mm_expand 1.8.6 → 1.8.8

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
@@ -1,28 +1,50 @@
1
1
  # mm_expand
2
2
 
3
- 这是超级美眉原型函数拓展模块,为JavaScript原生类型(String、Array、Number、Date等)提供丰富的拓展方法,使开发者能够更便捷地操作数据,简化业务逻辑,提高开发效率。
3
+ [![npm version](https://badge.fury.io/js/mm_expand.svg)](https://www.npmjs.com/package/mm_expand)
4
+ [![npm downloads](https://img.shields.io/npm/dt/mm_expand.svg)](https://www.npmjs.com/package/mm_expand)
5
+
6
+ mm_expand是一个功能丰富的JavaScript工具库,为原生类型(String、Array、Number、Date等)提供全面的原型函数扩展,帮助开发者简化数据操作,提高代码效率和可维护性。
7
+
8
+ ## 特点
9
+
10
+ - 丰富的原生类型扩展方法
11
+ - 简化文件系统操作
12
+ - 强大的对象处理功能
13
+ - 灵活的事件系统
14
+ - 轻量级且高性能
15
+ - 跨平台兼容
4
16
 
5
17
  ## 安装
6
18
 
7
19
  ```bash
8
- npm install mm_expand
20
+ npm install mm_expand --save
9
21
  ```
10
22
 
11
- ## 使用方法
23
+ ## 快速开始
12
24
 
13
25
  ```javascript
14
26
  // 引入模块
15
27
  const $ = require('mm_expand');
16
28
 
17
- // 开始使用拓展方法
18
- $.log.debug('test.json'.fullname());
19
- $.log.debug([1, 2, 3].copy());
20
- $.log.debug('2024-01-01'.toTime());
29
+ // 使用字符串扩展方法
30
+ const fullPath = 'test.json'.fullname(); // 获取完整路径
31
+
32
+ // 使用数组扩展方法
33
+ const newArray = [1, 2, 3].copy(); // 复制数组
34
+
35
+ // 使用日期扩展方法
36
+ const date = '2024-01-01'.toTime(); // 转换为Date对象
37
+
38
+ // 使用事件系统
39
+ $.eventer.on('event', (data) => {
40
+ console.log(data);
41
+ });
42
+ $.eventer.run('event', { message: 'Hello' });
21
43
  ```
22
44
 
23
- ## 核心功能模块
45
+ ## API文档
24
46
 
25
- ### 基础工具函数
47
+ ### 全局工具函数
26
48
 
27
49
  #### $.info(obj)
28
50
  - 描述:获取函数或对象的详细信息,用于调试和开发
@@ -346,23 +368,27 @@ await $.sleep(2000, obj, 'ok');
346
368
 
347
369
  ## 最佳实践
348
370
 
349
- 1. **文件路径处理**:使用`String.prototype.fullname()`获取完整路径,确保跨平台兼容性
350
- 2. **错误处理**:所有文件操作(saveText、saveJson等)都返回布尔值表示成功/失败,建议检查返回值
371
+ 1. **文件路径处理**:始终使用`String.prototype.fullname()`获取完整路径,确保跨平台兼容性
372
+ 2. **错误处理**:检查所有文件操作(saveText、saveJson等)的返回值,它们都返回布尔值表示成功/失败
351
373
  3. **异步操作**:对于需要等待的操作,如sleep、事件触发等,使用await/async语法
352
374
  4. **对象深拷贝**:使用`$.copy()`进行对象深拷贝,避免引用问题
353
- 5. **事件管理**:使用$.eventer系统进行事件发布订阅,避免直接函数调用导致的耦合
375
+ 5. **事件管理**:使用$.eventer系统进行事件发布订阅,降低代码耦合度
376
+ 6. **性能优化**:处理大量数据时,优先使用异步方法避免阻塞主线程
377
+
378
+ ## 兼容性
379
+
380
+ - Node.js 10.x及以上版本
381
+ - 支持所有现代浏览器(通过打包工具使用)
354
382
 
355
- ## 注意事项
383
+ ## 贡献指南
356
384
 
357
- 1. 所有文件路径操作都支持跨平台,内部会自动处理路径分隔符
358
- 2. 文件操作相关函数已添加错误处理,返回布尔值表示操作结果
359
- 3. 在处理大量数据时,建议使用异步方式避免阻塞主线程
360
- 4. 原型扩展可能与其他库冲突,使用时请注意命名空间隔离
385
+ 欢迎提交Issue和Pull Request!请确保您的代码遵循项目的编码规范。
361
386
 
362
387
  ## 许可证
363
388
 
364
- ISC License
389
+ [ISC License](LICENSE)
365
390
 
366
- ## 作者
391
+ ## 联系作者
367
392
 
368
- qww
393
+ - GitHub: [https://github.com/](https://github.com/)
394
+ - Gitee: [https://gitee.com/qiuwenwu91/mm_expand](https://gitee.com/qiuwenwu91/mm_expand)