egg-hashids
v1.0.0
Published
hashids plugin for egg
Downloads
2
Readme
egg-hashids
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.