@dereekb/util 8.12.0 → 8.12.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/CHANGELOG.md CHANGED
@@ -2,6 +2,18 @@
2
2
 
3
3
  This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
4
4
 
5
+ ## [8.12.3](https://github.com/dereekb/dbx-components/compare/v8.12.2-dev...v8.12.3) (2022-07-09)
6
+
7
+
8
+
9
+ ## [8.12.2](https://github.com/dereekb/dbx-components/compare/v8.12.1-dev...v8.12.2) (2022-07-08)
10
+
11
+
12
+
13
+ ## [8.12.1](https://github.com/dereekb/dbx-components/compare/v8.12.0-dev...v8.12.1) (2022-07-08)
14
+
15
+
16
+
5
17
  # [8.12.0](https://github.com/dereekb/dbx-components/compare/v8.11.2-dev...v8.12.0) (2022-07-07)
6
18
 
7
19
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dereekb/util",
3
- "version": "8.12.0",
3
+ "version": "8.12.3",
4
4
  "type": "commonjs",
5
5
  "exports": {
6
6
  ".": {
@@ -1,3 +1,4 @@
1
+ import { CopyObjectFunction } from '../object';
1
2
  import { PromiseOrValue } from '../promise/promise';
2
3
  import { MapFunction } from '../value/map';
3
4
  import { Maybe } from '../value/maybe.type';
@@ -59,6 +60,25 @@ export declare function getValueFromGetter<T extends string | number | object |
59
60
  * @returns
60
61
  */
61
62
  export declare function asGetter<T>(input: GetterOrValue<T>): Getter<T>;
63
+ /**
64
+ * A factory that returns a copy of a value.
65
+ */
66
+ export declare type ObjectCopyFactory<T> = Factory<T>;
67
+ /**
68
+ * Creates a getter from the input value that returns a copy of that value.
69
+ *
70
+ * @param value
71
+ */
72
+ export declare function objectCopyFactory<T extends object>(value: T, copyFunction?: CopyObjectFunction<T>): ObjectCopyFactory<T>;
73
+ /**
74
+ * Returns a getter that will copy any input object values to a new object.
75
+ *
76
+ * Any input Getters are considered ObjectCopyFactory values and passed through directly.
77
+ *
78
+ * @param input
79
+ * @returns
80
+ */
81
+ export declare function asObjectCopyFactory<T>(input: T | ObjectCopyFactory<T>, copyFunction?: CopyObjectFunction<T>): ObjectCopyFactory<T>;
62
82
  /**
63
83
  * Wraps the input and returns a Getter for that value.
64
84
  *
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.makeWithFactoryInput = exports.makeWithFactory = exports.makeGetter = exports.asGetter = exports.getValueFromGetter = exports.isGetter = void 0;
3
+ exports.makeWithFactoryInput = exports.makeWithFactory = exports.makeGetter = exports.asObjectCopyFactory = exports.objectCopyFactory = exports.asGetter = exports.getValueFromGetter = exports.isGetter = void 0;
4
+ const object_1 = require("../object");
4
5
  /**
5
6
  * Returns true if the input object looks like a Getter (is a function).
6
7
  *
@@ -35,6 +36,33 @@ function asGetter(input) {
35
36
  }
36
37
  }
37
38
  exports.asGetter = asGetter;
39
+ /**
40
+ * Creates a getter from the input value that returns a copy of that value.
41
+ *
42
+ * @param value
43
+ */
44
+ function objectCopyFactory(value, copyFunction = object_1.copyObject) {
45
+ return () => copyFunction(value);
46
+ }
47
+ exports.objectCopyFactory = objectCopyFactory;
48
+ /**
49
+ * Returns a getter that will copy any input object values to a new object.
50
+ *
51
+ * Any input Getters are considered ObjectCopyFactory values and passed through directly.
52
+ *
53
+ * @param input
54
+ * @returns
55
+ */
56
+ function asObjectCopyFactory(input, copyFunction) {
57
+ if (typeof input === 'object') {
58
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
59
+ return objectCopyFactory(input, copyFunction);
60
+ }
61
+ else {
62
+ return asGetter(input);
63
+ }
64
+ }
65
+ exports.asObjectCopyFactory = asObjectCopyFactory;
38
66
  /**
39
67
  * Wraps the input and returns a Getter for that value.
40
68
  *
@@ -1 +1 @@
1
- {"version":3,"file":"getter.js","sourceRoot":"","sources":["../../../../../../packages/util/src/lib/getter/getter.ts"],"names":[],"mappings":";;;AA8CA;;;;;GAKG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,CAAC,CAAC;KAC1B;IAED,OAAO,OAAO,CAAC;AACjB,CAAC;AARD,0CAQC;AAID,SAAgB,oBAAoB,CAAO,OAAuC,EAAE,KAAU;IAC5F,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;AACtC,CAAC;AAFD,oDAEC"}
@@ -111,8 +111,8 @@ export declare type ToModelFieldConversionsInput<T extends object, O extends obj
111
111
  * @returns
112
112
  */
113
113
  export declare function toModelFieldConversions<T extends object, O extends object>(input: ToModelFieldConversionsInput<T, O>): Required<{ [K in keyof T]: ModelFieldMapFunctions<T[K], ReplaceType<T, O, any>[K]>; }>;
114
- export declare type ModelMapFunctinosRef<T extends object, O extends object> = {
114
+ export declare type ModelMapFunctionsRef<T extends object, O extends object> = {
115
115
  readonly mapFunctions: ModelMapFunctions<T, O>;
116
116
  };
117
- export declare type ToModelMapFunctionsInput<T extends object, O extends object> = ToModelFieldConversionsInput<T, O> | ModelMapFunctinosRef<T, O>;
117
+ export declare type ToModelMapFunctionsInput<T extends object, O extends object> = ToModelFieldConversionsInput<T, O> | ModelMapFunctionsRef<T, O>;
118
118
  export declare function toModelMapFunctions<T extends object, O extends object>(input: ToModelMapFunctionsInput<T, O>): ModelMapFunctions<T, O>;
@@ -9,6 +9,9 @@ export declare function applyToMultipleFields<T extends object, X = unknown>(val
9
9
  export declare function mapToObject<T, K extends PropertyKey>(map: Map<K, T>): {
10
10
  [key: PropertyKey]: T;
11
11
  };
12
+ /**
13
+ * Returns a copy of the input object.
14
+ */
12
15
  export declare type CopyObjectFunction<T> = (input: T) => T;
13
16
  /**
14
17
  * Creates a shallow copy of an object using the spread operator.
@@ -1 +1 @@
1
- {"version":3,"file":"object.js","sourceRoot":"","sources":["../../../../../../packages/util/src/lib/object/object.ts"],"names":[],"mappings":";;;AAIA,SAAgB,eAAe,CAAC,GAAW;IACzC,OAAO,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC;AACvC,CAAC;AAFD,0CAEC;AAID,SAAgB,YAAY,CAAI,GAAM,EAAE,GAAW;IACjD,OAAO,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;AACxD,CAAC;AAFD,oCAEC;AAED,SAAgB,qBAAqB,CAAgC,KAAQ,EAAE,MAAwB;IACrG,MAAM,MAAM,GAAG,EAA2B,CAAC;IAE3C,MAAM,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE;QACvB,MAAM,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC;IACxB,CAAC,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC;AARD,sDAQC;AAED,SAAgB,WAAW,CAA2B,GAAc;IAClE,MAAM,MAAM,GAAG,EAA+B,CAAC;IAE/C,GAAG,CAAC,OAAO,CAAC,CAAC,CAAI,EAAE,GAAM,EAAE,EAAE;QAC3B,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC;AARD,kCAQC;AAID;;;;;GAKG;AACH,SAAgB,UAAU,CAAmB,KAAQ;IACnD,yBAAY,KAAK,EAAG;AACtB,CAAC;AAFD,gCAEC"}
1
+ {"version":3,"file":"object.js","sourceRoot":"","sources":["../../../../../../packages/util/src/lib/object/object.ts"],"names":[],"mappings":";;;AAIA,SAAgB,eAAe,CAAC,GAAW;IACzC,OAAO,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC;AACvC,CAAC;AAFD,0CAEC;AAID,SAAgB,YAAY,CAAI,GAAM,EAAE,GAAW;IACjD,OAAO,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;AACxD,CAAC;AAFD,oCAEC;AAED,SAAgB,qBAAqB,CAAgC,KAAQ,EAAE,MAAwB;IACrG,MAAM,MAAM,GAAG,EAA2B,CAAC;IAE3C,MAAM,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE;QACvB,MAAM,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC;IACxB,CAAC,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC;AARD,sDAQC;AAED,SAAgB,WAAW,CAA2B,GAAc;IAClE,MAAM,MAAM,GAAG,EAA+B,CAAC;IAE/C,GAAG,CAAC,OAAO,CAAC,CAAC,CAAI,EAAE,GAAM,EAAE,EAAE;QAC3B,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC;AARD,kCAQC;AAOD;;;;;GAKG;AACH,SAAgB,UAAU,CAAmB,KAAQ;IACnD,yBAAY,KAAK,EAAG;AACtB,CAAC;AAFD,gCAEC"}
@@ -28,3 +28,10 @@ export declare function addPlusPrefixToNumber(value?: Maybe<number>, prefix?: st
28
28
  * @returns
29
29
  */
30
30
  export declare function capitalizeFirstLetter(value: string): string;
31
+ /**
32
+ * Lowercases the first letter of the input.
33
+ *
34
+ * @param value
35
+ * @returns
36
+ */
37
+ export declare function lowercaseFirstLetter(value: string): string;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.capitalizeFirstLetter = exports.addPlusPrefixToNumber = exports.splitCommaSeparatedStringToSet = exports.splitCommaSeparatedString = exports.caseInsensitiveString = void 0;
3
+ exports.lowercaseFirstLetter = exports.capitalizeFirstLetter = exports.addPlusPrefixToNumber = exports.splitCommaSeparatedStringToSet = exports.splitCommaSeparatedString = exports.caseInsensitiveString = void 0;
4
4
  function caseInsensitiveString(input) {
5
5
  return input === null || input === void 0 ? void 0 : input.toLocaleLowerCase();
6
6
  }
@@ -38,4 +38,14 @@ function capitalizeFirstLetter(value) {
38
38
  return value.charAt(0).toUpperCase() + value.slice(1);
39
39
  }
40
40
  exports.capitalizeFirstLetter = capitalizeFirstLetter;
41
+ /**
42
+ * Lowercases the first letter of the input.
43
+ *
44
+ * @param value
45
+ * @returns
46
+ */
47
+ function lowercaseFirstLetter(value) {
48
+ return value.charAt(0).toLowerCase() + value.slice(1);
49
+ }
50
+ exports.lowercaseFirstLetter = lowercaseFirstLetter;
41
51
  //# sourceMappingURL=string.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"string.js","sourceRoot":"","sources":["../../../../../../packages/util/src/lib/string/string.ts"],"names":[],"mappings":";;;AAkBA,SAAgB,qBAAqB,CAAC,KAAoB;IACxD,OAAO,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,iBAAiB,EAAE,CAAC;AACpC,CAAC;AAFD,sDAEC;AAID,SAAgB,yBAAyB,CAAc,KAA8B,EAAE,QAA8B,CAAC,CAAC,EAAE,EAAE,CAAC,CAAiB;IAC3I,MAAM,MAAM,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAChC,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;AAC5C,CAAC;AAHD,8DAGC;AAED,SAAgB,8BAA8B,CAAC,KAAkC;IAC/E,OAAO,IAAI,GAAG,CAAC,KAAK,IAAI,IAAI,CAAC,CAAC,CAAC,yBAAyB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;AACxE,CAAC;AAFD,wEAEC;AAED;;;;GAIG;AACH,SAAgB,qBAAqB,CAAC,KAAqB,EAAE,MAAM,GAAG,GAAG;IACvE,IAAI,KAAK,IAAI,IAAI,EAAE;QACjB,OAAO,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,MAAM,GAAG,KAAK,EAAE,CAAC,CAAC,CAAC,GAAG,KAAK,EAAE,CAAC;KACrD;SAAM;QACL,OAAO,SAAS,CAAC;KAClB;AACH,CAAC;AAND,sDAMC;AAED;;;;;GAKG;AACH,SAAgB,qBAAqB,CAAC,KAAa;IACjD,OAAO,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AACxD,CAAC;AAFD,sDAEC"}
1
+ {"version":3,"file":"string.js","sourceRoot":"","sources":["../../../../../../packages/util/src/lib/string/string.ts"],"names":[],"mappings":";;;AAkBA,SAAgB,qBAAqB,CAAC,KAAoB;IACxD,OAAO,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,iBAAiB,EAAE,CAAC;AACpC,CAAC;AAFD,sDAEC;AAID,SAAgB,yBAAyB,CAAc,KAA8B,EAAE,QAA8B,CAAC,CAAC,EAAE,EAAE,CAAC,CAAiB;IAC3I,MAAM,MAAM,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAChC,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;AAC5C,CAAC;AAHD,8DAGC;AAED,SAAgB,8BAA8B,CAAC,KAAkC;IAC/E,OAAO,IAAI,GAAG,CAAC,KAAK,IAAI,IAAI,CAAC,CAAC,CAAC,yBAAyB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;AACxE,CAAC;AAFD,wEAEC;AAED;;;;GAIG;AACH,SAAgB,qBAAqB,CAAC,KAAqB,EAAE,MAAM,GAAG,GAAG;IACvE,IAAI,KAAK,IAAI,IAAI,EAAE;QACjB,OAAO,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,MAAM,GAAG,KAAK,EAAE,CAAC,CAAC,CAAC,GAAG,KAAK,EAAE,CAAC;KACrD;SAAM;QACL,OAAO,SAAS,CAAC;KAClB;AACH,CAAC;AAND,sDAMC;AAED;;;;;GAKG;AACH,SAAgB,qBAAqB,CAAC,KAAa;IACjD,OAAO,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AACxD,CAAC;AAFD,sDAEC;AAED;;;;;GAKG;AACH,SAAgB,oBAAoB,CAAC,KAAa;IAChD,OAAO,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AACxD,CAAC;AAFD,oDAEC"}
package/src/lib/type.d.ts CHANGED
@@ -69,17 +69,25 @@ export declare type StringKeyPropertyKeys<T> = keyof StringKeyProperties<T>;
69
69
  * Makes a readonly type able to be configured. Useful for configurating readonly types before they are used.
70
70
  */
71
71
  export declare type Configurable<T> = Writable<T>;
72
+ /**
73
+ * StringOrder of all keys of an object.
74
+ */
75
+ export declare type CommaSeparatedKeyOrderOfObject<T extends object> = CommaSeparatedKeyOrder<`${KeyCanBeString<keyof T>}`>;
76
+ export declare type CommaSeparatedKeyOrder<T extends string> = StringOrder<T, ','>;
77
+ /**
78
+ * StringCombinations of all keys of an object.
79
+ */
80
+ export declare type CommaSeparatedKeyCombinationsOfObject<T extends object> = CommaSeparatedKeyCombinations<`${KeyCanBeString<keyof T>}`>;
81
+ export declare type CommaSeparatedKeyCombinations<T extends string> = StringCombination<T, ','>;
72
82
  /**
73
83
  * StringConcatination of all keys of an object.
74
84
  */
75
85
  export declare type CommaSeparatedKeysOfObject<T extends object> = CommaSeparatedKeys<`${KeyCanBeString<keyof T>}`>;
76
86
  export declare type CommaSeparatedKeys<T extends string> = StringConcatination<T, ','>;
77
- export declare type CommaSeparatedKeyCombinationsOfObject<T extends object> = CommaSeparatedKeyCombinations<`${KeyCanBeString<keyof T>}`>;
78
- export declare type CommaSeparatedKeyCombinations<T extends string> = StringCombinations<T, ','>;
79
87
  export declare type UnionToOvlds<U> = UnionToIntersection<U extends any ? (f: U) => void : never>;
80
88
  export declare type PopUnion<U> = UnionToOvlds<U> extends (a: infer A) => void ? A : never;
81
89
  /**
82
- * A type that merges all combinations of strings together using a separator.
90
+ * A type that merges all combinations of strings together using a separator, but restricts a certain order.
83
91
  *
84
92
  * Example:
85
93
  * 'a' | 'b' | 'c' w/ ',' -> 'a' | 'b' | 'c' | 'a,b' | 'a,c' | 'a,b,c' | etc...
@@ -88,7 +96,14 @@ export declare type PopUnion<U> = UnionToOvlds<U> extends (a: infer A) => void ?
88
96
  *
89
97
  * https://stackoverflow.com/a/65157132
90
98
  */
91
- export declare type StringCombinations<S extends string, SEPARATOR extends string> = PopUnion<S> extends infer SELF ? SELF extends string ? Exclude<S, SELF> extends never ? SELF : `${StringCombinations<Exclude<S, SELF>, SEPARATOR>}${SEPARATOR}${SELF}` | StringCombinations<Exclude<S, SELF>, SEPARATOR> | SELF : never : never;
99
+ export declare type StringOrder<S extends string, SEPARATOR extends string> = PopUnion<S> extends infer SELF ? SELF extends string ? Exclude<S, SELF> extends never ? SELF : `${StringOrder<Exclude<S, SELF>, SEPARATOR>}${SEPARATOR}${SELF}` | StringOrder<Exclude<S, SELF>, SEPARATOR> | SELF : never : never;
100
+ /**
101
+ * A type that merges all combinations of strings together using a separator.
102
+ *
103
+ * Example:
104
+ * 'a' | 'b' | 'c' w/ ',' -> 'a' | 'b' | 'c' | 'a,b' | 'b,a' | 'c,a,b' | etc...
105
+ */
106
+ export declare type StringCombination<S extends string, SEPARATOR extends string> = PopUnion<S> extends infer SELF ? SELF extends string ? Exclude<S, SELF> extends never ? SELF : `${StringCombination<Exclude<S, SELF>, SEPARATOR>}${SEPARATOR}${SELF}` | `${SELF}${SEPARATOR}${StringCombination<Exclude<S, SELF>, SEPARATOR>}` | StringCombination<Exclude<S, SELF>, SEPARATOR> | SELF : never : never;
92
107
  /**
93
108
  * A type that merges all the input strings together using a separator.
94
109
  *
@@ -96,3 +111,7 @@ export declare type StringCombinations<S extends string, SEPARATOR extends strin
96
111
  * 'a' | 'b' | 'c' w/ ',' -> 'a,b,c' | 'a,c,b'
97
112
  */
98
113
  export declare type StringConcatination<S extends string, SEPARATOR extends string> = PopUnion<S> extends infer SELF ? SELF extends string ? Exclude<S, SELF> extends never ? SELF : `${StringConcatination<Exclude<S, SELF>, SEPARATOR>}${SEPARATOR}${SELF}` | `${SELF}${SEPARATOR}${StringConcatination<Exclude<S, SELF>, SEPARATOR>}` : never : never;
114
+ /**
115
+ * @deprecated use StringCombination
116
+ */
117
+ export declare type StringCombinations<S extends string, SEPARATOR extends string> = StringCombination<S, SEPARATOR>;
package/test/CHANGELOG.md CHANGED
@@ -2,6 +2,18 @@
2
2
 
3
3
  This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
4
4
 
5
+ ## [8.12.3](https://github.com/dereekb/dbx-components/compare/v8.12.2-dev...v8.12.3) (2022-07-09)
6
+
7
+
8
+
9
+ ## [8.12.2](https://github.com/dereekb/dbx-components/compare/v8.12.1-dev...v8.12.2) (2022-07-08)
10
+
11
+
12
+
13
+ ## [8.12.1](https://github.com/dereekb/dbx-components/compare/v8.12.0-dev...v8.12.1) (2022-07-08)
14
+
15
+
16
+
5
17
  # [8.12.0](https://github.com/dereekb/dbx-components/compare/v8.11.2-dev...v8.12.0) (2022-07-07)
6
18
 
7
19
 
package/test/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@dereekb/util/test",
3
- "version": "8.12.0",
3
+ "version": "8.12.3",
4
4
  "type": "commonjs",
5
5
  "main": "./src/index.js",
6
6
  "typings": "./src/index.d.ts",
7
7
  "dependencies": {},
8
8
  "peerDependencies": {
9
- "@dereekb/util": "8.12.0",
9
+ "@dereekb/util": "8.12.3",
10
10
  "make-error": "^1.3.0",
11
11
  "ts-essentials": "^9.1.2",
12
12
  "extra-set": "^2.2.11",