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

sequential-ids

Package Overview
Dependencies
Maintainers
2
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sequential-ids - npm Package Compare versions

Comparing version 0.0.0-alpha.3.2 to 0.0.0-alpha.4.0

.travis.yml

15

Accessor.js

@@ -8,7 +8,12 @@ var http = require("http");

this.url = "http://localhost:" + this.port;
http.get(this.url + "/ping").on("error", function(err) {
throw err;
});
}
Accessor.prototype.ping = function(callback) {
http.get(this.url + "/ping", function(res) {
callback(null);
}).on("error", function(err) {
callback(err);
});
};
Accessor.prototype.next = function(callback) {

@@ -20,3 +25,5 @@ callback = callback || function() {};

res.on("data", function(data) {id += data;});
res.on("end", function() {callback(id);});
res.on("end", function() {callback(null, id);});
}).on("error", function(err) {
callback(err);
});

@@ -23,0 +30,0 @@ };

@@ -73,8 +73,2 @@ var http = require("http");

/**
* If maxLetters is 0, we don't generate any letters
* If maxDigits is 0, we don't generate any numbers
* If numLetters and numDigits are greater than 0, we generate numbers
*
*/
function generateId(letters, numLetters, numbers, numNumbers) {

@@ -134,2 +128,4 @@ if (numLetters > 0 && numNumbers <= 0) {

this.server;
this._started;
this._stopped;
}

@@ -152,2 +148,3 @@

Generator.prototype.start = function() {
if (this._started) return;
this.server = http.Server(function(req, res) {

@@ -164,2 +161,3 @@ switch(req.url) {

this.server.listen(this.options.port);
this._started = true;
};

@@ -172,4 +170,6 @@

Generator.prototype.stop = function() {
if (this._stopped || !this._started) return;
this.store();
this.server.close();
this._stopped = true;
};

@@ -176,0 +176,0 @@

{
"name": "sequential-ids",
"version": "0.0.0-alpha.3.2",
"version": "0.0.0-alpha.4.0",
"description": "centralized generation of sequential, human-readable ids",

@@ -25,4 +25,7 @@ "homepage": "https://github.com/forfuture-dev/node-sequential-ids",

"devDependencies": {
"mocha": "^1.21.4"
"mocha": "latest"
},
"scripts": {
"test": "./node_modules/mocha/bin/mocha tests"
}
}
# node-sequential-ids
[![Build Status](https://travis-ci.org/forfuture-dev/node-sequential-ids.svg?branch=master)](https://travis-ci.org/forfuture-dev/node-sequential-ids)
A [Node.js][nodejs] module that allows centralized generation of

@@ -11,5 +13,5 @@ sequential and human-readable ids.

|-------|-----:|
|version|0.0.0-alpha.3.1|
|version|0.0.0-alpha.4.0|
|dependencies|none|
|last updated|1st Oct, 2014|
|last updated|2nd Oct, 2014|

@@ -87,7 +89,7 @@ ## installation

```js
var sequential = require("sequential-ids");
var generatorA = new sequential.Generator({port: 8998});
var generatorB = new sequential.Generator({port: 7667});
```
```js
var sequential = require("sequential-ids");
var generatorA = new sequential.Generator({port: 8998});
var generatorB = new sequential.Generator({port: 7667});
```

@@ -117,4 +119,8 @@ * A generator has the following methods:

* `Accessor#next(callback)`:
* requests generator for a new ID.
* The new ID is passed to the callback.
* callback signature: `function(err, id)`
* requests generator for a new ID.
* The new ID is passed to the callback, on success.
* `Accessor#ping(callback)`
* callback signature: `function(err)`
* pings the generator to see if it is online

@@ -121,0 +127,0 @@ * All methods are **asynchronous**, the Node.js way

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