Skip to content

0.10.0

Latest
Compare
Choose a tag to compare
@realpha realpha released this 02 Apr 11:10
· 1 commit to main since this release
25e071b

Features

  • New names for pass-through conditionals. .trip() and .rise() have been renamed to .andEnsure() and .orEnsure() respectively. This change is consistent with the general naming convention and semantically clearer. Here an example taken from the build script:
function main() {
  return parseVersion()
    .into(Task.of<SemVer, TypeError>)
    .andEnsure(() => dirIsEmpty(OUT_DIR))
    .andThen(buildPackage);
}
  • Consolidated exceptions. Introduction of Panic<E>, a canonical runtime exception which can be used in case an invariant is violated. This is accompanied by the panic helper function, a small utility to ease working with truely unrecoverable errors and a way to emulate the behaviour of .unwrap() from other languages/ecosystems.
import { panic, Option, Result } from "https://deno.land/x/eitherway/mod.ts";

function parseHex(hex: string): Result<number, TypeError> {
  return Option.fromCoercible(hex)
    .map((hex) => Number.parseInt(hex, 16))
    .filter(Number.isInteger)
    .okOrElse(() => TypeError("Cannot parse hex string", { cause: hex }));
}

const res = Result("0x10f2c").andThen(parseHex);

const value: number = res.unwrapOrElse(panic);

Deprecations

Support for cjs modules will be dropped. Please see this issue for all planned deprecations.
The following features have been marked as deprecated and will be removed in 1.0.0:


Fixes

Updated deno version in CI after the upstream swc bug has been resolved.


Changes

  • feat(core): panic and error helpers by @realpha in #34
  • feat(lib): conditional passthrough renaming by @realpha in #36
  • chore(tools): updated deno version by @realpha in #37
  • feat(async): deprecate task operators by @realpha in #38

Full Changelog: 0.9.2...0.10.0