Skip to content

Commit 93489f7

Browse files
committed
fix typo
1 parent 455ae67 commit 93489f7

1 file changed

Lines changed: 15 additions & 15 deletions

File tree

lib/String_random.js

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -121,15 +121,15 @@ function String_random (pattern, options) {
121121
const REFERENCE = {};
122122

123123
function processOthers (tree) {
124-
let ret = '', candinates = [];
124+
let ret = '', candidates = [];
125125
tree = tree.slice(0);
126126

127127
function choice () {
128-
let ret = candinates[ Math.floor(candinates.length * random()) ];
128+
let ret = candidates[ Math.floor(candidates.length * random()) ];
129129
if (ret instanceof Array) {
130130
ret = processOthers(ret);
131131
}
132-
if (candinates.n) REFERENCE[candinates.n] = ret;
132+
if (candidates.n) REFERENCE[candidates.n] = ret;
133133
return ret || '';
134134
}
135135

@@ -144,13 +144,13 @@ function String_random (pattern, options) {
144144
for (let i = 0, len = random() * 10; i < len; i++) {
145145
ret += choice();
146146
}
147-
candinates = [];
147+
candidates = [];
148148
break;
149149
case '+':
150150
for (let i = 0, len = random() * 10 + 1; i < len; i++) {
151151
ret += choice();
152152
}
153-
candinates = [];
153+
candidates = [];
154154
break;
155155
case '{':
156156
let brace = '';
@@ -171,13 +171,13 @@ function String_random (pattern, options) {
171171
for (let i = 0, len = Math.floor(random() * (max - min + 1)) + min; i < len; i++) {
172172
ret += choice();
173173
}
174-
candinates = [];
174+
candidates = [];
175175
break;
176176
case '?':
177177
if (random() < 0.5) {
178178
ret += choice();
179179
}
180-
candinates = [];
180+
candidates = [];
181181

182182
break;
183183

@@ -186,15 +186,15 @@ function String_random (pattern, options) {
186186
const escaped = tree.shift();
187187

188188
if (escaped.match(/^[1-9]$/)) {
189-
candinates = [ REFERENCE[escaped] || '' ];
189+
candidates = [ REFERENCE[escaped] || '' ];
190190
} else {
191191
if (escaped === 'b' || escaped === 'B') {
192192
throw Error(`\\b and \\B is not supported`);
193193
}
194-
candinates = CLASSES[escaped];
194+
candidates = CLASSES[escaped];
195195
}
196196

197-
if (!candinates) candinates = [ escaped ];
197+
if (!candidates) candidates = [ escaped ];
198198

199199
break;
200200
case '[':
@@ -249,21 +249,21 @@ function String_random (pattern, options) {
249249
neg[sets[i]] = true;
250250
}
251251

252-
candinates = [];
252+
candidates = [];
253253
for (let i = 0, len = ALL.length; i < len; i++) {
254-
if (!neg[ALL[i]]) candinates.push(ALL[i]);
254+
if (!neg[ALL[i]]) candidates.push(ALL[i]);
255255
}
256256
} else {
257-
candinates = sets;
257+
candidates = sets;
258258
}
259259
break;
260260
case '.':
261261
ret += choice();
262-
candinates = ALL;
262+
candidates = ALL;
263263
break;
264264
default:
265265
ret += choice();
266-
candinates = chr;
266+
candidates = chr;
267267
}
268268
}
269269
return ret + choice();

0 commit comments

Comments
 (0)