UNPKG

bagpipes

Version:

Less code, more flow. Let's dance!

15 lines (9 loc) 368 B
'use strict'; var debug = require('debug')('pipes'); module.exports = function create() { return function parse(context, cb) { if (context.input !== 'json') { throw new Error('parse input must be "json"'); } if (typeof context.output !== 'string') { throw new Error('context.output must be a string'); } cb(null, JSON.parse(context.output)); } };