Registry / serialization / hashmap

hashmap

JSON →
library2.4.0jsnpmunverified

The `hashmap` package provides a `HashMap` class for JavaScript, designed to store key/value pairs where keys can be of *any* data type, including objects, numbers, and dates, without the implicit stringification that occurs with plain JavaScript objects. This was a key differentiator before the introduction of native `Map` in ES6. The current stable version is 2.4.0. Given its last update was over eight years ago, the package is effectively abandoned, with no active development or release cadence. It targets both Node.js and browser environments and differentiates itself by allowing complex objects as keys without coercion.

serialization
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

This package is CommonJS-only. Attempting to use ES Modules `import` syntax directly will likely result in a runtime error or `undefined` in pure ESM environments without a CJS interop layer.

const HashMap = require('hashmap');

This example demonstrates how to import `HashMap` using CommonJS, set and retrieve values with various key types (string, number, object), check the map's size, delete entries, and iterate over its contents.

const HashMap = require('hashmap'); // Create a new HashMap instance const map = new HashMap(); // Basic key-value pair storage map.set('stringKey', 'Hello World'); map.set(123, 'Numeric Key'); console.log('Value for "stringKey":', map.get('stringKey')); // Expected: Hello World console.log('Value for 123:', map.get(123)); // Expected: Numeric Key // Demonstrating non-stringified object keys const objKey1 = { id: 1 }; const objKey2 = { id: 2 }; map.set(objKey1, 'First object'); map.set(objKey2, 'Second object'); console.log('Value for objKey1:', map.get(objKey1)); // Expected: First object console.log('Value for objKey2:', map.get(objKey2)); // Expected: Second object // Get current size console.log('Map size:', map.size); // Expected: 4 // Delete a key-value pair map.delete('stringKey'); console.log('Map size after deletion:', map.size); // Expected: 3 // Iterate over key-value pairs console.log('Map entries:'); map.forEach(function(value, key) { console.log(` Key: ${JSON.stringify(key)}, Value: ${value}`); });
Debug
Known footguns
gotchaThe `hashmap` package has not been updated in over eight years (last publish date is 8 years ago as of April 2026). This indicates it is likely abandoned, may not be compatible with newer Node.js versions or browser features, and will not receive security patches or bug fixes.
deprecatedThe methods `remove(key)` and `count()` are deprecated aliases. `remove(key)` is an alias for `delete(key)`, and `count()` is an alias for the `size` property.
gotchaThis package is designed for CommonJS (`require`) and does not natively support ES Modules (`import`). Attempting to use `import` syntax directly in a pure ESM environment without a CJS interop layer will fail.
gotchaThe package does not ship with TypeScript type definitions (`.d.ts` files). Users in TypeScript projects will need to provide their own type declarations or install community-maintained types (if available) to avoid type errors.
Upgrade
Version history

Breaking-change detection hasn't run for this library yet.

Audit
Security & dependencies

CVE tracking and dependency tree are planned for a later release.

Agent activity
0 hits · last 30 days

No traffic data recorded yet.

Resources