1.0.0 • Published 6 years ago

egg-hashids v1.0.0

Weekly downloads
3
License
MIT
Repository
github
Last release
6 years ago

egg-hashids

NPM version build status Test coverage David deps Known Vulnerabilities npm download

hashids plugin for egg

Install

$ npm i egg-hashids --save

Usage

// {app_root}/config/plugin.js
exports.hashids = {
  enable: true,
  package: 'egg-hashids',
};

Configuration

For more information, please read hashids.js document.

// {app_root}/config/config.default.js
exports.hashids = {
  projectName: '',
  minLength: 0,
  alphabet: 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890',

  app: true,
  agent: false,
};

see config/config.default.js for more detail.

Example

this.app.hashids.encode(1);   // => jR
this.app.hashids.decode('jR') // => [ 1 ]

Questions & Suggestions

Please open an issue here.

License

MIT