@tomsd/coflater
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

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

Readme

Keywords

none

Package Sidebar

Install

npm i @tomsd/coflater

Weekly Downloads

1

Version

1.0.1

License

MIT

Unpacked Size

11.7 kB

Total Files

8

Last publish

Collaborators

  • tomsd