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

object-tune

v0.0.4

Published

ObjectTune is a lightweight TypeScript utility for dynamically transforming object properties based on custom rules.

Readme

ObjectTuner

ObjectTuner is a TypeScript utility class for manipulating objects in a functional way. It provides methods for replacing, filtering, mapping, merging, picking, omitting, and cloning object properties.

Installation

To install the package, use npm or yarn:

npm install object-tune
# or
yarn add object-tune

Usage

Creating an ObjectTuner

To create an ObjectTuner instance, use the ObjectTune function:

import { ObjectTune } from 'object-tune';

const obj = { a: 1, b: 2, c: 3 };
const tuner = ObjectTune(obj);

Methods

replace(predicate: (value: any) => boolean, replacement: any): ObjectTuner<T>

Replaces values in the object that match the predicate with the replacement value.

const updated = tuner.replace(value => value === 2, 42).value();
console.log(updated); // { a: 1, b: 42, c: 3 }

filter(predicate: (key: keyof T, value: T[keyof T]) => boolean): ObjectTuner<Partial<T>>

Filters the object properties based on the predicate.

const filtered = tuner.filter((key, value) => value > 1).value();
console.log(filtered); // { b: 2, c: 3 }

deepReplace(predicate: (value: any) => boolean, replacement: any): ObjectTuner<T>

Recursively replaces values in the object that match the predicate with the replacement value.

const deepObj = { a: 1, b: { c: 2, d: 3 } };
const deepTuner = ObjectTune(deepObj);
const deepUpdated = deepTuner.deepReplace(value => value === 2, 42).value();
console.log(deepUpdated); // { a: 1, b: { c: 42, d: 3 } }

map<U>(fn: (value: T[keyof T], key: keyof T) => U): ObjectTuner<Record<keyof T, U>>

Maps the object properties using the provided function.

const mapped = tuner.map(value => value * 2).value();
console.log(mapped); // { a: 2, b: 4, c: 6 }

merge<U extends Record<string, any>>(other: U): ObjectTuner<T & U>

Merges the object with another object.

const merged = tuner.merge({ d: 4 }).value();
console.log(merged); // { a: 1, b: 2, c: 3, d: 4 }

pick<K extends keyof T>(keys: K[]): ObjectTuner<Pick<T, K>>

Picks the specified keys from the object.

const picked = tuner.pick(['a', 'c']).value();
console.log(picked); // { a: 1, c: 3 }

omit<K extends keyof T>(keys: K[]): ObjectTuner<Omit<T, K>>

Omits the specified keys from the object.

const omitted = tuner.omit(['b']).value();
console.log(omitted); // { a: 1, c: 3 }

deepClone(): ObjectTuner<T>

Creates a deep clone of the object.

const cloned = tuner.deepClone().value();
console.log(cloned); // { a: 1, b: 2, c: 3 }

hasKey(key: keyof T): boolean

Checks if the object has the specified key.

const hasKey = tuner.hasKey('a');
console.log(hasKey); // true

get<K extends keyof T>(key: K, defaultValue?: T[K]): T[K]

Gets the value of the specified key, or returns the default value if the key does not exist.

const value = tuner.get('b', 0);
console.log(value); // 2

deleteProperties(keys: string[]): ObjectTuner

Deletes the specified properties from the object.

const cleaned = tuner.deleteProperties(['b']).value();
console.log(cleaned); // { a: 1, c: 3 }

value(): T

Returns the current value of the object.

const value = tuner.value();
console.log(value); // { a: 1, b: 2, c: 3 }

License

This project is licensed under the MIT License.