JsonLang Extension for Mathematical Operations
npm install @jsonlang/mathIt is JsonLang Plugin/Extension for Math operations.










``bash`
npm install @jsonlang/core @jsonlang/math
` js
import { JsonLang } from '@jsonlang/core';
import { MathRules } from '@jsonlang/math';
const jsonLang = new JsonLang();
jsonLang.import(MathRules);
`
* IsNumber
* Input[]: Array
* Output: Boolean (true or false).
* Description: Check if the value dataType is a number or not.
* Sum or +
* Input[]: Array
* Output: number.
* Description: Used to Sum all values. i.e. Input1 + Input2 + .... + InputN.
* Subtract or -
* Input[]: Array
* Output: number.
* Description: Used to Subtract all values. i.e. Input1 - Input2 - .... - InputN.
Multiply or \
* Input[]: Array
* Output: number.
Description: Used to Multiply all values. i.e. Input1 Input2 .... InputN.
* Divide or /
* Input[]: Array
* Output: number.
* Description: Used to Divide all values. i.e. Input1 / Input2 / .... / InputN.
* More...
`js
import { JsonLang } from '@jsonlang/core';
import { MathRules } from '@jsonlang/math';
const jsonLang = new JsonLang();
jsonLang.import(MathRules);
jsonLang.execute( { "$R": "+" , "$I": [10, 20] }, undefined, { sync: true }); // 30
`
This library uses Array.map and Array.reduce`, so it's not exactly Internet Explorer 8 friendly.
JsonLang/Math is MIT licensed