rattail 1.0.0 → 1.0.1

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/README.md CHANGED
@@ -24,7 +24,7 @@
24
24
  - 🛠️   Provide utilities frequently used in daily development
25
25
  - 🛠️   Utilities implementation is very lightweight
26
26
  - 🛠️   Written based on ts, providing complete ts types
27
- - 💪   Make sure more than 90% unit test coverage, providing stability assurance
27
+ - 💪   Make sure more than 99% unit test coverage, providing stability assurance
28
28
 
29
29
  ### Installation
30
30
 
package/README.zh-CN.md CHANGED
@@ -24,7 +24,7 @@
24
24
  - 🛠️   提供日常开发中经常使用的实用工具
25
25
  - 🛠️   工具实现非常轻量
26
26
  - 🛠️   使用 ts 编写,提供完善的类型支持
27
- - 💪   确保 90% 以上单元测试覆盖率,提供稳定性保证
27
+ - 💪   确保 99% 以上单元测试覆盖率,提供稳定性保证
28
28
 
29
29
  ### 安装
30
30
 
package/lib/index.cjs CHANGED
@@ -72,6 +72,7 @@ __export(src_exports, {
72
72
  inViewport: () => inViewport,
73
73
  isArray: () => isArray,
74
74
  isArrayBuffer: () => isArrayBuffer,
75
+ isBlob: () => isBlob,
75
76
  isBoolean: () => isBoolean,
76
77
  isDOMException: () => isDOMException,
77
78
  isDataView: () => isDataView,
@@ -80,6 +81,7 @@ __export(src_exports, {
80
81
  isEqual: () => isEqual,
81
82
  isEqualWith: () => isEqualWith,
82
83
  isError: () => isError,
84
+ isFile: () => isFile,
83
85
  isFunction: () => isFunction,
84
86
  isMap: () => isMap,
85
87
  isNonEmptyArray: () => isNonEmptyArray,
@@ -472,6 +474,16 @@ function supportTouch() {
472
474
  return inBrowser() && "ontouchstart" in window;
473
475
  }
474
476
 
477
+ // src/general/isFile.ts
478
+ function isFile(val) {
479
+ return toRawType(val) === "File";
480
+ }
481
+
482
+ // src/general/isBlob.ts
483
+ function isBlob(val) {
484
+ return toRawType(val) === "Blob";
485
+ }
486
+
475
487
  // src/number/toNumber.ts
476
488
  function toNumber(val) {
477
489
  if (val == null) {
@@ -1233,6 +1245,7 @@ function sample(arr) {
1233
1245
  inViewport,
1234
1246
  isArray,
1235
1247
  isArrayBuffer,
1248
+ isBlob,
1236
1249
  isBoolean,
1237
1250
  isDOMException,
1238
1251
  isDataView,
@@ -1241,6 +1254,7 @@ function sample(arr) {
1241
1254
  isEqual,
1242
1255
  isEqualWith,
1243
1256
  isError,
1257
+ isFile,
1244
1258
  isFunction,
1245
1259
  isMap,
1246
1260
  isNonEmptyArray,
package/lib/index.d.cts CHANGED
@@ -159,6 +159,10 @@ declare function toRawType(value: unknown): string;
159
159
  declare const objectToString: typeof Object.prototype.toString;
160
160
  declare function toTypeString(value: unknown): string;
161
161
 
162
+ declare function isFile(val: unknown): val is File;
163
+
164
+ declare function isBlob(val: unknown): val is Blob;
165
+
162
166
  declare function clamp(num: number, min: number, max: number): number;
163
167
 
164
168
  declare function clampArrayRange(index: number, arr: Array<unknown>): number;
@@ -225,4 +229,4 @@ declare function meanBy<T>(arr: T[], fn: (val: T) => number): number;
225
229
 
226
230
  declare function sample<T>(arr: T[]): T | undefined;
227
231
 
228
- export { type BEM, type ClassName, type Classes, NOOP, type Storage, at, call, camelize, cancelAnimationFrame, chunk, clamp, clampArrayRange, classes, cloneDeep, cloneDeepWith, copyText, createNamespaceFn, createStorage, debounce, delay, doubleRaf, ensurePrefix, ensureSuffix, find, genNumberKey, genStringKey, getAllParentScroller, getGlobalThis, getParentScroller, getRect, getScrollLeft, getScrollTop, getStyle, hasOwn, inBrowser, inMobile, inViewport, isArray, isArrayBuffer, isBoolean, isDOMException, isDataView, isDate, isEmpty, isEqual, isEqualWith, isError, isFunction, isMap, isNonEmptyArray, isNullish, isNumber, isNumeric, isObject, isPlainObject, isPromise, isRegExp, isSet, isString, isSymbol, isTruthy, isTypedArray, isWeakMap, isWeakSet, isWindow, kebabCase, localStorage, lowerFirst, maxBy, mean, meanBy, merge, mergeWith, minBy, normalizeToArray, objectToString, omit, omitBy, once, pascalCase, pick, pickBy, prettyJSONObject, preventDefault, raf, randomColor, randomNumber, randomString, removeArrayBlank, removeArrayEmpty, removeItem, requestAnimationFrame, sample, sessionStorage, shuffle, slash, sum, sumBy, sumHash, supportTouch, throttle, times, toArrayBuffer, toDataURL, toNumber, toRawType, toText, toTypeString, toggleItem, tryParseJSON, uniq, uniqBy, upperFirst };
232
+ export { type BEM, type ClassName, type Classes, NOOP, type Storage, at, call, camelize, cancelAnimationFrame, chunk, clamp, clampArrayRange, classes, cloneDeep, cloneDeepWith, copyText, createNamespaceFn, createStorage, debounce, delay, doubleRaf, ensurePrefix, ensureSuffix, find, genNumberKey, genStringKey, getAllParentScroller, getGlobalThis, getParentScroller, getRect, getScrollLeft, getScrollTop, getStyle, hasOwn, inBrowser, inMobile, inViewport, isArray, isArrayBuffer, isBlob, isBoolean, isDOMException, isDataView, isDate, isEmpty, isEqual, isEqualWith, isError, isFile, isFunction, isMap, isNonEmptyArray, isNullish, isNumber, isNumeric, isObject, isPlainObject, isPromise, isRegExp, isSet, isString, isSymbol, isTruthy, isTypedArray, isWeakMap, isWeakSet, isWindow, kebabCase, localStorage, lowerFirst, maxBy, mean, meanBy, merge, mergeWith, minBy, normalizeToArray, objectToString, omit, omitBy, once, pascalCase, pick, pickBy, prettyJSONObject, preventDefault, raf, randomColor, randomNumber, randomString, removeArrayBlank, removeArrayEmpty, removeItem, requestAnimationFrame, sample, sessionStorage, shuffle, slash, sum, sumBy, sumHash, supportTouch, throttle, times, toArrayBuffer, toDataURL, toNumber, toRawType, toText, toTypeString, toggleItem, tryParseJSON, uniq, uniqBy, upperFirst };
package/lib/index.d.ts CHANGED
@@ -159,6 +159,10 @@ declare function toRawType(value: unknown): string;
159
159
  declare const objectToString: typeof Object.prototype.toString;
160
160
  declare function toTypeString(value: unknown): string;
161
161
 
162
+ declare function isFile(val: unknown): val is File;
163
+
164
+ declare function isBlob(val: unknown): val is Blob;
165
+
162
166
  declare function clamp(num: number, min: number, max: number): number;
163
167
 
164
168
  declare function clampArrayRange(index: number, arr: Array<unknown>): number;
@@ -225,4 +229,4 @@ declare function meanBy<T>(arr: T[], fn: (val: T) => number): number;
225
229
 
226
230
  declare function sample<T>(arr: T[]): T | undefined;
227
231
 
228
- export { type BEM, type ClassName, type Classes, NOOP, type Storage, at, call, camelize, cancelAnimationFrame, chunk, clamp, clampArrayRange, classes, cloneDeep, cloneDeepWith, copyText, createNamespaceFn, createStorage, debounce, delay, doubleRaf, ensurePrefix, ensureSuffix, find, genNumberKey, genStringKey, getAllParentScroller, getGlobalThis, getParentScroller, getRect, getScrollLeft, getScrollTop, getStyle, hasOwn, inBrowser, inMobile, inViewport, isArray, isArrayBuffer, isBoolean, isDOMException, isDataView, isDate, isEmpty, isEqual, isEqualWith, isError, isFunction, isMap, isNonEmptyArray, isNullish, isNumber, isNumeric, isObject, isPlainObject, isPromise, isRegExp, isSet, isString, isSymbol, isTruthy, isTypedArray, isWeakMap, isWeakSet, isWindow, kebabCase, localStorage, lowerFirst, maxBy, mean, meanBy, merge, mergeWith, minBy, normalizeToArray, objectToString, omit, omitBy, once, pascalCase, pick, pickBy, prettyJSONObject, preventDefault, raf, randomColor, randomNumber, randomString, removeArrayBlank, removeArrayEmpty, removeItem, requestAnimationFrame, sample, sessionStorage, shuffle, slash, sum, sumBy, sumHash, supportTouch, throttle, times, toArrayBuffer, toDataURL, toNumber, toRawType, toText, toTypeString, toggleItem, tryParseJSON, uniq, uniqBy, upperFirst };
232
+ export { type BEM, type ClassName, type Classes, NOOP, type Storage, at, call, camelize, cancelAnimationFrame, chunk, clamp, clampArrayRange, classes, cloneDeep, cloneDeepWith, copyText, createNamespaceFn, createStorage, debounce, delay, doubleRaf, ensurePrefix, ensureSuffix, find, genNumberKey, genStringKey, getAllParentScroller, getGlobalThis, getParentScroller, getRect, getScrollLeft, getScrollTop, getStyle, hasOwn, inBrowser, inMobile, inViewport, isArray, isArrayBuffer, isBlob, isBoolean, isDOMException, isDataView, isDate, isEmpty, isEqual, isEqualWith, isError, isFile, isFunction, isMap, isNonEmptyArray, isNullish, isNumber, isNumeric, isObject, isPlainObject, isPromise, isRegExp, isSet, isString, isSymbol, isTruthy, isTypedArray, isWeakMap, isWeakSet, isWindow, kebabCase, localStorage, lowerFirst, maxBy, mean, meanBy, merge, mergeWith, minBy, normalizeToArray, objectToString, omit, omitBy, once, pascalCase, pick, pickBy, prettyJSONObject, preventDefault, raf, randomColor, randomNumber, randomString, removeArrayBlank, removeArrayEmpty, removeItem, requestAnimationFrame, sample, sessionStorage, shuffle, slash, sum, sumBy, sumHash, supportTouch, throttle, times, toArrayBuffer, toDataURL, toNumber, toRawType, toText, toTypeString, toggleItem, tryParseJSON, uniq, uniqBy, upperFirst };
package/lib/index.js CHANGED
@@ -341,6 +341,16 @@ function supportTouch() {
341
341
  return inBrowser() && "ontouchstart" in window;
342
342
  }
343
343
 
344
+ // src/general/isFile.ts
345
+ function isFile(val) {
346
+ return toRawType(val) === "File";
347
+ }
348
+
349
+ // src/general/isBlob.ts
350
+ function isBlob(val) {
351
+ return toRawType(val) === "Blob";
352
+ }
353
+
344
354
  // src/number/toNumber.ts
345
355
  function toNumber(val) {
346
356
  if (val == null) {
@@ -1101,6 +1111,7 @@ export {
1101
1111
  inViewport,
1102
1112
  isArray,
1103
1113
  isArrayBuffer,
1114
+ isBlob,
1104
1115
  isBoolean,
1105
1116
  isDOMException,
1106
1117
  isDataView,
@@ -1109,6 +1120,7 @@ export {
1109
1120
  isEqual,
1110
1121
  isEqualWith,
1111
1122
  isError,
1123
+ isFile,
1112
1124
  isFunction,
1113
1125
  isMap,
1114
1126
  isNonEmptyArray,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rattail",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "type": "module",
5
5
  "main": "lib/index.cjs",
6
6
  "module": "lib/index.js",