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

@caldwell619/durable-parse-float

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@caldwell619/durable-parse-float

Utility to parse number from flexible input sources

  • 0.0.1
  • latest
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

GitHub Slugger

Fork of durable-parse-float written in TS

NPM NPM

Getting Started

yarn add @caldwell619/durable-parse-float

Quick Example

import { durableParseFloat, parseFloatStrict } from '@caldwell619/durable-parse-float'

durableParseFloat('1.34') // 1.34
durableParseFloat('#REF!') // null
parseFloatStrict('1') // 1
parseFloatStrict('1.34') // 1.34
parseFloatStrict('') // error thrown
parseFloatStrict(undefined) // error thrown

Differences

durableParseFloat is a flexible function that will return null or a number or float.

parseFloatStrict is a light wrapper around durableParseFloat that will throw if the input is invalid.

There are 2 separate functions, mainly to ensure that data stays consistent. If you cannot have a number be null, whether that's from TypeScript types, or some schema, etc, you have a way to ensure that your input will be a number, or die trying.

FAQs

Package last updated on 25 Sep 2022

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