UNPKG
ice.fo.utils
Version:
latest (0.0.8)
0.0.8
0.0.6
0.0.5
0.0.4
0.0.3
0.0.2
0.0.1
ice.fo.utils
/
random
/
randomObjectId.js
7 lines
(6 loc)
•
253 B
JavaScript
View Raw
1
2
3
4
5
6
7
module
.
exports
=
function
randomObjectId
(
) {
const
timestamp = (
new
Date
().
getTime
() /
1000
|
0
).
toString
(
16
)
return
timestamp +
'xxxxxxxxxxxxxxxx'
.
replace
(
/[x]/g
,
function
(
) {
return
(
Math
.
random
() *
16
|
0
).
toString
(
16
) }).
toLowerCase
() }