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

@kokimin/utils

v0.0.11

Published

### Import

Downloads

1,122

Readme

Usage

Import

import _utils from '@kokimin/utils'

// or
import { uniq, orderBy, dateFormat } from '@kokimin/utils'

Examples

Array

import { uniq, union, head, last } from '@kokimin/utils'

uniq([1, 2, 2, 3])        // [1, 2, 3]
union([1, 2], [2, 3])     // [1, 2, 3]
head([10, 20, 30])        // 10
last([10, 20, 30])        // 30

Collection

import { sortBy, orderBy } from '@kokimin/utils'

orderBy(
  [
    { name: 'Tom', age: 30 },
    { name: 'Jane', age: 20 }
  ],
  ['age'],
  ['asc']
)

Date (Dayjs-based)

import { dateFormat, searchDefaultDate } from '@kokimin/utils'

dateFormat(new Date(), 'YYYY-MM-DD')

searchDefaultDate('thisMonth')
// ['2025-12-01', '2025-12-31']

Formatter

import { currencyFormatter, phoneFormatter } from '@kokimin/utils'

currencyFormatter(1234567)      // "1,234,567"
phoneFormatter('01012341234')   // "010-1234-1234"

Object

import { omit, has, merge } from '@kokimin/utils'

omit({ a: 1, b: 2 }, 'b')        // { a: 1 }
has({ a: { b: 1 } }, 'a.b')      // true
merge({ a: 1 }, { b: 2 })        // { a: 1, b: 2 }

String

import { padStart, trim } from '@kokimin/utils'

padStart('5', 3, '0')            // "005"
trim('  hello  ')                // "hello"

Number

import { random, numberArrayMax } from '@kokimin/utils'

random(1, 10)
numberArrayMax([3, 9, 5])        // 9

Clone & Validation

import { cloneDeep, isEmpty } from '@kokimin/utils'

cloneDeep({ a: 1 })
isEmpty({})                      // true

UI Alerts (SweetAlert2)

import { alert, confirm, toastSuccess } from '@kokimin/utils'

await alert('Notice', 'Saved successfully')

const ok = await confirm('Confirm', 'Delete this item?')

toastSuccess('Success', 'Completed')

API

Array

  • concat(array, ...values)
  • uniq(array)
  • union(...arrays)
  • intersection(...arrays)
  • head(array)
  • last(array)
  • flattenDeep(array)
  • flattenDeepAll(array, key?, child?)

Collection

  • sortBy(collection, iteratees)
  • orderBy(collection, iteratees, orders?)

Common

  • generateUuid(v?: 'v1' | 'v4')
  • generateRandomNumber(min?, max?)
  • trimStringByByte(str, byteLength)
  • getByteLength(str)

Date

  • dateFormat(date, format?)
  • quarter(date)
  • calculateDay(options?)
  • searchDefaultDate(type?)

Formatter

  • currencyFormatter(value, precision?)
  • phoneFormatter(phone?)

Object

  • assign(object, ...sources)
  • merge(object, ...sources)
  • has(object, path)
  • omit(object, paths)
  • objectEmptyRemove(object)

String

  • padStart(string, targetLength, padString?)
  • replace(string, pattern, replacement)
  • trim(string, chars?)

Number

  • random(lower?, upper?, floating?)
  • numberArrayMax(arr)

Alert

  • alert(title, content)
  • confirm(title, content)
  • toastSuccess(title, content?)
  • toastError(title, content?)
  • close()

Default Export

All utilities are also available via default export:

import _utils from '@kokimin/utils';

_utils.dateFormat(new Date())
_utils.toastSuccess('Done')

TypeScript Support

  • Built-in .d.ts
  • Generic-friendly APIs
  • No additional configuration required

License

MIT © kokimin