Skip to content

Getting Started

Installation

bash
npm install fundamentool

Entry points

fundamentool is split into focused entry points — import only what you need:

Entry pointContents
fundamentoolUniversal utilities (string, object, array, etc.)
fundamentool/asyncAsync iteration, parallel execution, sequencing
fundamentool/isType predicates (isString, isEqual, isMatch, …)
fundamentool/browserBrowser utilities (WebSocket, storage, routing)
fundamentool/nodeNode.js utilities (file I/O, hashing, directory scan)
fundamentool/rpcRPC core (RpcClient, RpcConnect, RpcClientPool)
fundamentool/rpc/browserBrowser worker RPC
fundamentool/rpc/nodeNode.js worker RPC
fundamentool/jsonlJSON Lines serialization
fundamentool/joinJoin utilities
fundamentool/splitSplit utilities

Basic usage

ts
import { isString, isEqual } from 'fundamentool/is';
import { mapAsync } from 'fundamentool/async';
import { NodeRpcClientWorker } from 'fundamentool/rpc/node';

isString('hello');       // true
isEqual({ a: 1 }, { a: 1 }); // true

const results = await mapAsync([1, 2, 3], async (n) => n * 2);
// [2, 4, 6]

RPC example

ts
// worker.ts
import { NodeRpcConnectWorker } from 'fundamentool/rpc/node';
NodeRpcConnectWorker.run({
  add: (a: number, b: number) => a + b,
});

// main.ts
import { NodeRpcClientWorker } from 'fundamentool/rpc/node';
const worker = new NodeRpcClientWorker('./worker.js');
const result = await worker.call('add', [3, 4]); // 7
worker.destroy();

MIT License