flatten

2018-10-12 admin

flatten是什么

什么是flatten,Flatten arbitrarily nested arrays into a non-nested list of non-array items

flatten使用教程帮助文档

flatten

A tiny utility to flatten arrays of arrays (of arrays, etc., recursively, infinitely or to an optional depth) into a single array of non-arrays.

example:

> var flatten = require('flatten');
undefined
> flatten([1, [2, 3], [4, 5, 6], [7, [8, 9]], 10])
[ 1,
  2,
  3,
  4,
  5,
  6,
  7,
  8,
  9,
  10 ]
> flatten([1, [2, [3, [4, [5]]]]], 2)
[ 1,
  2,
  3,
  [ 4, [ 5 ] ] ]

install:

npm install flatten

license:

MIT/X11.

本站文章除注明转载外,均为本站原创或编译。欢迎任何形式的转载,但请务必注明出处。

转载请注明:文章转载自 JavaScript中文网 [https://www.javascriptcn.com]

本文地址:https://www.javascriptcn.com/read-42523.html

文章标题:flatten

相关文章
just-flatten-it
just-flatten-it是什么 什么是just-flatten-it,return a flattened array just-flatten-it官网:官网 just-flatten-it源码仓库:源码仓库 just-flatt...
2018-12-02
utils-flatten
utils-flatten是什么 什么是utils-flatten,flatten() utility function utils-flatten官网:官网 utils-flatten源码仓库:源码仓库 utils-flatten下载地...
2018-12-02
flatten-array
flatten-array是什么 什么是flatten-array,Recursively flattens an Array flatten-array官网:官网 flatten-array源码仓库:源码仓库 flatten-array...
2018-12-02
回到顶部