JsonLang Extension for (Key-Value pair) Object/Map Operations
npm install @jsonlang/objectIt is JsonLang Plugin/Extension for Object operations.










``bash`
npm install @jsonlang/core @jsonlang/object
` js
import { JsonLang } from '@jsonlang/core';
import { ObjectRules } from '@jsonlang/object';
const jsonLang = new JsonLang();
jsonLang.import(ObjectRules);
`
* Get [In Progress]
* Input[]: Array
* Output: Any.
* Description: It accepts two inputs, the 1st one (required) is a path to get the Data, and the 2nd one (optional) is a default value of the path is not found. the path must follow the dotted style var1.var2 for nested fields and brackets with number for arrays var1.var2[3].var3
* Set [In Progress]
* Input[]: Array
* Output: Any.
* Description: It accepts two inputs. The 1st one (required) is a path to update/mutate the Data, and the 2nd one is the value to set. the path must follow the dotted style var1.var2 for nested fields and brackets with number for arrays var1.var2[3].var3. If the path does not exist, the Set Rule will create it.
* Update [In Progress]
* Input[]: Array
* Output: Any.
* Description: It accepts two inputs. The 1st one (required) is a path to update/mutate the Data, and the 2nd one is the value to update. the path must follow the dotted style var1.var2 for nested fields and brackets with number for arrays var1.var2[3].var3. If the path does not exist, the Update rule won't do anything.
* Delete [In Progress]
* Input[]: Array
* Output: Any.
* Description: It accepts two inputs, a path to mutate the Data by deleting a field in the request path. the path must follow the dotted style var1.var2 for nested fields and brackets with number for arrays var1.var2[3].var3. If the path does not exist, the Delete rule won't do anything.
* More...
`js
import { JsonLang } from '@jsonlang/core';
import { ObjectRules } from '@jsonlang/object';
const jsonLang = new JsonLang();
jsonLang.import(ObjectRules);
jsonLang.execute(
{ $R: 'Get', $I: ['data.test', null, { $R: 'Data', $I: ['External'] }] },
{ data: { id: '1', test: 100 } },
{ sync: true }
); // 100
`
This library uses Array.map and Array.reduce`, so it's not exactly Internet Explorer 8 friendly.
JsonLang/Object is MIT licensed