Build lodash.pick from Scratch

InstructorJamund Ferguson

Share this video with your friends

Send Tweet

_.pick and its sibling _.omit are popular utilities which apply filter-like functionality to objects. This lesson will demonstrate two different techniques for building the functionality found in _.pick.

  1. Using for...of to loop through the keys array
  2. Using for..in to loop through the target object

This lesson will also cover how to emulate _.pick's support for either an array or multiple arguments for the picked keys using Rest params and Array.prototype.flat().