JSPM

  • Created
  • Published
  • Downloads 203
  • Score
    100M100P100Q87858F
  • License MIT

Standard library

Package Exports

  • @koober/std
  • @koober/std/lib/data
  • @koober/std/lib/result

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@koober/std) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Koober Standard Library (@koober/std)

NPM Version License

Standard library

Installation

npm install @koober/std

Usage

import { Iterable } from '@koober/std';

Iterable.map(['foo'].entries(), (_) => _.length);
VanillaJS STD Explanation
null, undefined Option Stop spending time choosing between undefined and null. Based on Microsoft standard, undefined (== Option.None) is preferred.
throw Error() return Result.Error(Error()) Error throwing / Promise rejection is a mechanism that should only be used to stop the execution of a program. When a computation represents an expected failure (ex: parsing, data fetching), Result should be used.
Promise Task.Async Task.Async is like a Promise but lazily evaluated. It has numerous advantages (composable, etc). See Article
Date.now Time.now Date.now is impure, use Time.now that is a Task.Sync.
N/A Time, Duration Tagged types that makes the unit of time explicit (milliseconds). Some libraries could use seconds or minutes implicitly in their functions
console.debug Console.debug console.debug is impure, use Console.debug that is a Task.Sync.
Math.random, UUID Task.Sync More impure function, wrap them in a Task.Sync()
N/A Int A tagged type that narrows number to only the integral values

License

MIT © Julien Polo julien.polo@koober.com