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

Package detail

@silen/is-weak-set

sileny10MIT1.0.3TypeScript support: included

Check if the parameter is weakset

type, typescript, isWeakSet, is-weak-set

readme

is-weak-set

Determine if a value is WeakSet

install

npm i @silen/is-weak-set

api

  • declare function isWeakSet(val: any): boolean;

usage

const { isWeakSet } = require('@silen/is-weak-set');
// or
import { isWeakSet } from '@silen/is-weak-set';

console.log(isWeakSet(new Buffer(4)));
console.log(isWeakSet(Buffer.alloc(4)));
console.log(isWeakSet(undefined));
console.log(isWeakSet(null));
console.log(isWeakSet(''));
console.log(isWeakSet(true));
console.log(isWeakSet(0));
console.log(isWeakSet(1));
console.log(isWeakSet(1.0));
console.log(isWeakSet('string'));
console.log(isWeakSet({}));
console.log(isWeakSet(function foo() {}));
console.log(isWeakSet(Symbol()));
console.log(isWeakSet(new Set));
console.log(isWeakSet(new Map));
console.log(isWeakSet(new WeakMap));
console.log(isWeakSet(new WeakSet));

// or
console.log(window.Type.isWeakSet(new WeakSet));

This is a demo for testing the usage of isWeakSet from @silen/is-weak-set module. You can try the others and do likewise.

others