@byloth/core 2.1.1 → 2.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@byloth/core",
3
- "version": "2.1.1",
3
+ "version": "2.1.2",
4
4
  "description": "An unopinionated collection of useful functions and classes that I use widely in all my projects. 🔧",
5
5
  "keywords": [
6
6
  "Core",
@@ -51,14 +51,14 @@
51
51
  "devDependencies": {
52
52
  "@byloth/eslint-config-typescript": "^3.1.0",
53
53
  "@eslint/compat": "^1.2.9",
54
- "@types/node": "^22.15.18",
55
- "@vitest/coverage-v8": "^3.1.3",
56
- "eslint": "^9.26.0",
54
+ "@types/node": "^22.15.21",
55
+ "@vitest/coverage-v8": "^3.1.4",
56
+ "eslint": "^9.27.0",
57
57
  "husky": "^9.1.7",
58
58
  "jsdom": "^26.1.0",
59
59
  "typescript": "^5.8.3",
60
60
  "vite": "^6.3.5",
61
- "vitest": "^3.1.3"
61
+ "vitest": "^3.1.4"
62
62
  },
63
63
  "scripts": {
64
64
  "dev": "vite",
package/src/index.ts CHANGED
@@ -1,4 +1,4 @@
1
- export const VERSION = "2.1.1";
1
+ export const VERSION = "2.1.2";
2
2
 
3
3
  export type { Constructor, Interval, Timeout, ValueOf } from "./core/types.js";
4
4
 
@@ -112,10 +112,14 @@ export default class MapView<K, V> extends Map<K, V>
112
112
  */
113
113
  public override delete(key: K): boolean
114
114
  {
115
- const result = super.delete(key);
116
- if (result) { this._publisher.publish("entry:remove", key); }
115
+ const value = this.get(key);
116
+ if (value === undefined) { return false; }
117
117
 
118
- return result;
118
+ super.delete(key);
119
+
120
+ this._publisher.publish("entry:remove", key, value);
121
+
122
+ return true;
119
123
  }
120
124
 
121
125
  /**
@@ -17,7 +17,7 @@ import type SetView from "./set-view.js";
17
17
  export interface MapViewEventsMap<K, V>
18
18
  {
19
19
  "entry:add": (key: K, value: V) => void;
20
- "entry:remove": (key: K) => void;
20
+ "entry:remove": (key: K, value: V) => void;
21
21
 
22
22
  "collection:clear": () => void;
23
23
  }