How to use the unique function from lodash

Find comprehensive JavaScript lodash.unique code examples handpicked from public code repositorys.

150
151
152
153
154
155
156
157
158
159
160
161


    return vals.length > 0 ? op(vals) : null;
}


var __tagCombinators = {
    "union" : function(taglist) { return _.unique([].concat.apply([], taglist)).sort(); },
    "intersection" : function(taglist) { return _.intersection.apply(_, taglist).sort(); },
    "difference" : function(taglist) { return _.difference.apply(_, taglist).sort(); }
};

fork icon0
star icon0
watch icon0

265
266
267
268
269
270
271
272
273
274
let keys = _(form.components).map(getKeys).flatten().filter(function(key) {
  return !_.isUndefined(key);
}).values();

// Potential errors, because the empty key was included (potential duplicates).
if (keys.indexOf('') !== -1 || !_.isEqual(keys, _.unique(keys))) {
  form.components = cleanLayoutKeys(form.components, form._id);

  // Update the key list after cleaning erroneous form component layout keys.
  keys = _(form.components).map(getKeys).flatten().filter(function(key) {
fork icon0
star icon0
watch icon0

Other functions in lodash

Sorted by popularity

function icon

lodash.get is the most popular function in lodash (7670 examples)