UNPKG

contract-scraper

Version:

A customisable data scraper for the web based on JSON contracts

15 lines (14 loc) 474 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = (number) => { if (number === undefined || number === null) { return null; } const strippedString = number.toString().replace(/\s+/g, ''); const getValue = /\d+/gm; const parsedString = strippedString.match(getValue); if (parsedString === null || parsedString.length === 0) { return null; } return parseInt(parsedString[0], 10); };