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

@guanghechen/std

v2.0.2

Published

Standard utilities codes and types.

Readme

Standard utility functions for type checking, iterable operations, and common helper functions.

Install

  • npm

    npm install --save @guanghechen/std
  • yarn

    yarn add @guanghechen/std

Usage

Type Checking Functions

import {
  isArray,
  isString,
  isNumber,
  isObject,
  isFunction,
  isPromise,
  isPlainObject,
  isNonBlankString,
  isNotEmptyArray,
} from '@guanghechen/std'

isArray([1, 2, 3])      // true
isString('hello')       // true
isNumber(42)            // true
isObject({})            // true
isFunction(() => {})    // true
isPromise(Promise.resolve()) // true

isPlainObject({})       // true
isPlainObject(new Date()) // false

isNonBlankString('')    // false
isNonBlankString('hi')  // true

isNotEmptyArray([])     // false
isNotEmptyArray([1])    // true

Complete Type Check List

| Function | Description | | :-----------------------: | :-------------------------------------------------------: | | isArray | Check if the given data is an Array type | | isBigint | Check if the given data is a bigint type | | isBoolean | Check if the given data is a boolean / Boolean type | | isDate | Check if the given data is a Date type | | isFunction | Check if the given data is a Function type | | isAsyncFunction | Check if the given data is an AsyncFunction type | | isInteger | Check if the given data is an Integer type | | isNumber | Check if the given data is a number / Number type | | isObject | Check if the given data is an Object type | | isString | Check if the given data is a string / String type | | isSymbol | Check if the given data is a symbol type | | isUndefined | Check if the given data is undefined | | isPrimitiveBoolean | Check if the given data is a primitive boolean | | isPrimitiveInteger | Check if the given data is a primitive integer | | isPrimitiveNumber | Check if the given data is a primitive number | | isPrimitiveString | Check if the given data is a primitive string | | isNonBlankString | Check if the given data is a non-blank string | | isNotEmptyArray | Check if the given data is a non-empty array | | isNotEmptyObject | Check if the given data is a non-empty object | | isEmptyObject | Check if the given data is an empty object | | isNumberLike | Check if the given data is a number or number-like string | | isPlainObject | Check if the given data is a plain object | | isPromise | Check if the given data is a Promise | | isArrayOfT | Check if array elements match a type guard | | isTwoDimensionArrayOfT | Check if 2D array elements match a type guard |

Helper Functions

import { delay, noop, identity, truthy, falsy } from '@guanghechen/std'

// Delay execution
await delay(1000) // Wait 1 second

// No-operation function
const callback = noop // () => {}

// Identity function (returns input unchanged)
identity(42) // 42

// Always return true/false
truthy() // true
falsy()  // false

Iterable Utilities

import { filterIterable, mapIterable, iterable2map } from '@guanghechen/std'

const set = new Set([1, 2, 3, 4, 5])

// Filter iterable
const evens = filterIterable(set, x => x % 2 === 0) // [2, 4]

// Map iterable
const doubled = mapIterable(set, x => x * 2) // [2, 4, 6, 8, 10]

// Convert iterable to Map
const arr = ['foo', 'bar', 'baz']
const map = iterable2map(arr, (el, i) => `${el}-${i}`)
// Map { 'foo-0' => 'foo', 'bar-1' => 'bar', 'baz-2' => 'baz' }

Global Root Reference

import { root } from '@guanghechen/std'

// Cross-environment global reference (globalThis, global, self, or window)
root.setTimeout(() => {}, 100)

Reference