Extract numbers in a sentence
npm install number-analyzerThis package allow you to extract numbers from a string, for example:
``
import NumberAnalyzer from 'number-analyzer'
expect(NumberAnalyzer('mua hang 1,500 trieu 200,000.12 ngan 30,5 tieu xai 200 000 000'))
.toEqual([
[{
start: 9,
end: 41,
value: 1500000000 + (200000.12 * 1000) + 30.5,
}, {
start: 52,
end: 63,
value: 200000000,
},
],
]);
`
- use node v14.20.0
- Your work should be placed in src/ and test/
- To run test: npm test -- --watch. If you encounter ENOSPC error, fix it by running echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p (read more here)
- Before using this package, you shoule build it npm run build. This commands will automatically generate es5 code in lib/ folder
- To dev with your meteor app:
* in the root of this package, run npm link
* in for meteor app root, run npm link number-analyzer
* in the root of this package, run npm run dev` to continuously watch for file changes and build.
=> following these steps will make sure all changes get updated immediately in your meteor app