egg-hashids
Hashids is small JavaScript library to generate YouTube-like ids from numbers. Use it when you don't want to expose your database ids to the user.
This plugin is only for egg.js
Install
$ npm i eggjs-hashids --save
Usage
// {app_root}/config/plugin.jsexportshashids = enable: true package: 'eggjs-hashids';
Configuration
// {app_root}/config/config.default.jsexportshashids = salt: '' minLength: 0 alphabet: 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890';
see config/config.default.js and hashids for more detail.
Example
thisapphashids; // => 'jR'thisapphashids; // => [ 1 ]thisapphashids; // => 'y42LW46J9luq3Xq9XMly'thisapphashids; // => '507f1f77bcf86cd799439011'
Questions & Suggestions
Please open an issue here.