How to use the pluck function from lodash
Find comprehensive JavaScript lodash.pluck code examples handpicked from public code repositorys.
4521 4522 4523 4524 4525 4526 4527 4528 4529
* var characters = [ * { 'name': 'barney', 'age': 36 }, * { 'name': 'fred', 'age': 40 } * ]; * * _.pluck(characters, 'name'); * // => ['barney', 'fred'] */ var pluck = map;
73
711
29
+ 9 other calls in file
217 218 219 220 221 222 223 224 225 226
return baseUtils.tagUpdate.tagsAreEqual(currentTag, newTag); }); }); // Tags from the new tag array which don't exist in the DB should be created tagsToCreate = _.pluck(_.reject(newTags, function (newTag) { return _.any(existingTags, function (existingTag) { return baseUtils.tagUpdate.tagsAreEqual(existingTag, newTag); }); }), 'name');
0
1
2
249 250 251 252 253 254 255 256 257 258
return result; }; // TODO: test it this.getAllowedTimeZonesName = function() { return _.pluck(consts.TIME_ZONES, 'name'); }; // TODO: test it this.getOffsetByTimeZone = function(tzName) {
0
1
0
28 29 30 31 32 33 34 35 36 37
return presence.getSockets(socketIds); }) .then(function(_sockets) { //console.log(_sockets); sockets = _.sortBy(_.values(_sockets), 'createdTime'); var troupeIds = _.pluck(sockets, 'troupeId'); return troupeService.findByIdsLean(troupeIds, { uri: 1 }); }) .then(function(troupes) { // just modify it in place
0
0
0
1071 1072 1073 1074 1075 1076 1077 1078 1079 1080
return copies && copies[index]; } function getArrayCopies(key) { const service = this; return _.pluck(service.getArrayScopes(key), 'form'); } function getArrayCopiesFor(keyStart) { const service = this;
0
0
0
+ 2 other calls in file
437 438 439 440 441 442 443 444 445 446
async.detectSeries(_.values(Constants.NETWORKS), function(network, nextNetwork) { var bc = self._getBlockchainExplorer(network); bc.getTransaction(opts.identifier, function(err, tx) { if (err || !tx) return nextNetwork(err, false); var outputs = _.first(self._normalizeTxHistory(tx)).outputs; var toAddresses = _.pluck(outputs, 'address'); async.detect(toAddresses, function(addressStr, nextAddress) { self.storage.fetchAddress(addressStr, function(err, address) { if (err || !address) return nextAddress(err, false); walletId = address.walletId;
0
0
0
+ 15 other calls in file
lodash.get is the most popular function in lodash (7670 examples)