Input
Definition*:
1. The first argument must be a string or an object.
The string is the phrase to i18n
The object must contain a 'phrase' key with a string value to i18n
2. The second must be n number of strings, an array or an object.
The n number of strings will represent sprint-f
The array will represent sprint-f
The object will represent sprint-f, or other arguments
Inputify
class
new Inputify() extends Extractify
This class extends the Extractify class
by adding an API wrapper around it.
class Inputify extends Extractify {
constructor(phrase, args) {
super(phrase, args);
log.debug(`class: ${Inputify.name}`, `process: phrase`)
.info('extract:', this.extracts)
.info('phrase:', this.phrase())
.info('args:', this.arguments());
}
phrase
method
Inputify.prototype.phrase()
Returns the extracted phrase.
phrase() {
log.debug(`class: ${Inputify.name}`, `process: phrase`);
return this.extracts.phrase;
}
arguments
method
Inputify.prototype.arguments()
Returns the extracted arguments.
arguments() {
log.debug(`class: ${Inputify.name}`, `process: arguments`);
return this.extracts.args;
}
values
method
Inputify.prototype.values()
Returns the extracted values.
values() {
log.debug(`class: ${Inputify.name}`, `process: values`);
return this.extracts.values;
}
hasArgs
method
Inputify.prototype.hasArgs()
Determines whether the arguments are empty.
hasArgs() {
log.debug(`class: ${Inputify.name}`, `process: hasArgs`);
return !_.isEmpty(this.extracts.args);
}
hasValues
method
Inputify.prototype.hasValues()
Determines whether the values are empty.
hasValues() {
log.debug(`class: ${Inputify.name}`, `process: hasValues`);
return !_.isEmpty(this.extracts.values);
}
}
inputify
function
inputify()
Option name | Type | Description |
---|---|---|
phrase | String, Object | The phrase to parse. |
args | String, Object, Array | The arguments to apply to the phrase. |
return | Inputify | An instance of Inputify |
Returns instance of Inputify.
function inputify(phrase, ...args) {
'use strict';
return new Inputify(phrase, args);
}
export default inputify;