0.0.1 • Published 2 years ago

ts-flatten v0.0.1

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

ts-flatten

A utility function that takes in a value and returns a flatted version of that value

Installation

  npm install ts-flatten

Usage

const param = new Map([
  [[[[1, 2, 3, 4], new Set()]]],
  ['a', 1],
  ['b', null],
  ['c', { a: 1, b: 2 }],
]);

flatten(param);
/*
  Output:
  Map(4) {
    [ 1, 2, 3, 4 ] => Set(0) {}
    'a' => 1,
    'b' => null,
    'c' => { a: 1, b: 2 },
  }
*/

License

MIT