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

@ahriknow/utils

v0.1.0

Published

## Install

Readme

Utils for js/ts

Install

npm install --save @ahriknow/utils
# OR
yarn add @ahriknow/utils

Usage

Datetime

import { dateTime } from '@ahriknow/utils/datetime'

let dt = dateTime("2023-01-01 01:02:30.100")  // default args is new Date(), support Date, number, string

dt.format('yyyy-MM-dd hh:mm:ss.SSS')  // 2023-01-01 01:02:30.100

dt.year  // 2023
dt.month  // 1
dt.day  // 1
dt.hour  // 1
dt.minute  // 2
dt.second  // 30
dt.millisecond  // 100
dt.dayOfWeek  // 0

dt.year += 1  // 2024
dt.month = 2

dt.format('yyyy-MM-dd hh:mm:ss.SSS')  // 2024-02-01 01:02:30.100

regex

import regex from '@ahriknow/utils/regex'

regex.verify('abc', /abc/)  // true

regex.isMobile('13100000000')  // true
regex.mobile('1310000000')  // false
regex.isPhone('010-12345678')  // true
regex.phone('010-1234567x')  // false
regex.isEmail('[email protected]')  // true
regex.email('name@domain')  // false
regex.isIPV4('127.0.0.1')  // true
regex.ipv4('127.0.0.256')  // false
regex.isIPV6('2001:0db8:85a3:0000:0000:8a2e:0370:7334') // true
regex.ipv6('2001:0db8:85a3:0000:0000:8a2e:0370:7334:')  // false
regex.isDomain('domain.com')  // true
regex.domain('domain')  // false
regex.isURL('https://domain.com')  // true
regex.url('xxx')  // false
regex.isChinese('中文')  // true
regex.chinese('中文a')  // false
regex.hasChinese('中文a')  // true
regex.hasChinese('abc')  // false
regex.isNumber('123')  // true
regex.number('123a')  // false

Array

import { extend } from '@ahriknow/utils/array'

let data = [1, 2, 3, 4, 5]
extend(data)
data.max()  // 5
data.min()  // 1
data.sum()  // 15
data.avg()  // 3
data.median()  // 3
data.mode()  // 1

data = [1, 2, 3, 4, 5, 1, 2, 3, 4, 5]
data.distinct()  // [1, 2, 3, 4, 5]

// OR

import { init } from '@ahriknow/utils/array'

init()

let data = [1, 2, 3, 4, 5]
data.max()  // 5
data.min()  // 1
data.sum()  // 15
data.avg()  // 3
data.median()  // 3
data.mode()  // 1

data = [1, 2, 3, 4, 5, 1, 2, 3, 4, 5]
data.distinct()  // [1, 2, 3, 4, 5]

Build from source

git clone

npm install
# OR
yarn

npm run build
# OR
yarn build

Test

npm run test
# OR
yarn test

# coverage
#  PASS  src/__tests__/datetime.test.ts
#  PASS  src/__tests__/regex.test.ts
#  PASS  src/__tests__/array.test.ts
# -----------|---------|----------|---------|---------|-------------------
# File       | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s 
# -----------|---------|----------|---------|---------|-------------------
# All files  |     100 |      100 |     100 |     100 |                   
#  array     |     100 |      100 |     100 |     100 |                   
#   index.ts |     100 |      100 |     100 |     100 |                   
#  datetime  |     100 |      100 |     100 |     100 |                   
#   index.ts |     100 |      100 |     100 |     100 |                   
#  regex     |     100 |      100 |     100 |     100 |                   
#   index.ts |     100 |      100 |     100 |     100 |                   
# -----------|---------|----------|---------|---------|-------------------

# Test Suites: 3 passed, 3 total
# Tests:       7 passed, 7 total
# Snapshots:   0 total

License

MIT