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

相关文章
【每日一包0005】arr-flatten
github地址:https://github.com/ABCDdouyae… arr-flatten 将多维数组展开成一维数组 文档地址:https://www.npmjs.com/package/arr-flatten 用法:arr...
2018-11-13
component-flatten
component-flatten是什么 什么是component-flatten,flatten a resolved component tree component-flatten官网:官网 component-flatten源码仓...
2018-12-23
arr-flatten
arr-flatten是什么 什么是arr-flatten,Recursively flatten an array or arrays. arr-flatten官网:官网 arr-flatten源码仓库:源码仓库 arr-flatten...
2018-12-02
utils-flatten
utils-flatten是什么 什么是utils-flatten,flatten() utility function utils-flatten官网:官网 utils-flatten源码仓库:源码仓库 utils-flatten下载地...
2018-12-02
flatten-vertex-data
flatten-vertex-data是什么 什么是flatten-vertex-data,flattens nested vertex data into a typed array flatten-vertex-data官网:官网 f...
2019-04-21
lodash._baseflatten
lodash._baseflatten是什么 什么是lodash._baseflatten,The internal lodash function baseFlatten exported as a module. lodash._ba...
2019-03-26
JavaScript 数组展开(扁平化)和underscore的 flatten
原文地址 数组展开就是将嵌套的数组扁平化(转换为一维的)eg: const arr=[[[1, 2], [1, 2, 3]], [1, 2]] => [1, 2, 1, 2, 3, 1, 2] console.log(flatten...
2019-05-31
回到顶部