@dereekb/util 8.10.0 → 8.11.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,15 @@
2
2
 
3
3
  This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
4
4
 
5
+ # [8.11.0](https://github.com/dereekb/dbx-components/compare/v8.10.0-dev...v8.11.0) (2022-07-05)
6
+
7
+
8
+ ### Features
9
+
10
+ * added specifier for crud functions ([39e366e](https://github.com/dereekb/dbx-components/commit/39e366e09936b5963cd3e74bc127ad3146d14ef7))
11
+
12
+
13
+
5
14
  # [8.10.0](https://github.com/dereekb/dbx-components/compare/v8.9.1-dev...v8.10.0) (2022-07-04)
6
15
 
7
16
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dereekb/util",
3
- "version": "8.10.0",
3
+ "version": "8.11.0",
4
4
  "type": "commonjs",
5
5
  "exports": {
6
6
  ".": {
@@ -1,5 +1,5 @@
1
- import { PrimativeKey, ReadKeyFunction } from './../key';
2
- import { ArrayOrValue } from './../array/array';
1
+ import { PrimativeKey, ReadKeyFunction } from '../key';
2
+ import { ArrayOrValue } from '../array/array';
3
3
  import { PromiseOrValue } from '../promise/promise';
4
4
  /**
5
5
  * Key used to signify
package/src/lib/type.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Merge, NonNever, PickProperties, StrictOmit, Writable } from 'ts-essentials';
1
+ import { Merge, NonNever, PickProperties, StrictOmit, UnionToIntersection, Writable } from 'ts-essentials';
2
2
  /**
3
3
  * Class typing, restricted to types that have a constructor via the new keyword.
4
4
  */
@@ -24,10 +24,12 @@ export declare type StringKeyValueTransformMap<T, V> = {
24
24
  export declare type KeysAsStrings<T> = {
25
25
  [K in keyof T as string]: T[K];
26
26
  };
27
+ export declare type ValuesTypesAsArray<T> = T[keyof T][];
27
28
  /**
28
29
  * Converts the input value to a string, if possible. Never otherwise.
29
30
  */
30
- export declare type KeyAsString<K> = K extends number | boolean | string | null | undefined ? `${K}` : never;
31
+ export declare type KeyAsString<K> = `${KeyCanBeString<K>}`;
32
+ export declare type KeyCanBeString<K> = K extends number | boolean | string | null | undefined ? K : never;
31
33
  export declare type BooleanKeyValueTransformMap<T> = KeyValueTransformMap<T, boolean>;
32
34
  /**
33
35
  * Merges the types T and R, but replaces keys within T with those in R.
@@ -67,3 +69,30 @@ export declare type StringKeyPropertyKeys<T> = keyof StringKeyProperties<T>;
67
69
  * Makes a readonly type able to be configured. Useful for configurating readonly types before they are used.
68
70
  */
69
71
  export declare type Configurable<T> = Writable<T>;
72
+ /**
73
+ * StringConcatination of all keys of an object.
74
+ */
75
+ export declare type CommaSeparatedKeysOfObject<T extends object> = CommaSeparatedKeys<`${KeyCanBeString<keyof T>}`>;
76
+ 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
+ export declare type UnionToOvlds<U> = UnionToIntersection<U extends any ? (f: U) => void : never>;
80
+ export declare type PopUnion<U> = UnionToOvlds<U> extends (a: infer A) => void ? A : never;
81
+ /**
82
+ * A type that merges all combinations of strings together using a separator.
83
+ *
84
+ * Example:
85
+ * 'a' | 'b' | 'c' w/ ',' -> 'a' | 'b' | 'c' | 'a,b' | 'a,c' | 'a,b,c' | etc...
86
+ *
87
+ * Credit to:
88
+ *
89
+ * https://stackoverflow.com/a/65157132
90
+ */
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;
92
+ /**
93
+ * A type that merges all the input strings together using a separator.
94
+ *
95
+ * Example:
96
+ * 'a' | 'b' | 'c' w/ ',' -> 'a,b,c' | 'a,c,b'
97
+ */
98
+ 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;
package/test/CHANGELOG.md CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
4
4
 
5
+ # [8.11.0](https://github.com/dereekb/dbx-components/compare/v8.10.0-dev...v8.11.0) (2022-07-05)
6
+
7
+
8
+
5
9
  # [8.10.0](https://github.com/dereekb/dbx-components/compare/v8.9.1-dev...v8.10.0) (2022-07-04)
6
10
 
7
11
 
package/test/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@dereekb/util/test",
3
- "version": "8.10.0",
3
+ "version": "8.11.0",
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.10.0",
9
+ "@dereekb/util": "8.11.0",
10
10
  "make-error": "^1.3.0",
11
11
  "ts-essentials": "^9.1.2",
12
12
  "extra-set": "^2.2.11",