{ "version": 3, "sources": ["../lib/main.js", "../lib/index.js"], "sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar isObject = require( '@stdlib/assert-is-object' );\nvar isFunction = require( '@stdlib/assert-is-function' );\nvar getPrototypeOf = require( '@stdlib/utils-get-prototype-of' );\nvar hasOwnProp = require( '@stdlib/assert-has-own-property' );\nvar nativeClass = require( '@stdlib/utils-native-class' );\n\n\n// VARIABLES //\n\nvar objectPrototype = Object.prototype;\n\n\n// FUNCTIONS //\n\n/**\n* Tests that an object only has own properties.\n*\n* @private\n* @param {Object} obj - value to test\n* @returns {boolean} boolean indicating if an object only has own properties\n*/\nfunction ownProps( obj ) {\n\tvar key;\n\n\t// NOTE: possibility of perf boost if key enumeration order is known (see http://stackoverflow.com/questions/18531624/isplainobject-thing).\n\tfor ( key in obj ) {\n\t\tif ( !hasOwnProp( obj, key ) ) {\n\t\t\treturn false;\n\t\t}\n\t}\n\treturn true;\n}\n\n\n// MAIN //\n\n/**\n* Tests if a value is a plain object.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a plain object\n*\n* @example\n* var bool = isPlainObject( {} );\n* // returns true\n*\n* @example\n* var bool = isPlainObject( null );\n* // returns false\n*/\nfunction isPlainObject( value ) {\n\tvar proto;\n\n\t// Screen for obvious non-objects...\n\tif ( !isObject( value ) ) {\n\t\treturn false;\n\t}\n\t// Objects with no prototype (e.g., `Object.create( null )`) are plain...\n\tproto = getPrototypeOf( value );\n\tif ( !proto ) {\n\t\treturn true;\n\t}\n\t// Objects having a prototype are plain if and only if they are constructed with a global `Object` function and the prototype points to the prototype of a plain object...\n\treturn (\n\t\t// Cannot have own `constructor` property:\n\t\t!hasOwnProp( value, 'constructor' ) &&\n\n\t\t// Prototype `constructor` property must be a function (see also https://bugs.jquery.com/ticket/9897 and http://stackoverflow.com/questions/18531624/isplainobject-thing):\n\t\thasOwnProp( proto, 'constructor' ) &&\n\t\tisFunction( proto.constructor ) &&\n\t\tnativeClass( proto.constructor ) === '[object Function]' &&\n\n\t\t// Test for object-specific method:\n\t\thasOwnProp( proto, 'isPrototypeOf' ) &&\n\t\tisFunction( proto.isPrototypeOf ) &&\n\n\t\t(\n\t\t\t// Test if the prototype matches the global `Object` prototype (same realm):\n\t\t\tproto === objectPrototype ||\n\n\t\t\t// Test that all properties are own properties (cross-realm; *most* likely a plain object):\n\t\t\townProps( value )\n\t\t)\n\t);\n}\n\n\n// EXPORTS //\n\nmodule.exports = isPlainObject;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Test if a value is a plain object.\n*\n* @module @stdlib/assert-is-plain-object\n*\n* @example\n* var isPlainObject = require( '@stdlib/assert-is-plain-object' );\n*\n* var bool = isPlainObject( {} );\n* // returns true\n*\n* bool = isPlainObject( null );\n* // returns false\n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAW,QAAS,0BAA2B,EAC/CC,EAAa,QAAS,4BAA6B,EACnDC,EAAiB,QAAS,gCAAiC,EAC3DC,EAAa,QAAS,iCAAkC,EACxDC,EAAc,QAAS,4BAA6B,EAKpDC,EAAkB,OAAO,UAY7B,SAASC,EAAUC,EAAM,CACxB,IAAIC,EAGJ,IAAMA,KAAOD,EACZ,GAAK,CAACJ,EAAYI,EAAKC,CAAI,EAC1B,MAAO,GAGT,MAAO,EACR,CAmBA,SAASC,EAAeC,EAAQ,CAC/B,IAAIC,EAGJ,OAAMX,EAAUU,CAAM,GAItBC,EAAQT,EAAgBQ,CAAM,EACxBC,EAML,CAACR,EAAYO,EAAO,aAAc,GAGlCP,EAAYQ,EAAO,aAAc,GACjCV,EAAYU,EAAM,WAAY,GAC9BP,EAAaO,EAAM,WAAY,IAAM,qBAGrCR,EAAYQ,EAAO,eAAgB,GACnCV,EAAYU,EAAM,aAAc,IAI/BA,IAAUN,GAGVC,EAAUI,CAAM,GArBV,IALA,EA6BT,CAKAX,EAAO,QAAUU,IC1EjB,IAAIG,EAAO,IAKX,OAAO,QAAUA", "names": ["require_main", "__commonJSMin", "exports", "module", "isObject", "isFunction", "getPrototypeOf", "hasOwnProp", "nativeClass", "objectPrototype", "ownProps", "obj", "key", "isPlainObject", "value", "proto", "main"] }