@koine/utils 2.0.0-beta.10 → 2.0.0-beta.11

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.
Files changed (237) hide show
  1. package/Emitter.d.ts +3 -1
  2. package/Emitter.mjs +3 -1
  3. package/accentSets.d.ts +3 -2
  4. package/accentSets.mjs +3 -2
  5. package/addOrReplaceAtIdx.d.ts +4 -0
  6. package/addOrReplaceAtIdx.mjs +4 -0
  7. package/areEqual.d.ts +1 -1
  8. package/areEqual.mjs +1 -1
  9. package/arrayOfAll.d.ts +1 -2
  10. package/arrayOfAll.mjs +1 -2
  11. package/arraySum.d.ts +2 -1
  12. package/arraySum.mjs +2 -1
  13. package/capitalize.d.ts +2 -1
  14. package/capitalize.mjs +2 -1
  15. package/chunkByChunks.d.ts +1 -1
  16. package/chunkByChunks.mjs +1 -1
  17. package/clsx.d.ts +2 -1
  18. package/clsx.mjs +2 -1
  19. package/convertRange.d.ts +3 -1
  20. package/convertRange.mjs +3 -1
  21. package/cookie.d.ts +13 -1
  22. package/cookie.mjs +5 -1
  23. package/createPalette.d.ts +3 -1
  24. package/createPalette.mjs +3 -1
  25. package/debouncePromise.d.ts +10 -2
  26. package/debouncePromise.mjs +6 -2
  27. package/debounceRaf.d.ts +1 -1
  28. package/debounceRaf.mjs +1 -1
  29. package/errorToString.d.ts +2 -1
  30. package/errorToString.mjs +2 -1
  31. package/forin.d.ts +2 -1
  32. package/forin.mjs +2 -1
  33. package/getEmptyArray.d.ts +0 -1
  34. package/getEmptyArray.mjs +0 -1
  35. package/getKeys.d.ts +2 -1
  36. package/getKeys.mjs +2 -1
  37. package/getMediaQueryWidthResolvers.d.ts +6 -0
  38. package/getMediaQueryWidthResolvers.mjs +5 -1
  39. package/getMediaQueryWidthTailwindScreens.d.ts +4 -0
  40. package/getMediaQueryWidthTailwindScreens.mjs +4 -1
  41. package/getParamAmong.d.ts +3 -2
  42. package/getParamAmong.mjs +3 -2
  43. package/getParamAsInt.d.ts +2 -2
  44. package/getParamAsInt.mjs +2 -2
  45. package/getParamAsString.d.ts +1 -1
  46. package/getParamAsString.mjs +1 -1
  47. package/getType.d.ts +0 -3
  48. package/getType.mjs +0 -3
  49. package/getUrlQueryParams.d.ts +3 -4
  50. package/getUrlQueryParams.mjs +3 -4
  51. package/index.d.ts +4 -1
  52. package/matchSorter.mjs +2 -2
  53. package/mergeObjects.d.ts +1 -1
  54. package/mergeObjects.mjs +1 -1
  55. package/mergeUrlQueryParams.d.ts +0 -1
  56. package/mergeUrlQueryParams.mjs +0 -1
  57. package/moveSortableArrayItemByKey.d.ts +1 -1
  58. package/moveSortableArrayItemByKey.mjs +1 -1
  59. package/objectOmit.d.ts +1 -1
  60. package/objectOmit.mjs +1 -1
  61. package/objectPick.d.ts +1 -1
  62. package/objectPick.mjs +1 -1
  63. package/package.json +2 -2
  64. package/quaranteneProps.d.ts +1 -1
  65. package/quaranteneProps.mjs +1 -1
  66. package/readCookie.d.ts +5 -0
  67. package/removeCookie.d.ts +0 -4
  68. package/removeCookie.mjs +0 -4
  69. package/removeUrlQueryParams.d.ts +0 -1
  70. package/removeUrlQueryParams.mjs +0 -1
  71. package/render.d.ts +2 -1
  72. package/render.mjs +2 -1
  73. package/serializeCookie.d.ts +1 -5
  74. package/serializeCookie.mjs +1 -5
  75. package/setCookie.d.ts +0 -4
  76. package/setCookie.mjs +0 -4
  77. package/shuffle.d.ts +7 -6
  78. package/shuffle.mjs +7 -6
  79. package/slugify.d.ts +2 -1
  80. package/slugify.mjs +2 -1
  81. package/split.d.ts +4 -0
  82. package/split.mjs +4 -1
  83. package/swapMap.d.ts +1 -1
  84. package/swapMap.mjs +1 -1
  85. package/throttle.d.ts +1 -1
  86. package/throttle.mjs +1 -1
  87. package/titleCase.d.ts +4 -3
  88. package/titleCase.mjs +4 -3
  89. package/truncate.d.ts +1 -1
  90. package/truncate.mjs +1 -1
  91. package/tryUntil.d.ts +4 -1
  92. package/tryUntil.mjs +4 -1
  93. package/typings.d.ts +1 -6
  94. package/updateUrlQueryParams.d.ts +0 -1
  95. package/updateUrlQueryParams.mjs +0 -1
  96. package/uppercase.d.ts +1 -0
  97. package/uppercase.mjs +1 -0
  98. package/Defer.js +0 -35
  99. package/Emitter.js +0 -53
  100. package/accentSets.js +0 -133
  101. package/addOrReplaceAtIdx.js +0 -40
  102. package/areEqual.js +0 -75
  103. package/arrayOfAll.js +0 -45
  104. package/arraySum.js +0 -24
  105. package/arrayToLookup.js +0 -29
  106. package/buildUrlQueryString.js +0 -39
  107. package/capitalize.js +0 -28
  108. package/changeUrlPath.js +0 -29
  109. package/chunkByChunks.js +0 -52
  110. package/chunkBySize.js +0 -29
  111. package/clamp.js +0 -27
  112. package/clsx.js +0 -60
  113. package/convertRange.js +0 -33
  114. package/cookie.js +0 -21
  115. package/createPalette.js +0 -39
  116. package/debounce.js +0 -39
  117. package/debouncePromise.js +0 -87
  118. package/debounceRaf.js +0 -40
  119. package/decode.js +0 -27
  120. package/encode.js +0 -27
  121. package/ensureInt.js +0 -24
  122. package/env.js +0 -3
  123. package/errorToString.js +0 -22
  124. package/findDuplicatedIndexes.js +0 -31
  125. package/forin.js +0 -28
  126. package/gbToBytes.js +0 -24
  127. package/getEmptyArray.js +0 -29
  128. package/getKeys.js +0 -26
  129. package/getMediaQueryWidthResolvers.js +0 -81
  130. package/getMediaQueryWidthTailwindScreens.js +0 -51
  131. package/getNonce.js +0 -23
  132. package/getParamAmong.js +0 -25
  133. package/getParamAsInt.js +0 -28
  134. package/getParamAsString.js +0 -24
  135. package/getType.js +0 -30
  136. package/getUrlHashParams.js +0 -27
  137. package/getUrlHashPathname.js +0 -29
  138. package/getUrlPathnameParts.js +0 -25
  139. package/getUrlQueryParams.js +0 -36
  140. package/imgEmptyPixel.js +0 -24
  141. package/index.js +0 -532
  142. package/invariant.js +0 -50
  143. package/isAnyObject.js +0 -24
  144. package/isArray.js +0 -24
  145. package/isBlob.js +0 -24
  146. package/isBoolean.js +0 -24
  147. package/isBrowser.js +0 -23
  148. package/isBrowserNow.js +0 -22
  149. package/isDate.js +0 -24
  150. package/isEmptyArray.js +0 -24
  151. package/isEmptyObject.js +0 -24
  152. package/isEmptyString.js +0 -26
  153. package/isError.js +0 -24
  154. package/isExternalUrl.js +0 -32
  155. package/isFile.js +0 -24
  156. package/isFloat.js +0 -24
  157. package/isFormData.js +0 -24
  158. package/isFullArray.js +0 -24
  159. package/isFullObject.js +0 -24
  160. package/isFullString.js +0 -24
  161. package/isFunction.js +0 -22
  162. package/isInt.js +0 -24
  163. package/isMap.js +0 -24
  164. package/isNaNValue.js +0 -24
  165. package/isNegativeNumber.js +0 -24
  166. package/isNull.js +0 -24
  167. package/isNullOrUndefined.js +0 -24
  168. package/isNumber.js +0 -24
  169. package/isObject.js +0 -24
  170. package/isObjectLike.js +0 -24
  171. package/isOneOf.js +0 -22
  172. package/isPlainObject.js +0 -25
  173. package/isPositiveNumber.js +0 -24
  174. package/isPrimitive.js +0 -29
  175. package/isPromise.js +0 -24
  176. package/isRegExp.js +0 -24
  177. package/isServer.js +0 -23
  178. package/isServerNow.js +0 -22
  179. package/isSet.js +0 -24
  180. package/isString.js +0 -24
  181. package/isSymbol.js +0 -24
  182. package/isType.js +0 -32
  183. package/isUndefined.js +0 -24
  184. package/isWeakMap.js +0 -24
  185. package/isWeakSet.js +0 -24
  186. package/kbToBytes.js +0 -24
  187. package/location.js +0 -6
  188. package/lowercase.js +0 -24
  189. package/mapListBy.js +0 -29
  190. package/matchSorter.js +0 -373
  191. package/mbToBytes.js +0 -24
  192. package/mergeObjects.js +0 -39
  193. package/mergeUrlQueryParams.js +0 -32
  194. package/moveSortableArrayItemByKey.js +0 -35
  195. package/noop.js +0 -24
  196. package/normaliseUrl.js +0 -24
  197. package/normaliseUrlPathname.js +0 -24
  198. package/objectOmit.js +0 -35
  199. package/objectPick.js +0 -32
  200. package/parseCookie.js +0 -55
  201. package/parseURL.js +0 -37
  202. package/quaranteneProps.js +0 -49
  203. package/randomInt.js +0 -26
  204. package/randomKey.js +0 -28
  205. package/readCookie.js +0 -51
  206. package/removeAccents.js +0 -28
  207. package/removeCookie.js +0 -28
  208. package/removeDuplicates.js +0 -13
  209. package/removeDuplicatesByKey.js +0 -36
  210. package/removeDuplicatesComparing.js +0 -25
  211. package/removeIndexesFromArray.js +0 -31
  212. package/removeTrailingSlash.js +0 -26
  213. package/removeUrlQueryParams.js +0 -33
  214. package/render.js +0 -93
  215. package/roundTo.js +0 -50
  216. package/serializeCookie.js +0 -102
  217. package/setCookie.js +0 -68
  218. package/shuffle.js +0 -50
  219. package/slugify.js +0 -35
  220. package/split.js +0 -22
  221. package/swapMap.js +0 -30
  222. package/throttle.js +0 -38
  223. package/titleCase.js +0 -24
  224. package/toNumber.js +0 -23
  225. package/toRgba.js +0 -32
  226. package/transformToUrlPathname.js +0 -24
  227. package/truncate.js +0 -24
  228. package/tryUntil.js +0 -42
  229. package/types.js +0 -5
  230. package/uid.js +0 -24
  231. package/updateLinkParams.js +0 -26
  232. package/updateUrlQueryParams.js +0 -28
  233. package/uppercase.js +0 -24
  234. package/uuid.js +0 -28
  235. package/uuidNumeric.js +0 -23
  236. package/wait.js +0 -24
  237. package/without.js +0 -55
package/Emitter.d.ts CHANGED
@@ -6,9 +6,11 @@
6
6
  *
7
7
  * Adapted from https://github.com/developit/mitt
8
8
  *
9
- * Regarding typescript support @see:
9
+ * Regarding typescript support see:
10
10
  * - https://stackoverflow.com/q/53299743/1938970
11
11
  * - https://github.com/Microsoft/TypeScript/pull/26349
12
+ *
13
+ * @category impl
12
14
  */
13
15
  export declare function Emitter<EventMap extends {
14
16
  [key: string]: any;
package/Emitter.mjs CHANGED
@@ -6,9 +6,11 @@
6
6
  *
7
7
  * Adapted from https://github.com/developit/mitt
8
8
  *
9
- * Regarding typescript support @see:
9
+ * Regarding typescript support see:
10
10
  * - https://stackoverflow.com/q/53299743/1938970
11
11
  * - https://github.com/Microsoft/TypeScript/pull/26349
12
+ *
13
+ * @category impl
12
14
  */ export function Emitter(namespace) {
13
15
  const all = new Map();
14
16
  return {
package/accentSets.d.ts CHANGED
@@ -8,8 +8,9 @@ export type AccentsSet = [string, string];
8
8
  * Accent sets
9
9
  *
10
10
  * @category text
11
- * @see https://gist.github.com/mathewbyrne/1280286#gistcomment-3498021
12
- * @see https://gist.github.com/eek/9c4887e80b3ede05c0e39fee4dce3747 for usage
11
+ * @resources
12
+ * - https://gist.github.com/mathewbyrne/1280286#gistcomment-3498021
13
+ * - https://gist.github.com/eek/9c4887e80b3ede05c0e39fee4dce3747 for usage
13
14
  * of [normalize](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/normalize)
14
15
  */
15
16
  export declare const accentsSets: AccentsSet[];
package/accentSets.mjs CHANGED
@@ -6,8 +6,9 @@
6
6
  * Accent sets
7
7
  *
8
8
  * @category text
9
- * @see https://gist.github.com/mathewbyrne/1280286#gistcomment-3498021
10
- * @see https://gist.github.com/eek/9c4887e80b3ede05c0e39fee4dce3747 for usage
9
+ * @resources
10
+ * - https://gist.github.com/mathewbyrne/1280286#gistcomment-3498021
11
+ * - https://gist.github.com/eek/9c4887e80b3ede05c0e39fee4dce3747 for usage
11
12
  * of [normalize](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/normalize)
12
13
  */ export const accentsSets = [
13
14
  [
@@ -1,4 +1,8 @@
1
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
+ *
2
6
  * @category array
3
7
  */
4
8
  export declare function addOrReplaceAtIdx<T>(list: T[], newItem: T, newIdx?: number): T[];
@@ -1,4 +1,8 @@
1
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
+ *
2
6
  * @category array
3
7
  */ export function addOrReplaceAtIdx(list, newItem, newIdx) {
4
8
  if (list.length === 0) {
package/areEqual.d.ts CHANGED
@@ -13,7 +13,7 @@ type Comparable = ComparablePrimitive | object | Record<string, ComparablePrimit
13
13
  * According to very rudimentary tests this function takes on average between
14
14
  * 0.15 ms and 2ms to compare two averaged sizes requet body payloads.
15
15
  *
16
- * @category objects
16
+ * @category object
17
17
  */
18
18
  export declare function areEqual(a: Comparable, b?: Comparable): boolean;
19
19
  export default areEqual;
package/areEqual.mjs CHANGED
@@ -40,7 +40,7 @@ function areEqualObjects(a, b) {
40
40
  * According to very rudimentary tests this function takes on average between
41
41
  * 0.15 ms and 2ms to compare two averaged sizes requet body payloads.
42
42
  *
43
- * @category objects
43
+ * @category object
44
44
  */ export function areEqual(a, b) {
45
45
  if (!a && !b) {
46
46
  // console.log(`areEqual took ${performance.now() - t0} ms`);
package/arrayOfAll.d.ts CHANGED
@@ -5,8 +5,7 @@
5
5
  * @borrows [SO comment by `CertainPerformance`](https://stackoverflow.com/a/60132060/1938970)
6
6
  *
7
7
  * @usage
8
- *
9
- * ```
8
+ * ```ts
10
9
  * type Fruit = "pear" | "apple" | "orange";
11
10
  *
12
11
  * const arrayOfAllFruits = arrayOfAll<Fruit>();
package/arrayOfAll.mjs CHANGED
@@ -5,8 +5,7 @@
5
5
  * @borrows [SO comment by `CertainPerformance`](https://stackoverflow.com/a/60132060/1938970)
6
6
  *
7
7
  * @usage
8
- *
9
- * ```
8
+ * ```ts
10
9
  * type Fruit = "pear" | "apple" | "orange";
11
10
  *
12
11
  * const arrayOfAllFruits = arrayOfAll<Fruit>();
package/arraySum.d.ts CHANGED
@@ -1,7 +1,8 @@
1
1
  /**
2
2
  * Sum array of numbers
3
3
  *
4
- * @category array | math
4
+ * @category array
5
+ * @category math
5
6
  */
6
7
  export declare const arraySum: (numbers: number[]) => number;
7
8
  export default arraySum;
package/arraySum.mjs CHANGED
@@ -1,6 +1,7 @@
1
1
  /**
2
2
  * Sum array of numbers
3
3
  *
4
- * @category array | math
4
+ * @category array
5
+ * @category math
5
6
  */ export const arraySum = (numbers)=>numbers.reduce((sum, current)=>sum + current, 0);
6
7
  export default arraySum;
package/capitalize.d.ts CHANGED
@@ -2,7 +2,8 @@
2
2
  * Capitalize first letter of the given string.
3
3
  *
4
4
  * @category text
5
- * @see https://stackoverflow.com/a/11409944/1938970
5
+ * @resources
6
+ * - https://stackoverflow.com/a/11409944/1938970
6
7
  */
7
8
  export declare function capitalize<T extends string>(string?: null | T): Capitalize<T>;
8
9
  export default capitalize;
package/capitalize.mjs CHANGED
@@ -2,7 +2,8 @@
2
2
  * Capitalize first letter of the given string.
3
3
  *
4
4
  * @category text
5
- * @see https://stackoverflow.com/a/11409944/1938970
5
+ * @resources
6
+ * - https://stackoverflow.com/a/11409944/1938970
6
7
  */ export function capitalize(string) {
7
8
  const ensuredString = string || "";
8
9
  return ensuredString.charAt(0).toUpperCase() + ensuredString.slice(1);
@@ -1,7 +1,7 @@
1
1
  /**
2
- * TODO: untested
3
2
  * @category array
4
3
  * @see https://stackoverflow.com/a/8189268/1938970
4
+ * @experimental TODO: untested
5
5
  */
6
6
  export declare function chunkByChunks<T>(arr: T[], nrOfChunks: number, balanced?: boolean): T[][];
7
7
  export default chunkByChunks;
package/chunkByChunks.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  /**
2
- * TODO: untested
3
2
  * @category array
4
3
  * @see https://stackoverflow.com/a/8189268/1938970
4
+ * @experimental TODO: untested
5
5
  */ export function chunkByChunks(arr, nrOfChunks, balanced) {
6
6
  if (nrOfChunks < 2) return [
7
7
  arr
package/clsx.d.ts CHANGED
@@ -5,8 +5,9 @@ export type ClsxClassValue = ClassValue;
5
5
  /**
6
6
  * Class names utility
7
7
  *
8
+ * @category impl
8
9
  * @borrows [lukeed/clsx](https://github.com/lukeed/clsx)
9
- * @license [MIT: Luke Edwards](https://github.com/lukeed/clsx/blob/master/license)
10
+ * @license MIT Luke Edwards https://github.com/lukeed/clsx/blob/master/license
10
11
  */
11
12
  export declare const clsx: (...args: ClassValue[]) => string;
12
13
  export default clsx;
package/clsx.mjs CHANGED
@@ -29,8 +29,9 @@ function toVal(mix) {
29
29
  /**
30
30
  * Class names utility
31
31
  *
32
+ * @category impl
32
33
  * @borrows [lukeed/clsx](https://github.com/lukeed/clsx)
33
- * @license [MIT: Luke Edwards](https://github.com/lukeed/clsx/blob/master/license)
34
+ * @license MIT Luke Edwards https://github.com/lukeed/clsx/blob/master/license
34
35
  */ export const clsx = function() {
35
36
  let i = 0, tmp, x, str = "";
36
37
  while(i < arguments.length){
package/convertRange.d.ts CHANGED
@@ -3,7 +3,9 @@
3
3
  *
4
4
  * e.g. converting number 5 in a scale/range from 0 10 to a scale/range from 50
5
5
  * to 100 would return 75
6
- * ```
6
+ * @example
7
+ *
8
+ * ```ts
7
9
  * convertRange(5, [0, 10], [50, 100]);
8
10
  * ```
9
11
  *
package/convertRange.mjs CHANGED
@@ -3,7 +3,9 @@
3
3
  *
4
4
  * e.g. converting number 5 in a scale/range from 0 10 to a scale/range from 50
5
5
  * to 100 would return 75
6
- * ```
6
+ * @example
7
+ *
8
+ * ```ts
7
9
  * convertRange(5, [0, 10], [50, 100]);
8
10
  * ```
9
11
  *
package/cookie.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @file
2
+ * @module
3
3
  *
4
4
  * @category cookie
5
5
  *
@@ -7,6 +7,9 @@
7
7
  * - [js-cookie](https://github.com/js-cookie/js-cookie)
8
8
  * - [cookie](https://github.com/jshttp/cookie)
9
9
  */
10
+ /**
11
+ * @category cookie
12
+ */
10
13
  type CookieAttributes = {
11
14
  /**
12
15
  * Define when the cookie will be removed. Value can be a Number
@@ -41,13 +44,22 @@ type CookieAttributes = {
41
44
  */
42
45
  sameSite?: "strict" | "Strict" | "lax" | "Lax" | "none" | "None" | undefined;
43
46
  };
47
+ /**
48
+ * @category cookie
49
+ */
44
50
  export type CookieAttributesServer = CookieAttributes & {
45
51
  maxAge?: number;
46
52
  httpOnly?: boolean;
47
53
  encode?: (input: string) => string;
48
54
  decode?: (input: string) => string;
49
55
  };
56
+ /**
57
+ * @category cookie
58
+ */
50
59
  export type CookieAttributesClient = CookieAttributes;
60
+ /**
61
+ * @category cookie
62
+ */
51
63
  export declare const defaultAttributesClient: {
52
64
  path: string;
53
65
  };
package/cookie.mjs CHANGED
@@ -1,11 +1,15 @@
1
1
  /**
2
- * @file
2
+ * @module
3
3
  *
4
4
  * @category cookie
5
5
  *
6
6
  * All cookie related code is inspired and adapted from:
7
7
  * - [js-cookie](https://github.com/js-cookie/js-cookie)
8
8
  * - [cookie](https://github.com/jshttp/cookie)
9
+ */ /**
10
+ * @category cookie
11
+ */ /**
12
+ * @category cookie
9
13
  */ export const defaultAttributesClient = {
10
14
  path: "/"
11
15
  };
@@ -10,7 +10,9 @@ type PaletteMap<T extends PaletteShades> = {
10
10
  * Create palette, this is primarily thought to improve the reuse of a palette
11
11
  * definition between TailwindCSS and straight ES imports
12
12
  *
13
- * @category styling|tailwind|colours
13
+ * @category colors
14
+ * @category tailwind
15
+ * @category responsive
14
16
  *
15
17
  * @returns An array with: 1) A flat palette map 2) A TailwindCSS ready palette
16
18
  * object 3) A flat array of colors (no special sorting, same order as the `shades`
package/createPalette.mjs CHANGED
@@ -2,7 +2,9 @@
2
2
  * Create palette, this is primarily thought to improve the reuse of a palette
3
3
  * definition between TailwindCSS and straight ES imports
4
4
  *
5
- * @category styling|tailwind|colours
5
+ * @category colors
6
+ * @category tailwind
7
+ * @category responsive
6
8
  *
7
9
  * @returns An array with: 1) A flat palette map 2) A TailwindCSS ready palette
8
10
  * object 3) A flat array of colors (no special sorting, same order as the `shades`
@@ -1,11 +1,19 @@
1
1
  /**
2
- * @file Copy pasted from https://github.com/chodorowicz/ts-debounce/blob/master/src/index.ts
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
3
8
  */
4
9
  export type DebounceOptions<Result> = {
5
10
  isImmediate?: boolean;
6
11
  maxWait?: number;
7
12
  callback?: (data: Result) => void;
8
13
  };
14
+ /**
15
+ * @categroy functionn
16
+ */
9
17
  export interface DebouncedFunction<Args extends any[], F extends (...args: Args) => any> {
10
18
  (this: ThisParameterType<F>, ...args: Args & Parameters<F>): Promise<ReturnType<F>>;
11
19
  cancel: (reason?: any) => void;
@@ -15,7 +23,7 @@ export interface DebouncedFunction<Args extends any[], F extends (...args: Args)
15
23
  *
16
24
  * @category function
17
25
  * @borrows [chodorowicz/ts-debounce](https://github.com/chodorowicz/ts-debounce)
18
- * @license [MIT: Jakub Chodorowicz](Jakub Chodorowicz)
26
+ * @license MIT: Jakub Chodorowicz
19
27
  */
20
28
  export declare function debouncePromise<Args extends any[], F extends (...args: Args) => any>(func: F, waitMilliseconds?: number, options?: DebounceOptions<ReturnType<F>>): DebouncedFunction<Args, F>;
21
29
  export default debouncePromise;
@@ -10,13 +10,17 @@
10
10
  // export const debouncePromise = tsDebounce;
11
11
  // export default debouncePromise;
12
12
  /**
13
- * @file Copy pasted from https://github.com/chodorowicz/ts-debounce/blob/master/src/index.ts
13
+ * Copy pasted from [chodorowicz/ts-debounce](https://github.com/chodorowicz/ts-debounce/blob/master/src/index.ts)
14
+ *
15
+ * @module
16
+ */ /**
17
+ * @categroy functionn
14
18
  */ /**
15
19
  * Debounce function (with `Promise`)
16
20
  *
17
21
  * @category function
18
22
  * @borrows [chodorowicz/ts-debounce](https://github.com/chodorowicz/ts-debounce)
19
- * @license [MIT: Jakub Chodorowicz](Jakub Chodorowicz)
23
+ * @license MIT: Jakub Chodorowicz
20
24
  */ export function debouncePromise(func, waitMilliseconds = 50, options = {}) {
21
25
  let timeoutId;
22
26
  const isImmediate = options.isImmediate ?? false;
package/debounceRaf.d.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  /**
2
2
  * Debounce function (with `requestAnimationFrame`)
3
3
  *
4
- * (c) 2021 Chris Ferdinandi, MIT License, https://gomakethings.com
5
4
  * @category function
6
5
  * @borrows [vanillajstoolkit/debounce](https://vanillajstoolkit.com/helpers/debounce/)
6
+ * @license (c) 2021 Chris Ferdinandi, MIT License, https://gomakethings.com
7
7
  */
8
8
  export declare function debounceRaf<T extends (...args: any[]) => any>(this: unknown, fn: T): (this: unknown, ...args: Parameters<T>) => void;
9
9
  export default debounceRaf;
package/debounceRaf.mjs CHANGED
@@ -1,9 +1,9 @@
1
1
  /**
2
2
  * Debounce function (with `requestAnimationFrame`)
3
3
  *
4
- * (c) 2021 Chris Ferdinandi, MIT License, https://gomakethings.com
5
4
  * @category function
6
5
  * @borrows [vanillajstoolkit/debounce](https://vanillajstoolkit.com/helpers/debounce/)
6
+ * @license (c) 2021 Chris Ferdinandi, MIT License, https://gomakethings.com
7
7
  */ export function debounceRaf(fn) {
8
8
  let timeout;
9
9
  return function(...args) {
@@ -1,7 +1,8 @@
1
1
  /**
2
2
  * Ensure to transform a JavaScript `Error` into a string (uses its `message`)
3
3
  *
4
- * @category Error
4
+ * @category error
5
+ * @category cast
5
6
  */
6
7
  export declare const errorToString: (e: unknown) => string;
7
8
  export default errorToString;
package/errorToString.mjs CHANGED
@@ -2,6 +2,7 @@ import isString from "./isString";
2
2
  /**
3
3
  * Ensure to transform a JavaScript `Error` into a string (uses its `message`)
4
4
  *
5
- * @category Error
5
+ * @category error
6
+ * @category cast
6
7
  */ export const errorToString = (e)=>e instanceof Error ? e.message : isString(e) ? e : "";
7
8
  export default errorToString;
package/forin.d.ts CHANGED
@@ -1,7 +1,8 @@
1
1
  /**
2
2
  * To easily get typed native `for in`
3
3
  *
4
- * @category objects
4
+ * @category native
5
+ * @category object
5
6
  */
6
7
  export declare function forin<T>(object: T, cb: <K extends keyof T>(key: K, value: T[K]) => void): void;
7
8
  export default forin;
package/forin.mjs CHANGED
@@ -1,7 +1,8 @@
1
1
  /**
2
2
  * To easily get typed native `for in`
3
3
  *
4
- * @category objects
4
+ * @category native
5
+ * @category object
5
6
  */ export function forin(object, cb) {
6
7
  for(const key in object){
7
8
  cb(key, object[key]);
@@ -1,5 +1,4 @@
1
1
  /**
2
- *
3
2
  * Returns an array of undefined values of the desired length, useful to build
4
3
  * skeleton UIs.
5
4
  *
package/getEmptyArray.mjs CHANGED
@@ -1,6 +1,5 @@
1
1
  import isNumber from "./isNumber";
2
2
  /**
3
- *
4
3
  * Returns an array of undefined values of the desired length, useful to build
5
4
  * skeleton UIs.
6
5
  *
package/getKeys.d.ts CHANGED
@@ -2,7 +2,8 @@
2
2
  * Type safe replacement for `Object.keys(myObject)` to iterate over a record
3
3
  * without loosing the key's types in simple `string`s.
4
4
  *
5
- * @category objects
5
+ * @category native
6
+ * @category object
6
7
  * @see https://stackoverflow.com/a/59459000/1938970
7
8
  */
8
9
  export declare const getKeys: <T extends object>(obj: T) => (keyof T)[];
package/getKeys.mjs CHANGED
@@ -2,7 +2,8 @@
2
2
  * Type safe replacement for `Object.keys(myObject)` to iterate over a record
3
3
  * without loosing the key's types in simple `string`s.
4
4
  *
5
- * @category objects
5
+ * @category native
6
+ * @category object
6
7
  * @see https://stackoverflow.com/a/59459000/1938970
7
8
  */ export const getKeys = Object.keys;
8
9
  export default getKeys;
@@ -1,4 +1,10 @@
1
+ /**
2
+ * @category responsive
3
+ */
1
4
  export type GetMediaQueryWidthResolversBreakpoints = Record<string, number>;
5
+ /**
6
+ * @category responsive
7
+ */
2
8
  export declare function getMediaQueryWidthResolvers<TBreakpointsConfig extends GetMediaQueryWidthResolversBreakpoints>(customBreakpoints: TBreakpointsConfig): {
3
9
  max: (br: Extract<keyof TBreakpointsConfig, string>) => string;
4
10
  min: (br: Extract<keyof TBreakpointsConfig, string>) => string;
@@ -1,4 +1,8 @@
1
- export function getMediaQueryWidthResolvers(customBreakpoints) {
1
+ /**
2
+ * @category responsive
3
+ */ /**
4
+ * @category responsive
5
+ */ export function getMediaQueryWidthResolvers(customBreakpoints) {
2
6
  const breakpoints = {
3
7
  xs: 0,
4
8
  ...customBreakpoints
@@ -1,4 +1,8 @@
1
1
  import { type GetMediaQueryWidthResolversBreakpoints } from "./getMediaQueryWidthResolvers";
2
+ /**
3
+ * @category responsive
4
+ * @category tailwind
5
+ */
2
6
  export declare function getMediaQueryWidthTailwindScreens(breakpoints: GetMediaQueryWidthResolversBreakpoints): Record<string, {
3
7
  raw: string;
4
8
  }>;
@@ -1,5 +1,8 @@
1
1
  import { getMediaQueryWidthResolvers } from "./getMediaQueryWidthResolvers";
2
- export function getMediaQueryWidthTailwindScreens(breakpoints) {
2
+ /**
3
+ * @category responsive
4
+ * @category tailwind
5
+ */ export function getMediaQueryWidthTailwindScreens(breakpoints) {
3
6
  const mqWidthResolvers = getMediaQueryWidthResolvers(breakpoints);
4
7
  // Object.keys(breakpoints).reduce((screens, br) => {
5
8
  const screens = Object.keys(breakpoints).reduce((output, br, idx)=>{
@@ -5,8 +5,9 @@
5
5
  *
6
6
  * @category location
7
7
  *
8
- * @param {string} [raw] - The _raw_ query parameter
9
- * @param {string[]} [allowedValues=[]] - The list of values (as strings) that the parameter can have, if not one of them `null` is returned
8
+ * @param raw The _raw_ query parameter
9
+ * @param allowedValues The list of values (as strings) that the parameter can
10
+ * have, if not one of them `null` is returned
10
11
  */
11
12
  export declare function getParamAmong<T extends string[]>(raw?: string | string[], allowedValues?: T): T[number] | null;
12
13
  export default getParamAmong;
package/getParamAmong.mjs CHANGED
@@ -6,8 +6,9 @@ import getParamAsString from "./getParamAsString";
6
6
  *
7
7
  * @category location
8
8
  *
9
- * @param {string} [raw] - The _raw_ query parameter
10
- * @param {string[]} [allowedValues=[]] - The list of values (as strings) that the parameter can have, if not one of them `null` is returned
9
+ * @param raw The _raw_ query parameter
10
+ * @param allowedValues The list of values (as strings) that the parameter can
11
+ * have, if not one of them `null` is returned
11
12
  */ export function getParamAmong(raw, allowedValues = []) {
12
13
  const string = getParamAsString(raw);
13
14
  return allowedValues.includes(string) ? string : null;
@@ -5,8 +5,8 @@
5
5
  *
6
6
  * @category location
7
7
  *
8
- * @param {string} [raw] - The _raw_ query parameter
9
- * @param {number} [fallback] - Fallback number, we return `null` if not provided
8
+ * @param raw The _raw_ query parameter
9
+ * @param fallback Fallback number, we return `null` if not provided
10
10
  */
11
11
  export declare function getParamAsInt<TFallback extends number | null | undefined>(raw?: string | string[], fallback?: TFallback): number | TFallback;
12
12
  export default getParamAsInt;
package/getParamAsInt.mjs CHANGED
@@ -6,8 +6,8 @@ import getParamAsString from "./getParamAsString";
6
6
  *
7
7
  * @category location
8
8
  *
9
- * @param {string} [raw] - The _raw_ query parameter
10
- * @param {number} [fallback] - Fallback number, we return `null` if not provided
9
+ * @param raw The _raw_ query parameter
10
+ * @param fallback Fallback number, we return `null` if not provided
11
11
  */ export function getParamAsInt(raw, fallback = null) {
12
12
  const string = getParamAsString(raw);
13
13
  if (string) {
@@ -5,7 +5,7 @@
5
5
  *
6
6
  * @category location
7
7
  *
8
- * @param {string} [raw] - The _raw_ query parameter
8
+ * @param raw The _raw_ query parameter
9
9
  */
10
10
  export declare function getParamAsString(raw?: string | string[]): string;
11
11
  export default getParamAsString;
@@ -6,7 +6,7 @@ import isArray from "./isArray";
6
6
  *
7
7
  * @category location
8
8
  *
9
- * @param {string} [raw] - The _raw_ query parameter
9
+ * @param raw The _raw_ query parameter
10
10
  */ export function getParamAsString(raw) {
11
11
  return (isArray(raw) ? raw[0] : raw) || "";
12
12
  }
package/getType.d.ts CHANGED
@@ -14,9 +14,6 @@ export type PlainObject = Record<string | number | symbol, any>;
14
14
  export type TypeGuard<A, B extends A> = (payload: A) => payload is B;
15
15
  /**
16
16
  * Returns the object type of the given payload
17
- *
18
- * @param {*} payload
19
- * @returns {string}
20
17
  */
21
18
  export declare function getType(payload: any): string;
22
19
  export default getType;
package/getType.mjs CHANGED
@@ -8,9 +8,6 @@
8
8
  * - `isFloat`
9
9
  */ /**
10
10
  * Returns the object type of the given payload
11
- *
12
- * @param {*} payload
13
- * @returns {string}
14
11
  */ export function getType(payload) {
15
12
  return Object.prototype.toString.call(payload).slice(8, -1);
16
13
  }
@@ -4,10 +4,9 @@ import { type AnyQueryParams } from "./location";
4
4
  *
5
5
  * @category location
6
6
  * @param url A URL which contains a `?`, e.g. `?myparam=x` or `https://a.com?myparams=x`.
7
- * If not provided it defaults reading the current URL query string with
8
- * `location.search`. Through this argument you can use this
9
- * same function to parse, for instance, the query params of
10
- * the `href` of a `<a href="...">` HTML tag.
7
+ * If not provided it defaults reading the current URL query string with
8
+ * `location.search`. Through this argument you can use this same function to
9
+ * parse, for instance, the query params of the `href` of a `<a href="...">` HTML tag.
11
10
  *
12
11
  */
13
12
  export declare function getUrlQueryParams<T extends NonNullable<AnyQueryParams>>(url?: string): T;
@@ -4,10 +4,9 @@ import isBrowser from "./isBrowser";
4
4
  *
5
5
  * @category location
6
6
  * @param url A URL which contains a `?`, e.g. `?myparam=x` or `https://a.com?myparams=x`.
7
- * If not provided it defaults reading the current URL query string with
8
- * `location.search`. Through this argument you can use this
9
- * same function to parse, for instance, the query params of
10
- * the `href` of a `<a href="...">` HTML tag.
7
+ * If not provided it defaults reading the current URL query string with
8
+ * `location.search`. Through this argument you can use this same function to
9
+ * parse, for instance, the query params of the `href` of a `<a href="...">` HTML tag.
11
10
  *
12
11
  */ export function getUrlQueryParams(url) {
13
12
  let params = {};