npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

hofkit

v0.1.2

Published

hofkit is a modular functional utility library for JavaScript & TypeScript.

Readme

hofkit

hofkit (Higher Order Function toolKIT) is a modular functional utility library for JavaScript & TypeScript. This library collects frequently rewritten experimental functional wrappers for commonly used utility functions (either custom or from popular libraries such as lodash). These wrappers emphasised functional concepts (e.g., higher order functions, state purity, etc.) to provide functional benefits (e.g., less state, composition) whilst preserving compatibility with existing imperative approaches.

Through this flexiblity, the toolkit aims to be reusable across projects for a wide variety of uses ranging from array & object manipulation (e.g., filtering object entries) to concurrency-controlled Promises.

Additional benefits include builtin type support, environment-specific modules (i.e., featureGroups that group functions to separate dependencies), live-reloadable per-function test suites, and auto-generated live-reloadable documentation.

Features

|Feature|Details| |-|-| |Provide a library of functional utility functions|Includes 164 core functions & 14 node-environment functions (as of initial release), that cover a variety of uses ranging from array & object manipulation (e.g., filtering object entries) to concurrency-controlled Promises |Compatible with function & imperative approaches|Provides functional benefits (e.g., purity, composition) whilst remaining compatibility with imperative implementations| |Interoperable with JavaScript & TypeScript|-| |Builtin TypeScript support for all functions|All functions are written in TypeScript to generate bundled environment-specific declaration files| |Typed return values for functional composition|-| |Auto-generated live-reloadable documentation|Documentation is generated & live-reloadable for all featureGroup functions, which includes type signatures & any manual documentation| |Modular environment-specific functions|Environment-specific functions are grouped into individually importable featureGroup modules (e.g., core, node, etc.) to separate dependencies| |Environment-specific per-function unit test suites|All functions are easily testable via dedicated environment grouped live-reloadable test suites (totalling 180 test suites & 614 tests as of initial release) |Supports testing curried functions via command line|See test:cli in Scripts |Consistent code via JavaScript & TypeScript linting|Uses eslint-config-jsx to ensure consistent code

Usage

Install:

npm install hofkit

Using core functions in TypeScript:

import * as H from 'hofkit'; // Import all `core` functions.
// JavaScript: const H = require('hofkit');

import { titleCase } from H; // Named import.
// JavaScript: const { titleCase } = H;

titleCase('foo bar'); //=> 'Foo Bar'

// Typed return value: `toTitle: any => string`.
const toTitle = H.compose(
    titleCase,
    H.trim,
);
toTitle(' Foo-barBaz '); //=> 'Foo Bar Baz'

Using modular environment-specific functions (currently only node is supported), e.g., node functions:

import * as H from 'hofkit';
import * as HN from 'hofkit/dist/node'; // Import all `node` functions (requires Node environment).
import { readFile } from HN; // Named import.

// Using `async` IFFE for clarity but can be replaced by `H.promiseTryOr` to handle errors.
(async () => {
    // Writing to a file.
    await HN.writeFile('path/to/file')('foo');

    // Find existing paths.
    const filePaths = ['path1', 'path2', 'path3']; // Several file paths.
    const existingFilePaths = await H.promiseFilter(HN.pathExists);

    // Reading data for all existing files.
    let contents: string[] = [];
    const poolSize = 10;
    const onPoolComplete = (poolData: string) => [...contents, ...poolData]; // Flattens data from pools.
    const toFileContents = H.compose(
        H.promiseAll(poolSize, onPoolComplete), // Controlled concurrency.
        H.map(readFile)
    );
    toFileContents(existingFilePaths); //=> [['content1', ...], ...]

    // Overwriting all files.
    const writeFoo = (filePath: string) => HN.writeFile(filePath)('foo');
    const overwriteExistingFiles = H.compose(
        H.promiseAll(), // Uncontrolled concurrency;
        H.map(HN.writeFoo)
    );
    overwriteExistingFiles(filePaths);
})();

Documentation

Function documentation is available via the documentation website.

Screenshot of core documentation website:

Scripts

|Script|Info| |-|-| |test|Run all tests| |test:core|Run all core feature group tests| |test:node|Run all node feature group tests| |test <...test-names>|Run tests matching test-names| |test:watch|Run all tests in watch mode| |test:cli <functionName> <...argSets>|Runs a function matching functionName with argSets (see runFunctionFromCli.ts)| |test:data:reset|Resets the test data directory (i.e., _testDataDir/) & its contents| |docs:clean|Remove existing docs| |docs:build|Output documentation to docs/| |docs:build:serve|Output & serve docs| |docs:serve|Serve existing docs in watch mode| |docs:serve:open|Open served docs| |docs:watch|Output docs in watch mode| |docs:watch:serve|Output & serve docs in watch mode| |build:clean|Removes the generated dist/ directory| |build:featureGroupIndexes|Updates all feature group index.ts files (i.e., updates exported functions, see updateFeatureGroupIndexes.ts)| |build|Generates the production dist/ directory & its contents (minified bundles, bundled declarations, etc.)| |build:dev|Development alternative to build| |pack:clean|Removes generated tarball files| |pack|Runs pack:clean before re-generating a tarball file containing npm required (e.g., package.json) & generated files (i.e., _dist/| |pack:dry|Same as pack but prints tarball file contents without generating the tarball file| |deploy:pre|Runs all pre-deploy scripts (e.g., test, build, pack, etc.)| |deploy:major|Runs deploy:pre before publishing an incremented major version| |deploy:minor|Runs deploy:pre before publishing an incremented minor version| |deploy:patch|Runs deploy:pre before publishing an incremented patch version| |deploy|Runs deploy:pre before publishing the current version|

Future Plans

  • Complete remaining spec functions
  • Test async composition
  • Support web environments (e.g., browser, react, etc.)
  • Changelog