a-js-tools 1.0.6 → 1.0.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/index.d.ts +1 -1
- package/package.json +2 -2
- package/src/getRandomString.cjs +1 -4
- package/src/getRandomString.mjs +1 -4
package/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CreateConstructor, createConstructor } from 'src/object/createConstructor';
|
|
1
|
+
import { CreateConstructor, createConstructor } from './src/object/createConstructor';
|
|
2
2
|
export { toLowerCamelCase, toSplitCase, getRandomFloat, getRandomInt, getRandomString, } from './src/index';
|
|
3
3
|
export { throttle, debounce } from './src/performance';
|
|
4
4
|
export type { DebounceAndThrottleReturnType } from './src/performance';
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"type": "module",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.8",
|
|
4
4
|
"name": "a-js-tools",
|
|
5
5
|
"description": "一点点 🤏 js 函数",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"dependencies": {
|
|
8
|
-
"a-type-of-js": "^1.0.
|
|
8
|
+
"a-type-of-js": "^1.0.5"
|
|
9
9
|
},
|
|
10
10
|
"main": "index.cjs",
|
|
11
11
|
"module": "index.mjs",
|
package/src/getRandomString.cjs
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var aTypeOfJs = require('a-type-of-js');
|
|
4
|
-
var isNode = require('./isNode.cjs');
|
|
5
4
|
|
|
6
5
|
/**
|
|
7
6
|
* 获取随机字符串
|
|
@@ -72,9 +71,7 @@ function getRandomString(options) {
|
|
|
72
71
|
if (initOptions.includeSpecial)
|
|
73
72
|
interleaveString(templateCharsArr, initOptions.chars3);
|
|
74
73
|
// 使用密码学安全的随机数生成器
|
|
75
|
-
const bytes =
|
|
76
|
-
? window.crypto.getRandomValues(new Uint8Array(initOptions.length))
|
|
77
|
-
: global.crypto.getRandomValues(new Uint8Array(initOptions.length));
|
|
74
|
+
const bytes = global.crypto.getRandomValues(new Uint8Array(initOptions.length));
|
|
78
75
|
let result = '';
|
|
79
76
|
/** 获取最后的 chars 数据 */
|
|
80
77
|
const chars = templateCharsArr.join('');
|
package/src/getRandomString.mjs
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { isPlainObject, isNumber, isNaN, isUndefined } from 'a-type-of-js';
|
|
2
|
-
import { isBrowser } from './isNode.mjs';
|
|
3
2
|
|
|
4
3
|
/**
|
|
5
4
|
* 获取随机字符串
|
|
@@ -70,9 +69,7 @@ function getRandomString(options) {
|
|
|
70
69
|
if (initOptions.includeSpecial)
|
|
71
70
|
interleaveString(templateCharsArr, initOptions.chars3);
|
|
72
71
|
// 使用密码学安全的随机数生成器
|
|
73
|
-
const bytes =
|
|
74
|
-
? window.crypto.getRandomValues(new Uint8Array(initOptions.length))
|
|
75
|
-
: global.crypto.getRandomValues(new Uint8Array(initOptions.length));
|
|
72
|
+
const bytes = global.crypto.getRandomValues(new Uint8Array(initOptions.length));
|
|
76
73
|
let result = '';
|
|
77
74
|
/** 获取最后的 chars 数据 */
|
|
78
75
|
const chars = templateCharsArr.join('');
|