ts-flatten
TypeScript icon, indicating that this package has built-in type declarations

0.0.1 • Public • Published

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

Package Sidebar

Install

npm i ts-flatten

Weekly Downloads

2

Version

0.0.1

License

MIT

Unpacked Size

8.83 kB

Total Files

18

Last publish

Collaborators

  • evandrolg