Skip to content

Object.stringify is enhanced version of JSON.stringify with extra support for functions inside stringified object.

License

Notifications You must be signed in to change notification settings

MarekZeman91/Object.stringify

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

Object.stringify

Object.stringify is enhanced version of JSON.stringify with extra support for functions inside stringified object.

Usage:

Stringify complex object with function.

function FN(a, b, c) {
    a += b; c += b;
    return a * c;
}
 
var obj = {
    string: 'string',
    number: 999,
    object: {
        array: ['abcd', 1234, true, undefined, null],
        boolean: false
    },
    boolean: true,
    function: FN
};
 
var result = Object.stringify(obj, 4);
 
/*
result = {
    "string": "string",
    "number": 999,
    "object": {
        "array": [
            "abcd",
            1234,
            true,
            null,
            null
        ],
        "boolean": false
    },
    "boolean": true,
    "function": "function FN(a, b, c) {\n    a += b; c += b;\n    return a * c;\n}"
}
*/

About

Object.stringify is enhanced version of JSON.stringify with extra support for functions inside stringified object.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published