@varlet/shared 3.15.0 → 3.15.2
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/lib/index.cjs +13 -4
- package/lib/index.d.cts +6 -2
- package/package.json +2 -2
package/lib/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
let node_crypto = require("node:crypto");
|
|
3
|
-
//#region ../../node_modules/.pnpm/rattail@2.0.
|
|
3
|
+
//#region ../../node_modules/.pnpm/rattail@2.0.7_@voidzero-dev+vite-plus-core@0.1.18_@types+node@20.19.39_esbuild@0.27.7_jiti@2._6rwx5eoj5ijtwiwneistv24bcq/node_modules/rattail/dist/chunk-D1SwGrFN.mjs
|
|
4
4
|
var __defProp = Object.defineProperty;
|
|
5
5
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
6
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
@@ -26,7 +26,7 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
26
26
|
};
|
|
27
27
|
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
28
28
|
//#endregion
|
|
29
|
-
//#region ../../node_modules/.pnpm/rattail@2.0.
|
|
29
|
+
//#region ../../node_modules/.pnpm/rattail@2.0.7_@voidzero-dev+vite-plus-core@0.1.18_@types+node@20.19.39_esbuild@0.27.7_jiti@2._6rwx5eoj5ijtwiwneistv24bcq/node_modules/rattail/dist/isString-eoLxw4CX.mjs
|
|
30
30
|
function isArray(val) {
|
|
31
31
|
return Array.isArray(val);
|
|
32
32
|
}
|
|
@@ -34,7 +34,7 @@ function isString(val) {
|
|
|
34
34
|
return typeof val === "string";
|
|
35
35
|
}
|
|
36
36
|
//#endregion
|
|
37
|
-
//#region ../../node_modules/.pnpm/rattail@2.0.
|
|
37
|
+
//#region ../../node_modules/.pnpm/rattail@2.0.7_@voidzero-dev+vite-plus-core@0.1.18_@types+node@20.19.39_esbuild@0.27.7_jiti@2._6rwx5eoj5ijtwiwneistv24bcq/node_modules/rattail/dist/callOrReturn-MpTzoGlG.mjs
|
|
38
38
|
function isFunction(val) {
|
|
39
39
|
return typeof val === "function";
|
|
40
40
|
}
|
|
@@ -279,7 +279,7 @@ function init(converter, defaultAttributes) {
|
|
|
279
279
|
}
|
|
280
280
|
var api = init(defaultConverter, { path: "/" });
|
|
281
281
|
//#endregion
|
|
282
|
-
//#region ../../node_modules/.pnpm/rattail@2.0.
|
|
282
|
+
//#region ../../node_modules/.pnpm/rattail@2.0.7_@voidzero-dev+vite-plus-core@0.1.18_@types+node@20.19.39_esbuild@0.27.7_jiti@2._6rwx5eoj5ijtwiwneistv24bcq/node_modules/rattail/dist/index.mjs
|
|
283
283
|
function at(arr, index) {
|
|
284
284
|
if (!arr.length) return;
|
|
285
285
|
if (index < 0) index += arr.length;
|
|
@@ -633,6 +633,13 @@ function omitBy(object, fn) {
|
|
|
633
633
|
return result;
|
|
634
634
|
}, {});
|
|
635
635
|
}
|
|
636
|
+
function rekey(object, mapping) {
|
|
637
|
+
return [...Object.keys(object), ...Object.getOwnPropertySymbols(object)].reduce((result, key) => {
|
|
638
|
+
const nextKey = hasOwn(mapping, key) ? mapping[key] : key;
|
|
639
|
+
result[nextKey] = object[key];
|
|
640
|
+
return result;
|
|
641
|
+
}, {});
|
|
642
|
+
}
|
|
636
643
|
function mapObject(object, fn) {
|
|
637
644
|
return Object.entries(object).reduce((result, [key, value]) => {
|
|
638
645
|
const entry = fn(key, value);
|
|
@@ -1523,6 +1530,7 @@ __reExport(/* @__PURE__ */ __exportAll({
|
|
|
1523
1530
|
randomColor: () => randomColor,
|
|
1524
1531
|
randomNumber: () => randomNumber,
|
|
1525
1532
|
randomString: () => randomString,
|
|
1533
|
+
rekey: () => rekey,
|
|
1526
1534
|
removeArrayBlank: () => removeArrayBlank,
|
|
1527
1535
|
removeArrayEmpty: () => removeArrayEmpty,
|
|
1528
1536
|
removeItem: () => removeItem,
|
|
@@ -1691,6 +1699,7 @@ exports.raf = raf;
|
|
|
1691
1699
|
exports.randomColor = randomColor;
|
|
1692
1700
|
exports.randomNumber = randomNumber;
|
|
1693
1701
|
exports.randomString = randomString;
|
|
1702
|
+
exports.rekey = rekey;
|
|
1694
1703
|
exports.removeArrayBlank = removeArrayBlank;
|
|
1695
1704
|
exports.removeArrayEmpty = removeArrayEmpty;
|
|
1696
1705
|
exports.removeItem = removeItem;
|
package/lib/index.d.cts
CHANGED
|
@@ -45,7 +45,7 @@ interface Emitter<Events extends Record<EventType, unknown>> {
|
|
|
45
45
|
*/
|
|
46
46
|
declare function mitt<Events extends Record<EventType, unknown>>(all?: EventHandlerMap<Events>): Emitter<Events>;
|
|
47
47
|
//#endregion
|
|
48
|
-
//#region ../../node_modules/.pnpm/rattail@2.0.
|
|
48
|
+
//#region ../../node_modules/.pnpm/rattail@2.0.7_@voidzero-dev+vite-plus-core@0.1.18_@types+node@20.19.39_esbuild@0.27.7_jiti@2._6rwx5eoj5ijtwiwneistv24bcq/node_modules/rattail/dist/index.d.mts
|
|
49
49
|
//#region src/array/at.d.ts
|
|
50
50
|
declare function at<T>(arr: T[], index: number): T | undefined; //#endregion
|
|
51
51
|
//#region src/array/chunk.d.ts
|
|
@@ -98,6 +98,10 @@ declare function pickBy<T extends object>(object: T, fn: (value: any, key: keyof
|
|
|
98
98
|
declare function omit<T extends object, K extends keyof T>(object: T, keys: K[]): Omit<T, K>; //#endregion
|
|
99
99
|
//#region src/object/omitBy.d.ts
|
|
100
100
|
declare function omitBy<T extends object>(object: T, fn: (value: any, key: keyof T) => any): Partial<T>; //#endregion
|
|
101
|
+
//#region src/object/rekey.d.ts
|
|
102
|
+
type RekeyMap<T extends object> = Partial<Record<keyof T, PropertyKey>>;
|
|
103
|
+
type RekeyResult<T extends object, M extends RekeyMap<T>> = Omit<T, keyof M> & { [K in keyof M as M[K] extends PropertyKey ? M[K] : never]: K extends keyof T ? T[K] : never };
|
|
104
|
+
declare function rekey<T extends object, M extends RekeyMap<T>>(object: T, mapping: M): RekeyResult<T, M>; //#endregion
|
|
101
105
|
//#region src/object/mapObject.d.ts
|
|
102
106
|
declare function mapObject<K extends PropertyKey, V, NK extends PropertyKey = K, NV = V>(object: Record<K, V>, fn: (key: K, value: V) => [PropertyKey, NV] | undefined): Record<NK, NV>; //#endregion
|
|
103
107
|
//#region src/object/promiseWithResolvers.d.ts
|
|
@@ -479,4 +483,4 @@ declare function warn(source: string, message: string): void;
|
|
|
479
483
|
declare function error(source: string, message: string): void;
|
|
480
484
|
declare const isURL: (val: string | undefined | null) => boolean;
|
|
481
485
|
//#endregion
|
|
482
|
-
export { BEM, ClassName, Classes, CookieAttributes, CookieStorage, CreateCacheManagerOptions, DurationContext, Emitter, EnumOf, EnumOfConfigValue, EnumOfExtractOptionShape, EnumOfExtractValues, EnumOfKeyForValue, EnumOfNormalizeToOption, EnumOfOptionForValue, EnumOfResolvedField, EnumOfResolvedOption, EnumOfResult, EnumOfResultMethods, EnumOfStringOrGetter, EnumOfValue, EnumOfValueObject, EventHandlerList, EventHandlerMap, EventType, Handler, MaskStringOptions, Motion, MotionOptions, MotionState, NOOP, NavigationTarget, PromiseWithResolvers, Storage, WildCardEventHandlerList, WildcardHandler, assert, at, baseRound, buildNavigationUrl, call, callOrReturn, camelize, cancelAnimationFrame, ceil, chunk, clamp, clampArrayRange, classes, cloneDeep, cloneDeepWith, copyText, createCacheManager, createCookieStorage, createNamespaceFn, createStorage, debounce, delay, difference, differenceWith, doubleRaf, download, duration, ensurePrefix, ensureSuffix, enumOf, error, find, floor, genNumberKey, genStringKey, getAllParentScroller, getGlobalThis, getParentScroller, getRect, getScrollLeft, getScrollTop, getStyle, groupBy, hasDuplicates, hasDuplicatesBy, hasOwn, inBrowser, inMobile, inViewport, intersection, intersectionWith, isArray, isArrayBuffer, isBlob, isBoolean, isDOMException, isDataView, isDate, isEmpty, isEmptyPlainObject, isEqual, isEqualWith, isError, isFile, isFunction, isMap, isNonEmptyArray, isNullish, isNumber, isNumeric, isObject, isPlainObject, isPrimitive, isPromise, isRegExp, isSet, isString, isSymbol, isTruthy, isTypedArray, isURL, isWeakMap, isWeakSet, isWindow, kebabCase, localStorage, lowerFirst, mapObject, maskString, maxBy, mean, meanBy, merge, mergeWith, minBy, mitt, motion, navigation, normalizeToArray, objectEntries, objectKeys, objectToString, omit, omitBy, once, pascalCase, pick, pickBy, prettyJSONObject, preventDefault, promiseWithResolvers, raf, randomColor, randomNumber, randomString, removeArrayBlank, removeArrayEmpty, removeItem, removeItemBy, removeItemsBy, requestAnimationFrame, round, sample, sessionStorage, set, shuffle, slash, sum, sumBy, sumHash, supportTouch, throttle, times, toArrayBuffer, toDataURL, toNumber, toRawType, toText, toTypeString, toggleItem, tryAsyncCall, tryCall, tryParseJSON, uniq, uniqBy, upperFirst, v4 as uuid, v6 as uuidV6, warn, xor, xorWith };
|
|
486
|
+
export { BEM, ClassName, Classes, CookieAttributes, CookieStorage, CreateCacheManagerOptions, DurationContext, Emitter, EnumOf, EnumOfConfigValue, EnumOfExtractOptionShape, EnumOfExtractValues, EnumOfKeyForValue, EnumOfNormalizeToOption, EnumOfOptionForValue, EnumOfResolvedField, EnumOfResolvedOption, EnumOfResult, EnumOfResultMethods, EnumOfStringOrGetter, EnumOfValue, EnumOfValueObject, EventHandlerList, EventHandlerMap, EventType, Handler, MaskStringOptions, Motion, MotionOptions, MotionState, NOOP, NavigationTarget, PromiseWithResolvers, Storage, WildCardEventHandlerList, WildcardHandler, assert, at, baseRound, buildNavigationUrl, call, callOrReturn, camelize, cancelAnimationFrame, ceil, chunk, clamp, clampArrayRange, classes, cloneDeep, cloneDeepWith, copyText, createCacheManager, createCookieStorage, createNamespaceFn, createStorage, debounce, delay, difference, differenceWith, doubleRaf, download, duration, ensurePrefix, ensureSuffix, enumOf, error, find, floor, genNumberKey, genStringKey, getAllParentScroller, getGlobalThis, getParentScroller, getRect, getScrollLeft, getScrollTop, getStyle, groupBy, hasDuplicates, hasDuplicatesBy, hasOwn, inBrowser, inMobile, inViewport, intersection, intersectionWith, isArray, isArrayBuffer, isBlob, isBoolean, isDOMException, isDataView, isDate, isEmpty, isEmptyPlainObject, isEqual, isEqualWith, isError, isFile, isFunction, isMap, isNonEmptyArray, isNullish, isNumber, isNumeric, isObject, isPlainObject, isPrimitive, isPromise, isRegExp, isSet, isString, isSymbol, isTruthy, isTypedArray, isURL, isWeakMap, isWeakSet, isWindow, kebabCase, localStorage, lowerFirst, mapObject, maskString, maxBy, mean, meanBy, merge, mergeWith, minBy, mitt, motion, navigation, normalizeToArray, objectEntries, objectKeys, objectToString, omit, omitBy, once, pascalCase, pick, pickBy, prettyJSONObject, preventDefault, promiseWithResolvers, raf, randomColor, randomNumber, randomString, rekey, removeArrayBlank, removeArrayEmpty, removeItem, removeItemBy, removeItemsBy, requestAnimationFrame, round, sample, sessionStorage, set, shuffle, slash, sum, sumBy, sumHash, supportTouch, throttle, times, toArrayBuffer, toDataURL, toNumber, toRawType, toText, toTypeString, toggleItem, tryAsyncCall, tryCall, tryParseJSON, uniq, uniqBy, upperFirst, v4 as uuid, v6 as uuidV6, warn, xor, xorWith };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@varlet/shared",
|
|
3
|
-
"version": "3.15.
|
|
3
|
+
"version": "3.15.2",
|
|
4
4
|
"description": "shared utils of varlet",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"shared",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"lib"
|
|
33
33
|
],
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"rattail": "^2.0.
|
|
35
|
+
"rattail": "^2.0.7"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@types/node": "^20.19.0",
|