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

@isthmus/optics

v1.0.0-rc2

Published

A small set of optics

Downloads

12

Readme

@isthmus/optics

This is a small set of optics for modifying objects in an immutable fashion.

Installation

You can install _@isthmus/optics with:

npm install --save @isthmus/optics

Then to use in your JavaScript:

import { set, view, over } from '@isthmus/atom'

// and then use...

There is a umd version available under @isthmus/optics/dist/optics.js:

<script src="https//unpkg.com/@isthmus/optics/dist/optics.js"></script>
<script>
  const { set, view, over } = isthmusOptics
  // ...
</script>

API

Note that all functions without optional arguments are curried with crry.

set

set(lens, value, target) -> result

set is a function which takes a lens (string, number, or array), value, and object or array. It makes the adjustment and returns the result.
The original target is not modified.

const obj = { a: 'foo', b: [1, 2, 3] }
const arr = [1, 2, 3]

set('a', 'bar', obj) // { a: 'bar', b: [1, 2, 3] }
set(1, 7, arr) // [1, 7, 3]
set(['b', 1], 11, obj) // { a: 'foo', b: [1, 11, 3] }

view

view(lens, target) -> result

view is a function which takes a lens and target. It returns the result if it is found, or undefined otherwise.

const obj = { a: 'foo', b: [1, 2, 3] }

view('a', obj) // 'foo'
view(['b', 1], obj) // 2
view(['c', 7, 'd'], obj) // undefined

over

over(lens, transform, target) -> result

over is a function which takes a lens, transform function, and object. It adjusts the target based on the given transform, and returns the result.
The original target is not modified.

const obj = { a: 'foo', b: [1, 2, 3] }

over(['b', 1], x => x * x, obj) // { a: 'foo', b: [1, 4, 3] }