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

random-string

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

random-string - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

7

lib/random-string.js

@@ -22,3 +22,3 @@ /*

letters: typeof opts.letters === 'boolean' ? opts.letters : true,
special: typeof opts.special === 'boolean' ? opts.special : true
special: typeof opts.special === 'boolean' ? opts.special : false
};

@@ -37,6 +37,7 @@ }

opts = _defaults(opts);
var x, _i, rn, rnd = '',
var i, rn,
rnd = '',
len = opts.length,
randomChars = _buildChars(opts);
for (x = _i = 1; 1 <= len ? _i <= len : _i >= len; x = 1 <= len ? ++_i : --_i) {
for (i = 1; i <= len; i++) {
rnd += randomChars.substring(rn = Math.floor(Math.random() * randomChars.length), rn + 1);

@@ -43,0 +44,0 @@ }

{
"name": "random-string",
"description": "Simple Module for generating Random Strings",
"version": "0.1.0",
"version": "0.1.1",
"homepage": "https://github.com/valiton/node-random-string",

@@ -6,0 +6,0 @@ "author": {

@@ -59,2 +59,4 @@ # random-string

- 0.1.1 do not contain special cars per default
- 0.1.0 Initial Release

@@ -61,0 +63,0 @@

@@ -20,3 +20,3 @@ 'use strict';

'include_only_numbers': function(test) {
test.expect(1);
test.expect(3);
var result = randomString({

@@ -28,2 +28,4 @@ numeric: true,

test.ok(/^\d+$/.test(result), 'the random string should include only numbers');
test.equal(/^[a-zA-Z]+$/.test(result), false, 'the random string should not include letters');
test.equal(/^[-!$%^&*()_+|~=`{}\[\]:";'<>?,.\/]+$/.test(result), false, 'the random string should not include specials');
test.done();

@@ -33,3 +35,3 @@ },

'include_only_letters': function(test) {
test.expect(1);
test.expect(3);
var result = randomString({

@@ -40,3 +42,5 @@ numeric: false,

});
test.equal(/^\d+$/.test(result), false, 'the random string should not include numbers');
test.ok(/^[a-zA-Z]+$/.test(result), 'the random string should include only letters');
test.equal(/^[-!$%^&*()_+|~=`{}\[\]:";'<>?,.\/]+$/.test(result), false, 'the random string should not include specials');
test.done();

@@ -46,3 +50,3 @@ },

'include_only_specials': function(test) {
test.expect(1);
test.expect(3);
var result = randomString({

@@ -53,2 +57,4 @@ numeric: false,

});
test.equal(/^\d+$/.test(result), false, 'the random string should not include numbers');
test.equal(/^[a-zA-Z]+$/.test(result), false, 'the random string should not include letters');
test.ok(/^[-!$%^&*()_+|~=`{}\[\]:";'<>?,.\/]+$/.test(result), 'the random string should include only specials');

@@ -55,0 +61,0 @@ test.done();

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