MCPcopy
hub / github.com/stemkoski/stemkoski.github.com / shimIsPlainObject

Function shimIsPlainObject

MathBox/mathbox-bundle.js:36643–36659  ·  view source on GitHub ↗

* A fallback implementation of `isPlainObject` which checks if a given value * is an object created by the `Object` constructor, assuming objects created * by the `Object` constructor have no inherited enumerable properties and that * there are no `Object.prototype` extensions. *

(value)

Source from the content-addressed store, hash-verified

36641 * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
36642 */
36643 function shimIsPlainObject(value) {
36644 var ctor,
36645 result;
36646
36647 // avoid non Object objects, `arguments` objects, and DOM elements
36648 if (!(value && toString.call(value) == objectClass) ||
36649 (ctor = value.constructor, isFunction(ctor) && !(ctor instanceof ctor))) {
36650 return false;
36651 }
36652 // In most environments an object's own properties are iterated before
36653 // its inherited properties. If the last iterated property is an object's
36654 // own property then there are no inherited enumerable properties.
36655 forIn(value, function(value, key) {
36656 result = key;
36657 });
36658 return typeof result == 'undefined' || hasOwnProperty.call(value, result);
36659 }
36660
36661 /**
36662 * Used by `unescape` to convert HTML entities to characters.

Callers 1

runInContextFunction · 0.85

Calls 2

forInFunction · 0.85
isFunctionFunction · 0.70

Tested by

no test coverage detected