pax_global_header 0000666 0000000 0000000 00000000064 14155527451 0014523 g ustar 00root root 0000000 0000000 52 comment=68a69d548ade4e1d7112a11dfb79d1be7323f75a
is-weakset-2.0.2/ 0000775 0000000 0000000 00000000000 14155527451 0013600 5 ustar 00root root 0000000 0000000 is-weakset-2.0.2/.eslintignore 0000664 0000000 0000000 00000000012 14155527451 0016274 0 ustar 00root root 0000000 0000000 coverage/
is-weakset-2.0.2/.eslintrc 0000664 0000000 0000000 00000000220 14155527451 0015416 0 ustar 00root root 0000000 0000000 {
"root": true,
"extends": "@ljharb",
"rules": {
"new-cap": ["error", {
"capIsNewExceptions": [
"GetIntrinsic",
],
}],
},
}
is-weakset-2.0.2/.gitattributes 0000664 0000000 0000000 00000000014 14155527451 0016466 0 ustar 00root root 0000000 0000000 * text=auto
is-weakset-2.0.2/.github/ 0000775 0000000 0000000 00000000000 14155527451 0015140 5 ustar 00root root 0000000 0000000 is-weakset-2.0.2/.github/FUNDING.yml 0000664 0000000 0000000 00000001105 14155527451 0016752 0 ustar 00root root 0000000 0000000 # 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/is-weakset
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']
is-weakset-2.0.2/.github/workflows/ 0000775 0000000 0000000 00000000000 14155527451 0017175 5 ustar 00root root 0000000 0000000 is-weakset-2.0.2/.github/workflows/node-aught.yml 0000664 0000000 0000000 00000000516 14155527451 0021755 0 ustar 00root root 0000000 0000000 name: 'Tests: node.js < 10'
on: [pull_request, push]
jobs:
tests:
uses: ljharb/actions/.github/workflows/node.yml@main
with:
range: '< 10'
type: minors
command: npm run tests-only
node:
name: 'node < 10'
needs: [tests]
runs-on: ubuntu-latest
steps:
- run: 'echo tests completed'
is-weakset-2.0.2/.github/workflows/node-corejs.yml 0000664 0000000 0000000 00000000551 14155527451 0022131 0 ustar 00root root 0000000 0000000 name: 'Tests: node.js + core-js'
on: [pull_request, push]
jobs:
tests:
uses: ljharb/actions/.github/workflows/node.yml@main
with:
range: '0.10 - 0.12 || >= 1'
type: majors
command: npm run tests:corejs
node:
name: 'node + core-js'
needs: [tests]
runs-on: ubuntu-latest
steps:
- run: 'echo tests completed'
is-weakset-2.0.2/.github/workflows/node-pretest.yml 0000664 0000000 0000000 00000000206 14155527451 0022327 0 ustar 00root root 0000000 0000000 name: 'Tests: pretest/posttest'
on: [pull_request, push]
jobs:
tests:
uses: ljharb/actions/.github/workflows/pretest.yml@main
is-weakset-2.0.2/.github/workflows/node-shims.yml 0000664 0000000 0000000 00000000552 14155527451 0021770 0 ustar 00root root 0000000 0000000 name: 'Tests: node.js + es-shims'
on: [pull_request, push]
jobs:
tests:
uses: ljharb/actions/.github/workflows/node.yml@main
with:
range: '0.10 - 0.12 || >= 1'
type: majors
command: npm run tests:shims
node:
name: 'node + es-shims'
needs: [tests]
runs-on: ubuntu-latest
steps:
- run: 'echo tests completed'
is-weakset-2.0.2/.github/workflows/node-tens.yml 0000664 0000000 0000000 00000000521 14155527451 0021612 0 ustar 00root root 0000000 0000000 name: 'Tests: node.js >= 10'
on: [pull_request, push]
jobs:
tests:
uses: ljharb/actions/.github/workflows/node.yml@main
with:
range: '>= 10'
type: minors
command: npm run tests-only
node:
name: 'node >= 10'
needs: [tests]
runs-on: ubuntu-latest
steps:
- run: 'echo tests completed'
is-weakset-2.0.2/.github/workflows/rebase.yml 0000664 0000000 0000000 00000000411 14155527451 0021155 0 ustar 00root root 0000000 0000000 name: Automatic Rebase
on: [pull_request_target]
jobs:
_:
name: "Automatic Rebase"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: ljharb/rebase@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
is-weakset-2.0.2/.github/workflows/require-allow-edits.yml 0000664 0000000 0000000 00000000303 14155527451 0023612 0 ustar 00root root 0000000 0000000 name: Require “Allow Edits”
on: [pull_request_target]
jobs:
_:
name: "Require “Allow Edits”"
runs-on: ubuntu-latest
steps:
- uses: ljharb/require-allow-edits@main
is-weakset-2.0.2/.gitignore 0000664 0000000 0000000 00000001745 14155527451 0015577 0 ustar 00root root 0000000 0000000 # Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# Runtime data
pids
*.pid
*.seed
*.pid.lock
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
# nyc test coverage
.nyc_output
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# Bower dependency directory (https://bower.io/)
bower_components
# node-waf configuration
.lock-wscript
# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release
# Dependency directories
node_modules/
jspm_packages/
# TypeScript v1 declaration files
typings/
# Optional npm cache directory
.npm
# Optional eslint cache
.eslintcache
# Optional REPL history
.node_repl_history
# Output of 'npm pack'
*.tgz
# Yarn Integrity file
.yarn-integrity
# dotenv environment variables file
.env
# next.js build output
.next
# Only apps should have lockfiles
npm-shrinkwrap.json
package-lock.json
yarn.lock
is-weakset-2.0.2/.npmignore 0000664 0000000 0000000 00000001770 14155527451 0015604 0 ustar 00root root 0000000 0000000 # Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# Runtime data
pids
*.pid
*.seed
*.pid.lock
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
# nyc test coverage
.nyc_output
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# Bower dependency directory (https://bower.io/)
bower_components
# node-waf configuration
.lock-wscript
# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release
# Dependency directories
node_modules/
jspm_packages/
# TypeScript v1 declaration files
typings/
# Optional npm cache directory
.npm
# Optional eslint cache
.eslintcache
# Optional REPL history
.node_repl_history
# Output of 'npm pack'
*.tgz
# Yarn Integrity file
.yarn-integrity
# dotenv environment variables file
.env
# next.js build output
.next
# Only apps should have lockfiles
npm-shrinkwrap.json
package-lock.json
yarn.lock
.github/workflows
is-weakset-2.0.2/.npmrc 0000664 0000000 0000000 00000000067 14155527451 0014723 0 ustar 00root root 0000000 0000000 package-lock=false
allow-same-version=true
message=v%s
is-weakset-2.0.2/.nycrc 0000664 0000000 0000000 00000000213 14155527451 0014713 0 ustar 00root root 0000000 0000000 {
"all": true,
"check-coverage": false,
"reporter": ["text-summary", "text", "html", "json"],
"exclude": [
"coverage",
"test"
]
}
is-weakset-2.0.2/CHANGELOG.md 0000664 0000000 0000000 00000015615 14155527451 0015421 0 ustar 00root root 0000000 0000000 # 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).
## [v2.0.2](https://github.com/inspect-js/is-weakset/compare/v2.0.1...v2.0.2) - 2021-12-12
### Commits
- [actions] reuse common workflows [`a8f7c7f`](https://github.com/inspect-js/is-weakset/commit/a8f7c7fa22088dabbadf82cd52cf962eca646c59)
- [Tests] migrate tests to Github Actions [`f38af72`](https://github.com/inspect-js/is-weakset/commit/f38af729300d425360caad1763e7f904dcd3e393)
- [Refactor] use `call-bind` and `get-intrinsic` to be more robust [`5102e7e`](https://github.com/inspect-js/is-weakset/commit/5102e7ef227f06da1bc8dcee2579af74f1e1a477)
- [meta] do not publish github action workflow files [`6ac6e8e`](https://github.com/inspect-js/is-weakset/commit/6ac6e8e5b15181e73d30f6d37e41955372b07792)
- [actions] use `node/install` instead of `node/run`; use `codecov` action [`304af52`](https://github.com/inspect-js/is-weakset/commit/304af52f4c40743b055e252d50c8e804cac4054f)
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `auto-changelog`, `es6-shim`, `object-inspect`, `tape` [`b82fb5f`](https://github.com/inspect-js/is-weakset/commit/b82fb5fafdeea05f93420e0966fe63785362649a)
- [Tests] run `nyc` on all tests; use `tape` runner [`89e2611`](https://github.com/inspect-js/is-weakset/commit/89e26115ab1aa58b37816d6b5e2aad62508bd79c)
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `es5-shim`, `object-inspect`, `safe-publish-latest`, `tape` [`42b0bdc`](https://github.com/inspect-js/is-weakset/commit/42b0bdc5a8785ddb589ea16629c933ec01359ca8)
- [actions] update codecov uploader [`112697a`](https://github.com/inspect-js/is-weakset/commit/112697aaf3b6f2e22275575ce4b684059fa5dcaa)
- [actions] add "Allow Edits" workflow [`1af6ffe`](https://github.com/inspect-js/is-weakset/commit/1af6ffe2793a5784ac70048e50850f4d6e650de4)
- [readme] remove travis badge [`dff769b`](https://github.com/inspect-js/is-weakset/commit/dff769b367aa4886ab082dd6330cbc54d0dcf03f)
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `object-inspect`, `tape` [`4494ced`](https://github.com/inspect-js/is-weakset/commit/4494cedea891e3617768b30721e3b5ddee5c41e4)
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `es5-shim`, `tape` [`a2c11c6`](https://github.com/inspect-js/is-weakset/commit/a2c11c6dcef990b7f6fabb26d58837a7fe4f3a3e)
- [Tests] add `core-js` tests [`cd619e9`](https://github.com/inspect-js/is-weakset/commit/cd619e95f64cc02cbec8f4b0b29a806f371eab9e)
- [readme] add actions and codecov badges [`d3cbefe`](https://github.com/inspect-js/is-weakset/commit/d3cbefeb526773a565eb4e501b2e7da7947b215d)
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `tape` [`3d54035`](https://github.com/inspect-js/is-weakset/commit/3d54035e2ca66969f6cc779b85902ac3507d7297)
- [Dev Deps] update `auto-changelog`, `eslint` [`a80fb4a`](https://github.com/inspect-js/is-weakset/commit/a80fb4a7c1a90a2929d80f9b2a9adaa56c94d2d2)
- [actions] switch Automatic Rease workflow to `pull_request_target` event [`b3b8aee`](https://github.com/inspect-js/is-weakset/commit/b3b8aeeb3e133d88da897d42530aea4bcc729b23)
- [Dev Deps] update `es5-shim`, `tape` [`5ba5ca8`](https://github.com/inspect-js/is-weakset/commit/5ba5ca84a3d4bb4acacb9fd9265a21476d4f0457)
- [meta] use `prepublishOnly` script for npm 7+ [`b4f7636`](https://github.com/inspect-js/is-weakset/commit/b4f76366574ac4b4d854c330cbad33a8d9ff48ff)
- [Dev Deps] update `auto-changelog`; add `aud` [`2ccd594`](https://github.com/inspect-js/is-weakset/commit/2ccd5944c8fd161fa463620de268bd6f40ff0e59)
- [Fix] when `WeakSet` lacks a `has`, return false [`53a2cbc`](https://github.com/inspect-js/is-weakset/commit/53a2cbce11d2493b4ff82132f3d14e22c909b541)
- [Tests] only audit prod deps [`f74aaf5`](https://github.com/inspect-js/is-weakset/commit/f74aaf5746fc49d424742184025288d0d565639c)
- [meta] normalize line endings [`31f60a6`](https://github.com/inspect-js/is-weakset/commit/31f60a6a70e38851743e602e30bb0907cd3cc6ba)
## [v2.0.1](https://github.com/inspect-js/is-weakset/compare/v2.0.0...v2.0.1) - 2019-12-17
### Fixed
- [Refactor] avoid top-level return, because babel and webpack are broken [`#79`](https://github.com/inspect-js/node-deep-equal/issues/79) [`#78`](https://github.com/inspect-js/node-deep-equal/issues/78) [`#7`](https://github.com/es-shims/Promise.allSettled/issues/7) [`#12`](https://github.com/airbnb/js-shims/issues/12)
### Commits
- [actions] add automatic rebasing / merge commit blocking [`d85eb2c`](https://github.com/inspect-js/is-weakset/commit/d85eb2ca5fe1f1890a04c5504e4c23d68db68447)
- [Dev Deps] update `eslint`, `@ljharb/eslint-config` [`790128b`](https://github.com/inspect-js/is-weakset/commit/790128b8e7c2abe39f70a5c25a303646f8555487)
- [Dev Deps] update `tape` [`e4bda71`](https://github.com/inspect-js/is-weakset/commit/e4bda71a8a6b1233285e91f54a05a08b75cdbd6e)
## [v2.0.0](https://github.com/inspect-js/is-weakset/compare/v1.0.1...v2.0.0) - 2019-11-12
### Commits
- Initial commit [`095ce1f`](https://github.com/inspect-js/is-weakset/commit/095ce1f56c52aa547b57dd326e9b5c2c8a7c2765)
- Tests [`2e8f26d`](https://github.com/inspect-js/is-weakset/commit/2e8f26d1b632fbfe4ded276d046e34276780671b)
- implementation [`acae1ef`](https://github.com/inspect-js/is-weakset/commit/acae1ef8d29a84ff0729135ac4acfe42f18c1328)
- readme [`344db89`](https://github.com/inspect-js/is-weakset/commit/344db8951568a3206847e7b00820622c2364e1ff)
- npm init [`e318679`](https://github.com/inspect-js/is-weakset/commit/e318679acc2c3c168a32fb648ddf3d54ff3e6d5e)
- [meta] add `funding` field; create `FUNDING.yml` [`a1e9277`](https://github.com/inspect-js/is-weakset/commit/a1e927798405e643e570a43d0ee30f5ae16d9d18)
- [meta] add `safe-publish-latest`, `auto-changelog` [`066a08c`](https://github.com/inspect-js/is-weakset/commit/066a08cd939ec1efe433af23688f8c73d3524b5c)
- [Tests] add `npm run lint` [`6af0730`](https://github.com/inspect-js/is-weakset/commit/6af07301fda27f1450184f31b941cf9fbefe261d)
- [Tests] use shared travis-ci configs [`a44f4ec`](https://github.com/inspect-js/is-weakset/commit/a44f4ec03d734274e351acef37698272f3e500c1)
- Only apps should have lockfiles [`11e4115`](https://github.com/inspect-js/is-weakset/commit/11e41153e46eb3ead4be9187770fe8cb47a21e12)
- [Tests] add `npx aud` in `posttest` [`53ceba1`](https://github.com/inspect-js/is-weakset/commit/53ceba16b0a98f968e40439f7bd2ffc98a406de8)
## [v1.0.1](https://github.com/inspect-js/is-weakset/compare/v1.0.0...v1.0.1) - 2015-06-03
### Commits
- Tweaks [`cb3a689`](https://github.com/inspect-js/is-weakset/commit/cb3a68985d734632423ffe81704500bd04e95934)
- Add `related` section to readme [`7c2766b`](https://github.com/inspect-js/is-weakset/commit/7c2766b3e1992b34d5ad933f2cf8901352aa4fcd)
## v1.0.0 - 2015-02-18
### Commits
- init [`579f442`](https://github.com/inspect-js/is-weakset/commit/579f442c42afa4e3880f9f62b3ccea79e0b6edd5)
is-weakset-2.0.2/LICENSE 0000664 0000000 0000000 00000002053 14155527451 0014605 0 ustar 00root root 0000000 0000000 MIT License
Copyright (c) 2019 Inspect JS
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.
is-weakset-2.0.2/README.md 0000664 0000000 0000000 00000003601 14155527451 0015057 0 ustar 00root root 0000000 0000000 # is-weakset [![Version Badge][2]][1]
[![github actions][actions-image]][actions-url]
[![coverage][codecov-image]][codecov-url]
[![dependency status][5]][6]
[![dev dependency status][7]][8]
[![License][license-image]][license-url]
[![Downloads][downloads-image]][downloads-url]
[![npm badge][11]][1]
Is this value a JS WeakSet? This module works cross-realm/iframe, and despite ES6 @@toStringTag.
## Example
```js
var isWeakSet = require('is-weakset');
assert(!isWeakSet(function () {}));
assert(!isWeakSet(null));
assert(!isWeakSet(function* () { yield 42; return Infinity; });
assert(!isWeakSet(Symbol('foo')));
assert(!isWeakSet(1n));
assert(!isWeakSet(Object(1n)));
assert(!isWeakSet(new Set()));
assert(!isWeakSet(new WeakMap()));
assert(!isWeakSet(new Map()));
assert(isWeakSet(new WeakSet()));
class MyWeakSet extends WeakSet {}
assert(isWeakSet(new MyWeakSet()));
```
## Tests
Simply clone the repo, `npm install`, and run `npm test`
[1]: https://npmjs.org/package/is-weakset
[2]: https://versionbadg.es/inspect-js/is-weakset.svg
[5]: https://david-dm.org/inspect-js/is-weakset.svg
[6]: https://david-dm.org/inspect-js/is-weakset
[7]: https://david-dm.org/inspect-js/is-weakset/dev-status.svg
[8]: https://david-dm.org/inspect-js/is-weakset#info=devDependencies
[11]: https://nodei.co/npm/is-weakset.png?downloads=true&stars=true
[license-image]: https://img.shields.io/npm/l/is-weakset.svg
[license-url]: LICENSE
[downloads-image]: https://img.shields.io/npm/dm/is-weakset.svg
[downloads-url]: https://npm-stat.com/charts.html?package=is-weakset
[codecov-image]: https://codecov.io/gh/inspect-js/is-weakset/branch/main/graphs/badge.svg
[codecov-url]: https://app.codecov.io/gh/inspect-js/is-weakset/
[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/inspect-js/is-weakset
[actions-url]: https://github.com/inspect-js/is-weakset/actions
is-weakset-2.0.2/index.js 0000664 0000000 0000000 00000001441 14155527451 0015245 0 ustar 00root root 0000000 0000000 'use strict';
var GetIntrinsic = require('get-intrinsic');
var callBound = require('call-bind/callBound');
var $WeakSet = GetIntrinsic('%WeakSet%', true);
var $setHas = callBound('WeakSet.prototype.has', true);
if ($setHas) {
var $mapHas = callBound('WeakMap.prototype.has', true);
module.exports = function isWeakSet(x) {
if (!x || typeof x !== 'object') {
return false;
}
try {
$setHas(x, $setHas);
if ($mapHas) {
try {
$mapHas(x, $mapHas);
} catch (e) {
return true;
}
}
return x instanceof $WeakSet; // core-js workaround, pre-v3
} catch (e) {}
return false;
};
} else {
// eslint-disable-next-line no-unused-vars
module.exports = function isWeakSet(x) {
// `WeakSet` does not exist, or does not have a `has` method
return false;
};
}
is-weakset-2.0.2/package.json 0000664 0000000 0000000 00000003641 14155527451 0016072 0 ustar 00root root 0000000 0000000 {
"name": "is-weakset",
"version": "2.0.2",
"description": "Is this value a JS WeakSet? This module works cross-realm/iframe, and despite ES6 @@toStringTag.",
"main": "index.js",
"scripts": {
"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)\")\"",
"prepublishOnly": "safe-publish-latest",
"prepublish": "not-in-publish || npm run prepublishOnly",
"pretest": "npm run lint",
"lint": "eslint --ext=js,mjs .",
"tests-only": "nyc tape 'test/**/*.js'",
"tests:shims": "nyc tape --require=es5-shim --require=es6-shim 'test/**/*.js'",
"tests:corejs": "nyc tape --require=core-js 'test/**/*.js'",
"test": "npm run tests-only && npm run tests:shims && npm run tests:corejs",
"posttest": "aud --production"
},
"repository": {
"type": "git",
"url": "git+https://github.com/inspect-js/is-weakset.git"
},
"keywords": [
"map",
"weakmap",
"set",
"weakset",
"collection",
"is",
"robust"
],
"author": "Jordan Harband ",
"funding": {
"url": "https://github.com/sponsors/ljharb"
},
"license": "MIT",
"bugs": {
"url": "https://github.com/inspect-js/is-weakset/issues"
},
"homepage": "https://github.com/inspect-js/is-weakset#readme",
"devDependencies": {
"@ljharb/eslint-config": "^20.0.0",
"aud": "^1.1.5",
"auto-changelog": "^2.3.0",
"core-js": "^2.6.12",
"es5-shim": "^4.6.2",
"es6-shim": "^0.35.6",
"eslint": "^8.4.1",
"for-each": "^0.3.3",
"nyc": "^10.3.2",
"object-inspect": "^1.11.1",
"safe-publish-latest": "^2.0.0",
"tape": "^5.3.2"
},
"auto-changelog": {
"output": "CHANGELOG.md",
"template": "keepachangelog",
"unreleased": false,
"commitLimit": false,
"backfillLimit": false,
"hideCredit": true
},
"dependencies": {
"call-bind": "^1.0.2",
"get-intrinsic": "^1.1.1"
}
}
is-weakset-2.0.2/test/ 0000775 0000000 0000000 00000000000 14155527451 0014557 5 ustar 00root root 0000000 0000000 is-weakset-2.0.2/test/index.js 0000664 0000000 0000000 00000002172 14155527451 0016226 0 ustar 00root root 0000000 0000000 'use strict';
var test = require('tape');
var debug = require('object-inspect');
var forEach = require('for-each');
var isWeakSet = require('..');
test('non-collections', function (t) {
forEach([
null,
undefined,
true,
false,
42,
0,
-0,
NaN,
Infinity,
'',
'foo',
/a/g,
[],
{},
function () {}
], function (nonCollection) {
t.equal(isWeakSet(nonCollection), false, debug(nonCollection) + ' is not a WeakSet');
});
t.end();
});
test('Maps', { skip: typeof Map !== 'function' }, function (t) {
var m = new Map();
t.equal(isWeakSet(m), false, debug(m) + ' is not a WeakSet');
t.end();
});
test('Sets', { skip: typeof Set !== 'function' }, function (t) {
var s = new Set();
t.equal(isWeakSet(s), false, debug(s) + ' is not a WeakSet');
t.end();
});
test('WeakMaps', { skip: typeof WeakMap !== 'function' }, function (t) {
var wm = new WeakMap();
t.equal(isWeakSet(wm), false, debug(wm) + ' is not a WeakSet');
t.end();
});
test('WeakSets', { skip: typeof WeakSet !== 'function' }, function (t) {
var ws = new WeakSet();
t.equal(isWeakSet(ws), true, debug(ws) + ' is a WeakSet');
t.end();
});