egg-hashids

1.0.0 • Public • Published

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

Package Sidebar

Install

npm i egg-hashids

Weekly Downloads

0

Version

1.0.0

License

MIT

Unpacked Size

5.12 kB

Total Files

7

Last publish

Collaborators

  • viko16