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

192
Visualizações
Is RETE algorithm still relevant in year 2022 OR we have better alternatives, do we have any other stable rule engine libs in JavaScript except nools?

I am working with a user input that has to be processed based on the set of rules. Using nools but its a pain in the back when comes to javascript ES6 operations like IIFE, map-reduce, nested sort.

Talking about RETE algo in 2022 might sound overwhelming but its really handy and makes sense. I've been using nools(which is deprecated and no more supported, Duh!) and it works just fine when you define straight forward when-> then.

But if I want to do some JS operation on the output, sometimes it runs and fails sometimes. This behavior makes me think if I am doing something wrong OR its not stable anymore(as not actively supported now)

What I am trying to do: My data has a very bad DS pattern with nested array objects and strings together.

Data->

const matchOutput = [
  {
    X: ['None'],
    Y: ['None'],
    Z: ['1 mg/m3 STEL'],
    A: ['None'],
    name: 'AMER'
  },
  {
    X: [
      '2 mg/m3 TWA (as Sn) Inhalable fraction.',
      '0.2 mg/m3 STEL (as Sn)',
      '0.1 mg/m3 TWA (as Sn)'
    ],
    Y: ['0.1 mg/m3 PEL (as Sn)', '0.1 mg/m3 TWA (as Sn)'],
    Z: ['None'],
    A: ['0.1 mg/m3 REL (as Sn)'],
    name: '2-ethylhexanoate;tin(2+)'
  },
  {
    X: ['0.5 mg/m3 TWA (as Hf)'],
    Y: ['None'],
    Z: ['None'],
    A: ['0.5 mg/m3 REL (as Hf)'],
    name: 'Hafnium dioxide'
  },
  {
    X: ['300 ppm STEL', '200 ppm STEL'],
    Y: ['200 ppm PEL', '300 ppm PEL-STEL', '200 ppm TWA'],
    Z: ['None'],
    A: ['200 ppm REL', '300 ppm REL'],
    name: 'MEK'
  }
];

Inside my nools rule, I am doing a sort operation once it matches.

matchOutput.sort(()=>{
            exposureControlList.forEach(obj => {
                for (let key in obj) {
                    if (key !== 'name'){
                        obj[key].sort((a, b) => b.localeCompare(a, 'en', { numeric: true }))});
                    } 
                }
            exposureControlList.sort((a, b) => a.name.localeCompare(b.name, 'en'));
            return exposureControlList;
        });

Which should sort the inner array into desc numeric values and outer array on key name.

This sort function is working fine if in a JS file you put the data and do above sort function, but in .nools file it fails.

I am relatively new to nools, so few queries:

  1. I could not find any extension in VS Code to see .nools file properly (not in plain text)
  2. If the function is wrong, is there any way to debug the .nools file?
  3. Can you independently test a .nools file?

Thanks for your time.

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