randomatic
Advanced tools
Comparing version 3.0.0 to 3.1.0
@@ -82,2 +82,8 @@ /*! | ||
// Characters to exclude | ||
if (opts.exclude) { | ||
var exclude = typeOf(opts.exclude) === 'string' ? opts.exclude : opts.exclude.join(''); | ||
mask = mask.replace(new RegExp('[' + exclude + ']+', 'g'), ''); | ||
} | ||
while (length--) { | ||
@@ -84,0 +90,0 @@ res += mask.charAt(parseInt(mathRandom() * mask.length, 10)); |
{ | ||
"name": "randomatic", | ||
"description": "Generate randomized strings of a specified length using simple character sequences. The original generate-password.", | ||
"version": "3.0.0", | ||
"version": "3.1.0", | ||
"homepage": "https://github.com/jonschlinkert/randomatic", | ||
@@ -6,0 +6,0 @@ "author": "Jon Schlinkert (https://github.com/jonschlinkert)", |
@@ -25,2 +25,3 @@ # randomatic [![NPM version](https://img.shields.io/npm/v/randomatic.svg?style=flat)](https://www.npmjs.com/package/randomatic) [![NPM monthly downloads](https://img.shields.io/npm/dm/randomatic.svg?style=flat)](https://npmjs.org/package/randomatic) [![NPM total downloads](https://img.shields.io/npm/dt/randomatic.svg?style=flat)](https://npmjs.org/package/randomatic) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/randomatic.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/randomatic) | ||
randomize(pattern, length, options); | ||
randomize.isCrypto; | ||
``` | ||
@@ -31,2 +32,3 @@ | ||
* `options` **{Object}**: (optional) See available [options](#options) | ||
* `randomize.isCrypto` will be `true` when a cryptographically secure function is being used to generate random numbers. The value will be `false` when the function in use is `Math.random`. | ||
@@ -92,2 +94,14 @@ ### pattern | ||
#### exclude | ||
Type: `String|Array` | ||
Default: `undefined` | ||
Specify a string or array of characters can are excluded from the possible characters used to generate the randomized string. | ||
**Example:** | ||
* `randomize('*', 20, { exclude: '0oOiIlL1' })` will generate a 20-character randomized string using all of possible characters except for `0oOiIlL1`. | ||
## Usage Examples | ||
@@ -108,23 +122,27 @@ | ||
<details> | ||
<summary><strong>Contributing</strong></summary> | ||
### Related projects | ||
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new). | ||
* [pad-left](https://www.npmjs.com/package/pad-left): Left pad a string with zeros or a specified string. Fastest implementation. | [homepage](https://github.com/jonschlinkert/pad-left "Left pad a string with zeros or a specified string. Fastest implementation.") | ||
* [pad-right](https://www.npmjs.com/package/pad-right): Right pad a string with zeros or a specified string. Fastest implementation. | [homepage](https://github.com/jonschlinkert/pad-right "Right pad a string with zeros or a specified string. Fastest implementation.") | ||
* [repeat-string](https://www.npmjs.com/package/repeat-string): Repeat the given string n times. Fastest implementation for repeating a string. | [homepage](https://github.com/jonschlinkert/repeat-string "Repeat the given string n times. Fastest implementation for repeating a string.") | ||
</details> | ||
### Contributing | ||
<details> | ||
<summary><strong>Running Tests</strong></summary> | ||
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new). | ||
Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command: | ||
### Contributors | ||
```sh | ||
$ npm install && npm test | ||
``` | ||
| **Commits** | **Contributor** | | ||
| --- | --- | | ||
| 56 | [jonschlinkert](https://github.com/jonschlinkert) | | ||
| 2 | [realityking](https://github.com/realityking) | | ||
| 1 | [TrySound](https://github.com/TrySound) | | ||
| 1 | [Drag0s](https://github.com/Drag0s) | | ||
| 1 | [paulmillr](https://github.com/paulmillr) | | ||
| 1 | [sunknudsen](https://github.com/sunknudsen) | | ||
| 1 | [faizulhaque-tp](https://github.com/faizulhaque-tp) | | ||
| 1 | [michaelrhodes](https://github.com/michaelrhodes) | | ||
</details> | ||
### Building docs | ||
<details> | ||
<summary><strong>Building docs</strong></summary> | ||
_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_ | ||
@@ -138,24 +156,10 @@ | ||
</details> | ||
### Running tests | ||
### Related projects | ||
Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command: | ||
You might also be interested in these projects: | ||
```sh | ||
$ npm install && npm test | ||
``` | ||
* [pad-left](https://www.npmjs.com/package/pad-left): Left pad a string with zeros or a specified string. Fastest implementation. | [homepage](https://github.com/jonschlinkert/pad-left "Left pad a string with zeros or a specified string. Fastest implementation.") | ||
* [pad-right](https://www.npmjs.com/package/pad-right): Right pad a string with zeros or a specified string. Fastest implementation. | [homepage](https://github.com/jonschlinkert/pad-right "Right pad a string with zeros or a specified string. Fastest implementation.") | ||
* [repeat-string](https://www.npmjs.com/package/repeat-string): Repeat the given string n times. Fastest implementation for repeating a string. | [homepage](https://github.com/jonschlinkert/repeat-string "Repeat the given string n times. Fastest implementation for repeating a string.") | ||
### Contributors | ||
| **Commits** | **Contributor** | | ||
| --- | --- | | ||
| 48 | [jonschlinkert](https://github.com/jonschlinkert) | | ||
| 2 | [realityking](https://github.com/realityking) | | ||
| 1 | [TrySound](https://github.com/TrySound) | | ||
| 1 | [Drag0s](https://github.com/Drag0s) | | ||
| 1 | [paulmillr](https://github.com/paulmillr) | | ||
| 1 | [sunknudsen](https://github.com/sunknudsen) | | ||
| 1 | [faizulhaque-tp](https://github.com/faizulhaque-tp) | | ||
### Author | ||
@@ -170,3 +174,3 @@ | ||
Copyright © 2017, [Jon Schlinkert](https://github.com/jonschlinkert). | ||
Copyright © 2018, [Jon Schlinkert](https://github.com/jonschlinkert). | ||
Released under the [MIT License](LICENSE). | ||
@@ -176,2 +180,2 @@ | ||
_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on October 19, 2017._ | ||
_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.7.0, on August 08, 2018._ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
12421
76
174
1