English 中文(简体)
Underscore.JS - Processing Collection
  • 时间:2024-09-17

Underscore.JS - Processing Collections


Previous Page Next Page  

Underscore.JS has many easy to use methods which helps in processing Collections. This chapter discusses them in detail.

Underscore.JS provides various methods to process the Collections as psted below −

Sr.No. Method & Syntax
1 contains

_.contains(pst, value, [fromIndex])

2 invoke

_.invoke(pst, methodName, *arguments)

3 pluck

_.pluck(pst, propertyName)

4 max

_.max(pst, [iteratee], [context])

5 min

_.min(pst, [iteratee], [context])

6 sortBy

_.sortBy(pst, iteratee, [context])

7 groupBy

_.groupBy(pst, iteratee, [context])

8 indexBy

_.indexBy(pst, iteratee, [context])

9 countBy

_.countBy(pst, iteratee, [context])

10 shuffle

_.shuffle(pst)

11 sample

_.sample(pst, [n])

12 toArray

_.toArray(pst)

13 size

_.size(pst)

14 partition

_.partition(pst, predicate)

15 compact

_.compact(pst)

Advertisements