A modern library of high quality, zero-dependency, fully typed, tree-shakeable utilities, parsers, data structure factories, converters and other capabilities to help you create quality Node.js/Bun and JavaScript/TypeScript applications quickly.
Installations
npm install @zerodep/is-weakmap
Developer Guide
Typescript
Yes
Module System
ESM
Node Version
20.15.1
NPM Version
10.7.0
Score
48.4
Supply Chain
91.3
Quality
80.5
Maintenance
100
Vulnerability
100
License
Releases
Contributors
Unable to fetch Contributors
Languages
TypeScript (92.28%)
JavaScript (7.72%)
Developer
Download Statistics
Total Downloads
1,056
Last Day
1
Last Week
3
Last Month
18
Last Year
669
GitHub Statistics
6 Stars
176 Commits
3 Forks
2 Watching
4 Branches
3 Contributors
Package Meta Information
Latest Version
2.0.12
Package Id
@zerodep/is-weakmap@2.0.12
Unpacked Size
8.38 kB
Size
3.34 kB
File Count
8
NPM Version
10.7.0
Node Version
20.15.1
Publised On
27 Oct 2024
Total Downloads
Cumulative downloads
Total Downloads
1,056
Last day
0%
1
Compared to previous day
Last week
50%
3
Compared to previous week
Last month
350%
18
Compared to previous month
Last year
72.9%
669
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
No dependencies detected.
@zerodep/is-weakmap
A simple, performant utility to determine if a value is a Weak Map.
Full documentation is available at the zerodep.app page.
Signature
1declare const isWeakmap: (value: unknown) => boolean;
Examples
All @zerodep packages support both ESM and CJS formats, each complete with Typescript typings.
1// ESM 2import { isWeakmap } from '@zerodep/is-weakmap'; 3 4// CJS 5// CJS 6const { isWeakmap } = require('@zerodep/is-weakmap');
1// Arrays 2isWeakmap([]); // false 3isWeakmap([1, 2, 3]); // false 4isWeakmap(['a', 'b', 'c']); // false 5 6// BigInts 7isWeakmap(42n); // false 8isWeakmap(0n); // false 9isWeakmap(-0n); // false 10isWeakmap(-42n); // false 11 12// Booleans 13isWeakmap(true); // false 14isWeakmap(false); // false 15 16// Class 17isWeakmap( 18 class SomeClass { 19 constructor() {} 20 } 21); // false 22 23// Dates 24isWeakmap(new Date()); // false 25isWeakmap(new Date('1970-01-01T12:00:00.000Z')); // false 26isWeakmap(new Date('2099-12-31')); // false 27 28// Empty 29isWeakmap(null); // false 30isWeakmap(undefined); // false 31 32// Errors 33isWeakmap(new Error('message')); // false 34isWeakmap(new AggregateError([new Error('err1'), new Error('err2')], 'message')); // false 35 36// Floats 37isWeakmap(3.14); // false 38isWeakmap(0.0); // false 39isWeakmap(-0.0); // false 40isWeakmap(-3.14); // false 41isWeakmap(Math.E); // false 42isWeakmap(Math.PI); // false 43isWeakmap(Number.MIN_VALUE); // false 44 45// Functions 46isWeakmap(() => 'function'); // false 47isWeakmap(async () => 'function'); // false 48 49// Generators 50isWeakmap(function* () { 51 yield 'a'; 52}); // false 53isWeakmap(async function* () { 54 yield 'a'; 55}); // false 56 57// Maps 58isWeakmap(new Map()); // false 59isWeakmap(new Map([['key1', 123]])); // false 60isWeakmap(new Map([['key1', 'value1']])); // false 61 62// Numbers 63isWeakmap(Number.POSITIVE_INFINITY); // false 64isWeakmap(Number.MAX_SAFE_INTEGER); // false 65isWeakmap(3e8); // false 66isWeakmap(42); // false 67isWeakmap(1); // false 68isWeakmap(0); // false 69isWeakmap(-0); // false 70isWeakmap(-1); // false 71isWeakmap(-42); // false 72isWeakmap(-3e8); // false 73isWeakmap(Number.MIN_SAFE_INTEGER); // false 74isWeakmap(Number.NEGATIVE_INFINITY); // false 75isWeakmap(Number.NaN); // false 76 77// POJOs 78isWeakmap({}); // false 79isWeakmap({ key: 'string' }); // false 80isWeakmap({ key: 123 }); // false 81 82// Promise 83isWeakmap(new Promise(() => {})); // false 84isWeakmap(new Promise.all([])); // false 85isWeakmap(new Promise.allSettled([])); // false 86isWeakmap(new Promise.race([])); // false 87isWeakmap(Promise.resolve()); // false 88 89// Regular Expression 90isWeakmap(/[regex]+/gi); // false 91isWeakmap(new RegExp('d', 'gi')); // false 92 93// Sets 94isWeakmap(new Set()); // false 95isWeakmap(new Set([1, 2, 3])); // false 96isWeakmap(new Set(['a', 'b', 'c'])); // false 97 98// Strings 99isWeakmap(''); // false 100isWeakmap('a longer string'); // false 101isWeakmap('1000n'); // false 102isWeakmap('3e8'); // false 103isWeakmap('42'); // false 104isWeakmap('3.14'); // false 105isWeakmap('0'); // false 106isWeakmap('-0'); // false 107isWeakmap('-3.14'); // false 108isWeakmap('-42'); // false 109isWeakmap('-3e8'); // false 110isWeakmap('-1000n'); // false 111 112// Symbols 113isWeakmap(Symbol()); // false 114isWeakmap(Symbol('name')); // false 115 116// This 117isWeakmap(this); // false 118isWeakmap(globalThis); // false 119 120// TypedArrays 121isWeakmap(new Int8Array(2)); // false 122isWeakmap(new Int16Array(2)); // false 123isWeakmap(new Int32Array(2)); // false 124isWeakmap(new Uint8Array(2)); // false 125isWeakmap(new Uint16Array(2)); // false 126isWeakmap(new Uint32Array(2)); // false 127isWeakmap(new Uint8ClampedArray(2)); // false 128 129isWeakmap(new BigInt64Array(2)); // false 130isWeakmap(new BigUint64Array(2)); // false 131 132isWeakmap(new Float32Array(2)); // false 133isWeakmap(new Float64Array(2)); // false 134 135isWeakmap(new SharedArrayBuffer(512)); // false 136 137// WeakMap and WeakSet 138isWeakmap(new WeakMap()); // true 139isWeakmap(new WeakSet()); // false
ZeroDep Advantages
- Zero npm dependencies - completely eliminates all risk of supply-chain attacks, decreases node_modules folder size
- ESM & CJS - has both ecmascript modules and common javascript exports
- Tree Shakable - built to be fully tree shakable ensuring your packages are the smallest possible size
- Fully typed - typescript definitions are provided for every package for a better developer experience
- Semantically named - package and method names are easy to grok, remember, use, and read
- Documented - actually useful documentation with examples at zerodep.app
- Intelligently Packaged - multiple npm packages of different sizes available allowing a menu or a-la-carte composition of capabilities
- 100% Tested - all methods and packages are fully unit tested
- Predictably Versioned - semantically versioned for peace-of-mind upgrading, this includes changelogs
- MIT Licensed - permissively licensed for maximum usability
No vulnerabilities found.
No security vulnerabilities found.