UNPKG

e-scraper

Version:

Collect products, reviews, locations from a different E-Commerce stores. Currently supporting Target.Com and soon more.

19 lines (18 loc) 658 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.entryValidator = void 0; exports.entryValidator = (entry) => { for (const item in entry) { if (entry[item].required && !entry[item].value) { throw `Missing ${item}`; } if (typeof entry[item].condition === 'number') { if (typeof entry[item].value !== 'number') { throw `${item} can only be a number`; } if (entry[item].condition && entry[item].value > entry[item].condition) { throw `Max ${item} value is: ${entry[item].condition}`; } } } };