0.2.4 • Published 3 years ago

@heppokofrontend/flat-deep v0.2.4

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

@heppokofrontend/flat-deep

MIT License Published on NPM test workflow npm.io Maintainability Test Coverage Known Vulnerabilities @heppokofrontend/flat-deep

The flatDeep() method creates a new array with all sub-iterables elements concatenated into it recursively up.

Usage

Installation:

npm install --save @heppokofrontend/flat-deep

Example:

import { flatDeep } from '@heppokofrontend/flat-deep';

const map = new Map();
const set = new Set();
const arr = [
  0,
  'hoge',
  [
    1,
    2,
    [
      set,
      map,
    ],
  ],
  6,
];

set.add(3);
map.set(4, [5]);

console.log(flatDeep(arr)); // > [0, 'hoge', 1, 2, 3, 4, 5, 6]

Syntax

flatDeep(iterable, options);

Parameters

iterable

The iterable object to be flattened.

For Example:

  • Array
  • Set
  • Map
  • NodeList
  • HTMLCollection

options

propertytypedefaultrequireddescription
stringIgnorebooleantruenoneWhether to ignore the string type.
circularReferenceToJsonbooleanfalsenoneIf a circular reference is found, convert it to JSON without ignoring it. The circular reference will be replaced by the string [Circular] (see fast-safe-stringify).

Contributing

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request :D

License

MIT

0.2.4

3 years ago

0.2.3

3 years ago

0.2.2

3 years ago

0.2.1

3 years ago

0.2.0

3 years ago

0.1.1

3 years ago

0.1.0

3 years ago