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

@jcoreio/utils

v0.0.0-development

Published

lodash/es-toolkit-style functions redesigned to support Iterables, Maps, and type-safe functional programming

Readme

@jcoreio/utils

lodash/es-toolkit style functions redesigned to support Iterables, Maps, and type-safe functional programming

CircleCI Coverage Status semantic-release npm version

Overview

@jcoreio/utils provides many familiar functions like mapValues, groupBy, filter, etc, but with a variety of important differences from lodash to be more flexible and convenient:

Functions that accept arrays like filter also accept Iterables

import { filter } from '@jcoreio/utils/filter'
console.log(filter(new Set([1, 2, 3]), (x) => x > 1)) // [2, 3]

Functions that accept objects like mapValues also accept Maps and Iterables of key/value pairs

import { mapValues } from '@jcoreio/utils/mapValues'
console.log(
  mapValues(
    new Map([
      ['a', 1],
      ['b', 2],
    ]),
    (x) => x * 2
  )
) // Map(2) { 'a' => 2, 'b' => 4 }
console.log(
  mapValues(
    [
      ['a', 1],
      ['b', 2],
    ],
    (x) => x * 2
  )
) // [['a', 2], ['b', 4]]

Stronger type safety guarantees

lodash and es-toolkit type defs are unsound when iterating over object values:

import { mapValues } from 'lodash'

function unsound(x: { a: number }) {
  return mapValues(x, (value) => value.toFixed()) // 💥 crashes on `b: true`
}

const x = { a: 1, b: true }
unsound(x) // 💥 no TS errors, but crashes

@jcoreio/utils ensures soundness by default:

import { mapValues } from '@jcoreio/utils/mapValues'

function sound(x: { a: number }) {
  return mapValues(x, (value) => value.toFixed()) // ✘ 'value' is of type 'unknown'. ts(18046)
}

function sound2(x: { [K in string]?: number }) {
  // ️in this case, we know 'value' is 'number | undefined' since all string keys have that type
  return mapValues(x, (value) => value?.toFixed())
}

But you can use <function>.unsafe to opt into the unsound behavior if you prefer the convenience:

import { mapValues } from '@jcoreio/utils/mapValues'

function unsound(x: { a: number }) {
  return mapValues.unsafe(x, (value) => value.toFixed()) // no TS error
}

Functions can be called in either normal or functional programming style

For example, you can call mapValues in one of two ways:

// normal style:
mapValues(map, (x) => x * 2)

// functional programming style:
mapValues((x) => x * 2)(map)

Functional programming style is mainly intended for ease of use with function pipelines:

import { mapValues } from '@jcoreio/utils/mapValues'
import { pipe } from '@jcoreio/utils/pipe'

pipe(
  map,
  mapValues((x) => x * 2),
  ...
)

The overload definitions ensure that type information is fully preserved from function to function in pipelines.

Here's a real-world example of the convenience of function pipelines for merging chunks of timeseries data by tag:

import { pipe } from '@jcoreio/utils/pipe'
import { flatMap } from '@jcoreio/utils/flatMap'
import { entries } from '@jcoreio/utils/entries'
import { groupEntries } from '@jcoreio/utils/groupEntries'
import { definedValues } from '@jcoreio/utils/definedValues'
import { mapValues } from '@jcoreio/utils/mapValues'

type TagData = { t: number[]; v: number[]; min?: number[]; max?: number[] }
type Chunk<Tags extends PropertyKey = string> = { [Tag in Tags]?: TagData }

const chunks: Chunk<'foo' | 'bar'>[] = [
  { foo: { t: [1, 2, 3], v: [4, 5, 6] }, bar: { t: [1], v: [4] } },
  { foo: { t: [4, 5, 6], v: [7, 8, 9], min: [3, 4, 5] } },
]

const merged = pipe(
  chunks,
  flatMap(entries),
  // --> ['foo' | 'bar', TagData | undefined][]
  definedValues,
  // --> ['foo' | 'bar', TagData][]
  groupEntries,
  // --> Map<'foo' | 'bar', TagData[]>
  mapValues((datas) => ({
    t: datas.flatMap((d) => d.t),
    v: datas.flatMap((d) => d.v),
  }))
  // --> Map<'foo' | 'bar', { t: number[], v: number[] }>
)

Compare the above the above to the equivalent procedural code:

const merged = new Map<'foo' | 'bar', { t: number[]; v: number[] }>()
for (const chunk of chunks) {
  for (const [tag, data] of Object.entries(chunk) as [
    'foo' | 'bar',
    TagData | undefined,
  ][]) {
    if (!data) continue
    let group = merged.get(tag)
    if (!group) merged.set(tag, (group = { t: [], v: [] }))
    for (const t of data.t) group.t.push(t)
    for (const v of data.v) group.v.push(v)
  }
}