0.1.1 • Published 8 years ago

likert v0.1.1

Weekly downloads
3
License
MIT
Repository
github
Last release
8 years ago

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

0.1.1

8 years ago

0.1.0

8 years ago