Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/sindresorhus/modify-values

Modify the values of an object
https://github.com/sindresorhus/modify-values

Last synced: about 1 month ago
JSON representation

Modify the values of an object

Awesome Lists containing this project

README

        

# modify-values

> Modify the values of an object

## Install

```
$ npm install modify-values
```

## Usage

```js
import modifyValues from 'modify-values';

modifyValues({foo: 'UNICORN'}, (value, key) => value.toLowerCase());
//=> {foo: 'unicorn'}
```

## API

### modifyValues(object, transformer)

Modifies the values and returns a new object.

#### object

Type: `object`

#### transformer(value, key)

Type: `Function`

Gets the value and key for each item and is expected to return the new value.

## Related

See [`modify-keys`](https://github.com/sindresorhus/modify-keys) for modifying the keys of an object.

---



Get professional support for this package with a Tidelift subscription




Tidelift helps make open source sustainable for maintainers while giving companies
assurances about security, maintenance, and licensing for their dependencies.