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

kitchenette

v0.1.2

Published

A tasty library for transforming JSON objects.

Readme

kitchenette

kitchenette is a small, functional library for transforming JSON objects from one schema to another.

Installation

npm install kitchenette

Getting Started

The key tenet of kitchenette is transformation by function. Take a look:

// We want to transform this object:

const oldObject = {
  first_name: 'Anthony',
  last_name: 'Somos',
  address: {
    primary: '100 Main Street',
    unit: '#6',
  }
} 

// Into this object:

const newObject = {
  full_name: 'Anthony Somos',
  full_address: '100 Main Street, #6",
  job: 'developer',
}

Give kitchenette the recipe for this transformation. Here's how you would do it:

const {
  createRecipe,
  concat,
  hardCode,
} = require('kitchenette');

const myTransformer = createRecipe({
  full_name: concat('first_name', 'last_name'),
  full_address: concat('address.primary', 'address.unit'),
  job: hardCode('developer'),
});

const newObject = myTransformer(oldObject)

console.log(newObject) 

//outputs: { full_name: 'Anthony Somos', ... }

Two things to notice here:

  1. Your recipe has the same shape as your final object! This makes it easier to reason about your recipe. It also gives you the ability to completely separate your shape from your functions. The above example could also look like this:
// My values
const full_name = concat('first_name', 'last_name'),
const full_address = concat('address.primary', 'address.unit'),
const job = hardCode('developer'),

// My shape
const myTransformer = createRecipe({
  full_name,
  full_address,
  job,
});
  1. You can only create the values of your new object with a function. This functional flavour makes your code more testable, easier to understand, and encourages reusability. But don't worry, we give you an extensible API with some helpers so that creating your values and your own functions is easy as pie.

So go and get cooking!

API

createRecipe(recipe)

Creates your object transformer from a recipe.

Arguments:

recipe (object) The recipe which describes the object you are trying to create.

Returns:

transformer (function) A function which takes your source object as an argument and transforms into your final object.

hardCode(value)

Hard-codes a value for key being created.

Arguments:

value (string) A value to be hardcoded as the value for the key.

Example:

// In recipe:
name: hardCode('John Doe'), ...

// In final object:
name: 'John Doe', ...

directMap(path)

Takes the value found at the path and applies to the key in the new object.

Arguments:

path (string) The path to the value in the source object that you set as your value.

Example:

// In source object:
{ firstName: 'John', ... }

// In recipe:
{ name: directMap('firstName'), ... }

// In final object:
{ name: 'John Doe', ... }

concat(...paths)

Concatenates values into a string. Separates with a space.

Arguments:

paths (string) The paths to the values in the source object that you want to be concatenated.

Example:

// In source object:
{ firstName: 'John',
  otherNames: {
  lastName: 'Does', ... }

// In recipe:
{ name: concat('firstName', 'otherNames.lastName'), ... }

// In final object:
{ name: 'John Doe', ... }

custom(func, ...paths)

Takes a custom function and at transformation time, feeds it the values found at your specified paths as arguments. The output is set as the value.

Arguments:

func (function) Your custom function, that takes the values found at your paths as arguments, and outputs a value. You are responsible for dealing with corner cases such as undefined values.

paths (string) The paths to the values in the source object that you want to be concatenated.

Example:

// My function
const addFrosting = (aName) => `${aName} with some frosting on top`

// In source object:
{ firstName: 'John', ... }

// In recipe:
{ name: custom(addFrosting, 'firstName'), ... }

// In final object:
{ name: 'John with some frosting on top', ... }