jsoncram
v2.0.3
Published
Crams json into a smaller footprint and unpacks it.
Downloads
13
Maintainers
Readme
jsoncram
Crams json into a smaller footprint and unpacks it.
Install
npm i -D jsoncram
Usage
const { compress, decompress } = require('jsoncram');
const json = {
name: 'Sem Postma',
age: 21
};
const schema = {
type: "object",
required: [
"name",
"age"
],
properties: {
name: {
type: "string"
},
age: {
type: "number"
}
}
};
const compressed = compress(json, schema);
const decompressed = decompress(compressed, schema);
if (
json.name === decompressed.name
&& json.age === decompressed.age
) {
console.log('Yeeeeey');
}