Precise Data Type Detection
Replaces typeof to solve inaccurate type checking issues (e.g., typeof null === 'object'), returns lowercase precise type string
The working developer's field notes
A focused library of JavaScript and TypeScript patterns for the details you solve repeatedly—arrays, browser APIs, async flows, validation, and performance.
function debounce(fn, delay) {
let timer;
return (...args) => {
clearTimeout(timer);
timer = setTimeout(
() => fn(...args), delay
);
};
}
Wait until a burst of input settles before running expensive work.
Start here
Selected for broad usefulness, readable implementations, and the kinds of edge cases that show up in production.
Delays function execution until after specified idle time, ideal for search input, autocomplete, and form validation
Open field note →Simplifies async/await error handling without try/catch blocks, returns [error, result] tuple
Open field note →Caches function results based on arguments to avoid redundant computations
Open field note →Reference library
Replaces typeof to solve inaccurate type checking issues (e.g., typeof null === 'object'), returns lowercase precise type string
Solves reference type shallow copy issues, supports deep cloning of primitive types, objects, arrays, dates, and regular expressions to avoid affecting original data when modifying copies
Supports deduplication of not only primitive types but also complex types like objects and arrays, using JSON.stringify to generate unique identifiers
Lightweight and type-safe alternative to lodash.groupBy, groups array elements by specified rules and returns structured grouping object
Prevents index out-of-bounds errors when accessing array elements, returns default value for invalid indices
Flattens nested arrays with configurable depth, perfect for processing multi-level nested data structures
Creates a new object with only specified properties, ideal for removing unnecessary fields from API requests
Creates a new object excluding specified properties, useful for removing sensitive or unnecessary fields
Limits function execution frequency to specified interval, perfect for scroll/resize events and button clicks
Delays function execution until after specified idle time, ideal for search input, autocomplete, and form validation
Simplifies async/await error handling without try/catch blocks, returns [error, result] tuple
Enhanced localStorage with automatic expiry, supports TTL (Time-To-Live) for stored items
Generates cryptographically secure random IDs with configurable length, ideal for unique identifiers
Converts Date object to customizable string format without external libraries like moment.js
Robust email validation using RFC 5322 compliant regular expression
Validates URL format including http/https protocols, domain, and path
Converts kebab-case, snake_case, or space-separated strings to camelCase
Converts camelCase, snake_case, or space-separated strings to kebab-case
Calculates accurate age from birthdate considering month and day
Smoothly scrolls to a DOM element with configurable offset and behavior
Detects mobile devices (phones/tablets) using user agent string
Cross-browser implementation to copy text to clipboard with promise-based API
Generates array of numbers in specified range (like Python's range function)
Detects if a DOM element is visible in the viewport (fully or partially)
Fair and unbiased array shuffling using the Fisher-Yates (Knuth) shuffle algorithm
Combines debounce with requestAnimationFrame for high-performance scroll event handling
Formats numbers as currency strings with locale support (no external libraries)
Prevents excessive API calls by throttling requests to specified rate limit
TypeScript type guard to filter out null/undefined values from arrays
Caches function results based on arguments to avoid redundant computations