Socket
Book a DemoInstallSign in
Socket

@galaxar/jsonx

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@galaxar/jsonx

JSON Expression Syntax

npmnpm
Version
1.0.3
Version published
Maintainers
1
Created
Source

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

Keywords

galaxar

FAQs

Package last updated on 21 May 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts