How to use the values function from underscore

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

761
762
763
764
765
766
767
768
769
770
  return
}

if (thisThrow.formulaParts.length
  && _.contains(
    _.values(FORMULA_PART_TYPES.operands),
    thisThrow.formulaParts[thisThrow.formulaParts.length - 1].type
  )
) {
  // If the previous part is not an operator, this being an operand doesn't make a whole
fork icon2
star icon5
watch icon1

+ 7 other calls in file

872
873
874
875
876
877
878
879
880
881
        }
    }
    const absFolderPath = path.join(fullPath, folderPath);
    return (fullPaths[folder._id] = absFolderPath);
});
const pathsArray = _.values(fullPaths);
const pathsArrayPromises = _.map(
    pathsArray,
    (folderPath) => () =>
        new Promise(async (resolve, reject) => {
fork icon0
star icon2
watch icon0

+ 3 other calls in file

568
569
570
571
572
573
574
575
576
577
    Utils.nonCloneable
);

newEntry = _.extend(newEntry, _.pick(entry, entryValidPaths));
newEntry = _.defaults(newEntry, entryDefaults);
newEntry.handler = _.values(EntryType).includes(entry.handler)
    ? entry.handler
    : EntryType.UnkownEntry;
if (isRoot) {
    const entryExtensions = {
fork icon0
star icon2
watch icon0

2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
// Safely create a real, live array from anything iterable.
_.toArray = function(obj) {
  if (!obj) return [];
  if (_.isArray(obj)) return slice.call(obj);
  if (obj.length === +obj.length) return _.map(obj, _.identity);
  return _.values(obj);
};

// Return the number of elements in an object.
_.size = function(obj) {
fork icon0
star icon2
watch icon0

+ 6 other calls in file

196
197
198
199
200
201
202
203
204
205
  'contains', 'invoke', 'toArray', 'first', 'initial', 'rest',
  'last', 'without', 'isEmpty', 'pluck'];

_.each(methods, function(method) {
  Container.prototype[method] = function() {
    var elements = _.values(this._elements);
    var args = [elements].concat(_.toArray(arguments));
    return _[method].apply(_, args);
  };
});
fork icon0
star icon3
watch icon2

76
77
78
79
80
81
82
83
84
85
options.templateOptions = _.extend({}, DEFAULT_TEMPLATE_OPTIONS, options.templateOptions)

// Generates codepoints starting from `options.startCodepoint`,
// skipping codepoints explicitly specified in `options.codepoints`
var currentCodepoint = options.startCodepoint
var codepointsValues = _.values(options.codepoints)
function getNextCodepoint() {
	while (_.contains(codepointsValues, currentCodepoint)) {
		currentCodepoint++
	}
fork icon0
star icon1
watch icon1

743
744
745
746
747
748
749
750
751
752
_.toArray = function(iterable) {
  if (!iterable)                return [];
  if (iterable.toArray)         return iterable.toArray();
  if (_.isArray(iterable))      return slice.call(iterable);
  if (_.isArguments(iterable))  return slice.call(iterable);
  return _.values(iterable);
};

// Return the number of elements in an object.
_.size = function(obj) {
fork icon0
star icon0
watch icon1

+ 6 other calls in file