@dereekb/util 10.1.6 → 10.1.8

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": "@dereekb/util",
3
- "version": "10.1.6",
3
+ "version": "10.1.8",
4
4
  "exports": {
5
5
  ".": {
6
6
  "types": "./src/index.d.ts",
@@ -2,7 +2,9 @@ import { type PrimativeKey, type ReadKeyFunction, type ReadMultipleKeysFunction
2
2
  import { type IterableOrValue } from '../iterable/iterable';
3
3
  import { type Maybe } from '../value/maybe.type';
4
4
  /**
5
- * Creates a map by reading keys from the input values. Values without a key are ignored.
5
+ * Creates a map by reading keys from the input values.
6
+ *
7
+ * Values without a key (null/undefined) are ignored.
6
8
  */
7
9
  export type KeyValueMapFactory<T, K extends PrimativeKey = PrimativeKey> = (values: T[]) => Map<K, T>;
8
10
  /**
@@ -5,6 +5,7 @@ import { type MinAndMaxFunction, type MinAndMaxFunctionResult, type SortCompareF
5
5
  import { type FactoryWithRequiredInput } from '../getter/getter';
6
6
  import { type Maybe } from './maybe.type';
7
7
  import { type WrapNumberFunction } from '../number';
8
+ import { type FilterUniqueFunctionExcludeKeysInput } from '../array/array.unique';
8
9
  /**
9
10
  * A number that denotes which index an item is at.
10
11
  */
@@ -18,6 +19,13 @@ export interface IndexRef {
18
19
  */
19
20
  i: IndexNumber;
20
21
  }
22
+ /**
23
+ * Convenience function for calling readKeysToMap() and keying the values by their index number.
24
+ *
25
+ * @param items
26
+ * @returns
27
+ */
28
+ export declare function indexRefMap<T extends IndexRef>(items: T[]): Map<IndexNumber, T>;
21
29
  /**
22
30
  * IndexRef object that may not have an index set yet
23
31
  */
@@ -155,6 +163,12 @@ export declare function findBestIndexMatch<T extends IndexRef>(input: T[], i: In
155
163
  * @returns
156
164
  */
157
165
  export declare function safeFindBestIndexMatch<T extends IndexRef>(input: Maybe<T[]>, i: IndexNumber): Maybe<T>;
166
+ /**
167
+ * Creates a FilterUniqueFunction that filters by the input value's index.
168
+ *
169
+ * @param readIndex
170
+ */
171
+ export declare const filterUniqueByIndex: <T>(input: T[], exclude?: FilterUniqueFunctionExcludeKeysInput<T, number> | undefined) => T[];
158
172
  /**
159
173
  * A min and max value that denote the maximum edges of a range of index values.
160
174
  */
@@ -1,3 +1,4 @@
1
+ import { type PrimativeKey } from '../key';
1
2
  /**
2
3
  * Refernce to a label string.
3
4
  */
@@ -10,3 +11,10 @@ export interface LabelRef {
10
11
  export interface LabeledValue<T> extends LabelRef {
11
12
  value: T;
12
13
  }
14
+ /**
15
+ * Creates a new Map of LabeledValue values.
16
+ *
17
+ * @param values
18
+ * @returns
19
+ */
20
+ export declare function labeledValueMap<V extends LabeledValue<T>, T extends PrimativeKey>(values: V[]): Map<T, V>;
package/test/CHANGELOG.md CHANGED
@@ -2,6 +2,14 @@
2
2
 
3
3
  This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
4
4
 
5
+ ## [10.1.8](https://github.com/dereekb/dbx-components/compare/v10.1.7-dev...v10.1.8) (2024-04-02)
6
+
7
+
8
+
9
+ ## [10.1.7](https://github.com/dereekb/dbx-components/compare/v10.1.6-dev...v10.1.7) (2024-03-28)
10
+
11
+
12
+
5
13
  ## [10.1.6](https://github.com/dereekb/dbx-components/compare/v10.1.5-dev...v10.1.6) (2024-03-26)
6
14
 
7
15
 
package/test/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dereekb/util/test",
3
- "version": "10.1.6",
3
+ "version": "10.1.8",
4
4
  "type": "commonjs",
5
5
  "peerDependencies": {
6
6
  "@dereekb/util": "*"