パッケージの詳細

is-weakref

inspect-js151.9mMIT1.1.1

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

weakref, weak, ref, finalization

readme

is-weakref Version Badge

github actions coverage dependency status dev dependency status License Downloads

[![npm badge][11]][1]

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

Example

var isWeakRef = require('is-weakref');
assert(!isWeakRef(function () {}));
assert(!isWeakRef(null));
assert(!isWeakRef(function* () { yield 42; return Infinity; });
assert(!isWeakRef(Symbol('foo')));
assert(!isWeakRef(1n));
assert(!isWeakRef(Object(1n)));

assert(!isWeakRef(new Set()));
assert(!isWeakRef(new WeakSet()));
assert(!isWeakRef(new Map()));
assert(!isWeakRef(new WeakMap()));

assert(isWeakRef(new WeakRef({})));

class MyWeakRef extends WeakRef {}
assert(isWeakRef(new MyWeakRef({})));

Tests

Simply clone the repo, npm install, and run npm test

更新履歴

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.

v1.1.1 - 2025-02-03

Commits

  • [Dev Deps] update @arethetypeswrong/cli, @ljharb/tsconfig, @types/tape, for-each e0bccbc
  • [types] use WeakKey instead of object 9ec7583
  • [Deps] update call-bound 7655eb0

v1.1.0 - 2024-12-13

Commits

  • [meta] use npmignore to autogenerate an npmignore file 34494a3
  • [actions] split out node 10-20, and 20+ 78cb11d
  • [New] add types f4ceaf5
  • [Dev Deps] update eslint, @ljharb/eslint-config, aud, auto-changelog, object-inspect, tape 24fccf5
  • [actions] update rebase action to use reusable workflow b27c6e9
  • [Dev Deps] update @ljharb/eslint-config, auto-changelog, npmignore, object-inspect, tape 30fe836
  • [Dev Deps] update @ljharb/eslint-config, aud, object-inspect, tape 0185ba7
  • [Refactor] use call-bound directly 641d87c
  • [meta] add missing engines.node 8543506
  • [Tests] replace aud with npm audit 883c75c
  • [Deps] update call-bind 805de0e
  • [Deps] update call-bind 6a7ee43
  • [Dev Deps] update object-inspect d3d6a99
  • [meta] add sideEffects flag 2b13054
  • [Dev Deps] add missing peer dep 54cb0bc

v1.0.2 - 2021-12-10

Commits

  • [actions] reuse common workflows 2375b1f
  • [meta] do not publish workflow files 4c1be42
  • [actions] use node/install instead of node/run; use codecov action 7ec78ce
  • [readme] update URLs 6306f09
  • [Dev Deps] update eslint, @ljharb/eslint-config, object-inspect, safe-publish-latest, tape 7a1601e
  • [readme] add actions and codecov badges 67ecd14
  • [Dev Deps] update eslint, @ljharb/eslint-config, auto-changelog, object-inspect, safe-publish-latest, tape 1a5013b
  • [actions] update codecov uploader b57b037
  • [Dev Deps] update eslint, @ljharb/eslint-config, aud, object-inspect, tape da49017
  • [meta] simplify "exports" 9b88835
  • [Dev Deps] update eslint, @ljharb/eslint-config, tape c7e77f4
  • [Dev Deps] update eslint 417b29e
  • [meta] add safe-publish-latest; use prepublishOnly script for npm 7+ b1b99f4
  • [Deps] update call-bind aea342e
  • [actions] update workflows 786c2d3

v1.0.1 - 2020-12-04

Commits

  • [Tests] migrate tests to Github Actions 05b4faa
  • [Tests] run nyc on all tests 8df2e4b
  • [actions] add "Allow Edits" workflow 4a716b8
  • [Dev Deps] update eslint, @ljharb/eslint-config, aud, auto-changelog, object-inspect be23cf3
  • [Refactor] use call-bind instead of es-abstract a933a96
  • [actions] switch Automatic Rebase workflow to pull_request_target event 4473ed2
  • [readme] remove travis badge bd3bfcd

v1.0.0 - 2020-08-01

Commits