compaction improvements
This commit is contained in:
parent
c3a55c35bb
commit
4c94753eda
1 changed files with 406 additions and 145 deletions
|
|
@ -30,7 +30,7 @@ export namespace Identifier {
|
|||
|
||||
function generateID(prefix: keyof typeof prefixes, descending: boolean, given?: string): string {
|
||||
if (!given) {
|
||||
return generateNewID(prefix, descending)
|
||||
return create(prefix, descending)
|
||||
}
|
||||
|
||||
if (!given.startsWith(prefixes[prefix])) {
|
||||
|
|
@ -49,8 +49,8 @@ export namespace Identifier {
|
|||
return result
|
||||
}
|
||||
|
||||
function generateNewID(prefix: keyof typeof prefixes, descending: boolean): string {
|
||||
const currentTimestamp = Date.now()
|
||||
export function create(prefix: keyof typeof prefixes, descending: boolean, timestamp?: number): string {
|
||||
const currentTimestamp = timestamp ?? Date.now()
|
||||
|
||||
if (currentTimestamp !== lastTimestamp) {
|
||||
lastTimestamp = currentTimestamp
|
||||
|
|
|
|||
Loading…
Reference in a new issue