@maxclicks/utilities 1.6.0 → 1.6.1
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/dist/helpers/deepClone.d.ts +1 -0
- package/dist/helpers/deepClone.d.ts.map +1 -1
- package/dist/helpers/deepClone.js +1 -0
- package/dist/helpers/deepClone.js.map +1 -1
- package/dist/helpers/delay.d.ts +7 -0
- package/dist/helpers/delay.d.ts.map +1 -1
- package/dist/helpers/delay.js +1 -1
- package/dist/helpers/delay.js.map +1 -1
- package/dist/helpers/error-warning/alterError.d.ts +6 -0
- package/dist/helpers/error-warning/alterError.d.ts.map +1 -1
- package/dist/helpers/error-warning/alterError.js +6 -0
- package/dist/helpers/error-warning/alterError.js.map +1 -1
- package/dist/helpers/error-warning/combineMessages.d.ts +6 -0
- package/dist/helpers/error-warning/combineMessages.d.ts.map +1 -1
- package/dist/helpers/error-warning/combineMessages.js +6 -0
- package/dist/helpers/error-warning/combineMessages.js.map +1 -1
- package/dist/helpers/error-warning/getErrorMessage.d.ts +1 -0
- package/dist/helpers/error-warning/getErrorMessage.d.ts.map +1 -1
- package/dist/helpers/error-warning/getErrorMessage.js +1 -0
- package/dist/helpers/error-warning/getErrorMessage.js.map +1 -1
- package/dist/helpers/error-warning/prependMessage.d.ts +6 -0
- package/dist/helpers/error-warning/prependMessage.d.ts.map +1 -1
- package/dist/helpers/error-warning/prependMessage.js +6 -0
- package/dist/helpers/error-warning/prependMessage.js.map +1 -1
- package/dist/helpers/error-warning/throwError.d.ts +7 -0
- package/dist/helpers/error-warning/throwError.d.ts.map +1 -1
- package/dist/helpers/error-warning/throwError.js +9 -0
- package/dist/helpers/error-warning/throwError.js.map +1 -1
- package/dist/helpers/escapeForRegExp.d.ts +1 -0
- package/dist/helpers/escapeForRegExp.d.ts.map +1 -1
- package/dist/helpers/escapeForRegExp.js +2 -1
- package/dist/helpers/escapeForRegExp.js.map +1 -1
- package/dist/helpers/formatCurrencyUsd.d.ts +1 -0
- package/dist/helpers/formatCurrencyUsd.d.ts.map +1 -1
- package/dist/helpers/formatCurrencyUsd.js +1 -0
- package/dist/helpers/formatCurrencyUsd.js.map +1 -1
- package/dist/helpers/generateRandomKey.d.ts +6 -0
- package/dist/helpers/generateRandomKey.d.ts.map +1 -1
- package/dist/helpers/generateRandomKey.js +6 -0
- package/dist/helpers/generateRandomKey.js.map +1 -1
- package/dist/helpers/generateRuntimeId.d.ts +1 -0
- package/dist/helpers/generateRuntimeId.d.ts.map +1 -1
- package/dist/helpers/generateRuntimeId.js +1 -0
- package/dist/helpers/generateRuntimeId.js.map +1 -1
- package/dist/helpers/generateSequence.d.ts +5 -0
- package/dist/helpers/generateSequence.d.ts.map +1 -1
- package/dist/helpers/generateSequence.js +5 -0
- package/dist/helpers/generateSequence.js.map +1 -1
- package/dist/helpers/getEnumKeyValues.d.ts +1 -0
- package/dist/helpers/getEnumKeyValues.d.ts.map +1 -1
- package/dist/helpers/getEnumKeyValues.js +2 -0
- package/dist/helpers/getEnumKeyValues.js.map +1 -1
- package/dist/helpers/haveSameContents.d.ts +1 -0
- package/dist/helpers/haveSameContents.d.ts.map +1 -1
- package/dist/helpers/haveSameContents.js +1 -0
- package/dist/helpers/haveSameContents.js.map +1 -1
- package/dist/helpers/isOneOf.d.ts +5 -0
- package/dist/helpers/isOneOf.d.ts.map +1 -1
- package/dist/helpers/isOneOf.js +5 -0
- package/dist/helpers/isOneOf.js.map +1 -1
- package/dist/helpers/native/arrayHelpers.d.ts +4 -0
- package/dist/helpers/native/arrayHelpers.d.ts.map +1 -1
- package/dist/helpers/native/arrayHelpers.js +1 -1
- package/dist/helpers/native/arrayHelpers.js.map +1 -1
- package/dist/helpers/native/objectHelpers.d.ts +3 -0
- package/dist/helpers/native/objectHelpers.d.ts.map +1 -1
- package/dist/helpers/native/stringHelpers.d.ts +3 -0
- package/dist/helpers/native/stringHelpers.d.ts.map +1 -1
- package/dist/helpers/optional.d.ts +3 -0
- package/dist/helpers/optional.d.ts.map +1 -1
- package/dist/helpers/optional.js +3 -0
- package/dist/helpers/optional.js.map +1 -1
- package/dist/helpers/percent.d.ts +2 -0
- package/dist/helpers/percent.d.ts.map +1 -1
- package/dist/helpers/percent.js +2 -0
- package/dist/helpers/percent.js.map +1 -1
- package/dist/helpers/typed.d.ts +19 -0
- package/dist/helpers/typed.d.ts.map +1 -1
- package/dist/helpers/typed.js +19 -0
- package/dist/helpers/typed.js.map +1 -1
- package/dist/modules/common-normalizers/descriptionNormalizer.d.ts +1 -0
- package/dist/modules/common-normalizers/descriptionNormalizer.d.ts.map +1 -1
- package/dist/modules/common-normalizers/descriptionNormalizer.js +1 -0
- package/dist/modules/common-normalizers/descriptionNormalizer.js.map +1 -1
- package/dist/modules/common-normalizers/labelNormalizer.d.ts +1 -0
- package/dist/modules/common-normalizers/labelNormalizer.d.ts.map +1 -1
- package/dist/modules/common-normalizers/labelNormalizer.js +1 -0
- package/dist/modules/common-normalizers/labelNormalizer.js.map +1 -1
- package/dist/modules/common-normalizers/nameNormalizer.d.ts +1 -0
- package/dist/modules/common-normalizers/nameNormalizer.d.ts.map +1 -1
- package/dist/modules/common-normalizers/nameNormalizer.js +1 -0
- package/dist/modules/common-normalizers/nameNormalizer.js.map +1 -1
- package/dist/modules/common-normalizers/widthHeightNormalizer.d.ts +1 -0
- package/dist/modules/common-normalizers/widthHeightNormalizer.d.ts.map +1 -1
- package/dist/modules/common-normalizers/widthHeightNormalizer.js +1 -0
- package/dist/modules/common-normalizers/widthHeightNormalizer.js.map +1 -1
- package/dist/types/Address.d.ts +1 -0
- package/dist/types/Address.d.ts.map +1 -1
- package/dist/types/Color.d.ts +1 -0
- package/dist/types/Color.d.ts.map +1 -1
- package/dist/types/DateOnly.d.ts +2 -0
- package/dist/types/DateOnly.d.ts.map +1 -1
- package/dist/types/DateOnly.js +1 -0
- package/dist/types/DateOnly.js.map +1 -1
- package/dist/types/DateTime.d.ts +1 -0
- package/dist/types/DateTime.d.ts.map +1 -1
- package/dist/types/Decimal.d.ts +1 -0
- package/dist/types/Decimal.d.ts.map +1 -1
- package/dist/types/Email.d.ts +1 -0
- package/dist/types/Email.d.ts.map +1 -1
- package/dist/types/Geolocation.d.ts +1 -0
- package/dist/types/Geolocation.d.ts.map +1 -1
- package/dist/types/Json/Json.d.ts +7 -0
- package/dist/types/Json/Json.d.ts.map +1 -1
- package/dist/types/Json/Json.js +6 -0
- package/dist/types/Json/Json.js.map +1 -1
- package/dist/types/Json/jsonNormalizerWithSchemaFactory.js +13 -0
- package/dist/types/Json/jsonNormalizerWithSchemaFactory.js.map +1 -1
- package/dist/types/Json/jsonSchemaNormalizer.js +11 -0
- package/dist/types/Json/jsonSchemaNormalizer.js.map +1 -1
- package/dist/types/Json/jsonSchemaSatisfies.d.ts +9 -0
- package/dist/types/Json/jsonSchemaSatisfies.d.ts.map +1 -1
- package/dist/types/Json/jsonSchemaSatisfies.js +55 -3
- package/dist/types/Json/jsonSchemaSatisfies.js.map +1 -1
- package/dist/types/Json/jsonSchemaSimplifiedSatisfies.d.ts +1 -0
- package/dist/types/Json/jsonSchemaSimplifiedSatisfies.d.ts.map +1 -1
- package/dist/types/Json/jsonSchemaSimplifiedSatisfies.js +2 -0
- package/dist/types/Json/jsonSchemaSimplifiedSatisfies.js.map +1 -1
- package/dist/types/Lazily.d.ts +39 -0
- package/dist/types/Lazily.d.ts.map +1 -1
- package/dist/types/Lazily.js +2 -0
- package/dist/types/Lazily.js.map +1 -1
- package/dist/types/Normalizer.d.ts +78 -0
- package/dist/types/Normalizer.d.ts.map +1 -1
- package/dist/types/Normalizer.js +54 -0
- package/dist/types/Normalizer.js.map +1 -1
- package/dist/types/Phone.d.ts +1 -0
- package/dist/types/Phone.d.ts.map +1 -1
- package/dist/types/Slug.d.ts +1 -0
- package/dist/types/Slug.d.ts.map +1 -1
- package/dist/types/TimeOnly.d.ts +1 -0
- package/dist/types/TimeOnly.d.ts.map +1 -1
- package/dist/types/Url.d.ts +1 -0
- package/dist/types/Url.d.ts.map +1 -1
- package/dist/types/Uuid.d.ts +1 -0
- package/dist/types/Uuid.d.ts.map +1 -1
- package/dist/types.d.ts +29 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/types.d.ts
CHANGED
|
@@ -1,27 +1,56 @@
|
|
|
1
|
+
/** Like `Omit`, but constrains `K` to keys of `T` for type safety. */
|
|
1
2
|
export type OmitTyped<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
|
|
3
|
+
/** Like `Exclude`, but constrains `U` to extend `T` for type safety. */
|
|
2
4
|
export type ExcludeTyped<T, U extends T> = T extends U ? never : T;
|
|
5
|
+
/** Removes `readonly` modifier from all properties of `T`. */
|
|
3
6
|
export type Writable<T> = {
|
|
4
7
|
-readonly [K in keyof T]: T[K];
|
|
5
8
|
};
|
|
9
|
+
/** Recursively removes `readonly` modifier from all properties. */
|
|
6
10
|
export type DeepWritable<T> = T extends BuiltIns ? T : T extends ReadonlyArray<infer U> ? Array<DeepWritable<U>> : T extends ReadonlyMap<infer K, infer V> ? Map<K, DeepWritable<V>> : T extends ReadonlySet<infer M> ? Set<DeepWritable<M>> : {
|
|
7
11
|
-readonly [K in keyof T]: DeepWritable<T[K]>;
|
|
8
12
|
};
|
|
13
|
+
/** Recursively adds `readonly` modifier to all properties. */
|
|
9
14
|
export type DeepReadonly<T> = T extends BuiltIns ? T : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepReadonly<U>> : T extends ReadonlyMap<infer K, infer V> ? ReadonlyMap<K, DeepReadonly<V>> : T extends ReadonlySet<infer M> ? ReadonlySet<DeepReadonly<M>> : {
|
|
10
15
|
readonly [K in keyof T]: DeepReadonly<T[K]>;
|
|
11
16
|
};
|
|
17
|
+
/** Recursively makes all properties optional. */
|
|
12
18
|
export type DeepPartial<T> = T extends BuiltIns ? T : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U> | undefined> : T extends Array<infer U> ? Array<DeepPartial<U> | undefined> : T extends ReadonlyMap<infer K, infer V> ? ReadonlyMap<K, DeepPartial<V> | undefined> : T extends Map<infer K, infer V> ? Map<K, DeepPartial<V> | undefined> : T extends ReadonlySet<infer M> ? ReadonlySet<DeepPartial<M>> : T extends Set<infer M> ? Set<DeepPartial<M>> : {
|
|
13
19
|
[K in keyof T]?: DeepPartial<T[K]>;
|
|
14
20
|
};
|
|
21
|
+
/** Narrows a union type `U` to members with a specific `type` discriminant. */
|
|
15
22
|
export type WithType<U extends {
|
|
16
23
|
readonly type?: any;
|
|
17
24
|
}, T extends U['type']> = U & {
|
|
18
25
|
readonly type: T;
|
|
19
26
|
};
|
|
27
|
+
/**
|
|
28
|
+
* Works together with the `typed()` helper function to help define objects with
|
|
29
|
+
* specific types that _extend_ some other type.
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```ts
|
|
33
|
+
* interface Base { x: number }
|
|
34
|
+
*
|
|
35
|
+
* const extendingValue = (typed as Extender<Base>)({ x: 123, y: 'foo' }) // ✅ typeof extendingValue === { x: number; y: string }
|
|
36
|
+
*
|
|
37
|
+
* const invalidValue = (typed as Extender<Base>)({ y: 'foo' }) // ❌ TypeScript will complain about the value not extending the Base type correctly.
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
20
40
|
export type Extender<U> = <T extends U>(value: T) => T;
|
|
41
|
+
/**
|
|
42
|
+
* Sometimes TypeScript fails to figure out the "index signature of 'string'"
|
|
43
|
+
* in some type definitions, thus considers them unable to extend some base
|
|
44
|
+
* types like `Readonly<string, unknown>`.
|
|
45
|
+
* Even though. this is practically the same as the given type, it can help
|
|
46
|
+
* TypeScript to figure out the index signature it expects.
|
|
47
|
+
*/
|
|
21
48
|
export type WithStringIndexSignature<T> = {
|
|
22
49
|
[Key in keyof T]: T[Key];
|
|
23
50
|
};
|
|
51
|
+
/** Values that are falsy in JavaScript. */
|
|
24
52
|
export type Falsy = false | '' | 0 | null | undefined | void;
|
|
53
|
+
/** Excludes falsy values from type `T`. */
|
|
25
54
|
export type Trucy<T> = Exclude<T, Falsy>;
|
|
26
55
|
type BuiltIns = Primitive | Function | Date | RegExp;
|
|
27
56
|
type Primitive = null | undefined | string | number | boolean | symbol | bigint;
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,MAAM,MAAM,SAAS,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,CAAC,IAAI,IAAI,CAAC,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,CAAA;AAE1E,wEAAwE;AACxE,MAAM,MAAM,YAAY,CAAC,CAAC,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,KAAK,GAAG,CAAC,CAAA;AAElE,8DAA8D;AAC9D,MAAM,MAAM,QAAQ,CAAC,CAAC,IAAI;IAAE,CAAC,UAAU,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAAE,CAAA;AAE5D,mEAAmE;AACnE,MAAM,MAAM,YAAY,CAAC,CAAC,IAAI,CAAC,SAAS,QAAQ,GAC5C,CAAC,GACD,CAAC,SAAS,aAAa,CAAC,MAAM,CAAC,CAAC,GAC9B,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,GACtB,CAAC,SAAS,WAAW,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC,GACrC,GAAG,CAAC,CAAC,EAAE,YAAY,CAAC,CAAC,CAAC,CAAC,GACvB,CAAC,SAAS,WAAW,CAAC,MAAM,CAAC,CAAC,GAC5B,GAAG,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,GACpB;IACE,CAAC,UAAU,CAAC,IAAI,MAAM,CAAC,GAAG,YAAY,CAAC,CAAC,CAAC,CAAC,CA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