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

@dikolab/common

v0.1.0

Published

Common utility helpers for type checking, object manipulation, JSON path, and more

Readme

Common

npm version license

Common utility helpers for type checking, object manipulation, JSON path operations, and more.

Migrated from libcore with full TypeScript support.

Platform Support

Platform agnostic. Runs in Node.js and browsers. Ships four output formats:

| Format | File | Use case | |--------|------|----------| | CJS | lib/index.cjs | Node.js require() | | ESM | lib/index.mjs | Bundlers, Node.js import | | UMD | lib/index.umd.js | Browsers, <script> tags | | TypeScript | src/index.ts | Deno |

Installation

npm install @dikolab/common

Usage

Type checking

import {
   isString,
   isNumber,
   isObject,
   isArray,
   isRegex,
   isMethod,
} from '@dikolab/common';

isString('hello');   // true
isNumber(42);        // true
isObject({});        // true
isArray([1, 2, 3]);  // true
isRegex(/abc/);      // true
isMethod(() => {});  // true

Object utilities

import {
   contains,
   assign,
   clone,
   each,
   compare,
} from '@dikolab/common';

const obj = { a: 1, b: 2 };

contains(obj, 'a');  // true

each(obj, (value, key) => {
   console.log(key, value);
});

const copy = clone(obj);
compare(obj, copy);  // true

const merged = assign({}, obj, { c: 3 });
// { a: 1, b: 2, c: 3 }

String utilities

import {
   encode64,
   decode64,
   camelize,
   uncamelize,
   trim,
} from '@dikolab/common';

encode64('Good Game!');
// 'R29vZCBHYW1lIQ=='

decode64('R29vZCBHYW1lIQ==');
// 'Good Game!'

camelize('my-component');
// 'myComponent'

uncamelize('myComponent');
// 'my-component'

JSON path

import {
   jsonFind,
   jsonSet,
   jsonExists,
   jsonClone,
} from '@dikolab/common';

const data = { users: [{ name: 'diko' }] };

jsonFind(data, 'users.0.name');
// 'diko'

jsonExists(data, 'users.0.name');
// true

jsonSet(data, 'users.0.age', 30);
// { users: [{ name: 'diko', age: 30 }] }

Array set operations

import {
   unionList,
   intersectList,
   differenceList,
} from '@dikolab/common';

unionList([1, 2], [2, 3]);
// [1, 2, 3]

intersectList([1, 2, 3], [2, 3, 4]);
// [2, 3]

differenceList([1, 2, 3], [2, 3, 4]);
// [1]

Environment detection

import { browser, nodejs } from '@dikolab/common';

if (browser) {
   console.log('Running in a browser');
}

if (nodejs) {
   console.log('Running in Node.js');
}

API

Type checking

| Function | Description | |----------|-------------| | isString(value) | Check if value is a string | | isNumber(value) | Check if value is a finite number | | isObject(value) | Check if value is a plain object | | isArray(value) | Check if value is an array | | isMethod(value) | Check if value is a function | | isRegex(value) | Check if value is a RegExp | | isDate(value) | Check if value is a Date | | isScalar(value) | Check if value is a scalar | | isThenable(value) | Check if value is a thenable | | isIterable(value) | Check if value is iterable | | isNativeObject(value) | Check if value is a native object | | signature(value) | Get the type signature string | | type(value) | Get the type name |

Object utilities

| Function | Description | |----------|-------------| | each(obj, callback) | Iterate own properties | | assign(target, ...sources) | Merge properties | | contains(obj, key) | Check own property | | clone(value) | Deep clone | | compare(a, b) | Deep equality check | | fillin(target, ...sources) | Fill missing properties | | clear(obj) | Delete all own properties | | rehash(obj, callback) | Remap properties | | instantiate(Class, args) | Create instance with args |

String utilities

| Function | Description | |----------|-------------| | camelize(str) | Convert to camelCase | | uncamelize(str) | Convert from camelCase | | encode64(str) | Base64 encode | | decode64(str) | Base64 decode | | utf2bin(str) | UTF-8 to binary | | bin2utf(str) | Binary to UTF-8 | | trim(str) | Trim whitespace |

JSON path

| Function | Description | |----------|-------------| | jsonFind(data, path) | Get value at path | | jsonSet(data, path, value) | Set value at path | | jsonExists(data, path) | Check path exists | | jsonClone(data) | Deep clone via JSON path | | jsonEach(data, path, cb) | Iterate at path | | jsonCompare(a, b) | Compare via JSON path | | jsonUnset(data, path) | Remove value at path | | jsonFill(data, path, value) | Fill if missing | | jsonParsePath(path) | Parse path string |

Release Notes

License

ISC