warframe-name-generator 1.0.1 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.nvmrc +1 -0
- package/README.md +6 -2
- package/lib/Generator.js +86 -79
- package/lib/data.js +134 -0
- package/options/corpus/names.json +105 -52
- package/options/infested/titles.json +14 -14
- package/options/orokin/places.json +5 -1
- package/options/tenno/places.json +7 -1
- package/package.json +57 -20
- package/.eslintrc.json +0 -30
- package/index.js +0 -44
- package/test/.eslintrc.json +0 -13
- package/test/mochaspec.js +0 -35
package/.nvmrc
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
lts/hydrogen
|
package/README.md
CHANGED
|
@@ -9,12 +9,16 @@ npm i -S warframe-name-generator
|
|
|
9
9
|
## Usage
|
|
10
10
|
|
|
11
11
|
```js
|
|
12
|
-
|
|
12
|
+
import Generator from 'warframe-name-generator';
|
|
13
13
|
|
|
14
14
|
const generator = new Generator();
|
|
15
15
|
console.log(generator.make({ adjective: true }));
|
|
16
|
+
|
|
17
|
+
// if you'd like to access the data itself
|
|
18
|
+
import data from 'warframe-name-generator/data';
|
|
19
|
+
// and do stuff w/ it
|
|
16
20
|
```
|
|
17
21
|
|
|
18
22
|
## Contact me
|
|
19
23
|
|
|
20
|
-
[](https://discord.gg/
|
|
24
|
+
[](https://discord.gg/jGZxH9f "Contact me on Discord: Tobiah#0001")
|
package/lib/Generator.js
CHANGED
|
@@ -1,78 +1,36 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const data = {
|
|
4
|
-
corpus: {
|
|
5
|
-
adjectives: require('../options/corpus/adjectives.json'),
|
|
6
|
-
names: require('../options/corpus/names.json'),
|
|
7
|
-
places: require('../options/corpus/places.json'),
|
|
8
|
-
titles: require('../options/corpus/titles.json'),
|
|
9
|
-
},
|
|
10
|
-
grineer: {
|
|
11
|
-
adjectives: require('../options/grineer/adjectives.json'),
|
|
12
|
-
names: require('../options/grineer/names.json'),
|
|
13
|
-
places: require('../options/grineer/places.json'),
|
|
14
|
-
titles: require('../options/grineer/titles.json'),
|
|
15
|
-
},
|
|
16
|
-
orokin: {
|
|
17
|
-
adjectives: require('../options/orokin/adjectives.json'),
|
|
18
|
-
names: require('../options/orokin/names.json'),
|
|
19
|
-
places: require('../options/orokin/places.json'),
|
|
20
|
-
titles: require('../options/orokin/titles.json'),
|
|
21
|
-
},
|
|
22
|
-
sentient: {
|
|
23
|
-
adjectives: require('../options/sentient/adjectives.json'),
|
|
24
|
-
names: require('../options/sentient/names.json'),
|
|
25
|
-
places: require('../options/sentient/places.json'),
|
|
26
|
-
titles: require('../options/sentient/titles.json'),
|
|
27
|
-
},
|
|
28
|
-
tenno: {
|
|
29
|
-
adjectives: require('../options/tenno/adjectives.json'),
|
|
30
|
-
names: require('../options/tenno/names.json'),
|
|
31
|
-
places: require('../options/tenno/places.json'),
|
|
32
|
-
titles: require('../options/tenno/titles.json'),
|
|
33
|
-
},
|
|
34
|
-
infested: {
|
|
35
|
-
adjectives: require('../options/infested/adjectives.json'),
|
|
36
|
-
names: require('../options/infested/names.json'),
|
|
37
|
-
places: require('../options/infested/places.json'),
|
|
38
|
-
titles: require('../options/infested/titles.json'),
|
|
39
|
-
},
|
|
40
|
-
};
|
|
1
|
+
import data from './data.js';
|
|
41
2
|
|
|
42
3
|
const races = Object.keys(data);
|
|
43
4
|
const types = ['names', 'places', 'titles'];
|
|
44
5
|
|
|
45
|
-
const getRandomEntry = array => array[Math.floor(Math.random() * array.length)];
|
|
6
|
+
const getRandomEntry = (array) => array[Math.floor(Math.random() * array.length)];
|
|
46
7
|
|
|
47
|
-
const toTitleCase = (string, includeSpaces) =>
|
|
48
|
-
|
|
49
|
-
|
|
8
|
+
const toTitleCase = (string, includeSpaces) =>
|
|
9
|
+
string
|
|
10
|
+
.toLowerCase()
|
|
11
|
+
.split(' ')
|
|
12
|
+
.map((word) => word.replace(word[0], word[0].toUpperCase()))
|
|
13
|
+
.join(includeSpaces ? ' ' : '');
|
|
50
14
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
}) => {
|
|
63
|
-
const entry = toTitleCase(getRandomEntry(data[race][type]), spaces);
|
|
64
|
-
if (tokens.includes(entry) && (iterations < data[race][type].length)) {
|
|
65
|
-
return getNoun(tokens, {
|
|
66
|
-
race, type, spaces, iterations: iterations + 1,
|
|
67
|
-
});
|
|
15
|
+
const evalRace = (race) => {
|
|
16
|
+
const r = race.toLowerCase() === 'random' ? races[Math.floor(Math.random() * races.length)] : race;
|
|
17
|
+
if (!races.includes(r.toLowerCase())) {
|
|
18
|
+
throw new Error(`Invalid race '${r}' provided.\nValid races: ${races.map((innRace) => `'${innRace}'`).join(', ')}`);
|
|
19
|
+
}
|
|
20
|
+
return r;
|
|
21
|
+
};
|
|
22
|
+
const evalType = (type) => {
|
|
23
|
+
const t = type.toLowerCase() === 'random' ? types[Math.floor(Math.random() * types.length)] : type;
|
|
24
|
+
if (!types.includes(t.toLowerCase())) {
|
|
25
|
+
throw new Error(`Invalid type '${t}' provided.\nValid types: ${types.map((iType) => `'${iType}'`).join(', ')}`);
|
|
68
26
|
}
|
|
69
|
-
return
|
|
27
|
+
return t;
|
|
70
28
|
};
|
|
71
29
|
|
|
72
30
|
/**
|
|
73
|
-
* Generator for
|
|
31
|
+
* Generator for names!
|
|
74
32
|
*/
|
|
75
|
-
class Generator {
|
|
33
|
+
export default class Generator {
|
|
76
34
|
constructor() {
|
|
77
35
|
this.default = this.make();
|
|
78
36
|
this.logger = console;
|
|
@@ -92,29 +50,78 @@ class Generator {
|
|
|
92
50
|
* @param {boolean} [debug=false] (Optional) if true, debug and output string
|
|
93
51
|
* @returns {string} resultant generation from provided options
|
|
94
52
|
*/
|
|
95
|
-
make(
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
53
|
+
make(
|
|
54
|
+
{
|
|
55
|
+
race = 'random',
|
|
56
|
+
nouns = 1,
|
|
57
|
+
type = 'random',
|
|
58
|
+
spaces = true,
|
|
59
|
+
includeRace = false,
|
|
60
|
+
adjective = false,
|
|
61
|
+
debug = false,
|
|
62
|
+
} = { race: 'random', nouns: 1, type: 'random' }
|
|
63
|
+
) {
|
|
64
|
+
const raceRes = evalRace(race);
|
|
65
|
+
const typeRes = evalType(type);
|
|
107
66
|
|
|
108
67
|
const tokens = [];
|
|
109
68
|
if (adjective) tokens.push(toTitleCase(getRandomEntry(data[raceRes].adjectives), spaces));
|
|
110
69
|
if (includeRace) tokens.push(toTitleCase(raceRes, spaces));
|
|
111
70
|
for (let index = 0; index < nouns; index += 1) {
|
|
112
|
-
tokens.push(getNoun(tokens, { race: raceRes, type: typeRes, spaces }));
|
|
71
|
+
tokens.push(this.getNoun(tokens, { race: raceRes, type: typeRes, spaces }));
|
|
113
72
|
}
|
|
114
73
|
const name = tokens.join(spaces ? ' ' : '');
|
|
115
74
|
if (debug) this.logger.debug(name);
|
|
116
75
|
return name;
|
|
117
76
|
}
|
|
118
|
-
}
|
|
119
77
|
|
|
120
|
-
|
|
78
|
+
/**
|
|
79
|
+
* Get a random entry
|
|
80
|
+
* @returns {string} a random entry`
|
|
81
|
+
*/
|
|
82
|
+
get random() {
|
|
83
|
+
return this.getNoun();
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Get another string that's not already included in the tokens
|
|
88
|
+
* @param {string[]} tokens tokens to exclude
|
|
89
|
+
* @returns {string} new unique token
|
|
90
|
+
*/
|
|
91
|
+
another(tokens) {
|
|
92
|
+
return this.getNoun(tokens);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Get a unique noun.
|
|
97
|
+
* @param {string[]} tokens array of existing tokens
|
|
98
|
+
* @param {string} [race='random'] race type to use
|
|
99
|
+
* @param {string} [type='random'] noun type to use
|
|
100
|
+
* @param {boolean} [spaces=true}] whether or not to include spaces
|
|
101
|
+
* @param {number} [iterations=0] number of iterations to try to get a unique noun
|
|
102
|
+
* @returns {string} the unique noun result
|
|
103
|
+
*/
|
|
104
|
+
// eslint-disable-next-line class-methods-use-this
|
|
105
|
+
getNoun(
|
|
106
|
+
tokens = [],
|
|
107
|
+
{ race = 'random', type = 'random', spaces = true, iterations = 0 } = {
|
|
108
|
+
race: 'random',
|
|
109
|
+
type: 'random',
|
|
110
|
+
spaces: true,
|
|
111
|
+
iterations: 0,
|
|
112
|
+
}
|
|
113
|
+
) {
|
|
114
|
+
const raceR = evalRace(race);
|
|
115
|
+
const typeR = evalType(type);
|
|
116
|
+
const entry = toTitleCase(getRandomEntry(data[raceR][typeR]), spaces);
|
|
117
|
+
if (tokens.includes(entry) && iterations < data[raceR][typeR].length) {
|
|
118
|
+
return this.getNoun(tokens, {
|
|
119
|
+
race,
|
|
120
|
+
type,
|
|
121
|
+
spaces,
|
|
122
|
+
iterations: iterations + 1,
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
return entry;
|
|
126
|
+
}
|
|
127
|
+
}
|
package/lib/data.js
ADDED
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
corpus: {
|
|
3
|
+
adjectives: (
|
|
4
|
+
await import('../options/corpus/adjectives.json', {
|
|
5
|
+
assert: { type: 'json' },
|
|
6
|
+
})
|
|
7
|
+
).default,
|
|
8
|
+
names: (
|
|
9
|
+
await import('../options/corpus/names.json', {
|
|
10
|
+
assert: { type: 'json' },
|
|
11
|
+
})
|
|
12
|
+
).default,
|
|
13
|
+
places: (
|
|
14
|
+
await import('../options/corpus/places.json', {
|
|
15
|
+
assert: { type: 'json' },
|
|
16
|
+
})
|
|
17
|
+
).default,
|
|
18
|
+
titles: (
|
|
19
|
+
await import('../options/corpus/titles.json', {
|
|
20
|
+
assert: { type: 'json' },
|
|
21
|
+
})
|
|
22
|
+
).default,
|
|
23
|
+
},
|
|
24
|
+
grineer: {
|
|
25
|
+
adjectives: (
|
|
26
|
+
await import('../options/grineer/adjectives.json', {
|
|
27
|
+
assert: { type: 'json' },
|
|
28
|
+
})
|
|
29
|
+
).default,
|
|
30
|
+
names: (
|
|
31
|
+
await import('../options/grineer/names.json', {
|
|
32
|
+
assert: { type: 'json' },
|
|
33
|
+
})
|
|
34
|
+
).default,
|
|
35
|
+
places: (
|
|
36
|
+
await import('../options/grineer/places.json', {
|
|
37
|
+
assert: { type: 'json' },
|
|
38
|
+
})
|
|
39
|
+
).default,
|
|
40
|
+
titles: (
|
|
41
|
+
await import('../options/grineer/titles.json', {
|
|
42
|
+
assert: { type: 'json' },
|
|
43
|
+
})
|
|
44
|
+
).default,
|
|
45
|
+
},
|
|
46
|
+
orokin: {
|
|
47
|
+
adjectives: (
|
|
48
|
+
await import('../options/orokin/adjectives.json', {
|
|
49
|
+
assert: { type: 'json' },
|
|
50
|
+
})
|
|
51
|
+
).default,
|
|
52
|
+
names: (
|
|
53
|
+
await import('../options/orokin/names.json', {
|
|
54
|
+
assert: { type: 'json' },
|
|
55
|
+
})
|
|
56
|
+
).default,
|
|
57
|
+
places: (
|
|
58
|
+
await import('../options/orokin/places.json', {
|
|
59
|
+
assert: { type: 'json' },
|
|
60
|
+
})
|
|
61
|
+
).default,
|
|
62
|
+
titles: (
|
|
63
|
+
await import('../options/orokin/titles.json', {
|
|
64
|
+
assert: { type: 'json' },
|
|
65
|
+
})
|
|
66
|
+
).default,
|
|
67
|
+
},
|
|
68
|
+
sentient: {
|
|
69
|
+
adjectives: (
|
|
70
|
+
await import('../options/sentient/adjectives.json', {
|
|
71
|
+
assert: { type: 'json' },
|
|
72
|
+
})
|
|
73
|
+
).default,
|
|
74
|
+
names: (
|
|
75
|
+
await import('../options/sentient/names.json', {
|
|
76
|
+
assert: { type: 'json' },
|
|
77
|
+
})
|
|
78
|
+
).default,
|
|
79
|
+
places: (
|
|
80
|
+
await import('../options/sentient/places.json', {
|
|
81
|
+
assert: { type: 'json' },
|
|
82
|
+
})
|
|
83
|
+
).default,
|
|
84
|
+
titles: (
|
|
85
|
+
await import('../options/sentient/titles.json', {
|
|
86
|
+
assert: { type: 'json' },
|
|
87
|
+
})
|
|
88
|
+
).default,
|
|
89
|
+
},
|
|
90
|
+
tenno: {
|
|
91
|
+
adjectives: (
|
|
92
|
+
await import('../options/tenno/adjectives.json', {
|
|
93
|
+
assert: { type: 'json' },
|
|
94
|
+
})
|
|
95
|
+
).default,
|
|
96
|
+
names: (
|
|
97
|
+
await import('../options/tenno/names.json', {
|
|
98
|
+
assert: { type: 'json' },
|
|
99
|
+
})
|
|
100
|
+
).default,
|
|
101
|
+
places: (
|
|
102
|
+
await import('../options/tenno/places.json', {
|
|
103
|
+
assert: { type: 'json' },
|
|
104
|
+
})
|
|
105
|
+
).default,
|
|
106
|
+
titles: (
|
|
107
|
+
await import('../options/tenno/titles.json', {
|
|
108
|
+
assert: { type: 'json' },
|
|
109
|
+
})
|
|
110
|
+
).default,
|
|
111
|
+
},
|
|
112
|
+
infested: {
|
|
113
|
+
adjectives: (
|
|
114
|
+
await import('../options/infested/adjectives.json', {
|
|
115
|
+
assert: { type: 'json' },
|
|
116
|
+
})
|
|
117
|
+
).default,
|
|
118
|
+
names: (
|
|
119
|
+
await import('../options/infested/names.json', {
|
|
120
|
+
assert: { type: 'json' },
|
|
121
|
+
})
|
|
122
|
+
).default,
|
|
123
|
+
places: (
|
|
124
|
+
await import('../options/infested/places.json', {
|
|
125
|
+
assert: { type: 'json' },
|
|
126
|
+
})
|
|
127
|
+
).default,
|
|
128
|
+
titles: (
|
|
129
|
+
await import('../options/infested/titles.json', {
|
|
130
|
+
assert: { type: 'json' },
|
|
131
|
+
})
|
|
132
|
+
).default,
|
|
133
|
+
},
|
|
134
|
+
};
|
|
@@ -1,52 +1,105 @@
|
|
|
1
|
-
[
|
|
2
|
-
"
|
|
3
|
-
"Alad",
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
-
"
|
|
10
|
-
"
|
|
11
|
-
"
|
|
12
|
-
"
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
"
|
|
1
|
+
[
|
|
2
|
+
"002-ER",
|
|
3
|
+
"Alad",
|
|
4
|
+
"Ambulas",
|
|
5
|
+
"Amprex",
|
|
6
|
+
"Angstrum",
|
|
7
|
+
"Anyo",
|
|
8
|
+
"Armis",
|
|
9
|
+
"Arn",
|
|
10
|
+
"Arca",
|
|
11
|
+
"Auditor",
|
|
12
|
+
"Azoth",
|
|
13
|
+
"Battacor",
|
|
14
|
+
"Bek",
|
|
15
|
+
"Bidd",
|
|
16
|
+
"Bursa",
|
|
17
|
+
"Carmine",
|
|
18
|
+
"Cestra",
|
|
19
|
+
"Chas",
|
|
20
|
+
"Clohs",
|
|
21
|
+
"Coildrive",
|
|
22
|
+
"Comba",
|
|
23
|
+
"Convectrix",
|
|
24
|
+
"Corvette",
|
|
25
|
+
"Crewman",
|
|
26
|
+
"Cycron",
|
|
27
|
+
"Darvo",
|
|
28
|
+
"Datalyst",
|
|
29
|
+
"Deca",
|
|
30
|
+
"Dera",
|
|
31
|
+
"Derf",
|
|
32
|
+
"Derim",
|
|
33
|
+
"Detron",
|
|
34
|
+
"Dro",
|
|
35
|
+
"Drone",
|
|
36
|
+
"Dropship",
|
|
37
|
+
"Dru",
|
|
38
|
+
"Etina",
|
|
39
|
+
"Ferrox",
|
|
40
|
+
"Flux",
|
|
41
|
+
"Frigate",
|
|
42
|
+
"Frohd",
|
|
43
|
+
"Fuhns",
|
|
44
|
+
"Glaxion",
|
|
45
|
+
"Gox",
|
|
46
|
+
"Hedron",
|
|
47
|
+
"Helios",
|
|
48
|
+
"Hepta",
|
|
49
|
+
"Hyena",
|
|
50
|
+
"Ico",
|
|
51
|
+
"Intehb",
|
|
52
|
+
"Jackal",
|
|
53
|
+
"Jad",
|
|
54
|
+
"Jen",
|
|
55
|
+
"John",
|
|
56
|
+
"Jordas",
|
|
57
|
+
"Kappa",
|
|
58
|
+
"Kite",
|
|
59
|
+
"Kota",
|
|
60
|
+
"Kreska",
|
|
61
|
+
"Lanka",
|
|
62
|
+
"Lecta",
|
|
63
|
+
"Lenz",
|
|
64
|
+
"Lockjaw",
|
|
65
|
+
"Loot",
|
|
66
|
+
"Lynx",
|
|
67
|
+
"M-W.A.M.",
|
|
68
|
+
"MOA",
|
|
69
|
+
"Nako",
|
|
70
|
+
"Nef",
|
|
71
|
+
"Nemes",
|
|
72
|
+
"Nullifier",
|
|
73
|
+
"Octa",
|
|
74
|
+
"Obex",
|
|
75
|
+
"Ocucor",
|
|
76
|
+
"Ohma",
|
|
77
|
+
"Opticor",
|
|
78
|
+
"Orb",
|
|
79
|
+
"Osprey",
|
|
80
|
+
"Penta",
|
|
81
|
+
"Plasmor",
|
|
82
|
+
"Presfor",
|
|
83
|
+
"Prodman",
|
|
84
|
+
"Prova",
|
|
85
|
+
"Quanta",
|
|
86
|
+
"Raknoid",
|
|
87
|
+
"Ranger",
|
|
88
|
+
"Raptor",
|
|
89
|
+
"Rho",
|
|
90
|
+
"Scisco",
|
|
91
|
+
"Serro",
|
|
92
|
+
"Sol",
|
|
93
|
+
"Spectra",
|
|
94
|
+
"Supra",
|
|
95
|
+
"Teran",
|
|
96
|
+
"Tetra",
|
|
97
|
+
"Titron",
|
|
98
|
+
"Trencher",
|
|
99
|
+
"Ulta",
|
|
100
|
+
"Uno",
|
|
101
|
+
"Xol",
|
|
102
|
+
"Zahn",
|
|
103
|
+
"Zanuka",
|
|
104
|
+
"Zeta"
|
|
105
|
+
]
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
[
|
|
2
|
-
"
|
|
3
|
-
"
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
"Moa",
|
|
8
|
-
"Ancient",
|
|
9
|
-
"Charger",
|
|
10
|
-
"Leaper",
|
|
11
|
-
"
|
|
12
|
-
"
|
|
13
|
-
"
|
|
14
|
-
|
|
1
|
+
[
|
|
2
|
+
"Juggernaut",
|
|
3
|
+
"Golem",
|
|
4
|
+
"Crawler",
|
|
5
|
+
"Runner",
|
|
6
|
+
"Boiler",
|
|
7
|
+
"Moa",
|
|
8
|
+
"Ancient",
|
|
9
|
+
"Charger",
|
|
10
|
+
"Leaper",
|
|
11
|
+
"Moa",
|
|
12
|
+
"Brood Mother",
|
|
13
|
+
"Carrier"
|
|
14
|
+
]
|
package/package.json
CHANGED
|
@@ -1,13 +1,22 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "warframe-name-generator",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "Name Generator for Warframe",
|
|
5
|
-
"
|
|
5
|
+
"exports": {
|
|
6
|
+
".": {
|
|
7
|
+
"import": "./lib/Generator.js"
|
|
8
|
+
},
|
|
9
|
+
"./data": {
|
|
10
|
+
"import": "./lib/data.js"
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
"type": "module",
|
|
6
14
|
"scripts": {
|
|
7
|
-
"test": "
|
|
8
|
-
"
|
|
9
|
-
"lint
|
|
10
|
-
"
|
|
15
|
+
"test": "c8 mocha",
|
|
16
|
+
"coverage": "npm test && c8 report --reporter=text-lcov | coveralls",
|
|
17
|
+
"lint": "eslint .",
|
|
18
|
+
"lint:fix": "eslint . --fix",
|
|
19
|
+
"postinstall": "npx install-peerdeps @wfcd/eslint-config@latest -S"
|
|
11
20
|
},
|
|
12
21
|
"keywords": [
|
|
13
22
|
"warframe",
|
|
@@ -17,20 +26,48 @@
|
|
|
17
26
|
"author": "TobiTenno",
|
|
18
27
|
"license": "Apache-2.0",
|
|
19
28
|
"engines": {
|
|
20
|
-
"node": ">=
|
|
21
|
-
"npm": ">=
|
|
29
|
+
"node": ">=18.19.1",
|
|
30
|
+
"npm": ">=10.2.4"
|
|
22
31
|
},
|
|
23
32
|
"devDependencies": {
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
"
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
"c8": "^9.1.0",
|
|
34
|
+
"chai": "^5.1.0",
|
|
35
|
+
"coveralls": "^3.1.1",
|
|
36
|
+
"mocha": "^10.3.0",
|
|
37
|
+
"sinon": "^17.0.1"
|
|
38
|
+
},
|
|
39
|
+
"c8": {
|
|
40
|
+
"reporter": [
|
|
41
|
+
"lcov",
|
|
42
|
+
"text"
|
|
43
|
+
],
|
|
44
|
+
"skip-full": true
|
|
45
|
+
},
|
|
46
|
+
"mocha": {
|
|
47
|
+
"exit": true,
|
|
48
|
+
"check-leaks": true,
|
|
49
|
+
"diff": true,
|
|
50
|
+
"color": true,
|
|
51
|
+
"spec": "test/**/*.spec.js"
|
|
52
|
+
},
|
|
53
|
+
"eslintIgnore": [],
|
|
54
|
+
"eslintConfig": {
|
|
55
|
+
"extends": [
|
|
56
|
+
"@wfcd/eslint-config/esm"
|
|
57
|
+
],
|
|
58
|
+
"parserOptions": {
|
|
59
|
+
"sourceType": "module",
|
|
60
|
+
"parser": "@babel/eslint-parser"
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
"babel": {
|
|
64
|
+
"presets": [
|
|
65
|
+
"@babel/preset-env"
|
|
66
|
+
],
|
|
67
|
+
"plugins": [
|
|
68
|
+
"@babel/plugin-transform-class-properties",
|
|
69
|
+
"@babel/plugin-transform-private-methods"
|
|
70
|
+
]
|
|
71
|
+
},
|
|
72
|
+
"prettier": "@wfcd/eslint-config/prettier"
|
|
36
73
|
}
|
package/.eslintrc.json
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "airbnb",
|
|
3
|
-
"parserOptions": {
|
|
4
|
-
"sourceType": "script"
|
|
5
|
-
},
|
|
6
|
-
"rules": {
|
|
7
|
-
"valid-jsdoc": ["error", {
|
|
8
|
-
"requireReturn": false,
|
|
9
|
-
"requireReturnDescription": false,
|
|
10
|
-
"preferType": {
|
|
11
|
-
"String": "string",
|
|
12
|
-
"Number": "number",
|
|
13
|
-
"Boolean": "boolean",
|
|
14
|
-
"Function": "function",
|
|
15
|
-
"object": "Object",
|
|
16
|
-
"date": "Date",
|
|
17
|
-
"error": "Error"
|
|
18
|
-
},
|
|
19
|
-
"prefer": {
|
|
20
|
-
"return": "returns"
|
|
21
|
-
}
|
|
22
|
-
}],
|
|
23
|
-
"strict": ["error", "safe"],
|
|
24
|
-
"linebreak-style": "off",
|
|
25
|
-
"no-restricted-syntax": ["off"],
|
|
26
|
-
"no-await-in-loop": "off",
|
|
27
|
-
"import/no-unresolved": 0,
|
|
28
|
-
"global-require": "off"
|
|
29
|
-
}
|
|
30
|
-
}
|
package/index.js
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
/* eslint-disable global-require */
|
|
4
|
-
module.exports = {
|
|
5
|
-
Generator: require('./lib/Generator'),
|
|
6
|
-
data: {
|
|
7
|
-
corpus: {
|
|
8
|
-
adjectives: require('./options/corpus/adjectives.json'),
|
|
9
|
-
names: require('./options/corpus/names.json'),
|
|
10
|
-
places: require('./options/corpus/places.json'),
|
|
11
|
-
titles: require('./options/corpus/titles.json'),
|
|
12
|
-
},
|
|
13
|
-
grineer: {
|
|
14
|
-
adjectives: require('./options/grineer/adjectives.json'),
|
|
15
|
-
names: require('./options/grineer/names.json'),
|
|
16
|
-
places: require('./options/grineer/places.json'),
|
|
17
|
-
titles: require('./options/grineer/titles.json'),
|
|
18
|
-
},
|
|
19
|
-
orokin: {
|
|
20
|
-
adjectives: require('./options/orokin/adjectives.json'),
|
|
21
|
-
names: require('./options/orokin/names.json'),
|
|
22
|
-
places: require('./options/orokin/places.json'),
|
|
23
|
-
titles: require('./options/orokin/titles.json'),
|
|
24
|
-
},
|
|
25
|
-
sentient: {
|
|
26
|
-
adjectives: require('./options/sentient/adjectives.json'),
|
|
27
|
-
names: require('./options/sentient/names.json'),
|
|
28
|
-
places: require('./options/sentient/places.json'),
|
|
29
|
-
titles: require('./options/sentient/titles.json'),
|
|
30
|
-
},
|
|
31
|
-
tenno: {
|
|
32
|
-
adjectives: require('./options/tenno/adjectives.json'),
|
|
33
|
-
names: require('./options/tenno/names.json'),
|
|
34
|
-
places: require('./options/tenno/places.json'),
|
|
35
|
-
titles: require('./options/tenno/titles.json'),
|
|
36
|
-
},
|
|
37
|
-
infested: {
|
|
38
|
-
adjectives: require('./options/infested/adjectives.json'),
|
|
39
|
-
names: require('./options/infested/names.json'),
|
|
40
|
-
places: require('./options/infested/places.json'),
|
|
41
|
-
titles: require('./options/infested/titles.json'),
|
|
42
|
-
},
|
|
43
|
-
},
|
|
44
|
-
};
|
package/test/.eslintrc.json
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"env": {
|
|
3
|
-
"mocha": true
|
|
4
|
-
},
|
|
5
|
-
"rules": {
|
|
6
|
-
"prefer-arrow-callback": "off",
|
|
7
|
-
"func-names": "off",
|
|
8
|
-
"no-new": "off",
|
|
9
|
-
"no-unused-expressions": "off",
|
|
10
|
-
"valid-jsdoc": "off",
|
|
11
|
-
"import/no-extraneous-dependencies": ["error", {"devDependencies": true, "optionalDependencies": false, "peerDependencies": false}]
|
|
12
|
-
}
|
|
13
|
-
}
|
package/test/mochaspec.js
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const chai = require('chai');
|
|
4
|
-
const { Generator } = require('../index.js');
|
|
5
|
-
|
|
6
|
-
const should = chai.should();
|
|
7
|
-
|
|
8
|
-
describe('The Generator', () => {
|
|
9
|
-
const generator = new Generator();
|
|
10
|
-
|
|
11
|
-
it('should provide a default name with no extra call', () => {
|
|
12
|
-
should.exist(generator.default);
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
it('should generate a name with no parameters', () => {
|
|
16
|
-
(() => {
|
|
17
|
-
const name = generator.make({ debug: false, adjective: true });
|
|
18
|
-
should.exist(name);
|
|
19
|
-
}).should.not.throw();
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
it('should generate unique names', () => {
|
|
23
|
-
const name = generator.make({ debug: false, adjective: true });
|
|
24
|
-
const name2 = generator.make({ debug: false, adjective: true });
|
|
25
|
-
should.not.equal(name, name2);
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
it('should generate 10k names without issues', () => {
|
|
29
|
-
(() => {
|
|
30
|
-
for (let i = 0; i < 10000; i += 1) {
|
|
31
|
-
generator.make({ debug: false, adjective: true, nouns: Math.floor(Math.random() * 10) });
|
|
32
|
-
}
|
|
33
|
-
}).should.not.throw();
|
|
34
|
-
});
|
|
35
|
-
});
|