Slicing collections into smaller pieces
So far we've seen how collections can be filtered, creating a new smaller collection. Lo-Dash supplies you with a number of functions that take existing arrays and produce one or more smaller arrays. For example, you might want a portion of the first part of any array—or a portion of the last part. Arrays can be divided into chunks of smaller arrays that are useful for batched processing. You can also use Lo-Dash array tools to remove duplicates, thus ensuring the uniqueness of your array.
First and last collection portions
With native JavaScript arrays, you can slice off the first portion of an array using the slice()
array method. Lo-Dash provides abstractions on top of the native array slice()
method that ...
Get Lo-Dash Essentials now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.