@koine/utils 1.2.3 → 2.0.0-alpha.2

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/areEqual.d.ts CHANGED
@@ -7,7 +7,7 @@ type Comparable = ComparablePrimitive | object | Record<string, ComparablePrimit
7
7
  *
8
8
  * It support nested `object`s and `array`s only.
9
9
  *
10
- * NB: `undefined` and `null` values do not count in the comparison as they are
10
+ * NB: `undefined` and `null` values do not count in the comparison as they are
11
11
  * usually meant to be ignored in JSON requestBody payloads.
12
12
  *
13
13
  * According to very rudimentary tests this function takes on average between
package/areEqual.js CHANGED
@@ -42,7 +42,7 @@ function areEqualObjects(a, b) {
42
42
  *
43
43
  * It support nested `object`s and `array`s only.
44
44
  *
45
- * NB: `undefined` and `null` values do not count in the comparison as they are
45
+ * NB: `undefined` and `null` values do not count in the comparison as they are
46
46
  * usually meant to be ignored in JSON requestBody payloads.
47
47
  *
48
48
  * According to very rudimentary tests this function takes on average between
package/areEqual.mjs CHANGED
@@ -39,7 +39,7 @@ function areEqualObjects(a, b) {
39
39
  *
40
40
  * It support nested `object`s and `array`s only.
41
41
  *
42
- * NB: `undefined` and `null` values do not count in the comparison as they are
42
+ * NB: `undefined` and `null` values do not count in the comparison as they are
43
43
  * usually meant to be ignored in JSON requestBody payloads.
44
44
  *
45
45
  * According to very rudimentary tests this function takes on average between
package/arrayOfAll.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Ensure an array contains all deisred values
2
+ * Ensure an array contains all desired values
3
3
  *
4
4
  * @category array
5
5
  * @borrows [SO comment by `CertainPerformance`](https://stackoverflow.com/a/60132060/1938970)
package/arrayOfAll.js CHANGED
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.arrayOfAll = void 0;
4
4
  /**
5
- * Ensure an array contains all deisred values
5
+ * Ensure an array contains all desired values
6
6
  *
7
7
  * @category array
8
8
  * @borrows [SO comment by `CertainPerformance`](https://stackoverflow.com/a/60132060/1938970)
package/arrayOfAll.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Ensure an array contains all deisred values
2
+ * Ensure an array contains all desired values
3
3
  *
4
4
  * @category array
5
5
  * @borrows [SO comment by `CertainPerformance`](https://stackoverflow.com/a/60132060/1938970)
package/capitalize.d.ts CHANGED
@@ -4,5 +4,5 @@
4
4
  * @category text
5
5
  * @see https://stackoverflow.com/a/11409944/1938970
6
6
  */
7
- export declare function capitalize<T extends string>(string: null | T): Capitalize<T>;
7
+ export declare function capitalize<T extends string>(string?: null | T): Capitalize<T>;
8
8
  export default capitalize;
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Create palette, this is primarily thought to improve the reuse of a palette
3
+ * definition between TailwindCSS and straight ES imports
4
+ *
5
+ * @category styling|tailwind|colours
6
+ *
7
+ * @returns An array with: 1) A flat palette map 2) A TailwindCSS ready palette
8
+ * object 3) A flat array of colors (no special sorting, same order as the `shades`
9
+ * given as argument)
10
+ */
11
+ export declare const createPalette: <TName extends string, TShades extends readonly (readonly [number, string])[], TShade extends number = TShades[number][0]>(name: TName, shades: TShades) => readonly [Record<TShade, string>, Record<`${TName}-${TShades[number][0]}`, string>, unknown[]];
12
+ export default createPalette;
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createPalette = void 0;
4
+ /**
5
+ * Create palette, this is primarily thought to improve the reuse of a palette
6
+ * definition between TailwindCSS and straight ES imports
7
+ *
8
+ * @category styling|tailwind|colours
9
+ *
10
+ * @returns An array with: 1) A flat palette map 2) A TailwindCSS ready palette
11
+ * object 3) A flat array of colors (no special sorting, same order as the `shades`
12
+ * given as argument)
13
+ */
14
+ var createPalette = function (name, shades) {
15
+ var map = shades.reduce(function (map, def) {
16
+ map[def[0]] = def[1];
17
+ return map;
18
+ }, {});
19
+ var tailwindPalette = shades.reduce(function (map, def) {
20
+ map["".concat(name, "-").concat(def[0])] = def[1];
21
+ return map;
22
+ }, {});
23
+ return [map, tailwindPalette, Object.values(map)];
24
+ };
25
+ exports.createPalette = createPalette;
26
+ exports.default = exports.createPalette;
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Create palette, this is primarily thought to improve the reuse of a palette
3
+ * definition between TailwindCSS and straight ES imports
4
+ *
5
+ * @category styling|tailwind|colours
6
+ *
7
+ * @returns An array with: 1) A flat palette map 2) A TailwindCSS ready palette
8
+ * object 3) A flat array of colors (no special sorting, same order as the `shades`
9
+ * given as argument)
10
+ */
11
+ export var createPalette = function (name, shades) {
12
+ var map = shades.reduce(function (map, def) {
13
+ map[def[0]] = def[1];
14
+ return map;
15
+ }, {});
16
+ var tailwindPalette = shades.reduce(function (map, def) {
17
+ map["".concat(name, "-").concat(def[0])] = def[1];
18
+ return map;
19
+ }, {});
20
+ return [map, tailwindPalette, Object.values(map)];
21
+ };
22
+ export default createPalette;
package/index.d.ts CHANGED
@@ -1,133 +1,134 @@
1
- export * from "./accentSets";
2
- export * from "./addOrReplaceAtIdx";
3
- export * from "./areEqual";
4
- export * from "./arrayOfAll";
5
- export * from "./arraySum";
6
- export * from "./arrayToLookup";
7
- export * from "./buildUrlQueryString";
8
- export * from "./capitalize";
9
- export * from "./changeUrlPath";
10
- export * from "./chunkByChunks";
11
- export * from "./chunkBySize";
12
- export * from "./clamp";
13
- export * from "./clsx";
14
- export * from "./convertRange";
15
- export * from "./cookie";
16
- export * from "./debounce";
17
- export * from "./debounceRaf";
18
- export * from "./debouncePromise";
19
- export * from "./decode";
20
- export * from "./Defer";
21
- export * from "./Emitter";
22
- export * from "./encode";
23
- export * from "./ensureInt";
24
- export * from "./errorToString";
25
- export * from "./findDuplicatedIndexes";
26
- export * from "./forin";
27
- export * from "./gbToBytes";
28
- export * from "./getEmptyArray";
29
- export * from "./getKeys";
30
- export * from "./getMediaQueryWidthResolvers";
31
- export * from "./getMediaQueryWidthTailwindScreens";
32
- export * from "./getNonce";
33
- export * from "./getParamAmong";
34
- export * from "./getParamAsInt";
35
- export * from "./getParamAsString";
36
- export * from "./getType";
37
- export * from "./getUrlHashParams";
38
- export * from "./getUrlHashPathname";
39
- export * from "./getUrlPathnameParts";
40
- export * from "./getUrlQueryParams";
41
- export * from "./imgEmptyPixel";
42
- export * from "./isAnyObject";
43
- export * from "./isArray";
44
- export * from "./isBlob";
45
- export * from "./isBoolean";
46
- export * from "./isBrowser";
47
- export * from "./isBrowserNow";
48
- export * from "./isDate";
49
- export * from "./isEmptyArray";
50
- export * from "./isEmptyObject";
51
- export * from "./isEmptyString";
52
- export * from "./isError";
53
- export * from "./isExternalUrl";
54
- export * from "./isFile";
55
- export * from "./isFloat";
56
- export * from "./isFormData";
57
- export * from "./isFullArray";
58
- export * from "./isFullObject";
59
- export * from "./isFullString";
60
- export * from "./isFunction";
61
- export * from "./isInt";
62
- export * from "./isMap";
63
- export * from "./isNaNValue";
64
- export * from "./isNegativeNumber";
65
- export * from "./isNullOrUndefined";
66
- export * from "./isNull";
67
- export * from "./isNumber";
68
- export * from "./isObjectLike";
69
- export * from "./isObject";
70
- export * from "./isOneOf";
71
- export * from "./isPlainObject";
72
- export * from "./isPositiveNumber";
73
- export * from "./isPrimitive";
74
- export * from "./isPromise";
75
- export * from "./isRegExp";
76
- export * from "./isServer";
77
- export * from "./isServerNow";
78
- export * from "./isSet";
79
- export * from "./isString";
80
- export * from "./isSymbol";
81
- export * from "./isType";
82
- export * from "./isUndefined";
83
- export * from "./isWeakMap";
84
- export * from "./isWeakSet";
85
- export * from "./kbToBytes";
86
- export * from "./location";
87
- export * from "./lowercase";
88
- export * from "./mapListBy";
89
- export * from "./matchSorter";
90
- export * from "./mbToBytes";
91
- export * from "./mergeObjects";
92
- export * from "./mergeUrlQueryParams";
93
- export * from "./moveSortableArrayItemByKey";
94
- export * from "./noop";
95
- export * from "./normaliseUrlPathname";
96
- export * from "./normaliseUrl";
97
- export * from "./objectPick";
98
- export * from "./objectOmit";
99
- export * from "./parseCookie";
100
- export * from "./parseURL";
101
- export * from "./quaranteneProps";
102
- export * from "./randomInt";
103
- export * from "./randomKey";
104
- export * from "./readCookie";
105
- export * from "./removeAccents";
106
- export * from "./removeCookie";
107
- export * from "./removeDuplicatesByKey";
108
- export * from "./removeDuplicatesComparing";
109
- export * from "./removeIndexesFromArray";
110
- export * from "./removeTrailingSlash";
111
- export * from "./removeUrlQueryParams";
112
- export * from "./roundTo";
113
- export * from "./serializeCookie";
114
- export * from "./setCookie";
115
- export * from "./shuffle";
116
- export * from "./slugify";
117
- export * from "./swapMap";
118
- export * from "./throttle";
119
- export * from "./titleCase";
120
- export * from "./toNumber";
121
- export * from "./toRgba";
122
- export * from "./transformToUrlPathname";
123
- export * from "./truncate";
124
- export * from "./tryUntil";
125
- export * from "./uid";
126
- export * from "./updateLinkParams";
127
- export * from "./updateUrlQueryParams";
128
- export * from "./uppercase";
129
- export * from "./uuid";
130
- export * from "./uuidNumeric";
131
- export * from "./wait";
132
- export * from "./types";
1
+ export { accentsSets, type AccentsSet } from "./accentSets";
2
+ export { addOrReplaceAtIdx } from "./addOrReplaceAtIdx";
3
+ export { areEqual } from "./areEqual";
4
+ export { arrayOfAll } from "./arrayOfAll";
5
+ export { arraySum } from "./arraySum";
6
+ export { arrayToLookup } from "./arrayToLookup";
7
+ export { buildUrlQueryString } from "./buildUrlQueryString";
8
+ export { capitalize } from "./capitalize";
9
+ export { changeUrlPath } from "./changeUrlPath";
10
+ export { chunkByChunks } from "./chunkByChunks";
11
+ export { chunkBySize } from "./chunkBySize";
12
+ export { clamp } from "./clamp";
13
+ export { clsx } from "./clsx";
14
+ export { convertRange } from "./convertRange";
15
+ export { type CookieAttributesClient, type CookieAttributesServer, } from "./cookie";
16
+ export { createPalette } from "./createPalette";
17
+ export { debounce } from "./debounce";
18
+ export { debounceRaf } from "./debounceRaf";
19
+ export { debouncePromise, type DebounceOptions, type DebouncedFunction, } from "./debouncePromise";
20
+ export { decode } from "./decode";
21
+ export { Defer, type Deferred } from "./Defer";
22
+ export { Emitter } from "./Emitter";
23
+ export { encode } from "./encode";
24
+ export { ensureInt } from "./ensureInt";
25
+ export { errorToString } from "./errorToString";
26
+ export { findDuplicatedIndexes } from "./findDuplicatedIndexes";
27
+ export { forin } from "./forin";
28
+ export { gbToBytes } from "./gbToBytes";
29
+ export { getEmptyArray } from "./getEmptyArray";
30
+ export { getKeys } from "./getKeys";
31
+ export { getMediaQueryWidthResolvers } from "./getMediaQueryWidthResolvers";
32
+ export { getMediaQueryWidthTailwindScreens } from "./getMediaQueryWidthTailwindScreens";
33
+ export { getNonce } from "./getNonce";
34
+ export { getParamAmong } from "./getParamAmong";
35
+ export { getParamAsInt } from "./getParamAsInt";
36
+ export { getParamAsString } from "./getParamAsString";
37
+ export { getType } from "./getType";
38
+ export { getUrlHashParams } from "./getUrlHashParams";
39
+ export { getUrlHashPathname } from "./getUrlHashPathname";
40
+ export { getUrlPathnameParts } from "./getUrlPathnameParts";
41
+ export { getUrlQueryParams } from "./getUrlQueryParams";
42
+ export { imgEmptyPixel } from "./imgEmptyPixel";
43
+ export { isAnyObject } from "./isAnyObject";
44
+ export { isArray } from "./isArray";
45
+ export { isBlob } from "./isBlob";
46
+ export { isBoolean } from "./isBoolean";
47
+ export { isBrowser } from "./isBrowser";
48
+ export { isBrowserNow } from "./isBrowserNow";
49
+ export { isDate } from "./isDate";
50
+ export { isEmptyArray } from "./isEmptyArray";
51
+ export { isEmptyObject } from "./isEmptyObject";
52
+ export { isEmptyString } from "./isEmptyString";
53
+ export { isError } from "./isError";
54
+ export { isExternalUrl } from "./isExternalUrl";
55
+ export { isFile } from "./isFile";
56
+ export { isFloat } from "./isFloat";
57
+ export { isFormData } from "./isFormData";
58
+ export { isFullArray } from "./isFullArray";
59
+ export { isFullObject } from "./isFullObject";
60
+ export { isFullString } from "./isFullString";
61
+ export { isFunction } from "./isFunction";
62
+ export { isInt } from "./isInt";
63
+ export { isMap } from "./isMap";
64
+ export { isNaNValue } from "./isNaNValue";
65
+ export { isNegativeNumber } from "./isNegativeNumber";
66
+ export { isNullOrUndefined } from "./isNullOrUndefined";
67
+ export { isNull } from "./isNull";
68
+ export { isNumber } from "./isNumber";
69
+ export { isObjectLike } from "./isObjectLike";
70
+ export { isObject } from "./isObject";
71
+ export { isOneOf } from "./isOneOf";
72
+ export { isPlainObject } from "./isPlainObject";
73
+ export { isPositiveNumber } from "./isPositiveNumber";
74
+ export { isPrimitive } from "./isPrimitive";
75
+ export { isPromise } from "./isPromise";
76
+ export { isRegExp } from "./isRegExp";
77
+ export { isServer } from "./isServer";
78
+ export { isServerNow } from "./isServerNow";
79
+ export { isSet } from "./isSet";
80
+ export { isString } from "./isString";
81
+ export { isSymbol } from "./isSymbol";
82
+ export { isType } from "./isType";
83
+ export { isUndefined } from "./isUndefined";
84
+ export { isWeakMap } from "./isWeakMap";
85
+ export { isWeakSet } from "./isWeakSet";
86
+ export { kbToBytes } from "./kbToBytes";
87
+ export { type AnyQueryParams } from "./location";
88
+ export { lowercase } from "./lowercase";
89
+ export { mapListBy } from "./mapListBy";
90
+ export { matchSorter } from "./matchSorter";
91
+ export { mbToBytes } from "./mbToBytes";
92
+ export { mergeObjects } from "./mergeObjects";
93
+ export { mergeUrlQueryParams } from "./mergeUrlQueryParams";
94
+ export { moveSortableArrayItemByKey } from "./moveSortableArrayItemByKey";
95
+ export { noop } from "./noop";
96
+ export { normaliseUrlPathname } from "./normaliseUrlPathname";
97
+ export { normaliseUrl } from "./normaliseUrl";
98
+ export { objectPick } from "./objectPick";
99
+ export { objectOmit } from "./objectOmit";
100
+ export { parseCookie } from "./parseCookie";
101
+ export { parseURL } from "./parseURL";
102
+ export { quaranteneProps } from "./quaranteneProps";
103
+ export { randomInt } from "./randomInt";
104
+ export { randomKey } from "./randomKey";
105
+ export { readCookie } from "./readCookie";
106
+ export { removeAccents } from "./removeAccents";
107
+ export { removeCookie } from "./removeCookie";
108
+ export { removeDuplicatesByKey } from "./removeDuplicatesByKey";
109
+ export { removeDuplicatesComparing } from "./removeDuplicatesComparing";
110
+ export { removeIndexesFromArray } from "./removeIndexesFromArray";
111
+ export { removeTralingSlash } from "./removeTrailingSlash";
112
+ export { removeUrlQueryParams } from "./removeUrlQueryParams";
113
+ export { roundTo } from "./roundTo";
114
+ export { serializeCookie } from "./serializeCookie";
115
+ export { setCookie } from "./setCookie";
116
+ export { shuffle } from "./shuffle";
117
+ export { slugify } from "./slugify";
118
+ export { swapMap } from "./swapMap";
119
+ export { throttle } from "./throttle";
120
+ export { titleCase } from "./titleCase";
121
+ export { toNumber } from "./toNumber";
122
+ export { toRgba } from "./toRgba";
123
+ export { transformToUrlPathname } from "./transformToUrlPathname";
124
+ export { truncate } from "./truncate";
125
+ export { tryUntil } from "./tryUntil";
126
+ export { uid } from "./uid";
127
+ export { updateLinkParams } from "./updateLinkParams";
128
+ export { updateUrlQueryParams } from "./updateUrlQueryParams";
129
+ export { uppercase } from "./uppercase";
130
+ export { uuid } from "./uuid";
131
+ export { uuidNumeric } from "./uuidNumeric";
132
+ export { wait } from "./wait";
133
+ export type { AnythingFalsy } from "./types";
133
134
  export type { Primitive, Class, Constructor, TypedArray, Observer, ObservableLike, Except, Writable, Merge, MergeDeep, MergeExclusive, RequireAtLeastOne, RequireExactlyOne, RequireAllOrNone, RemoveIndexSignature, PartialDeep, ReadonlyDeep, LiteralUnion, Opaque, InvariantOf, SetOptional, SetRequired, ValueOf, ConditionalKeys, ConditionalPick, ConditionalExcept, UnionToIntersection, LiteralToPrimitive, Stringified, IterableElement, Entry, Exact, Entries, SetReturnType, Simplify, Get, StringKeyOf, Schema, Jsonify, JsonPrimitive, JsonObject, JsonArray, JsonValue, Promisable, AsyncReturnType, Asyncify, Trim, Split, Includes, Join, LastArrayElement, FixedLengthArray, MultidimensionalArray, MultidimensionalReadonlyArray, PositiveInfinity, NegativeInfinity, Finite, Integer, Float, NegativeFloat, Negative, NonNegative, NegativeInteger, NonNegativeInteger, CamelCase, CamelCasedProperties, CamelCasedPropertiesDeep, KebabCase, KebabCasedProperties, KebabCasedPropertiesDeep, PascalCase, PascalCasedProperties, PascalCasedPropertiesDeep, SnakeCase, SnakeCasedProperties, SnakeCasedPropertiesDeep, ScreamingSnakeCase, DelimiterCase, DelimiterCasedProperties, DelimiterCasedPropertiesDeep, PackageJson, TsConfigJson, SetNonNullable, Spread, PartialOnUndefinedDeep, OptionalKeysOf, HasOptionalKeys, RequiredKeysOf, HasRequiredKeys, UnwrapOpaque, EmptyObject, IsEmptyObject, TupleToUnion, OmitIndexSignature, PickIndexSignature, ConditionalPickDeep, } from "type-fest";