pen-it 1.0.6 → 1.0.7
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 +31 -2
- package/package.json +8 -16
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# pen-it
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
用“笔”锚定记忆,一个轻量级前端工具库,覆盖类型检查、日期格式化、数字处理、深克隆、本地存储、Cookie 及浏览器 API。零依赖,支持 Tree-shaking,让常用函数信手拈来。
|
|
4
4
|
|
|
5
5
|
## 安装
|
|
6
6
|
|
|
@@ -572,4 +572,33 @@ import { isArray, formatFull, deepClone, unique } from 'pen-it'
|
|
|
572
572
|
const fn = throttle((val: string) => console.log(val), 500)
|
|
573
573
|
fn('a'); fn('b'); fn('c')
|
|
574
574
|
// => 'a',500ms 后输出 'c'
|
|
575
|
-
```
|
|
575
|
+
```
|
|
576
|
+
|
|
577
|
+
---
|
|
578
|
+
|
|
579
|
+
## 更新日志
|
|
580
|
+
|
|
581
|
+
### v1.0.7
|
|
582
|
+
|
|
583
|
+
- **体积优化** — 移除JSDoc `@example` 示例注释(共 294 行),减少包体积
|
|
584
|
+
- **文档** — README 底部新增更新日志模块
|
|
585
|
+
|
|
586
|
+
### v1.0.6
|
|
587
|
+
|
|
588
|
+
- **数组模块** — 新增 `mergeArrays` 数组合并、`flatten` 数组扁平化(支持任意层级)、`arrFind` 数组项查询、`groupBy` JSON 数组分组、`filterEmptyValues` 对象移除空值属性、`createRange` 快速生成范围数组
|
|
589
|
+
- **浏览器模块** — 新增 `observeIntersection` 可视区域检测(基于 IntersectionObserver)
|
|
590
|
+
|
|
591
|
+
### v1.0.5
|
|
592
|
+
|
|
593
|
+
- **控制模块** — 新增 `debounce` 防抖与 `throttle` 节流
|
|
594
|
+
|
|
595
|
+
### v1.0.4
|
|
596
|
+
|
|
597
|
+
- 初始版本,包含以下模块:
|
|
598
|
+
- **类型判断** — `isArray` `isObject` `is` `isFunction` `isAsyncFunction` `isPromise` `isDate` `isNumber` `isInt` `isFloat` `isString` `isBoolean` `isSymbol` `isPrimitive` `isNull` `isDef` `isUnDef` `isNullOrUnDef` `isEmpty` `isEmptySv` `isEqual` `isHexColor` `isValidEmail` `isPC` `isWindow` `isElement` `isIOS` 共 27 个函数
|
|
599
|
+
- **格式化** — 日期时间(`formatFull` `formatFullReplace` `formatYMD` `formatWeek`)、数字货币(`formatRmb` `formatNum` `percentCN` `compactEN` `compactCN` `signed`)、字符串(`maskPhone` `spacePhone` `capitalize` `kebabToCamel` `camelToKebab` `toCamel` `firstUpper` `firstLower` `reverse` `trimAll` `truncate` `truncateByWords`)共 22 个函数
|
|
600
|
+
- **存储** — `localGet` `localSet` `localRm` `localClear` 共 4 个函数
|
|
601
|
+
- **拷贝** — `deepClone` `deepCloneWithJSON` `shallowClone` 共 3 个函数
|
|
602
|
+
- **数组** — `unique` `uniqueByKey` `sortNumAsc` `sortNumDesc` `sortByKey` `toArray` 共 6 个函数
|
|
603
|
+
- **Cookie** — `setCookie` `getCookie` `delCookie` 共 3 个函数
|
|
604
|
+
- **浏览器** — `getUrlParams` `getUrlParam` `toQueryString` `copyToClipboard` `downloadFile` `exportJSON` `scrollToTop` `scrollToBottom` `onScroll` 共 9 个函数
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pen-it",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.7",
|
|
4
4
|
"description": "用笔锚定记忆中的前端常用工具函数,一个轻量级的前端实用程序库,支持类型检查、日期/数字格式化、字符串操作、数据存储、深度克隆、数组操作、Cookie 以及浏览器 API",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
@@ -21,23 +21,15 @@
|
|
|
21
21
|
"dist"
|
|
22
22
|
],
|
|
23
23
|
"keywords": [
|
|
24
|
+
"pen-it",
|
|
24
25
|
"utils",
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"helpers",
|
|
28
|
-
"frontend",
|
|
29
|
-
"typescript",
|
|
30
|
-
"type-checking",
|
|
31
|
-
"date-format",
|
|
32
|
-
"number-format",
|
|
33
|
-
"deep-clone",
|
|
34
|
-
"string-manipulation",
|
|
35
|
-
"array-operations",
|
|
26
|
+
"function",
|
|
27
|
+
"copy",
|
|
36
28
|
"cookie",
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"
|
|
29
|
+
"format",
|
|
30
|
+
"data types",
|
|
31
|
+
"storage",
|
|
32
|
+
"browser"
|
|
41
33
|
],
|
|
42
34
|
"author": "newborn_calf",
|
|
43
35
|
"license": "MIT",
|