From de3c06d8444ffc341090654001b8e894a2ffe3c6 Mon Sep 17 00:00:00 2001 From: s2 Date: Sat, 25 Apr 2015 16:27:22 +0200 Subject: [PATCH] rename module --- README.md | 10 +++++----- lib/{securerandomstring.js => secure-random-string.js} | 4 ++-- package.json | 4 ++-- tests.js | 10 +++++----- 4 files changed, 14 insertions(+), 14 deletions(-) rename lib/{securerandomstring.js => secure-random-string.js} (84%) diff --git a/README.md b/README.md index 85076e0..154d48e 100644 --- a/README.md +++ b/README.md @@ -1,17 +1,17 @@ -# securerandomstring +# secure-random-string a node module that generates a secure random string with a given length ## Usage `require` it ``` -var securerandomstring = require('securerandomstring'); +var srs = require('secure-random-string'); ``` generate a random string that is 32 chars long (the default) ``` -securerandomstring(function(sr) { +srs(function(sr) { console.log(sr); }); ``` @@ -19,7 +19,7 @@ securerandomstring(function(sr) { generate a random string that is 256 chars long ``` -securerandomstring({length: 256}, function(sr) { +srs({length: 256}, function(sr) { console.log(sr); }); ``` @@ -27,7 +27,7 @@ securerandomstring({length: 256}, function(sr) { generate a random string that is 20 chars long and is url safe (can be used as a url token) ``` -securerandomstring({length: 20, urlsafe: true}, function(sr) { +srs({length: 20, urlsafe: true}, function(sr) { console.log(sr); }); ``` diff --git a/lib/securerandomstring.js b/lib/secure-random-string.js similarity index 84% rename from lib/securerandomstring.js rename to lib/secure-random-string.js index b1d84e5..20810c7 100644 --- a/lib/securerandomstring.js +++ b/lib/secure-random-string.js @@ -1,6 +1,6 @@ var crypto = require('crypto'); -function securerandomstring(options, cb) { +function srs(options, cb) { if (typeof(options) === 'function') { cb = options; options = {}; @@ -23,4 +23,4 @@ function securerandomstring(options, cb) { }; -module.exports = securerandomstring; +module.exports = srs; diff --git a/package.json b/package.json index 1257e79..a9dfcf1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { - "name": "securerandomstring", - "version": "0.0.3", + "name": "secure-random-string", + "version": "0.0.1", "description": "Generates a secure random string with a given length", "main": "lib/securerandomstring.js", "scripts": { diff --git a/tests.js b/tests.js index dacaaa6..b6ce75f 100644 --- a/tests.js +++ b/tests.js @@ -1,4 +1,4 @@ -var securerandomstring = require('./lib/securerandomstring.js'); +var srs = require('./lib/secure-random-string.js'); //my awesome test framework @@ -29,28 +29,28 @@ var test = function(name, what, ref, c) { //the actual tests -securerandomstring(function(sr) { +srs(function(sr) { test('generate a random string 32 chars long', sr.length, 32 ); }); -securerandomstring({length: 1}, function(sr) { +srs({length: 1}, function(sr) { test('generate a random string 1 char long', sr.length, 1 ); }); -securerandomstring({length: 256}, function(sr) { +srs({length: 256}, function(sr) { test('generate a random string 256 chars long', sr.length, 256 ); }); -securerandomstring({length: 256, urlsafe: true}, function(sr) { +srs({length: 256, urlsafe: true}, function(sr) { test('generate a urlsafe random string 256 chars long', sr.length, 256