@koine/utils 2.0.0-beta.131 → 2.0.0-beta.133
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/Defer.d.ts +14 -0
- package/Emitter.d.ts +20 -0
- package/accentsSets.d.ts +14 -0
- package/addOrReplaceAtIdx.d.ts +7 -0
- package/areEqual.d.ts +15 -0
- package/arrayFilterFalsy.d.ts +6 -0
- package/arrayFindLastIndex.d.ts +13 -0
- package/arrayOfAll.d.ts +22 -0
- package/arraySum.d.ts +6 -0
- package/arrayToLookup.d.ts +5 -0
- package/arrayUniqueByProperties.d.ts +8 -0
- package/buildUrlQueryString.d.ts +9 -0
- package/capitalize.d.ts +7 -0
- package/changeCaseCamel.d.ts +7 -0
- package/changeCaseCapital.d.ts +7 -0
- package/changeCaseConstant.d.ts +7 -0
- package/changeCaseDot.d.ts +7 -0
- package/changeCaseHelpers.d.ts +22 -0
- package/changeCaseKebab.d.ts +7 -0
- package/changeCaseNone.d.ts +7 -0
- package/changeCasePascal.d.ts +7 -0
- package/changeCasePascalSnake.d.ts +7 -0
- package/changeCasePath.d.ts +7 -0
- package/changeCaseSentence.d.ts +7 -0
- package/changeCaseSnake.d.ts +7 -0
- package/changeCaseTrain.d.ts +7 -0
- package/chunkByChunks.d.ts +5 -0
- package/chunkBySize.d.ts +4 -0
- package/clamp.d.ts +6 -0
- package/clsx.d.ts +6 -0
- package/convertRange.d.ts +14 -0
- package/cookie.d.ts +45 -0
- package/createPalette.d.ts +12 -0
- package/debounce.d.ts +6 -0
- package/debouncePromise.d.ts +17 -0
- package/debounceRaf.d.ts +6 -0
- package/decode.d.ts +4 -0
- package/encode.d.ts +4 -0
- package/ensureInt.d.ts +5 -0
- package/errorToString.d.ts +6 -0
- package/escapeRegExp.d.ts +7 -0
- package/findDuplicatedIndexes.d.ts +3 -0
- package/forin.d.ts +6 -0
- package/gbToBytes.d.ts +5 -0
- package/getEmptyArray.d.ts +6 -0
- package/getKeys.d.ts +8 -0
- package/getMediaQueryWidthResolvers.d.ts +6 -0
- package/getMediaQueryWidthTailwindScreens.d.ts +4 -0
- package/getNonce.d.ts +4 -0
- package/getParamAmong.d.ts +11 -0
- package/getParamAsInt.d.ts +10 -0
- package/getParamAsString.d.ts +9 -0
- package/getType.d.ts +15 -0
- package/getUrlHashParams.d.ts +6 -0
- package/getUrlHashPathname.d.ts +7 -0
- package/getUrlPathnameParts.d.ts +10 -0
- package/getUrlQueryParams.d.ts +10 -0
- package/hashAny.d.ts +17 -0
- package/imgEmptyPixel.d.ts +5 -0
- package/index.d.ts +3 -0
- package/invariant.d.ts +17 -0
- package/isAbsoluteUrl.d.ts +9 -0
- package/isAnyObject.d.ts +5 -0
- package/isArray.d.ts +5 -0
- package/isBlob.d.ts +5 -0
- package/isBoolean.d.ts +5 -0
- package/isBrowser.d.ts +4 -0
- package/isBrowserNow.d.ts +4 -0
- package/isDate.d.ts +5 -0
- package/isEmptyArray.d.ts +5 -0
- package/isEmptyObject.d.ts +5 -0
- package/isEmptyString.d.ts +5 -0
- package/isError.d.ts +5 -0
- package/isExternalUrl.d.ts +7 -0
- package/isFile.d.ts +5 -0
- package/isFloat.d.ts +5 -0
- package/isFormData.d.ts +5 -0
- package/isFullArray.d.ts +5 -0
- package/isFullObject.d.ts +5 -0
- package/isFullString.d.ts +5 -0
- package/isFunction.d.ts +5 -0
- package/isInt.d.ts +5 -0
- package/isMap.d.ts +5 -0
- package/isNaNValue.d.ts +5 -0
- package/isNegativeNumber.d.ts +5 -0
- package/isNull.d.ts +5 -0
- package/isNullOrUndefined.d.ts +5 -0
- package/isNumber.d.ts +7 -0
- package/isNumericLiteral.d.ts +8 -0
- package/isObject.d.ts +5 -0
- package/isObjectLike.d.ts +7 -0
- package/isObjectStringKeyed.d.ts +9 -0
- package/isOneOf.d.ts +3 -0
- package/isPlainObject.d.ts +5 -0
- package/isPositiveNumber.d.ts +5 -0
- package/isPrimitive.d.ts +5 -0
- package/isPromise.d.ts +5 -0
- package/isRegExp.d.ts +5 -0
- package/isServer.d.ts +4 -0
- package/isServerNow.d.ts +4 -0
- package/isSet.d.ts +5 -0
- package/isString.d.ts +5 -0
- package/isSymbol.d.ts +5 -0
- package/isType.d.ts +8 -0
- package/isUndefined.d.ts +5 -0
- package/isWeakMap.d.ts +5 -0
- package/isWeakSet.d.ts +5 -0
- package/kbToBytes.d.ts +5 -0
- package/location.d.ts +3 -0
- package/lowercase.d.ts +5 -0
- package/mapListBy.d.ts +5 -0
- package/matchSorter.d.ts +10 -0
- package/mbToBytes.d.ts +5 -0
- package/mergeObjects.d.ts +6 -0
- package/mergeUrlQueryParams.d.ts +5 -0
- package/moveSortableArrayItemByKey.d.ts +7 -0
- package/noop.d.ts +5 -0
- package/normaliseUrl.d.ts +9 -0
- package/normaliseUrlPathname.d.ts +8 -0
- package/objectFlat.d.ts +8 -0
- package/objectFlip.d.ts +4 -0
- package/objectMergeWithDefaults.d.ts +10 -0
- package/objectOmit.d.ts +9 -0
- package/objectPick.d.ts +6 -0
- package/objectSort.d.ts +8 -0
- package/objectSortByKeysMatching.d.ts +9 -0
- package/objectToArray.d.ts +6 -0
- package/package.json +1 -1
- package/parseCookie.d.ts +8 -0
- package/parseURL.d.ts +6 -0
- package/quaranteneProps.d.ts +15 -0
- package/randomInt.d.ts +5 -0
- package/randomKey.d.ts +6 -0
- package/readCookie.d.ts +5 -0
- package/removeAccents.d.ts +3 -0
- package/removeCookie.d.ts +3 -0
- package/removeDuplicates.d.ts +8 -0
- package/removeDuplicatesByKey.d.ts +6 -0
- package/removeDuplicatesComparing.d.ts +3 -0
- package/removeIndexesFromArray.d.ts +3 -0
- package/removeTrailingSlash.d.ts +5 -0
- package/removeUrlQueryParams.d.ts +5 -0
- package/render.d.ts +40 -0
- package/round.d.ts +11 -0
- package/roundTo.d.ts +6 -0
- package/serializeCookie.d.ts +20 -0
- package/setCookie.d.ts +3 -0
- package/shuffle.d.ts +15 -0
- package/slugify.d.ts +10 -0
- package/split.d.ts +6 -0
- package/splitReverse.d.ts +6 -0
- package/swapMap.d.ts +5 -0
- package/throttle.d.ts +6 -0
- package/titleCase.d.ts +5 -0
- package/toNumber.d.ts +5 -0
- package/toRgba.d.ts +5 -0
- package/transformToUrlPathname.d.ts +9 -0
- package/truncate.d.ts +5 -0
- package/tryUntil.d.ts +9 -0
- package/types.d.ts +27 -0
- package/uid.d.ts +5 -0
- package/updateLinkParams.d.ts +7 -0
- package/updateUrlQueryParams.d.ts +5 -0
- package/uppercase.d.ts +6 -0
- package/uuid.d.ts +6 -0
- package/uuidNumeric.d.ts +4 -0
- package/wait.d.ts +5 -0
package/Defer.d.ts
CHANGED
|
@@ -1,8 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @category async
|
|
3
|
+
*/
|
|
1
4
|
export type Deferred<T> = Promise<T> & {
|
|
2
5
|
resolve: (value: T | PromiseLike<T>) => void;
|
|
3
6
|
reject: (value: T | PromiseLike<T>) => void;
|
|
4
7
|
catch: Promise<T>["catch"];
|
|
5
8
|
};
|
|
9
|
+
/**
|
|
10
|
+
* @category async
|
|
11
|
+
* @see https://stackoverflow.com/a/37673534/1938970
|
|
12
|
+
* @example
|
|
13
|
+
*
|
|
14
|
+
* ```ts
|
|
15
|
+
* const deferred = Defer();
|
|
16
|
+
* deferred.resolve();
|
|
17
|
+
* deferred.then(handleSuccess, handleError);
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
6
20
|
export declare function Defer<T>(this: Promise<T> & {
|
|
7
21
|
promise: Promise<T>;
|
|
8
22
|
resolve: (value: T | PromiseLike<T>) => void;
|
package/Emitter.d.ts
CHANGED
|
@@ -1,7 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Emitter super simple class
|
|
3
|
+
*
|
|
4
|
+
* Events will be prefixed with the given `namespace` plus a `.` so:
|
|
5
|
+
* `{namespace}.myevent`
|
|
6
|
+
*
|
|
7
|
+
* Adapted from https://github.com/developit/mitt
|
|
8
|
+
*
|
|
9
|
+
* Regarding typescript support see:
|
|
10
|
+
* - https://stackoverflow.com/q/53299743/1938970
|
|
11
|
+
* - https://github.com/Microsoft/TypeScript/pull/26349
|
|
12
|
+
*
|
|
13
|
+
* @category impl
|
|
14
|
+
*/
|
|
1
15
|
export declare let Emitter: <EventMap extends {
|
|
2
16
|
[key: string]: any;
|
|
3
17
|
}>(namespace: string) => {
|
|
18
|
+
/**
|
|
19
|
+
* Register an event handler for the given type.
|
|
20
|
+
*/
|
|
4
21
|
on<EventName extends keyof EventMap>(name: EventName, handler: (data?: EventMap[EventName]) => any): void;
|
|
22
|
+
/**
|
|
23
|
+
* Invoke all handlers for the given type.
|
|
24
|
+
*/
|
|
5
25
|
emit<EventName extends keyof EventMap>(name: EventName, data?: EventMap[EventName]): void;
|
|
6
26
|
};
|
|
7
27
|
export default Emitter;
|
package/accentsSets.d.ts
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* First value is the `to`, second is `from`, from *which* chars do we translates *to*
|
|
3
|
+
*
|
|
4
|
+
* @category text
|
|
5
|
+
*/
|
|
1
6
|
export type AccentsSet = [string, string];
|
|
7
|
+
/**
|
|
8
|
+
* Accent sets
|
|
9
|
+
*
|
|
10
|
+
* @category text
|
|
11
|
+
* @resources
|
|
12
|
+
* - https://gist.github.com/mathewbyrne/1280286#gistcomment-3498021
|
|
13
|
+
* - https://gist.github.com/eek/9c4887e80b3ede05c0e39fee4dce3747 for usage
|
|
14
|
+
* of [normalize](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/normalize)
|
|
15
|
+
*/
|
|
2
16
|
export declare let accentsSets: AccentsSet[];
|
|
3
17
|
export default accentsSets;
|
package/addOrReplaceAtIdx.d.ts
CHANGED
|
@@ -1,2 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Add or replace an item in the given array, it returns a new array (immutable).
|
|
3
|
+
* Typescript wise this is meant to keep the same type on the newly returned
|
|
4
|
+
* array, therefore the `newItem` must match the type of the `list` items.
|
|
5
|
+
*
|
|
6
|
+
* @category array
|
|
7
|
+
*/
|
|
1
8
|
export declare let addOrReplaceAtIdx: <T>(list: T[], newItem: T, newIdx?: number) => T[];
|
|
2
9
|
export default addOrReplaceAtIdx;
|
package/areEqual.d.ts
CHANGED
|
@@ -1,4 +1,19 @@
|
|
|
1
1
|
type ComparablePrimitive = string | number | boolean;
|
|
2
2
|
type Comparable = ComparablePrimitive | object | Record<string, ComparablePrimitive> | Array<ComparablePrimitive>;
|
|
3
|
+
/**
|
|
4
|
+
* A simple and quick deep equal objects utility. This is meant to be used
|
|
5
|
+
* solely to deduplicate requests payload and perform comparison on JSON ready
|
|
6
|
+
* objects made of primitives `string`, `number` and `boolean`s.
|
|
7
|
+
*
|
|
8
|
+
* It support nested `object`s and `array`s only.
|
|
9
|
+
*
|
|
10
|
+
* NB: `undefined` and `null` values do not count in the comparison as they are
|
|
11
|
+
* usually meant to be ignored in JSON requestBody payloads.
|
|
12
|
+
*
|
|
13
|
+
* According to very rudimentary tests this function takes on average between
|
|
14
|
+
* 0.15 ms and 2ms to compare two averaged sizes requet body payloads.
|
|
15
|
+
*
|
|
16
|
+
* @category object
|
|
17
|
+
*/
|
|
3
18
|
export declare let areEqual: (a: Comparable, b?: Comparable) => boolean;
|
|
4
19
|
export default areEqual;
|
package/arrayFilterFalsy.d.ts
CHANGED
|
@@ -1,2 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Given a list it returns it filtered without any falsy values (`null`,
|
|
3
|
+
* `undefined`, `false`, `0`, `""`). It "adjusts" the returned type as well.
|
|
4
|
+
*
|
|
5
|
+
* @category array
|
|
6
|
+
*/
|
|
1
7
|
export declare let arrayFilterFalsy: <T extends unknown[]>(list?: null | T) => Exclude<NonNullable<T>[number], undefined | false | 0 | "">[];
|
|
2
8
|
export default arrayFilterFalsy;
|
package/arrayFindLastIndex.d.ts
CHANGED
|
@@ -1,2 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns the index of the last element in the array where predicate is true, and -1
|
|
3
|
+
* otherwise.
|
|
4
|
+
*
|
|
5
|
+
* @borrows [SO's answer by Nico Timmerman](https://stackoverflow.com/a/53187807/1938970)
|
|
6
|
+
*
|
|
7
|
+
* @category array
|
|
8
|
+
*
|
|
9
|
+
* @param array The source array to search in
|
|
10
|
+
* @param predicate find calls predicate once for each element of the array, in descending
|
|
11
|
+
* order, until it finds one where predicate returns true. If such an element is found,
|
|
12
|
+
* findLastIndex immediately returns that element index. Otherwise, findLastIndex returns -1.
|
|
13
|
+
*/
|
|
1
14
|
export declare let arrayFindLastIndex: <T>(array: Array<T>, predicate: (value: T, index: number, obj: T[]) => boolean) => number;
|
|
2
15
|
export default arrayFindLastIndex;
|
package/arrayOfAll.d.ts
CHANGED
|
@@ -1,3 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ensure an array contains all desired values
|
|
3
|
+
*
|
|
4
|
+
* @category array
|
|
5
|
+
* @borrows [SO comment by `CertainPerformance`](https://stackoverflow.com/a/60132060/1938970)
|
|
6
|
+
*
|
|
7
|
+
* @usage
|
|
8
|
+
* ```ts
|
|
9
|
+
* type Fruit = "pear" | "apple" | "orange";
|
|
10
|
+
*
|
|
11
|
+
* const arrayOfAllFruits = arrayOfAll<Fruit>();
|
|
12
|
+
*
|
|
13
|
+
* const allFruits = arrayOfAllFruits([ "pear", "apple", "orange" ]); // ts compiler ok
|
|
14
|
+
* const allFruits = arrayOfAllFruits([ "pear", "apple" ]); // ts compiler fails
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
1
17
|
export declare let arrayOfAll: <T>() => <U extends T[]>(array: U & ([T] extends [U[number]] ? unknown : "Invalid")) => U & ([T] extends [U[number]] ? unknown : "Invalid");
|
|
18
|
+
/**
|
|
19
|
+
* @usage
|
|
20
|
+
* ```ts
|
|
21
|
+
* type Check_AreAllListed = AssertTrue<ArrayOfAll<typeof myList, MyUnion>>;
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
2
24
|
export type ArrayOfAll<List extends unknown[], Union> = List[number] extends Union ? Union extends List[number] ? true : "Incomplete" : "Incomplete";
|
|
3
25
|
export default arrayOfAll;
|
package/arraySum.d.ts
CHANGED
package/arrayToLookup.d.ts
CHANGED
|
@@ -1,2 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @borrows [SO answer](https://stackoverflow.com/a/56757215/1938970)
|
|
3
|
+
*
|
|
4
|
+
* @category array
|
|
5
|
+
* @param array The array to filter
|
|
6
|
+
* @param keys The keys to compare in each array item
|
|
7
|
+
* @returns The filtered array
|
|
8
|
+
*/
|
|
1
9
|
export declare let arrayUniqueByProperties: <T extends any[]>(array: T, keys: (keyof T[number])[]) => T;
|
|
2
10
|
export default arrayUniqueByProperties;
|
package/buildUrlQueryString.d.ts
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
1
|
import type { AnyQueryParams } from "./location";
|
|
2
|
+
/**
|
|
3
|
+
* Get clean query string for URL
|
|
4
|
+
*
|
|
5
|
+
* It returns the query string **with** the initial `?`
|
|
6
|
+
*
|
|
7
|
+
* TODO: at some point replace with `URLSearchParams`, @see [caniuse](https://caniuse.com/?search=URLSearchParams)
|
|
8
|
+
*
|
|
9
|
+
* @category location
|
|
10
|
+
*/
|
|
2
11
|
export declare let buildUrlQueryString: <T extends AnyQueryParams>(params: T) => string;
|
|
3
12
|
export default buildUrlQueryString;
|
package/capitalize.d.ts
CHANGED
|
@@ -1,2 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Capitalize first letter of the given string.
|
|
3
|
+
*
|
|
4
|
+
* @category text
|
|
5
|
+
* @resources
|
|
6
|
+
* - https://stackoverflow.com/a/11409944/1938970
|
|
7
|
+
*/
|
|
1
8
|
export declare let capitalize: <T extends string>(string?: null | T) => Capitalize<T>;
|
|
2
9
|
export default capitalize;
|
package/changeCaseCamel.d.ts
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
1
|
import { type PascalCaseOptions } from "./changeCaseHelpers";
|
|
2
|
+
/**
|
|
3
|
+
* Convert a string to camel case (`fooBar`).
|
|
4
|
+
*
|
|
5
|
+
* @category text
|
|
6
|
+
* @category case
|
|
7
|
+
* @borrows [blakeembrey/change-case](https://github.com/blakeembrey/change-case)
|
|
8
|
+
*/
|
|
2
9
|
export declare let changeCaseCamel: (input: string, options?: PascalCaseOptions) => string;
|
|
3
10
|
export default changeCaseCamel;
|
package/changeCaseCapital.d.ts
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
1
|
import { type Options } from "./changeCaseHelpers";
|
|
2
|
+
/**
|
|
3
|
+
* Convert a string to sentence case (`Foo Bar`).
|
|
4
|
+
*
|
|
5
|
+
* @category text
|
|
6
|
+
* @category case
|
|
7
|
+
* @borrows [blakeembrey/change-case](https://github.com/blakeembrey/change-case)
|
|
8
|
+
*/
|
|
2
9
|
export declare let changeCaseCapital: (input: string, options?: Options) => string;
|
|
3
10
|
export default changeCaseCapital;
|
package/changeCaseConstant.d.ts
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
1
|
import { type Options } from "./changeCaseHelpers";
|
|
2
|
+
/**
|
|
3
|
+
* Convert a string to constant case (`FOO_BAR`).
|
|
4
|
+
*
|
|
5
|
+
* @category text
|
|
6
|
+
* @category case
|
|
7
|
+
* @borrows [blakeembrey/change-case](https://github.com/blakeembrey/change-case)
|
|
8
|
+
*/
|
|
2
9
|
export declare let changeCaseConstant: (input: string, options?: Options) => string;
|
|
3
10
|
export default changeCaseConstant;
|
package/changeCaseDot.d.ts
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
1
|
import type { Options } from "./changeCaseHelpers";
|
|
2
|
+
/**
|
|
3
|
+
* Convert a string to dot case (`foo.bar`).
|
|
4
|
+
*
|
|
5
|
+
* @category text
|
|
6
|
+
* @category case
|
|
7
|
+
* @borrows [blakeembrey/change-case](https://github.com/blakeembrey/change-case)
|
|
8
|
+
*/
|
|
2
9
|
export declare let changeCaseDot: (input: string, options?: Options) => string;
|
|
3
10
|
export default changeCaseDot;
|
package/changeCaseHelpers.d.ts
CHANGED
|
@@ -1,14 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file
|
|
3
|
+
*
|
|
4
|
+
* @borrows [blakeembrey/change-case](https://github.com/blakeembrey/change-case)
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Supported locale values. Use `false` to ignore locale.
|
|
8
|
+
* Defaults to `undefined`, which uses the host environment.
|
|
9
|
+
*/
|
|
1
10
|
export type Locale = string[] | string | false | undefined;
|
|
11
|
+
/**
|
|
12
|
+
* Options used for converting strings to pascal/camel case.
|
|
13
|
+
*/
|
|
2
14
|
export interface PascalCaseOptions extends Options {
|
|
3
15
|
mergeAmbiguousCharacters?: boolean;
|
|
4
16
|
}
|
|
17
|
+
/**
|
|
18
|
+
* Options used for converting strings to any case.
|
|
19
|
+
*/
|
|
5
20
|
export interface Options {
|
|
6
21
|
locale?: Locale;
|
|
7
22
|
split?: (value: string) => string[];
|
|
23
|
+
/** @deprecated Pass `split: splitSeparateNumbers` instead. */
|
|
8
24
|
separateNumbers?: boolean;
|
|
9
25
|
delimiter?: string;
|
|
10
26
|
prefixCharacters?: string;
|
|
11
27
|
suffixCharacters?: string;
|
|
12
28
|
}
|
|
29
|
+
/**
|
|
30
|
+
* Split any cased input strings into an array of words.
|
|
31
|
+
*/
|
|
13
32
|
export declare let split: (value: string) => string[];
|
|
33
|
+
/**
|
|
34
|
+
* Split the input string into an array of words, separating numbers.
|
|
35
|
+
*/
|
|
14
36
|
export declare let splitSeparateNumbers: (value: string) => string[];
|
package/changeCaseKebab.d.ts
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
1
|
import type { Options } from "./changeCaseHelpers";
|
|
2
|
+
/**
|
|
3
|
+
* Convert a string to kebab case (`foo.bar`).
|
|
4
|
+
*
|
|
5
|
+
* @category text
|
|
6
|
+
* @category case
|
|
7
|
+
* @borrows [blakeembrey/change-case](https://github.com/blakeembrey/change-case)
|
|
8
|
+
*/
|
|
2
9
|
export declare let changeCaseKebab: (input: string, options?: Options) => string;
|
|
3
10
|
export default changeCaseKebab;
|
package/changeCaseNone.d.ts
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
1
|
import { type Options } from "./changeCaseHelpers";
|
|
2
|
+
/**
|
|
3
|
+
* Convert a string to space separated lower case (`foo bar`).
|
|
4
|
+
*
|
|
5
|
+
* @category text
|
|
6
|
+
* @category case
|
|
7
|
+
* @borrows [blakeembrey/change-case](https://github.com/blakeembrey/change-case)
|
|
8
|
+
*/
|
|
2
9
|
export declare let changeCaseNone: (input: string, options?: Options) => string;
|
|
3
10
|
export default changeCaseNone;
|
package/changeCasePascal.d.ts
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
1
|
import { type PascalCaseOptions } from "./changeCaseHelpers";
|
|
2
|
+
/**
|
|
3
|
+
* Convert a string to camel case (`FooBar`).
|
|
4
|
+
*
|
|
5
|
+
* @category text
|
|
6
|
+
* @category case
|
|
7
|
+
* @borrows [blakeembrey/change-case](https://github.com/blakeembrey/change-case)
|
|
8
|
+
*/
|
|
2
9
|
export declare let changeCasePascal: (input: string, options?: PascalCaseOptions) => string;
|
|
3
10
|
export default changeCasePascal;
|
|
@@ -1,3 +1,10 @@
|
|
|
1
1
|
import type { Options } from "./changeCaseHelpers";
|
|
2
|
+
/**
|
|
3
|
+
* Convert a string to pascal snake case (`Foo_Bar`).
|
|
4
|
+
*
|
|
5
|
+
* @category text
|
|
6
|
+
* @category case
|
|
7
|
+
* @borrows [blakeembrey/change-case](https://github.com/blakeembrey/change-case)
|
|
8
|
+
*/
|
|
2
9
|
export declare let changeCasePascalSnake: (input: string, options?: Options) => string;
|
|
3
10
|
export default changeCasePascalSnake;
|
package/changeCasePath.d.ts
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
1
|
import type { Options } from "./changeCaseHelpers";
|
|
2
|
+
/**
|
|
3
|
+
* Convert a string to path case (`foo/bar`).
|
|
4
|
+
*
|
|
5
|
+
* @category text
|
|
6
|
+
* @category case
|
|
7
|
+
* @borrows [blakeembrey/change-case](https://github.com/blakeembrey/change-case)
|
|
8
|
+
*/
|
|
2
9
|
export declare let changeCasePath: (input: string, options?: Options) => string;
|
|
3
10
|
export default changeCasePath;
|
package/changeCaseSentence.d.ts
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
1
|
import { type Options } from "./changeCaseHelpers";
|
|
2
|
+
/**
|
|
3
|
+
* Convert a string to sentence case (`Foo bar`).
|
|
4
|
+
*
|
|
5
|
+
* @category text
|
|
6
|
+
* @category case
|
|
7
|
+
* @borrows [blakeembrey/change-case](https://github.com/blakeembrey/change-case)
|
|
8
|
+
*/
|
|
2
9
|
export declare let changeCaseSentence: (input: string, options?: Options) => string;
|
|
3
10
|
export default changeCaseSentence;
|
package/changeCaseSnake.d.ts
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
1
|
import type { Options } from "./changeCaseHelpers";
|
|
2
|
+
/**
|
|
3
|
+
* Convert a string to snake case (`foo_bar`).
|
|
4
|
+
*
|
|
5
|
+
* @category text
|
|
6
|
+
* @category case
|
|
7
|
+
* @borrows [blakeembrey/change-case](https://github.com/blakeembrey/change-case)
|
|
8
|
+
*/
|
|
2
9
|
export declare let changeCaseSnake: (input: string, options?: Options) => string;
|
|
3
10
|
export default changeCaseSnake;
|
package/changeCaseTrain.d.ts
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
1
|
import type { Options } from "./changeCaseHelpers";
|
|
2
|
+
/**
|
|
3
|
+
* Convert a string to train case (`Foo-Bar`).
|
|
4
|
+
*
|
|
5
|
+
* @category text
|
|
6
|
+
* @category case
|
|
7
|
+
* @borrows [blakeembrey/change-case](https://github.com/blakeembrey/change-case)
|
|
8
|
+
*/
|
|
2
9
|
export declare let changeCaseTrain: (input: string, options?: Options) => string;
|
|
3
10
|
export default changeCaseTrain;
|
package/chunkByChunks.d.ts
CHANGED
package/chunkBySize.d.ts
CHANGED
package/clamp.d.ts
CHANGED
package/clsx.d.ts
CHANGED
|
@@ -2,5 +2,11 @@ type ClassValue = ClassArray | ClassDictionary | string | number | bigint | null
|
|
|
2
2
|
type ClassDictionary = Record<string, any>;
|
|
3
3
|
type ClassArray = ClassValue[];
|
|
4
4
|
export type ClsxClassValue = ClassValue;
|
|
5
|
+
/**
|
|
6
|
+
* Class names utility
|
|
7
|
+
*
|
|
8
|
+
* @category impl
|
|
9
|
+
* @borrows [lukeed/clsx](https://github.com/lukeed/clsx)
|
|
10
|
+
*/
|
|
5
11
|
export declare let clsx: (...args: ClassValue[]) => string;
|
|
6
12
|
export default clsx;
|
package/convertRange.d.ts
CHANGED
|
@@ -1,2 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Convert range of a number
|
|
3
|
+
*
|
|
4
|
+
* e.g. converting number 5 in a scale/range from 0 10 to a scale/range from 50
|
|
5
|
+
* to 100 would return 75
|
|
6
|
+
* @example
|
|
7
|
+
*
|
|
8
|
+
* ```ts
|
|
9
|
+
* convertRange(5, [0, 10], [50, 100]);
|
|
10
|
+
* ```
|
|
11
|
+
*
|
|
12
|
+
* @category math
|
|
13
|
+
* @see https://stackoverflow.com/a/14224813
|
|
14
|
+
*/
|
|
1
15
|
export declare let convertRange: (num: number, r1: number[], r2: number[]) => number;
|
|
2
16
|
export default convertRange;
|
package/cookie.d.ts
CHANGED
|
@@ -1,15 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module
|
|
3
|
+
*
|
|
4
|
+
* @category cookie
|
|
5
|
+
*
|
|
6
|
+
* All cookie related code is inspired and adapted from:
|
|
7
|
+
* - [js-cookie](https://github.com/js-cookie/js-cookie)
|
|
8
|
+
* - [cookie](https://github.com/jshttp/cookie)
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* @category cookie
|
|
12
|
+
*/
|
|
1
13
|
type CookieAttributes = {
|
|
14
|
+
/**
|
|
15
|
+
* Define when the cookie will be removed. Value can be a Number
|
|
16
|
+
* which will be interpreted as days from time of creation or a
|
|
17
|
+
* Date instance. If omitted, the cookie becomes a session cookie.
|
|
18
|
+
*/
|
|
2
19
|
expires?: number | Date | undefined;
|
|
20
|
+
/**
|
|
21
|
+
* Define the path where the cookie is available. Defaults to '/'
|
|
22
|
+
*
|
|
23
|
+
* @default "/"
|
|
24
|
+
*/
|
|
3
25
|
path?: string | undefined;
|
|
26
|
+
/**
|
|
27
|
+
* Define the domain where the cookie is available. Defaults to
|
|
28
|
+
* the domain of the page where the cookie was created.
|
|
29
|
+
*/
|
|
4
30
|
domain?: string | undefined;
|
|
31
|
+
/**
|
|
32
|
+
* A Boolean indicating if the cookie transmission requires a
|
|
33
|
+
* secure protocol (https).
|
|
34
|
+
*
|
|
35
|
+
* @default "true"
|
|
36
|
+
*/
|
|
5
37
|
secure?: boolean | undefined;
|
|
38
|
+
/**
|
|
39
|
+
* Asserts that a cookie must not be sent with cross-origin requests,
|
|
40
|
+
* providing some protection against cross-site request forgery
|
|
41
|
+
* attacks (CSRF)
|
|
42
|
+
*
|
|
43
|
+
* @default "strict"
|
|
44
|
+
*/
|
|
6
45
|
sameSite?: "strict" | "Strict" | "lax" | "Lax" | "none" | "None" | undefined;
|
|
7
46
|
};
|
|
47
|
+
/**
|
|
48
|
+
* @category cookie
|
|
49
|
+
*/
|
|
8
50
|
export type CookieAttributesServer = CookieAttributes & {
|
|
9
51
|
maxAge?: number;
|
|
10
52
|
httpOnly?: boolean;
|
|
11
53
|
encode?: (input: string) => string;
|
|
12
54
|
decode?: (input: string) => string;
|
|
13
55
|
};
|
|
56
|
+
/**
|
|
57
|
+
* @category cookie
|
|
58
|
+
*/
|
|
14
59
|
export type CookieAttributesClient = CookieAttributes;
|
|
15
60
|
export {};
|
package/createPalette.d.ts
CHANGED
|
@@ -6,5 +6,17 @@ type PaletteMapPair<T extends PaletteShade> = {
|
|
|
6
6
|
type PaletteMap<T extends PaletteShades> = {
|
|
7
7
|
[PS in T[number] as keyof PaletteMapPair<PS>]: PaletteMapPair<PS>[keyof PaletteMapPair<PS>];
|
|
8
8
|
};
|
|
9
|
+
/**
|
|
10
|
+
* Create palette, this is primarily thought to improve the reuse of a palette
|
|
11
|
+
* definition between TailwindCSS and straight ES imports
|
|
12
|
+
*
|
|
13
|
+
* @category colors
|
|
14
|
+
* @category tailwind
|
|
15
|
+
* @category responsive
|
|
16
|
+
*
|
|
17
|
+
* @returns An array with: 1) A flat palette map 2) A TailwindCSS ready palette
|
|
18
|
+
* object 3) A flat array of colors (no special sorting, same order as the `shades`
|
|
19
|
+
* given as argument)
|
|
20
|
+
*/
|
|
9
21
|
export declare let createPalette: <TName extends string, TShades extends PaletteShades, TColor = TShades[number][1], TMap = PaletteMap<TShades>>(name: TName, shades: TShades) => readonly [TMap, Record<`${TName}-${TShades[number][0]}`, string>, TColor[]];
|
|
10
22
|
export default createPalette;
|
package/debounce.d.ts
CHANGED
|
@@ -1,2 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Debounce function (with `setTimeout`)
|
|
3
|
+
*
|
|
4
|
+
* @category function
|
|
5
|
+
* @borrows [davidwalsh/debounce](https://davidwalsh.name/javascript-debounce-function)
|
|
6
|
+
*/
|
|
1
7
|
export declare let debounce: <T extends (...args: any[]) => any>(fn: T, wait?: number, immediate?: boolean) => (this: unknown, ...args: Parameters<T>) => void;
|
|
2
8
|
export default debounce;
|
package/debouncePromise.d.ts
CHANGED
|
@@ -1,11 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copy pasted from [chodorowicz/ts-debounce](https://github.com/chodorowicz/ts-debounce/blob/master/src/index.ts)
|
|
3
|
+
*
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* @categroy functionn
|
|
8
|
+
*/
|
|
1
9
|
export type DebounceOptions<Result> = {
|
|
2
10
|
isImmediate?: boolean;
|
|
3
11
|
maxWait?: number;
|
|
4
12
|
callback?: (data: Result) => void;
|
|
5
13
|
};
|
|
14
|
+
/**
|
|
15
|
+
* @categroy functionn
|
|
16
|
+
*/
|
|
6
17
|
export interface DebouncedFunction<Args extends any[], F extends (...args: Args) => any> {
|
|
7
18
|
(this: ThisParameterType<F>, ...args: Args & Parameters<F>): Promise<ReturnType<F>>;
|
|
8
19
|
cancel: (reason?: any) => void;
|
|
9
20
|
}
|
|
21
|
+
/**
|
|
22
|
+
* Debounce function (with `Promise`)
|
|
23
|
+
*
|
|
24
|
+
* @category function
|
|
25
|
+
* @borrows [chodorowicz/ts-debounce](https://github.com/chodorowicz/ts-debounce)
|
|
26
|
+
*/
|
|
10
27
|
export declare let debouncePromise: <Args extends any[], F extends (...args: Args) => any>(func: F, waitMilliseconds?: number, options?: DebounceOptions<ReturnType<F>>) => DebouncedFunction<Args, F>;
|
|
11
28
|
export default debouncePromise;
|
package/debounceRaf.d.ts
CHANGED
|
@@ -1,2 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Debounce function (with `requestAnimationFrame`)
|
|
3
|
+
*
|
|
4
|
+
* @category function
|
|
5
|
+
* @borrows [vanillajstoolkit/debounce by Chris Ferdinandi](https://vanillajstoolkit.com/helpers/debounce/)
|
|
6
|
+
*/
|
|
1
7
|
export declare function debounceRaf<T extends (...args: any[]) => any>(this: unknown, fn: T): (this: unknown, ...args: Parameters<T>) => void;
|
|
2
8
|
export default debounceRaf;
|
package/decode.d.ts
CHANGED
package/encode.d.ts
CHANGED
package/ensureInt.d.ts
CHANGED
package/errorToString.d.ts
CHANGED
package/escapeRegExp.d.ts
CHANGED
|
@@ -1,2 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @borrows [MDN Docs](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions)
|
|
3
|
+
* @borrows [SO's answer by Mathias Bynens](https://stackoverflow.com/a/9310752/1938970)
|
|
4
|
+
*
|
|
5
|
+
* @category escape
|
|
6
|
+
* @category RegExp
|
|
7
|
+
*/
|
|
1
8
|
export declare let escapeRegExp: (text: string) => string;
|
|
2
9
|
export default escapeRegExp;
|
package/forin.d.ts
CHANGED