0.0.13 • Published 2 years ago

maasglobal-prelude-ts v0.0.13

Weekly downloads
27
License
MIT
Repository
github
Last release
2 years ago

MaaS Global Prelude for TypeScript Projects

The maasglobal-prelude-ts npm package is a bundle of essential imports for TypeScript projects.

Some convenience tools

import * as P from 'maasglobal-prelude-ts';

const x = 2;
const limit = 10;
const isOverLimit = P.ii(() => {
  if (x > limit) {
    return true;
  }
  return false;
});

Some basic tools from fp-ts

import * as P from 'maasglobal-prelude-ts';

const numbers = [1, 2, 3];
const doubled = P.pipe(
  numbers,
  P.Array_.map((x) => 2 * x),
);

const twoIsEven = P.do(P.Identity__)
  .bind('x', 2)
  .bindL('p', ({ x }) => (x % 2 ? 'odd' : 'even'))
  .return(({ x, p }) => `Number ${x} is ${p}.`);

Some basic codecs from io-ts

import * as P from 'maasglobal-prelude-ts';

const NumberArray = P.Array(P.number);
const onTheWire = JSON.stringify(NumberArray.encode([1, 2, 3]));
const atTheServer = NumberArray.decode(JSON.parse(onTheWire));
0.0.13

2 years ago

0.0.12

3 years ago

0.0.11

3 years ago

0.0.11-alpha1

3 years ago

0.0.10

3 years ago

0.0.10-alpha1

3 years ago

0.0.9

3 years ago

0.0.8

4 years ago

0.0.7

4 years ago

0.0.6

4 years ago

0.0.5

4 years ago

0.0.3

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago