Motivation

Why ?

This is a library containing common tools that can also work in the browser that we use in almost all projects except @sirutils/core.

For example:

Converting a string to an URL can throw an error.

const good = new URL("https://sirutils.com"); // is fine
const bad = new URL("bad_url") // Uncaught TypeError: Failed to construct 'URL': Invalid URL

Our solution:

import { toUrl } from "@sirutils/safe-toolbox"

const result = toUrl("https://sirutils.com") // ok(URL)
const otherResult = toUrl("https://sirutils.com") // err(URL)