rattail 1.0.12 → 1.0.13

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 CHANGED
@@ -87,6 +87,7 @@ __export(src_exports, {
87
87
  isDataView: () => isDataView,
88
88
  isDate: () => isDate,
89
89
  isEmpty: () => isEmpty,
90
+ isEmptyPlainObject: () => isEmptyPlainObject,
90
91
  isEqual: () => isEqual,
91
92
  isEqualWith: () => isEqualWith,
92
93
  isError: () => isError,
@@ -504,6 +505,11 @@ function isPrimitive(val) {
504
505
  return val == null || typeof val !== "object" && typeof val !== "function";
505
506
  }
506
507
 
508
+ // src/general/isEmptyPlainObject.ts
509
+ function isEmptyPlainObject(val) {
510
+ return isPlainObject(val) && Object.keys(val).length === 0 && Object.getOwnPropertySymbols(val).length === 0;
511
+ }
512
+
507
513
  // src/number/toNumber.ts
508
514
  function toNumber(val) {
509
515
  if (val == null) {
@@ -1419,6 +1425,7 @@ function ceil(val, precision = 0) {
1419
1425
  isDataView,
1420
1426
  isDate,
1421
1427
  isEmpty,
1428
+ isEmptyPlainObject,
1422
1429
  isEqual,
1423
1430
  isEqualWith,
1424
1431
  isError,
package/lib/index.d.cts CHANGED
@@ -2,21 +2,21 @@ declare function at<T>(arr: T[], index: number): T | undefined;
2
2
 
3
3
  declare function chunk<T>(arr: T[], size?: number): T[][];
4
4
 
5
- declare function removeItem<T>(arr: Array<T>, item: T): T[] | undefined;
5
+ declare function removeItem<T>(arr: T[], item: T): T[] | undefined;
6
6
 
7
- declare function toggleItem<T>(arr: Array<T>, item: T): T[];
7
+ declare function toggleItem<T>(arr: T[], item: T): T[];
8
8
 
9
9
  declare function uniq<T>(arr: T[]): T[];
10
10
 
11
11
  declare function uniqBy<T>(arr: T[], fn: (a: T, b: T) => any): T[];
12
12
 
13
- declare function find<T>(arr: Array<T>, fn: (item: T, index: number, array: Array<T>) => any, from?: 'start' | 'end'): [T, number] | [null, -1];
13
+ declare function find<T>(arr: T[], fn: (item: T, index: number, array: T[]) => any, from?: 'start' | 'end'): [T, number] | [null, -1];
14
14
 
15
15
  declare function shuffle<T>(arr: T[]): T[];
16
16
 
17
- declare function removeArrayBlank<T>(arr: Array<T | null | undefined>): T[];
17
+ declare function removeArrayBlank<T>(arr: (T | null | undefined)[]): T[];
18
18
 
19
- declare function removeArrayEmpty<T>(arr: Array<T | null | undefined | ''>): T[];
19
+ declare function removeArrayEmpty<T>(arr: (T | null | undefined | '')[]): T[];
20
20
 
21
21
  declare function normalizeToArray<T>(value: T | T[]): T[];
22
22
 
@@ -72,7 +72,7 @@ declare function createNamespaceFn<N extends string>(namespace: N): <C extends s
72
72
 
73
73
  declare function doubleRaf(): Promise<unknown>;
74
74
 
75
- declare function getAllParentScroller(el: HTMLElement): Array<HTMLElement | Window>;
75
+ declare function getAllParentScroller(el: HTMLElement): (HTMLElement | Window)[];
76
76
 
77
77
  declare function getParentScroller(el: HTMLElement): HTMLElement | Window;
78
78
 
@@ -125,7 +125,7 @@ declare function inBrowser(): boolean;
125
125
 
126
126
  declare function inMobile(): boolean;
127
127
 
128
- declare function isArray(val: unknown): val is Array<any>;
128
+ declare function isArray(val: unknown): val is any[];
129
129
 
130
130
  declare function isArrayBuffer(val: unknown): val is ArrayBuffer;
131
131
 
@@ -149,7 +149,7 @@ declare function isFunction(val: unknown): val is Function;
149
149
 
150
150
  declare function isMap(val: unknown): val is Map<any, any>;
151
151
 
152
- declare function isNonEmptyArray(val: unknown): val is Array<any>;
152
+ declare function isNonEmptyArray(val: unknown): val is any[];
153
153
 
154
154
  declare function isNullish<T>(val: T | null | undefined): val is NonNullable<T>;
155
155
 
@@ -194,9 +194,11 @@ declare function isBlob(val: unknown): val is Blob;
194
194
 
195
195
  declare function isPrimitive(val: unknown): boolean;
196
196
 
197
+ declare function isEmptyPlainObject(val: unknown): val is Record<string, any>;
198
+
197
199
  declare function clamp(num: number, min: number, max: number): number;
198
200
 
199
- declare function clampArrayRange(index: number, arr: Array<unknown>): number;
201
+ declare function clampArrayRange(index: number, arr: unknown[]): number;
200
202
 
201
203
  declare function delay(time: number): Promise<void>;
202
204
 
@@ -268,4 +270,4 @@ declare function floor(val: number, precision?: number): number;
268
270
 
269
271
  declare function ceil(val: number, precision?: number): number;
270
272
 
271
- export { type BEM, type ClassName, type Classes, NOOP, type PromiseWithResolvers, type Storage, at, baseRound, call, camelize, cancelAnimationFrame, ceil, chunk, clamp, clampArrayRange, classes, cloneDeep, cloneDeepWith, copyText, createNamespaceFn, createStorage, debounce, delay, difference, differenceWith, doubleRaf, download, ensurePrefix, ensureSuffix, find, floor, genNumberKey, genStringKey, getAllParentScroller, getGlobalThis, getParentScroller, getRect, getScrollLeft, getScrollTop, getStyle, groupBy, hasOwn, inBrowser, inMobile, inViewport, intersection, intersectionWith, isArray, isArrayBuffer, isBlob, isBoolean, isDOMException, isDataView, isDate, isEmpty, isEqual, isEqualWith, isError, isFile, isFunction, isMap, isNonEmptyArray, isNullish, isNumber, isNumeric, isObject, isPlainObject, isPrimitive, isPromise, isRegExp, isSet, isString, isSymbol, isTruthy, isTypedArray, isWeakMap, isWeakSet, isWindow, kebabCase, localStorage, lowerFirst, mapObject, maxBy, mean, meanBy, merge, mergeWith, minBy, normalizeToArray, objectToString, omit, omitBy, once, pascalCase, pick, pickBy, prettyJSONObject, preventDefault, promiseWithResolvers, raf, randomColor, randomNumber, randomString, removeArrayBlank, removeArrayEmpty, removeItem, requestAnimationFrame, round, sample, sessionStorage, shuffle, slash, sum, sumBy, sumHash, supportTouch, throttle, times, toArrayBuffer, toDataURL, toNumber, toRawType, toText, toTypeString, toggleItem, tryParseJSON, uniq, uniqBy, upperFirst, xor, xorWith };
273
+ export { type BEM, type ClassName, type Classes, NOOP, type PromiseWithResolvers, type Storage, at, baseRound, call, camelize, cancelAnimationFrame, ceil, chunk, clamp, clampArrayRange, classes, cloneDeep, cloneDeepWith, copyText, createNamespaceFn, createStorage, debounce, delay, difference, differenceWith, doubleRaf, download, ensurePrefix, ensureSuffix, find, floor, genNumberKey, genStringKey, getAllParentScroller, getGlobalThis, getParentScroller, getRect, getScrollLeft, getScrollTop, getStyle, groupBy, 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, isWeakMap, isWeakSet, isWindow, kebabCase, localStorage, lowerFirst, mapObject, maxBy, mean, meanBy, merge, mergeWith, minBy, normalizeToArray, objectToString, omit, omitBy, once, pascalCase, pick, pickBy, prettyJSONObject, preventDefault, promiseWithResolvers, raf, randomColor, randomNumber, randomString, removeArrayBlank, removeArrayEmpty, removeItem, requestAnimationFrame, round, sample, sessionStorage, shuffle, slash, sum, sumBy, sumHash, supportTouch, throttle, times, toArrayBuffer, toDataURL, toNumber, toRawType, toText, toTypeString, toggleItem, tryParseJSON, uniq, uniqBy, upperFirst, xor, xorWith };
package/lib/index.d.ts CHANGED
@@ -2,21 +2,21 @@ declare function at<T>(arr: T[], index: number): T | undefined;
2
2
 
3
3
  declare function chunk<T>(arr: T[], size?: number): T[][];
4
4
 
5
- declare function removeItem<T>(arr: Array<T>, item: T): T[] | undefined;
5
+ declare function removeItem<T>(arr: T[], item: T): T[] | undefined;
6
6
 
7
- declare function toggleItem<T>(arr: Array<T>, item: T): T[];
7
+ declare function toggleItem<T>(arr: T[], item: T): T[];
8
8
 
9
9
  declare function uniq<T>(arr: T[]): T[];
10
10
 
11
11
  declare function uniqBy<T>(arr: T[], fn: (a: T, b: T) => any): T[];
12
12
 
13
- declare function find<T>(arr: Array<T>, fn: (item: T, index: number, array: Array<T>) => any, from?: 'start' | 'end'): [T, number] | [null, -1];
13
+ declare function find<T>(arr: T[], fn: (item: T, index: number, array: T[]) => any, from?: 'start' | 'end'): [T, number] | [null, -1];
14
14
 
15
15
  declare function shuffle<T>(arr: T[]): T[];
16
16
 
17
- declare function removeArrayBlank<T>(arr: Array<T | null | undefined>): T[];
17
+ declare function removeArrayBlank<T>(arr: (T | null | undefined)[]): T[];
18
18
 
19
- declare function removeArrayEmpty<T>(arr: Array<T | null | undefined | ''>): T[];
19
+ declare function removeArrayEmpty<T>(arr: (T | null | undefined | '')[]): T[];
20
20
 
21
21
  declare function normalizeToArray<T>(value: T | T[]): T[];
22
22
 
@@ -72,7 +72,7 @@ declare function createNamespaceFn<N extends string>(namespace: N): <C extends s
72
72
 
73
73
  declare function doubleRaf(): Promise<unknown>;
74
74
 
75
- declare function getAllParentScroller(el: HTMLElement): Array<HTMLElement | Window>;
75
+ declare function getAllParentScroller(el: HTMLElement): (HTMLElement | Window)[];
76
76
 
77
77
  declare function getParentScroller(el: HTMLElement): HTMLElement | Window;
78
78
 
@@ -125,7 +125,7 @@ declare function inBrowser(): boolean;
125
125
 
126
126
  declare function inMobile(): boolean;
127
127
 
128
- declare function isArray(val: unknown): val is Array<any>;
128
+ declare function isArray(val: unknown): val is any[];
129
129
 
130
130
  declare function isArrayBuffer(val: unknown): val is ArrayBuffer;
131
131
 
@@ -149,7 +149,7 @@ declare function isFunction(val: unknown): val is Function;
149
149
 
150
150
  declare function isMap(val: unknown): val is Map<any, any>;
151
151
 
152
- declare function isNonEmptyArray(val: unknown): val is Array<any>;
152
+ declare function isNonEmptyArray(val: unknown): val is any[];
153
153
 
154
154
  declare function isNullish<T>(val: T | null | undefined): val is NonNullable<T>;
155
155
 
@@ -194,9 +194,11 @@ declare function isBlob(val: unknown): val is Blob;
194
194
 
195
195
  declare function isPrimitive(val: unknown): boolean;
196
196
 
197
+ declare function isEmptyPlainObject(val: unknown): val is Record<string, any>;
198
+
197
199
  declare function clamp(num: number, min: number, max: number): number;
198
200
 
199
- declare function clampArrayRange(index: number, arr: Array<unknown>): number;
201
+ declare function clampArrayRange(index: number, arr: unknown[]): number;
200
202
 
201
203
  declare function delay(time: number): Promise<void>;
202
204
 
@@ -268,4 +270,4 @@ declare function floor(val: number, precision?: number): number;
268
270
 
269
271
  declare function ceil(val: number, precision?: number): number;
270
272
 
271
- export { type BEM, type ClassName, type Classes, NOOP, type PromiseWithResolvers, type Storage, at, baseRound, call, camelize, cancelAnimationFrame, ceil, chunk, clamp, clampArrayRange, classes, cloneDeep, cloneDeepWith, copyText, createNamespaceFn, createStorage, debounce, delay, difference, differenceWith, doubleRaf, download, ensurePrefix, ensureSuffix, find, floor, genNumberKey, genStringKey, getAllParentScroller, getGlobalThis, getParentScroller, getRect, getScrollLeft, getScrollTop, getStyle, groupBy, hasOwn, inBrowser, inMobile, inViewport, intersection, intersectionWith, isArray, isArrayBuffer, isBlob, isBoolean, isDOMException, isDataView, isDate, isEmpty, isEqual, isEqualWith, isError, isFile, isFunction, isMap, isNonEmptyArray, isNullish, isNumber, isNumeric, isObject, isPlainObject, isPrimitive, isPromise, isRegExp, isSet, isString, isSymbol, isTruthy, isTypedArray, isWeakMap, isWeakSet, isWindow, kebabCase, localStorage, lowerFirst, mapObject, maxBy, mean, meanBy, merge, mergeWith, minBy, normalizeToArray, objectToString, omit, omitBy, once, pascalCase, pick, pickBy, prettyJSONObject, preventDefault, promiseWithResolvers, raf, randomColor, randomNumber, randomString, removeArrayBlank, removeArrayEmpty, removeItem, requestAnimationFrame, round, sample, sessionStorage, shuffle, slash, sum, sumBy, sumHash, supportTouch, throttle, times, toArrayBuffer, toDataURL, toNumber, toRawType, toText, toTypeString, toggleItem, tryParseJSON, uniq, uniqBy, upperFirst, xor, xorWith };
273
+ export { type BEM, type ClassName, type Classes, NOOP, type PromiseWithResolvers, type Storage, at, baseRound, call, camelize, cancelAnimationFrame, ceil, chunk, clamp, clampArrayRange, classes, cloneDeep, cloneDeepWith, copyText, createNamespaceFn, createStorage, debounce, delay, difference, differenceWith, doubleRaf, download, ensurePrefix, ensureSuffix, find, floor, genNumberKey, genStringKey, getAllParentScroller, getGlobalThis, getParentScroller, getRect, getScrollLeft, getScrollTop, getStyle, groupBy, 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, isWeakMap, isWeakSet, isWindow, kebabCase, localStorage, lowerFirst, mapObject, maxBy, mean, meanBy, merge, mergeWith, minBy, normalizeToArray, objectToString, omit, omitBy, once, pascalCase, pick, pickBy, prettyJSONObject, preventDefault, promiseWithResolvers, raf, randomColor, randomNumber, randomString, removeArrayBlank, removeArrayEmpty, removeItem, requestAnimationFrame, round, sample, sessionStorage, shuffle, slash, sum, sumBy, sumHash, supportTouch, throttle, times, toArrayBuffer, toDataURL, toNumber, toRawType, toText, toTypeString, toggleItem, tryParseJSON, uniq, uniqBy, upperFirst, xor, xorWith };
@@ -88,6 +88,7 @@ var Rattail = (() => {
88
88
  isDataView: () => isDataView,
89
89
  isDate: () => isDate,
90
90
  isEmpty: () => isEmpty,
91
+ isEmptyPlainObject: () => isEmptyPlainObject,
91
92
  isEqual: () => isEqual,
92
93
  isEqualWith: () => isEqualWith,
93
94
  isError: () => isError,
@@ -504,6 +505,11 @@ var Rattail = (() => {
504
505
  return val == null || typeof val !== "object" && typeof val !== "function";
505
506
  }
506
507
 
508
+ // src/general/isEmptyPlainObject.ts
509
+ function isEmptyPlainObject(val) {
510
+ return isPlainObject(val) && Object.keys(val).length === 0 && Object.getOwnPropertySymbols(val).length === 0;
511
+ }
512
+
507
513
  // src/number/toNumber.ts
508
514
  function toNumber(val) {
509
515
  if (val == null) {
package/lib/index.js CHANGED
@@ -356,6 +356,11 @@ function isPrimitive(val) {
356
356
  return val == null || typeof val !== "object" && typeof val !== "function";
357
357
  }
358
358
 
359
+ // src/general/isEmptyPlainObject.ts
360
+ function isEmptyPlainObject(val) {
361
+ return isPlainObject(val) && Object.keys(val).length === 0 && Object.getOwnPropertySymbols(val).length === 0;
362
+ }
363
+
359
364
  // src/number/toNumber.ts
360
365
  function toNumber(val) {
361
366
  if (val == null) {
@@ -1270,6 +1275,7 @@ export {
1270
1275
  isDataView,
1271
1276
  isDate,
1272
1277
  isEmpty,
1278
+ isEmptyPlainObject,
1273
1279
  isEqual,
1274
1280
  isEqualWith,
1275
1281
  isError,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rattail",
3
- "version": "1.0.12",
3
+ "version": "1.0.13",
4
4
  "type": "module",
5
5
  "main": "lib/index.cjs",
6
6
  "module": "lib/index.js",