@tomsd/coflater
v1.0.1
Published
It flattens a deep object and restores a flattened object.
Downloads
5
Readme
coflater
It flattens a deep object and restores a flattened object.
Installation
npm install @tomsd/coflater
Usage
import { Coflater } from "@tomsd/coflater";
const coflater = new Coflater();
const original = {
a: {
b: {
c: 1,
d: false,
}
},
z: "s",
};
const deflated = coflater.deflate(original);
console.log(deflated); // {"a.b.c": 1, "a.b.d": false, z: "s" }
const inflated = coflater.inflate(deflated);
console.log(inflated); // equals to original