Launch Week Day 2: Introducing Reports: An Extensible Reporting Framework for Socket Data.Learn More
Socket
Book a DemoSign in
Socket

@ki2/utils

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ki2/utils

latest
Source
npmnpm
Version
2.2.0
Version published
Weekly downloads
4
-33.33%
Maintainers
1
Weekly downloads
 
Created
Source

@ki2/utils

Write what you mean, not what the compiler needs. @ki2/utils wraps the idioms we use every day—checking existence, narrowing types, running async work in parallel—into tiny helpers that read like plain English while keeping TypeScript on your side.

Install

yarn add @ki2/utils
# or
npm install @ki2/utils

The package exposes ESM, CJS, and UMD bundles plus .d.ts files. Tree-shaking works out of the box with modern bundlers.

Essentials in 30 seconds

HelperWhy teams rely on it
exist(value)Expresses “does this exist?” and narrows away null | undefined without losing the underlying type.
isString(value), isNumber(value), isArray(value), …Self-explanatory guards that replace noisy typeof / Array.isArray chains and work seamlessly with TypeScript’s control-flow analysis.
runParallel(...promises), applyParallel(items, fn)Compose async operations declaratively, keep tuple types intact, and make intent unmistakable.
import { readFile } from "node:fs/promises";

import { exist, isString, runParallel, applyParallel } from "@ki2/utils";

async function greet(name: unknown) {
  if (!exist(name) || !isString(name)) return;

  const [shout, echo] = await runParallel(
    fetch(`https://api.example.com/hello/${encodeURIComponent(name)}`).then((res) => res.text()),
    fetch("https://api.example.com/motd").then((res) => res.text())
  );

  return `${echo}${shout.toUpperCase()}`;
}

// Fan out async work while keeping results in order
const files = await applyParallel(paths, (path) => readFile(path, "utf8"));

These helpers frontload intent—you see the business logic immediately—and they still unlock TypeScript’s strongest narrowing.

Need the full toolbox?

Browse the dedicated documentation:

  • Existence helpers
  • Type guards
  • Async helpers
  • Everything else (object tools, data helpers, validators, types, recipes)
  • Guidelines & contribution notes

Each page is short and focused so you, or an agent, can find the right helper quickly.

Compatibility & scripts

  • Runtime: Node.js ≥ 14.17 or any ES2018-compatible browser.
  • TypeScript: developed against TS 4.x; declarations remain consumable by TS 5 projects.
  • Dependencies: none at runtime—only the Node/DOM standard library.

Local commands:

yarn lint
yarn workspace @ki2/utils test --runInBand
yarn workspace @ki2/utils build

The repository uses Yarn 4 (PnP). For editor integration, run yarn sdks vscode (or the equivalent for your IDE).

Contributing

Pull requests are welcome. Keep them focused, run the commands above, and update docs whenever behaviour changes. The aim is simple, readable utilities that stay friendly to both humans and TypeScript.

FAQs

Package last updated on 08 Nov 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts