a-js-tools 0.1.1 → 0.1.2

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,30 +1,35 @@
1
1
  # a-js-tools
2
2
 
3
- [![version](<https://img.shields.io/npm/v/a-js-tools.svg?logo=npm&logoColor=rgb(0,0,0)&label=version&labelColor=rgb(73,73,228)&color=rgb(0,0,0)>)](https://www.npmjs.com/package/a-js-tools) [![NPM Last Update](<https://img.shields.io/npm/last-update/a-js-tools?logo=npm&labelColor=rgb(255,36,63)&color=rgb(0,0,0)>)](https://www.npmjs.com/package/a-js-tools) [![📦 size](<https://img.shields.io/bundlephobia/minzip/a-js-tools.svg?logo=npm&labelColor=rgb(201,158,140)&color=rgb(0,0,0)>)](https://www.npmjs.com/package/a-js-tools) [![downloads](<https://img.shields.io/npm/dm/a-js-tools.svg?logo=npm&logoColor=rgb(0,0,0)&labelColor=rgb(194,112,210)&color=rgb(0,0,0)>)](https://www.npmjs.com/package/a-js-tools) [![downloads](<https://img.shields.io/npm/dt/a-js-tools.svg?logo=npm&labelColor=rgb(107,187,124)&color=rgb(0,0,0)>)](https://www.npmjs.com/package/a-js-tools)
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) [![NPM Last Update](<https://img.shields.io/npm/last-update/a-js-tools?logo=npm&label=版本最后更新&labelColor=rgb(255,36,63)&color=rgb(0,0,0)>)](https://www.npmjs.com/package/a-js-tools) [![📦 size](<https://img.shields.io/bundlephobia/minzip/a-js-tools.svg?logo=npm&label=压缩包大小&labelColor=rgb(201,158,140)&color=rgb(0,0,0)>)](https://www.npmjs.com/package/a-js-tools) [![downloads](<https://img.shields.io/npm/dm/a-js-tools.svg?logo=npm&logoColor=rgb(0,0,0)&label=月下载量&labelColor=rgb(194,112,210)&color=rgb(0,0,0)>)](https://www.npmjs.com/package/a-js-tools) [![downloads](<https://img.shields.io/npm/dt/a-js-tools.svg?logo=npm&label=总下载量&labelColor=rgb(107,187,124)&color=rgb(0,0,0)>)](https://www.npmjs.com/package/a-js-tools)
4
4
 
5
- [![last commit](<https://img.shields.io/github/last-commit/earthnutDev/a-js-tools.svg?logo=github&logoColor=rgb(0,0,0)&labelColor=rgb(255,165,0)&color=rgb(0,0,0)>)](https://github.com/earthnutDev/a-js-tools) [![GitHub commit activity](<https://img.shields.io/github/commit-activity/y/earthnutDev/a-js-tools.svg?logo=github&labelColor=rgb(128,0,128)&color=rgb(0,0,0)>)](https://github.com/earthnutDev/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)
5
+ [![last commit](<https://img.shields.io/github/last-commit/earthnutDev/a-js-tools.svg?logo=github&logoColor=rgb(0,0,0)&label=最后推码&labelColor=rgb(255,165,0)&color=rgb(0,0,0)>)](https://github.com/earthnutDev/a-js-tools) [![GitHub commit activity](<https://img.shields.io/github/commit-activity/y/earthnutDev/a-js-tools.svg?logo=github&label=推码数&labelColor=rgb(128,0,128)&color=rgb(0,0,0)>)](https://github.com/earthnutDev/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)
6
6
 
7
7
  ---
8
8
 
9
- [![🇨🇳 中文](<https://img.shields.io/badge/🇨🇳-中_%20_文-rgb(0,0,0)>)](https://github.com/earthnutDev/a-js-tools/blob/main/README-zh.md) ![🌍 English](<https://img.shields.io/badge/🌍-English-rgb(0,0,0)?style=social>) [![👀 change log](<https://img.shields.io/badge/👀-change_%20_log-rgb(0,125,206)?logo=github>)](https://github.com/earthnutDev/a-js-tools/blob/main/CHANGELOG-en.md) [![submit 🙋‍♂️ issue](<https://img.shields.io/badge/☣️-submit_%20_issue-rgb(255,0,63)?logo=github>)](https://github.com/earthnutDev/a-js-tools/issues)
9
+ [![查看 📔 日志](<https://img.shields.io/badge/👀-日_%20_志-rgb(0,125,206)>)](https://github.com/earthnutDev/a-js-tools/blob/main/CHANGELOG.md) [![bug 🙋‍♂️ 提交](<https://img.shields.io/badge/☣️-bug_%20_提交-rgb(255,0,63)>)](https://github.com/earthnutDev/a-js-tools/issues)
10
10
 
11
11
  ---
12
12
 
13
- A purely functional tool that includes .
13
+ 一个纯函数的工具
14
+
15
+ ## 安装
16
+
17
+ ```sh
18
+ npm install a-js-tools --save
19
+ ```
14
20
 
15
21
  ## pure function
16
22
 
17
- - `typeOf` Verify data type
18
- - `lmDebounce` Anti shake function
19
- - `lmThrottle` Throttling function
20
- - `getRandomInt` get random int number
21
- - `getRandomFloat` get random float number
23
+ - `lmDebounce` 防抖函数
24
+ - `lmThrottle` 节流函数
25
+ - `getRandomInt` 获取随机的整数
26
+ - `getRandomFloat` 获取随机的浮点数
22
27
 
23
- ## class name
28
+ ## class 名称转化
24
29
 
25
30
  - `toLowerCamelCase` Convert hyphenation to hump
26
31
  - `toSplitCase` Convert small hump to hyphen split
27
32
 
28
- ## Documentation
33
+ ## 查看文档
29
34
 
30
- see [https://earthnut.dev/a-js-tools/](https://earthnut.dev/a-js-tools/)
35
+ 产看 [https://earthnut.dev/a-js-tools](https://earthnut.dev/a-js-tools)
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  /**
4
- *
4
+ * 驼峰命名与连字符命名法的互换
5
5
  *
6
6
  * @packageDocumentation
7
7
  * @module @a-js-tools/class-name
@@ -9,20 +9,20 @@
9
9
  */
10
10
  /**
11
11
  *
12
- * Translates into hump nomenclature
12
+ * 连字符连接转化为小/大驼峰命名法
13
13
  *
14
- * @param str The string to be converted
15
- * @param dividingType Separator. Defaults to "-"
16
- * @param initial Whether or not to convert the first character. Default is false (small hump type)
17
- * @returns hump nomenclature string (e.g. "helloWorld")
14
+ * @param str 待转化文本
15
+ * @param dividingType 连字符,缺省值为 "-"
16
+ * @param initial 是否转换第一个字符。默认值为 false (小驼峰类型)
17
+ * @returns 驼峰命名法字符串(e.g. helloWorld”)
18
18
  *
19
19
  */
20
20
  function toLowerCamelCase(
21
- /** The string to be converted */
21
+ /** 待转化文本 */
22
22
  str,
23
- /** Separator. Defaults to "-" */
23
+ /** 连字符,缺省值为 "-" */
24
24
  dividingType = '-',
25
- /** Whether or not to convert the first character. Default is false (small hump type) */
25
+ /** 是否转换第一个字符。默认值为 false (小驼峰类型) */
26
26
  initial = false) {
27
27
  let result = str;
28
28
  /**
@@ -42,11 +42,11 @@ initial = false) {
42
42
  : result;
43
43
  }
44
44
  /**
45
- * Convert to hyphenated joins
45
+ * 驼峰命名法转化为连字符连接
46
46
  *
47
- * @param str The converted string
48
- * @param dividingType Hyphens between converted words
49
- * @returns a hyphenated string (e.g. 'hello-world')
47
+ * @param str 待转化文本
48
+ * @param dividingType 分割符
49
+ * @returns 分割符转化的文本 (e.g. 'hello-world')
50
50
  *
51
51
  */
52
52
  function toSplitCase(str, dividingType = '-') {
@@ -3,7 +3,7 @@
3
3
  var aTypeOfJs = require('a-type-of-js');
4
4
 
5
5
  /**
6
- *
6
+ * 过去随机数
7
7
  *
8
8
  * @packageDocumentation
9
9
  * @module @a-js-tools/get-random-number
@@ -11,19 +11,24 @@ var aTypeOfJs = require('a-type-of-js');
11
11
  */
12
12
  /**
13
13
  *
14
- * Get a random integer
14
+ * 获取一个随机的整数类型
15
15
  *
16
- * You can pass in two parameters and get any number between them
16
+ * 您可以传入两个参数并获取它们之间的任意数字
17
17
  *
18
- * If only one parameter is passed, this gets an integer that is less than (or greater than) that number if the value provided is negative
18
+ * 如果只传递一个参数,则如果提供的值为负数,则得到一个小于(或大于)该数字的整数
19
19
  *
20
- * @param max Maximum, not allowed `NaN`
21
- * @param min Minimum, non-desirable value `NaN`
22
- * @returns a random integer number
20
+ * @param max 较大值 ,不允许为`NaN`
21
+ * @param min 较小值,不允许为 `NaN`
22
+ * @returns 任意的整数
23
23
  */
24
24
  function getRandomInt(max = 1, min = 0) {
25
25
  // 判断是否为 NaN 或 不是数字
26
- if (aTypeOfJs.isNaN(max) || aTypeOfJs.isNaN(min) || !aTypeOfJs.isNumber(max) || !aTypeOfJs.isNumber(min)) {
26
+ if (!isFinite(max) ||
27
+ !isFinite(min) ||
28
+ aTypeOfJs.isNaN(max) ||
29
+ aTypeOfJs.isNaN(min) ||
30
+ !aTypeOfJs.isNumber(max) ||
31
+ !aTypeOfJs.isNumber(min)) {
27
32
  throw new TypeError('getRandomInt: max or min is NaN or is not a number');
28
33
  }
29
34
  /** 获取最小值 */
@@ -40,17 +45,26 @@ function getRandomInt(max = 1, min = 0) {
40
45
  }
41
46
  /**
42
47
  *
43
- * Gets a random floating-point number
48
+ * 获取任意的浮点数
44
49
  *
45
- * You can pass in two parameters and get any number between them
50
+ * 您可以传入两个参数并获取它们之间的任意数字
46
51
  *
47
- * If you pass in only one parameter, this gets the number of floating-point numbers that are less than (or greater than) that number if the value provided is negative
52
+ * 如果只传入一个参数,则如果提供的值为负数,则获取小于(或大于)该数字的浮点数
48
53
  *
49
- * @param max Maximum, default 1
50
- * @param min Minimum, default 0
51
- * @returns a random floating-point number
54
+ * @param max 较大数,缺省值为 1
55
+ * @param min 较小值,缺省值为 0
56
+ * @returns 任意的浮点数
52
57
  */
53
58
  function getRandomFloat(max = 1, min = 0) {
59
+ // 判断是否为 NaN 或 不是数字
60
+ if (!isFinite(max) ||
61
+ !isFinite(min) ||
62
+ aTypeOfJs.isNaN(max) ||
63
+ aTypeOfJs.isNaN(min) ||
64
+ !aTypeOfJs.isNumber(max) ||
65
+ !aTypeOfJs.isNumber(min)) {
66
+ throw new TypeError('getRandomInt: max or min is NaN or is not a number');
67
+ }
54
68
  if (max == min)
55
69
  max++;
56
70
  if (min > max)
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  /**
4
- *
4
+ * 防抖和节流
5
5
  *
6
6
  * @packageDocumentation
7
7
  * @module @a-js-tools/performance
@@ -9,11 +9,11 @@
9
9
  */
10
10
  /**
11
11
  *
12
- * debounce function
12
+ * 防抖
13
13
  *
14
- * @param callback
15
- * @param delay Delay time in milliseconds (ms), default 200 (ms)
16
- * @returns return a function
14
+ * @param callback 回调函数
15
+ * @param delay 延迟时间(毫秒),默认 200 (ms)
16
+ * @returns 返回的闭包函数
17
17
  * @example
18
18
  *
19
19
  * ```ts
@@ -57,11 +57,11 @@ function debounce(callback, delay = 200) {
57
57
  return result;
58
58
  }
59
59
  /**
60
- * throttle
60
+ * 节流
61
61
  *
62
- * @param callback Callback function
63
- * @param delay Delay time in milliseconds (ms), default 200 (ms)
64
- * @returns return a function
62
+ * @param callback 回调函数
63
+ * @param delay 延迟时间(毫秒),默认 200 (ms)
64
+ * @returns 返回的闭包函数
65
65
  */
66
66
  function throttle(callback, delay = 200) {
67
67
  // 强制转换非数值
@@ -1,5 +1,5 @@
1
1
  /**
2
- *
2
+ * 驼峰命名与连字符命名法的互换
3
3
  *
4
4
  * @packageDocumentation
5
5
  * @module @a-js-tools/class-name
@@ -7,20 +7,20 @@
7
7
  */
8
8
  /**
9
9
  *
10
- * Translates into hump nomenclature
10
+ * 连字符连接转化为小/大驼峰命名法
11
11
  *
12
- * @param str The string to be converted
13
- * @param dividingType Separator. Defaults to "-"
14
- * @param initial Whether or not to convert the first character. Default is false (small hump type)
15
- * @returns hump nomenclature string (e.g. "helloWorld")
12
+ * @param str 待转化文本
13
+ * @param dividingType 连字符,缺省值为 "-"
14
+ * @param initial 是否转换第一个字符。默认值为 false (小驼峰类型)
15
+ * @returns 驼峰命名法字符串(e.g. helloWorld”)
16
16
  *
17
17
  */
18
18
  function toLowerCamelCase(
19
- /** The string to be converted */
19
+ /** 待转化文本 */
20
20
  str,
21
- /** Separator. Defaults to "-" */
21
+ /** 连字符,缺省值为 "-" */
22
22
  dividingType = '-',
23
- /** Whether or not to convert the first character. Default is false (small hump type) */
23
+ /** 是否转换第一个字符。默认值为 false (小驼峰类型) */
24
24
  initial = false) {
25
25
  let result = str;
26
26
  /**
@@ -40,11 +40,11 @@ initial = false) {
40
40
  : result;
41
41
  }
42
42
  /**
43
- * Convert to hyphenated joins
43
+ * 驼峰命名法转化为连字符连接
44
44
  *
45
- * @param str The converted string
46
- * @param dividingType Hyphens between converted words
47
- * @returns a hyphenated string (e.g. 'hello-world')
45
+ * @param str 待转化文本
46
+ * @param dividingType 分割符
47
+ * @returns 分割符转化的文本 (e.g. 'hello-world')
48
48
  *
49
49
  */
50
50
  function toSplitCase(str, dividingType = '-') {
@@ -1,7 +1,7 @@
1
1
  import { isNaN, isNumber } from 'a-type-of-js';
2
2
 
3
3
  /**
4
- *
4
+ * 过去随机数
5
5
  *
6
6
  * @packageDocumentation
7
7
  * @module @a-js-tools/get-random-number
@@ -9,19 +9,24 @@ import { isNaN, isNumber } from 'a-type-of-js';
9
9
  */
10
10
  /**
11
11
  *
12
- * Get a random integer
12
+ * 获取一个随机的整数类型
13
13
  *
14
- * You can pass in two parameters and get any number between them
14
+ * 您可以传入两个参数并获取它们之间的任意数字
15
15
  *
16
- * If only one parameter is passed, this gets an integer that is less than (or greater than) that number if the value provided is negative
16
+ * 如果只传递一个参数,则如果提供的值为负数,则得到一个小于(或大于)该数字的整数
17
17
  *
18
- * @param max Maximum, not allowed `NaN`
19
- * @param min Minimum, non-desirable value `NaN`
20
- * @returns a random integer number
18
+ * @param max 较大值 ,不允许为`NaN`
19
+ * @param min 较小值,不允许为 `NaN`
20
+ * @returns 任意的整数
21
21
  */
22
22
  function getRandomInt(max = 1, min = 0) {
23
23
  // 判断是否为 NaN 或 不是数字
24
- if (isNaN(max) || isNaN(min) || !isNumber(max) || !isNumber(min)) {
24
+ if (!isFinite(max) ||
25
+ !isFinite(min) ||
26
+ isNaN(max) ||
27
+ isNaN(min) ||
28
+ !isNumber(max) ||
29
+ !isNumber(min)) {
25
30
  throw new TypeError('getRandomInt: max or min is NaN or is not a number');
26
31
  }
27
32
  /** 获取最小值 */
@@ -38,17 +43,26 @@ function getRandomInt(max = 1, min = 0) {
38
43
  }
39
44
  /**
40
45
  *
41
- * Gets a random floating-point number
46
+ * 获取任意的浮点数
42
47
  *
43
- * You can pass in two parameters and get any number between them
48
+ * 您可以传入两个参数并获取它们之间的任意数字
44
49
  *
45
- * If you pass in only one parameter, this gets the number of floating-point numbers that are less than (or greater than) that number if the value provided is negative
50
+ * 如果只传入一个参数,则如果提供的值为负数,则获取小于(或大于)该数字的浮点数
46
51
  *
47
- * @param max Maximum, default 1
48
- * @param min Minimum, default 0
49
- * @returns a random floating-point number
52
+ * @param max 较大数,缺省值为 1
53
+ * @param min 较小值,缺省值为 0
54
+ * @returns 任意的浮点数
50
55
  */
51
56
  function getRandomFloat(max = 1, min = 0) {
57
+ // 判断是否为 NaN 或 不是数字
58
+ if (!isFinite(max) ||
59
+ !isFinite(min) ||
60
+ isNaN(max) ||
61
+ isNaN(min) ||
62
+ !isNumber(max) ||
63
+ !isNumber(min)) {
64
+ throw new TypeError('getRandomInt: max or min is NaN or is not a number');
65
+ }
52
66
  if (max == min)
53
67
  max++;
54
68
  if (min > max)
@@ -1,5 +1,5 @@
1
1
  /**
2
- *
2
+ * 防抖和节流
3
3
  *
4
4
  * @packageDocumentation
5
5
  * @module @a-js-tools/performance
@@ -7,11 +7,11 @@
7
7
  */
8
8
  /**
9
9
  *
10
- * debounce function
10
+ * 防抖
11
11
  *
12
- * @param callback
13
- * @param delay Delay time in milliseconds (ms), default 200 (ms)
14
- * @returns return a function
12
+ * @param callback 回调函数
13
+ * @param delay 延迟时间(毫秒),默认 200 (ms)
14
+ * @returns 返回的闭包函数
15
15
  * @example
16
16
  *
17
17
  * ```ts
@@ -55,11 +55,11 @@ function debounce(callback, delay = 200) {
55
55
  return result;
56
56
  }
57
57
  /**
58
- * throttle
58
+ * 节流
59
59
  *
60
- * @param callback Callback function
61
- * @param delay Delay time in milliseconds (ms), default 200 (ms)
62
- * @returns return a function
60
+ * @param callback 回调函数
61
+ * @param delay 延迟时间(毫秒),默认 200 (ms)
62
+ * @returns 返回的闭包函数
63
63
  */
64
64
  function throttle(callback, delay = 200) {
65
65
  // 强制转换非数值
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "type": "module",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "name": "a-js-tools",
5
5
  "main": "cjs/index.cjs",
6
6
  "module": "mjs/index.mjs",
@@ -41,6 +41,6 @@
41
41
  "registry": "https://registry.npmjs.org/"
42
42
  },
43
43
  "dependencies": {
44
- "a-type-of-js": ">=0.1.5 <1.0.0"
44
+ "a-type-of-js": ">=0.1.6 <1.0.0"
45
45
  }
46
46
  }
@@ -1,5 +1,5 @@
1
1
  /**
2
- *
2
+ * 驼峰命名与连字符命名法的互换
3
3
  *
4
4
  * @packageDocumentation
5
5
  * @module @a-js-tools/class-name
@@ -7,27 +7,27 @@
7
7
  */
8
8
  /**
9
9
  *
10
- * Translates into hump nomenclature
10
+ * 连字符连接转化为小/大驼峰命名法
11
11
  *
12
- * @param str The string to be converted
13
- * @param dividingType Separator. Defaults to "-"
14
- * @param initial Whether or not to convert the first character. Default is false (small hump type)
15
- * @returns hump nomenclature string (e.g. "helloWorld")
12
+ * @param str 待转化文本
13
+ * @param dividingType 连字符,缺省值为 "-"
14
+ * @param initial 是否转换第一个字符。默认值为 false (小驼峰类型)
15
+ * @returns 驼峰命名法字符串(e.g. helloWorld”)
16
16
  *
17
17
  */
18
18
  export declare function toLowerCamelCase(
19
- /** The string to be converted */
19
+ /** 待转化文本 */
20
20
  str: string,
21
- /** Separator. Defaults to "-" */
21
+ /** 连字符,缺省值为 "-" */
22
22
  dividingType?: string,
23
- /** Whether or not to convert the first character. Default is false (small hump type) */
23
+ /** 是否转换第一个字符。默认值为 false (小驼峰类型) */
24
24
  initial?: boolean): string;
25
25
  /**
26
- * Convert to hyphenated joins
26
+ * 驼峰命名法转化为连字符连接
27
27
  *
28
- * @param str The converted string
29
- * @param dividingType Hyphens between converted words
30
- * @returns a hyphenated string (e.g. 'hello-world')
28
+ * @param str 待转化文本
29
+ * @param dividingType 分割符
30
+ * @returns 分割符转化的文本 (e.g. 'hello-world')
31
31
  *
32
32
  */
33
33
  export declare function toSplitCase(str: string, dividingType?: string): string;
@@ -1,26 +1,26 @@
1
1
  /**
2
2
  *
3
- * Get a random integer
3
+ * 获取一个随机的整数类型
4
4
  *
5
- * You can pass in two parameters and get any number between them
5
+ * 您可以传入两个参数并获取它们之间的任意数字
6
6
  *
7
- * If only one parameter is passed, this gets an integer that is less than (or greater than) that number if the value provided is negative
7
+ * 如果只传递一个参数,则如果提供的值为负数,则得到一个小于(或大于)该数字的整数
8
8
  *
9
- * @param max Maximum, not allowed `NaN`
10
- * @param min Minimum, non-desirable value `NaN`
11
- * @returns a random integer number
9
+ * @param max 较大值 ,不允许为`NaN`
10
+ * @param min 较小值,不允许为 `NaN`
11
+ * @returns 任意的整数
12
12
  */
13
13
  export declare function getRandomInt(max?: number, min?: number): number;
14
14
  /**
15
15
  *
16
- * Gets a random floating-point number
16
+ * 获取任意的浮点数
17
17
  *
18
- * You can pass in two parameters and get any number between them
18
+ * 您可以传入两个参数并获取它们之间的任意数字
19
19
  *
20
- * If you pass in only one parameter, this gets the number of floating-point numbers that are less than (or greater than) that number if the value provided is negative
20
+ * 如果只传入一个参数,则如果提供的值为负数,则获取小于(或大于)该数字的浮点数
21
21
  *
22
- * @param max Maximum, default 1
23
- * @param min Minimum, default 0
24
- * @returns a random floating-point number
22
+ * @param max 较大数,缺省值为 1
23
+ * @param min 较小值,缺省值为 0
24
+ * @returns 任意的浮点数
25
25
  */
26
26
  export declare function getRandomFloat(max?: number, min?: number): number;
@@ -7,42 +7,49 @@
7
7
  */
8
8
  export type RandomStringOptions = {
9
9
  /**
10
- * string length
10
+ * 字符串长度
11
+ *
11
12
  * @default 32
12
13
  */
13
14
  length?: number;
14
15
  /**
15
- * String optional characters
16
+ * 字符集
16
17
  * @default '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
17
18
  */
18
19
  chars?: string;
19
20
  /**
20
- * Whether or not to include numbers
21
+ * 是否包含数字
22
+ *
21
23
  * @default false
22
24
  */
23
25
  includeNumbers?: boolean;
24
26
  /**
25
- * Whether or not to include capital letters
27
+ * 是否包含大写字母
28
+ *
26
29
  * @default false
27
30
  */
28
31
  includeUppercaseLetters?: boolean;
29
32
  /**
30
- * Whether or not it contains special characters
33
+ * 是否包含特殊字符
34
+ *
31
35
  * @default false
32
36
  */
33
37
  includeSpecial?: boolean;
34
38
  /**
35
- * String type
39
+ * 字符类型
40
+ *
41
+ * 缺省值为 'string',可选为 'uuid'
42
+ *
36
43
  * @default 'string''
37
44
  */
38
45
  type?: 'string' | 'uuid';
39
46
  };
40
47
  /**
41
48
  *
42
- * Random string generation
49
+ * 获取随机字符串
43
50
  *
44
- * @param length - string length
45
- * @returns - A random string of characters generated
51
+ * @param length - 字符串长度
52
+ * @returns - 随机字符串
46
53
  *
47
54
  *
48
55
  */
@@ -1,5 +1,5 @@
1
1
  /**
2
- *
2
+ * 防抖和节流
3
3
  *
4
4
  * @packageDocumentation
5
5
  * @module @a-js-tools/performance
@@ -8,7 +8,7 @@
8
8
  type Callback = (...args: unknown[]) => void;
9
9
  /**
10
10
  *
11
- * debounce or throttle function return value type
11
+ * 节流和防抖返回值类型
12
12
  *
13
13
  */
14
14
  export interface DebounceAndThrottleReturnType<F extends Callback> {
@@ -17,11 +17,11 @@ export interface DebounceAndThrottleReturnType<F extends Callback> {
17
17
  }
18
18
  /**
19
19
  *
20
- * debounce function
20
+ * 防抖
21
21
  *
22
- * @param callback
23
- * @param delay Delay time in milliseconds (ms), default 200 (ms)
24
- * @returns return a function
22
+ * @param callback 回调函数
23
+ * @param delay 延迟时间(毫秒),默认 200 (ms)
24
+ * @returns 返回的闭包函数
25
25
  * @example
26
26
  *
27
27
  * ```ts
@@ -35,11 +35,11 @@ export interface DebounceAndThrottleReturnType<F extends Callback> {
35
35
  */
36
36
  export declare function debounce<F extends (...args: unknown[]) => void>(callback: F, delay?: number): DebounceAndThrottleReturnType<F>;
37
37
  /**
38
- * throttle
38
+ * 节流
39
39
  *
40
- * @param callback Callback function
41
- * @param delay Delay time in milliseconds (ms), default 200 (ms)
42
- * @returns return a function
40
+ * @param callback 回调函数
41
+ * @param delay 延迟时间(毫秒),默认 200 (ms)
42
+ * @returns 返回的闭包函数
43
43
  */
44
44
  export declare function throttle<F extends (...args: unknown[]) => void>(callback: F, delay?: number): DebounceAndThrottleReturnType<F>;
45
45
  export {};
package/CHANGELOG-en.md DELETED
@@ -1,28 +0,0 @@
1
- # change log
2
-
3
- [![中文 🇨🇳](<https://img.shields.io/badge/🇨🇳-自述_%20_文件-rgb(255,12,36)>)](https://github.com/earthnutDev/a-js-tools/blob/main/README-zh.md) [![English 🌍](<https://img.shields.io/badge/🌍-README-rgb(0,0,0)>)](https://github.com/earthnutDev/a-js-tools/blob/main/README.md) [![查看 📔 日志](<https://img.shields.io/badge/👀-日_%20_志-rgb(0,125,206)>)](https://github.com/earthnutDev/a-js-tools/blob/main/CHANGELOG.md) ![查看 📔 日志](<https://img.shields.io/badge/👀-Change_%20_log-rgb(0,125,206)?style=social>)
4
-
5
- ## 0.1.1(3/23/2025)
6
-
7
- - There are no feature updates
8
-
9
- ## 0.1.0(3/22/2025)
10
-
11
- - There are no feature updates
12
-
13
- ## 0.0.4(3/21/2025)
14
-
15
- - There are no feature updates
16
- - Updated badge links and how test coverage badges are displayed
17
-
18
- ## 0.0.3(3/16/2025)
19
-
20
- - The previous version's dependency `a-type-of-js` exception was not detected and has been fixed
21
-
22
- ## 0.0.2(3/15/2025)
23
-
24
- - add test coverage percentage badge
25
-
26
- ## 0.0.1(3/7/2025)
27
-
28
- - Refine the test