a-js-tools 1.0.10-test.0 → 1.0.11

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,6 +1,6 @@
1
1
  # 一点点 🤏 js 函数
2
2
 
3
- [![version](<https://img.shields.io/npm/v/a-js-tools.svg?logo=npm&logoColor=rgb(0,0,0)&label=版本号&labelColor=rgb(73,73,228)&color=rgb(0,0,0)>)](https://www.npmjs.com/package/a-js-tools) [![Coverage Status](<https://img.shields.io/coverallsCoverage/github/earthnutDev/a-js-tools?logo=coveralls&label=coveralls&labelColor=rgb(12, 244, 39)&color=rgb(0,0,0)>)](https://coveralls.io/github/earthnutDev/a-js-tools?branch=main) [![codecov](<https://img.shields.io/codecov/c/github/earthnutDev/a-js-tools/main?logo=codecov&label=codecov&labelColor=rgb(7, 245, 245)&color=rgb(0,0,0)>)](https://codecov.io/gh/earthnutDev/a-js-tools) [![issues 提交](<https://img.shields.io/badge/issues-提交-rgb(255,0,63)?logo=github>)](https://github.com/earthnutDev/a-js-tools/issues)
3
+ [![version](<https://img.shields.io/npm/v/a-js-tools.svg?logo=npm&logoColor=rgb(0,0,0)&label=版本号&labelColor=rgb(73,73,228)&color=rgb(0,0,0)>)](https://www.npmjs.com/package/a-js-tools) [![issues 提交](<https://img.shields.io/badge/issues-提交-rgb(255,0,63)?logo=github>)](https://github.com/earthnutDev/a-js-tools/issues)
4
4
  一个纯函数的工具
5
5
 
6
6
  ## 安装
@@ -11,8 +11,8 @@ npm install --save a-js-tools
11
11
 
12
12
  ## 纯函数
13
13
 
14
- - `lmDebounce` 防抖函数
15
- - `lmThrottle` 节流函数
14
+ - `debounce` 防抖函数
15
+ - `throttle` 节流函数
16
16
  - `getRandomInt` 获取随机的整数
17
17
  - `getRandomFloat` 获取随机的浮点数
18
18
  - `getRandomString` 获取随机字符串
@@ -37,4 +37,4 @@ npm install --save a-js-tools
37
37
 
38
38
  ## 查看文档
39
39
 
40
- 查看 [https://earthnut.dev/a-js-tools](https://earthnut.dev/a-js-tools)
40
+ 查看 [https://earthnut.dev/npm/a-js-tools](https://earthnut.dev/npm/a-js-tools)
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "type": "module",
3
- "version": "1.0.10-test.0",
3
+ "version": "1.0.11",
4
4
  "name": "a-js-tools",
5
5
  "description": "一点点 🤏 js 函数",
6
6
  "license": "MIT",
7
7
  "dependencies": {
8
- "a-type-of-js": "^1.0.5"
8
+ "a-type-of-js": "^1.0.7"
9
9
  },
10
10
  "main": "index.cjs",
11
11
  "module": "index.mjs",
@@ -34,7 +34,7 @@
34
34
  "email": "earthnut.dev@outlook.com",
35
35
  "url": "https://earthnut.dev/about"
36
36
  },
37
- "homepage": "https://earthnut.dev/a-js-tools",
37
+ "homepage": "https://earthnut.dev/npm/a-js-tools",
38
38
  "bugs": {
39
39
  "url": "https://github.com/earthnutDev/a-js-tools/issues",
40
40
  "email": "earthnut.dev@outlook.com"
@@ -13,7 +13,7 @@ var aTypeOfJs = require('a-type-of-js');
13
13
  *
14
14
  * 获取一个随机的整数类型
15
15
  *
16
- * 您可以传入两个参数并获取它们之间的任意数字
16
+ * 您可以传入两个参数并获取它们之间的任意数字,返回值<span style="color:#ff0;">*会包含端值*</span>
17
17
  *
18
18
  * 如果只传递一个参数,则如果提供的值为负数,则得到一个小于(或大于)该数字的整数
19
19
  *
@@ -35,12 +35,12 @@ function getRandomInt(max = 1, min = 0) {
35
35
  let _min = Math.ceil(Number(min)),
36
36
  /** 获取最大值 */
37
37
  _max = Math.floor(Number(max));
38
- /** 两值交换 */
39
- if (_min > _max)
40
- [_max, _min] = [_min, _max];
41
- //** 两值相等时,直接返回最大值 */
38
+ // 两值相等时,直接返回最大值
42
39
  if (_max === _min)
43
40
  return _max;
41
+ // 两值交换
42
+ if (_min > _max)
43
+ [_max, _min] = [_min, _max];
44
44
  return Math.round(Math.random() * (_max - _min) + _min);
45
45
  }
46
46
  /**
@@ -2,7 +2,7 @@
2
2
  *
3
3
  * 获取一个随机的整数类型
4
4
  *
5
- * 您可以传入两个参数并获取它们之间的任意数字
5
+ * 您可以传入两个参数并获取它们之间的任意数字,返回值<span style="color:#ff0;">*会包含端值*</span>
6
6
  *
7
7
  * 如果只传递一个参数,则如果提供的值为负数,则得到一个小于(或大于)该数字的整数
8
8
  *
@@ -11,7 +11,7 @@ import { isNaN, isNumber } from 'a-type-of-js';
11
11
  *
12
12
  * 获取一个随机的整数类型
13
13
  *
14
- * 您可以传入两个参数并获取它们之间的任意数字
14
+ * 您可以传入两个参数并获取它们之间的任意数字,返回值<span style="color:#ff0;">*会包含端值*</span>
15
15
  *
16
16
  * 如果只传递一个参数,则如果提供的值为负数,则得到一个小于(或大于)该数字的整数
17
17
  *
@@ -33,12 +33,12 @@ function getRandomInt(max = 1, min = 0) {
33
33
  let _min = Math.ceil(Number(min)),
34
34
  /** 获取最大值 */
35
35
  _max = Math.floor(Number(max));
36
- /** 两值交换 */
37
- if (_min > _max)
38
- [_max, _min] = [_min, _max];
39
- //** 两值相等时,直接返回最大值 */
36
+ // 两值相等时,直接返回最大值
40
37
  if (_max === _min)
41
38
  return _max;
39
+ // 两值交换
40
+ if (_min > _max)
41
+ [_max, _min] = [_min, _max];
42
42
  return Math.round(Math.random() * (_max - _min) + _min);
43
43
  }
44
44
  /**
@@ -38,6 +38,13 @@
38
38
  *
39
39
  */
40
40
  function createConstructor(constructor) {
41
+ constructor.prototype.apply = Function.apply;
42
+ constructor.prototype.bind = Function.bind;
43
+ constructor.prototype.call = Function.call;
44
+ constructor.prototype.length = Function.length;
45
+ constructor.prototype.arguments = Function.arguments;
46
+ constructor.prototype.name = Function.name;
47
+ constructor.prototype.toString = Function.toString;
41
48
  return constructor;
42
49
  }
43
50
 
@@ -36,6 +36,13 @@
36
36
  *
37
37
  */
38
38
  function createConstructor(constructor) {
39
+ constructor.prototype.apply = Function.apply;
40
+ constructor.prototype.bind = Function.bind;
41
+ constructor.prototype.call = Function.call;
42
+ constructor.prototype.length = Function.length;
43
+ constructor.prototype.arguments = Function.arguments;
44
+ constructor.prototype.name = Function.name;
45
+ constructor.prototype.toString = Function.toString;
39
46
  return constructor;
40
47
  }
41
48