From e91153d96102baa860ac59de78be7712e0a01e4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sandro=20Ariel=20Go=CC=81mez=20Araya?= Date: Fri, 24 Nov 2017 12:07:54 -0300 Subject: [PATCH 1/2] Fix error in options name * Change Readme.md fixing alphabetic by alphanumeric name of options * Add test to new option alphanumeric always expect alphanumeric chars if 'alphanumeric' options is true --- README.md | 8 ++++---- tests.js | 7 ++++++- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index c7ae1ed..24acfed 100644 --- a/README.md +++ b/README.md @@ -34,16 +34,16 @@ srs({length: 256}, function(err, sr) { console.log(sr); }); ``` -### Options: alphabetic +### Options: alphanumeric -Optionally, you can specify a 'alphabetic' option to get a alphabetical chars only. +Optionally, you can specify a 'alphanumeric' option to get a alphanumerical chars only. ```javascript // sync -var result = srs({alphabetic: true}); +var result = srs({alphanumeric: true}); // async -srs({alphabetic: true}, function(err, sr) { +srs({alphanumeric: true}, function(err, sr) { console.log(sr); }); ``` diff --git a/tests.js b/tests.js index 630ba62..fa27e1a 100644 --- a/tests.js +++ b/tests.js @@ -50,7 +50,12 @@ srs({length: 256}, function(err, sr) { ); }); - +srs({alphanumeric: true}, function(err, sr) {; + test('Must contain alphanumeric only', + sr.match(/^[a-zA-Z0-9_]*$/g)[0] === sr, + true + ); +}); // sync tests test('generate a random string 32 chars long (sync)', srs().length, 32); test('generate a random string 1 chars long (sync)', srs({length:1}).length, 1); From 1c0fec2544c281b7212eb2afa477108d9fd49947 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sandro=20Ariel=20Go=CC=81mez=20Araya?= Date: Fri, 24 Nov 2017 12:12:01 -0300 Subject: [PATCH 2/2] Adding new contributor --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 24acfed..6217cb0 100644 --- a/README.md +++ b/README.md @@ -60,6 +60,7 @@ the async API returns the error to the callback. ## Contributors [Mark Stosberg](https://github.com/markstos) + [Sandro Gomez](https://github.com/mrsangrin) ## License