docparse-supplier-nge
Version:
process ngrid electric utility bill data for use in the docparse system
20 lines (19 loc) • 537 B
JavaScript
var inspect = require('eyespect').inspector();
/**
* Competitive Supply Bills are handled differently than those for standard offer
*
* {Boolean} is_competive
* @return callback(<error if any>, is_supplier)
*/
module.exports = function(text) {
var is_competive = false;
var pattern = /Supply Services[\s\S]*?SUPPLIER\s*(.*?)\s*$/m;
var matches = text.match(pattern);
if (matches) {
var supplierName = matches[1];
if (supplierName !== 'National Grid') {
is_competive = true;
}
}
return is_competive;
};