pax_global_header 0000666 0000000 0000000 00000000064 13576322334 0014522 g ustar 00root root 0000000 0000000 52 comment=ed2a5c1c3424911887a2ef8dea42bea43c7f90ed
is-weakset-2.0.1/ 0000775 0000000 0000000 00000000000 13576322334 0013576 5 ustar 00root root 0000000 0000000 is-weakset-2.0.1/.eslintrc 0000664 0000000 0000000 00000000146 13576322334 0015423 0 ustar 00root root 0000000 0000000 {
"root": true,
"extends": "@ljharb",
"globals": {
"WeakMap": false,
"WeakSet": false,
},
}
is-weakset-2.0.1/.github/ 0000775 0000000 0000000 00000000000 13576322334 0015136 5 ustar 00root root 0000000 0000000 is-weakset-2.0.1/.github/FUNDING.yml 0000664 0000000 0000000 00000001105 13576322334 0016750 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.1/.github/workflows/ 0000775 0000000 0000000 00000000000 13576322334 0017173 5 ustar 00root root 0000000 0000000 is-weakset-2.0.1/.github/workflows/rebase.yml 0000664 0000000 0000000 00000000372 13576322334 0021161 0 ustar 00root root 0000000 0000000 name: Automatic Rebase
on: [pull_request]
jobs:
_:
name: "Automatic Rebase"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: ljharb/rebase@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
is-weakset-2.0.1/.gitignore 0000664 0000000 0000000 00000001745 13576322334 0015575 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.1/.npmrc 0000664 0000000 0000000 00000000067 13576322334 0014721 0 ustar 00root root 0000000 0000000 package-lock=false
allow-same-version=true
message=v%s
is-weakset-2.0.1/.travis.yml 0000664 0000000 0000000 00000000243 13576322334 0015706 0 ustar 00root root 0000000 0000000 version: ~> 1.0
language: node_js
os:
- linux
import:
- ljharb/travis-ci:node/all.yml
- ljharb/travis-ci:node/pretest.yml
- ljharb/travis-ci:node/posttest.yml
is-weakset-2.0.1/CHANGELOG.md 0000664 0000000 0000000 00000005171 13576322334 0015413 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).
Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
## [v2.0.1](https://github.com/inspect-js/is-weakset/compare/v2.0.0...v2.0.1) - 2019-12-18
### 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 - 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)
is-weakset-2.0.1/LICENSE 0000664 0000000 0000000 00000002053 13576322334 0014603 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.1/README.md 0000664 0000000 0000000 00000003110 13576322334 0015050 0 ustar 00root root 0000000 0000000 # is-weakset [![Version Badge][2]][1]
[![Build Status][3]][4]
[![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]: http://versionbadg.es/inspect-js/is-weakset.svg
[3]: https://travis-ci.org/inspect-js/is-weakset.svg
[4]: https://travis-ci.org/inspect-js/is-weakset
[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]: http://img.shields.io/npm/l/is-weakset.svg
[license-url]: LICENSE
[downloads-image]: http://img.shields.io/npm/dm/is-weakset.svg
[downloads-url]: http://npm-stat.com/charts.html?package=is-weakset
is-weakset-2.0.1/index.js 0000664 0000000 0000000 00000001752 13576322334 0015250 0 ustar 00root root 0000000 0000000 'use strict';
var $WeakMap = typeof WeakMap === 'function' && WeakMap.prototype ? WeakMap : null;
var $WeakSet = typeof WeakSet === 'function' && WeakSet.prototype ? WeakSet : null;
var exported;
if (!$WeakMap) {
// eslint-disable-next-line no-unused-vars
exported = function isWeakSet(x) {
// `WeakSet` is not present in this environment.
return false;
};
}
var $mapHas = $WeakMap ? $WeakMap.prototype.has : null;
var $setHas = $WeakSet ? $WeakSet.prototype.has : null;
if (!exported && !$setHas) {
// eslint-disable-next-line no-unused-vars
module.exports = function isWeakSet(x) {
// `WeakSet` does not have a `has` method
return false;
};
}
module.exports = exported || function isWeakSet(x) {
if (!x || typeof x !== 'object') {
return false;
}
try {
$setHas.call(x, $setHas);
if ($mapHas) {
try {
$mapHas.call(x, $mapHas);
} catch (e) {
return true;
}
}
return x instanceof $WeakSet; // core-js workaround, pre-v3
} catch (e) {}
return false;
};
is-weakset-2.0.1/package.json 0000664 0000000 0000000 00000003076 13576322334 0016072 0 ustar 00root root 0000000 0000000 {
"name": "is-weakset",
"version": "2.0.1",
"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)\")\"",
"prepublish": "safe-publish-latest",
"pretest": "npm run lint",
"lint": "eslint .",
"tests-only": "node test",
"posttests-only": "node -e \"require('es5-shim'); require('es6-shim'); require('./test');\"",
"test": "npm run tests-only",
"posttest": "npx aud"
},
"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": "^15.0.2",
"auto-changelog": "^1.16.2",
"es5-shim": "^4.5.13",
"es6-shim": "^0.35.5",
"eslint": "^6.7.2",
"for-each": "^0.3.3",
"object-inspect": "^1.7.0",
"safe-publish-latest": "^1.1.4",
"tape": "^4.12.0"
},
"auto-changelog": {
"output": "CHANGELOG.md",
"template": "keepachangelog",
"unreleased": false,
"commitLimit": false,
"backfillLimit": false
}
}
is-weakset-2.0.1/test/ 0000775 0000000 0000000 00000000000 13576322334 0014555 5 ustar 00root root 0000000 0000000 is-weakset-2.0.1/test/index.js 0000664 0000000 0000000 00000002172 13576322334 0016224 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();
});