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 🙏

© 2026 – Pkg Stats / Ryan Hefner

js-utils-lib-core

v1.1.1

Published

Well-known, battle-tested JavaScript utility functions

Readme

js-utils-lib-core

npm version License: MIT

A minimal, dependency-free JavaScript utility library. Provides commonly used helpers for arrays, objects, strings, functions, types, and numbers—inspired by lodash-style APIs with a small surface area and tree-shakeable subpath exports.


Table of Contents


Features

  • Zero dependencies — No runtime or peer dependencies.
  • Subpath exports — Import only what you need (e.g. js-utils-lib-core/array).
  • Consistent API — Predictable naming and signatures across all modules.
  • Node & bundlers — Works in Node.js and with ESM/CJS bundlers.

Requirements

  • Node.js 14+ (or any runtime with ES2020 support)

Installation

npm install js-utils-lib-core

Quick Start

CommonJS

const {
  debounce,
  chunk,
  uniq,
  pick,
  omit,
  get,
  camelCase,
  isEmpty,
  clamp,
  memoize,
} = require('js-utils-lib-core');

// Event handling
window.addEventListener('resize', debounce(() => console.log('resized'), 200));

// Arrays
chunk([1, 2, 3, 4, 5], 2);        // [[1, 2], [3, 4], [5]]
uniq([1, 2, 1, 3, 2]);            // [1, 2, 3]
compact([0, 1, null, 2, '', 3]);  // [1, 2, 3]

// Objects
pick({ a: 1, b: 2, c: 3 }, ['a', 'c']);  // { a: 1, c: 3 }
omit({ a: 1, b: 2, c: 3 }, ['b']);       // { a: 1, c: 3 }
get({ a: { b: { c: 42 } } }, 'a.b.c');   // 42

// Strings
camelCase('hello world');   // 'helloWorld'
kebabCase('helloWorld');    // 'hello-world'
truncate('Long text...', 8); // 'Long...'

// Types & numbers
isEmpty([]);           // true
isObject({});          // true
clamp(15, 0, 10);      // 10
random(1, 10);         // integer in [1, 10)

ES Modules

import { debounce, chunk, pick, camelCase, isEmpty } from 'js-utils-lib-core';
// or by category
import { chunk, uniq } from 'js-utils-lib-core/array';
import { pick, omit } from 'js-utils-lib-core/object';

Subpath Imports

Import by category for smaller bundles and clearer dependencies:

const { chunk, uniq, groupBy } = require('js-utils-lib-core/array');
const { pick, omit, deepClone } = require('js-utils-lib-core/object');
const { debounce, throttle, memoize } = require('js-utils-lib-core/function');
const { isArray, isEmpty, isPlainObject } = require('js-utils-lib-core/type');
const { camelCase, truncate, kebabCase } = require('js-utils-lib-core/string');
const { clamp, random, sum, mean } = require('js-utils-lib-core/number');

API Reference

Type — js-utils-lib-core/type

| Function | Description | |----------------|--------------------------------------------| | isArray | Returns true if value is an array. | | isObject | Plain object (excludes null and arrays). | | isFunction | Returns true if value is a function. | | isString | Returns true if value is a string. | | isNumber | Finite number (excludes NaN). | | isBoolean | Returns true for true or false. | | isNull | Returns true for null. | | isUndefined | Returns true for undefined. | | isNil | Returns true for null or undefined. | | isPlainObject| Object with default prototype. | | isEmpty | Empty array, string, or object. |

Array — js-utils-lib-core/array

| Function | Description | |----------------|----------------------------------------------| | chunk | Split array into chunks of given size. | | compact | Remove falsy values. | | uniq | Unique values (order preserved). | | uniqBy | Unique by iteratee (key or function). | | flatten | Flatten one level. | | flattenDeep | Flatten recursively. | | difference | Elements in first array not in second. | | intersection | Elements in both arrays. | | groupBy | Group by key or iteratee. | | keyBy | Index by key or iteratee. | | sortBy | Sort by key(s) or iteratee(s). | | take / drop| First N elements / skip first N. | | first / last | First or last element. | | sample | Random element. | | shuffle | Shuffle (returns new array). | | range | Integer range. | | without | Exclude given values. |

Object — js-utils-lib-core/object

| Function | Description | |-----------|----------------------------------------------| | pick | Subset of object by keys. | | omit | Object without given keys. | | get | Nested value by path (e.g. 'a.b.c'). | | set | Set nested value (returns new object). | | merge | Deep merge objects. | | deepClone | Recursive clone. | | invert | Swap keys and values (primitives only). | | defaults| Fill missing keys from source objects. | | has | Has property at path. | | keys / values / entries | Object keys, values, or entries. |

String — js-utils-lib-core/string

| Function | Description | |-----------|----------------------------------------------| | capitalize | First character uppercase. | | truncate | Truncate with optional suffix. | | camelCase / kebabCase / snakeCase | Case conversion. | | startCase | Title-style words. | | padStart / padEnd | Pad string to length. | | repeat | Repeat string. | | trim / trimStart / trimEnd | Trim whitespace. | | words | Split into words (regex). | | escape / unescape | HTML entity encode/decode. |

Function — js-utils-lib-core/function

| Function | Description | |-----------|----------------------------------------------| | debounce | Delay execution until calls stop. | | throttle | Limit execution rate. | | once | Execute only once. | | memoize | Cache results by arguments (optional resolver). | | noop | No-op function. | | identity| Return first argument. | | constant| Return a constant function. | | compose / pipe | Compose or pipe functions. | | bind / partial / partialRight | Partial application. | | delay | Invoke after timeout. | | negate | Negate predicate. |

Number — js-utils-lib-core/number

| Function | Description | |-----------|----------------------------------------------| | clamp | Clamp value to [lower, upper]. | | random | Random number or integer in range. | | round | Round to given precision. | | sum | Sum of array. | | min / max | Minimum or maximum of array. | | inRange | Whether value is in numeric range. | | mean | Average of array. |


License

MIT © js-utils-lib-core