MCPcopy
hub / github.com/stemkoski/stemkoski.github.com / omit

Function omit

MathBox/mathbox-bundle.js:37868–37893  ·  view source on GitHub ↗

* Creates a shallow clone of `object` excluding the specified properties. * Property names may be specified as individual arguments or as arrays of * property names. If a callback is provided it will be executed for each * property of `object` omitting the properties the callback retu

(object, callback, thisArg)

Source from the content-addressed store, hash-verified

37866 * // => { 'name': 'fred' }
37867 */
37868 function omit(object, callback, thisArg) {
37869 var result = {};
37870 if (typeof callback != 'function') {
37871 var props = [];
37872 forIn(object, function(value, key) {
37873 props.push(key);
37874 });
37875 props = baseDifference(props, baseFlatten(arguments, true, false, 1));
37876
37877 var index = -1,
37878 length = props.length;
37879
37880 while (++index < length) {
37881 var key = props[index];
37882 result[key] = object[key];
37883 }
37884 } else {
37885 callback = lodash.createCallback(callback, thisArg, 3);
37886 forIn(object, function(value, key, object) {
37887 if (!callback(value, key, object)) {
37888 result[key] = value;
37889 }
37890 });
37891 }
37892 return result;
37893 }
37894
37895 /**
37896 * Creates a two dimensional array of an object's key-value pairs,

Callers

nothing calls this directly

Calls 4

forInFunction · 0.85
baseDifferenceFunction · 0.85
baseFlattenFunction · 0.85
callbackFunction · 0.70

Tested by

no test coverage detected