jutils-schema-mapping
v0.1.4
Published
A JSON oriented package to transfrom a schema to another schema.
Downloads
1
Readme
JSON Utils - Schema Mapping
A JSON oriented package to transfrom a schema to another schema.
Installation
npm install --save jutils-schema-mapping
or
yarn add jutils-schema-mapping
Usage
- Basic usage
const { convert } = require('jutils-schema-mapping');
let output = convert(
{ name: "myName" },
[ // A series of mapping rules.
{
name: "__root__", // Default entry rule name.
rules: [
["$.name", "string.uppercase", "T.user.name"]
]
}
]
)
/**
* output = {
* user: {
* name: "MYNAME"
* }
* }
*/
More examples
Please see those examples under the 'examples/' folder.
Mapping rule schema
export class StringStyledMappingRule {
name: string;
rules: Rule[];
}
Pipe schema
Pull data
Powered by json-path
Transform data
string.uppercase
,object.get('name')
Push data
T.name
,T.person.name