This library, `typescript-map`, provides a lightweight, TypeScript-first implementation of an ES6 Map-like data structure. Currently at version 0.1.0, it is designed for scenarios where a full ES6 Map polyfill is not desired or where bundle size is a critical concern, weighing in at just over 1 kilobyte gzipped. A key differentiator is its deliberate simplicity: it does not employ a hashing function. While this keeps the implementation small and straightforward, it means the library is explicitly *not* recommended for use with more than a few hundred keys or in performance-critical "hot path" operations, where native `Map` or more robust alternatives like `es6-map` would be superior. The release cadence appears to be slow or inactive given the low version number and its niche purpose. It is primarily intended for TypeScript projects needing a basic, type-safe map collection without significant overhead.
npm install typescript-mapVerified import paths — ran on the pinned version, not inferred.
Demonstrates basic instantiation, setting and getting values, type-safe usage with generics, initialization with an array, and a custom `fromJSON` method.
If a full ES6 Map polyfill is required, use `es6-map` or a similar solution. This library is an alternative for specific use cases.
For large datasets or 'hot path' scenarios, use the native `Map` object or a robust polyfill/library that employs hashing (e.g., `es6-map`).
Prefer using module bundlers (like Webpack or Rollup) with ES modules or CommonJS imports to encapsulate the library's scope and avoid global variable conflicts.
Ensure you are instantiating the class with `new TSMap()` and that your CommonJS import is `const TSMap = require('typescript-map').TSMap;`.Verify that `TSMap` has been correctly imported and instantiated (e.g., `const myMap = new TSMap();`).
This library is not a polyfill for the native `Map`. If native `Map` compatibility is required, consider using `es6-map` or adapting your code to accept `TSMap` where appropriate, or converting `TSMap` to a standard object if only basic iteration is needed.
No dependency data recorded yet.