@beenotung/tslib
Version:
utils library in Typescript
14 lines (13 loc) • 375 B
JavaScript
;
/**
* Created by beenotung on 4/23/17.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.fromLocaleString = fromLocaleString;
function fromLocaleString(str) {
const num = +str.replaceAll(',', '');
if (num.toLocaleString() === str) {
return num;
}
throw new Error('failed to parse locale string into number');
}