@koine/utils 1.0.71 → 1.0.74

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.
@@ -8,5 +8,5 @@ import { type AnyQueryParams } from "./location";
8
8
  *
9
9
  * @category location
10
10
  */
11
- export declare function buildUrlQueryString(params?: AnyQueryParams): string;
11
+ export declare function buildUrlQueryString<T extends AnyQueryParams>(params: T): string;
12
12
  export default buildUrlQueryString;
@@ -11,8 +11,9 @@ import isArray from "./isArray";
11
11
  * @category location
12
12
  */
13
13
  export function buildUrlQueryString(params) {
14
- if (params === void 0) { params = {}; }
15
14
  var output = "";
15
+ if (!params)
16
+ return output;
16
17
  for (var key in params) {
17
18
  var value = params[key];
18
19
  if (isArray(value)) {
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Capitalize first letter of the given string.
3
+ *
4
+ * @category text
5
+ * @see https://stackoverflow.com/a/11409944/1938970
6
+ */
7
+ export declare function capitalize<T extends string>(text?: null | T): "" | Capitalize<T>;
8
+ export default capitalize;
package/capitalize.js ADDED
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Capitalize first letter of the given string.
3
+ *
4
+ * @category text
5
+ * @see https://stackoverflow.com/a/11409944/1938970
6
+ */
7
+ export function capitalize(text) {
8
+ return text
9
+ ? (text.charAt(0).toUpperCase() + text.slice(1))
10
+ : "";
11
+ }
12
+ export default capitalize;
@@ -1,11 +1,51 @@
1
1
  export declare type CreateStorageConfig = Record<string, any>;
2
+ /**
3
+ * Utility to create a storage instance to interact with `localStorage` using
4
+ * encrypted (encoded) key/values.
5
+ */
2
6
  export declare const createStorage: <T extends CreateStorageConfig>(config: Partial<T>) => {
7
+ /**
8
+ * Get all storage value (it uses `localStorage.get()`).
9
+ *
10
+ * Unparseable values with `JSON.parse()` return their value as it is.
11
+ * If the given `key` argument is not found `null` is returned.
12
+ */
3
13
  get<TKey extends keyof T>(key: TKey): T[TKey] | null;
14
+ /**
15
+ * Get all storage values (it uses `localStorage.get()`).
16
+ *
17
+ * `undefined` and `null` values are not returned.
18
+ */
19
+ getAll(): T;
20
+ /**
21
+ * Set a storage value (it uses `localStorage.set()`).
22
+ *
23
+ * Non-string values are stringified with `JSON.stringify()`
24
+ */
4
25
  set<TKey_1 extends keyof T>(key: TKey_1, value: T[TKey_1]): void;
26
+ /**
27
+ * Set all given storage values (it uses `localStorage.set()`).
28
+ *
29
+ * Non-string values are stringified with `JSON.stringify()`, `undefined`
30
+ * and `null` values are removed from the storage
31
+ */
32
+ setMany(newValues: Partial<T>): void;
33
+ /**
34
+ * Check if a storage value is _truthy_ (it uses `localStorage.get()`).
35
+ */
5
36
  has<TKey_2 extends keyof T>(key: TKey_2): boolean;
37
+ /**
38
+ * Remove a storage value (it uses `localStorage.remove()`).
39
+ */
6
40
  remove<TKey_3 extends keyof T>(key: TKey_3): void;
41
+ /**
42
+ * Clear all storage values (it uses `localStorage.remove()`).
43
+ */
7
44
  clear(): void;
8
45
  /**
46
+ * Watch a storage value changes, this needs to be executed only in browser
47
+ * context (it uses `window.addEventListener("storage")`).
48
+ *
9
49
  * Inspiration from [Multi Tab Logout in React — Redux](https://medium.com/front-end-weekly/multi-tab-logout-in-react-redux-4715f071c7fa)
10
50
  */
11
51
  watch: <TKey_4 extends keyof T>(keyToWatch: TKey_4, onRemoved?: () => void, onAdded?: () => void) => () => void;
package/createStorage.js CHANGED
@@ -1,8 +1,13 @@
1
1
  import { __assign } from "tslib";
2
2
  import { decode } from "./decode";
3
3
  import { encode } from "./encode";
4
- import isBrowser from "./isBrowser";
4
+ import { isBrowser } from "./isBrowser";
5
+ import { isNullOrUndefined } from "./isNullOrUndefined";
5
6
  import { isString } from "./isString";
7
+ /**
8
+ * Utility to create a storage instance to interact with `localStorage` using
9
+ * encrypted (encoded) key/values.
10
+ */
6
11
  export var createStorage = function (config) {
7
12
  var methodsMap = { g: "getItem", s: "setItem", r: "removeItem" };
8
13
  /**
@@ -22,6 +27,12 @@ export var createStorage = function (config) {
22
27
  return (__assign(__assign({}, map), (_a = {}, _a[key] = encode(key), _a)));
23
28
  }, {});
24
29
  return {
30
+ /**
31
+ * Get all storage value (it uses `localStorage.get()`).
32
+ *
33
+ * Unparseable values with `JSON.parse()` return their value as it is.
34
+ * If the given `key` argument is not found `null` is returned.
35
+ */
25
36
  get: function (key) {
26
37
  var stored = ls("g", keys[key]);
27
38
  if (stored) {
@@ -35,22 +46,71 @@ export var createStorage = function (config) {
35
46
  }
36
47
  return null;
37
48
  },
49
+ /**
50
+ * Get all storage values (it uses `localStorage.get()`).
51
+ *
52
+ * `undefined` and `null` values are not returned.
53
+ */
54
+ getAll: function () {
55
+ var all = {};
56
+ for (var key in keys) {
57
+ var value = this.get(key);
58
+ if (!isNullOrUndefined(value)) {
59
+ all[key] = value;
60
+ }
61
+ }
62
+ return all;
63
+ },
64
+ /**
65
+ * Set a storage value (it uses `localStorage.set()`).
66
+ *
67
+ * Non-string values are stringified with `JSON.stringify()`
68
+ */
38
69
  set: function (key, value) {
39
70
  ls("s", keys[key], isString(value) ? encode(value) : encode(JSON.stringify(value)));
40
71
  },
72
+ /**
73
+ * Set all given storage values (it uses `localStorage.set()`).
74
+ *
75
+ * Non-string values are stringified with `JSON.stringify()`, `undefined`
76
+ * and `null` values are removed from the storage
77
+ */
78
+ setMany: function (newValues) {
79
+ for (var key in newValues) {
80
+ var value = newValues[key];
81
+ if (!isNullOrUndefined(value)) {
82
+ this.set(key, value);
83
+ }
84
+ else {
85
+ this.remove(key);
86
+ }
87
+ }
88
+ },
89
+ /**
90
+ * Check if a storage value is _truthy_ (it uses `localStorage.get()`).
91
+ */
41
92
  has: function (key) {
42
93
  var stored = ls("g", keys[key]);
43
94
  return !!stored;
44
95
  },
96
+ /**
97
+ * Remove a storage value (it uses `localStorage.remove()`).
98
+ */
45
99
  remove: function (key) {
46
100
  ls("r", keys[key]);
47
101
  },
102
+ /**
103
+ * Clear all storage values (it uses `localStorage.remove()`).
104
+ */
48
105
  clear: function () {
49
106
  for (var key in keys) {
50
107
  ls("r", keys[key]);
51
108
  }
52
109
  },
53
110
  /**
111
+ * Watch a storage value changes, this needs to be executed only in browser
112
+ * context (it uses `window.addEventListener("storage")`).
113
+ *
54
114
  * Inspiration from [Multi Tab Logout in React — Redux](https://medium.com/front-end-weekly/multi-tab-logout-in-react-redux-4715f071c7fa)
55
115
  */
56
116
  watch: function (keyToWatch, onRemoved, onAdded) {
@@ -65,6 +125,8 @@ export var createStorage = function (config) {
65
125
  }
66
126
  }
67
127
  };
128
+ if (!isBrowser)
129
+ return function () { return void 0; };
68
130
  window.addEventListener("storage", handler);
69
131
  return function () {
70
132
  window.removeEventListener("storage", handler);
@@ -0,0 +1,9 @@
1
+ /**
2
+ *
3
+ * Returns an array of undefined values of the desired length, useful to build
4
+ * skeleton UIs.
5
+ *
6
+ * @category array
7
+ */
8
+ export declare function getEmptyArray(length: number | string): undefined[];
9
+ export default getEmptyArray;
@@ -0,0 +1,15 @@
1
+ import isNumber from "./isNumber";
2
+ /**
3
+ *
4
+ * Returns an array of undefined values of the desired length, useful to build
5
+ * skeleton UIs.
6
+ *
7
+ * @category array
8
+ */
9
+ export function getEmptyArray /* <T extends undefined | null = undefined> */(length) {
10
+ if (!isNumber(length)) {
11
+ length = parseInt(length, 10);
12
+ }
13
+ return Array.from({ length: length });
14
+ }
15
+ export default getEmptyArray;
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Get query parameter as `string` treating the `ParsedUrlQuery` result of
3
+ * [`querystring`](https://nodejs.org/api/querystring.html) (used in next.js
4
+ * router and elsewhere)
5
+ *
6
+ * @category location
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
10
+ */
11
+ export declare function getParamAmong<T extends string[]>(raw?: string | string[], allowedValues?: T): T[number] | null;
12
+ export default getParamAmong;
@@ -0,0 +1,17 @@
1
+ import getParamAsString from "./getParamAsString";
2
+ /**
3
+ * Get query parameter as `string` treating the `ParsedUrlQuery` result of
4
+ * [`querystring`](https://nodejs.org/api/querystring.html) (used in next.js
5
+ * router and elsewhere)
6
+ *
7
+ * @category location
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
11
+ */
12
+ export function getParamAmong(raw, allowedValues) {
13
+ if (allowedValues === void 0) { allowedValues = []; }
14
+ var string = getParamAsString(raw);
15
+ return allowedValues.includes(string) ? string : null;
16
+ }
17
+ export default getParamAmong;
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Get query parameter as `int`eger treating the `ParsedUrlQuery` result of
3
+ * [`querystring`](https://nodejs.org/api/querystring.html) (used in next.js
4
+ * router and elsewhere)
5
+ *
6
+ * @category location
7
+ *
8
+ * @param {string} [raw] - The _raw_ query parameter
9
+ * @param {number} [fallback=1] - Fallback value, `1` by default
10
+ */
11
+ export declare function getParamAsInt(raw?: string | string[], fallback?: number): number;
12
+ export default getParamAsInt;
@@ -0,0 +1,16 @@
1
+ import getParamAsString from "./getParamAsString";
2
+ /**
3
+ * Get query parameter as `int`eger treating the `ParsedUrlQuery` result of
4
+ * [`querystring`](https://nodejs.org/api/querystring.html) (used in next.js
5
+ * router and elsewhere)
6
+ *
7
+ * @category location
8
+ *
9
+ * @param {string} [raw] - The _raw_ query parameter
10
+ * @param {number} [fallback=1] - Fallback value, `1` by default
11
+ */
12
+ export function getParamAsInt(raw, fallback) {
13
+ if (fallback === void 0) { fallback = 1; }
14
+ return parseInt(getParamAsString(raw) || String(fallback), 10);
15
+ }
16
+ export default getParamAsInt;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Get query parameter as `string` treating the `ParsedUrlQuery` result of
3
+ * [`querystring`](https://nodejs.org/api/querystring.html) (used in next.js
4
+ * router and elsewhere)
5
+ *
6
+ * @category location
7
+ *
8
+ * @param {string} [raw] - The _raw_ query parameter
9
+ */
10
+ export declare function getParamAsString(raw?: string | string[]): string;
11
+ export default getParamAsString;
@@ -0,0 +1,14 @@
1
+ import isArray from "./isArray";
2
+ /**
3
+ * Get query parameter as `string` treating the `ParsedUrlQuery` result of
4
+ * [`querystring`](https://nodejs.org/api/querystring.html) (used in next.js
5
+ * router and elsewhere)
6
+ *
7
+ * @category location
8
+ *
9
+ * @param {string} [raw] - The _raw_ query parameter
10
+ */
11
+ export function getParamAsString(raw) {
12
+ return (isArray(raw) ? raw[0] : raw) || "";
13
+ }
14
+ export default getParamAsString;
package/index.d.ts CHANGED
@@ -2,6 +2,7 @@ export * from "./accentSets";
2
2
  export * from "./addOrReplaceAtIdx";
3
3
  export * from "./arrayToLookup";
4
4
  export * from "./buildUrlQueryString";
5
+ export * from "./capitalize";
5
6
  export * from "./changeUrlPath";
6
7
  export * from "./chunkByChunks";
7
8
  export * from "./chunkBySize";
@@ -16,8 +17,12 @@ export * from "./Emitter";
16
17
  export * from "./encode";
17
18
  export * from "./ensureInt";
18
19
  export * from "./findDuplicatedIndexes";
20
+ export * from "./getEmptyArray";
19
21
  export * from "./getKeys";
20
22
  export * from "./getNonce";
23
+ export * from "./getParamAmong";
24
+ export * from "./getParamAsInt";
25
+ export * from "./getParamAsString";
21
26
  export * from "./getType";
22
27
  export * from "./getUrlHashParams";
23
28
  export * from "./getUrlHashPathname";
package/index.js CHANGED
@@ -2,6 +2,7 @@ export * from "./accentSets";
2
2
  export * from "./addOrReplaceAtIdx";
3
3
  export * from "./arrayToLookup";
4
4
  export * from "./buildUrlQueryString";
5
+ export * from "./capitalize";
5
6
  export * from "./changeUrlPath";
6
7
  export * from "./chunkByChunks";
7
8
  export * from "./chunkBySize";
@@ -17,8 +18,12 @@ export * from "./encode";
17
18
  export * from "./ensureInt";
18
19
  // export * from "./env"
19
20
  export * from "./findDuplicatedIndexes";
21
+ export * from "./getEmptyArray";
20
22
  export * from "./getKeys";
21
23
  export * from "./getNonce";
24
+ export * from "./getParamAmong";
25
+ export * from "./getParamAsInt";
26
+ export * from "./getParamAsString";
22
27
  export * from "./getType";
23
28
  export * from "./getUrlHashParams";
24
29
  export * from "./getUrlHashPathname";
@@ -92,6 +97,7 @@ export * from "./readCookie";
92
97
  export * from "./redirectTo";
93
98
  export * from "./removeAccents";
94
99
  export * from "./removeCookie";
100
+ // export * from "./removeDuplicates";
95
101
  export * from "./removeDuplicatesByKey";
96
102
  export * from "./removeDuplicatesComparing";
97
103
  export * from "./removeIndexesFromArray";
@@ -14,8 +14,9 @@ var isArray_1 = require("./isArray");
14
14
  * @category location
15
15
  */
16
16
  function buildUrlQueryString(params) {
17
- if (params === void 0) { params = {}; }
18
17
  var output = "";
18
+ if (!params)
19
+ return output;
19
20
  for (var key in params) {
20
21
  var value = params[key];
21
22
  if ((0, isArray_1.default)(value)) {
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.capitalize = void 0;
4
+ /**
5
+ * Capitalize first letter of the given string.
6
+ *
7
+ * @category text
8
+ * @see https://stackoverflow.com/a/11409944/1938970
9
+ */
10
+ function capitalize(text) {
11
+ return text
12
+ ? (text.charAt(0).toUpperCase() + text.slice(1))
13
+ : "";
14
+ }
15
+ exports.capitalize = capitalize;
16
+ exports.default = capitalize;
@@ -5,14 +5,19 @@ var tslib_1 = require("tslib");
5
5
  var decode_1 = require("./decode");
6
6
  var encode_1 = require("./encode");
7
7
  var isBrowser_1 = require("./isBrowser");
8
+ var isNullOrUndefined_1 = require("./isNullOrUndefined");
8
9
  var isString_1 = require("./isString");
10
+ /**
11
+ * Utility to create a storage instance to interact with `localStorage` using
12
+ * encrypted (encoded) key/values.
13
+ */
9
14
  var createStorage = function (config) {
10
15
  var methodsMap = { g: "getItem", s: "setItem", r: "removeItem" };
11
16
  /**
12
17
  * Super minifiable localStorage wrapper with SSR safety
13
18
  */
14
19
  var ls = function (method, key, value) {
15
- return isBrowser_1.default
20
+ return isBrowser_1.isBrowser
16
21
  ? localStorage[methodsMap[method]](key, value)
17
22
  : function () {
18
23
  if (process.env["NODE_ENV"] !== "production") {
@@ -25,6 +30,12 @@ var createStorage = function (config) {
25
30
  return (tslib_1.__assign(tslib_1.__assign({}, map), (_a = {}, _a[key] = (0, encode_1.encode)(key), _a)));
26
31
  }, {});
27
32
  return {
33
+ /**
34
+ * Get all storage value (it uses `localStorage.get()`).
35
+ *
36
+ * Unparseable values with `JSON.parse()` return their value as it is.
37
+ * If the given `key` argument is not found `null` is returned.
38
+ */
28
39
  get: function (key) {
29
40
  var stored = ls("g", keys[key]);
30
41
  if (stored) {
@@ -38,22 +49,71 @@ var createStorage = function (config) {
38
49
  }
39
50
  return null;
40
51
  },
52
+ /**
53
+ * Get all storage values (it uses `localStorage.get()`).
54
+ *
55
+ * `undefined` and `null` values are not returned.
56
+ */
57
+ getAll: function () {
58
+ var all = {};
59
+ for (var key in keys) {
60
+ var value = this.get(key);
61
+ if (!(0, isNullOrUndefined_1.isNullOrUndefined)(value)) {
62
+ all[key] = value;
63
+ }
64
+ }
65
+ return all;
66
+ },
67
+ /**
68
+ * Set a storage value (it uses `localStorage.set()`).
69
+ *
70
+ * Non-string values are stringified with `JSON.stringify()`
71
+ */
41
72
  set: function (key, value) {
42
73
  ls("s", keys[key], (0, isString_1.isString)(value) ? (0, encode_1.encode)(value) : (0, encode_1.encode)(JSON.stringify(value)));
43
74
  },
75
+ /**
76
+ * Set all given storage values (it uses `localStorage.set()`).
77
+ *
78
+ * Non-string values are stringified with `JSON.stringify()`, `undefined`
79
+ * and `null` values are removed from the storage
80
+ */
81
+ setMany: function (newValues) {
82
+ for (var key in newValues) {
83
+ var value = newValues[key];
84
+ if (!(0, isNullOrUndefined_1.isNullOrUndefined)(value)) {
85
+ this.set(key, value);
86
+ }
87
+ else {
88
+ this.remove(key);
89
+ }
90
+ }
91
+ },
92
+ /**
93
+ * Check if a storage value is _truthy_ (it uses `localStorage.get()`).
94
+ */
44
95
  has: function (key) {
45
96
  var stored = ls("g", keys[key]);
46
97
  return !!stored;
47
98
  },
99
+ /**
100
+ * Remove a storage value (it uses `localStorage.remove()`).
101
+ */
48
102
  remove: function (key) {
49
103
  ls("r", keys[key]);
50
104
  },
105
+ /**
106
+ * Clear all storage values (it uses `localStorage.remove()`).
107
+ */
51
108
  clear: function () {
52
109
  for (var key in keys) {
53
110
  ls("r", keys[key]);
54
111
  }
55
112
  },
56
113
  /**
114
+ * Watch a storage value changes, this needs to be executed only in browser
115
+ * context (it uses `window.addEventListener("storage")`).
116
+ *
57
117
  * Inspiration from [Multi Tab Logout in React — Redux](https://medium.com/front-end-weekly/multi-tab-logout-in-react-redux-4715f071c7fa)
58
118
  */
59
119
  watch: function (keyToWatch, onRemoved, onAdded) {
@@ -68,6 +128,8 @@ var createStorage = function (config) {
68
128
  }
69
129
  }
70
130
  };
131
+ if (!isBrowser_1.isBrowser)
132
+ return function () { return void 0; };
71
133
  window.addEventListener("storage", handler);
72
134
  return function () {
73
135
  window.removeEventListener("storage", handler);
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getEmptyArray = void 0;
4
+ var isNumber_1 = require("./isNumber");
5
+ /**
6
+ *
7
+ * Returns an array of undefined values of the desired length, useful to build
8
+ * skeleton UIs.
9
+ *
10
+ * @category array
11
+ */
12
+ function getEmptyArray /* <T extends undefined | null = undefined> */(length) {
13
+ if (!(0, isNumber_1.default)(length)) {
14
+ length = parseInt(length, 10);
15
+ }
16
+ return Array.from({ length: length });
17
+ }
18
+ exports.getEmptyArray = getEmptyArray;
19
+ exports.default = getEmptyArray;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getParamAmong = void 0;
4
+ var getParamAsString_1 = require("./getParamAsString");
5
+ /**
6
+ * Get query parameter as `string` treating the `ParsedUrlQuery` result of
7
+ * [`querystring`](https://nodejs.org/api/querystring.html) (used in next.js
8
+ * router and elsewhere)
9
+ *
10
+ * @category location
11
+ *
12
+ * @param {string} [raw] - The _raw_ query parameter
13
+ * @param {string[]} [allowedValues=[]] - The list of values (as strings) that the parameter can have, if not one of them `null` is returned
14
+ */
15
+ function getParamAmong(raw, allowedValues) {
16
+ if (allowedValues === void 0) { allowedValues = []; }
17
+ var string = (0, getParamAsString_1.default)(raw);
18
+ return allowedValues.includes(string) ? string : null;
19
+ }
20
+ exports.getParamAmong = getParamAmong;
21
+ exports.default = getParamAmong;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getParamAsInt = void 0;
4
+ var getParamAsString_1 = require("./getParamAsString");
5
+ /**
6
+ * Get query parameter as `int`eger treating the `ParsedUrlQuery` result of
7
+ * [`querystring`](https://nodejs.org/api/querystring.html) (used in next.js
8
+ * router and elsewhere)
9
+ *
10
+ * @category location
11
+ *
12
+ * @param {string} [raw] - The _raw_ query parameter
13
+ * @param {number} [fallback=1] - Fallback value, `1` by default
14
+ */
15
+ function getParamAsInt(raw, fallback) {
16
+ if (fallback === void 0) { fallback = 1; }
17
+ return parseInt((0, getParamAsString_1.default)(raw) || String(fallback), 10);
18
+ }
19
+ exports.getParamAsInt = getParamAsInt;
20
+ exports.default = getParamAsInt;
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getParamAsString = void 0;
4
+ var isArray_1 = require("./isArray");
5
+ /**
6
+ * Get query parameter as `string` treating the `ParsedUrlQuery` result of
7
+ * [`querystring`](https://nodejs.org/api/querystring.html) (used in next.js
8
+ * router and elsewhere)
9
+ *
10
+ * @category location
11
+ *
12
+ * @param {string} [raw] - The _raw_ query parameter
13
+ */
14
+ function getParamAsString(raw) {
15
+ return ((0, isArray_1.default)(raw) ? raw[0] : raw) || "";
16
+ }
17
+ exports.getParamAsString = getParamAsString;
18
+ exports.default = getParamAsString;
package/node/index.js CHANGED
@@ -5,6 +5,7 @@ tslib_1.__exportStar(require("./accentSets"), exports);
5
5
  tslib_1.__exportStar(require("./addOrReplaceAtIdx"), exports);
6
6
  tslib_1.__exportStar(require("./arrayToLookup"), exports);
7
7
  tslib_1.__exportStar(require("./buildUrlQueryString"), exports);
8
+ tslib_1.__exportStar(require("./capitalize"), exports);
8
9
  tslib_1.__exportStar(require("./changeUrlPath"), exports);
9
10
  tslib_1.__exportStar(require("./chunkByChunks"), exports);
10
11
  tslib_1.__exportStar(require("./chunkBySize"), exports);
@@ -20,8 +21,12 @@ tslib_1.__exportStar(require("./encode"), exports);
20
21
  tslib_1.__exportStar(require("./ensureInt"), exports);
21
22
  // export * from "./env"
22
23
  tslib_1.__exportStar(require("./findDuplicatedIndexes"), exports);
24
+ tslib_1.__exportStar(require("./getEmptyArray"), exports);
23
25
  tslib_1.__exportStar(require("./getKeys"), exports);
24
26
  tslib_1.__exportStar(require("./getNonce"), exports);
27
+ tslib_1.__exportStar(require("./getParamAmong"), exports);
28
+ tslib_1.__exportStar(require("./getParamAsInt"), exports);
29
+ tslib_1.__exportStar(require("./getParamAsString"), exports);
25
30
  tslib_1.__exportStar(require("./getType"), exports);
26
31
  tslib_1.__exportStar(require("./getUrlHashParams"), exports);
27
32
  tslib_1.__exportStar(require("./getUrlHashPathname"), exports);
@@ -95,6 +100,7 @@ tslib_1.__exportStar(require("./readCookie"), exports);
95
100
  tslib_1.__exportStar(require("./redirectTo"), exports);
96
101
  tslib_1.__exportStar(require("./removeAccents"), exports);
97
102
  tslib_1.__exportStar(require("./removeCookie"), exports);
103
+ // export * from "./removeDuplicates";
98
104
  tslib_1.__exportStar(require("./removeDuplicatesByKey"), exports);
99
105
  tslib_1.__exportStar(require("./removeDuplicatesComparing"), exports);
100
106
  tslib_1.__exportStar(require("./removeIndexesFromArray"), exports);
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ // /**
3
+ // * FIXME: Type 'Set<any>' can only be iterated through when using the
4
+ // * '--downlevelIteration' flag or with a '--target' of 'es2015' or higher.
5
+ // * I am not sure I want to use those ts options here. Let's keep it commented
6
+ // * for now
7
+ // *
8
+ // * @category array
9
+ // */
10
+ // export function removeDuplicates<T extends any[]>(arr: T) {
11
+ // return [...new Set(arr)];
12
+ // }
13
+ // export default removeDuplicates;
package/package.json CHANGED
@@ -7,7 +7,7 @@
7
7
  "peerDependencies": {
8
8
  "tslib": "^2.4.0"
9
9
  },
10
- "version": "1.0.71",
10
+ "version": "1.0.74",
11
11
  "module": "./index.js",
12
12
  "types": "./index.d.ts"
13
13
  }
File without changes
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ // /**
3
+ // * FIXME: Type 'Set<any>' can only be iterated through when using the
4
+ // * '--downlevelIteration' flag or with a '--target' of 'es2015' or higher.
5
+ // * I am not sure I want to use those ts options here. Let's keep it commented
6
+ // * for now
7
+ // *
8
+ // * @category array
9
+ // */
10
+ // export function removeDuplicates<T extends any[]>(arr: T) {
11
+ // return [...new Set(arr)];
12
+ // }
13
+ // export default removeDuplicates;
package/typings.d.ts CHANGED
@@ -6,3 +6,7 @@
6
6
 
7
7
  // eslint-disable-next-line no-var,@typescript-eslint/no-explicit-any
8
8
  declare var gtag: (...args: any[]) => any;
9
+
10
+ // declare type NullableRecord<T> = {
11
+ // [K in keyof T]: T[K] | null;
12
+ // };