-
Notifications
You must be signed in to change notification settings - Fork 0
Home
Welcome to the rslike wiki!
here is you find:
- Less undefined behavior, when using Option and Result.
- Well tested. 100% test coverage
- JSDoc with examples.
- Typescript ready - d.ts types are generated with tsc.
- first-class
CJS
andESM
support. - Zero dependencies.
-
2kB
for min+gzip and7.6kB
for minified. See in bundlefobia. - Deno?
Installation
npm i @rslike/std
# or
yarn add @rslike/std
# or
pnpm add @rslike/std
Installation
npm i @rslike/cmp
# or
yarn add @rslike/cmp
# or
pnpm add @rslike/cmp
cmp
or Comparison package allows define your custom compares structures between each others.
Installation
npm i @rslike/dbg
# or
yarn add @rslike/dbg
# or
pnpm add @rslike/dbg
dbg
package allows to print information about variable and it's type.
You can find the Debug
API here
- Install package type (
std
and/orcmp
) - In your entry file write next:
// your main file
// add global types in globalThis: Some, None, Option, Result, Ok, Err functions
import '@rslike/<package>/globals';
// rest your file
part of the std package
Option
is the same as for rust Option
object
You can find the Option
API here
part of the std package
Result<T,E>
is a same as for rust Result
object
You can find API here
part of the std package
Tries to resolve Promise<T>
into Result<Option<T>, E>
.
You can find API and examples here
part of the std package
Wraps function call into Result<Option<T>, E>
. Easily to combine with match function
You can find API and examples here
part of the std package
unwraps boolean
, Option
or Result
and execute one of 2 callbacks depending on result.
If result is Ok
, Some
or true
- 1 callback will be executed
If result is Err
, None
or false
- 2 callback will be executed
You can find API and examples here