Initial commit
This commit is contained in:
		
							
								
								
									
										20
									
								
								node_modules/which-boxed-primitive/.editorconfig
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								node_modules/which-boxed-primitive/.editorconfig
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,20 @@
 | 
			
		||||
root = true
 | 
			
		||||
 | 
			
		||||
[*]
 | 
			
		||||
indent_style = tab
 | 
			
		||||
indent_size = 4
 | 
			
		||||
end_of_line = lf
 | 
			
		||||
charset = utf-8
 | 
			
		||||
trim_trailing_whitespace = true
 | 
			
		||||
insert_final_newline = true
 | 
			
		||||
max_line_length = 150
 | 
			
		||||
 | 
			
		||||
[CHANGELOG.md]
 | 
			
		||||
indent_style = space
 | 
			
		||||
indent_size = 2
 | 
			
		||||
 | 
			
		||||
[*.json]
 | 
			
		||||
max_line_length = off
 | 
			
		||||
 | 
			
		||||
[Makefile]
 | 
			
		||||
max_line_length = off
 | 
			
		||||
							
								
								
									
										1
									
								
								node_modules/which-boxed-primitive/.eslintignore
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								node_modules/which-boxed-primitive/.eslintignore
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1 @@
 | 
			
		||||
coverage/
 | 
			
		||||
							
								
								
									
										9
									
								
								node_modules/which-boxed-primitive/.eslintrc
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								node_modules/which-boxed-primitive/.eslintrc
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,9 @@
 | 
			
		||||
{
 | 
			
		||||
	"root": true,
 | 
			
		||||
 | 
			
		||||
	"extends": "@ljharb",
 | 
			
		||||
 | 
			
		||||
	"rules": {
 | 
			
		||||
		"max-statements": [2, 12],
 | 
			
		||||
	},
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										12
									
								
								node_modules/which-boxed-primitive/.github/FUNDING.yml
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								node_modules/which-boxed-primitive/.github/FUNDING.yml
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,12 @@
 | 
			
		||||
# These are supported funding model platforms
 | 
			
		||||
 | 
			
		||||
github: [ljharb]
 | 
			
		||||
patreon: # Replace with a single Patreon username
 | 
			
		||||
open_collective: # Replace with a single Open Collective username
 | 
			
		||||
ko_fi: # Replace with a single Ko-fi username
 | 
			
		||||
tidelift: npm/which-boxed-primitive
 | 
			
		||||
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
 | 
			
		||||
liberapay: # Replace with a single Liberapay username
 | 
			
		||||
issuehunt: # Replace with a single IssueHunt username
 | 
			
		||||
otechie: # Replace with a single Otechie username
 | 
			
		||||
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
 | 
			
		||||
							
								
								
									
										13
									
								
								node_modules/which-boxed-primitive/.nycrc
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								node_modules/which-boxed-primitive/.nycrc
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,13 @@
 | 
			
		||||
{
 | 
			
		||||
	"all": true,
 | 
			
		||||
	"check-coverage": false,
 | 
			
		||||
	"reporter": ["text-summary", "text", "html", "json"],
 | 
			
		||||
	"lines": 86,
 | 
			
		||||
	"statements": 85.93,
 | 
			
		||||
	"functions": 82.43,
 | 
			
		||||
	"branches": 76.06,
 | 
			
		||||
	"exclude": [
 | 
			
		||||
		"coverage",
 | 
			
		||||
		"test"
 | 
			
		||||
	]
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										54
									
								
								node_modules/which-boxed-primitive/CHANGELOG.md
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										54
									
								
								node_modules/which-boxed-primitive/CHANGELOG.md
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,54 @@
 | 
			
		||||
# Changelog
 | 
			
		||||
 | 
			
		||||
All notable changes to this project will be documented in this file.
 | 
			
		||||
 | 
			
		||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
 | 
			
		||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
 | 
			
		||||
 | 
			
		||||
## [v1.0.2](https://github.com/inspect-js/which-boxed-primitive/compare/v1.0.1...v1.0.2) - 2020-12-14
 | 
			
		||||
 | 
			
		||||
### Commits
 | 
			
		||||
 | 
			
		||||
- [Tests] use shared travis-ci configs [`8674582`](https://github.com/inspect-js/which-boxed-primitive/commit/86745829b6a92cff2cfb0d3c0414ec9afdc2a087)
 | 
			
		||||
- [Tests] migrate tests to Github Actions [`dff6643`](https://github.com/inspect-js/which-boxed-primitive/commit/dff6643405ba4d6dc6694a25904c8f72f273ece8)
 | 
			
		||||
- [meta] do not publish github action workflow files [`b26112a`](https://github.com/inspect-js/which-boxed-primitive/commit/b26112a4e4ac6beec8f54c734135dbf9e9ba16f9)
 | 
			
		||||
- [meta] make `auto-changelog` config consistent [`8d10175`](https://github.com/inspect-js/which-boxed-primitive/commit/8d10175171154cd6c8f8a016aa7fb71b5044acf6)
 | 
			
		||||
- [readme] fix repo URLs, remove defunct badges [`ab8db24`](https://github.com/inspect-js/which-boxed-primitive/commit/ab8db247573723dbcda68469118d08c7c2692c67)
 | 
			
		||||
- [Tests] run `nyc` on all tests; use `tape` runner [`7d084df`](https://github.com/inspect-js/which-boxed-primitive/commit/7d084dfc5251230e9399a81782c0b9d7ae5d1901)
 | 
			
		||||
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `auto-changelog`, `object-inspect`, `tape` [`576f6f3`](https://github.com/inspect-js/which-boxed-primitive/commit/576f6f308aed35ef1d3392bb9472def59482ed13)
 | 
			
		||||
- [actions] add automatic rebasing / merge commit blocking [`97efa53`](https://github.com/inspect-js/which-boxed-primitive/commit/97efa53a307678323e63f576c07db9ff84846fd3)
 | 
			
		||||
- [actions] add "Allow Edits" workflow [`fb1b4f7`](https://github.com/inspect-js/which-boxed-primitive/commit/fb1b4f7cd753fcced74ac054b20c8b2bfafe7953)
 | 
			
		||||
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `has-symbols`, `object-inspect`, `safe-publish-latest` [`1e03c61`](https://github.com/inspect-js/which-boxed-primitive/commit/1e03c6153693d385833acc15178f675e6ce5ddd0)
 | 
			
		||||
- [Deps] update `is-boolean-object`, `is-number-object`, `is-string`, `is-symbol` [`13673df`](https://github.com/inspect-js/which-boxed-primitive/commit/13673dff6e43f0a915377c3e5740ec24e86d6bb7)
 | 
			
		||||
- [Dev Deps] update `auto-changelog`, `in-publish`, `tape` [`65a0e15`](https://github.com/inspect-js/which-boxed-primitive/commit/65a0e155fc46a9237692233a51ec9573621135d2)
 | 
			
		||||
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `tape` [`f8a0afe`](https://github.com/inspect-js/which-boxed-primitive/commit/f8a0afea82938d64f3d2d240268afbd346d0c4da)
 | 
			
		||||
- [Deps] update `is-bigint`, `is-boolean-object` [`e7a1ce2`](https://github.com/inspect-js/which-boxed-primitive/commit/e7a1ce25371c00ee726f1c0cc5b6acf10d51ec50)
 | 
			
		||||
- [actions] switch Automatic Rebase workflow to `pull_request_target` event [`e46f193`](https://github.com/inspect-js/which-boxed-primitive/commit/e46f193298b158db5c8aba889803513e4ee38957)
 | 
			
		||||
- [Dev Deps] update `@ljharb/eslint-config`, `tape` [`df3da14`](https://github.com/inspect-js/which-boxed-primitive/commit/df3da1424552a5d22e203a0abf1710106bfd4ae2)
 | 
			
		||||
- [Dev Deps] update `auto-changelog`; add `aud` [`e2e8a12`](https://github.com/inspect-js/which-boxed-primitive/commit/e2e8a12c6fbf8c48e760ea1d1ccd5e8d2d6fbf24)
 | 
			
		||||
- [meta] add `funding` field [`7df404b`](https://github.com/inspect-js/which-boxed-primitive/commit/7df404b20cd50b2b87e6645b130fefa8ee98810e)
 | 
			
		||||
- [Dev Deps] update `auto-changelog` [`0d6b76d`](https://github.com/inspect-js/which-boxed-primitive/commit/0d6b76dbbe760581fa86a0c3f254988fe5d27770)
 | 
			
		||||
- [Tests] only audit prod deps [`246151c`](https://github.com/inspect-js/which-boxed-primitive/commit/246151cc1407b3b1ef42014db993f62670bd82ff)
 | 
			
		||||
- [meta] fix changelog [`c2d1685`](https://github.com/inspect-js/which-boxed-primitive/commit/c2d16856deffbf86e0b5029e69b65d8aa758ec3d)
 | 
			
		||||
- [readme] Fix spelling error [`25fb2b5`](https://github.com/inspect-js/which-boxed-primitive/commit/25fb2b56e1f708c6364923e4bae384f818ecf57f)
 | 
			
		||||
 | 
			
		||||
## [v1.0.1](https://github.com/inspect-js/which-boxed-primitive/compare/v1.0.0...v1.0.1) - 2019-08-10
 | 
			
		||||
 | 
			
		||||
### Commits
 | 
			
		||||
 | 
			
		||||
- [meta] avoid running `safe-publish-latest` when not publishing [`df44b27`](https://github.com/inspect-js/which-boxed-primitive/commit/df44b27875a8f5c3c596663ecb4a063f9fc7bde3)
 | 
			
		||||
 | 
			
		||||
## v1.0.0 - 2019-08-10
 | 
			
		||||
 | 
			
		||||
### Commits
 | 
			
		||||
 | 
			
		||||
- [Tests] add `.travis.yml` [`764b0cf`](https://github.com/inspect-js/which-boxed-primitive/commit/764b0cf75f8d2b3a0ad2056de5f4ad85d5d1b765)
 | 
			
		||||
- Initial commit [`da7d068`](https://github.com/inspect-js/which-boxed-primitive/commit/da7d068913d591294bf155db5d438f7804d71b9a)
 | 
			
		||||
- readme [`1395bb2`](https://github.com/inspect-js/which-boxed-primitive/commit/1395bb27b72137ac01e48ee398a0f54e93fd87f5)
 | 
			
		||||
- [Tests] add tests [`0ff580f`](https://github.com/inspect-js/which-boxed-primitive/commit/0ff580f99579cd4424af7b814bd76fcb69a2b04e)
 | 
			
		||||
- implementation [`8811c32`](https://github.com/inspect-js/which-boxed-primitive/commit/8811c3262a57963634cdc83ceb5bb2c5e9ae4e7e)
 | 
			
		||||
- npm init [`cffdea9`](https://github.com/inspect-js/which-boxed-primitive/commit/cffdea9755eabfa2f9ec62a6fcbce0c28f04495b)
 | 
			
		||||
- [Tests] add `npm run lint` [`a8be993`](https://github.com/inspect-js/which-boxed-primitive/commit/a8be9933fec1b21267acd847df77f6438e07e3b9)
 | 
			
		||||
- [meta] add FUNDING.yml [`941258c`](https://github.com/inspect-js/which-boxed-primitive/commit/941258c70c9a397466e05b614126cb8c7be77b99)
 | 
			
		||||
- Only apps should have lockfiles [`6857316`](https://github.com/inspect-js/which-boxed-primitive/commit/68573165d8ce842cdf15d94af82f8cccb961b8cf)
 | 
			
		||||
- [Tests] use `npx aud` in `posttest` [`ee48a91`](https://github.com/inspect-js/which-boxed-primitive/commit/ee48a9144bea23bde5cc47788a54d5aa7969d489)
 | 
			
		||||
							
								
								
									
										21
									
								
								node_modules/which-boxed-primitive/LICENSE
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								node_modules/which-boxed-primitive/LICENSE
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,21 @@
 | 
			
		||||
MIT License
 | 
			
		||||
 | 
			
		||||
Copyright (c) 2019 Jordan Harband
 | 
			
		||||
 | 
			
		||||
Permission is hereby granted, free of charge, to any person obtaining a copy
 | 
			
		||||
of this software and associated documentation files (the "Software"), to deal
 | 
			
		||||
in the Software without restriction, including without limitation the rights
 | 
			
		||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 | 
			
		||||
copies of the Software, and to permit persons to whom the Software is
 | 
			
		||||
furnished to do so, subject to the following conditions:
 | 
			
		||||
 | 
			
		||||
The above copyright notice and this permission notice shall be included in all
 | 
			
		||||
copies or substantial portions of the Software.
 | 
			
		||||
 | 
			
		||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 | 
			
		||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 | 
			
		||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 | 
			
		||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 | 
			
		||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 | 
			
		||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 | 
			
		||||
SOFTWARE.
 | 
			
		||||
							
								
								
									
										73
									
								
								node_modules/which-boxed-primitive/README.md
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										73
									
								
								node_modules/which-boxed-primitive/README.md
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,73 @@
 | 
			
		||||
# which-boxed-primitive <sup>[![Version Badge][2]][1]</sup>
 | 
			
		||||
 | 
			
		||||
[![dependency status][5]][6]
 | 
			
		||||
[![dev dependency status][7]][8]
 | 
			
		||||
[![License][license-image]][license-url]
 | 
			
		||||
[![Downloads][downloads-image]][downloads-url]
 | 
			
		||||
 | 
			
		||||
[![npm badge][11]][1]
 | 
			
		||||
 | 
			
		||||
Which 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.
 | 
			
		||||
 | 
			
		||||
## Example
 | 
			
		||||
 | 
			
		||||
```js
 | 
			
		||||
var whichBoxedPrimitive = require('which-boxed-primitive');
 | 
			
		||||
var assert = require('assert');
 | 
			
		||||
 | 
			
		||||
// unboxed primitives return `null`
 | 
			
		||||
// boxed primitives return the builtin constructor name
 | 
			
		||||
 | 
			
		||||
assert.equal(whichBoxedPrimitive(undefined), null);
 | 
			
		||||
assert.equal(whichBoxedPrimitive(null), null);
 | 
			
		||||
 | 
			
		||||
assert.equal(whichBoxedPrimitive(false), null);
 | 
			
		||||
assert.equal(whichBoxedPrimitive(true), null);
 | 
			
		||||
assert.equal(whichBoxedPrimitive(new Boolean(false)), 'Boolean');
 | 
			
		||||
assert.equal(whichBoxedPrimitive(new Boolean(true)), 'Boolean');
 | 
			
		||||
 | 
			
		||||
assert.equal(whichBoxedPrimitive(42), null);
 | 
			
		||||
assert.equal(whichBoxedPrimitive(NaN), null);
 | 
			
		||||
assert.equal(whichBoxedPrimitive(Infinity), null);
 | 
			
		||||
assert.equal(whichBoxedPrimitive(new Number(42)), 'Number');
 | 
			
		||||
assert.equal(whichBoxedPrimitive(new Number(NaN)), 'Number');
 | 
			
		||||
assert.equal(whichBoxedPrimitive(new Number(Infinity)), 'Number');
 | 
			
		||||
 | 
			
		||||
assert.equal(whichBoxedPrimitive(''), null);
 | 
			
		||||
assert.equal(whichBoxedPrimitive('foo'), null);
 | 
			
		||||
assert.equal(whichBoxedPrimitive(new String('')), 'String');
 | 
			
		||||
assert.equal(whichBoxedPrimitive(new String('foo')), 'String');
 | 
			
		||||
 | 
			
		||||
assert.equal(whichBoxedPrimitive(Symbol()), null);
 | 
			
		||||
assert.equal(whichBoxedPrimitive(Object(Symbol()), 'Symbol');
 | 
			
		||||
 | 
			
		||||
assert.equal(whichBoxedPrimitive(42n), null);
 | 
			
		||||
assert.equal(whichBoxedPrimitive(Object(42n), 'BigInt');
 | 
			
		||||
 | 
			
		||||
// non-boxed-primitive objects return `undefined`
 | 
			
		||||
assert.equal(whichBoxedPrimitive([]), undefined);
 | 
			
		||||
assert.equal(whichBoxedPrimitive({}), undefined);
 | 
			
		||||
assert.equal(whichBoxedPrimitive(/a/g), undefined);
 | 
			
		||||
assert.equal(whichBoxedPrimitive(new RegExp('a', 'g')), undefined);
 | 
			
		||||
assert.equal(whichBoxedPrimitive(new Date()), undefined);
 | 
			
		||||
assert.equal(whichBoxedPrimitive(function () {}), undefined);
 | 
			
		||||
assert.equal(whichBoxedPrimitive(function* () {}), undefined);
 | 
			
		||||
assert.equal(whichBoxedPrimitive(x => x * x), undefined);
 | 
			
		||||
assert.equal(whichBoxedPrimitive([]), undefined);
 | 
			
		||||
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
## Tests
 | 
			
		||||
Simply clone the repo, `npm install`, and run `npm test`
 | 
			
		||||
 | 
			
		||||
[1]: https://npmjs.org/package/which-boxed-primitive
 | 
			
		||||
[2]: https://versionbadg.es/inspect-js/which-boxed-primitive.svg
 | 
			
		||||
[5]: https://david-dm.org/inspect-js/which-boxed-primitive.svg
 | 
			
		||||
[6]: https://david-dm.org/inspect-js/which-boxed-primitive
 | 
			
		||||
[7]: https://david-dm.org/inspect-js/which-boxed-primitive/dev-status.svg
 | 
			
		||||
[8]: https://david-dm.org/inspect-js/which-boxed-primitive#info=devDependencies
 | 
			
		||||
[11]: https://nodei.co/npm/which-boxed-primitive.png?downloads=true&stars=true
 | 
			
		||||
[license-image]: https://img.shields.io/npm/l/which-boxed-primitive.svg
 | 
			
		||||
[license-url]: LICENSE
 | 
			
		||||
[downloads-image]: https://img.shields.io/npm/dm/which-boxed-primitive.svg
 | 
			
		||||
[downloads-url]: https://npm-stat.com/charts.html?package=which-boxed-primitive
 | 
			
		||||
							
								
								
									
										30
									
								
								node_modules/which-boxed-primitive/index.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										30
									
								
								node_modules/which-boxed-primitive/index.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,30 @@
 | 
			
		||||
'use strict';
 | 
			
		||||
 | 
			
		||||
var isString = require('is-string');
 | 
			
		||||
var isNumber = require('is-number-object');
 | 
			
		||||
var isBoolean = require('is-boolean-object');
 | 
			
		||||
var isSymbol = require('is-symbol');
 | 
			
		||||
var isBigInt = require('is-bigint');
 | 
			
		||||
 | 
			
		||||
// eslint-disable-next-line consistent-return
 | 
			
		||||
module.exports = function whichBoxedPrimitive(value) {
 | 
			
		||||
	// eslint-disable-next-line eqeqeq
 | 
			
		||||
	if (value == null || (typeof value !== 'object' && typeof value !== 'function')) {
 | 
			
		||||
		return null;
 | 
			
		||||
	}
 | 
			
		||||
	if (isString(value)) {
 | 
			
		||||
		return 'String';
 | 
			
		||||
	}
 | 
			
		||||
	if (isNumber(value)) {
 | 
			
		||||
		return 'Number';
 | 
			
		||||
	}
 | 
			
		||||
	if (isBoolean(value)) {
 | 
			
		||||
		return 'Boolean';
 | 
			
		||||
	}
 | 
			
		||||
	if (isSymbol(value)) {
 | 
			
		||||
		return 'Symbol';
 | 
			
		||||
	}
 | 
			
		||||
	if (isBigInt(value)) {
 | 
			
		||||
		return 'BigInt';
 | 
			
		||||
	}
 | 
			
		||||
};
 | 
			
		||||
							
								
								
									
										65
									
								
								node_modules/which-boxed-primitive/package.json
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										65
									
								
								node_modules/which-boxed-primitive/package.json
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,65 @@
 | 
			
		||||
{
 | 
			
		||||
	"name": "which-boxed-primitive",
 | 
			
		||||
	"version": "1.0.2",
 | 
			
		||||
	"description": "Which kind of boxed JS primitive is this?",
 | 
			
		||||
	"main": "index.js",
 | 
			
		||||
	"scripts": {
 | 
			
		||||
		"preversion": "auto-changelog",
 | 
			
		||||
		"prepublish": "not-in-publish || safe-publish-latest",
 | 
			
		||||
		"lint": "eslint --ext=js,mjs .",
 | 
			
		||||
		"pretest": "npm run lint",
 | 
			
		||||
		"tests-only": "nyc tape 'test/**/*.js'",
 | 
			
		||||
		"test": "npm run tests-only",
 | 
			
		||||
		"posttest": "aud --production",
 | 
			
		||||
		"version": "auto-changelog && git add CHANGELOG.md",
 | 
			
		||||
		"postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\""
 | 
			
		||||
	},
 | 
			
		||||
	"repository": {
 | 
			
		||||
		"type": "git",
 | 
			
		||||
		"url": "git+https://github.com/inspect-js/which-boxed-primitive.git"
 | 
			
		||||
	},
 | 
			
		||||
	"keywords": [
 | 
			
		||||
		"boxed",
 | 
			
		||||
		"primitive",
 | 
			
		||||
		"object",
 | 
			
		||||
		"ecmascript",
 | 
			
		||||
		"javascript",
 | 
			
		||||
		"which"
 | 
			
		||||
	],
 | 
			
		||||
	"author": "Jordan Harband <ljharb@gmail.com>",
 | 
			
		||||
	"funding": {
 | 
			
		||||
		"url": "https://github.com/sponsors/ljharb"
 | 
			
		||||
	},
 | 
			
		||||
	"license": "MIT",
 | 
			
		||||
	"bugs": {
 | 
			
		||||
		"url": "https://github.com/inspect-js/which-boxed-primitive/issues"
 | 
			
		||||
	},
 | 
			
		||||
	"homepage": "https://github.com/inspect-js/which-boxed-primitive#readme",
 | 
			
		||||
	"dependencies": {
 | 
			
		||||
		"is-bigint": "^1.0.1",
 | 
			
		||||
		"is-boolean-object": "^1.1.0",
 | 
			
		||||
		"is-number-object": "^1.0.4",
 | 
			
		||||
		"is-string": "^1.0.5",
 | 
			
		||||
		"is-symbol": "^1.0.3"
 | 
			
		||||
	},
 | 
			
		||||
	"devDependencies": {
 | 
			
		||||
		"@ljharb/eslint-config": "^17.3.0",
 | 
			
		||||
		"aud": "^1.1.3",
 | 
			
		||||
		"auto-changelog": "^2.2.1",
 | 
			
		||||
		"eslint": "^7.15.0",
 | 
			
		||||
		"has-symbols": "^1.0.1",
 | 
			
		||||
		"in-publish": "^2.0.1",
 | 
			
		||||
		"nyc": "^10.3.2",
 | 
			
		||||
		"object-inspect": "^1.9.0",
 | 
			
		||||
		"safe-publish-latest": "^1.1.4",
 | 
			
		||||
		"tape": "^5.0.1"
 | 
			
		||||
	},
 | 
			
		||||
	"auto-changelog": {
 | 
			
		||||
		"output": "CHANGELOG.md",
 | 
			
		||||
		"template": "keepachangelog",
 | 
			
		||||
		"unreleased": false,
 | 
			
		||||
		"commitLimit": false,
 | 
			
		||||
		"backfillLimit": false,
 | 
			
		||||
		"hideCredit": true
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										66
									
								
								node_modules/which-boxed-primitive/test/index.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										66
									
								
								node_modules/which-boxed-primitive/test/index.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,66 @@
 | 
			
		||||
'use strict';
 | 
			
		||||
 | 
			
		||||
var test = require('tape');
 | 
			
		||||
var inspect = require('object-inspect');
 | 
			
		||||
var whichBoxedPrimitive = require('..');
 | 
			
		||||
 | 
			
		||||
var debug = function (v, m) { return inspect(v) + ' ' + m; };
 | 
			
		||||
 | 
			
		||||
var forEach = function (arr, func) {
 | 
			
		||||
	var i;
 | 
			
		||||
	for (i = 0; i < arr.length; ++i) {
 | 
			
		||||
		func(arr[i], i, arr);
 | 
			
		||||
	}
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
var hasSymbols = require('has-symbols')();
 | 
			
		||||
var hasBigInts = typeof BigInt === 'function';
 | 
			
		||||
 | 
			
		||||
var primitives = [
 | 
			
		||||
	true,
 | 
			
		||||
	false,
 | 
			
		||||
	42,
 | 
			
		||||
	NaN,
 | 
			
		||||
	Infinity,
 | 
			
		||||
	'',
 | 
			
		||||
	'foo'
 | 
			
		||||
].concat(
 | 
			
		||||
	hasSymbols ? [Symbol(), Symbol.iterator] : [],
 | 
			
		||||
	hasBigInts ? BigInt(42) : []
 | 
			
		||||
);
 | 
			
		||||
 | 
			
		||||
var objects = [
 | 
			
		||||
	/a/g,
 | 
			
		||||
	new Date(),
 | 
			
		||||
	function () {},
 | 
			
		||||
	[],
 | 
			
		||||
	{}
 | 
			
		||||
];
 | 
			
		||||
 | 
			
		||||
test('isBoxedPrimitive', function (t) {
 | 
			
		||||
	t.test('unboxed primitives', function (st) {
 | 
			
		||||
		forEach([null, undefined].concat(primitives), function (primitive) {
 | 
			
		||||
			st.equal(null, whichBoxedPrimitive(primitive), debug(primitive, 'is a primitive, but not a boxed primitive'));
 | 
			
		||||
		});
 | 
			
		||||
		st.end();
 | 
			
		||||
	});
 | 
			
		||||
 | 
			
		||||
	t.test('boxed primitives', function (st) {
 | 
			
		||||
		forEach(primitives, function (primitive) {
 | 
			
		||||
			var boxed = Object(primitive);
 | 
			
		||||
			var expected = boxed.constructor.name;
 | 
			
		||||
			st.equal(typeof expected, 'string', 'expected is string');
 | 
			
		||||
			st.equal(whichBoxedPrimitive(boxed), expected, debug(boxed, 'is a boxed primitive: ' + expected));
 | 
			
		||||
		});
 | 
			
		||||
		st.end();
 | 
			
		||||
	});
 | 
			
		||||
 | 
			
		||||
	t.test('non-primitive objects', function (st) {
 | 
			
		||||
		forEach(objects, function (object) {
 | 
			
		||||
			st.equal(undefined, whichBoxedPrimitive(object), debug(object, 'is not a primitive, boxed or otherwise'));
 | 
			
		||||
		});
 | 
			
		||||
		st.end();
 | 
			
		||||
	});
 | 
			
		||||
 | 
			
		||||
	t.end();
 | 
			
		||||
});
 | 
			
		||||
		Reference in New Issue
	
	Block a user