Lodash教程

Lodash array

Lodash 有许多易于使用的方法来帮助处理数组。本章将详细讨论它们。
Lodash 提供了各种方法来处理下面列出的数组-
方法和语法
_.chunk(array, [size=1])
_.compact(array)
_.concat(array, [values])
_.difference(array, [values])
_.differenceBy(array, [values], [iteratee=_.identity])
_.differenceWith(array, [values], [comparator])
_.drop(array, [n=1])
_.dropRight(array, [n=1])
_.dropRightWhile(array, [predicate=_.identity])
_.dropWhile(array, [predicate=_.identity])
_.fill(array, value, [start=0], [end=array.长度])
_.findIndex(array, [predicate=_.identity], [fromIndex=0] )
_.findLastIndex(array, [predicate=_.identity], [fromIndex=array.长度-1])
_.flatten(array)
_.flattenDeep(array)
_.flattenDepth(array, [depth=1])
_.fromPairs(pairs)
_.head(array)
_.indexOf(array, value, [fromIndex=0])
_.initial(array)
_.intersection([arrays])
_.intersectionBy([arrays], [iteratee=_.identity])
_.intersectionWith([arrays], [comparator])
_.join(array, [separator=','])
_.last(array)
_.lastIndexOf(array, value, [fromIndex=array.length-1])
_.nth(array, [n=0])
_.pull(array, [values])
_.pullAll(array, values)
_.pullAllBy(array, values, [iteratee=_.identity])
_.pullAllWith(array, values, [comparator])
_.pullAt(array, [indexes])
_.remove(array, [predicate=_.identity])
_.reverse(array)
_.slice(array, [start=0], [end=array.length] )
_.sortedIndex(array, value)
_.sortedIndexBy(array, value, [iteratee=_.identity])
_.sortedIndexOf(array, value)
_.sortedLastIndex(array, value)
_.sortedLastIndexBy(array, value, [iteratee=_.identity])
_.sortedLastIndexOf(array, value)
_.sortedUniq(array)
_.sortedUniqBy(array, [iteratee])
_.tail(array)
_.take(array, [n=1])
_.takeRight(array, [n=1])
_.takeRightWhile(array, [predicate=_.identity])
_.takeWhile(array, [predicate=_.identity])
_.union([arrays])
_.unionBy([arrays], [iteratee=_.identity])
_.unionWith([arrays], [comparator])
_.uniq(array)
_.uniqBy(array, [iteratee=_.identity])
_.uniqWith(array, [comparator])
_.unzip(array)
_.unzipWith(array, [iteratee=_.identity])
_.without(array, [values])
_.xor([arrays])
_.xorBy([arrays], [iteratee=_.identity])
_.xorWith([arrays], [comparator])
_.zip([arrays])
_.zipObject([props=[]], [values=[]])
_.zipObjectDeep([props=[]], [values=[]])
_.zipWith([arrays], [iteratee=_.identity])
昵称: 邮箱:
Copyright © 2022 立地货 All Rights Reserved.
备案号:京ICP备14037608号-4