JSPM

meeko

1.7.36
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 2267
  • Score
    100M100P100Q136205F
  • License MIT

meeko自用函数

Package Exports

  • meeko

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (meeko) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

meeko

Build Stat Coverage Status Codacy Badge

NPM

Standard - JavaScript Style Guide

开始你的征途

let $ = require('meeko')

数学函数

$.math.linearFitting(xArray,yArray) 线性拟合

颜色基本函数

$.log($.c.dimr('dimred', backGroundColor[41-47], isUnderline))

json color format

* $.dir(object)
* 内部10行代码实现 注意字符串下标数组无法显示

JSON color format

###$.compare

let cnDictObj = {items:[{'name':'a',lev:1},{name:'b',lev:2}]}
$.log(cnDictObj.items.sort(compare('lev', 'desc'))) //默认升序

Array原型扩展

  • remove (idx = 0, len = 1)
[1, 2, 3, 4, 5].remove(1,2) => [1,4,5]
  • count()
 ['A', 'B', 'B', 'C', 'A', 'D'].count() => {"A":2,"B":2,"C":1,"D":1}
  • flatten()
[1, [2, [3, [4, 5], 6], 7], 8].flatten() => [1,2,3,4,5,6,7,8]
  • orderBy()
[{ name: 'A', age: 48 }, { name: 'B', age: 36 }, { name: 'C', age: 26 }]
.orderBy(['age'],['asc']) 
=> [{"name":"C","age":26},{"name":"B","age":36},{"name":"A","age":48}] 默认升序

String原型扩展

  • upperFirst() 将首字母变成大写,其他小写
  • String.render(o) 字符串模板渲染

Notice

$.tools.checkParam(obj)
* obj 如果为日期格式,日期格式为UTC日期
* 请在前端写入mysql之前 date.date2Str()一下
* 否则需要主动调用mysql的转换utc时间的函数

正则发生器

r = '(你|我|他)'
console.log($.reg.gen(r))

日期格式化

yyyy/YYYY mm/MM ww/WW dd/DD hh/HH mm ss SS(毫秒) q(季度) X(unix秒)
$.now().format('X')

路径下所有js文件全加载

$.requireAll() //加载某个目录下的所有对象,默认 __dirname

分布式雪花碎片算法 每秒可以产生超过200万 不重复id

new $.Snowflake(workId, dataCenterId, sequence) // 工作进程id ,服务器id,开始序号
sequenceDiagram
    participant 用户A
    participant 用户B
    participant Bot
    用户A->>Bot: 你好啊?

    Bot-->>用户A: 你好!
    Note right of Bot: 人工智能核心代码
    用户B->>Bot: 在吗?
    Bot-->>用户B: 在!
    Note right of Bot: 去除[啊吗嘛]等<br/>语气助词,?换成!