Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

is-weakset

inspect-js116.5mMIT2.0.4TypeScript support: included

Is this value a JS WeakSet? This module works cross-realm/iframe, and despite ES6 @@toStringTag.

map, weakmap, set, weakset, collection, is, robust

readme

is-weakset Version Badge

github actions coverage License Downloads

npm badge

Is this value a JS WeakSet? This module works cross-realm/iframe, and despite ES6 @@toStringTag.

Example

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

changelog

Changelog

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog and this project adheres to Semantic Versioning.

v2.0.4 - 2024-12-16

Commits

  • [types] use shared config 5fe9848
  • [actions] split out node 10-20, and 20+ bd400b9
  • [Dev Deps] update @arethetypeswrong/cli, @ljharb/eslint-config, @types/object-inspect, auto-changelog, object-inspect, tape 8b290fc
  • [Refactor] use call-bound directly 265971b
  • [Dev Deps] update @arethetypeswrong/cli, @ljharb/tsconfig, @types/tape f39dc78
  • [Dev Deps] update @arethetypeswrong/cli, @types/get-intrinsic, object-inspect ce6c6a9
  • [Deps] update call-bind, get-intrinsic ebd5d82
  • [Tests] replace aud with npm audit 3eb16c8
  • [Dev Deps] update @arethetypeswrong/cli 9fe99f3
  • [Dev Deps] add missing peer dep a2fc30e

v2.0.3 - 2024-03-08

Commits

  • [meta] use npmignore to autogenerate an npmignore file e70d6aa
  • add types c9bbc35
  • [readme] remove dead badges fb443f6
  • [actions] remove redundant finisher eb292cc
  • [Dev Deps] update eslint, @ljharb/eslint-config, aud, auto-changelog, es5-shim, object-inspect, tape 49d0c35
  • [Dev Deps] update @ljharb/eslint-config, aud, es6-shim, npmignore, object-inspect, tape 6ec0a57
  • [actions] update rebase action to use reusable workflow d996166
  • [Deps] update call-bind, get-intrinsic e207da3
  • [meta] add missing engines.node 4d9dd14
  • [Deps] update get-intrinsic cf796dd
  • [meta] add sideEffects flag c88a25d

v2.0.2 - 2021-12-12

Commits

  • [actions] reuse common workflows a8f7c7f
  • [Tests] migrate tests to Github Actions f38af72
  • [Refactor] use call-bind and get-intrinsic to be more robust 5102e7e
  • [meta] do not publish github action workflow files 6ac6e8e
  • [actions] use node/install instead of node/run; use codecov action 304af52
  • [Dev Deps] update eslint, @ljharb/eslint-config, aud, auto-changelog, es6-shim, object-inspect, tape b82fb5f
  • [Tests] run nyc on all tests; use tape runner 89e2611
  • [Dev Deps] update eslint, @ljharb/eslint-config, es5-shim, object-inspect, safe-publish-latest, tape 42b0bdc
  • [actions] update codecov uploader 112697a
  • [actions] add "Allow Edits" workflow 1af6ffe
  • [readme] remove travis badge dff769b
  • [Dev Deps] update eslint, @ljharb/eslint-config, aud, object-inspect, tape 4494ced
  • [Dev Deps] update eslint, @ljharb/eslint-config, es5-shim, tape a2c11c6
  • [Tests] add core-js tests cd619e9
  • [readme] add actions and codecov badges d3cbefe
  • [Dev Deps] update eslint, @ljharb/eslint-config, tape 3d54035
  • [Dev Deps] update auto-changelog, eslint a80fb4a
  • [actions] switch Automatic Rease workflow to pull_request_target event b3b8aee
  • [Dev Deps] update es5-shim, tape 5ba5ca8
  • [meta] use prepublishOnly script for npm 7+ b4f7636
  • [Dev Deps] update auto-changelog; add aud 2ccd594
  • [Fix] when WeakSet lacks a has, return false 53a2cbc
  • [Tests] only audit prod deps f74aaf5
  • [meta] normalize line endings 31f60a6

v2.0.1 - 2019-12-17

Fixed

  • [Refactor] avoid top-level return, because babel and webpack are broken #79 #78 #7 #12

Commits

  • [actions] add automatic rebasing / merge commit blocking d85eb2c
  • [Dev Deps] update eslint, @ljharb/eslint-config 790128b
  • [Dev Deps] update tape e4bda71

v2.0.0 - 2019-11-12

Commits

v1.0.1 - 2015-06-03

Commits

v1.0.0 - 2015-02-18

Commits