example.ts 601 B

1234567891011121314151617
  1. import * as hyperid from '..'
  2. const urlSafeInstance = hyperid({ fixedLength: false, urlSafe: true })
  3. const fixedLengthInstance = hyperid(true)
  4. const startFromInstance = hyperid({ startFrom: 9 })
  5. const maxIntInstance = hyperid({ maxInt: 10000 })
  6. const urlSafeId = urlSafeInstance()
  7. const fixedLengthId = fixedLengthInstance()
  8. const startFromId = startFromInstance()
  9. const maxIntId = maxIntInstance()
  10. // decode
  11. console.log(hyperid.decode(urlSafeId))
  12. console.log(fixedLengthInstance.decode(fixedLengthId))
  13. console.log(startFromInstance.decode(startFromId))
  14. console.log(maxIntInstance.decode(maxIntId))