@nxtedition/unordered 1.0.2 → 1.0.3

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/lib/index.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare function remove<T>(array: T[], idx: number): void;
1
+ export declare function remove<T>(array: T[], idx: number): void | T;
2
2
  export declare function filter<T>(array: T[], predicate: (value: T) => boolean): void;
package/lib/index.js CHANGED
@@ -1,11 +1,11 @@
1
- export function remove (array , idx ) {
1
+ export function remove (array , idx ) {
2
2
  if (idx < 0 || idx >= array.length) {
3
3
  throw new RangeError(`Index ${idx} out of bounds for array of length ${array.length}`)
4
4
  }
5
5
 
6
6
  const last = array.length - 1
7
7
  if (idx !== last) {
8
- array[idx] = array.pop()
8
+ return (array[idx] = array.pop() )
9
9
  } else {
10
10
  array.pop()
11
11
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nxtedition/unordered",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "type": "module",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -27,5 +27,5 @@
27
27
  "rimraf": "^6.1.3",
28
28
  "typescript": "^5.9.3"
29
29
  },
30
- "gitHead": "f6592f0be62fecc161237610ae6454ec6585548b"
30
+ "gitHead": "cfc529e921c93a1fb0292018e2026f2b326ec998"
31
31
  }