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.4.1 to 0.0.0-alpha.4.2

1

Accessor.js

@@ -11,2 +11,3 @@ var http = require("http");

Accessor.prototype.ping = function(callback) {
callback = callback || function() {};
http.get(this.url + "/ping", function(res) {

@@ -13,0 +14,0 @@ callback(null);

18

Generator.js

@@ -61,8 +61,9 @@ var http = require("http");

id = id.trim();
var ltrs = id.match(/^(\w*)\s*-/);
var nums = id.match(/-\s*(\d*)$/);
// NOTE: using \w in Regexp matches both digits and letters
var ltrs = id.match(/^([A-z]*)\s*\-*/);
var nums = id.match(/\-*\s*(\d*)$/);
var result = {};
if (ltrs && nums) {
result.numbers = nums[1];
result.letters = ltrs[1].toUpperCase();
if (ltrs || nums) {
result.numbers = nums[1] || "";
result.letters = ltrs[1] ? ltrs[1].toUpperCase() : "";
return result;

@@ -76,3 +77,3 @@ } else {

if (numLetters > 0 && numNumbers <= 0) {
var nextLetters = "A" === letters ? "AAA" : incrementLetters(letters);
var nextLetters = incrementLetters(letters);
var id = fillLetters(nextLetters, numLetters);

@@ -117,2 +118,7 @@ return {id: id, letters: nextLetters, numbers: null};

this.letters = "A";
// workaround to get A's generated as first ids when
// options.digits is 0
if (options.digits === 0) {
this.letters = "@";
}
if (options.restore) {

@@ -119,0 +125,0 @@ var result = parseId(options.restore);

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

@@ -5,0 +5,0 @@ "homepage": "https://github.com/forfuture-dev/node-sequential-ids",

@@ -13,5 +13,6 @@

|-------|-----:|
|version|0.0.0-alpha.4.1|
|version|0.0.0-alpha.4.2|
|dependencies|none|
|last updated|4th Oct, 2014|
|node|0.11, 0.10|
|last updated|6th Oct, 2014|

@@ -72,3 +73,3 @@ ## installation

* Defaults to `null`.
* `store_freq`:
* `store\_freq`:
* frequency at which the store function should be called.

@@ -83,2 +84,3 @@ * Defaults to `1`(called every 1 ID is generated)

* **MUST** be a string.
* Overides the `.digits` and `.letters` options.
* Defaults to `null`.

@@ -146,3 +148,3 @@ * `port`:

Sequential Ids and its source code are licensed under the [MIT][mit] license. See *LICENSE* file accompanying this text.
Sequential Ids and its source code are licensed under the [MIT][mit] license. See [LICENSE](LICENSE) file accompanying this text.

@@ -149,0 +151,0 @@

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