@williamthorsen/toolbelt.arrays 3.3.8 → 3.4.0

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/CHANGELOG.md CHANGED
@@ -2,6 +2,50 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file.
4
4
 
5
+ ## 3.4.0 — 2026-08-08
6
+
7
+ ### Features
8
+
9
+ - Use underscore separator at 4 digits or more
10
+
11
+ Changes the `unicorn/numeric-separators-style` rule config so that separators are consistently used in base 10 numbers, instead of exempting numbers of 5 digits or less.
12
+
13
+ ### Refactoring
14
+
15
+ - Fix slug punctuation and require safe integers (#86)
16
+
17
+ - Fixes an issue where the use of certain letters as the slug separator in `slugify` would leave punctuation marks in the result.
18
+ - Time-unit conversions, scaling range bounds, normal-distribution interval counts, and array indices in object paths now reject values too large to represent exactly instead of silently losing precision.
19
+ - Seeded number generators now produce distinct sequences for seeds at or beyond 2^53, where adjacent seeds previously collapsed onto nearly identical output. A seed of that size saved before this release no longer reproduces the same output.
20
+
21
+ ### Tooling
22
+
23
+ - Migrate Vitest configs to the nmr projects model (#73)
24
+
25
+ Packages no longer need to declare their own Vitest config. Test suites are now selected by a test file's name suffix rather than by choosing a config file: `*.app.test.ts` and `*.int.test.ts` route to the app and integration suites, and everything else runs as a unit test. Local development is now declared to require Node 24.16 or later.
26
+
27
+ - Adopt the centralized tsconfig with more modern settings (#81)
28
+
29
+ Raises the language level for typechecking to ES2025, so code across the monorepo can now use `Promise.try`, `RegExp.escape`, the new `Set` methods, and iterator helpers. Typechecking is also stricter: properties reached through an index signature must now be read with bracket access. Published output is unchanged.
30
+
31
+ - Adopt four deferred unicorn lint rules (#90)
32
+
33
+ The strict-lint severity cap of four lint rules has been raised to error: `no-array-from-fill`, `no-return-array-push`, `no-unreadable-array-destructuring`, and `prefer-math-constants`.
34
+
35
+ - Use identical compiler settings for all packages (#105)
36
+
37
+ All packages now have identical compiler settings, using the settings from the `@williamthorsen/tsconfig` base config without modification.
38
+
39
+ ## 3.3.9 — 2026-07-27
40
+
41
+ ### Tooling
42
+
43
+ - Normalize Vitest, and lint configs
44
+
45
+ ### Documentation
46
+
47
+ - Change license to ISC
48
+
5
49
  ## 3.3.8 — 2026-07-24
6
50
 
7
51
  ### Tooling
package/LICENSE CHANGED
@@ -1,7 +1,7 @@
1
- UNLICENSED SOFTWARE
1
+ ISC License
2
2
 
3
- Copyright (c) 2023-2025 William Thorsen
3
+ Copyright (c) 2023-2026 William Thorsen
4
4
 
5
- All rights reserved.
5
+ Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
6
6
 
7
- This software is provided 'as-is', without any express or implied warranty. No rights are granted to use, copy, modify, or distribute this software for any purpose. For full legal details, consult a legal expert. This notice may not be removed or altered from any distribution.
7
+ The software is provided "as is" and the author disclaims all warranties with regard to this software including all implied warranties of merchantability and fitness. In no event shall the author be liable for any special, direct, indirect, or consequential damages or any damages whatsoever resulting from loss of use, data or profits, whether in an action of contract, negligence or other tortious action, arising out of or in connection with the use or performance of this software.
package/README.md CHANGED
@@ -2,7 +2,15 @@
2
2
 
3
3
  Array utilities.
4
4
 
5
- <!-- section:release-notes --><!-- /section:release-notes -->
5
+ <!-- section:release-notes -->
6
+ ## Release notes — v3.4.0 (2026-08-08)
7
+
8
+ ### Features
9
+
10
+ - Use underscore separator at 4 digits or more
11
+
12
+ Changes the `unicorn/numeric-separators-style` rule config so that separators are consistently used in base 10 numbers, instead of exempting numbers of 5 digits or less.
13
+ <!-- /section:release-notes -->
6
14
 
7
15
  ## Installation
8
16
 
@@ -1,14 +1,16 @@
1
- import { generateRandom, SeededRng } from '@williamthorsen/toolbelt.numbers/candidate';
1
+ import { pickInteger, SeededRng } from '@williamthorsen/toolbelt.numbers/candidate';
2
2
  import { getAtIndexOrThrow } from "./getAtIndexOrThrow.js";
3
3
  export function shuffle(items, options = {}) {
4
- const tempItems = [...items];
5
- shuffleInPlace(tempItems, options);
6
- return tempItems;
4
+ const shuffled = [...items];
5
+ shuffleInPlace(shuffled, options);
6
+ return shuffled;
7
7
  }
8
8
  export function shuffleInPlace(items, options = {}) {
9
9
  const seed = SeededRng.spawn(options.seed);
10
10
  for (let i = items.length - 1; i > 0; i--) {
11
- const j = Math.floor(generateRandom({ seed }) * (i + 1));
12
- [items[i], items[j]] = [getAtIndexOrThrow(items, j), getAtIndexOrThrow(items, i)];
11
+ const j = pickInteger({ max: i, seed });
12
+ const swapped = getAtIndexOrThrow(items, i);
13
+ items[i] = getAtIndexOrThrow(items, j);
14
+ items[j] = swapped;
13
15
  }
14
16
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@williamthorsen/toolbelt.arrays",
3
- "version": "3.3.8",
3
+ "version": "3.4.0",
4
4
  "description": "API",
5
5
  "keywords": [],
6
6
  "homepage": "https://github.com/williamthorsen/toolbelt/tree/main/packages/arrays#readme",
@@ -12,7 +12,7 @@
12
12
  "url": "git+https://github.com/williamthorsen/toolbelt.git",
13
13
  "directory": "packages/arrays"
14
14
  },
15
- "license": "UNLICENSED",
15
+ "license": "ISC",
16
16
  "author": "William Thorsen <william@thorsen.dev> (https://github.com/williamthorsen)",
17
17
  "type": "module",
18
18
  "exports": {
@@ -34,8 +34,8 @@
34
34
  "CHANGELOG.md"
35
35
  ],
36
36
  "dependencies": {
37
- "@williamthorsen/toolbelt.guards": "3.1.7",
38
- "@williamthorsen/toolbelt.numbers": "4.3.7"
37
+ "@williamthorsen/toolbelt.guards": "3.1.9",
38
+ "@williamthorsen/toolbelt.numbers": "5.0.0"
39
39
  },
40
40
  "engines": {
41
41
  "node": ">=24.0.0"