Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

uuid-int

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

uuid-int - npm Package Compare versions

Comparing version 1.0.1 to 1.1.0

17

addon.d.ts

@@ -5,9 +5,24 @@ export as namespace uuidInt;

declare function UUID(id: number): UUID.Generator;
/**
* uuid对象
* @param id machine unique id
* @param seed time seed
*/
declare function UUID(id: number, seed: number): UUID.Generator;
declare namespace UUID {
export interface Generator {
/**
* machine unique id
*/
id: number;
/**
* time seed
*/
seed: number;
/**
* generate unique int53
*/
uuid(): number;
}
}

2

addon.js
var Generator = require('bindings')('addon.node');
module.exports = Generator;
module.exports = (id, seed = 0) => Generator(id, seed);
{
"name": "uuid-int",
"version": "1.0.1",
"version": "1.1.0",
"description": "uuid-int for nodejs",

@@ -5,0 +5,0 @@ "main": "addon.js",

@@ -0,4 +1,28 @@

[![NPM version][npm-image]][npm-url]
[![build status][travis-image]][travis-url]
[![Test coverage][codecov-image]][codecov-url]
[![David deps][david-image]][david-url]
[![Known Vulnerabilities][snyk-image]][snyk-url]
[![npm download][download-image]][download-url]
[npm-image]: https://img.shields.io/npm/v/uuid-int.svg?style=flat-square
[npm-url]: https://npmjs.org/package/uuid-int
[travis-image]: https://img.shields.io/travis/wbget/uuid-int.svg?style=flat-square
[travis-url]: https://travis-ci.org/wbget/uuid-int
[codecov-image]: https://img.shields.io/codecov/c/github/wbget/uuid-int.svg?style=flat-square
[codecov-url]: https://codecov.io/github/wbget/uuid-int?branch=master
[david-image]: https://img.shields.io/david/wbget/uuid-int.svg?style=flat-square
[david-url]: https://david-dm.org/wbget/uuid-int
[snyk-image]: https://snyk.io/test/npm/uuid-int/badge.svg?style=flat-square
[snyk-url]: https://snyk.io/test/npm/uuid-int
[download-image]: https://img.shields.io/npm/dm/uuid-int.svg?style=flat-square
[download-url]: https://npmjs.org/package/uuid-int
# uuid-int
uuid-int for nodejs .
uuid-int for nodejs
[中文](./README.zh-CN.md)

@@ -5,0 +29,0 @@ ## Quick Start

const assert = require('assert');
const UUID = require('./addon');
assert.throws(() => UUID(), Error);
assert.throws(() => UUID(-1), Error);
assert.throws(() => UUID(512), Error);
assert.throws(() => UUID('28'), Error);
assert.throws(() => UUID(), Error, 'need id');
assert.throws(() => UUID(-1), Error, 'id out of range');
assert.throws(() => UUID(512), Error, 'id out of range');
assert.throws(() => UUID('28'), Error, 'id must be number');
assert.throws(() => UUID(2, Date.now() / 1000 + 1), Error, 'seed out of range');
assert.throws(() => UUID(2, -1), Error, 'seed out of range');
assert.throws(() => UUID(2, '392'), Error, 'seed must be number');
const t0 = UUID(0, Date.now() / 1000);
assert(t0.uuid() === 0x200000);
const t1 = UUID(1);
console.log(t1.uuid());
const t2 = UUID(2);

@@ -39,2 +46,1 @@ assert(t1.id === 1);

assert(catchError);
console.log(t1.uuid());

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc