1.0.0 • Published 7 years ago

json-length v1.0.0

Weekly downloads
1
License
MIT
Repository
-
Last release
7 years ago

json-length

Calculate length of stringified json without JSON.stringify.

const jsonLength = require("json-length");

const json = { ... };
const length = jsonLength(json);

// result of `jsonLength(json)` is equal to `JSON.stringify(json).length`
const jsonStringifyLength = JSON.stringify(json).length;
if(length === jsonStringifyLength){
    console.log("jsonLength(json) === JSON.stringify(json).length");
}

License

MIT