Home
Docs
GitHub
Pricing
Blog
Log In

Run Sandworm Audit for your App

Get started
Hold on, we're currently generating a fresh version of this report
Generated on May 6, 2024 via pnpm

map-obj 5.0.2

Map object keys and values into a new object
Package summary
Share
0
issues
1
license
1
MIT
Package created
12 Oct 2014
Version published
21 Jun 2022
Maintainers
1
Total deps
1
Direct deps
0
License
MIT

Issues

0
This package has no issues

Licenses

MIT License

Permissive
OSI Approved
This is a human-readable summary of (and not a substitute for) the license. Disclaimer.
Can
commercial-use
modify
distribute
sublicense
private-use
Cannot
hold-liable
Must
include-copyright
include-license
1 Packages, Including:
map-obj@5.0.2
Disclaimer

This deed highlights only some of the key features and terms of the actual license. It is not a license and has no legal value. You should carefully review all of the terms and conditions of the actual license before using the licensed material.

Sandworm is not a law firm and does not provide legal services. Distributing, displaying, or linking to this deed or the license that it summarizes does not create a lawyer-client or any other relationship.

Direct Dependencies

0
All Dependencies CSV
β“˜ This is a list of map-obj 's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.
NameVersionSizeLicenseTypeVulnerabilities

Visualizations

Frequently Asked Questions

What does map-obj do?

"map-obj" is a versatile JavaScript package that allows developers to map object keys and values into a new object. It is particularly useful in situations where manipulation or transformation of object properties is needed, with the added benefit of functionalities such as recursing nested objects and excluding certain keys from the new object.

How do you use map-obj?

To utilize "map-obj", firstly, we would need to install it using npm command: npm install map-obj.

Once installed, it can be imported and used in your JavaScript file with following coding pattern:

import mapObject, {mapObjectSkip} from 'map-obj';

const newObject = mapObject({foo: 'bar'}, (key, value) => [value, key]);
// This will output: {bar: 'foo'}

In this example, foo is the key and bar is the value of the source object. The function (key, value) => [value, key] swaps the key-value pairs around, producing a new object {bar: 'foo'}.

It can also be used with options such as deep mapping for nested object:

const newObject = mapObject({FOO: true, bAr: {bAz: true}}, (key, value) => [key.toLowerCase(), value], {deep: true});
// This will output: {foo: true, bar: {baz: true}}

In cases where you want to exclude certain keys from the new object, mapObjectSkip can be utilized:

const newObject = mapObject({one: 1, two: 2}, (key, value) => value === 1 ? [key, value] : mapObjectSkip);
// This will output: {one: 1}

Where are the map-obj docs?

The extensive documentation for the "map-obj" JavaScript package can be located on the GitHub repo: map-obj repository on GitHub. The GitHub repository holds information about API usage, available functionality, detailed description for every parameter and option along with usage examples.

The readme file from GitHub, which is presented at the start of the question, gives comprehensive usage guidance and provides examples of using key features such as "deep" transformation and exclusion with the mapObjectSkip return value. These examples should provide a handy reference for beginners and experts alike.