Skip to content
This repository was archived by the owner on Feb 4, 2025. It is now read-only.
This repository was archived by the owner on Feb 4, 2025. It is now read-only.

'<=' operator does not distinguish 0 and null, should be '<==' #30

@gasp

Description

@gasp

let's consider this rule, looking for values between or equals 0 and 1

const rule = { '<=': [0, { var: 'data' }, 1] };

with data being 0, it works

const zeroInput = { data: 0 };
const zeroArrayInput = { data: [0] };
jsonLogic.apply(rule, zeroInput); // returns true
jsonLogic.apply(rule, zeroArrayInput); // returns true

with data being null, this is wrongly interpreted

const nullInput = { data: null };
jsonLogic.apply(rule, nullInput); // returns true, whereas it should be returning false

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions