Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "fix(crypto): [crypto] use nanoid instead to support SSR" #1864

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,6 @@
"echarts-liquidfill": "3.1.0",
"echarts-wordcloud": "2.0.0",
"fastdom": "1.0.11",
"nanoid": "^5.0.7",
"shepherd.js": "11.0.1",
"streamsaver": "2.0.6"
},
Expand Down
6 changes: 2 additions & 4 deletions packages/renderless/src/common/string.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import { isPlainObject, isNumber, isNumeric, isNull } from './type'
import { getObj, toJsonStr } from './object'
import { toFixed, Decimal } from './decimal'
import { nanoid } from 'nanoid'

/**
* 文本替换格式类型
Expand Down Expand Up @@ -242,9 +241,8 @@ export const fillChar = (string, length, append, chr = '0') => {
}

export const random = () => {
const randomString = nanoid(8)
const randomValue = parseInt(randomString, 16)
return randomValue / 16 ** randomString.length
let MAX_UINT32_PLUS_ONE = 4294967296
return window.crypto.getRandomValues(new window.Uint32Array(1))[0] / MAX_UINT32_PLUS_ONE
}

/**
Expand Down
Loading