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

randomatic

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

randomatic - npm Package Compare versions

Comparing version 0.1.1 to 0.1.2

8

.verbrc.md

@@ -19,2 +19,10 @@ # {%= name %} {%= badge("fury") %}

## Tests
Run the tests
```bash
mocha
```
## Documentation

@@ -21,0 +29,0 @@

2

bower.json
{
"name": "randomatic",
"version": "0.1.1",
"version": "0.1.2",
"main": [

@@ -5,0 +5,0 @@ "index.js"

@@ -12,5 +12,3 @@ /**

// Example replacement patterns. These replacement
// patterns are used in assemble-contrib-permalinks:
// https://github.com/assemble/assemble-contrib-permalinks
// Example replacement patterns.
var replacements = [

@@ -17,0 +15,0 @@ {

{
"name": "randomatic",
"description": "Generate randomized strings of a specified length from patterns of numeric, alpha-numeric, alphabetical, special or custom characters.",
"version": "0.1.1",
"version": "0.1.2",
"homepage": "https://github.com/jonschlinkert/randomatic",

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

@@ -19,2 +19,10 @@ # randomatic [![NPM version](https://badge.fury.io/js/randomatic.png)](http://badge.fury.io/js/randomatic)

## Tests
Run the tests
```bash
mocha
```
## Documentation

@@ -21,0 +29,0 @@

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

it('should return an uppercase string, 12 digits long', function (done) {
it('should return a 12-character string, lowercase', function (done) {
var actual = randomize('a', 12);

@@ -30,3 +30,3 @@ expect(/[a-z]{12}/.test(actual)).to.eql(true);

it('should return an uppercase string, 12 digits long', function (done) {
it('should return 12-characters of ordered numbers', function (done) {
var actual = randomize('0', 12);

@@ -40,3 +40,3 @@ expect(/[\d]{12}/.test(actual)).to.eql(true);

it('should return an uppercase string, 12 digits long', function (done) {
it('should return a randomized 12-character string, uppercase and numbers', function (done) {
var actual = randomize('A0', 12);

@@ -49,3 +49,3 @@ expect(/[\dA-Z]{12}/.test(actual)).to.eql(true);

it('should return an uppercase string, 12 digits long', function (done) {
it('should return an 3-character string, all uppercase letters', function (done) {
var actual = randomize('AAA');

@@ -58,3 +58,10 @@ expect(/[A-Z]{3}/.test(actual)).to.eql(true);

it('should return an uppercase string, 12 digits long', function (done) {
it('should return an 3-character string, all uppercase letters', function (done) {
var actual = randomize('AAAAA', 3);
expect(/[A-Z]{3}/.test(actual)).to.eql(true);
expect(actual.length).to.deep.equal(3);
done();
});
it('should return an 12-character string of random uppercase and lowercase letters, and numbers', function (done) {
var actual = randomize('Aa0', 12);

@@ -66,3 +73,3 @@ expect(actual.length).to.deep.equal(12);

it('should return an uppercase string, 12 digits long', function (done) {
it('should return an 3-character, random alpha-numeric string', function (done) {
var actual = randomize('Aa0');

@@ -74,3 +81,3 @@ expect(/[\dA-Za-z]{3}/.test(actual)).to.eql(true);

it('should return an uppercase string, 12 digits long', function (done) {
it('should return 3-characters of numbers in order', function (done) {
var actual = randomize('000');

@@ -82,3 +89,3 @@ expect(/\d{3}/.test(actual)).to.eql(true);

it('should return an uppercase string, 12 digits long', function (done) {
it('should return a radomized 12-character string composed of the letters passed in the `chars` option', function (done) {
var actual = randomize('?', {chars: 'jonschlinkert'});

@@ -90,4 +97,36 @@ expect(/[jonschlinkert]{13}/.test(actual)).to.eql(true);

it('should return an uppercase string, 12 digits long', function (done) {
var actual = randomize('AAAAA', 3);
it('should return a radomized 16-character string', function (done) {
var actual = randomize('*', 16);
expect(/.{12}/.test(actual)).to.eql(true);
expect(actual.length).to.deep.equal(16);
done();
});
it('alphabetical, 10 digit:', function (done) {
var actual = randomize('A', 10);
expect(/.{10}/.test(actual)).to.eql(true);
expect(actual.length).to.deep.equal(10);
done();
});
it('alphabetical, 5 digits:', function (done) {
var actual = randomize('A', 5);
expect(/[A-Z]{5}/.test(actual)).to.eql(true);
expect(actual.length).to.deep.equal(5);
done();
});
it('alphabetical, 10 digits:', function (done) {
var actual = randomize('AA', 10);
expect(/[A-Z]{10}/.test(actual)).to.eql(true);
expect(actual.length).to.deep.equal(10);
done();
});
it('alphabetical, 12 digits:', function (done) {
var actual = randomize('Aa', 12);
expect(/.{12}/.test(actual)).to.eql(true);
expect(actual.length).to.deep.equal(12);
done();
});
it('alphabetical, 3 digits:', function (done) {
var actual = randomize('A', 3);
expect(/[A-Z]{3}/.test(actual)).to.eql(true);

@@ -97,11 +136,105 @@ expect(actual.length).to.deep.equal(3);

});
it('should return an uppercase string, 12 digits long', function (done) {
it('alphabetical, 3 digits:', function (done) {
var actual = randomize('AAa');
expect(/[A-Za-z]{3}/.test(actual)).to.eql(true);
expect(actual.length).to.deep.equal(3);
done();
});
it('alphabetical, 3 digits:', function (done) {
var actual = randomize('AA', 3);
expect(/[A-Z]{3}/.test(actual)).to.eql(true);
expect(actual.length).to.deep.equal(3);
done();
});
it('alphabetical, 3 digits:', function (done) {
var actual = randomize('AA');
expect(/[A-Z]{2}/.test(actual)).to.eql(true);
expect(actual.length).to.deep.equal(2);
done();
});
it('alpha-numeric, 5 digits:', function (done) {
var actual = randomize('A0', 5);
expect(/[A-Z\d]{5}/.test(actual)).to.eql(true);
expect(actual.length).to.deep.equal(5);
done();
});
it('alpha-numeric, 5 digits:', function (done) {
var actual = randomize('AA00', 5);
expect(/[A-Z\d]{5}/.test(actual)).to.eql(true);
expect(actual.length).to.deep.equal(5);
done();
});
it('alpha-numeric, 5 digits:', function (done) {
var actual = randomize('A0A0', 5);
expect(/[A-Z\d]{5}/.test(actual)).to.eql(true);
expect(actual.length).to.deep.equal(5);
done();
});
it('alpha-numeric, 5 digits:', function (done) {
var actual = randomize('A0A0A0A0A0A', 5);
expect(/[A-Z\d]{5}/.test(actual)).to.eql(true);
expect(actual.length).to.deep.equal(5);
done();
});
it('alpha-numeric, 8 digits:', function (done) {
var actual = randomize('AaAa0000');
expect(/[A-Za-z\d]{8}/.test(actual)).to.eql(true);
expect(actual.length).to.deep.equal(8);
done();
});
it('numeric, 1 digit:\t', function (done) {
var actual = randomize('0', 1);
expect(/\d{1}/.test(actual)).to.eql(true);
expect(actual.length).to.deep.equal(1);
done();
});
it('numeric, 8 digits:\t', function (done) {
var actual = randomize('0', 8);
expect(/^\d{8}/.test(actual)).to.eql(true);
expect(actual.length).to.deep.equal(8);
done();
});
it('numeric, 8 digits:\t', function (done) {
var actual = randomize('00000000');
expect(/^\d{8}/.test(actual)).to.eql(true);
expect(actual.length).to.deep.equal(8);
done();
});
it('special chars, 7 digits:', function (done) {
var actual = randomize('A0!', 7);
expect(/[\s\S]{7}/.test(actual)).to.eql(true);
expect(actual.length).to.deep.equal(7);
done();
});
it('special chars, 7 digits:', function (done) {
var actual = randomize('A0!a0A0');
expect(/[\s\S]{7}/.test(actual)).to.eql(true);
expect(/[\s\S]{8}/.test(actual)).to.eql(false);
expect(actual.length).to.deep.equal(7);
done();
});
it('alphabetical, 1 digit:', function (done) {
var actual = randomize('Aa0');
expect(/.{3}/.test(actual)).to.eql(true);
expect(/.{4}/.test(actual)).to.eql(false);
expect(actual.length).to.deep.equal(3);
done();
});
it('all characters, 16 digits:', function (done) {
var actual = randomize('*', 16);
expect(/.{12}/.test(actual)).to.eql(true);
expect(/.{16}/.test(actual)).to.eql(true);
expect(actual.length).to.deep.equal(16);
done();
});
it('custom chars, 16 digit', function (done) {
var actual = randomize('?', 16, 'jonathan');
expect(/.{16}/.test(actual)).to.eql(true);
expect(/[jonathan]/.test(actual)).to.eql(true);
expect(actual.length).to.deep.equal(16);
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