UNPKG

object.pluck

Version:

Like pluck from underscore / lo-dash, but returns an object composed of specified properties, with values unmodified from those of the original object.

18 lines (14 loc) 353 B
/*! * object.pluck <https://github.com/jonschlinkert/object.pluck> * * Copyright (c) 2014 Jon Schlinkert, contributors. * Licensed under the MIT License */ 'use strict'; var map = require('object.map'); var get = require('get-value'); module.exports = function pluck(o, key) { return map(o, function (obj) { return get(obj, key); }); };