2.0.5 • Published 6 years ago
json-to-es2015 v2.0.5
Introduction
Generate sealed ES2015(ES6) model class files from json file.
Usage
Global install
You can use this package globally
npm
npm install -g json-to-es2015
yarn
yarn global add json-to-es2015
Example
file example.json
{
"key1":"any",
"key2":false,
"key3":null,
"key4":{
"key5": 12,
"key6": [
{
"key7": ""
}
]
}
}
json-to-es2015 ./example.json
will generate
- example
--- Example.js
--- Key4.js
--- Key6Value.js
Example.js
//This is a generated-file, do not modify.
import {Key4} from "./Key4";
export class Example {
constructor() {
this.key1 = undefined;
this.key2 = undefined;
this.key3 = undefined;
this.key4 = new Key4();
Object.seal(this);
}
}
Key4.js
//This is a generated-file, do not modify.
export class Key4 {
constructor() {
this.key5 = undefined;
this.key6 = [];
Object.seal(this);
}
}
Key6Value.js
//This is a generated-file, do not modify.
export class Key6Value {
constructor() {
this.key7 = undefined;
Object.seal(this);
}
}
Local project install
You can add package to your dev dependencies
npm
npm install -D json-to-es2015
yarn
yarn add --dev json-to-es2015
Then add a script entry in your package json and use it.
...
"scripts": {
"generate:example": "json-to-es2015 ./path-to-your-example.json"
}
Options
You can change default "undefined" value with -d or --default
json-to-es2015 ./example.json -d null
json-to-es2015 ./example.json -default null
2.0.5
6 years ago
2.0.4
6 years ago
2.0.3
6 years ago
2.0.2
6 years ago
2.0.1
6 years ago
2.0.0
6 years ago
1.0.27
6 years ago
1.0.26
7 years ago
1.0.25
7 years ago
1.0.24
7 years ago
1.0.23
7 years ago
1.0.22
7 years ago
1.0.21
7 years ago
1.0.20
7 years ago
1.0.19
7 years ago
1.0.18
7 years ago
1.0.17
8 years ago
1.0.16
8 years ago
1.0.15
8 years ago
1.0.14
8 years ago
1.0.13
8 years ago
1.0.12
8 years ago
1.0.11
8 years ago
1.0.10
8 years ago
1.0.9
8 years ago
1.0.8
8 years ago
1.0.7
8 years ago
1.0.6
8 years ago
1.0.5
8 years ago
1.0.4
8 years ago
1.0.3
8 years ago
1.0.2
8 years ago
1.0.1
8 years ago
1.0.0
8 years ago