@galaxar/jsonx

1.0.6 • Public • Published

@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');

Package Sidebar

Install

npm i @galaxar/jsonx

Weekly Downloads

4

Version

1.0.6

License

MIT

Unpacked Size

121 kB

Total Files

34

Last publish

Collaborators

  • rockie