Lodash Collection has many easy-to-use methods which help in processing Collections. This chapter discusses them in detail.
Lodash provides various methods to process the Collections as listed below −
Sr.No. | Method & Syntax |
---|---|
1 | countBy_.countBy(collection, [iteratee=_.identity]) |
2 | every_.every(collection, [predicate=_.identity]) |
3 | filter_.filter(collection, [predicate=_.identity]) |
4 | find_.find(collection, [predicate=_.identity], [fromIndex=0]) |
5 | findLast_.findLast(collection, [predicate=_.identity], [fromIndex=collection.length-1]) |
6 | flatMap_.flatMap(collection, [iteratee=_.identity]) |
7 | flatMapDeep_.flatMapDeep(collection, [iteratee=_.identity]) |
8 | flatMapDepth_.flatMapDepth(collection, [iteratee=_.identity], [depth=1]) |
9 | forEach_.forEach(collection, [iteratee=_.identity]) |
10 | forEachRight_.forEachRight(collection, [iteratee=_.identity]) |
11 | groupBy_.groupBy(collection, [iteratee=_.identity]) |
12 | includes_.includes(collection, value, [fromIndex=0]) |
13 | invokeMap_.invokeMap(collection, path, [args]) |
14 | keyBy_.keyBy(collection, [iteratee=_.identity]) |
15 | map_.map(collection, [iteratee=_.identity]) |
16 | orderBy_.orderBy(collection, [iteratees=[_.identity]], [orders]) |
17 | partition_.partition(collection, [predicate=_.identity]) |
18 | reduce_.reduce(collection, [iteratee=_.identity], [accumulator]) |
19 | reduceRight_.reduceRight(collection, [iteratee=_.identity], [accumulator]) |
20 | reject_.reject(collection, [predicate=_.identity]) |
21 | sample_.sample(collection) |
22 | sampleSize_.sampleSize(collection, [n=1]) |
23 | shuffle_.shuffle(collection) |
24 | size_.size(collection) |
25 | some_.some(collection, [predicate=_.identity]) |
26 | sortBy_.sortBy(collection, [iteratees=[_.identity]]) |
Next Topic – Click Here