@naturalcycles/js-lib 15.47.1 → 15.47.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.
@@ -1,5 +1,6 @@
1
1
  export * from './deepEquals.js';
2
2
  export * from './keySortedMap.js';
3
+ export * from './lazyKeySortedMap.js';
3
4
  export * from './map2.js';
4
5
  export * from './object.util.js';
5
6
  export * from './set2.js';
@@ -1,5 +1,6 @@
1
1
  export * from './deepEquals.js';
2
2
  export * from './keySortedMap.js';
3
+ export * from './lazyKeySortedMap.js';
3
4
  export * from './map2.js';
4
5
  export * from './object.util.js';
5
6
  export * from './set2.js';
@@ -1,5 +1,5 @@
1
1
  import type { Comparator } from '../types.js';
2
- export interface KeySortedMapOptions<K> {
2
+ export interface LazyKeySortedMapOptions<K> {
3
3
  /**
4
4
  * Defaults to undefined.
5
5
  * Undefined (default comparator) works well for String keys.
@@ -14,16 +14,16 @@ export interface KeySortedMapOptions<K> {
14
14
  *
15
15
  * @experimental
16
16
  */
17
- export declare class KeySortedMap2<K, V> implements Map<K, V> {
17
+ export declare class LazyKeySortedMap<K, V> implements Map<K, V> {
18
18
  #private;
19
19
  private readonly map;
20
20
  private readonly maybeSortedKeys;
21
21
  private keysAreSorted;
22
- constructor(entries?: [K, V][], opt?: KeySortedMapOptions<K>);
22
+ constructor(entries?: [K, V][], opt?: LazyKeySortedMapOptions<K>);
23
23
  /**
24
24
  * Convenience way to create KeySortedMap from object.
25
25
  */
26
- static of<V>(obj: Record<any, V>): KeySortedMap2<string, V>;
26
+ static of<V>(obj: Record<any, V>): LazyKeySortedMap<string, V>;
27
27
  get size(): number;
28
28
  clear(): void;
29
29
  has(key: K): boolean;
@@ -5,7 +5,7 @@ import { _assert } from '../error/index.js';
5
5
  *
6
6
  * @experimental
7
7
  */
8
- export class KeySortedMap2 {
8
+ export class LazyKeySortedMap {
9
9
  map;
10
10
  maybeSortedKeys;
11
11
  keysAreSorted = false;
@@ -19,7 +19,7 @@ export class KeySortedMap2 {
19
19
  * Convenience way to create KeySortedMap from object.
20
20
  */
21
21
  static of(obj) {
22
- return new KeySortedMap2(Object.entries(obj));
22
+ return new LazyKeySortedMap(Object.entries(obj));
23
23
  }
24
24
  get size() {
25
25
  return this.map.size;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@naturalcycles/js-lib",
3
3
  "type": "module",
4
- "version": "15.47.1",
4
+ "version": "15.47.3",
5
5
  "dependencies": {
6
6
  "tslib": "^2",
7
7
  "undici": "^7",
@@ -13,7 +13,7 @@
13
13
  "@types/semver": "^7",
14
14
  "crypto-js": "^4",
15
15
  "dayjs": "^1",
16
- "@naturalcycles/dev-lib": "20.11.1"
16
+ "@naturalcycles/dev-lib": "18.4.2"
17
17
  },
18
18
  "exports": {
19
19
  ".": "./dist/index.js",
@@ -54,7 +54,7 @@
54
54
  "types": "dist/index.d.ts",
55
55
  "sideEffects": false,
56
56
  "engines": {
57
- "node": ">=24.10.0"
57
+ "node": ">=24.11.0"
58
58
  },
59
59
  "publishConfig": {
60
60
  "provenance": true,
@@ -1,5 +1,6 @@
1
1
  export * from './deepEquals.js'
2
2
  export * from './keySortedMap.js'
3
+ export * from './lazyKeySortedMap.js'
3
4
  export * from './map2.js'
4
5
  export * from './object.util.js'
5
6
  export * from './set2.js'
@@ -1,7 +1,7 @@
1
1
  import { _assert } from '../error/index.js'
2
2
  import type { Comparator } from '../types.js'
3
3
 
4
- export interface KeySortedMapOptions<K> {
4
+ export interface LazyKeySortedMapOptions<K> {
5
5
  /**
6
6
  * Defaults to undefined.
7
7
  * Undefined (default comparator) works well for String keys.
@@ -17,12 +17,12 @@ export interface KeySortedMapOptions<K> {
17
17
  *
18
18
  * @experimental
19
19
  */
20
- export class KeySortedMap2<K, V> implements Map<K, V> {
20
+ export class LazyKeySortedMap<K, V> implements Map<K, V> {
21
21
  private readonly map: Map<K, V>
22
22
  private readonly maybeSortedKeys: K[]
23
23
  private keysAreSorted = false
24
24
 
25
- constructor(entries: [K, V][] = [], opt: KeySortedMapOptions<K> = {}) {
25
+ constructor(entries: [K, V][] = [], opt: LazyKeySortedMapOptions<K> = {}) {
26
26
  this.#comparator = opt.comparator
27
27
  this.map = new Map(entries)
28
28
  this.maybeSortedKeys = [...this.map.keys()]
@@ -33,8 +33,8 @@ export class KeySortedMap2<K, V> implements Map<K, V> {
33
33
  /**
34
34
  * Convenience way to create KeySortedMap from object.
35
35
  */
36
- static of<V>(obj: Record<any, V>): KeySortedMap2<string, V> {
37
- return new KeySortedMap2(Object.entries(obj))
36
+ static of<V>(obj: Record<any, V>): LazyKeySortedMap<string, V> {
37
+ return new LazyKeySortedMap(Object.entries(obj))
38
38
  }
39
39
 
40
40
  get size(): number {