DeprecatedThis package is deprecated
Parsers without nonsense.
Instead of throwing or returning values like NaN, the parsers in this library
either return the expected parsed value or undefined (making use of the
Maybe type).
Usage
Node
Install @lou.codes/parsers as a dependency:
pnpm add @lou.codes/parsers
# or
npm install @lou.codes/parsers
# or
yarn add @lou.codes/parsers
Import it and use it:
import { parseDecimal } from "@lou.codes/parsers";
parseDecimal("101"); // 101
parseDecimal("nope"); // undefined
Deno
Import @lou.codes/parsers using the npm: prefix, and use it directly:
import { parseDecimal } from "npm:@lou.codes/parsers";
parseDecimal("101"); // 101
parseDecimal("nope"); // undefined
Browser
Import @lou.codes/parsers using esm.sh, and use it directly:
<script type="module">
import { parseDecimal } from "https://esm.sh/@lou.codes/parsers";
parseDecimal("101"); // 101
parseDecimal("nope"); // undefined
</script>
Useful links
- Documentation: TypeDoc generated documentation.
- Changelog: List of changes between versions.
- Tests Coverage: Coveralls page with tests coverage.