@extendscript/aes.patch.json.instantiate

1.0.0 • Public • Published

json.instantiate

version

Extension

Adds instantiate() to JSON. A simple tool for instantiating JSON Schemas.

Source: tomarad/JSON-Schema-Instantiator

Install

npm install @extendscript/aes.patch.json.instantiate

Include

#include 'node_modules/@extendscript/aes.patch.json.instantiate/instantiate.js'

Use

var schema = {
    "type": "object",
    "properties": {
        "title": {
            "type": "string",
            "default": "Example"
        },
        "description": {
            "type": "string"
        }
    },
    "required": ["title"]
};

instance = JSON.instantiate(schema);
// instance === { title: "Example", description: "" }

instance = JSON.instantiate(schema, {requiredPropertiesOnly: false});
// instance === { title: "Example", description: "" }

instance = JSON.instantiate(schema, {requiredPropertiesOnly: true});
// instance === { title: "Example" }

Test

You can test the code against a range of targets:

npm run test target-1 target-2

We keep a log of test results

Dependencies (0)

    Dev Dependencies (6)

    Package Sidebar

    Install

    npm i @extendscript/aes.patch.json.instantiate

    Weekly Downloads

    3

    Version

    1.0.0

    License

    MIT

    Unpacked Size

    11.1 kB

    Total Files

    6

    Last publish

    Collaborators

    • extendscripter
    • fabianmoronzirfas
    • fabian.moron.zirfas
    • vogelino