@ustack/egg-ue

0.8.0 • Public • Published

egg-ue

Install

npm i @ustack/egg-ue --save

Usage

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

Example

application

  • joi
  • boom
  • fs ---------> fs-async-await
ajax(url, options){
    //  发送请求并判断status是否为2XX 
    // 返回 res 响应
}

context

  • joi
  • boom
  • ajax 同上
validate(schema = {}){
    // 传入joi图表进行验证
    // 若发现错误则发送badrequest回调
}

helper

  • _ ---------> lodash
  • uuid
  • fs ----------> fs-async-await
password {
    hash () {
        // brcypt.hash()
    },
    compare() {
        // brcypt.compare()
    }
}
pagination(data, page, limit){
    // data数据page分页 limit每页数据个数
    // return  { data, prev, next, count, page, limit }
}
exec() {
   // child_process.exec() 转化为promise对象
}
xor (oldArr, newArr){
    return {
        toDel: 合体 - newArr,
        toAdd: 合体 - oldArr
    }
}
getSymbolValue(obj, symbolKey) {
    // return obj[symbolKey对应的值]
}
randomCode(){
    return Math.random() * 900000 | 100000;
}

Questions & Suggestions

Please open an issue here.

License

MIT

Package Sidebar

Install

npm i @ustack/egg-ue

Weekly Downloads

0

Version

0.8.0

License

MIT

Unpacked Size

10.3 kB

Total Files

10

Last publish

Collaborators

  • dengbo
  • hbshun
  • hex2dec
  • leohihimax
  • majiajun
  • mslovy
  • pjy