yepnope

1.1.0 • Public • Published

Yepnope

Build Status

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!'
    }
 
  }

Readme

Keywords

none

Package Sidebar

Install

npm i yepnope

Weekly Downloads

42

Version

1.1.0

License

MIT

Last publish

Collaborators

  • entomb