@aicacia/core
TypeScript icon, indicating that this package has built-in type declarations

0.2.13 • Public • Published

ts-core

license docs npm (scoped) build

aicacia core utils

Options

import { Option, none } from "@aicacia/core";

const maybe = none<number>();

if (maybe.isNone()) {
  maybe.replace(1);
}

console.log(maybe.unwrap()); // 1

Result

import { Result, ok, err } from "@aicacia/core";

fetch("/api")
  .then((res) => ok(res))
  .catch((e) => err<Response>(e))
  .then((result) => {
    if (result.isOk()) {
      console.log(result.unwrap());
    } else {
      console.error(result.unwrapErr());
    }
  });

Iter

import { iter } from "@aicacia/core";

const evens = iter([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10])
  .map((x) => x * x)
  .filter((x) => x % 2 === 0);

for (const value of evens) {
  console.log(value);
}

Readme

Keywords

Package Sidebar

Install

npm i @aicacia/core

Weekly Downloads

2

Version

0.2.13

License

(MIT OR Apache-2.0)

Unpacked Size

165 kB

Total Files

102

Last publish

Collaborators

  • nathanfaucett