1.0.0 • Published 8 years ago
json-length v1.0.0
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
1.0.0
8 years ago