-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathulid.javascript.txt
25 lines (17 loc) · 1017 Bytes
/
ulid.javascript.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
┏━━━━━━━━━━┓
┃ ULID ┃
┗━━━━━━━━━━┛
ALTERNATIVES ==> # - ulid: not maintained
# - deno ulid: Deno-specific
# - cannot set PRNG
VERSION ==> #2.4.0
#Browser compatible
ulid([DATE_NUM])->'ID' #Def DATE_NUM: now
factory([PRNG]) #Sets PRNG, which is FUNC()->NUM (0, included, to 1, excluded)
->FUNC([DATE_NUM])->'ID' #Def PRNG: crypto.getRandomValues() (browser), crypto.randomBytes (Node.js)
detectPrng([BOOL[, OBJ]])->PRNG #If BOOL true (def: false), use Math.random()
#OBJ is global (def: window)
monotonicFactory([PRNG])
->FUNC([DATE_NUM])->'ID' #
decodeTime('ID')->DATE_NUM #
ulid #CLI