1.0.6 • Published 11 months ago

@galaxar/jsonx v1.0.6

Weekly downloads
-
License
MIT
Repository
-
Last release
11 months ago

@galaxar/jsonx

JSON Expression

Installation

pnpm install @galaxar/jsonx

Init locales

Rules

  • Each jxs object can only has one $operator at a level

Wrong usage

// If you want to check if key1 is greater than 2, below usage is wrong
// The first element will return { key1: false } which is treated as true, thus the result will be 'positive'
Jxs.evaluate(
    {
        key1: 1.5,
    },
    {
        $if: [{ key1: { $match: { $gt: 2 } } }, { $value: 'positive' }, { $value: 'non-positive' }],
    }
).should.be.eql('non-positive');

// Correct usage should be
Jxs.evaluate(
    {
        key1: 1.5,
    },
    {
        $if: [{ $match: { key1: { $gt: 2 } } }, { $value: 'positive' }, { $value: 'non-positive' }],
    }
).should.be.eql('non-positive');
1.0.6

11 months ago

1.0.5

11 months ago

1.0.4

11 months ago

1.0.3

12 months ago

1.0.2

12 months ago

1.0.1

1 year ago

1.0.0

1 year ago