How to use the allKeys function from underscore

Find comprehensive JavaScript underscore.allKeys code examples handpicked from public code repositorys.

5741
5742
5743
5744
5745
5746
5747
5748
5749
5750
// Return a copy of the object only containing the whitelisted properties.
_.pick = function(object, oiteratee, context) {
  var result = {}, obj = object, iteratee, keys;
  if (obj == null) return result;
  if (_.isFunction(oiteratee)) {
    keys = _.allKeys(obj);
    iteratee = optimizeCb(oiteratee, context);
  } else {
    keys = flatten(arguments, false, false, 1);
    iteratee = function(value, key, obj) { return key in obj; };
fork icon0
star icon2
watch icon0