daily-code

Most common codes

/_next/static/media/nodess.03ea6bzeal6m1.png

daily-code is a collection of type-safe utilities and helpers for Node.js, browser, React, and server code. It includes helpers for color conversion, random numbers, async waits, DOM work, environment variables, and more.

What it does

  • Base helpers for arrays (shuffle, chunk, partition), strings (capitalize, truncate, UUIDs), objects (pick, omit), numbers, and one-time passwords.
  • Browser helpers for creating elements, downloading files, managing cookies, finding an image's dominant color, and generating avatars, gradients, and placeholder images.
  • Node.js helpers for reading and writing Windows environment variables through PowerShell.
  • Server helpers for wrapping Express routes and routing Socket.IO events.
  • React helpers such as a context creator, extra effect hooks, Suspense helpers, and an error boundary.
  • TypeScript type helpers like Prettify and Nullify. Separate entry points let you import only what you need, and the package has no runtime dependencies.

Usage

npm install daily-code
// Base utilities (always available)
import { randomNumber, wait, hexToRGB } from 'daily-code'

// Browser-specific utilities
import { createElementFromString, findDominantColor } from 'daily-code/browser'

// React utilities
import { createContext, ErrorBoundary } from 'daily-code/react'