https://github.com/rads/map-vals
Apply a function to the values of an object.
https://github.com/rads/map-vals
Last synced: 5 months ago
JSON representation
Apply a function to the values of an object.
- Host: GitHub
- URL: https://github.com/rads/map-vals
- Owner: rads
- Created: 2013-06-25T05:56:49.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2013-06-25T06:04:15.000Z (over 12 years ago)
- Last Synced: 2025-02-07T17:11:17.948Z (11 months ago)
- Language: JavaScript
- Homepage:
- Size: 102 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# map-vals
Takes an `object` and a `fn` and returns a new object with the same keys, but
with `fn` applied to the values.
## Usage
var mapVals = require('map-vals');
function inc(val) {
return val + 1;
}
var numbers = {a: 1, b: 2, c: 3};
var newNumbers = mapVals(numbers, inc);
console.log(newNumbers); //=> {a: 2, b: 3, c: 4}