UNPKG

think-payload

Version:
10 lines (8 loc) 311 B
const text = require('./text.js'); const helper = require('think-helper'); const parseString = require('xml2js').parseString; const parser = helper.promisify(parseString, parseString); module.exports = (ctx, opts) => text(ctx, opts) .then(xml => parser(xml, opts).then(post => ({ post, raw: xml })) );