Comparing version 1.2.0 to 2.0.0
23
addon.js
@@ -1,3 +0,22 @@ | ||
var Generator = require('bindings')('addon.node'); | ||
const Generator = require('bindings')('addon.node'); | ||
module.exports = (id, seed = 0) => Generator(id, seed); | ||
module.exports = (id, seed = 0) => { | ||
if (typeof id !== 'number') { | ||
throw Error('id need be number'); | ||
} | ||
if (typeof seed !== 'number') { | ||
throw Error('seed need be number'); | ||
} | ||
id = parseInt(id); | ||
seed = parseInt(seed); | ||
if (id < 0 || id > 511) { | ||
throw Error('d must be >=0 or <= 511'); | ||
} | ||
if (seed < 0 || seed * 1000 > Date.now()) { | ||
throw Error('seed must <= now'); | ||
} | ||
const gen = Generator(id, seed); | ||
gen.id = id; | ||
gen.seed = seed; | ||
return gen; | ||
}; |
{ | ||
"name": "uuid-int", | ||
"version": "1.2.0", | ||
"version": "2.0.0", | ||
"description": "uuid-int for nodejs", | ||
@@ -23,4 +23,3 @@ "main": "addon.js", | ||
"dependencies": { | ||
"bindings": "^1.5.0", | ||
"node-addon-api": "^1.6.3" | ||
"bindings": "^1.5.0" | ||
}, | ||
@@ -27,0 +26,0 @@ "homepage": "https://github.com/wbget/uuid-int", |
@@ -27,3 +27,3 @@ [![NPM version][npm-image]][npm-url] | ||
Install | ||
__Install__ | ||
@@ -34,5 +34,12 @@ ``` | ||
Use | ||
__Windows install__ | ||
``` | ||
npm install --global --production windows-build-tools | ||
npm install --save uuid-int | ||
``` | ||
__Use__ | ||
``` | ||
const UUID = require('uuid-int'); | ||
@@ -39,0 +46,0 @@ |
@@ -12,3 +12,7 @@ # uuid-int | ||
``` | ||
windows下安装 | ||
``` | ||
npm install --global --production windows-build-tools | ||
npm install --save uuid-int | ||
``` | ||
使用 | ||
@@ -15,0 +19,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
10415
1
90
53
- Removednode-addon-api@^1.6.3
- Removednode-addon-api@1.7.2(transitive)