pax_global_header00006660000000000000000000000064135763223310014517gustar00rootroot0000000000000052 comment=2ea2585475935605fb66a77304ad0083870a6b8c is-weakmap-2.0.1/000077500000000000000000000000001357632233100135555ustar00rootroot00000000000000is-weakmap-2.0.1/.eslintrc000066400000000000000000000001461357632233100154020ustar00rootroot00000000000000{ "root": true, "extends": "@ljharb", "globals": { "WeakMap": false, "WeakSet": false, }, } is-weakmap-2.0.1/.github/000077500000000000000000000000001357632233100151155ustar00rootroot00000000000000is-weakmap-2.0.1/.github/FUNDING.yml000066400000000000000000000011051357632233100167270ustar00rootroot00000000000000# 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-weakmap 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-weakmap-2.0.1/.github/workflows/000077500000000000000000000000001357632233100171525ustar00rootroot00000000000000is-weakmap-2.0.1/.github/workflows/rebase.yml000066400000000000000000000003721357632233100211400ustar00rootroot00000000000000name: 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-weakmap-2.0.1/.gitignore000066400000000000000000000017451357632233100155540ustar00rootroot00000000000000# 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-weakmap-2.0.1/.npmrc000066400000000000000000000000671357632233100147000ustar00rootroot00000000000000package-lock=false allow-same-version=true message=v%s is-weakmap-2.0.1/.travis.yml000066400000000000000000000002431357632233100156650ustar00rootroot00000000000000version: ~> 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-weakmap-2.0.1/CHANGELOG.md000066400000000000000000000050001357632233100153610ustar00rootroot00000000000000# 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-weakmap/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 [`4fa3010`](https://github.com/inspect-js/is-weakmap/commit/4fa301026787589c5a061072fda64b11d65bda18) - [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `tape` [`44bafb6`](https://github.com/inspect-js/is-weakmap/commit/44bafb65829d687fcf8205d0c451cc407d96463c) ## v2.0.0 - 2019-11-12 ### Commits - Initial commit [`6e9bd4a`](https://github.com/inspect-js/is-weakmap/commit/6e9bd4a0d61deadbf40d9875033ebdf430924236) - Tests [`61985dd`](https://github.com/inspect-js/is-weakmap/commit/61985ddf042687f2c6d8c884200f576e9cc0f29d) - implementation [`67b468d`](https://github.com/inspect-js/is-weakmap/commit/67b468db3390671c14ad656d3489e7422151b2bf) - readme [`b0ed982`](https://github.com/inspect-js/is-weakmap/commit/b0ed9826547c25cfe2ed0c6e1258d407cb76e6f4) - npm init [`54a1f81`](https://github.com/inspect-js/is-weakmap/commit/54a1f815702bde057a83d6bc0d69816c3644d698) - [meta] add `funding` field; create `FUNDING.yml` [`74579bc`](https://github.com/inspect-js/is-weakmap/commit/74579bc96345f9d15392b384d765204f398fb3c3) - [meta] add `safe-publish-latest`, `auto-changelog` [`9495b13`](https://github.com/inspect-js/is-weakmap/commit/9495b13cea989c344fbb5747f1471feb24f35959) - [Tests] add `npm run lint` [`4d4657d`](https://github.com/inspect-js/is-weakmap/commit/4d4657d396ec9e2b6625b937fcc8794bd5583fd3) - [Tests] use shared travis-ci configs [`1db25d5`](https://github.com/inspect-js/is-weakmap/commit/1db25d515fa042c39828c3cbfac65667722a679b) - Only apps should have lockfiles [`f6b0152`](https://github.com/inspect-js/is-weakmap/commit/f6b015293a4702c9cb7672a364d725ae6cc8bca8) - [Tests] add `npx aud` in `posttest` [`35dce96`](https://github.com/inspect-js/is-weakmap/commit/35dce964f73ef11237d12b0759468526e0e628a2) is-weakmap-2.0.1/LICENSE000066400000000000000000000020531357632233100145620ustar00rootroot00000000000000MIT 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-weakmap-2.0.1/README.md000066400000000000000000000031101357632233100150270ustar00rootroot00000000000000# is-weakmap [![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 WeakMap? This module works cross-realm/iframe, and despite ES6 @@toStringTag. ## Example ```js var isWeakMap = require('is-weakmap'); assert(!isWeakMap(function () {})); assert(!isWeakMap(null)); assert(!isWeakMap(function* () { yield 42; return Infinity; }); assert(!isWeakMap(Symbol('foo'))); assert(!isWeakMap(1n)); assert(!isWeakMap(Object(1n))); assert(!isWeakMap(new Set())); assert(!isWeakMap(new WeakSet())); assert(!isWeakMap(new Map())); assert(isWeakMap(new WeakMap())); class MyWeakMap extends WeakMap {} assert(isWeakMap(new MyWeakMap())); ``` ## Tests Simply clone the repo, `npm install`, and run `npm test` [1]: https://npmjs.org/package/is-weakmap [2]: http://versionbadg.es/inspect-js/is-weakmap.svg [3]: https://travis-ci.org/inspect-js/is-weakmap.svg [4]: https://travis-ci.org/inspect-js/is-weakmap [5]: https://david-dm.org/inspect-js/is-weakmap.svg [6]: https://david-dm.org/inspect-js/is-weakmap [7]: https://david-dm.org/inspect-js/is-weakmap/dev-status.svg [8]: https://david-dm.org/inspect-js/is-weakmap#info=devDependencies [11]: https://nodei.co/npm/is-weakmap.png?downloads=true&stars=true [license-image]: http://img.shields.io/npm/l/is-weakmap.svg [license-url]: LICENSE [downloads-image]: http://img.shields.io/npm/dm/is-weakmap.svg [downloads-url]: http://npm-stat.com/charts.html?package=is-weakmap is-weakmap-2.0.1/index.js000066400000000000000000000017441357632233100152300ustar00rootroot00000000000000'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 isWeakMap(x) { // `WeakMap` is not present in this environment. return false; }; } var $mapHas = $WeakMap ? $WeakMap.prototype.has : null; var $setHas = $WeakSet ? $WeakSet.prototype.has : null; if (!exported && !$mapHas) { // eslint-disable-next-line no-unused-vars exported = function isWeakMap(x) { // `WeakMap` does not have a `has` method return false; }; } module.exports = exported || function isWeakMap(x) { if (!x || typeof x !== 'object') { return false; } try { $mapHas.call(x, $mapHas); if ($setHas) { try { $setHas.call(x, $setHas); } catch (e) { return true; } } return x instanceof $WeakMap; // core-js workaround, pre-v3 } catch (e) {} return false; }; is-weakmap-2.0.1/package.json000066400000000000000000000030761357632233100160510ustar00rootroot00000000000000{ "name": "is-weakmap", "version": "2.0.1", "description": "Is this value a JS WeakMap? 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-weakmap.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-weakmap/issues" }, "homepage": "https://github.com/inspect-js/is-weakmap#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-weakmap-2.0.1/test/000077500000000000000000000000001357632233100145345ustar00rootroot00000000000000is-weakmap-2.0.1/test/index.js000066400000000000000000000021721357632233100162030ustar00rootroot00000000000000'use strict'; var test = require('tape'); var debug = require('object-inspect'); var forEach = require('for-each'); var isWeakMap = require('..'); test('non-collections', function (t) { forEach([ null, undefined, true, false, 42, 0, -0, NaN, Infinity, '', 'foo', /a/g, [], {}, function () {} ], function (nonCollection) { t.equal(isWeakMap(nonCollection), false, debug(nonCollection) + ' is not a WeakMap'); }); t.end(); }); test('Maps', { skip: typeof Map !== 'function' }, function (t) { var m = new Map(); t.equal(isWeakMap(m), false, debug(m) + ' is not a WeakMap'); t.end(); }); test('Sets', { skip: typeof Set !== 'function' }, function (t) { var s = new Set(); t.equal(isWeakMap(s), false, debug(s) + ' is not a WeakMap'); t.end(); }); test('WeakMaps', { skip: typeof WeakMap !== 'function' }, function (t) { var wm = new WeakMap(); t.equal(isWeakMap(wm), true, debug(wm) + ' is a WeakMap'); t.end(); }); test('WeakSets', { skip: typeof WeakSet !== 'function' }, function (t) { var ws = new WeakSet(); t.equal(isWeakMap(ws), false, debug(ws) + ' is not a WeakMap'); t.end(); });