radashi 12.7.1 → 12.8.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.
- package/dist/radashi.cjs +57 -0
- package/dist/radashi.d.cts +37 -8
- package/dist/radashi.d.ts +37 -8
- package/dist/radashi.js +56 -1
- package/package.json +2 -2
package/dist/radashi.cjs
CHANGED
|
@@ -1754,6 +1754,53 @@ function dash(str) {
|
|
|
1754
1754
|
});
|
|
1755
1755
|
}
|
|
1756
1756
|
|
|
1757
|
+
// src/string/deburr.ts
|
|
1758
|
+
var DEBURR_MAP = new Map(
|
|
1759
|
+
Object.entries({
|
|
1760
|
+
\u00C6: "Ae",
|
|
1761
|
+
\u00D0: "D",
|
|
1762
|
+
\u00D8: "O",
|
|
1763
|
+
\u00DE: "Th",
|
|
1764
|
+
\u00DF: "ss",
|
|
1765
|
+
\u00E6: "ae",
|
|
1766
|
+
\u00F0: "d",
|
|
1767
|
+
\u00F8: "o",
|
|
1768
|
+
\u00FE: "th",
|
|
1769
|
+
\u0110: "D",
|
|
1770
|
+
\u0111: "d",
|
|
1771
|
+
\u0126: "H",
|
|
1772
|
+
\u0127: "h",
|
|
1773
|
+
\u0131: "i",
|
|
1774
|
+
\u0132: "IJ",
|
|
1775
|
+
\u0133: "ij",
|
|
1776
|
+
\u0138: "k",
|
|
1777
|
+
\u013F: "L",
|
|
1778
|
+
\u0140: "l",
|
|
1779
|
+
\u0141: "L",
|
|
1780
|
+
\u0142: "l",
|
|
1781
|
+
\u0149: "'n",
|
|
1782
|
+
\u014A: "N",
|
|
1783
|
+
\u014B: "n",
|
|
1784
|
+
\u0152: "Oe",
|
|
1785
|
+
\u0153: "oe",
|
|
1786
|
+
\u0166: "T",
|
|
1787
|
+
\u0167: "t",
|
|
1788
|
+
\u017F: "s"
|
|
1789
|
+
})
|
|
1790
|
+
);
|
|
1791
|
+
function deburr(input) {
|
|
1792
|
+
let result = "";
|
|
1793
|
+
const chars = input.normalize("NFD");
|
|
1794
|
+
for (let index = 0; index < chars.length; index++) {
|
|
1795
|
+
const char = chars[index];
|
|
1796
|
+
if (char >= "\u0300" && char <= "\u036F" || char >= "\uFE20" && char <= "\uFE23") {
|
|
1797
|
+
continue;
|
|
1798
|
+
}
|
|
1799
|
+
result += DEBURR_MAP.get(char) ?? char;
|
|
1800
|
+
}
|
|
1801
|
+
return result;
|
|
1802
|
+
}
|
|
1803
|
+
|
|
1757
1804
|
// src/string/dedent.ts
|
|
1758
1805
|
function dedent(text, ...values) {
|
|
1759
1806
|
var _a;
|
|
@@ -1908,6 +1955,14 @@ function assert(condition, message) {
|
|
|
1908
1955
|
}
|
|
1909
1956
|
}
|
|
1910
1957
|
|
|
1958
|
+
// src/typed/getErrorMessage.ts
|
|
1959
|
+
function getErrorMessage(error) {
|
|
1960
|
+
if (error instanceof Error && error.message) {
|
|
1961
|
+
return error.message;
|
|
1962
|
+
}
|
|
1963
|
+
return typeof error === "string" && error.length > 0 ? error : "Unknown error.";
|
|
1964
|
+
}
|
|
1965
|
+
|
|
1911
1966
|
// src/typed/isArray.ts
|
|
1912
1967
|
var isArray = /* @__PURE__ */ (() => Array.isArray)();
|
|
1913
1968
|
|
|
@@ -2182,6 +2237,7 @@ exports.counting = counting;
|
|
|
2182
2237
|
exports.crush = crush;
|
|
2183
2238
|
exports.dash = dash;
|
|
2184
2239
|
exports.debounce = debounce;
|
|
2240
|
+
exports.deburr = deburr;
|
|
2185
2241
|
exports.dedent = dedent;
|
|
2186
2242
|
exports.defer = defer;
|
|
2187
2243
|
exports.diff = diff;
|
|
@@ -2193,6 +2249,7 @@ exports.flat = flat;
|
|
|
2193
2249
|
exports.flip = flip;
|
|
2194
2250
|
exports.fork = fork;
|
|
2195
2251
|
exports.get = get;
|
|
2252
|
+
exports.getErrorMessage = getErrorMessage;
|
|
2196
2253
|
exports.getOrInsert = getOrInsert;
|
|
2197
2254
|
exports.getOrInsertComputed = getOrInsertComputed;
|
|
2198
2255
|
exports.group = group;
|
package/dist/radashi.d.cts
CHANGED
|
@@ -1769,13 +1769,13 @@ declare function callable<TValue, TObj extends Record<string | number | symbol,
|
|
|
1769
1769
|
*/
|
|
1770
1770
|
declare function chain<T1 extends any[], T2, T3>(f1: (...arg: T1) => T2, f2: (arg: T2) => T3): (...arg: T1) => T3;
|
|
1771
1771
|
declare function chain<T1 extends any[], T2, T3, T4>(f1: (...arg: T1) => T2, f2: (arg: T2) => T3, f3: (arg: T3) => T4): (...arg: T1) => T4;
|
|
1772
|
-
declare function chain<T1 extends any[], T2, T3, T4, T5>(f1: (...arg: T1) => T2, f2: (arg: T2) => T3, f3: (arg: T3) => T4, f4: (arg:
|
|
1773
|
-
declare function chain<T1 extends any[], T2, T3, T4, T5, T6>(f1: (...arg: T1) => T2, f2: (arg: T2) => T3, f3: (arg: T3) => T4, f4: (arg:
|
|
1774
|
-
declare function chain<T1 extends any[], T2, T3, T4, T5, T6, T7>(f1: (...arg: T1) => T2, f2: (arg: T2) => T3, f3: (arg: T3) => T4, f4: (arg:
|
|
1775
|
-
declare function chain<T1 extends any[], T2, T3, T4, T5, T6, T7, T8>(f1: (...arg: T1) => T2, f2: (arg: T2) => T3, f3: (arg: T3) => T4, f4: (arg:
|
|
1776
|
-
declare function chain<T1 extends any[], T2, T3, T4, T5, T6, T7, T8, T9>(f1: (...arg: T1) => T2, f2: (arg: T2) => T3, f3: (arg: T3) => T4, f4: (arg:
|
|
1777
|
-
declare function chain<T1 extends any[], T2, T3, T4, T5, T6, T7, T8, T9, T10>(f1: (...arg: T1) => T2, f2: (arg: T2) => T3, f3: (arg: T3) => T4, f4: (arg:
|
|
1778
|
-
declare function chain<T1 extends any[], T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>(f1: (...arg: T1) => T2, f2: (arg: T2) => T3, f3: (arg: T3) => T4, f4: (arg:
|
|
1772
|
+
declare function chain<T1 extends any[], T2, T3, T4, T5>(f1: (...arg: T1) => T2, f2: (arg: T2) => T3, f3: (arg: T3) => T4, f4: (arg: T4) => T5): (...arg: T1) => T5;
|
|
1773
|
+
declare function chain<T1 extends any[], T2, T3, T4, T5, T6>(f1: (...arg: T1) => T2, f2: (arg: T2) => T3, f3: (arg: T3) => T4, f4: (arg: T4) => T5, f5: (arg: T5) => T6): (...arg: T1) => T6;
|
|
1774
|
+
declare function chain<T1 extends any[], T2, T3, T4, T5, T6, T7>(f1: (...arg: T1) => T2, f2: (arg: T2) => T3, f3: (arg: T3) => T4, f4: (arg: T4) => T5, f5: (arg: T5) => T6, f6: (arg: T6) => T7): (...arg: T1) => T7;
|
|
1775
|
+
declare function chain<T1 extends any[], T2, T3, T4, T5, T6, T7, T8>(f1: (...arg: T1) => T2, f2: (arg: T2) => T3, f3: (arg: T3) => T4, f4: (arg: T4) => T5, f5: (arg: T5) => T6, f6: (arg: T6) => T7, f7: (arg: T7) => T8): (...arg: T1) => T8;
|
|
1776
|
+
declare function chain<T1 extends any[], T2, T3, T4, T5, T6, T7, T8, T9>(f1: (...arg: T1) => T2, f2: (arg: T2) => T3, f3: (arg: T3) => T4, f4: (arg: T4) => T5, f5: (arg: T5) => T6, f6: (arg: T6) => T7, f7: (arg: T7) => T8, f8: (arg: T8) => T9): (...arg: T1) => T9;
|
|
1777
|
+
declare function chain<T1 extends any[], T2, T3, T4, T5, T6, T7, T8, T9, T10>(f1: (...arg: T1) => T2, f2: (arg: T2) => T3, f3: (arg: T3) => T4, f4: (arg: T4) => T5, f5: (arg: T5) => T6, f6: (arg: T6) => T7, f7: (arg: T7) => T8, f8: (arg: T8) => T9, f9: (arg: T9) => T10): (...arg: T1) => T10;
|
|
1778
|
+
declare function chain<T1 extends any[], T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>(f1: (...arg: T1) => T2, f2: (arg: T2) => T3, f3: (arg: T3) => T4, f4: (arg: T4) => T5, f5: (arg: T5) => T6, f6: (arg: T6) => T7, f7: (arg: T7) => T8, f8: (arg: T8) => T9, f9: (arg: T9) => T10, f10: (arg: T10) => T11): (...arg: T1) => T11;
|
|
1779
1779
|
|
|
1780
1780
|
/**
|
|
1781
1781
|
* Create a function that composes multiple functions together. In a
|
|
@@ -3463,6 +3463,19 @@ declare function capitalize(str: string): string;
|
|
|
3463
3463
|
*/
|
|
3464
3464
|
declare function dash(str: string): string;
|
|
3465
3465
|
|
|
3466
|
+
/**
|
|
3467
|
+
* Removes accents and converts extended Latin ligatures to basic Latin text.
|
|
3468
|
+
*
|
|
3469
|
+
* @see https://radashi.js.org/reference/string/deburr
|
|
3470
|
+
* @example
|
|
3471
|
+
* ```ts
|
|
3472
|
+
* deburr('déjà vu') // => 'deja vu'
|
|
3473
|
+
* deburr('Ærøskøbing') // => 'Aeroskobing'
|
|
3474
|
+
* ```
|
|
3475
|
+
* @version 12.8.0
|
|
3476
|
+
*/
|
|
3477
|
+
declare function deburr(input: string): string;
|
|
3478
|
+
|
|
3466
3479
|
/**
|
|
3467
3480
|
* Remove indentation from a string. The given string is expected to
|
|
3468
3481
|
* be consistently indented (i.e. the leading whitespace of the first
|
|
@@ -3656,6 +3669,22 @@ declare function trim(str: string | null | undefined, charsToTrim?: string): str
|
|
|
3656
3669
|
declare function assert(condition: false, error?: string | Error): never;
|
|
3657
3670
|
declare function assert(condition: unknown, error?: string | Error): asserts condition;
|
|
3658
3671
|
|
|
3672
|
+
/**
|
|
3673
|
+
* Gets a readable message from an unknown error value.
|
|
3674
|
+
*
|
|
3675
|
+
* Empty error messages and unsupported values return `"Unknown error."`.
|
|
3676
|
+
*
|
|
3677
|
+
* @see https://radashi.js.org/reference/typed/getErrorMessage
|
|
3678
|
+
* @example
|
|
3679
|
+
* ```ts
|
|
3680
|
+
* getErrorMessage(new Error('Request failed')) // => 'Request failed'
|
|
3681
|
+
* getErrorMessage('Request failed') // => 'Request failed'
|
|
3682
|
+
* getErrorMessage(null) // => 'Unknown error.'
|
|
3683
|
+
* ```
|
|
3684
|
+
* @version 12.8.0
|
|
3685
|
+
*/
|
|
3686
|
+
declare function getErrorMessage(error: unknown): string;
|
|
3687
|
+
|
|
3659
3688
|
/**
|
|
3660
3689
|
* Literally just `Array.isArray` but with better type inference.
|
|
3661
3690
|
*
|
|
@@ -4215,4 +4244,4 @@ declare function isWeakMap<K extends WeakKey = WeakKey, V = unknown>(value: unkn
|
|
|
4215
4244
|
*/
|
|
4216
4245
|
declare function isWeakSet<T extends WeakKey = WeakKey>(value: unknown): value is WeakSet<T>;
|
|
4217
4246
|
|
|
4218
|
-
export { AggregateErrorOrPolyfill as AggregateError, Any, type Assign, type Awaitable, type BoxedPrimitive, type BuiltInType, type CastArray, type CastArrayIfExists, type Class, type CloningStrategy, type Comparable, type ComparableProperty, type Comparator, type ComparatorMapping, type CompatibleProperty, type Concat, type Crush, type CustomClass, type CustomClassRegistry, type DebounceFunction, type DebounceOptions, DefaultCloningStrategy, DurationParser, type DurationShortUnit, type DurationString, type DurationUnit, type Err, type ExtractArray, type ExtractClass, type ExtractMap, type ExtractNotAny, type ExtractSet, type Falsy, FastCloningStrategy, type FilteredKeys, type Flip, type GuardReturnType, type Intersect, type IsExactType, type KeyFilter, type KeyFilterFunction, type LowercaseKeys, type MappedInput, type MappedOutput, type Mapping, type MappingFunction, type MemoOptions, type NoInfer$1 as NoInfer, type Ok, type OnceFunction, type OptionalKeys, type OptionalMapping, type ParallelOptions, type Primitive, type PromiseWithResolvers, QuantityParser, type QuantityString, type RequiredKeys, type Result, type ResultPromise, type RetryOptions, Semaphore, type SemaphoreAcquireOptions, SemaphorePermit, type Series, type Simplify, type StrictExtract, type SwitchAny, type SwitchNever, type ThrottledFunction, TimeoutError, type ToEmpty, type ToEmptyAble, type TraverseContext, type TraverseOptions, type TraverseVisitor, type TryitResult, type TypedArray, type UppercaseKeys, absoluteJitter, all, alphabetical, always, assert, assign, boil, callable, camel, capitalize, cartesianProduct, castArray, castArrayIfExists, castComparator, castMapping, chain, clamp, clone, cloneDeep, cluster, compose, concat, construct, counting, crush, dash, debounce, dedent, defer, diff, draw, escapeHTML, filterKey, first, flat, flip, fork, get, getOrInsert, getOrInsertComputed, group, guard, identity, inRange, intersects, invert, isArray, isArrayEqual, isAsyncIterable, isBigInt, isBoolean, isClass, isDangerousKey, isDate, isEmpty, isEqual, isError, isFloat, isFunction, isInt, isIntString, isIterable, isMap, isMapEqual, isNullish, isNumber, isObject, isPlainObject, isPrimitive, isPromise, isRegExp, isResult, isResultErr, isResultOk, isSet, isSetEqual, isString, isSymbol, isTagged, isUndefined, isWeakMap, isWeakSet, iterate, keys, last, lerp, list, listify, lowerize, map, mapEntries, mapKeys, mapValues, mapify, max, memo, memoLastCall, merge, min, noop, objectify, omit, once, parallel, parseDuration, parseQuantity, partial, partob, pascal, pick, pluck, promiseChain, proportionalJitter, proxied, queueByKey, random, range, reduce, remove, replace, replaceOrAppend, retry, round, select, selectFirst, series, set, shake, shift, shuffle, sift, similarity, sleep, snake, sort, sum, template, throttle, timeout, title, toFloat, toInt, toResult, toggle, traverse, trim, tryit as try, tryit, uid, unique, unzip, upperize, withResolvers, zip, zipToObject };
|
|
4247
|
+
export { AggregateErrorOrPolyfill as AggregateError, Any, type Assign, type Awaitable, type BoxedPrimitive, type BuiltInType, type CastArray, type CastArrayIfExists, type Class, type CloningStrategy, type Comparable, type ComparableProperty, type Comparator, type ComparatorMapping, type CompatibleProperty, type Concat, type Crush, type CustomClass, type CustomClassRegistry, type DebounceFunction, type DebounceOptions, DefaultCloningStrategy, DurationParser, type DurationShortUnit, type DurationString, type DurationUnit, type Err, type ExtractArray, type ExtractClass, type ExtractMap, type ExtractNotAny, type ExtractSet, type Falsy, FastCloningStrategy, type FilteredKeys, type Flip, type GuardReturnType, type Intersect, type IsExactType, type KeyFilter, type KeyFilterFunction, type LowercaseKeys, type MappedInput, type MappedOutput, type Mapping, type MappingFunction, type MemoOptions, type NoInfer$1 as NoInfer, type Ok, type OnceFunction, type OptionalKeys, type OptionalMapping, type ParallelOptions, type Primitive, type PromiseWithResolvers, QuantityParser, type QuantityString, type RequiredKeys, type Result, type ResultPromise, type RetryOptions, Semaphore, type SemaphoreAcquireOptions, SemaphorePermit, type Series, type Simplify, type StrictExtract, type SwitchAny, type SwitchNever, type ThrottledFunction, TimeoutError, type ToEmpty, type ToEmptyAble, type TraverseContext, type TraverseOptions, type TraverseVisitor, type TryitResult, type TypedArray, type UppercaseKeys, absoluteJitter, all, alphabetical, always, assert, assign, boil, callable, camel, capitalize, cartesianProduct, castArray, castArrayIfExists, castComparator, castMapping, chain, clamp, clone, cloneDeep, cluster, compose, concat, construct, counting, crush, dash, debounce, deburr, dedent, defer, diff, draw, escapeHTML, filterKey, first, flat, flip, fork, get, getErrorMessage, getOrInsert, getOrInsertComputed, group, guard, identity, inRange, intersects, invert, isArray, isArrayEqual, isAsyncIterable, isBigInt, isBoolean, isClass, isDangerousKey, isDate, isEmpty, isEqual, isError, isFloat, isFunction, isInt, isIntString, isIterable, isMap, isMapEqual, isNullish, isNumber, isObject, isPlainObject, isPrimitive, isPromise, isRegExp, isResult, isResultErr, isResultOk, isSet, isSetEqual, isString, isSymbol, isTagged, isUndefined, isWeakMap, isWeakSet, iterate, keys, last, lerp, list, listify, lowerize, map, mapEntries, mapKeys, mapValues, mapify, max, memo, memoLastCall, merge, min, noop, objectify, omit, once, parallel, parseDuration, parseQuantity, partial, partob, pascal, pick, pluck, promiseChain, proportionalJitter, proxied, queueByKey, random, range, reduce, remove, replace, replaceOrAppend, retry, round, select, selectFirst, series, set, shake, shift, shuffle, sift, similarity, sleep, snake, sort, sum, template, throttle, timeout, title, toFloat, toInt, toResult, toggle, traverse, trim, tryit as try, tryit, uid, unique, unzip, upperize, withResolvers, zip, zipToObject };
|
package/dist/radashi.d.ts
CHANGED
|
@@ -1769,13 +1769,13 @@ declare function callable<TValue, TObj extends Record<string | number | symbol,
|
|
|
1769
1769
|
*/
|
|
1770
1770
|
declare function chain<T1 extends any[], T2, T3>(f1: (...arg: T1) => T2, f2: (arg: T2) => T3): (...arg: T1) => T3;
|
|
1771
1771
|
declare function chain<T1 extends any[], T2, T3, T4>(f1: (...arg: T1) => T2, f2: (arg: T2) => T3, f3: (arg: T3) => T4): (...arg: T1) => T4;
|
|
1772
|
-
declare function chain<T1 extends any[], T2, T3, T4, T5>(f1: (...arg: T1) => T2, f2: (arg: T2) => T3, f3: (arg: T3) => T4, f4: (arg:
|
|
1773
|
-
declare function chain<T1 extends any[], T2, T3, T4, T5, T6>(f1: (...arg: T1) => T2, f2: (arg: T2) => T3, f3: (arg: T3) => T4, f4: (arg:
|
|
1774
|
-
declare function chain<T1 extends any[], T2, T3, T4, T5, T6, T7>(f1: (...arg: T1) => T2, f2: (arg: T2) => T3, f3: (arg: T3) => T4, f4: (arg:
|
|
1775
|
-
declare function chain<T1 extends any[], T2, T3, T4, T5, T6, T7, T8>(f1: (...arg: T1) => T2, f2: (arg: T2) => T3, f3: (arg: T3) => T4, f4: (arg:
|
|
1776
|
-
declare function chain<T1 extends any[], T2, T3, T4, T5, T6, T7, T8, T9>(f1: (...arg: T1) => T2, f2: (arg: T2) => T3, f3: (arg: T3) => T4, f4: (arg:
|
|
1777
|
-
declare function chain<T1 extends any[], T2, T3, T4, T5, T6, T7, T8, T9, T10>(f1: (...arg: T1) => T2, f2: (arg: T2) => T3, f3: (arg: T3) => T4, f4: (arg:
|
|
1778
|
-
declare function chain<T1 extends any[], T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>(f1: (...arg: T1) => T2, f2: (arg: T2) => T3, f3: (arg: T3) => T4, f4: (arg:
|
|
1772
|
+
declare function chain<T1 extends any[], T2, T3, T4, T5>(f1: (...arg: T1) => T2, f2: (arg: T2) => T3, f3: (arg: T3) => T4, f4: (arg: T4) => T5): (...arg: T1) => T5;
|
|
1773
|
+
declare function chain<T1 extends any[], T2, T3, T4, T5, T6>(f1: (...arg: T1) => T2, f2: (arg: T2) => T3, f3: (arg: T3) => T4, f4: (arg: T4) => T5, f5: (arg: T5) => T6): (...arg: T1) => T6;
|
|
1774
|
+
declare function chain<T1 extends any[], T2, T3, T4, T5, T6, T7>(f1: (...arg: T1) => T2, f2: (arg: T2) => T3, f3: (arg: T3) => T4, f4: (arg: T4) => T5, f5: (arg: T5) => T6, f6: (arg: T6) => T7): (...arg: T1) => T7;
|
|
1775
|
+
declare function chain<T1 extends any[], T2, T3, T4, T5, T6, T7, T8>(f1: (...arg: T1) => T2, f2: (arg: T2) => T3, f3: (arg: T3) => T4, f4: (arg: T4) => T5, f5: (arg: T5) => T6, f6: (arg: T6) => T7, f7: (arg: T7) => T8): (...arg: T1) => T8;
|
|
1776
|
+
declare function chain<T1 extends any[], T2, T3, T4, T5, T6, T7, T8, T9>(f1: (...arg: T1) => T2, f2: (arg: T2) => T3, f3: (arg: T3) => T4, f4: (arg: T4) => T5, f5: (arg: T5) => T6, f6: (arg: T6) => T7, f7: (arg: T7) => T8, f8: (arg: T8) => T9): (...arg: T1) => T9;
|
|
1777
|
+
declare function chain<T1 extends any[], T2, T3, T4, T5, T6, T7, T8, T9, T10>(f1: (...arg: T1) => T2, f2: (arg: T2) => T3, f3: (arg: T3) => T4, f4: (arg: T4) => T5, f5: (arg: T5) => T6, f6: (arg: T6) => T7, f7: (arg: T7) => T8, f8: (arg: T8) => T9, f9: (arg: T9) => T10): (...arg: T1) => T10;
|
|
1778
|
+
declare function chain<T1 extends any[], T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>(f1: (...arg: T1) => T2, f2: (arg: T2) => T3, f3: (arg: T3) => T4, f4: (arg: T4) => T5, f5: (arg: T5) => T6, f6: (arg: T6) => T7, f7: (arg: T7) => T8, f8: (arg: T8) => T9, f9: (arg: T9) => T10, f10: (arg: T10) => T11): (...arg: T1) => T11;
|
|
1779
1779
|
|
|
1780
1780
|
/**
|
|
1781
1781
|
* Create a function that composes multiple functions together. In a
|
|
@@ -3463,6 +3463,19 @@ declare function capitalize(str: string): string;
|
|
|
3463
3463
|
*/
|
|
3464
3464
|
declare function dash(str: string): string;
|
|
3465
3465
|
|
|
3466
|
+
/**
|
|
3467
|
+
* Removes accents and converts extended Latin ligatures to basic Latin text.
|
|
3468
|
+
*
|
|
3469
|
+
* @see https://radashi.js.org/reference/string/deburr
|
|
3470
|
+
* @example
|
|
3471
|
+
* ```ts
|
|
3472
|
+
* deburr('déjà vu') // => 'deja vu'
|
|
3473
|
+
* deburr('Ærøskøbing') // => 'Aeroskobing'
|
|
3474
|
+
* ```
|
|
3475
|
+
* @version 12.8.0
|
|
3476
|
+
*/
|
|
3477
|
+
declare function deburr(input: string): string;
|
|
3478
|
+
|
|
3466
3479
|
/**
|
|
3467
3480
|
* Remove indentation from a string. The given string is expected to
|
|
3468
3481
|
* be consistently indented (i.e. the leading whitespace of the first
|
|
@@ -3656,6 +3669,22 @@ declare function trim(str: string | null | undefined, charsToTrim?: string): str
|
|
|
3656
3669
|
declare function assert(condition: false, error?: string | Error): never;
|
|
3657
3670
|
declare function assert(condition: unknown, error?: string | Error): asserts condition;
|
|
3658
3671
|
|
|
3672
|
+
/**
|
|
3673
|
+
* Gets a readable message from an unknown error value.
|
|
3674
|
+
*
|
|
3675
|
+
* Empty error messages and unsupported values return `"Unknown error."`.
|
|
3676
|
+
*
|
|
3677
|
+
* @see https://radashi.js.org/reference/typed/getErrorMessage
|
|
3678
|
+
* @example
|
|
3679
|
+
* ```ts
|
|
3680
|
+
* getErrorMessage(new Error('Request failed')) // => 'Request failed'
|
|
3681
|
+
* getErrorMessage('Request failed') // => 'Request failed'
|
|
3682
|
+
* getErrorMessage(null) // => 'Unknown error.'
|
|
3683
|
+
* ```
|
|
3684
|
+
* @version 12.8.0
|
|
3685
|
+
*/
|
|
3686
|
+
declare function getErrorMessage(error: unknown): string;
|
|
3687
|
+
|
|
3659
3688
|
/**
|
|
3660
3689
|
* Literally just `Array.isArray` but with better type inference.
|
|
3661
3690
|
*
|
|
@@ -4215,4 +4244,4 @@ declare function isWeakMap<K extends WeakKey = WeakKey, V = unknown>(value: unkn
|
|
|
4215
4244
|
*/
|
|
4216
4245
|
declare function isWeakSet<T extends WeakKey = WeakKey>(value: unknown): value is WeakSet<T>;
|
|
4217
4246
|
|
|
4218
|
-
export { AggregateErrorOrPolyfill as AggregateError, Any, type Assign, type Awaitable, type BoxedPrimitive, type BuiltInType, type CastArray, type CastArrayIfExists, type Class, type CloningStrategy, type Comparable, type ComparableProperty, type Comparator, type ComparatorMapping, type CompatibleProperty, type Concat, type Crush, type CustomClass, type CustomClassRegistry, type DebounceFunction, type DebounceOptions, DefaultCloningStrategy, DurationParser, type DurationShortUnit, type DurationString, type DurationUnit, type Err, type ExtractArray, type ExtractClass, type ExtractMap, type ExtractNotAny, type ExtractSet, type Falsy, FastCloningStrategy, type FilteredKeys, type Flip, type GuardReturnType, type Intersect, type IsExactType, type KeyFilter, type KeyFilterFunction, type LowercaseKeys, type MappedInput, type MappedOutput, type Mapping, type MappingFunction, type MemoOptions, type NoInfer$1 as NoInfer, type Ok, type OnceFunction, type OptionalKeys, type OptionalMapping, type ParallelOptions, type Primitive, type PromiseWithResolvers, QuantityParser, type QuantityString, type RequiredKeys, type Result, type ResultPromise, type RetryOptions, Semaphore, type SemaphoreAcquireOptions, SemaphorePermit, type Series, type Simplify, type StrictExtract, type SwitchAny, type SwitchNever, type ThrottledFunction, TimeoutError, type ToEmpty, type ToEmptyAble, type TraverseContext, type TraverseOptions, type TraverseVisitor, type TryitResult, type TypedArray, type UppercaseKeys, absoluteJitter, all, alphabetical, always, assert, assign, boil, callable, camel, capitalize, cartesianProduct, castArray, castArrayIfExists, castComparator, castMapping, chain, clamp, clone, cloneDeep, cluster, compose, concat, construct, counting, crush, dash, debounce, dedent, defer, diff, draw, escapeHTML, filterKey, first, flat, flip, fork, get, getOrInsert, getOrInsertComputed, group, guard, identity, inRange, intersects, invert, isArray, isArrayEqual, isAsyncIterable, isBigInt, isBoolean, isClass, isDangerousKey, isDate, isEmpty, isEqual, isError, isFloat, isFunction, isInt, isIntString, isIterable, isMap, isMapEqual, isNullish, isNumber, isObject, isPlainObject, isPrimitive, isPromise, isRegExp, isResult, isResultErr, isResultOk, isSet, isSetEqual, isString, isSymbol, isTagged, isUndefined, isWeakMap, isWeakSet, iterate, keys, last, lerp, list, listify, lowerize, map, mapEntries, mapKeys, mapValues, mapify, max, memo, memoLastCall, merge, min, noop, objectify, omit, once, parallel, parseDuration, parseQuantity, partial, partob, pascal, pick, pluck, promiseChain, proportionalJitter, proxied, queueByKey, random, range, reduce, remove, replace, replaceOrAppend, retry, round, select, selectFirst, series, set, shake, shift, shuffle, sift, similarity, sleep, snake, sort, sum, template, throttle, timeout, title, toFloat, toInt, toResult, toggle, traverse, trim, tryit as try, tryit, uid, unique, unzip, upperize, withResolvers, zip, zipToObject };
|
|
4247
|
+
export { AggregateErrorOrPolyfill as AggregateError, Any, type Assign, type Awaitable, type BoxedPrimitive, type BuiltInType, type CastArray, type CastArrayIfExists, type Class, type CloningStrategy, type Comparable, type ComparableProperty, type Comparator, type ComparatorMapping, type CompatibleProperty, type Concat, type Crush, type CustomClass, type CustomClassRegistry, type DebounceFunction, type DebounceOptions, DefaultCloningStrategy, DurationParser, type DurationShortUnit, type DurationString, type DurationUnit, type Err, type ExtractArray, type ExtractClass, type ExtractMap, type ExtractNotAny, type ExtractSet, type Falsy, FastCloningStrategy, type FilteredKeys, type Flip, type GuardReturnType, type Intersect, type IsExactType, type KeyFilter, type KeyFilterFunction, type LowercaseKeys, type MappedInput, type MappedOutput, type Mapping, type MappingFunction, type MemoOptions, type NoInfer$1 as NoInfer, type Ok, type OnceFunction, type OptionalKeys, type OptionalMapping, type ParallelOptions, type Primitive, type PromiseWithResolvers, QuantityParser, type QuantityString, type RequiredKeys, type Result, type ResultPromise, type RetryOptions, Semaphore, type SemaphoreAcquireOptions, SemaphorePermit, type Series, type Simplify, type StrictExtract, type SwitchAny, type SwitchNever, type ThrottledFunction, TimeoutError, type ToEmpty, type ToEmptyAble, type TraverseContext, type TraverseOptions, type TraverseVisitor, type TryitResult, type TypedArray, type UppercaseKeys, absoluteJitter, all, alphabetical, always, assert, assign, boil, callable, camel, capitalize, cartesianProduct, castArray, castArrayIfExists, castComparator, castMapping, chain, clamp, clone, cloneDeep, cluster, compose, concat, construct, counting, crush, dash, debounce, deburr, dedent, defer, diff, draw, escapeHTML, filterKey, first, flat, flip, fork, get, getErrorMessage, getOrInsert, getOrInsertComputed, group, guard, identity, inRange, intersects, invert, isArray, isArrayEqual, isAsyncIterable, isBigInt, isBoolean, isClass, isDangerousKey, isDate, isEmpty, isEqual, isError, isFloat, isFunction, isInt, isIntString, isIterable, isMap, isMapEqual, isNullish, isNumber, isObject, isPlainObject, isPrimitive, isPromise, isRegExp, isResult, isResultErr, isResultOk, isSet, isSetEqual, isString, isSymbol, isTagged, isUndefined, isWeakMap, isWeakSet, iterate, keys, last, lerp, list, listify, lowerize, map, mapEntries, mapKeys, mapValues, mapify, max, memo, memoLastCall, merge, min, noop, objectify, omit, once, parallel, parseDuration, parseQuantity, partial, partob, pascal, pick, pluck, promiseChain, proportionalJitter, proxied, queueByKey, random, range, reduce, remove, replace, replaceOrAppend, retry, round, select, selectFirst, series, set, shake, shift, shuffle, sift, similarity, sleep, snake, sort, sum, template, throttle, timeout, title, toFloat, toInt, toResult, toggle, traverse, trim, tryit as try, tryit, uid, unique, unzip, upperize, withResolvers, zip, zipToObject };
|
package/dist/radashi.js
CHANGED
|
@@ -1752,6 +1752,53 @@ function dash(str) {
|
|
|
1752
1752
|
});
|
|
1753
1753
|
}
|
|
1754
1754
|
|
|
1755
|
+
// src/string/deburr.ts
|
|
1756
|
+
var DEBURR_MAP = new Map(
|
|
1757
|
+
Object.entries({
|
|
1758
|
+
\u00C6: "Ae",
|
|
1759
|
+
\u00D0: "D",
|
|
1760
|
+
\u00D8: "O",
|
|
1761
|
+
\u00DE: "Th",
|
|
1762
|
+
\u00DF: "ss",
|
|
1763
|
+
\u00E6: "ae",
|
|
1764
|
+
\u00F0: "d",
|
|
1765
|
+
\u00F8: "o",
|
|
1766
|
+
\u00FE: "th",
|
|
1767
|
+
\u0110: "D",
|
|
1768
|
+
\u0111: "d",
|
|
1769
|
+
\u0126: "H",
|
|
1770
|
+
\u0127: "h",
|
|
1771
|
+
\u0131: "i",
|
|
1772
|
+
\u0132: "IJ",
|
|
1773
|
+
\u0133: "ij",
|
|
1774
|
+
\u0138: "k",
|
|
1775
|
+
\u013F: "L",
|
|
1776
|
+
\u0140: "l",
|
|
1777
|
+
\u0141: "L",
|
|
1778
|
+
\u0142: "l",
|
|
1779
|
+
\u0149: "'n",
|
|
1780
|
+
\u014A: "N",
|
|
1781
|
+
\u014B: "n",
|
|
1782
|
+
\u0152: "Oe",
|
|
1783
|
+
\u0153: "oe",
|
|
1784
|
+
\u0166: "T",
|
|
1785
|
+
\u0167: "t",
|
|
1786
|
+
\u017F: "s"
|
|
1787
|
+
})
|
|
1788
|
+
);
|
|
1789
|
+
function deburr(input) {
|
|
1790
|
+
let result = "";
|
|
1791
|
+
const chars = input.normalize("NFD");
|
|
1792
|
+
for (let index = 0; index < chars.length; index++) {
|
|
1793
|
+
const char = chars[index];
|
|
1794
|
+
if (char >= "\u0300" && char <= "\u036F" || char >= "\uFE20" && char <= "\uFE23") {
|
|
1795
|
+
continue;
|
|
1796
|
+
}
|
|
1797
|
+
result += DEBURR_MAP.get(char) ?? char;
|
|
1798
|
+
}
|
|
1799
|
+
return result;
|
|
1800
|
+
}
|
|
1801
|
+
|
|
1755
1802
|
// src/string/dedent.ts
|
|
1756
1803
|
function dedent(text, ...values) {
|
|
1757
1804
|
var _a;
|
|
@@ -1906,6 +1953,14 @@ function assert(condition, message) {
|
|
|
1906
1953
|
}
|
|
1907
1954
|
}
|
|
1908
1955
|
|
|
1956
|
+
// src/typed/getErrorMessage.ts
|
|
1957
|
+
function getErrorMessage(error) {
|
|
1958
|
+
if (error instanceof Error && error.message) {
|
|
1959
|
+
return error.message;
|
|
1960
|
+
}
|
|
1961
|
+
return typeof error === "string" && error.length > 0 ? error : "Unknown error.";
|
|
1962
|
+
}
|
|
1963
|
+
|
|
1909
1964
|
// src/typed/isArray.ts
|
|
1910
1965
|
var isArray = /* @__PURE__ */ (() => Array.isArray)();
|
|
1911
1966
|
|
|
@@ -2145,4 +2200,4 @@ function isWeakSet(value) {
|
|
|
2145
2200
|
return isTagged(value, "[object WeakSet]");
|
|
2146
2201
|
}
|
|
2147
2202
|
|
|
2148
|
-
export { AggregateErrorOrPolyfill as AggregateError, DefaultCloningStrategy, DurationParser, FastCloningStrategy, QuantityParser, Semaphore, SemaphorePermit, TimeoutError, absoluteJitter, all, alphabetical, always, assert, assign, boil, callable, camel, capitalize, cartesianProduct, castArray, castArrayIfExists, castComparator, castMapping, chain, clamp, clone, cloneDeep, cluster, compose, concat, construct, counting, crush, dash, debounce, dedent, defer, diff, draw, escapeHTML, filterKey, first, flat, flip, fork, get, getOrInsert, getOrInsertComputed, group, guard, identity, inRange, intersects, invert, isArray, isArrayEqual, isAsyncIterable, isBigInt, isBoolean, isClass, isDangerousKey, isDate, isEmpty, isEqual, isError, isFloat, isFunction, isInt, isIntString, isIterable, isMap, isMapEqual, isNullish, isNumber, isObject, isPlainObject, isPrimitive, isPromise, isRegExp, isResult, isResultErr, isResultOk, isSet, isSetEqual, isString, isSymbol, isTagged, isUndefined, isWeakMap, isWeakSet, iterate, keys, last, lerp, list, listify, lowerize, map, mapEntries, mapKeys, mapValues, mapify, max, memo, memoLastCall, merge, min, noop, objectify, omit, once, parallel, parseDuration, parseQuantity, partial, partob, pascal, pick, pluck, promiseChain, proportionalJitter, proxied, queueByKey, random, range, reduce, remove, replace, replaceOrAppend, retry, round, select, selectFirst, series, set, shake, shift, shuffle, sift, similarity, sleep, snake, sort, sum, template, throttle, timeout, title, toFloat, toInt, toResult, toggle, traverse, trim, tryit as try, tryit, uid, unique, unzip, upperize, withResolvers, zip, zipToObject };
|
|
2203
|
+
export { AggregateErrorOrPolyfill as AggregateError, DefaultCloningStrategy, DurationParser, FastCloningStrategy, QuantityParser, Semaphore, SemaphorePermit, TimeoutError, absoluteJitter, all, alphabetical, always, assert, assign, boil, callable, camel, capitalize, cartesianProduct, castArray, castArrayIfExists, castComparator, castMapping, chain, clamp, clone, cloneDeep, cluster, compose, concat, construct, counting, crush, dash, debounce, deburr, dedent, defer, diff, draw, escapeHTML, filterKey, first, flat, flip, fork, get, getErrorMessage, getOrInsert, getOrInsertComputed, group, guard, identity, inRange, intersects, invert, isArray, isArrayEqual, isAsyncIterable, isBigInt, isBoolean, isClass, isDangerousKey, isDate, isEmpty, isEqual, isError, isFloat, isFunction, isInt, isIntString, isIterable, isMap, isMapEqual, isNullish, isNumber, isObject, isPlainObject, isPrimitive, isPromise, isRegExp, isResult, isResultErr, isResultOk, isSet, isSetEqual, isString, isSymbol, isTagged, isUndefined, isWeakMap, isWeakSet, iterate, keys, last, lerp, list, listify, lowerize, map, mapEntries, mapKeys, mapValues, mapify, max, memo, memoLastCall, merge, min, noop, objectify, omit, once, parallel, parseDuration, parseQuantity, partial, partob, pascal, pick, pluck, promiseChain, proportionalJitter, proxied, queueByKey, random, range, reduce, remove, replace, replaceOrAppend, retry, round, select, selectFirst, series, set, shake, shift, shuffle, sift, similarity, sleep, snake, sort, sum, template, throttle, timeout, title, toFloat, toInt, toResult, toggle, traverse, trim, tryit as try, tryit, uid, unique, unzip, upperize, withResolvers, zip, zipToObject };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "radashi",
|
|
3
|
-
"version": "12.
|
|
3
|
+
"version": "12.8.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "The modern, community-first TypeScript toolkit with all of the fast, readable, and minimal utility functions you need. Type-safe, dependency-free, tree-shakeable, fully tested.",
|
|
6
6
|
"repository": {
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"Ray Epps"
|
|
13
13
|
],
|
|
14
14
|
"license": "MIT",
|
|
15
|
-
"packageManager": "pnpm@
|
|
15
|
+
"packageManager": "pnpm@10.29.3",
|
|
16
16
|
"engines": {
|
|
17
17
|
"node": ">=16.0.0"
|
|
18
18
|
},
|