JSPM

type-aligned

1.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 9
  • Score
    100M100P100Q29063F
  • License MIT

library for abstract data types of type-aligned sequences

Package Exports

  • type-aligned
  • type-aligned/dist/main.js
  • type-aligned/dist/module.js

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 (type-aligned) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Type Aligned

GitHub Workflow Status GitHub license npm semantic-release: gitmoji Twitter

Various abstract data types of type-aligned sequences. A type-aligned sequence is a heterogeneous sequence where the types enforce the element order.

Pipeline

A pipeline is a left-to-right composition of functions.

import { tap, pipe, feed } from "type-aligned";

const length = (s: string) => s.length;
const even = (n: number) => n % 2 === 0;

const pipeline = pipe(length, pipe(even, tap()));
const morphism = feed(pipeline);

console.log(morphism("Hello World!")); // true
console.log(morphism("hello world")); // false

Composition

A composition is a right-to-left composition of functions.

import { id, compose, apply } from "type-aligned";

const length = (s: string) => s.length;
const even = (n: number) => n % 2 === 0;

const composition = compose(even, compose(length, id()));
const morphism = apply(composition);

console.log(morphism("Hello World!")); // true
console.log(morphism("hello world")); // false