1.1.4 • Published 6 years ago

json-dry-factory v1.1.4

Weekly downloads
2
License
MIT
Repository
github
Last release
6 years ago

JSON dry Factory

create an JSON instance, and registered isolated serialization/deserialization handlers for custom classes.

Importantly, it is possible that a Class is registered with multiple JSON-dry instances. Will not affect each other.

This is very important. For example, during process communication, different modules may need to register a specific serialization deserialization scheme for the Error object. Use this library to ensure that this Error class can serve multiple modules at the same time.

DEMO

import { JSONDryFactory } from "json-dry-factory";
const jsonFac = new JSONDryFactory("test1");
const json = jsonFac.stringify({
    a: "QAQ",
    r: /z\d([1-z]+?)/g,
    mix: { '4': 3, o: new Date(), 0: "1" },
    e: new Error('cccc'),
    deep: {
        a: {
            b: {
                x: /44/,
                c: {
                    m: "ccc",
                    s: /cc/
                }
            },
            xx: "432cc1",
            x: 4321,
            bb: /cf/
        }
    }
});
console.log(json);
const obj = jsonFac.parse(json);
console.log('-----------------------');
console.log(obj);
1.1.4

6 years ago

1.1.3

6 years ago

1.1.2

6 years ago

1.1.1

6 years ago

1.1.0

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago