1.0.3 • Published 6 years ago

ismart-flake v1.0.3

Weekly downloads
-
License
ISC
Repository
-
Last release
6 years ago

#ismart-flake

##config

path /.ismart/configs/smart.flake.idgen.json

{
        builder : {
            datacenter: 9,                          //不知道
            worker    : 7,                          //工作进程
            id        : 1,                          //ID
            epoch     : 10000000000000000,          //初始值
        },
        formater: {
            type   : "dec",                         //类型
            options: {
                format   : "BE",                    //大头朝上
                prefix   : "",                      //前缀
                groupsize: "",
                delimiter: "",
                padstr   : "",
                size     : "",
            }
        }
    }

##Useage

npm install ismart-flake --save

var iFlake = require("ismart-flake"); var myFlake = new iFlake(options);

var smartid = myFlake.next(); //默认smart.flake.idgen.json

or

var smartid = myFlake.int(); //纯数字

or

var smartid = myFlake.hex() //字符串