UNPKG

docparse-supplier-nge

Version:

process ngrid electric utility bill data for use in the docparse system

24 lines (22 loc) 548 B
/** * Cost Delivery looks like "... Total Delivery Services $ 7310.30 ..." */ var extract = require('regex-extract'); var inspect = require('eyespect').inspector(); module.exports = function(text, cb) { text = text.replace(/\$/g,''); var pattern = /Total Delivery Services\s*(-?\s?[\d\.]+)\s*$/m; extract(text, pattern, function (err, reply) { if (err) { return cb(err, null); } if (reply === null) { inspect('delivery charges not found'); reply = '0'; } return cb(null, reply); }); };