crypto-random-string
Advanced tools
Comparing version 3.0.0 to 3.0.1
10
index.js
'use strict'; | ||
const crypto = require('crypto'); | ||
const urlSafeCharacters = 'abcdefjhijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~'.split(''); | ||
const urlSafeCharacters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~'.split(''); | ||
@@ -41,12 +41,12 @@ const generateForCustomCharacters = (length, characters) => { | ||
module.exports = ({length, type, characters}) => { | ||
if (!Number.isFinite(length)) { | ||
throw new TypeError('Expected a finite number'); | ||
if (!(length >= 0 && Number.isFinite(length))) { | ||
throw new TypeError('Expected a `length` to be a non-negative finite number'); | ||
} | ||
if (type !== undefined && characters !== undefined) { | ||
throw new TypeError('Expected either type or characters'); | ||
throw new TypeError('Expected either `type` or `characters`'); | ||
} | ||
if (characters !== undefined && typeof characters !== 'string') { | ||
throw new TypeError('Expected characters to be string'); | ||
throw new TypeError('Expected `characters` to be string'); | ||
} | ||
@@ -53,0 +53,0 @@ |
{ | ||
"name": "crypto-random-string", | ||
"version": "3.0.0", | ||
"version": "3.0.1", | ||
"description": "Generate a cryptographically strong random string", | ||
@@ -36,9 +36,9 @@ "license": "MIT", | ||
"dependencies": { | ||
"type-fest": "^0.4.1" | ||
"type-fest": "^0.5.2" | ||
}, | ||
"devDependencies": { | ||
"ava": "^1.4.1", | ||
"tsd": "^0.7.2", | ||
"ava": "^2.1.0", | ||
"tsd": "^0.7.3", | ||
"xo": "^0.24.0" | ||
} | ||
} |
8186
+ Addedtype-fest@0.5.2(transitive)
- Removedtype-fest@0.4.1(transitive)
Updatedtype-fest@^0.5.2