Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

134
Visualizações
fuse.js: ability to fallback on default behaviour in case of declaring getFn option

Example: In our code we have an object with the next type

{
  person: {
   name: string,
  },
  status: string,
  date: Date,
}

on the UI we have formatted date and want to search by this field.

As I understand getFn option is what we need.

The only question - is it possible to have a fallback to the default lib behaviour in case if we don't need any adjustment in the code

For now our fn looks like this (raw version that handle only two level depth)

getFn: (obj, path) => {
        if (path.length === 1 && path[0] === 'date') {
          return format(obj[path[0]], DATE_FORMAT)
        }
        console.log({obj, path })
        return path.length === 1 ? obj[path[0]] : (obj[path[0]] && obj[path[0]][path[1]])
      },

Thanks in advance for any suggestions!

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda