1.1.0 • Published 4 years ago

think-hashids v1.1.0

Weekly downloads
4
License
MIT
Repository
github
Last release
4 years ago

think-hashids

npm Build Status Coverage Status

Generate a short unique ID from the integer for ThinkJS base on hashids

How to use

Install

npm install think-hashids --save

Configure extends.js

const hashids = require('think-hashids')

module.exports = [
  hashids({
    salt: 'this is salt',
    minLength: 10,
    alphabet: 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890'
  })
];

Config

  • salt: Participate in the calculated salt. Default: ''
  • minLength: The minimum length of the resulting result. Default:0
  • alphabet: Generates the resulting character set .Default: 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890'

Method

  • this.encode(id): Encode ID
  • this.decode(id): Decode ID
  • this.encodeHex(id): Encode hex instead of numbers
  • this.decodeHex(id): Decode hex instead of numbers
1.1.0

4 years ago

1.0.6

4 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago