# map-utils

> map util functions, map, utils, pick, pluck, set, exists

Latest version **0.4.0** (published 2014-03-23) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install map-utils
pnpm add map-utils
yarn add map-utils
bun add map-utils
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 0.4.0 |
| Published | 2014-03-23 |
| First published | 2014-03-03 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | Tejesh Mehta |
| Maintainers | tjmehta |
| Keywords | map, util, functions, map, utils, pick, pluck, set, exists |

## Links

- npm: https://www.npmjs.com/package/map-utils
- Repository: https://github.com/tjmehta/map-utils
- Issues: https://github.com/tjmehta/map-utils/issues
- npm.io page: https://npm.io/package/map-utils

## Alternatives

- [lodash.assign](https://npm.io/package/lodash.assign.md) — 2.3M weekly downloads
- [lodash.chunk](https://npm.io/package/lodash.chunk.md) — 1.8M weekly downloads
- [react-native-ios-utilities](https://npm.io/package/react-native-ios-utilities.md) — 138.5K weekly downloads
- [@technically/lodash](https://npm.io/package/@technically/lodash.md) — 50.9K weekly downloads
- [@fluid-topics/ft-icon](https://npm.io/package/@fluid-topics/ft-icon.md) — 20.6K weekly downloads

## Recent versions

- 0.4.0 (latest) — 2014-03-23
- 0.3.0 — 2014-03-22
- 0.2.0 — 2014-03-12
- 0.1.2 — 2014-03-06
- 0.1.1 — 2014-03-03

## README

map-utils [![Build Status](https://travis-ci.org/tjmehta/map-utils.png)](https://travis-ci.org/tjmehta/map-utils)
========

### works with great with Array.map

## exists
### return true for any value other than ull or undefined
```js
var utils = require('map-utils');

utils.exists(null);      // false
utils.exists(undefined); // false
utils.exists('foo');     // true
```

## pick
### accepts keys and returns a function which accepts an object and return a new object with the keys specified
```js
var utils = require('map-utils');
var arr = [
  {
    foo: 1,
    bar: 1,
    qux: 1
  },
  {
    foo: 2,
    bar: 2,
    qux: 2
  }
];

arr.map(utils.pick('foo', 'bar'));
/*
  [
    {
      foo: 1,
      bar: 1
    },
    {
      foo: 2,
      bar: 2
    }
  ]
*/
```

## omit
### accepts keys and returns a function which accepts an object and returns a new object without the keys specified
```js
var utils = require('map-utils');
var arr = [
  {
    foo: 1,
    bar: 1,
    qux: 1
  },
  {
    foo: 2,
    bar: 2,
    qux: 2
  }
];

arr.map(utils.omit('foo', 'bar'));
/*
  [
    {
      qux: 1
    },
    {
      qux: 2
    }
  ]
*/
```

## pluck
### accepts keys and returns a function which accepts an object and returns the value of the key specified
```js
var utils = require('map-utils');
var arr = [
  {
    foo: 1,
    bar: 1,
    qux: 1
  },
  {
    foo: 2,
    bar: 2,
    qux: 2
  }
];

arr.map(utils.pluck('foo')); // [1, 2]
```

## set
### accepts obj or key val arguments and returns a function which accepts an object which those key/values will be set on
```js
var utils = require('map-utils');
var arr1 = [
  {
    foo: 1,
    bar: 1
  },
  {
    foo: 2,
    bar: 1
  }
];
var arr2 = [
  {
    foo: 1
  },
  {
    foo: 2
  }
];

arr1.map(utils.set('qux', 1));
arr2.map(utils.set({ bar:1, qux:1 }));
/* both arr and arr2 becom:
  [
    {
      foo: 1,
      bar: 1,
      qux: 1
    },
    {
      foo: 2,
      bar: 1,
      qux: 1
    }
  ]
*/
```

## unset
### accepts keys and returns a function which accepts an object which those keys will be deleted from
```js
var utils = require('map-utils');
var arr = [
  {
    foo: 1,
    bar: 1,
    qux: 1
  },
  {
    foo: 2,
    bar: 2,
    qux: 2
  }
];

arr.map(utils.unset('foo', 'bar'));
/* arr becomes:
  [
    {
      foo: 1,
      bar: 1
    },
    {
      foo: 2,
      bar: 2
    }
  ]
*/
```

---
_Source: https://npm.io/package/map-utils · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
