a-js-tools 2.0.0 → 2.0.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.
Files changed (52) hide show
  1. package/README.md +0 -4
  2. package/cjs/array/difference.js +1 -4
  3. package/cjs/array/index.js +9 -30
  4. package/cjs/array/intersection.js +1 -6
  5. package/cjs/array/symmetricDifference.js +1 -7
  6. package/cjs/className.js +0 -4
  7. package/cjs/getRandomNumber.js +3 -9
  8. package/cjs/getRandomString.js +19 -19
  9. package/cjs/index.js +4 -4
  10. package/cjs/isNode.js +0 -4
  11. package/cjs/object/createConstructor.js +2 -5
  12. package/cjs/performance.js +8 -16
  13. package/cjs/regexp/autoEscapedRegExp.js +1 -5
  14. package/cjs/regexp/escapeRegExp.js +6 -8
  15. package/cjs/regexp/parse.js +0 -2
  16. package/cjs/sleep.js +3 -6
  17. package/es/array/difference.js +1 -4
  18. package/es/array/index.js +9 -30
  19. package/es/array/intersection.js +1 -6
  20. package/es/array/symmetricDifference.js +1 -7
  21. package/es/className.js +0 -4
  22. package/es/getRandomNumber.js +3 -9
  23. package/es/getRandomString.js +19 -19
  24. package/es/index.js +2 -2
  25. package/es/isNode.js +0 -4
  26. package/es/object/createConstructor.js +2 -5
  27. package/es/performance.js +5 -13
  28. package/es/regexp/autoEscapedRegExp.js +1 -5
  29. package/es/regexp/escapeRegExp.js +6 -8
  30. package/es/regexp/parse.js +0 -2
  31. package/es/sleep.js +2 -5
  32. package/es/{src → types}/array/difference.d.ts +1 -4
  33. package/es/{src → types}/array/index.d.ts +9 -30
  34. package/es/{src → types}/array/intersection.d.ts +1 -6
  35. package/es/{src → types}/array/symmetricDifference.d.ts +1 -7
  36. package/es/{src → types}/className.d.ts +0 -4
  37. package/es/{src → types}/getRandomNumber.d.ts +2 -4
  38. package/es/{src → types}/getRandomString.d.ts +11 -8
  39. package/es/{src → types}/isNode.d.ts +0 -4
  40. package/es/{src → types}/object/createConstructor.d.ts +2 -8
  41. package/es/{src → types}/performance.d.ts +4 -15
  42. package/es/{src → types}/regexp/autoEscapedRegExp.d.ts +1 -5
  43. package/es/types/regexp/escapeRegExp.d.ts +16 -0
  44. package/es/{src → types}/regexp/parse.d.ts +0 -2
  45. package/es/{src → types}/regexp/types.d.ts +0 -5
  46. package/es/{src → types}/sleep.d.ts +0 -3
  47. package/package.json +16 -24
  48. package/es/src/regexp/escapeRegExp.d.ts +0 -18
  49. /package/es/{src → types}/array/union.d.ts +0 -0
  50. /package/es/{src → types}/index.d.ts +0 -0
  51. /package/es/{src → types}/object/index.d.ts +0 -0
  52. /package/es/{src → types}/regexp/index.d.ts +0 -0
package/README.md CHANGED
@@ -34,7 +34,3 @@ npm install --save a-js-tools
34
34
  - `difference` 方法,计算两个数组的差集(以第一个数组为基准)
35
35
  - `symmetricDifference` 方法,计算两个数组的对称差集(在两个数组都不共有的元素)
36
36
  - `enArr` 对象,包含上面的方法
37
-
38
- ## 查看文档
39
-
40
- 查看 [https://earthnut.dev/npm/a-js-tools](https://earthnut.dev/npm/a-js-tools)
@@ -3,7 +3,7 @@
3
3
  var aTypeOfJs = require('a-type-of-js');
4
4
 
5
5
  /**
6
- * 求给出的两个数组的差值(A - B)
6
+ * ## 求给出的两个数组的差值(A - B)
7
7
  *
8
8
  * @param a - 第一个数组
9
9
  * @param b - 第二个数组
@@ -11,13 +11,11 @@ var aTypeOfJs = require('a-type-of-js');
11
11
  * @description 当两个参数有一个不是数组时将抛出
12
12
  * @returns 返回第一个参数相对第二个参数的差值
13
13
  * @example
14
- *
15
14
  * ```ts
16
15
  * import { difference} from 'a-js-tools';
17
16
  *
18
17
  * const log = console.log;
19
18
  *
20
- *
21
19
  * log(difference([], [1, 2, 3])); // []
22
20
  *
23
21
  * log([1, 2, 3], []); //[1, 2, 3]
@@ -31,7 +29,6 @@ var aTypeOfJs = require('a-type-of-js');
31
29
  * log(difference([1, 2, 3], null));
32
30
  * log(difference([1, 2, 3], true));
33
31
  * ```
34
- *
35
32
  */
36
33
  function difference(a, b) {
37
34
  if (!aTypeOfJs.isArray(a) || !aTypeOfJs.isArray(b)) {
@@ -6,25 +6,19 @@ var difference = require('./difference.js');
6
6
  var symmetricDifference = require('./symmetricDifference.js');
7
7
 
8
8
  /**
9
+ * ## 数组的一些方法
9
10
  *
10
- * 数组的一些方法
11
- *
12
- * - union 两个数组的并集(排除共有项)
13
- * - intersection 两个数组的交集(共有项)
14
- * - difference 两个数组的差集 (A - B)
15
- * - symmetricDifference 对称差集 ( A △ B)
16
- *
11
+ * - `union` 两个数组的并集(排除共有项)
12
+ * - `intersection` 两个数组的交集(共有项)
13
+ * - `difference` 两个数组的差集 (A - B)
14
+ * - `symmetricDifference` 对称差集 ( A △ B)
17
15
  */
18
16
  const enArr = {
19
17
  /**
20
- *
21
- * 数组的并集
22
- *
18
+ * ### 数组的并集
23
19
  * <span style="color:#f36;">请注意,参数有不为数组时直接抛出 TypeError</span>
24
20
  * @param arrays - 多个数组
25
21
  * @returns 联合后的数组
26
- *
27
- *
28
22
  * @example
29
23
  *
30
24
  * ```ts
@@ -55,33 +49,27 @@ const enArr = {
55
49
  * // [1, 2, 3, 4, 6]
56
50
  * log(union([1, 2, 3], [2, 4, 6], [1, 2, 3], [1, 2, 3]));
57
51
  * ```
58
- *
59
52
  */
60
53
  union: union.union,
61
54
  /**
62
- *
63
- * 两个数组的交集
55
+ * ### 两个数组的交集
64
56
  *
65
57
  * @param a 数组 1️⃣
66
58
  * @param b 数组 2️⃣
67
59
  * @returns 返回两个数组的交集
68
60
  * @example
69
- *
70
61
  * ```ts
71
62
  * import { intersection } from 'a-js-tools';
72
63
  *
73
64
  * const log = console.log;
74
65
  *
75
- *
76
66
  * log(intersection([1, 2, 3, 4], [2, 3])); // [2, 3]
77
67
  * log(intersection([1, 3, 5, 7], [2, 3, 4])); // [3]
78
- *
79
68
  * ```
80
- *
81
69
  */
82
70
  intersection: intersection.intersection,
83
71
  /**
84
- * 求给出的两个数组的差值(A - B)
72
+ * ### 求给出的两个数组的差值(A - B)
85
73
  *
86
74
  * @param a - 第一个数组
87
75
  * @param b - 第二个数组
@@ -89,13 +77,11 @@ const enArr = {
89
77
  * @description 当两个参数有一个不是数组时将抛出
90
78
  * @returns 返回第一个参数相对第二个参数的差值
91
79
  * @example
92
- *
93
80
  * ```ts
94
81
  * import { difference} from 'a-js-tools';
95
82
  *
96
83
  * const log = console.log;
97
84
  *
98
- *
99
85
  * log(difference([], [1, 2, 3])); // []
100
86
  *
101
87
  * log([1, 2, 3], []); //[1, 2, 3]
@@ -109,19 +95,15 @@ const enArr = {
109
95
  * log(difference([1, 2, 3], null));
110
96
  * log(difference([1, 2, 3], true));
111
97
  * ```
112
- *
113
98
  */
114
99
  difference: difference.difference,
115
100
  /**
116
- *
117
- * 对称差集 ( A △ B)
101
+ * ### 对称差集 ( A △ B)
118
102
  *
119
103
  * @param a - 数组 a
120
104
  * @param b - 数组 b
121
105
  * @returns - 返回一个全新的数组
122
- *
123
106
  * @example
124
- *
125
107
  * ```ts
126
108
  * import { symmetricDifference } from 'a-js-tools';
127
109
  *
@@ -133,16 +115,13 @@ const enArr = {
133
115
  *
134
116
  * log(symmetricDifference([1, 2, 3], [1, 2, 3])); // []
135
117
  *
136
- *
137
118
  * /// TypeError
138
119
  * log(symmetricDifference(1, []));
139
120
  * log(symmetricDifference(undefined, []));
140
121
  * log(symmetricDifference(null, []));
141
122
  * log(symmetricDifference('a', []));
142
123
  * log(symmetricDifference(true, []));
143
- *
144
124
  * ```
145
- *
146
125
  */
147
126
  symmetricDifference: symmetricDifference.symmetricDifference,
148
127
  };
@@ -3,25 +3,20 @@
3
3
  var aTypeOfJs = require('a-type-of-js');
4
4
 
5
5
  /**
6
- *
7
- * 两个数组的交集
6
+ * ## 两个数组的交集
8
7
  *
9
8
  * @param a 数组 1️⃣
10
9
  * @param b 数组 2️⃣
11
10
  * @returns 返回两个数组的交集
12
11
  * @example
13
- *
14
12
  * ```ts
15
13
  * import { intersection } from 'a-js-tools';
16
14
  *
17
15
  * const log = console.log;
18
16
  *
19
- *
20
17
  * log(intersection([1, 2, 3, 4], [2, 3])); // [2, 3]
21
18
  * log(intersection([1, 3, 5, 7], [2, 3, 4])); // [3]
22
- *
23
19
  * ```
24
- *
25
20
  */
26
21
  function intersection(a, b) {
27
22
  if (!aTypeOfJs.isArray(a) || !aTypeOfJs.isArray(b)) {
@@ -4,15 +4,12 @@ var aTypeOfJs = require('a-type-of-js');
4
4
  var difference = require('./difference.js');
5
5
 
6
6
  /**
7
- *
8
- * 对称差集 ( A △ B)
7
+ * ## 对称差集 ( A △ B)
9
8
  *
10
9
  * @param a - 数组 a
11
10
  * @param b - 数组 b
12
11
  * @returns - 返回一个全新的数组
13
- *
14
12
  * @example
15
- *
16
13
  * ```ts
17
14
  * import { symmetricDifference } from 'a-js-tools';
18
15
  *
@@ -24,16 +21,13 @@ var difference = require('./difference.js');
24
21
  *
25
22
  * log(symmetricDifference([1, 2, 3], [1, 2, 3])); // []
26
23
  *
27
- *
28
24
  * /// TypeError
29
25
  * log(symmetricDifference(1, []));
30
26
  * log(symmetricDifference(undefined, []));
31
27
  * log(symmetricDifference(null, []));
32
28
  * log(symmetricDifference('a', []));
33
29
  * log(symmetricDifference(true, []));
34
- *
35
30
  * ```
36
- *
37
31
  */
38
32
  function symmetricDifference(a, b) {
39
33
  if (!aTypeOfJs.isArray(a) || !aTypeOfJs.isArray(b)) {
package/cjs/className.js CHANGED
@@ -2,10 +2,6 @@
2
2
 
3
3
  /**
4
4
  * 驼峰命名与连字符命名法的互换
5
- *
6
- * @packageDocumentation
7
- * @module @a-js-tools/class-name
8
- * @license MIT
9
5
  */
10
6
  /**
11
7
  *
@@ -3,15 +3,10 @@
3
3
  var aTypeOfJs = require('a-type-of-js');
4
4
 
5
5
  /**
6
- * 过去随机数
7
- *
8
- * @packageDocumentation
9
- * @module @a-js-tools/get-random-number
10
- * @license MIT
6
+ * 获取随机数
11
7
  */
12
8
  /**
13
- *
14
- * 获取一个随机的整数类型
9
+ * ## 获取一个随机的整数类型
15
10
  *
16
11
  * 您可以传入两个参数并获取它们之间的任意数字,返回值<span style="color:#ff0;">*会包含端值*</span>
17
12
  *
@@ -44,8 +39,7 @@ function getRandomInt(max = 1, min = 0) {
44
39
  return Math.round(Math.random() * (_max - _min) + _min);
45
40
  }
46
41
  /**
47
- *
48
- * 获取任意的浮点数
42
+ * ## 获取任意的浮点数
49
43
  *
50
44
  * 您可以传入两个参数并获取它们之间的任意数字
51
45
  *
@@ -6,19 +6,20 @@ var getRandomNumber = require('./getRandomNumber.js');
6
6
 
7
7
  /**
8
8
  * 获取随机字符串
9
- *
10
- * @packageDocumentation
11
- * @module @a-js-tools/get-random-string
12
- * @license MIT
13
9
  */
14
10
  /**
11
+ * 获取简单的随机字符串
15
12
  *
16
- * 获取简单的随机字符串
17
- *
18
- * @param options - 字符串长度
19
- * @returns - 随机字符串
20
- *
13
+ * @param options - 字符串生成参数
14
+ * @returns - 随机字符串
15
+ * @example
16
+ * ```ts
17
+ * import { getRandomString } from 'a-js-tools';
21
18
  *
19
+ * // 获取简单的随机字符串
20
+ * // 'abcdefg'
21
+ * // getRandomString(7);
22
+ * ```
22
23
  */
23
24
  function getRandomString(options) {
24
25
  // 验证输入参数
@@ -90,18 +91,17 @@ function getRandomString(options) {
90
91
  result += str[getRandomNumber.getRandomInt(strLen - 1)];
91
92
  }
92
93
  /**
94
+ * ## 字符串交叉函数
93
95
  *
94
- * 字符串交叉函数
95
- *
96
- * 非线形串交叉,对相交叉
96
+ * 非线形串交叉,对相交叉
97
97
  *
98
- * @param str1 - 字符串1
99
- * @param str2 - 字符串2
100
- * @returns - 交叉后的字符串
101
- * @example
102
- * ```ts
103
- * interleaveString('abc', '123') // 'a1b2c3'
104
- * ```
98
+ * @param str1 - 字符串1
99
+ * @param str2 - 字符串2
100
+ * @returns - 交叉后的字符串
101
+ * @example
102
+ * ```ts
103
+ * interleaveString('abc', '123') // 'a1b2c3'
104
+ * ```
105
105
  */
106
106
  function interleaveString(str1, str2) {
107
107
  const str1Length = str1.length, str2Length = str2.length;
package/cjs/index.js CHANGED
@@ -10,10 +10,10 @@ var autoEscapedRegExp = require('./regexp/autoEscapedRegExp.js');
10
10
  var isNode = require('./isNode.js');
11
11
  var index = require('./array/index.js');
12
12
  var sleep = require('./sleep.js');
13
- var intersection = require('./array/intersection.js');
14
- var union = require('./array/union.js');
15
13
  var difference = require('./array/difference.js');
14
+ var intersection = require('./array/intersection.js');
16
15
  var symmetricDifference = require('./array/symmetricDifference.js');
16
+ var union = require('./array/union.js');
17
17
 
18
18
 
19
19
 
@@ -32,7 +32,7 @@ exports.isBrowser = isNode.isBrowser;
32
32
  exports.isNode = isNode.isNode;
33
33
  exports.enArr = index.enArr;
34
34
  exports.sleep = sleep.sleep;
35
- exports.intersection = intersection.intersection;
36
- exports.union = union.union;
37
35
  exports.difference = difference.difference;
36
+ exports.intersection = intersection.intersection;
38
37
  exports.symmetricDifference = symmetricDifference.symmetricDifference;
38
+ exports.union = union.union;
package/cjs/isNode.js CHANGED
@@ -3,9 +3,7 @@
3
3
  var aTypeOfJs = require('a-type-of-js');
4
4
 
5
5
  /**
6
- *
7
6
  * 判断当前环境是否为 node 环境
8
- *
9
7
  */
10
8
  function isNode() {
11
9
  return !aTypeOfJs.isUndefined((globalThis &&
@@ -15,9 +13,7 @@ function isNode() {
15
13
  undefined);
16
14
  }
17
15
  /**
18
- *
19
16
  * 是否为浏览器环境
20
- *
21
17
  */
22
18
  function isBrowser() {
23
19
  return !isNode();
@@ -1,8 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  /**
4
- *
5
- * 构建一个 Constructor 构造函数
4
+ * # 构建一个 Constructor 构造函数
6
5
  *
7
6
  * 接收一个构造函数,然后返回 TS 能识别的构造函数自身
8
7
  *
@@ -12,7 +11,7 @@
12
11
  *
13
12
  * @param constructor - 传入一个构造函数
14
13
  * @returns 返回传入的构造函数
15
- *
14
+ * @example
16
15
  * ```ts
17
16
  * import { createConstructor } from "a-js-tools";
18
17
  *
@@ -33,9 +32,7 @@
33
32
  * const tomConstructor = createConstructor(_tom);
34
33
  *
35
34
  * const b = new tomConstructor(); // 这时就不会显示错误
36
- *
37
35
  * ```
38
- *
39
36
  */
40
37
  function createConstructor(constructor) {
41
38
  constructor.prototype.apply = Function.apply;
@@ -1,18 +1,11 @@
1
1
  'use strict';
2
2
 
3
3
  var aTypeOfJs = require('a-type-of-js');
4
- var isFunction = require('a-type-of-js/isFunction');
5
- var isNumber = require('a-type-of-js/isNumber');
6
4
 
7
5
  /**
8
6
  * 防抖和节流
9
- *
10
- * @packageDocumentation
11
- * @module @a-js-tools/performance
12
- * @license MIT
13
7
  */
14
8
  /**
15
- *
16
9
  * 防抖
17
10
  *
18
11
  * @param callback 回调函数
@@ -23,16 +16,15 @@ var isNumber = require('a-type-of-js/isNumber');
23
16
  * ```ts
24
17
  * const debounce = (callback: Function, delay = 300) => {
25
18
  * let timer: any = null
26
- * return (...args: any[]) => {
27
- * clearTimeout(timer)
28
- * }
29
- * }
30
19
  *
20
+ * return (...args: any[]) => clearTimeout(timer)
21
+ * }
22
+ * ```
31
23
  */
32
24
  function debounce(callback, options = 200) {
33
- if (!isFunction.isFunction(callback))
25
+ if (!aTypeOfJs.isFunction(callback))
34
26
  throw new TypeError('callback must be a function');
35
- if (isNumber.isNumber(options))
27
+ if (aTypeOfJs.isNumber(options))
36
28
  options = {
37
29
  delay: options,
38
30
  this: null,
@@ -68,16 +60,16 @@ function debounce(callback, options = 200) {
68
60
  return result;
69
61
  }
70
62
  /**
71
- * 节流
63
+ * 节流
72
64
  *
73
65
  * @param callback 回调函数
74
66
  * @param options 延迟时间(毫秒),默认 200 (ms) 或设置 this
75
67
  * @returns 返回的闭包函数
76
68
  */
77
69
  function throttle(callback, options = 200) {
78
- if (!isFunction.isFunction(callback))
70
+ if (!aTypeOfJs.isFunction(callback))
79
71
  throw new TypeError('callback must be a function');
80
- if (isNumber.isNumber(options))
72
+ if (aTypeOfJs.isNumber(options))
81
73
  options = {
82
74
  delay: options,
83
75
  this: null,
@@ -5,8 +5,7 @@ var escapeRegExp = require('./escapeRegExp.js');
5
5
  var parse = require('./parse.js');
6
6
 
7
7
  /**
8
- *
9
- * ## 适用于简单的文本字符串自动转化为简单模式正则表达式
8
+ * ## 适用于简单的文本字符串自动转化为简单模式正则表达式
10
9
  *
11
10
  * *若字符串包含且需保留字符类、组、反向引用、量词等时,该方法可能不适用*
12
11
  *
@@ -14,7 +13,6 @@ var parse = require('./parse.js');
14
13
  * @param options 转化选项。 为文本字符串时,默认为正则表达式的标志,还可指定是否匹配开头或结尾
15
14
  * @returns 正则表达式
16
15
  * @example
17
- *
18
16
  * ```ts
19
17
  * import { autoEscapedRegExp } from 'a-regexp';
20
18
  *
@@ -30,9 +28,7 @@ var parse = require('./parse.js');
30
28
  * autoEscapedRegExp('a-zA-Z0-9', 'g'); // => /a-zA-Z0-9/g
31
29
  * autoEscapedRegExp('[a-zA-Z0-9]'); // => /\[a-zA-Z0-9\]/
32
30
  * autoEscapedRegExp('^[a-zA-Z0-9]+$'); // => /\^\[a-zA-Z0-9\]\$/
33
- *
34
31
  * ```
35
- *
36
32
  */
37
33
  function autoEscapedRegExp(pattern, options) {
38
34
  if (!aTypeOfJs.isString(pattern))
@@ -1,20 +1,18 @@
1
1
  'use strict';
2
2
 
3
3
  /**
4
- *
5
- * 将一个字符串转化为符合正则要求的字符串
4
+ * # 将一个字符串转化为符合正则要求的字符串
6
5
  *
7
6
  * @param str 需要转义的字符串
8
7
  * @requires escapeRegExp 转化后字符串
9
8
  * @example
10
- *
11
9
  * ```ts
12
- * import { escapeRegExp } from 'a-js-tools';
10
+ * import { escapeRegExp } from 'a-js-tools';
13
11
  *
14
- * escapeRegExp('a.b.c'); // 'a\\.b\\.c'
15
- * escapeRegExp('a\\.b\\.c'); // 'a\\\\.b\\\\.c'
16
- * escapeRegExp('[a-z]'); // '\\[a-z\\]'
17
- * escapeRegExp('^abc$'); // '\\^abc\\$'
12
+ * escapeRegExp('a.b.c'); // 'a\\.b\\.c'
13
+ * escapeRegExp('a\\.b\\.c'); // 'a\\\\.b\\\\.c'
14
+ * escapeRegExp('[a-z]'); // '\\[a-z\\]'
15
+ * escapeRegExp('^abc$'); // '\\^abc\\$'
18
16
  * ```
19
17
  */
20
18
  function escapeRegExp(str) {
@@ -3,9 +3,7 @@
3
3
  var aTypeOfJs = require('a-type-of-js');
4
4
 
5
5
  /**
6
- *
7
6
  * 解析 options
8
- *
9
7
  */
10
8
  function parse(options) {
11
9
  // 处理 options
package/cjs/sleep.js CHANGED
@@ -1,9 +1,8 @@
1
1
  'use strict';
2
2
 
3
- var isNumber = require('a-type-of-js/isNumber');
3
+ var aTypeOfJs = require('a-type-of-js');
4
4
 
5
5
  /**
6
- *
7
6
  * ## 线程休息
8
7
  *
9
8
  * 但从调用到执行完毕总是与期望的时间并不相吻合,除非执行是线型的(也不保证时间的严格性)
@@ -23,14 +22,12 @@ var isNumber = require('a-type-of-js/isNumber');
23
22
  * console.log(Date.now()); // 1748058118471
24
23
  * await sleep(1000);
25
24
  * console.log(Date.now()); // 1748058119473
26
- *
27
25
  * ```
28
- *
29
26
  */
30
27
  async function sleep(delay = 1000) {
31
- if (!isFinite(delay) || delay < 0)
28
+ if (!isFinite(delay) || delay < 4)
32
29
  throw new TypeError('delay 应该是一个正常的数值');
33
- if (isNumber.isZero(delay))
30
+ if (aTypeOfJs.isZero(delay))
34
31
  return Promise.resolve();
35
32
  return new Promise(resolve => setTimeout(resolve, delay));
36
33
  }
@@ -1,7 +1,7 @@
1
1
  import { isArray, isEmptyArray } from 'a-type-of-js';
2
2
 
3
3
  /**
4
- * 求给出的两个数组的差值(A - B)
4
+ * ## 求给出的两个数组的差值(A - B)
5
5
  *
6
6
  * @param a - 第一个数组
7
7
  * @param b - 第二个数组
@@ -9,13 +9,11 @@ import { isArray, isEmptyArray } from 'a-type-of-js';
9
9
  * @description 当两个参数有一个不是数组时将抛出
10
10
  * @returns 返回第一个参数相对第二个参数的差值
11
11
  * @example
12
- *
13
12
  * ```ts
14
13
  * import { difference} from 'a-js-tools';
15
14
  *
16
15
  * const log = console.log;
17
16
  *
18
- *
19
17
  * log(difference([], [1, 2, 3])); // []
20
18
  *
21
19
  * log([1, 2, 3], []); //[1, 2, 3]
@@ -29,7 +27,6 @@ import { isArray, isEmptyArray } from 'a-type-of-js';
29
27
  * log(difference([1, 2, 3], null));
30
28
  * log(difference([1, 2, 3], true));
31
29
  * ```
32
- *
33
30
  */
34
31
  function difference(a, b) {
35
32
  if (!isArray(a) || !isArray(b)) {