yepnope
v1.1.0
Published
Yepnope transforms yes/no answers into booleans
Downloads
26
Readme
Yepnope
Yepnope transforms yes/no answers into bools, very usefull for chatbots and command line tools.
Usage
require the lib using const yepnope = require('yepnoe')
var ok = new yepnope('yes')
//ok.true === true
var notok = new yepnope('nope')
//notok.false === true
Example
function parseAnswer(text){
var response = new yepnope(text);
if(response.true){
return 'thanks! i\'ll do that!';
}
if(response.false){
return 'ups! i\'ll do something else then!';
}
if(!response.false && !response.true){
return 'I don\'t understand!'
}
}