New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

num-parse

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

num-parse

Package for parsing numbers from any string

  • 1.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
78
increased by47.17%
Maintainers
1
Weekly downloads
 
Created
Source

Package for parsing numbers from any string

Parse number from any string if it's possible.

Works in Node.js and browsers.

Usage

const numParse = require('num-parse')

numParse('text5.5text') // -> 5.5
numParse('text-5.5text') // -> -5.5
numParse('text%&*-5.5text') // -> -5.5
numParse('text--5.5text') // -> -5.5
numParse('test some-5.5m') // -> -5.5

numParse('5,000') // -> 5000
numParse('text 5,000,55') // -> 500055
numParse('5,000.55') // -> 5000.55
numParse('text5,000.55some') // -> 5000.55

numParse('text 5,000 55') // -> 5000
numParse('text 5,000.55 some 100000 other 345') // -> 5000.55

numParse('srt') // -> NaN
numParse('') // -> NaN
numParse(undefined) // -> NaN
numParse(null) // -> NaN

License

MIT

Keywords

FAQs

Package last updated on 03 Apr 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc