radashi 12.8.0 → 12.9.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 +16 -4
- package/dist/radashi.d.cts +65 -2
- package/dist/radashi.d.ts +65 -2
- package/dist/radashi.js +16 -5
- package/package.json +1 -1
package/dist/radashi.cjs
CHANGED
|
@@ -338,9 +338,8 @@ function sort(array, getter = identity, desc = false) {
|
|
|
338
338
|
if (!array) {
|
|
339
339
|
return [];
|
|
340
340
|
}
|
|
341
|
-
const
|
|
342
|
-
|
|
343
|
-
return array.slice().sort(desc === true ? dsc : asc);
|
|
341
|
+
const direction = desc ? -1 : 1;
|
|
342
|
+
return array.slice().sort((a, b) => (getter(a) - getter(b)) * direction);
|
|
344
343
|
}
|
|
345
344
|
|
|
346
345
|
// src/array/toggle.ts
|
|
@@ -1244,6 +1243,17 @@ function mapValues(obj, mapFunc) {
|
|
|
1244
1243
|
);
|
|
1245
1244
|
}
|
|
1246
1245
|
|
|
1246
|
+
// src/object/mergeOptions.ts
|
|
1247
|
+
function mergeOptions(a, b) {
|
|
1248
|
+
if (a === void 0) {
|
|
1249
|
+
return b;
|
|
1250
|
+
}
|
|
1251
|
+
if (b === void 0) {
|
|
1252
|
+
return a;
|
|
1253
|
+
}
|
|
1254
|
+
return { ...a, ...b };
|
|
1255
|
+
}
|
|
1256
|
+
|
|
1247
1257
|
// src/object/omit.ts
|
|
1248
1258
|
function omit(obj, keys2) {
|
|
1249
1259
|
if (!obj) {
|
|
@@ -1802,11 +1812,12 @@ function deburr(input) {
|
|
|
1802
1812
|
}
|
|
1803
1813
|
|
|
1804
1814
|
// src/string/dedent.ts
|
|
1815
|
+
// @__NO_SIDE_EFFECTS__
|
|
1805
1816
|
function dedent(text, ...values) {
|
|
1806
1817
|
var _a;
|
|
1807
1818
|
if (isArray(text)) {
|
|
1808
1819
|
if (values.length > 0) {
|
|
1809
|
-
return dedent(
|
|
1820
|
+
return /* @__PURE__ */ dedent(
|
|
1810
1821
|
text.reduce((acc, input, i) => {
|
|
1811
1822
|
var _a2;
|
|
1812
1823
|
let value = String(values[i] ?? "");
|
|
@@ -2310,6 +2321,7 @@ exports.max = max;
|
|
|
2310
2321
|
exports.memo = memo;
|
|
2311
2322
|
exports.memoLastCall = memoLastCall;
|
|
2312
2323
|
exports.merge = merge;
|
|
2324
|
+
exports.mergeOptions = mergeOptions;
|
|
2313
2325
|
exports.min = min;
|
|
2314
2326
|
exports.noop = noop;
|
|
2315
2327
|
exports.objectify = objectify;
|
package/dist/radashi.d.cts
CHANGED
|
@@ -557,7 +557,15 @@ declare function sift<T>(array: readonly (T | Falsy)[]): T[];
|
|
|
557
557
|
* ```
|
|
558
558
|
* @version 12.1.0
|
|
559
559
|
*/
|
|
560
|
-
declare function sort<T>(array:
|
|
560
|
+
declare function sort<const T extends readonly any[]>(array: T, getter?: (item: T[number]) => number, desc?: boolean): SortArray<T>;
|
|
561
|
+
/**
|
|
562
|
+
* The return type of the `sort` function. Tuple types are preserved.
|
|
563
|
+
*/
|
|
564
|
+
type SortArray<T extends readonly any[]> = T extends readonly [] ? [] : T extends readonly [any, ...infer TRest] ? [T[number], ...SortArrayRest<T[number], TRest>] : T[number][];
|
|
565
|
+
type SortArrayRest<TElement, T extends readonly any[]> = T extends readonly [
|
|
566
|
+
any,
|
|
567
|
+
...infer TRest
|
|
568
|
+
] ? [TElement, ...SortArrayRest<TElement, TRest>] : T extends readonly [] ? [] : TElement[];
|
|
561
569
|
|
|
562
570
|
/**
|
|
563
571
|
* Either adds or removes an item from an array, based on whether it
|
|
@@ -2911,6 +2919,61 @@ declare function mapValues<T extends object, U>(obj: T, mapFunc: (value: Require
|
|
|
2911
2919
|
[K in keyof T]: U;
|
|
2912
2920
|
};
|
|
2913
2921
|
|
|
2922
|
+
/**
|
|
2923
|
+
* Merges two option objects into a new object.
|
|
2924
|
+
* - If both arguments are defined, properties
|
|
2925
|
+
* from the second object (`b`) will override those
|
|
2926
|
+
* from the first one (`a`) when keys overlap
|
|
2927
|
+
* - If either argument is `undefined`, the other is returned
|
|
2928
|
+
* - If both are `undefined`, the result is `undefined`
|
|
2929
|
+
*
|
|
2930
|
+
* @param a - The first options object, or `undefined`.
|
|
2931
|
+
* @param b - The second options object, or `undefined`.
|
|
2932
|
+
* @returns A merged object when both arguments are defined, otherwise the defined argument, or `undefined` if both are `undefined`.
|
|
2933
|
+
* @version 12.9.0
|
|
2934
|
+
*
|
|
2935
|
+
* @see https://radashi.js.org/reference/object/mergeOptions
|
|
2936
|
+
*
|
|
2937
|
+
* @example
|
|
2938
|
+
* ```ts
|
|
2939
|
+
* // Merging two objects with overlapping keys
|
|
2940
|
+
* mergeOptions({ a: 1, b: 2 }, { b: 3, c: 4 })
|
|
2941
|
+
* // => { a: 1, b: 3, c: 4 }
|
|
2942
|
+
*
|
|
2943
|
+
* // First argument undefined
|
|
2944
|
+
* mergeOptions(undefined, { a: 1 })
|
|
2945
|
+
* // => { a: 1 }
|
|
2946
|
+
*
|
|
2947
|
+
* // Second argument undefined
|
|
2948
|
+
* mergeOptions({ a: 1 }, undefined)
|
|
2949
|
+
* // => { a: 1 }
|
|
2950
|
+
*
|
|
2951
|
+
* // Both arguments undefined
|
|
2952
|
+
* mergeOptions(undefined, undefined)
|
|
2953
|
+
* // => undefined
|
|
2954
|
+
* ```
|
|
2955
|
+
*/
|
|
2956
|
+
declare function mergeOptions<A extends object | undefined, B extends object | undefined>(a: A, b: B): MergeOptions<A, B>;
|
|
2957
|
+
/**
|
|
2958
|
+
* Computes the merged type of two option objects, handling `undefined` and partials.
|
|
2959
|
+
*
|
|
2960
|
+
* @version 12.9.0
|
|
2961
|
+
*/
|
|
2962
|
+
type MergeOptions<A extends object | undefined, B extends object | undefined> = (undefined extends A ? B : never) | (undefined extends B ? NonNullable<A> : never) | MergePresent<NonNullable<A>, NonNullable<B>>;
|
|
2963
|
+
type Expand<T> = T extends object ? {
|
|
2964
|
+
[K in keyof T]: Expand<T[K]>;
|
|
2965
|
+
} : T;
|
|
2966
|
+
type MergePresent<A, B> = [A, B] extends [never, never] ? never : A extends object ? B extends object ? Expand<MergeObjects<A, B>> : never : never;
|
|
2967
|
+
type MergeObjects<A extends object, B extends object> = {
|
|
2968
|
+
[K in MergeRequiredKeys<A, B>]: MergeValue<A, B, K>;
|
|
2969
|
+
} & {
|
|
2970
|
+
[K in MergeOptionalKeys<A, B>]?: MergeValue<A, B, K>;
|
|
2971
|
+
};
|
|
2972
|
+
type MergeRequiredKeys<A extends object, B extends object> = RequiredKeys<B> | Exclude<RequiredKeys<A>, keyof B> | (RequiredKeys<A> & OptionalKeys<B>);
|
|
2973
|
+
type MergeOptionalKeys<A extends object, B extends object> = Exclude<OptionalKeys<A>, keyof B> | Exclude<OptionalKeys<B>, RequiredKeys<A>>;
|
|
2974
|
+
type MergeValue<A extends object, B extends object, K extends keyof A | keyof B> = K extends keyof B ? K extends OptionalKeys<B> ? K extends keyof A ? PropValue<A, K> | PropValue<B, K> : PropValue<B, K> : B[K] : K extends keyof A ? PropValue<A, K> : never;
|
|
2975
|
+
type PropValue<T extends object, K extends keyof T> = K extends OptionalKeys<T> ? Required<Pick<T, K>>[K] : T[K];
|
|
2976
|
+
|
|
2914
2977
|
/**
|
|
2915
2978
|
* Omit a list of properties from an object returning a new object
|
|
2916
2979
|
* with the properties that remain.
|
|
@@ -4244,4 +4307,4 @@ declare function isWeakMap<K extends WeakKey = WeakKey, V = unknown>(value: unkn
|
|
|
4244
4307
|
*/
|
|
4245
4308
|
declare function isWeakSet<T extends WeakKey = WeakKey>(value: unknown): value is WeakSet<T>;
|
|
4246
4309
|
|
|
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 };
|
|
4310
|
+
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 MergeOptions, 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 SortArray, 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, mergeOptions, 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
|
@@ -557,7 +557,15 @@ declare function sift<T>(array: readonly (T | Falsy)[]): T[];
|
|
|
557
557
|
* ```
|
|
558
558
|
* @version 12.1.0
|
|
559
559
|
*/
|
|
560
|
-
declare function sort<T>(array:
|
|
560
|
+
declare function sort<const T extends readonly any[]>(array: T, getter?: (item: T[number]) => number, desc?: boolean): SortArray<T>;
|
|
561
|
+
/**
|
|
562
|
+
* The return type of the `sort` function. Tuple types are preserved.
|
|
563
|
+
*/
|
|
564
|
+
type SortArray<T extends readonly any[]> = T extends readonly [] ? [] : T extends readonly [any, ...infer TRest] ? [T[number], ...SortArrayRest<T[number], TRest>] : T[number][];
|
|
565
|
+
type SortArrayRest<TElement, T extends readonly any[]> = T extends readonly [
|
|
566
|
+
any,
|
|
567
|
+
...infer TRest
|
|
568
|
+
] ? [TElement, ...SortArrayRest<TElement, TRest>] : T extends readonly [] ? [] : TElement[];
|
|
561
569
|
|
|
562
570
|
/**
|
|
563
571
|
* Either adds or removes an item from an array, based on whether it
|
|
@@ -2911,6 +2919,61 @@ declare function mapValues<T extends object, U>(obj: T, mapFunc: (value: Require
|
|
|
2911
2919
|
[K in keyof T]: U;
|
|
2912
2920
|
};
|
|
2913
2921
|
|
|
2922
|
+
/**
|
|
2923
|
+
* Merges two option objects into a new object.
|
|
2924
|
+
* - If both arguments are defined, properties
|
|
2925
|
+
* from the second object (`b`) will override those
|
|
2926
|
+
* from the first one (`a`) when keys overlap
|
|
2927
|
+
* - If either argument is `undefined`, the other is returned
|
|
2928
|
+
* - If both are `undefined`, the result is `undefined`
|
|
2929
|
+
*
|
|
2930
|
+
* @param a - The first options object, or `undefined`.
|
|
2931
|
+
* @param b - The second options object, or `undefined`.
|
|
2932
|
+
* @returns A merged object when both arguments are defined, otherwise the defined argument, or `undefined` if both are `undefined`.
|
|
2933
|
+
* @version 12.9.0
|
|
2934
|
+
*
|
|
2935
|
+
* @see https://radashi.js.org/reference/object/mergeOptions
|
|
2936
|
+
*
|
|
2937
|
+
* @example
|
|
2938
|
+
* ```ts
|
|
2939
|
+
* // Merging two objects with overlapping keys
|
|
2940
|
+
* mergeOptions({ a: 1, b: 2 }, { b: 3, c: 4 })
|
|
2941
|
+
* // => { a: 1, b: 3, c: 4 }
|
|
2942
|
+
*
|
|
2943
|
+
* // First argument undefined
|
|
2944
|
+
* mergeOptions(undefined, { a: 1 })
|
|
2945
|
+
* // => { a: 1 }
|
|
2946
|
+
*
|
|
2947
|
+
* // Second argument undefined
|
|
2948
|
+
* mergeOptions({ a: 1 }, undefined)
|
|
2949
|
+
* // => { a: 1 }
|
|
2950
|
+
*
|
|
2951
|
+
* // Both arguments undefined
|
|
2952
|
+
* mergeOptions(undefined, undefined)
|
|
2953
|
+
* // => undefined
|
|
2954
|
+
* ```
|
|
2955
|
+
*/
|
|
2956
|
+
declare function mergeOptions<A extends object | undefined, B extends object | undefined>(a: A, b: B): MergeOptions<A, B>;
|
|
2957
|
+
/**
|
|
2958
|
+
* Computes the merged type of two option objects, handling `undefined` and partials.
|
|
2959
|
+
*
|
|
2960
|
+
* @version 12.9.0
|
|
2961
|
+
*/
|
|
2962
|
+
type MergeOptions<A extends object | undefined, B extends object | undefined> = (undefined extends A ? B : never) | (undefined extends B ? NonNullable<A> : never) | MergePresent<NonNullable<A>, NonNullable<B>>;
|
|
2963
|
+
type Expand<T> = T extends object ? {
|
|
2964
|
+
[K in keyof T]: Expand<T[K]>;
|
|
2965
|
+
} : T;
|
|
2966
|
+
type MergePresent<A, B> = [A, B] extends [never, never] ? never : A extends object ? B extends object ? Expand<MergeObjects<A, B>> : never : never;
|
|
2967
|
+
type MergeObjects<A extends object, B extends object> = {
|
|
2968
|
+
[K in MergeRequiredKeys<A, B>]: MergeValue<A, B, K>;
|
|
2969
|
+
} & {
|
|
2970
|
+
[K in MergeOptionalKeys<A, B>]?: MergeValue<A, B, K>;
|
|
2971
|
+
};
|
|
2972
|
+
type MergeRequiredKeys<A extends object, B extends object> = RequiredKeys<B> | Exclude<RequiredKeys<A>, keyof B> | (RequiredKeys<A> & OptionalKeys<B>);
|
|
2973
|
+
type MergeOptionalKeys<A extends object, B extends object> = Exclude<OptionalKeys<A>, keyof B> | Exclude<OptionalKeys<B>, RequiredKeys<A>>;
|
|
2974
|
+
type MergeValue<A extends object, B extends object, K extends keyof A | keyof B> = K extends keyof B ? K extends OptionalKeys<B> ? K extends keyof A ? PropValue<A, K> | PropValue<B, K> : PropValue<B, K> : B[K] : K extends keyof A ? PropValue<A, K> : never;
|
|
2975
|
+
type PropValue<T extends object, K extends keyof T> = K extends OptionalKeys<T> ? Required<Pick<T, K>>[K] : T[K];
|
|
2976
|
+
|
|
2914
2977
|
/**
|
|
2915
2978
|
* Omit a list of properties from an object returning a new object
|
|
2916
2979
|
* with the properties that remain.
|
|
@@ -4244,4 +4307,4 @@ declare function isWeakMap<K extends WeakKey = WeakKey, V = unknown>(value: unkn
|
|
|
4244
4307
|
*/
|
|
4245
4308
|
declare function isWeakSet<T extends WeakKey = WeakKey>(value: unknown): value is WeakSet<T>;
|
|
4246
4309
|
|
|
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 };
|
|
4310
|
+
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 MergeOptions, 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 SortArray, 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, mergeOptions, 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
|
@@ -336,9 +336,8 @@ function sort(array, getter = identity, desc = false) {
|
|
|
336
336
|
if (!array) {
|
|
337
337
|
return [];
|
|
338
338
|
}
|
|
339
|
-
const
|
|
340
|
-
|
|
341
|
-
return array.slice().sort(desc === true ? dsc : asc);
|
|
339
|
+
const direction = desc ? -1 : 1;
|
|
340
|
+
return array.slice().sort((a, b) => (getter(a) - getter(b)) * direction);
|
|
342
341
|
}
|
|
343
342
|
|
|
344
343
|
// src/array/toggle.ts
|
|
@@ -1242,6 +1241,17 @@ function mapValues(obj, mapFunc) {
|
|
|
1242
1241
|
);
|
|
1243
1242
|
}
|
|
1244
1243
|
|
|
1244
|
+
// src/object/mergeOptions.ts
|
|
1245
|
+
function mergeOptions(a, b) {
|
|
1246
|
+
if (a === void 0) {
|
|
1247
|
+
return b;
|
|
1248
|
+
}
|
|
1249
|
+
if (b === void 0) {
|
|
1250
|
+
return a;
|
|
1251
|
+
}
|
|
1252
|
+
return { ...a, ...b };
|
|
1253
|
+
}
|
|
1254
|
+
|
|
1245
1255
|
// src/object/omit.ts
|
|
1246
1256
|
function omit(obj, keys2) {
|
|
1247
1257
|
if (!obj) {
|
|
@@ -1800,11 +1810,12 @@ function deburr(input) {
|
|
|
1800
1810
|
}
|
|
1801
1811
|
|
|
1802
1812
|
// src/string/dedent.ts
|
|
1813
|
+
// @__NO_SIDE_EFFECTS__
|
|
1803
1814
|
function dedent(text, ...values) {
|
|
1804
1815
|
var _a;
|
|
1805
1816
|
if (isArray(text)) {
|
|
1806
1817
|
if (values.length > 0) {
|
|
1807
|
-
return dedent(
|
|
1818
|
+
return /* @__PURE__ */ dedent(
|
|
1808
1819
|
text.reduce((acc, input, i) => {
|
|
1809
1820
|
var _a2;
|
|
1810
1821
|
let value = String(values[i] ?? "");
|
|
@@ -2200,4 +2211,4 @@ function isWeakSet(value) {
|
|
|
2200
2211
|
return isTagged(value, "[object WeakSet]");
|
|
2201
2212
|
}
|
|
2202
2213
|
|
|
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 };
|
|
2214
|
+
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, mergeOptions, 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.9.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": {
|