npm.io
1.1.4 • Published 1 year ago

@lou.codes/parsers

Licence
MIT
Version
1.1.4
Deps
2
Size
20 kB
Vulns
0
Weekly
0
Stars
5
DeprecatedThis package is deprecated
@lou.codes/parsers

Coverage License NPM Version Open Issues Size

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>

Keywords