Turn humanized numbers back into machine numbers
Works well for UI tests if numbers are humanized with humanize-plus
This package is available on npm, so you can install it with npm
$ npm install --save-dev dehumanize
or if you prefer yarn
$ yarn add --dev dehumanize
Currently only one method fromCompactInteger
is exposed. The delimiter and thousands separator are not (yet) configurable.
const { fromCompactInteger } = require("dehumanize")
fromCompactInteger("56") // 56 as a number
fromCompactInteger("34k") // 34000
fromCompactInteger("6.54M") // 6540000
fromCompactInteger("4,321") // 4321