Added the underscore node_module.
All checks were successful
Auto Maintenance Cycle / pre-commit Autoupdate (push) Successful in 39s
All checks were successful
Auto Maintenance Cycle / pre-commit Autoupdate (push) Successful in 39s
This commit is contained in:
40
node_modules/underscore/modules/_collectNonEnumProps.js
generated
vendored
Normal file
40
node_modules/underscore/modules/_collectNonEnumProps.js
generated
vendored
Normal file
@ -0,0 +1,40 @@
|
||||
import { nonEnumerableProps, ObjProto } from './_setup.js';
|
||||
import isFunction from './isFunction.js';
|
||||
import has from './_has.js';
|
||||
|
||||
// Internal helper to create a simple lookup structure.
|
||||
// `collectNonEnumProps` used to depend on `_.contains`, but this led to
|
||||
// circular imports. `emulatedSet` is a one-off solution that only works for
|
||||
// arrays of strings.
|
||||
function emulatedSet(keys) {
|
||||
var hash = {};
|
||||
for (var l = keys.length, i = 0; i < l; ++i) hash[keys[i]] = true;
|
||||
return {
|
||||
contains: function(key) { return hash[key] === true; },
|
||||
push: function(key) {
|
||||
hash[key] = true;
|
||||
return keys.push(key);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// Internal helper. Checks `keys` for the presence of keys in IE < 9 that won't
|
||||
// be iterated by `for key in ...` and thus missed. Extends `keys` in place if
|
||||
// needed.
|
||||
export default function collectNonEnumProps(obj, keys) {
|
||||
keys = emulatedSet(keys);
|
||||
var nonEnumIdx = nonEnumerableProps.length;
|
||||
var constructor = obj.constructor;
|
||||
var proto = (isFunction(constructor) && constructor.prototype) || ObjProto;
|
||||
|
||||
// Constructor is a special case.
|
||||
var prop = 'constructor';
|
||||
if (has(obj, prop) && !keys.contains(prop)) keys.push(prop);
|
||||
|
||||
while (nonEnumIdx--) {
|
||||
prop = nonEnumerableProps[nonEnumIdx];
|
||||
if (prop in obj && obj[prop] !== proto[prop] && !keys.contains(prop)) {
|
||||
keys.push(prop);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user