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

@papillonbits/library

v1.13.1

Published

Papillon Bits Library

Readme

@papillonbits/library

Modular JavaScript utility library with helper functions for common programming tasks.

npm version

Overview

A comprehensive collection of utility functions organized by category, providing reusable solutions for array manipulation, date formatting, state management, and more.

Installation

npm install @papillonbits/library

Modules

a11y - Accessibility Utilities

Helper functions for improving web accessibility, ARIA attributes, and assistive technology support.

array - Array Manipulation

Functions for working with arrays including filtering, mapping, reducing, and transforming data structures.

auth - Authentication Utilities

Helper functions for authentication, authorization, token management, and user session handling.

boolean - Boolean Helpers

Utilities for boolean logic, type coercion, and conditional operations.

browser - Browser Detection & Utilities

Functions for browser detection, feature detection, user agent parsing, and browser-specific utilities.

date - Date Formatting & Manipulation

Date utilities for formatting, parsing, comparing, and manipulating dates and timestamps.

event - Event Handling Utilities

Helper functions for DOM event handling, event delegation, and custom event management.

hooks - Custom React Hooks

Reusable React hooks for common patterns like state management, side effects, and component lifecycle.

number - Number Formatting & Utilities

Functions for number formatting, parsing, validation, and mathematical operations.

object - Object Manipulation

Utilities for object creation, transformation, deep cloning, merging, and property access.

pagination - Pagination Logic

Functions for calculating page numbers, page ranges, and pagination state management.

sort - Sorting Utilities

Sorting algorithms and comparator functions for various data types and structures.

store - State Management Utilities

Helper functions for Redux store management, action creators, and state selectors.

string - String Manipulation

String utilities for formatting, parsing, validation, and transformation.

Usage

// Import specific modules
import { formatDate } from '@papillonbits/library/date';
import { sortByProperty } from '@papillonbits/library/sort';
import { debounce } from '@papillonbits/library/event';

// Use the utilities
const formattedDate = formatDate(new Date(), 'YYYY-MM-DD');
const sortedArray = sortByProperty(items, 'name');
const debouncedHandler = debounce(handleInput, 300);
// Import from main entry point
import { date, sort, event } from '@papillonbits/library';

const formattedDate = date.formatDate(new Date());
const sortedItems = sort.sortByProperty(items, 'name');

Features

  • Modular Design - Import only what you need for optimal bundle size
  • Pure Functions - Side-effect free, testable utilities
  • Well Typed - PropTypes and JSDoc for type safety
  • Tree Shakeable - Optimized for tree shaking
  • Well Tested - Comprehensive test coverage
  • Zero Dependencies - Lightweight with no external dependencies

Development

Building

# Build the package
npm run build

# Build for different environments
npm run build-test
npm run build-acceptance
npm run build-release

Scripts

  • clean-up - Remove build artifacts and dependencies
  • install-packages - Install dependencies
  • build - Transpile and build the package (ignores tests)

Build Process

The build process:

  1. Removes existing build/ directory
  2. Transpiles source with Babel
  3. Copies files preserving structure
  4. Ignores test files (**/__tests__)

File Structure

packages/library/
├── src/
│   ├── a11y/
│   ├── array/
│   ├── auth/
│   ├── boolean/
│   ├── browser/
│   ├── date/
│   ├── event/
│   ├── hooks/
│   ├── number/
│   ├── object/
│   ├── pagination/
│   ├── sort/
│   ├── store/
│   └── string/
└── build/ (generated)

Each module directory contains:

  • index.js - Module exports
  • *.js - Implementation files
  • __tests__/ - Test files (not included in build)

Testing

All utilities are tested with Jest:

# Run tests from root
npm run test

# Run tests in watch mode
npm run test:tdd

Use Cases

Date Formatting

import { formatDate, parseDate } from '@papillonbits/library/date';

const formatted = formatDate(new Date(), 'MM/DD/YYYY');
const parsed = parseDate('2024-01-15', 'YYYY-MM-DD');

Array Manipulation

import { groupBy, unique } from '@papillonbits/library/array';

const grouped = groupBy(users, 'role');
const uniqueIds = unique(items.map(item => item.id));

Event Handling

import { debounce, throttle } from '@papillonbits/library/event';

const handleSearch = debounce((query) => {
  // Search logic
}, 300);

const handleScroll = throttle(() => {
  // Scroll logic
}, 100);

React Hooks

import { useLocalStorage, useDebounce } from '@papillonbits/library/hooks';

function MyComponent() {
  const [value, setValue] = useLocalStorage('key', 'default');
  const debouncedValue = useDebounce(value, 500);
  
  return <div>{debouncedValue}</div>;
}

API Documentation

For detailed API documentation of each utility function, see the source files and tests in the repository.

Links

Related Packages

License

See root LICENSE file for details.