# @f/index

> Generate a keyed map from a list

Latest version **1.0.4** (published 2016-03-08) · MIT license · 0 weekly downloads

## Install

```sh
npm install @f/index
pnpm add @f/index
yarn add @f/index
bun add @f/index
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.4 |
| Published | 2016-03-08 |
| First published | 2016-02-26 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Maintainers | f |

## Links

- npm: https://www.npmjs.com/package/@f/index
- Repository: https://github.com/micro-js/index
- Homepage: https://github.com/micro-js/index#readme
- Issues: https://github.com/micro-js/index/issues
- npm.io page: https://npm.io/package/@f/index

## Dependencies (2)

- [@f/identity](https://npm.io/package/@f/identity.md) ^1.1.1
- [@f/reduce-array](https://npm.io/package/@f/reduce-array.md) ^0.2.1

## Recent versions

- 1.0.4 (latest) — 2016-03-08
- 1.0.2 — 2016-02-29
- 1.0.1 — 2016-02-29
- 1.0.0 — 2016-02-26

## README

# index

[![Build status][travis-image]][travis-url]
[![Git tag][git-image]][git-url]
[![NPM version][npm-image]][npm-url]
[![Code style][standard-image]][standard-url]

Generate a keyed map from a list

## Installation

    $ npm install @f/index

## Usage

Use it to figure out what was created/removed from lists, or to test membership, etc.., e.g.

```js
var index = require('@f/index')
var reduce = require('@f/reduce')

function removedItems (cur, prev) {
  var map = index(getKey, cur)
  return reduce(function (removed, item) {
    if (!map[getKey(item)]) removed.push(item)
    return removed
  }, [], prev)
}
```

## API

### index(keyFn?, itemFn?, list)

- `keyFn` - Optional. Defaults to identity. A function that takes an item of `list` and returns a `key` appropriate for use in an object map.
- `itemFn` - Optional. If two arguments are passed, `list` is the second argument. Transforms the value in the indexed map.
- `list` - The list of things you want to index

**Returns:** An indexed map of the items in `list` to their corresponding `key` as returned by `fn(item)`.

## License

MIT

[travis-image]: https://img.shields.io/travis/micro-js/index.svg?style=flat-square
[travis-url]: https://travis-ci.org/micro-js/index
[git-image]: https://img.shields.io/github/tag/micro-js/index.svg?style=flat-square
[git-url]: https://github.com/micro-js/index
[standard-image]: https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square
[standard-url]: https://github.com/feross/standard
[npm-image]: https://img.shields.io/npm/v/@f/index.svg?style=flat-square
[npm-url]: https://npmjs.org/package/@f/index

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