sequential-ids
Advanced tools
Comparing version 0.0.0-alpha.2.0 to 0.0.0-alpha.3.0
{ | ||
"name": "sequential-ids", | ||
"version": "0.0.0-alpha.2.0", | ||
"version": "0.0.0-alpha.3.0", | ||
"description": "centralized generation of sequential, human-readable ids", | ||
"homepage": "https://github.com/GochoMugo/sequential-ids", | ||
"homepage": "https://github.com/forfuture-dev/node-sequential-ids", | ||
"license": "MIT", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/GochoMugo/sequential-ids.git" | ||
"url": "https://github.com/forfuture-dev/node-sequential-ids.git" | ||
}, | ||
"bugs": "https://github.com/GochoMugo/sequential-ids/issues", | ||
"bugs": "https://github.com/forfuture-dev/node-sequential-ids/issues", | ||
"keywords": [ | ||
"centralized", | ||
"sequential", | ||
"ids", | ||
"sequence", | ||
"human-readable", | ||
"centralized" | ||
"ids" | ||
], | ||
"author": { | ||
"name": "Gocho Mugo", | ||
"email": "mugo@forfuture.co.ke", | ||
"url": "https://twitter.com/@mugo_gocho" | ||
"name": "GochoMugo", | ||
"email": "mugo@forfuture.co.ke" | ||
}, | ||
"main": "sequential-ids.js", | ||
"main": "index.js", | ||
"dependencies": {} | ||
} |
# sequential ids | ||
# node-sequential-ids | ||
A [Node.js][nodejs] module that allows centralized generation of sequential, unique and human-readable ids. | ||
A [Node.js][nodejs] module that allows centralized generation of | ||
sequential and human-readable ids. | ||
**Sample Id:** `ACB - 00423` | ||
|Aspect|Detail| | ||
|aspect|detail| | ||
|-------|-----:| | ||
|version|0.0.0-alpha.2.0| | ||
|version|0.0.0-alpha.3.0| | ||
|dependencies|none| | ||
|last updated|4th Sept, 2014| | ||
|last updated|29th Sept, 2014| | ||
## installation | ||
From [npmjs][npmjs]: | ||
From [Npm][npmjs]: | ||
$ npm install sequential-ids --save | ||
```bash | ||
$ npm install sequential-ids --save | ||
``` | ||
## usage | ||
```js | ||
// assuming `db` is a variable holding a database connection with the | ||
// method `.store(key, value)` | ||
// assuming `db` is a variable holding a database object | ||
// with the method `.store(key, value)` | ||
// and `.read(key)` | ||
var sequential = require("sequential-ids"); | ||
var generator = new sequential.Generator({ | ||
digits: 6, letters: 3, | ||
store: function(ids) { | ||
db.store("last-id", ids[ids.length - 1]); | ||
}, | ||
restore: "AAB - 000" | ||
}); | ||
var sequential = require("sequential-ids"); | ||
var generator = new sequential.Generator({ | ||
digits: 6, | ||
letters: 3, | ||
store: function (ids) { | ||
db.store("last-id", ids[ids.length - 1]); | ||
}, | ||
restore: (function () { | ||
return db.read("last-id"); | ||
})() | ||
}); | ||
var accessor = new sequential.Accessor() | ||
accessor.next(function (id) { | ||
console.log("First ID: " + id); | ||
}); | ||
accessor.next(function (id) { | ||
console.log("Second ID: " + id); | ||
}); | ||
var accessor = new sequential.Accessor(); | ||
accessor.next(function(id) { | ||
console.log("new id: %s", id); | ||
}); | ||
``` | ||
## notes | ||
@@ -84,5 +72,5 @@ | ||
* `digits` and `letters` will be ignored so as to follow the restore ID style. | ||
* it must be in the same style as IDs generated by the Generator | ||
* it **must** be in the same style as IDs generated by the Generator | ||
* If not specified, generates from start. | ||
* **MUST** be a string, or a function called that **returns** a string as in example above. | ||
* **MUST** be a string. | ||
* Defaults to `null`. | ||
@@ -95,9 +83,9 @@ * `port`: | ||
```js | ||
```js | ||
var sequential = require("sequential-ids"); | ||
var generatorA = new sequential.Generator({port: 8998}); | ||
var generatorB = new sequential.Generator({port: 7667}); | ||
var sequential = require("sequential-ids"); | ||
var generatorA = new sequential.Generator({port: 8998}); | ||
var generatorB = new sequential.Generator({port: 7667}); | ||
``` | ||
``` | ||
@@ -132,3 +120,3 @@ | ||
Copyright (c) 2014 Gocho Mugo <mugo@forfuture.co.ke> | ||
Copyright (c) 2014 Forfuture LLC | ||
@@ -135,0 +123,0 @@ |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
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
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
14954
10
303
1
124
4