FileProcessor.Parsers.int
const parseNumber = (value, func) => {
if (value === null || typeof value === 'undefined') {
return null;
}
const result = func(value.toString().replace(/[^0-9.]+/g, ''), 10);
if (isNaN(result)) {
return null;
}
return result;
};
function int(value, coefficient) {
const candidate = parseNumber(value, parseInt);
if (candidate === null) {
return null;
}
return candidate * (coefficient || 1);
}
int('50106478, 50106479, 50106125')
no comments