{"name":"which-boxed-primitive","version":"1.1.0","keywords":["boxed","primitive","object","ecmascript","javascript","which"],"author":{"name":"Jordan Harband","email":"ljharb@gmail.com"},"license":"MIT","_id":"which-boxed-primitive@1.1.0","homepage":"https://github.com/inspect-js/which-boxed-primitive#readme","bugs":{"url":"https://github.com/inspect-js/which-boxed-primitive/issues"},"dist":{"shasum":"2d850d6c4ac37b95441a67890e19f3fda8b6c6d9","tarball":"http://registry-npm.ywwl.com/which-boxed-primitive/download/which-boxed-primitive-1.1.0.tgz","fileCount":12,"integrity":"sha512-Ei7Miu/AXe2JJ4iNF5j/UphAgRoma4trE6PtisM09bPygb3egMH3YLW/befsWb1A1AxvNSFidOFTB18XtnIIng==","signatures":[{"sig":"MEUCIBbg2Nj9FqMUzyST37gV0yOksbZQGwkO0OU2FAtiVhg6AiEAzE7PeFnTHBMEeXFAOsUOcVru4jFA5cmof37mcA7C0Sg=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":18774,"size":6626,"noattachment":false,"key":"/which-boxed-primitive/-/which-boxed-primitive-1.1.0.tgz"},"main":"index.js","types":"./index.d.ts","engines":{"node":">= 0.4"},"funding":{"url":"https://github.com/sponsors/ljharb"},"gitHead":"7310c5f86e59ff4a7b94ed3b53815a98785f178d","scripts":{"lint":"eslint --ext=js,mjs .","test":"npm run tests-only","prepack":"npmignore --auto --commentLines=autogenerated","pretest":"npm run lint","version":"auto-changelog && git add CHANGELOG.md","postlint":"tsc -p . && attw -P","posttest":"npx npm@'>=10.2' audit --production","prepublish":"not-in-publish || npm run prepublishOnly","tests-only":"nyc tape 'test/**/*.js'","postversion":"auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\"","prepublishOnly":"safe-publish-latest"},"_npmUser":{"name":"ljharb","email":"ljharb@gmail.com"},"repository":{"url":"git+https://github.com/inspect-js/which-boxed-primitive.git","type":"git"},"_npmVersion":"10.9.0","description":"Which kind of boxed JS primitive is this?","directories":{},"_nodeVersion":"23.3.0","dependencies":{"is-bigint":"^1.1.0","is-string":"^1.1.0","is-symbol":"^1.1.0","is-number-object":"^1.1.0","is-boolean-object":"^1.2.0"},"publishConfig":{"ignore":[".github/workflows"]},"_hasShrinkwrap":false,"auto-changelog":{"output":"CHANGELOG.md","template":"keepachangelog","hideCredit":true,"unreleased":false,"commitLimit":false,"backfillLimit":false},"devDependencies":{"nyc":"^10.3.2","tape":"^5.9.0","eslint":"=8.8.0","encoding":"^0.1.13","for-each":"^0.3.3","npmignore":"^0.3.1","in-publish":"^2.0.1","typescript":"next","@types/tape":"^5.6.5","auto-changelog":"^2.5.0","object-inspect":"^1.13.3","@types/for-each":"^0.3.3","@ljharb/tsconfig":"^0.2.0","es-value-fixtures":"^1.5.0","safe-publish-latest":"^2.0.0","@arethetypeswrong/cli":"^0.17.0","@ljharb/eslint-config":"^21.1.1","@types/object-inspect":"^1.13.0"},"_npmOperationalInternal":{"tmp":"tmp/which-boxed-primitive_1.1.0_1733171088990_0.316680455359889","host":"s3://npm-registry-packages"},"readme":"# which-boxed-primitive <sup>[![Version Badge][2]][1]</sup>\n\n[![dependency status][5]][6]\n[![dev dependency status][7]][8]\n[![License][license-image]][license-url]\n[![Downloads][downloads-image]][downloads-url]\n\n[![npm badge][11]][1]\n\nWhich kind of boxed JS primitive is this? This module works cross-realm/iframe, does not depend on `instanceof` or mutable properties, and works despite ES6 Symbol.toStringTag.\n\n## Example\n\n```js\nvar whichBoxedPrimitive = require('which-boxed-primitive');\nvar assert = require('assert');\n\n// unboxed primitives return `null`\n// boxed primitives return the builtin constructor name\n\nassert.equal(whichBoxedPrimitive(undefined), null);\nassert.equal(whichBoxedPrimitive(null), null);\n\nassert.equal(whichBoxedPrimitive(false), null);\nassert.equal(whichBoxedPrimitive(true), null);\nassert.equal(whichBoxedPrimitive(new Boolean(false)), 'Boolean');\nassert.equal(whichBoxedPrimitive(new Boolean(true)), 'Boolean');\n\nassert.equal(whichBoxedPrimitive(42), null);\nassert.equal(whichBoxedPrimitive(NaN), null);\nassert.equal(whichBoxedPrimitive(Infinity), null);\nassert.equal(whichBoxedPrimitive(new Number(42)), 'Number');\nassert.equal(whichBoxedPrimitive(new Number(NaN)), 'Number');\nassert.equal(whichBoxedPrimitive(new Number(Infinity)), 'Number');\n\nassert.equal(whichBoxedPrimitive(''), null);\nassert.equal(whichBoxedPrimitive('foo'), null);\nassert.equal(whichBoxedPrimitive(new String('')), 'String');\nassert.equal(whichBoxedPrimitive(new String('foo')), 'String');\n\nassert.equal(whichBoxedPrimitive(Symbol()), null);\nassert.equal(whichBoxedPrimitive(Object(Symbol()), 'Symbol');\n\nassert.equal(whichBoxedPrimitive(42n), null);\nassert.equal(whichBoxedPrimitive(Object(42n), 'BigInt');\n\n// non-boxed-primitive objects return `undefined`\nassert.equal(whichBoxedPrimitive([]), undefined);\nassert.equal(whichBoxedPrimitive({}), undefined);\nassert.equal(whichBoxedPrimitive(/a/g), undefined);\nassert.equal(whichBoxedPrimitive(new RegExp('a', 'g')), undefined);\nassert.equal(whichBoxedPrimitive(new Date()), undefined);\nassert.equal(whichBoxedPrimitive(function () {}), undefined);\nassert.equal(whichBoxedPrimitive(function* () {}), undefined);\nassert.equal(whichBoxedPrimitive(x => x * x), undefined);\nassert.equal(whichBoxedPrimitive([]), undefined);\n\n```\n\n## Tests\nSimply clone the repo, `npm install`, and run `npm test`\n\n[1]: https://npmjs.org/package/which-boxed-primitive\n[2]: https://versionbadg.es/inspect-js/which-boxed-primitive.svg\n[5]: https://david-dm.org/inspect-js/which-boxed-primitive.svg\n[6]: https://david-dm.org/inspect-js/which-boxed-primitive\n[7]: https://david-dm.org/inspect-js/which-boxed-primitive/dev-status.svg\n[8]: https://david-dm.org/inspect-js/which-boxed-primitive#info=devDependencies\n[11]: https://nodei.co/npm/which-boxed-primitive.png?downloads=true&stars=true\n[license-image]: https://img.shields.io/npm/l/which-boxed-primitive.svg\n[license-url]: LICENSE\n[downloads-image]: https://img.shields.io/npm/dm/which-boxed-primitive.svg\n[downloads-url]: https://npm-stat.com/charts.html?package=which-boxed-primitive\n","publish_time":1733171089156,"maintainers":[{"name":"ljharb","email":"ljharb@gmail.com"}],"_cnpm_publish_time":1733171089156,"dist-tags":{"latest":"1.1.1"}}