ulid / javascript

Universally Unique Lexicographically Sortable Identifier
MIT License
3.04k stars 107 forks source link

fix(incrementBase32): fix error message when unable to increment the input #106

Open kt3k opened 1 year ago

kt3k commented 1 year ago

Currently the below errors with Error: incorrectly encoded string:

const ULID = require('ulid')
ULID.incrementBase32('ZZZ')

However, the error message seems wrong here because ZZZ is correctly encoded base32 string. I think the error message should be cannot increment this string here. This PR fixes this issue by incrementing index counter before comparing with >=0.