likert

0.1.1 • Public • Published

Likert

Build Status Coverage Status

Survey data flow engine.

Install

npm install likert

Usage

import createSurvey from 'likert';
 
const spec = {
  'Do you like vegetables?': {
    options: ['Yes', 'No'],
    next: answer => {
      if (answer === 'Yes') return 'What\'s your favorite vegetable?';
      else return 'Thank you for taking our survey! Any last words?';
    }
  },
  'What\'s your favorite vegetable?': {
    options: [
      'Corn', 'Carrots', 'Tomatoes'
    ],
    next: answer => {
      if (answer === 'Tomatoes') return 'You do realize tomatoes are a fruit, right?';
      else return 'Thank you for taking our survey! Any last words?'; 
    }
  },
  'You do realize tomatoes are a fruit, right?': [
    'Yes', 'No'
  ],
  'Thank you for taking our survey! Any last words?': {} 
}
 
const question1 = createSurvey(spec2);
const question2 = question1.answer('Yes');
const question3 = question2.answer('Corn');
const question4 = question3.answer('I love vegetables!');

License

MIT


pori.io  ·  GitHub @pori  ·  Twitter @pori_alex

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.1.1
    0
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 0.1.1
    0
  • 0.1.0
    0

Package Sidebar

Install

npm i likert

Weekly Downloads

0

Version

0.1.1

License

MIT

Last publish

Collaborators

  • pori