From 0731751d10c6dfbb21f8b71b101ccbf2486d60e7 Mon Sep 17 00:00:00 2001 From: Daniyar Kurmangaliyev Date: Thu, 29 Jan 2026 01:56:50 +0500 Subject: [PATCH 1/2] feat: add shortcuts WishMap#on, WishMap#once and WishMap#off --- README.md | 50 +++++++++++++++++++++++++++++++++++++++++++++++--- package.json | 1 + src/index.ts | 6 +++++- 3 files changed, 53 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 146cc1d..9c324a8 100644 --- a/README.md +++ b/README.md @@ -6,13 +6,57 @@ An extended `Map` with Array-like methods and event emission. [API Docs](https://danliyev.github.io/WishMap) -## Installation +# Installation + +## Using NPM Registry ```bash npm install @danliyev/wishmap ``` -## Usage +## Using GitHub Packages Registry + +1. Create a [GitHub Personal Access Token](https://github.com/settings/tokens/new) with `read:packages` scope + +2. Add to your shell profile (`.bashrc`, `.zshrc`, or `.profile`): + +```bash +export GITHUB_TOKEN=your_token_here +``` + +3. In your project directory, create `.npmrc`: + +``` +@danliyev:registry=https://npm.pkg.github.com/ +//npm.pkg.github.com/:_authToken=${GITHUB_TOKEN} +``` + +4. Install: + +```bash +npm install @danliyev/wishmap +``` + +### Alternative: npm login + +Authenticate once with GitHub Packages: + +```bash +npm login --registry=https://npm.pkg.github.com --scope=@danliyev +# Username: your-github-username +# Password: your-personal-access-token (with read:packages scope) +# Email: your-email +``` + +Then install normally: + +```bash +npm install @danliyev/wishmap +``` + +See [Working with the npm registry](https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-npm-registry) for more information. + +# Usage ```typescript import { WishMap } from '@danliyev/wishmap' @@ -42,6 +86,6 @@ map.some(v => v > 2) // true map.reduce((acc, v) => acc + v, 0) // 6 ``` -## License +# License This project is licensed under the [MIT License](./LICENSE). diff --git a/package.json b/package.json index d3e6bc5..06ae8b3 100644 --- a/package.json +++ b/package.json @@ -3,6 +3,7 @@ "version": "1.0.3", "description": "An extended JavaScript Map with Array-like methods and event emission.", "main": "dist/index.js", + "types": "dist/index.d.ts", "scripts": { "build": "tsup" }, diff --git a/src/index.ts b/src/index.ts index 25265f8..c938f14 100644 --- a/src/index.ts +++ b/src/index.ts @@ -8,7 +8,11 @@ import { EventEmitter } from 'node:events' */ export class WishMap extends Map { /** Event emitter for map mutations */ - public events: EventEmitter> = new EventEmitter() + public readonly events: EventEmitter> = new EventEmitter() + + public on = this.events.on + public once = this.events.once + public off = this.events.off /** * Removes the specified element from the map. From 7c8144539921f2fe7c5a2be0b7bbe21df8000a1e Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 28 Jan 2026 20:57:37 +0000 Subject: [PATCH 2/2] chore: bump version to 1.0.4 --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index cc9dab3..9138066 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "wishmap", - "version": "1.0.3", + "version": "1.0.4", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "wishmap", - "version": "1.0.3", + "version": "1.0.4", "license": "MIT", "devDependencies": { "@types/node": "^25.0.10", diff --git a/package.json b/package.json index 06ae8b3..9824f53 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@danliyev/wishmap", - "version": "1.0.3", + "version": "1.0.4", "description": "An extended JavaScript Map with Array-like methods and event emission.", "main": "dist/index.js", "types": "dist/index.d.ts",