return result with input, if prescribed
This commit is contained in:
parent
22e0c904e0
commit
66d46eab32
|
@ -41,11 +41,12 @@ The follow options may also be specified:
|
||||||
// 4. check the most recent character, if desired
|
// 4. check the most recent character, if desired
|
||||||
|
|
||||||
// 5. normalize the input if desired (i.e. John.Doe@GMail.com -> john.doe@gmail.com)
|
// 5. normalize the input if desired (i.e. John.Doe@GMail.com -> john.doe@gmail.com)
|
||||||
|
// (or return something else entirely)
|
||||||
|
|
||||||
// You can error out
|
// You can error out
|
||||||
// return form.PromiseA.reject(new Error("[X] This isn't an email address: no '@'"));
|
// return form.PromiseA.reject(new Error("[X] This isn't an email address: no '@'"));
|
||||||
|
|
||||||
return input.toLowerCase();
|
return input.toLowerCase(); // will be returned as `result` alongside `input`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
2
index.js
2
index.js
|
@ -233,7 +233,7 @@ var form = {
|
||||||
var input = ws._input.join('');
|
var input = ws._input.join('');
|
||||||
ws._input = [];
|
ws._input = [];
|
||||||
ws._inputIndex = 0;
|
ws._inputIndex = 0;
|
||||||
resolve({ input: normalInput || input });
|
resolve({ input: input, result: normalInput });
|
||||||
}, function (err) {
|
}, function (err) {
|
||||||
rrs.on('data', onData);
|
rrs.on('data', onData);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue