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

@kamataryo/extypes

v0.2.57

Published

Lightweight and safe JavaScript Data type extensions

Readme

@kamataryo/extypes

Build Status Build status Code Climate Codecov branch

npm (scoped) downloads

Dependency Status devDependency Status

License: MIT

Light and safe JavaScript Data type extensions.

features

  • collision free with Symbol property.
  • Partial import is Available. This saves file size when bundled

install

$ npm install @kamataryo/extypes --save-dev

usage


// import all
import props from '@kamataryo/extypes'
console.log([0, 1, 2][props.Array.$random]) // 0, 1, or 2

// partial import on a certain type
import props, { $random } from '@kamataryo/extypes/Array'
console.log([0, 1, 2][props.$random]) // 0, 1, or 2
console.log([0, 1, 2][$random]) // 0, 1, or 2

// partial import on a certain property/method
import $radom from '@kamataryo/extypes/Array/$random'
console.log([0, 1, 2][$random]) // 0, 1, or 2

APIs

Object

Object[$dig](props, fallback)

Dig nested properties.

{ a : { b : { c : 'd' } } }[$dig](['a', 'b', 'c']) // 'd'
{ a : { b : { c : 'd' } } }[$dig](['a', 'X'], 'no props') // 'no props'

Object[$keys]

Wrapper of Object.keys.

{ foo: 'FOO', bar: 'BAR' }[$keys] // ['foo', 'bar']

Object[$multiply]()

{ a: 'A' }[$multiply](3) // [{ a: 'A' }, { a: 'A' }, { a: 'A' }]

Object[$values]

Wrapper of Object.values.

{ foo: 'FOO', bar: 'BAR' }[$values] // ['FOO', 'BAR']

Object[$switch]

Wrapper of switz.

'abc'[$switch]
  .case('ABC', () => console.log('not match'))
  .case('abc', () => console.log('match!'))
  .default(() => console.log('not match'))
// 'match!'

Array

Array[$cummulatives]

get cummulative values of the array.

[1, 10, 100][$cummulative] // [1, 11, 111]

Array[$flatten]()

Flatten array.

[[0, 1], [2], 3][$flatten]() // [0, 1, 2, 3]

Array[$push](any)

Non-destructive altenative method for Array.push.

[0, 1, 2][$push](3) // [0, 1, 2, 3]

Array[$random]

Pick an element randomly.

[0, 1, 2][$random] // 0, 1, or 2

Array[$weightedRandom](array)

Pick an element randomly and weightedly.

[0, 1, 2][$weightedRandom]([1, 1, 2]) // 0(25%), 1(25%) or 2(50%)

Function

Function[$partialApply](...args)

Curry the function.

((a, b, c) => a + b + c)[$partialApply](1) // (b + c) => 1 + b + c

Function[$appliedArguments]

Applied argument after curried.

((a, b, c) => a + b + c)[$partialApply](1, 2)[$appliedArguments] // [1, 2]

Function[$repeat](args, num)

Call function repeatedly.

((a, b, c) => a + b + c)[$repeat]([1, 2, 3], 2) // [6, 6]

Number

Number[$toRange]()

Create range array.

100[$toRange]() // [0, 1, ... ,99]

Number[$zeroPadding](int, dec)

Create zero padding string.

123[$zeroPadding](5)         // '00123'
1.23[$zeroPadding](false, 3) // '1.230'
12.3[$zeroPadding](3, 3)     // '012.300'

initialize deploy secrets (for commiters)

Below initializes..

  • encrypted npm deploy token
  • encrypted GitHub deploy key

and send new private key to the concerned remote repository.

$ .bin/travis-setup.sh kamataryo/extypes

deployment (for commiters)

$ npm version patch -m "some patch"
$ npm version minor -m "some minor update"
$ npm version major -m "some major update"

TODOs

  • check performance
  • invalid arguments
  • How to deal with Lodash/Underscore?