{ "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 nativeClass = require( '@stdlib/utils-native-class' );\nvar RE = require( '@stdlib/regexp-function-name' ).REGEXP;\nvar isBuffer = require( '@stdlib/assert-is-buffer' );\n\n\n// MAIN //\n\n/**\n* Determines the name of a value's constructor.\n*\n* @param {*} v - input value\n* @returns {string} name of a value's constructor\n*\n* @example\n* var v = constructorName( 'a' );\n* // returns 'String'\n*\n* @example\n* var v = constructorName( 5 );\n* // returns 'Number'\n*\n* @example\n* var v = constructorName( null );\n* // returns 'Null'\n*\n* @example\n* var v = constructorName( undefined );\n* // returns 'Undefined'\n*\n* @example\n* var v = constructorName( function noop() {} );\n* // returns 'Function'\n*/\nfunction constructorName( v ) {\n\tvar match;\n\tvar name;\n\tvar ctor;\n\tname = nativeClass( v ).slice( 8, -1 );\n\tif ( (name === 'Object' || name === 'Error') && v.constructor ) {\n\t\tctor = v.constructor;\n\t\tif ( typeof ctor.name === 'string' ) {\n\t\t\treturn ctor.name;\n\t\t}\n\t\tmatch = RE.exec( ctor.toString() );\n\t\tif ( match ) {\n\t\t\treturn match[ 1 ];\n\t\t}\n\t}\n\tif ( isBuffer( v ) ) {\n\t\treturn 'Buffer';\n\t}\n\treturn name;\n}\n\n\n// EXPORTS //\n\nmodule.exports = constructorName;\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* Determine the name of a value's constructor.\n*\n* @module @stdlib/utils-constructor-name\n*\n* @example\n* var constructorName = require( '@stdlib/utils-constructor-name' );\n*\n* var v = constructorName( 'a' );\n* // returns 'String'\n*\n* v = constructorName( {} );\n* // returns 'Object'\n*\n* v = constructorName( true );\n* // returns 'Boolean'\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,EAAc,QAAS,4BAA6B,EACpDC,EAAK,QAAS,8BAA+B,EAAE,OAC/CC,EAAW,QAAS,0BAA2B,EA+BnD,SAASC,EAAiBC,EAAI,CAC7B,IAAIC,EACAC,EACAC,EAEJ,GADAD,EAAON,EAAaI,CAAE,EAAE,MAAO,EAAG,EAAG,GAC/BE,IAAS,UAAYA,IAAS,UAAYF,EAAE,YAAc,CAE/D,GADAG,EAAOH,EAAE,YACJ,OAAOG,EAAK,MAAS,SACzB,OAAOA,EAAK,KAGb,GADAF,EAAQJ,EAAG,KAAMM,EAAK,SAAS,CAAE,EAC5BF,EACJ,OAAOA,EAAO,CAAE,CAElB,CACA,OAAKH,EAAUE,CAAE,EACT,SAEDE,CACR,CAKAP,EAAO,QAAUI,ICvCjB,IAAIK,EAAO,IAKX,OAAO,QAAUA", "names": ["require_main", "__commonJSMin", "exports", "module", "nativeClass", "RE", "isBuffer", "constructorName", "v", "match", "name", "ctor", "main"] }