@oscarpalmer/atoms 0.137.0 → 0.139.0

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.
@@ -1823,6 +1823,167 @@ function throttle(callback, time) {
1823
1823
  return getLimiter(callback, true, time);
1824
1824
  }
1825
1825
  const DEFAULT_CACHE_SIZE = 1024;
1826
+ function equal(first, second, options) {
1827
+ return equalValue(first, second, getEqualOptions(options));
1828
+ }
1829
+ function equalArray(first, second, options) {
1830
+ const { length } = first;
1831
+ if (length !== second.length) return false;
1832
+ let offset = 0;
1833
+ if (length >= ARRAY_THRESHOLD) {
1834
+ offset = Math.round(length / ARRAY_PEEK_PERCENTAGE);
1835
+ offset = offset > ARRAY_THRESHOLD ? ARRAY_THRESHOLD : offset;
1836
+ for (let index = 0; index < offset; index += 1) if (!(equalValue(first[index], second[index], options) && equalValue(first[length - index - 1], second[length - index - 1], options))) return false;
1837
+ }
1838
+ const firstChunks = chunk(first.slice(offset, length - offset), ARRAY_THRESHOLD);
1839
+ const secondChunks = chunk(second.slice(offset, length - offset), ARRAY_THRESHOLD);
1840
+ const chunksLength = firstChunks.length;
1841
+ for (let chunkIndex = 0; chunkIndex < chunksLength; chunkIndex += 1) {
1842
+ const firstChunk = firstChunks[chunkIndex];
1843
+ const secondChunk = secondChunks[chunkIndex];
1844
+ const chunkLength = firstChunk.length;
1845
+ for (let index = 0; index < chunkLength; index += 1) if (!equalValue(firstChunk[index], secondChunk[index], options)) return false;
1846
+ }
1847
+ return true;
1848
+ }
1849
+ function equalArrayBuffer(first, second, options) {
1850
+ return first.byteLength === second.byteLength ? equalArray(new Uint8Array(first), new Uint8Array(second), options) : false;
1851
+ }
1852
+ function equalDataView(first, second, options) {
1853
+ return first.byteOffset === second.byteOffset ? equalArrayBuffer(first.buffer, second.buffer, options) : false;
1854
+ }
1855
+ function equalMap(first, second, options) {
1856
+ const { size } = first;
1857
+ if (size !== second.size) return false;
1858
+ const firstKeys = [...first.keys()];
1859
+ const secondKeys = [...second.keys()];
1860
+ if (firstKeys.some((key) => !secondKeys.includes(key))) return false;
1861
+ for (let index = 0; index < size; index += 1) {
1862
+ const key = firstKeys[index];
1863
+ if (!equalValue(first.get(key), second.get(key), options)) return false;
1864
+ }
1865
+ return true;
1866
+ }
1867
+ function equalPlainObject(first, second, options) {
1868
+ let firstKeys = [...Object.keys(first), ...Object.getOwnPropertySymbols(first)];
1869
+ let secondKeys = [...Object.keys(second), ...Object.getOwnPropertySymbols(second)];
1870
+ if (options.ignoreKeys.enabled || options.ignoreExpressions.enabled) {
1871
+ firstKeys = firstKeys.filter((key) => filterKey(key, options));
1872
+ secondKeys = secondKeys.filter((key) => filterKey(key, options));
1873
+ }
1874
+ const { length } = firstKeys;
1875
+ if (length !== secondKeys.length || firstKeys.some((key) => !secondKeys.includes(key))) return false;
1876
+ for (let index = 0; index < length; index += 1) {
1877
+ const key = firstKeys[index];
1878
+ if (!equalValue(first[key], second[key], options)) return false;
1879
+ }
1880
+ return true;
1881
+ }
1882
+ function equalProperties(first, second, properties, options) {
1883
+ const { length } = properties;
1884
+ for (let index = 0; index < length; index += 1) {
1885
+ const property = properties[index];
1886
+ if (!equalValue(first[property], second[property], options)) return false;
1887
+ }
1888
+ return true;
1889
+ }
1890
+ function equalSet(first, second, options) {
1891
+ const { size } = first;
1892
+ if (size !== second.size) return false;
1893
+ const firstValues = [...first];
1894
+ const secondValues = [...second];
1895
+ for (let index = 0; index < size; index += 1) {
1896
+ const firstValue = firstValues[index];
1897
+ if (!secondValues.some((secondValue) => equalValue(firstValue, secondValue, options))) return false;
1898
+ }
1899
+ return true;
1900
+ }
1901
+ function equalTypedArray(first, second) {
1902
+ if (first.constructor !== second.constructor) return false;
1903
+ if (first.byteLength !== second.byteLength) return false;
1904
+ const { length } = first;
1905
+ for (let index = 0; index < length; index += 1) if (first[index] !== second[index]) return false;
1906
+ return true;
1907
+ }
1908
+ function equalValue(first, second, options) {
1909
+ if (options.relaxedNullish && first == null && second == null) return true;
1910
+ switch (true) {
1911
+ case Object.is(first, second): return true;
1912
+ case first == null || second == null: return first === second;
1913
+ case typeof first !== typeof second: return false;
1914
+ case typeof first === "string" && options.ignoreCase === true: return Object.is(first.toLocaleLowerCase(), second.toLocaleLowerCase());
1915
+ case first instanceof ArrayBuffer && second instanceof ArrayBuffer: return equalArrayBuffer(first, second, options);
1916
+ case first instanceof Date && second instanceof Date: return Object.is(Number(first), Number(second));
1917
+ case first instanceof DataView && second instanceof DataView: return equalDataView(first, second, options);
1918
+ case first instanceof Error && second instanceof Error: return equalProperties(first, second, ["name", "message"], options);
1919
+ case first instanceof Map && second instanceof Map: return equalMap(first, second, options);
1920
+ case first instanceof RegExp && second instanceof RegExp: return equalProperties(first, second, ["source", "flags"], options);
1921
+ case first instanceof Set && second instanceof Set: return equalSet(first, second, options);
1922
+ case Array.isArray(first) && Array.isArray(second): return equalArray(first, second, options);
1923
+ case isPlainObject(first) && isPlainObject(second): return equalPlainObject(first, second, options);
1924
+ case isTypedArray(first) && isTypedArray(second): return equalTypedArray(first, second);
1925
+ default: return equalHandlers.handle(first, second, options);
1926
+ }
1927
+ }
1928
+ /**
1929
+ * Create an equalizer with predefined options
1930
+ * @param options Comparison options
1931
+ * @returns Equalizer function
1932
+ */
1933
+ function initializeEqualizer(options) {
1934
+ const actual = getEqualOptions(options);
1935
+ return (first, second) => equalValue(first, second, actual);
1936
+ }
1937
+ /**
1938
+ * Register a equality comparison function for a specific class
1939
+ * @param constructor Class constructor
1940
+ * @param fn Comparison function
1941
+ */
1942
+ function registerEqualizer(constructor, fn) {
1943
+ equalHandlers.register(constructor, fn);
1944
+ }
1945
+ /**
1946
+ * Unregister a equality comparison handler for a specific class
1947
+ * @param constructor Class constructor
1948
+ */
1949
+ function unregisterEqualizer(constructor) {
1950
+ equalHandlers.unregister(constructor);
1951
+ }
1952
+ function filterKey(key, options) {
1953
+ if (typeof key !== "string") return true;
1954
+ if (options.ignoreExpressions.enabled && options.ignoreExpressions.values.some((expression) => expression.test(key))) return false;
1955
+ if (options.ignoreKeys.enabled && options.ignoreKeys.values.has(key)) return false;
1956
+ return true;
1957
+ }
1958
+ function getEqualOptions(input) {
1959
+ const options = {
1960
+ ignoreCase: false,
1961
+ ignoreExpressions: {
1962
+ enabled: false,
1963
+ values: []
1964
+ },
1965
+ ignoreKeys: {
1966
+ enabled: false,
1967
+ values: /* @__PURE__ */ new Set()
1968
+ },
1969
+ relaxedNullish: false
1970
+ };
1971
+ if (typeof input === "boolean") {
1972
+ options.ignoreCase = input;
1973
+ return options;
1974
+ }
1975
+ if (!isPlainObject(input)) return options;
1976
+ options.ignoreCase = typeof input.ignoreCase === "boolean" ? input.ignoreCase : false;
1977
+ options.ignoreExpressions.values = (Array.isArray(input.ignoreKeys) ? input.ignoreKeys : [input.ignoreKeys]).filter((key) => key instanceof RegExp);
1978
+ options.ignoreKeys.values = new Set((Array.isArray(input.ignoreKeys) ? input.ignoreKeys : [input.ignoreKeys]).filter((key) => typeof key === "string"));
1979
+ options.ignoreExpressions.enabled = options.ignoreExpressions.values.length > 0;
1980
+ options.ignoreKeys.enabled = options.ignoreKeys.values.size > 0;
1981
+ options.relaxedNullish = input.relaxedNullish === true;
1982
+ return options;
1983
+ }
1984
+ const equalHandlers = getCompareHandlers(equal, { callback: Object.is });
1985
+ const ARRAY_PEEK_PERCENTAGE = 10;
1986
+ const ARRAY_THRESHOLD = 100;
1826
1987
  var Logger = class {
1827
1988
  /**
1828
1989
  * Log any number of values at the "debug" log level
@@ -2118,45 +2279,160 @@ const MESSAGE_EXPECTATION = "Timed function expected a Promise";
2118
2279
  const MESSAGE_TIMEOUT = "Promise timed out";
2119
2280
  const TYPE_FULFILLED = "fulfilled";
2120
2281
  const TYPE_REJECTED = "rejected";
2121
- var Queue = class {
2122
- #callback;
2123
- #handled = [];
2124
- #id = 0;
2125
- #items = [];
2126
- #options;
2127
- #paused;
2128
- #runners = 0;
2129
- /**
2130
- * Is the queue active?
2131
- */
2132
- get active() {
2133
- return this.#runners > 0;
2134
- }
2135
- /**
2136
- * Does the queue automatically start when the first item is added?
2137
- */
2138
- get autostart() {
2139
- return this.#options.autostart;
2282
+ function findKey(needle, haystack) {
2283
+ const keys = Object.keys(haystack);
2284
+ const index = keys.map((key) => key.toLowerCase()).indexOf(needle.toLowerCase());
2285
+ return index > -1 ? keys[index] : needle;
2286
+ }
2287
+ function getPaths(path, lowercase) {
2288
+ const normalized = lowercase ? path.toLowerCase() : path;
2289
+ if (!EXPRESSION_NESTED.test(normalized)) return normalized;
2290
+ return normalized.replace(EXPRESSION_BRACKET, ".$1").replace(EXPRESSION_DOTS, "").split(".");
2291
+ }
2292
+ function handleValue(data, path, value, get, ignoreCase) {
2293
+ if (typeof data === "object" && data !== null && !ignoreKey(path)) {
2294
+ const key = ignoreCase ? findKey(path, data) : path;
2295
+ if (get) return data[key];
2296
+ data[key] = typeof value === "function" ? value(data[key]) : value;
2140
2297
  }
2141
- /**
2142
- * Maximum number of runners to process the queue concurrently
2143
- */
2144
- get concurrency() {
2145
- return this.#options.concurrency;
2298
+ }
2299
+ const EXPRESSION_BRACKET = /\[(\w+)\]/g;
2300
+ const EXPRESSION_DOTS = /^\.|\.$/g;
2301
+ const EXPRESSION_NESTED = /\.|\[\w+\]/;
2302
+ function setValue(data, path, value, ignoreCase) {
2303
+ if (typeof data !== "object" || data === null || typeof path !== "string" || path.trim().length === 0) return data;
2304
+ const shouldIgnoreCase = ignoreCase === true;
2305
+ const paths = getPaths(path, shouldIgnoreCase);
2306
+ if (typeof paths === "string") {
2307
+ handleValue(data, paths, value, false, shouldIgnoreCase);
2308
+ return data;
2146
2309
  }
2147
- /**
2148
- * Is the queue empty?
2149
- */
2150
- get empty() {
2151
- return this.#items.length === 0;
2310
+ const { length } = paths;
2311
+ const lastIndex = length - 1;
2312
+ let target = data;
2313
+ for (let index = 0; index < length; index += 1) {
2314
+ const currentPath = paths[index];
2315
+ if (index === lastIndex) {
2316
+ handleValue(target, currentPath, value, false, shouldIgnoreCase);
2317
+ break;
2318
+ }
2319
+ let next = handleValue(target, currentPath, null, true, shouldIgnoreCase);
2320
+ if (typeof next !== "object" || next === null) {
2321
+ const nextPath = paths[index + 1];
2322
+ if (EXPRESSION_INDEX.test(nextPath)) next = Array.from({ length: Number.parseInt(nextPath, 10) + 1 }, () => void 0);
2323
+ else next = {};
2324
+ target[currentPath] = next;
2325
+ }
2326
+ target = next;
2152
2327
  }
2153
- /**
2154
- * Is the queue full?
2155
- */
2156
- get full() {
2157
- return this.#options.maximum > 0 && this.#items.length >= this.#options.maximum;
2328
+ return data;
2329
+ }
2330
+ const EXPRESSION_INDEX = /^\d+$/;
2331
+ /**
2332
+ * Convert a query string to a plain _(nested)_ object
2333
+ * @param query Query string to convert
2334
+ * @returns Plain object representation of the query string
2335
+ */
2336
+ function fromQuery(query) {
2337
+ if (typeof query !== "string" || query.trim().length === 0) return {};
2338
+ const parts = query.split("&");
2339
+ const { length } = parts;
2340
+ const parameters = {};
2341
+ for (let index = 0; index < length; index += 1) {
2342
+ const decoded = parts[index].split("=").map(tryDecode);
2343
+ const key = decoded[0].replace(EXPRESSION_ARRAY_SUFFIX, "");
2344
+ if (!ignoreKey(key)) setQueryValue(parameters, key, decoded[1]);
2158
2345
  }
2159
- /**
2346
+ return parameters;
2347
+ }
2348
+ function getParts(value, fromArray, prefix) {
2349
+ const keys = Object.keys(value);
2350
+ const { length } = keys;
2351
+ const parts = [];
2352
+ for (let index = 0; index < length; index += 1) {
2353
+ const key = keys[index];
2354
+ const val = value[key];
2355
+ const full = join([prefix, fromArray ? void 0 : key], ".");
2356
+ if (Array.isArray(val)) parts.push(...getParts(val, true, full));
2357
+ else if (isPlainObject(val)) parts.push(...getParts(val, false, full));
2358
+ else if (isDecodable(val)) parts.push(`${tryEncode(full)}=${tryEncode(val)}`);
2359
+ else if (val instanceof Date) parts.push(`${tryEncode(full)}=${val.toJSON()}`);
2360
+ }
2361
+ return parts;
2362
+ }
2363
+ function getQueryValue(value) {
2364
+ if (EXPRESSION_BOOLEAN.test(value)) return value === "true";
2365
+ const asNumber = getNumber(value);
2366
+ if (!Number.isNaN(asNumber)) return asNumber;
2367
+ const parsed = Date.parse(value);
2368
+ if (Number.isNaN(parsed)) return value;
2369
+ const date = new Date(parsed);
2370
+ return date.toJSON() === value ? date : value;
2371
+ }
2372
+ function isDecodable(value) {
2373
+ return TYPES.has(typeof value);
2374
+ }
2375
+ function setQueryValue(parameters, key, value) {
2376
+ if (key.includes(".")) setValue(parameters, key, getQueryValue(value));
2377
+ else if (key in parameters) {
2378
+ if (!Array.isArray(parameters[key])) parameters[key] = [parameters[key]];
2379
+ parameters[key].push(getQueryValue(value));
2380
+ } else parameters[key] = getQueryValue(value);
2381
+ }
2382
+ /**
2383
+ * Convert a plain _(nested)_ object to a query string
2384
+ * @param parameters Plain object to convert
2385
+ * @returns Query string representation of the object
2386
+ */
2387
+ function toQuery(parameters) {
2388
+ return isPlainObject(parameters) ? join(getParts(parameters, false).filter((part) => part.length > 0), "&") : "";
2389
+ }
2390
+ const EXPRESSION_ARRAY_SUFFIX = /\[\]$/;
2391
+ const EXPRESSION_BOOLEAN = /^(false|true)$/;
2392
+ const TYPES = new Set([
2393
+ "boolean",
2394
+ "number",
2395
+ "string"
2396
+ ]);
2397
+ var Queue = class {
2398
+ #callback;
2399
+ #handled = [];
2400
+ #id = 0;
2401
+ #items = [];
2402
+ #options;
2403
+ #paused;
2404
+ #runners = 0;
2405
+ /**
2406
+ * Is the queue active?
2407
+ */
2408
+ get active() {
2409
+ return this.#runners > 0;
2410
+ }
2411
+ /**
2412
+ * Does the queue automatically start when the first item is added?
2413
+ */
2414
+ get autostart() {
2415
+ return this.#options.autostart;
2416
+ }
2417
+ /**
2418
+ * Maximum number of runners to process the queue concurrently
2419
+ */
2420
+ get concurrency() {
2421
+ return this.#options.concurrency;
2422
+ }
2423
+ /**
2424
+ * Is the queue empty?
2425
+ */
2426
+ get empty() {
2427
+ return this.#items.length === 0;
2428
+ }
2429
+ /**
2430
+ * Is the queue full?
2431
+ */
2432
+ get full() {
2433
+ return this.#options.maximum > 0 && this.#items.length >= this.#options.maximum;
2434
+ }
2435
+ /**
2160
2436
  * Maximum number of items allowed in the queue
2161
2437
  */
2162
2438
  get maximum() {
@@ -2325,121 +2601,6 @@ const MESSAGE_CALLBACK = "A Queue requires a callback function";
2325
2601
  const MESSAGE_CLEAR = "Queue was cleared";
2326
2602
  const MESSAGE_MAXIMUM = "Queue has reached its maximum size";
2327
2603
  const MESSAGE_REMOVE = "Item removed from queue";
2328
- function findKey(needle, haystack) {
2329
- const keys = Object.keys(haystack);
2330
- const index = keys.map((key) => key.toLowerCase()).indexOf(needle.toLowerCase());
2331
- return index > -1 ? keys[index] : needle;
2332
- }
2333
- function getPaths(path, lowercase) {
2334
- const normalized = lowercase ? path.toLowerCase() : path;
2335
- if (!EXPRESSION_NESTED.test(normalized)) return normalized;
2336
- return normalized.replace(EXPRESSION_BRACKET, ".$1").replace(EXPRESSION_DOTS, "").split(".");
2337
- }
2338
- function handleValue(data, path, value, get, ignoreCase) {
2339
- if (typeof data === "object" && data !== null && !ignoreKey(path)) {
2340
- const key = ignoreCase ? findKey(path, data) : path;
2341
- if (get) return data[key];
2342
- data[key] = typeof value === "function" ? value(data[key]) : value;
2343
- }
2344
- }
2345
- const EXPRESSION_BRACKET = /\[(\w+)\]/g;
2346
- const EXPRESSION_DOTS = /^\.|\.$/g;
2347
- const EXPRESSION_NESTED = /\.|\[\w+\]/;
2348
- function setValue(data, path, value, ignoreCase) {
2349
- if (typeof data !== "object" || data === null || typeof path !== "string" || path.trim().length === 0) return data;
2350
- const shouldIgnoreCase = ignoreCase === true;
2351
- const paths = getPaths(path, shouldIgnoreCase);
2352
- if (typeof paths === "string") {
2353
- handleValue(data, paths, value, false, shouldIgnoreCase);
2354
- return data;
2355
- }
2356
- const { length } = paths;
2357
- const lastIndex = length - 1;
2358
- let target = data;
2359
- for (let index = 0; index < length; index += 1) {
2360
- const currentPath = paths[index];
2361
- if (index === lastIndex) {
2362
- handleValue(target, currentPath, value, false, shouldIgnoreCase);
2363
- break;
2364
- }
2365
- let next = handleValue(target, currentPath, null, true, shouldIgnoreCase);
2366
- if (typeof next !== "object" || next === null) {
2367
- const nextPath = paths[index + 1];
2368
- if (EXPRESSION_INDEX.test(nextPath)) next = Array.from({ length: Number.parseInt(nextPath, 10) + 1 }, () => void 0);
2369
- else next = {};
2370
- target[currentPath] = next;
2371
- }
2372
- target = next;
2373
- }
2374
- return data;
2375
- }
2376
- const EXPRESSION_INDEX = /^\d+$/;
2377
- /**
2378
- * Convert a query string to a plain _(nested)_ object
2379
- * @param query Query string to convert
2380
- * @returns Plain object representation of the query string
2381
- */
2382
- function fromQuery(query) {
2383
- if (typeof query !== "string" || query.trim().length === 0) return {};
2384
- const parts = query.split("&");
2385
- const { length } = parts;
2386
- const parameters = {};
2387
- for (let index = 0; index < length; index += 1) {
2388
- const decoded = parts[index].split("=").map(tryDecode);
2389
- const key = decoded[0].replace(EXPRESSION_ARRAY_SUFFIX, "");
2390
- if (!ignoreKey(key)) setQueryValue(parameters, key, decoded[1]);
2391
- }
2392
- return parameters;
2393
- }
2394
- function getParts(value, fromArray, prefix) {
2395
- const keys = Object.keys(value);
2396
- const { length } = keys;
2397
- const parts = [];
2398
- for (let index = 0; index < length; index += 1) {
2399
- const key = keys[index];
2400
- const val = value[key];
2401
- const full = join([prefix, fromArray ? void 0 : key], ".");
2402
- if (Array.isArray(val)) parts.push(...getParts(val, true, full));
2403
- else if (isPlainObject(val)) parts.push(...getParts(val, false, full));
2404
- else if (isDecodable(val)) parts.push(`${tryEncode(full)}=${tryEncode(val)}`);
2405
- else if (val instanceof Date) parts.push(`${tryEncode(full)}=${val.toJSON()}`);
2406
- }
2407
- return parts;
2408
- }
2409
- function getQueryValue(value) {
2410
- if (EXPRESSION_BOOLEAN.test(value)) return value === "true";
2411
- const asNumber = getNumber(value);
2412
- if (!Number.isNaN(asNumber)) return asNumber;
2413
- const parsed = Date.parse(value);
2414
- if (Number.isNaN(parsed)) return value;
2415
- const date = new Date(parsed);
2416
- return date.toJSON() === value ? date : value;
2417
- }
2418
- function isDecodable(value) {
2419
- return TYPES.has(typeof value);
2420
- }
2421
- function setQueryValue(parameters, key, value) {
2422
- if (key.includes(".")) setValue(parameters, key, getQueryValue(value));
2423
- else if (key in parameters) {
2424
- if (!Array.isArray(parameters[key])) parameters[key] = [parameters[key]];
2425
- parameters[key].push(getQueryValue(value));
2426
- } else parameters[key] = getQueryValue(value);
2427
- }
2428
- /**
2429
- * Convert a plain _(nested)_ object to a query string
2430
- * @param parameters Plain object to convert
2431
- * @returns Query string representation of the object
2432
- */
2433
- function toQuery(parameters) {
2434
- return isPlainObject(parameters) ? join(getParts(parameters, false).filter((part) => part.length > 0), "&") : "";
2435
- }
2436
- const EXPRESSION_ARRAY_SUFFIX = /\[\]$/;
2437
- const EXPRESSION_BOOLEAN = /^(false|true)$/;
2438
- const TYPES = new Set([
2439
- "boolean",
2440
- "number",
2441
- "string"
2442
- ]);
2443
2604
  /**
2444
2605
  * Get a random boolean
2445
2606
  * @return Random boolean
@@ -2814,169 +2975,23 @@ function template(value, variables, options) {
2814
2975
  return handleTemplate(value, pattern, ignoreCase, variables);
2815
2976
  }
2816
2977
  const EXPRESSION_VARIABLE = /{{([\s\S]+?)}}/g;
2817
- function equal(first, second, options) {
2818
- return equalValue(first, second, getEqualOptions(options));
2819
- }
2820
- function equalArray(first, second, options) {
2821
- const { length } = first;
2822
- if (length !== second.length) return false;
2823
- let offset = 0;
2824
- if (length >= ARRAY_THRESHOLD) {
2825
- offset = Math.round(length / ARRAY_PEEK_PERCENTAGE);
2826
- offset = offset > ARRAY_THRESHOLD ? ARRAY_THRESHOLD : offset;
2827
- for (let index = 0; index < offset; index += 1) if (!(equalValue(first[index], second[index], options) && equalValue(first[length - index - 1], second[length - index - 1], options))) return false;
2828
- }
2829
- const firstChunks = chunk(first.slice(offset, length - offset), ARRAY_THRESHOLD);
2830
- const secondChunks = chunk(second.slice(offset, length - offset), ARRAY_THRESHOLD);
2831
- const chunksLength = firstChunks.length;
2832
- for (let chunkIndex = 0; chunkIndex < chunksLength; chunkIndex += 1) {
2833
- const firstChunk = firstChunks[chunkIndex];
2834
- const secondChunk = secondChunks[chunkIndex];
2835
- const chunkLength = firstChunk.length;
2836
- for (let index = 0; index < chunkLength; index += 1) if (!equalValue(firstChunk[index], secondChunk[index], options)) return false;
2837
- }
2838
- return true;
2839
- }
2840
- function equalArrayBuffer(first, second, options) {
2841
- return first.byteLength === second.byteLength ? equalArray(new Uint8Array(first), new Uint8Array(second), options) : false;
2842
- }
2843
- function equalDataView(first, second, options) {
2844
- return first.byteOffset === second.byteOffset ? equalArrayBuffer(first.buffer, second.buffer, options) : false;
2845
- }
2846
- function equalMap(first, second, options) {
2847
- const { size } = first;
2848
- if (size !== second.size) return false;
2849
- const firstKeys = [...first.keys()];
2850
- const secondKeys = [...second.keys()];
2851
- if (firstKeys.some((key) => !secondKeys.includes(key))) return false;
2852
- for (let index = 0; index < size; index += 1) {
2853
- const key = firstKeys[index];
2854
- if (!equalValue(first.get(key), second.get(key), options)) return false;
2855
- }
2856
- return true;
2857
- }
2858
- function equalPlainObject(first, second, options) {
2859
- let firstKeys = [...Object.keys(first), ...Object.getOwnPropertySymbols(first)];
2860
- let secondKeys = [...Object.keys(second), ...Object.getOwnPropertySymbols(second)];
2861
- if (options.ignoreKeys.enabled || options.ignoreExpressions.enabled) {
2862
- firstKeys = firstKeys.filter((key) => filterKey(key, options));
2863
- secondKeys = secondKeys.filter((key) => filterKey(key, options));
2864
- }
2865
- const { length } = firstKeys;
2866
- if (length !== secondKeys.length || firstKeys.some((key) => !secondKeys.includes(key))) return false;
2867
- for (let index = 0; index < length; index += 1) {
2868
- const key = firstKeys[index];
2869
- if (!equalValue(first[key], second[key], options)) return false;
2870
- }
2871
- return true;
2872
- }
2873
- function equalProperties(first, second, properties, options) {
2874
- const { length } = properties;
2875
- for (let index = 0; index < length; index += 1) {
2876
- const property = properties[index];
2877
- if (!equalValue(first[property], second[property], options)) return false;
2878
- }
2879
- return true;
2880
- }
2881
- function equalSet(first, second, options) {
2882
- const { size } = first;
2883
- if (size !== second.size) return false;
2884
- const firstValues = [...first];
2885
- const secondValues = [...second];
2886
- for (let index = 0; index < size; index += 1) {
2887
- const firstValue = firstValues[index];
2888
- if (!secondValues.some((secondValue) => equalValue(firstValue, secondValue, options))) return false;
2889
- }
2890
- return true;
2891
- }
2892
- function equalTypedArray(first, second) {
2893
- if (first.constructor !== second.constructor) return false;
2894
- if (first.byteLength !== second.byteLength) return false;
2895
- const { length } = first;
2896
- for (let index = 0; index < length; index += 1) if (first[index] !== second[index]) return false;
2897
- return true;
2898
- }
2899
- function equalValue(first, second, options) {
2900
- if (options.relaxedNullish && first == null && second == null) return true;
2901
- switch (true) {
2902
- case Object.is(first, second): return true;
2903
- case first == null || second == null: return first === second;
2904
- case typeof first !== typeof second: return false;
2905
- case typeof first === "string" && options.ignoreCase === true: return Object.is(first.toLocaleLowerCase(), second.toLocaleLowerCase());
2906
- case first instanceof ArrayBuffer && second instanceof ArrayBuffer: return equalArrayBuffer(first, second, options);
2907
- case first instanceof Date && second instanceof Date: return Object.is(Number(first), Number(second));
2908
- case first instanceof DataView && second instanceof DataView: return equalDataView(first, second, options);
2909
- case first instanceof Error && second instanceof Error: return equalProperties(first, second, ["name", "message"], options);
2910
- case first instanceof Map && second instanceof Map: return equalMap(first, second, options);
2911
- case first instanceof RegExp && second instanceof RegExp: return equalProperties(first, second, ["source", "flags"], options);
2912
- case first instanceof Set && second instanceof Set: return equalSet(first, second, options);
2913
- case Array.isArray(first) && Array.isArray(second): return equalArray(first, second, options);
2914
- case isPlainObject(first) && isPlainObject(second): return equalPlainObject(first, second, options);
2915
- case isTypedArray(first) && isTypedArray(second): return equalTypedArray(first, second);
2916
- default: return equalHandlers.handle(first, second, options);
2917
- }
2918
- }
2919
- /**
2920
- * Create an equalizer with predefined options
2921
- * @param options Comparison options
2922
- * @returns Equalizer function
2923
- */
2924
- function initializeEqualizer(options) {
2925
- const actual = getEqualOptions(options);
2926
- return (first, second) => equalValue(first, second, actual);
2978
+ function clone(value) {
2979
+ return cloneValue(value, 0, /* @__PURE__ */ new WeakMap());
2927
2980
  }
2928
2981
  /**
2929
- * Register a equality comparison function for a specific class
2982
+ * Register a clone handler for a specific class
2930
2983
  * @param constructor Class constructor
2931
- * @param fn Comparison function
2984
+ * @param handler Method name or clone function _(defaults to `clone`)_
2932
2985
  */
2933
- function registerEqualizer(constructor, fn) {
2934
- equalHandlers.register(constructor, fn);
2986
+ function registerCloner(constructor, handler) {
2987
+ cloneHandlers.register(constructor, handler);
2935
2988
  }
2936
2989
  /**
2937
- * Unregister a equality comparison handler for a specific class
2990
+ * Unregister a clone handler for a specific class
2938
2991
  * @param constructor Class constructor
2939
2992
  */
2940
- function unregisterEqualizer(constructor) {
2941
- equalHandlers.unregister(constructor);
2942
- }
2943
- function filterKey(key, options) {
2944
- if (typeof key !== "string") return true;
2945
- if (options.ignoreExpressions.enabled && options.ignoreExpressions.values.some((expression) => expression.test(key))) return false;
2946
- if (options.ignoreKeys.enabled && options.ignoreKeys.values.has(key)) return false;
2947
- return true;
2948
- }
2949
- function getEqualOptions(input) {
2950
- const options = {
2951
- ignoreCase: false,
2952
- ignoreExpressions: {
2953
- enabled: false,
2954
- values: []
2955
- },
2956
- ignoreKeys: {
2957
- enabled: false,
2958
- values: /* @__PURE__ */ new Set()
2959
- },
2960
- relaxedNullish: false
2961
- };
2962
- if (typeof input === "boolean") {
2963
- options.ignoreCase = input;
2964
- return options;
2965
- }
2966
- if (!isPlainObject(input)) return options;
2967
- options.ignoreCase = typeof input.ignoreCase === "boolean" ? input.ignoreCase : false;
2968
- options.ignoreExpressions.values = (Array.isArray(input.ignoreKeys) ? input.ignoreKeys : [input.ignoreKeys]).filter((key) => key instanceof RegExp);
2969
- options.ignoreKeys.values = new Set((Array.isArray(input.ignoreKeys) ? input.ignoreKeys : [input.ignoreKeys]).filter((key) => typeof key === "string"));
2970
- options.ignoreExpressions.enabled = options.ignoreExpressions.values.length > 0;
2971
- options.ignoreKeys.enabled = options.ignoreKeys.values.size > 0;
2972
- options.relaxedNullish = input.relaxedNullish === true;
2973
- return options;
2974
- }
2975
- const equalHandlers = getCompareHandlers(equal, { callback: Object.is });
2976
- const ARRAY_PEEK_PERCENTAGE = 10;
2977
- const ARRAY_THRESHOLD = 100;
2978
- function clone(value) {
2979
- return cloneValue(value, 0, /* @__PURE__ */ new WeakMap());
2993
+ function unregisterCloner(constructor) {
2994
+ cloneHandlers.unregister(constructor);
2980
2995
  }
2981
2996
  function cloneArrayBuffer(value, depth, references) {
2982
2997
  if (typeof depth === "number" && depth >= MAX_CLONE_DEPTH) return value;
@@ -3076,161 +3091,6 @@ const cloneHandlers = getSelfHandlers(clone, {
3076
3091
  });
3077
3092
  const MAX_CLONE_DEPTH = 100;
3078
3093
  /**
3079
- * Find the differences between two values
3080
- * @param first First value
3081
- * @param second Second value
3082
- * @param options Comparison options
3083
- * @returns Difference result
3084
- */
3085
- function diff(first, second, options) {
3086
- const relaxedNullish = typeof options === "object" && options?.relaxedNullish === true;
3087
- const diffResult = {
3088
- original: {
3089
- from: first,
3090
- to: second
3091
- },
3092
- type: "partial",
3093
- values: {}
3094
- };
3095
- const same = relaxedNullish && first == null && second == null || Object.is(first, second);
3096
- const firstIsArrayOrObject = isArrayOrPlainObject(first);
3097
- const secondIsArrayOrObject = isArrayOrPlainObject(second);
3098
- if (same || !(firstIsArrayOrObject || secondIsArrayOrObject)) {
3099
- diffResult.type = same ? "none" : "full";
3100
- return diffResult;
3101
- }
3102
- if (firstIsArrayOrObject !== secondIsArrayOrObject) {
3103
- diffResult.type = "full";
3104
- return diffResult;
3105
- }
3106
- const diffs = getDiffs(first, second, relaxedNullish);
3107
- const { length } = diffs;
3108
- if (length === 0) diffResult.type = "none";
3109
- for (let index = 0; index < length; index += 1) {
3110
- const differences = diffs[index];
3111
- diffResult.values[differences.key] = {
3112
- from: differences.from,
3113
- to: differences.to
3114
- };
3115
- }
3116
- return diffResult;
3117
- }
3118
- function getChanges(changes, first, second, relaxedNullish, prefix) {
3119
- const checked = /* @__PURE__ */ new Set();
3120
- for (let outerIndex = 0; outerIndex < 2; outerIndex += 1) {
3121
- const value = (outerIndex === 0 ? first : second) ?? {};
3122
- const keys = [...Object.keys(value), ...Object.getOwnPropertySymbols(value)];
3123
- const { length } = keys;
3124
- for (let innerIndex = 0; innerIndex < length; innerIndex += 1) {
3125
- const key = keys[innerIndex];
3126
- if (checked.has(key)) continue;
3127
- checked.add(key);
3128
- setChanges({
3129
- changes,
3130
- key,
3131
- relaxedNullish,
3132
- prefix,
3133
- values: {
3134
- first,
3135
- second
3136
- }
3137
- });
3138
- }
3139
- }
3140
- return changes;
3141
- }
3142
- function getDiffs(first, second, relaxedNullish, prefix) {
3143
- const changes = [];
3144
- if (Array.isArray(first) && Array.isArray(second)) {
3145
- const maximumLength = Math.max(first.length, second.length);
3146
- const minimumLength = Math.min(first.length, second.length);
3147
- for (let index = minimumLength; index < maximumLength; index += 1) {
3148
- const key = join([prefix, index], ".");
3149
- changes.push({
3150
- key,
3151
- from: index >= first.length ? void 0 : first[index],
3152
- to: index >= first.length ? second[index] : void 0
3153
- });
3154
- }
3155
- }
3156
- return getChanges(changes, first, second, relaxedNullish, prefix);
3157
- }
3158
- function setChanges(parameters) {
3159
- const { changes, key, prefix, relaxedNullish, values } = parameters;
3160
- const from = values.first?.[key];
3161
- const to = values.second?.[key];
3162
- if (equal(from, to, { relaxedNullish })) return;
3163
- const prefixed = join([prefix, key], ".");
3164
- const change = {
3165
- from,
3166
- to,
3167
- key: prefixed
3168
- };
3169
- const diffs = isArrayOrPlainObject(from) || isArrayOrPlainObject(to) ? getDiffs(from, to, relaxedNullish, prefixed) : [];
3170
- changes.push(change);
3171
- const diffsLength = diffs.length;
3172
- for (let diffIndex = 0; diffIndex < diffsLength; diffIndex += 1) changes.push(diffs[diffIndex]);
3173
- }
3174
- function getMergeOptions(options) {
3175
- const actual = {
3176
- replaceableObjects: void 0,
3177
- skipNullableInArrays: false
3178
- };
3179
- if (typeof options !== "object" || options == null) return actual;
3180
- actual.replaceableObjects = getReplaceableObjects(options.replaceableObjects);
3181
- actual.skipNullableInArrays = options.skipNullableInArrays === true;
3182
- return actual;
3183
- }
3184
- function getReplaceableObjects(value) {
3185
- const items = (Array.isArray(value) ? value : [value]).filter((item) => typeof item === "string" || item instanceof RegExp);
3186
- if (items.length > 0) return (name) => items.some((item) => typeof item === "string" ? item === name : item.test(name));
3187
- }
3188
- function handleMerge(values, options) {
3189
- return !Array.isArray(values) || values.length === 0 ? {} : mergeValues(values, options, true);
3190
- }
3191
- /**
3192
- * Merge multiple arrays or objects into a single one
3193
- * @param values Values to merge
3194
- * @param options Merging options
3195
- * @returns Merged value
3196
- */
3197
- function merge(values, options) {
3198
- return handleMerge(values, getMergeOptions(options));
3199
- }
3200
- /**
3201
- * Create a merger with predefined options
3202
- * @param options Merging options
3203
- * @returns Merger function
3204
- */
3205
- function initializeMerger(options) {
3206
- const actual = getMergeOptions(options);
3207
- return (values) => handleMerge(values, actual);
3208
- }
3209
- function mergeObjects(values, options, prefix) {
3210
- const { length } = values;
3211
- const isArray = values.every(Array.isArray);
3212
- const merged = isArray ? [] : {};
3213
- for (let outerIndex = 0; outerIndex < length; outerIndex += 1) {
3214
- const item = values[outerIndex];
3215
- const keys = Object.keys(item);
3216
- const size = keys.length;
3217
- for (let innerIndex = 0; innerIndex < size; innerIndex += 1) {
3218
- const key = keys[innerIndex];
3219
- const full = join([prefix, key], ".");
3220
- const next = item[key];
3221
- const previous = merged[key];
3222
- if (isArray && options.skipNullableInArrays && next == null) continue;
3223
- if (isArrayOrPlainObject(next) && isArrayOrPlainObject(previous) && !(options.replaceableObjects?.(full) ?? false)) merged[key] = mergeValues([previous, next], options, false, full);
3224
- else merged[key] = next;
3225
- }
3226
- }
3227
- return merged;
3228
- }
3229
- function mergeValues(values, options, validate, prefix) {
3230
- const actual = validate ? values.filter(isArrayOrPlainObject) : values;
3231
- return actual.length > 1 ? mergeObjects(actual, options, prefix) : actual[0] ?? {};
3232
- }
3233
- /**
3234
3094
  * Create a new object with only the specified keys
3235
3095
  * @param value Original object
3236
3096
  * @param keys Keys to use
@@ -3311,4 +3171,63 @@ function unsmush(value) {
3311
3171
  }
3312
3172
  return unsmushed;
3313
3173
  }
3314
- export { frame_rate_default as FRAME_RATE_MS, PromiseTimeoutError, QueueError, SizedMap, SizedSet, asyncResult, average, beacon, between, camelCase, capitalize, chunk, clamp, clone, compact, compare, count, debounce, delay, diff, endsWith, equal, error, exists, filter, find, flatten, fromQuery, getArray, getColor, getForegroundColor, getHexColor, getHexaColor, getHslColor, getHslaColor, getNormalizedHex, getNumber, getRandomBoolean, getRandomCharacters, getRandomColor, getRandomFloat, getRandomHex, getRandomInteger, getRandomItem, getRandomItems, getRgbColor, getRgbaColor, getString, getUuid, getValue, groupArraysBy, groupBy, hexToHsl, hexToHsla, hexToRgb, hexToRgba, hslToHex, hslToRgb, hslToRgba, includes, indexOf, initializeEqualizer, initializeMerger, initializeTemplater, insert, isArrayOrPlainObject, isColor, isConstructor, isEmpty, isError, isFulfilled, isHexColor, isHslColor, isHslLike, isHslaColor, isKey, isNullable, isNullableOrEmpty, isNullableOrWhitespace, isNumber, isNumerical, isObject, isOk, isPlainObject, isPrimitive, isRejected, isResult, isRgbColor, isRgbLike, isRgbaColor, isTypedArray, join, kebabCase, logger, lowerCase, max, memoize, merge, min, noop, ok, parse, partial, pascalCase, promises, push, queue, registerComparator, registerEqualizer, result, rgbToHex, rgbToHsl, rgbToHsla, round, setValue, shuffle, smush, snakeCase, sort, splice, startsWith, sum, template, throttle, timed, titleCase, toMap, toMapArrays, toQuery, toRecord, toRecordArrays, toSet, trim, truncate, unique, unregisterComparator, unregisterEqualizer, unsmush, unwrap, upperCase, words };
3174
+ function getMergeOptions(options) {
3175
+ const actual = {
3176
+ replaceableObjects: void 0,
3177
+ skipNullableInArrays: false
3178
+ };
3179
+ if (typeof options !== "object" || options == null) return actual;
3180
+ actual.replaceableObjects = getReplaceableObjects(options.replaceableObjects);
3181
+ actual.skipNullableInArrays = options.skipNullableInArrays === true;
3182
+ return actual;
3183
+ }
3184
+ function getReplaceableObjects(value) {
3185
+ const items = (Array.isArray(value) ? value : [value]).filter((item) => typeof item === "string" || item instanceof RegExp);
3186
+ if (items.length > 0) return (name) => items.some((item) => typeof item === "string" ? item === name : item.test(name));
3187
+ }
3188
+ function handleMerge(values, options) {
3189
+ return !Array.isArray(values) || values.length === 0 ? {} : mergeValues(values, options, true);
3190
+ }
3191
+ /**
3192
+ * Merge multiple arrays or objects into a single one
3193
+ * @param values Values to merge
3194
+ * @param options Merging options
3195
+ * @returns Merged value
3196
+ */
3197
+ function merge(values, options) {
3198
+ return handleMerge(values, getMergeOptions(options));
3199
+ }
3200
+ /**
3201
+ * Create a merger with predefined options
3202
+ * @param options Merging options
3203
+ * @returns Merger function
3204
+ */
3205
+ function initializeMerger(options) {
3206
+ const actual = getMergeOptions(options);
3207
+ return (values) => handleMerge(values, actual);
3208
+ }
3209
+ function mergeObjects(values, options, prefix) {
3210
+ const { length } = values;
3211
+ const isArray = values.every(Array.isArray);
3212
+ const merged = isArray ? [] : {};
3213
+ for (let outerIndex = 0; outerIndex < length; outerIndex += 1) {
3214
+ const item = values[outerIndex];
3215
+ const keys = Object.keys(item);
3216
+ const size = keys.length;
3217
+ for (let innerIndex = 0; innerIndex < size; innerIndex += 1) {
3218
+ const key = keys[innerIndex];
3219
+ const full = join([prefix, key], ".");
3220
+ const next = item[key];
3221
+ const previous = merged[key];
3222
+ if (isArray && options.skipNullableInArrays && next == null) continue;
3223
+ if (isArrayOrPlainObject(next) && isArrayOrPlainObject(previous) && !(options.replaceableObjects?.(full) ?? false)) merged[key] = mergeValues([previous, next], options, false, full);
3224
+ else merged[key] = next;
3225
+ }
3226
+ }
3227
+ return merged;
3228
+ }
3229
+ function mergeValues(values, options, validate, prefix) {
3230
+ const actual = validate ? values.filter(isArrayOrPlainObject) : values;
3231
+ return actual.length > 1 ? mergeObjects(actual, options, prefix) : actual[0] ?? {};
3232
+ }
3233
+ export { frame_rate_default as FRAME_RATE_MS, PromiseTimeoutError, QueueError, SizedMap, SizedSet, asyncResult, average, beacon, between, camelCase, capitalize, chunk, clamp, clone, compact, compare, count, debounce, delay, endsWith, equal, error, exists, filter, find, flatten, fromQuery, getArray, getColor, getForegroundColor, getHexColor, getHexaColor, getHslColor, getHslaColor, getNormalizedHex, getNumber, getRandomBoolean, getRandomCharacters, getRandomColor, getRandomFloat, getRandomHex, getRandomInteger, getRandomItem, getRandomItems, getRgbColor, getRgbaColor, getString, getUuid, getValue, groupArraysBy, groupBy, hexToHsl, hexToHsla, hexToRgb, hexToRgba, hslToHex, hslToRgb, hslToRgba, includes, indexOf, initializeEqualizer, initializeMerger, initializeTemplater, insert, isArrayOrPlainObject, isColor, isConstructor, isEmpty, isError, isFulfilled, isHexColor, isHslColor, isHslLike, isHslaColor, isKey, isNullable, isNullableOrEmpty, isNullableOrWhitespace, isNumber, isNumerical, isObject, isOk, isPlainObject, isPrimitive, isRejected, isResult, isRgbColor, isRgbLike, isRgbaColor, isTypedArray, join, kebabCase, logger, lowerCase, max, memoize, merge, min, noop, ok, parse, partial, pascalCase, promises, push, queue, registerCloner, registerComparator, registerEqualizer, result, rgbToHex, rgbToHsl, rgbToHsla, round, setValue, shuffle, smush, snakeCase, sort, splice, startsWith, sum, template, throttle, timed, titleCase, toMap, toMapArrays, toQuery, toRecord, toRecordArrays, toSet, trim, truncate, unique, unregisterCloner, unregisterComparator, unregisterEqualizer, unsmush, unwrap, upperCase, words };
package/dist/index.js CHANGED
@@ -35,25 +35,23 @@ import frame_rate_default from "./internal/frame-rate.js";
35
35
  import { isEmpty, isNullable, isNullableOrEmpty, isNullableOrWhitespace, isNumerical, isObject, isPrimitive } from "./is.js";
36
36
  import { SizedMap, SizedSet } from "./sized.js";
37
37
  import { debounce, memoize, throttle } from "./function.js";
38
+ import { equal, initializeEqualizer, registerEqualizer, unregisterEqualizer } from "./internal/value/equal.js";
38
39
  import { logger } from "./logger.js";
39
40
  import { average, count, min, round, sum } from "./math.js";
40
41
  import { PromiseTimeoutError, delay, isFulfilled, isRejected, promises, timed } from "./promise.js";
41
- import { QueueError, queue } from "./queue.js";
42
42
  import { setValue } from "./internal/value/set.js";
43
43
  import { fromQuery, toQuery } from "./query.js";
44
+ import { QueueError, queue } from "./queue.js";
44
45
  import { getRandomBoolean, getRandomCharacters, getRandomColor, getRandomHex, getRandomItem, getRandomItems } from "./random.js";
45
46
  import { asyncResult, error, isError, isOk, isResult, ok, result, unwrap } from "./result.js";
46
47
  import { camelCase, capitalize, kebabCase, lowerCase, pascalCase, snakeCase, titleCase, upperCase } from "./string/case.js";
47
48
  import { endsWith, getUuid, includes, parse, startsWith, trim, truncate } from "./string/misc.js";
49
+ import "./string/index.js";
48
50
  import { getValue } from "./internal/value/get.js";
49
51
  import { initializeTemplater, template } from "./string/template.js";
50
- import "./string/index.js";
51
- import { equal, initializeEqualizer, registerEqualizer, unregisterEqualizer } from "./internal/value/equal.js";
52
- import { clone } from "./value/clone.js";
53
- import { diff } from "./value/diff.js";
54
- import { initializeMerger, merge } from "./value/merge.js";
52
+ import { clone, registerCloner, unregisterCloner } from "./value/clone.js";
55
53
  import { partial } from "./value/partial.js";
56
54
  import { smush } from "./value/smush.js";
57
55
  import { unsmush } from "./value/unsmush.js";
58
- import "./value/index.js";
59
- export { frame_rate_default as FRAME_RATE_MS, PromiseTimeoutError, QueueError, SizedMap, SizedSet, asyncResult, average, beacon, between, camelCase, capitalize, chunk, clamp, clone, compact, compare, count, debounce, delay, diff, endsWith, equal, error, exists, filter, find, flatten, fromQuery, getArray, getColor, getForegroundColor, getHexColor, getHexaColor, getHslColor, getHslaColor, getNormalizedHex, getNumber, getRandomBoolean, getRandomCharacters, getRandomColor, getRandomFloat, getRandomHex, getRandomInteger, getRandomItem, getRandomItems, getRgbColor, getRgbaColor, getString, getUuid, getValue, groupArraysBy, groupBy, hexToHsl, hexToHsla, hexToRgb, hexToRgba, hslToHex, hslToRgb, hslToRgba, includes, indexOf, initializeEqualizer, initializeMerger, initializeTemplater, insert, isArrayOrPlainObject, isColor, isConstructor, isEmpty, isError, isFulfilled, isHexColor, isHslColor, isHslLike, isHslaColor, isKey, isNullable, isNullableOrEmpty, isNullableOrWhitespace, isNumber, isNumerical, isObject, isOk, isPlainObject, isPrimitive, isRejected, isResult, isRgbColor, isRgbLike, isRgbaColor, isTypedArray, join, kebabCase, logger, lowerCase, max, memoize, merge, min, noop, ok, parse, partial, pascalCase, promises, push, queue, registerComparator, registerEqualizer, result, rgbToHex, rgbToHsl, rgbToHsla, round, setValue, shuffle, smush, snakeCase, sort, splice, startsWith, sum, template, throttle, timed, titleCase, toMap, toMapArrays, toQuery, toRecord, toRecordArrays, toSet, trim, truncate, unique, unregisterComparator, unregisterEqualizer, unsmush, unwrap, upperCase, words };
56
+ import { initializeMerger, merge } from "./value/merge.js";
57
+ export { frame_rate_default as FRAME_RATE_MS, PromiseTimeoutError, QueueError, SizedMap, SizedSet, asyncResult, average, beacon, between, camelCase, capitalize, chunk, clamp, clone, compact, compare, count, debounce, delay, endsWith, equal, error, exists, filter, find, flatten, fromQuery, getArray, getColor, getForegroundColor, getHexColor, getHexaColor, getHslColor, getHslaColor, getNormalizedHex, getNumber, getRandomBoolean, getRandomCharacters, getRandomColor, getRandomFloat, getRandomHex, getRandomInteger, getRandomItem, getRandomItems, getRgbColor, getRgbaColor, getString, getUuid, getValue, groupArraysBy, groupBy, hexToHsl, hexToHsla, hexToRgb, hexToRgba, hslToHex, hslToRgb, hslToRgba, includes, indexOf, initializeEqualizer, initializeMerger, initializeTemplater, insert, isArrayOrPlainObject, isColor, isConstructor, isEmpty, isError, isFulfilled, isHexColor, isHslColor, isHslLike, isHslaColor, isKey, isNullable, isNullableOrEmpty, isNullableOrWhitespace, isNumber, isNumerical, isObject, isOk, isPlainObject, isPrimitive, isRejected, isResult, isRgbColor, isRgbLike, isRgbaColor, isTypedArray, join, kebabCase, logger, lowerCase, max, memoize, merge, min, noop, ok, parse, partial, pascalCase, promises, push, queue, registerCloner, registerComparator, registerEqualizer, result, rgbToHex, rgbToHsl, rgbToHsla, round, setValue, shuffle, smush, snakeCase, sort, splice, startsWith, sum, template, throttle, timed, titleCase, toMap, toMapArrays, toQuery, toRecord, toRecordArrays, toSet, trim, truncate, unique, unregisterCloner, unregisterComparator, unregisterEqualizer, unsmush, unwrap, upperCase, words };
@@ -1,5 +1,4 @@
1
1
  import { getString, join, words } from "../internal/string.js";
2
2
  import { camelCase, capitalize, kebabCase, lowerCase, pascalCase, snakeCase, titleCase, upperCase } from "./case.js";
3
3
  import { endsWith, getUuid, includes, parse, startsWith, trim, truncate } from "./misc.js";
4
- import { initializeTemplater, template } from "./template.js";
5
- export { camelCase, capitalize, endsWith, getString, getUuid, includes, initializeTemplater, join, kebabCase, lowerCase, parse, pascalCase, snakeCase, startsWith, template, titleCase, trim, truncate, upperCase, words };
4
+ export { camelCase, capitalize, endsWith, getString, getUuid, includes, join, kebabCase, lowerCase, parse, pascalCase, snakeCase, startsWith, titleCase, trim, truncate, upperCase, words };
@@ -1,11 +1,6 @@
1
- import { compare, registerComparator, unregisterComparator } from "../internal/value/compare.js";
2
1
  import { setValue } from "../internal/value/set.js";
3
2
  import { getValue } from "../internal/value/get.js";
4
- import { equal, initializeEqualizer, registerEqualizer, unregisterEqualizer } from "../internal/value/equal.js";
5
- import { clone } from "./clone.js";
6
- import { diff } from "./diff.js";
7
- import { initializeMerger, merge } from "./merge.js";
8
3
  import { partial } from "./partial.js";
9
4
  import { smush } from "./smush.js";
10
5
  import { unsmush } from "./unsmush.js";
11
- export { clone, compare, diff, equal, getValue, initializeEqualizer, initializeMerger, merge, partial, registerComparator, registerEqualizer, setValue, smush, unregisterComparator, unregisterEqualizer, unsmush };
6
+ export { getValue, partial, setValue, smush, unsmush };
package/package.json CHANGED
@@ -89,9 +89,33 @@
89
89
  "types": "./types/string/index.d.ts",
90
90
  "default": "./dist/string/index.js"
91
91
  },
92
+ "./string/template": {
93
+ "types": "./types/string/template.d.ts",
94
+ "default": "./dist/string/template.js"
95
+ },
92
96
  "./value": {
93
97
  "types": "./types/value/index.d.ts",
94
98
  "default": "./dist/value/index.js"
99
+ },
100
+ "./value/clone": {
101
+ "types": "./types/value/clone.d.ts",
102
+ "default": "./dist/value/clone.js"
103
+ },
104
+ "./value/compare": {
105
+ "types": "./types/internal/value/compare.d.ts",
106
+ "default": "./dist/internal/value/compare.js"
107
+ },
108
+ "./value/diff": {
109
+ "types": "./types/value/diff.d.ts",
110
+ "default": "./dist/value/diff.js"
111
+ },
112
+ "./value/equal": {
113
+ "types": "./types/internal/value/equal.d.ts",
114
+ "default": "./dist/internal/value/equal.js"
115
+ },
116
+ "./value/merge": {
117
+ "types": "./types/value/merge.d.ts",
118
+ "default": "./dist/value/merge.js"
95
119
  }
96
120
  },
97
121
  "files": [
@@ -120,5 +144,5 @@
120
144
  },
121
145
  "type": "module",
122
146
  "types": "./types/index.d.ts",
123
- "version": "0.137.0"
147
+ "version": "0.139.0"
124
148
  }
package/src/index.ts CHANGED
@@ -4,18 +4,23 @@ export * from './array/index';
4
4
  export * from './beacon';
5
5
  export * from './color/index';
6
6
  export * from './function';
7
+ export * from './internal/value/compare';
8
+ export * from './internal/value/equal';
7
9
  export * from './is';
8
10
  export * from './logger';
9
11
  export * from './math';
10
12
  export * from './models';
11
13
  export * from './number';
12
14
  export * from './promise';
13
- export * from './queue';
14
15
  export * from './query';
16
+ export * from './queue';
15
17
  export * from './random';
16
18
  export * from './result';
17
19
  export * from './sized';
18
20
  export * from './string/index';
21
+ export * from './string/template';
22
+ export * from './value/clone';
19
23
  export * from './value/index';
24
+ export * from './value/merge';
20
25
 
21
26
  export {FRAME_RATE_MS};
@@ -11,4 +11,3 @@ export {
11
11
  upperCase,
12
12
  } from './case';
13
13
  export {endsWith, getUuid, includes, parse, startsWith, trim, truncate} from './misc';
14
- export {initializeTemplater, template, type TemplateOptions} from './template';
@@ -1,6 +1,6 @@
1
+ import {isPlainObject} from '../internal/is';
1
2
  import {getString} from '../internal/string';
2
3
  import {getValue} from '../internal/value/get';
3
- import {isPlainObject} from '../is';
4
4
  import type {PlainObject} from '../models';
5
5
 
6
6
  // #region Types
@@ -1,17 +1,6 @@
1
- export {compare, registerComparator, unregisterComparator} from '../internal/value/compare';
2
- export {
3
- equal,
4
- initializeEqualizer,
5
- registerEqualizer,
6
- unregisterEqualizer,
7
- type EqualOptions,
8
- } from '../internal/value/equal';
9
1
  export {getValue} from '../internal/value/get';
10
2
  export {setValue} from '../internal/value/set';
11
3
  export type {ArrayOrPlainObject, NestedPartial, PlainObject} from '../models';
12
- export {clone} from './clone';
13
- export {diff, type DiffOptions, type DiffResult, type DiffValue} from './diff';
14
- export {merge, initializeMerger, type MergeOptions} from './merge';
15
4
  export {partial} from './partial';
16
5
  export {smush} from './smush';
17
6
  export {unsmush} from './unsmush';
package/types/index.d.ts CHANGED
@@ -3,17 +3,22 @@ export * from './array/index';
3
3
  export * from './beacon';
4
4
  export * from './color/index';
5
5
  export * from './function';
6
+ export * from './internal/value/compare';
7
+ export * from './internal/value/equal';
6
8
  export * from './is';
7
9
  export * from './logger';
8
10
  export * from './math';
9
11
  export * from './models';
10
12
  export * from './number';
11
13
  export * from './promise';
12
- export * from './queue';
13
14
  export * from './query';
15
+ export * from './queue';
14
16
  export * from './random';
15
17
  export * from './result';
16
18
  export * from './sized';
17
19
  export * from './string/index';
20
+ export * from './string/template';
21
+ export * from './value/clone';
18
22
  export * from './value/index';
23
+ export * from './value/merge';
19
24
  export { FRAME_RATE_MS };
@@ -2,4 +2,3 @@ export { getString, join, words } from '../internal/string';
2
2
  export type { PlainObject } from '../models';
3
3
  export { camelCase, capitalize, kebabCase, lowerCase, pascalCase, snakeCase, titleCase, upperCase, } from './case';
4
4
  export { endsWith, getUuid, includes, parse, startsWith, trim, truncate } from './misc';
5
- export { initializeTemplater, template, type TemplateOptions } from './template';
@@ -1,11 +1,6 @@
1
- export { compare, registerComparator, unregisterComparator } from '../internal/value/compare';
2
- export { equal, initializeEqualizer, registerEqualizer, unregisterEqualizer, type EqualOptions, } from '../internal/value/equal';
3
1
  export { getValue } from '../internal/value/get';
4
2
  export { setValue } from '../internal/value/set';
5
3
  export type { ArrayOrPlainObject, NestedPartial, PlainObject } from '../models';
6
- export { clone } from './clone';
7
- export { diff, type DiffOptions, type DiffResult, type DiffValue } from './diff';
8
- export { merge, initializeMerger, type MergeOptions } from './merge';
9
4
  export { partial } from './partial';
10
5
  export { smush } from './smush';
11
6
  export { unsmush } from './unsmush';