Comparing version 1.1.1 to 1.2.0
19
index.js
@@ -117,5 +117,6 @@ let fs = require('fs'); | ||
if (gender === Genders.Any) { | ||
return space[self.keys[ NVRNG.randIntFromZero(self.keys.length) ]]; | ||
let proGender = self.keys[ NVRNG.randIntFromZero(self.keys.length) ]; | ||
return [proGender, space[proGender]]; | ||
} | ||
return space[gender]; | ||
return [gender, space[gender]]; | ||
} | ||
@@ -169,5 +170,6 @@ | ||
do { | ||
let p = []; | ||
let p = [], arr; | ||
let proGender = gender; | ||
for (let space of self.spaces) { | ||
let arr = self.getArrOfGender(self.rset[space], gender); | ||
[proGender, arr] = self.getArrOfGender(self.rset[space], proGender); | ||
let index = NVRNG.randIntFromZero(arr.length); | ||
@@ -204,8 +206,9 @@ p.push(formatter(arr[index])); | ||
} | ||
let adder = proExclude.size > 0 ? addToSetAndExclude : addToSet, | ||
limitter = self.limit; | ||
let adder = proExclude.size > 0 ? addToSetAndExclude : addToSet, | ||
limitter = self.limit; | ||
while (out.size < size && limitter-->0) { | ||
let p = []; | ||
let p = [], arr; | ||
let proGender = gender; | ||
for (let space of self.spaces) { | ||
let arr = self.getArrOfGender(self.rset[space], gender); | ||
[proGender, arr] = self.getArrOfGender(self.rset[space], proGender); | ||
let index = NVRNG.randIntFromZero(arr.length); | ||
@@ -212,0 +215,0 @@ p.push(formatter(arr[index])); |
{ | ||
"name": "nvrng", | ||
"version": "1.1.1", | ||
"version": "1.2.0", | ||
"description": "Not very random temporary name generator", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -27,4 +27,8 @@ [![Codecov Coverage](https://img.shields.io/codecov/c/github/ssypachev/nvrng/master.svg?style=flat-square)](https://codecov.io/gh/ssypachev/nvrng/) | ||
# Options | ||
Some predefined vocabularies can be found in `vocabularies` folder in [repository](https://github.com/ssypachev/nvrng/tree/master/vocabularies) | ||
Please, make pull request to find any errors in words or if you have any other vocabulary to suggest. | ||
## Methods | ||
#### `constructor({ limit = 100000 })` | ||
@@ -77,8 +81,10 @@ | ||
`include` - array or set of values that would be injected to output set, default is empty set. For example, if `include` is 3 unique string long and | ||
you generate 5 new string, then output would be 5 + 3 = 8 strings long | ||
`exclude` - array or set of values that must be ommitted in output set, default is empty set. | ||
`include` - array or set of values that would be injected to output set, default is empty set. For example, if `include` is 3 unique strings long and | ||
you generate 5 new strings, then output would be 5 + 3 = 8 strings long | ||
`exclude` - array or set of values that must be ommitted in output set, default is empty set | ||
`delimiter` - char to join random words, default is ' ' | ||
## `getOne({ gender = Genders.Any, exclude, delimiter = ' ', format = StringFormat.NoFormat }) => [err, string]` | ||
#### `getOne({ gender = Genders.Any, exclude, delimiter = ' ', format = StringFormat.NoFormat }) => [err, string]` | ||
@@ -129,3 +135,3 @@ Returns one string. Same options as in `getSet` (except `include` and `output`). | ||
let newname; | ||
[err, newname] = gen.getOne({ delimiter: '-', format: StringFormat.Capitalize }); | ||
[err, newname] = gen.getOne({ delimiter: '-', format: StringFormat.Capitalize, exclude: set }); | ||
@@ -132,0 +138,0 @@ console.log(newname); |
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
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
19770
209
174