Skip to content

tomsdoo/coflater

Repository files navigation

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

About

It flattens a deep object and restores a flattened object.

Resources

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published