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

wrangler-object-mapper

v0.1.2

Published

An object mapper for Node.

Readme

Wrangler

A simple Javascript object mapper.

Why?

Sometimes you receive onjects that don't quite conform to your standards. Maybe it's naming conventions, or a lack of nested properties. Or maybe you need to transform the object's values in some way. Perhaps you need to parse JSON from an API into your own schema.

Wrangler helps you with this. By defining a map and passing an object, Wrangler whips your objects into shape.

Installation

Just install Wrangler from npm...

npm install wrangler-object-mapper --save

... and import. const Wrangler = require('wrangler-object-mapper')

Getting Started

Wrangler applies tranformations between a source object and a destination object. To create a transformation, define a map:

let map = [
    ['sourceProp', 'destProp']
]

A map is an array of pairs. The left side is the name of a key inside the source object. The right side is the desired name of the source key value will be mapped to in the destination object.

A function may also be passed to either side of the pair.

The left side function signature:

function(source) {}

Where source is the source object. To pass data from the source to the destination object, you must return a value.

The right side function signature:

function(dest, val) {}

Where dest is the destination object and val is the value returned from the source object. You must assign the value to the destination object yourself if using a function.

Example

// The source object
let obj = {
    aPropA: true,
    aPropB: false,
    aPropC: 'FALSE',
    nested: {
        prop: 22
    }
}

// Define a map
let map = [
    // Mapping from flat property name to nested.
    ['aPropA': 'aProp.A'],
    ['aPropB: 'aProp.B'],

    // Mapping from nested property to flat.
    ['nested.prop', 'unnestedNum']

    // Transforming a value and mapping to nested.
    [source => { return !(source.aPropC === 'FASLE')}, 'aProp.C']

    // Transforming value in destination
    ['nested.prop', (dest, val) => { dest['transformed'] == val * 2 }]
]

let result = Atlas.parse(obj, map);

Result:

{
    aProp: {
        A: true,
        B: false,
        C: false
    },
    unnestedNum: 22,
    transformed: 44
}