# value-index-pair-interface

> TypeScript interface for object that represents a single array item

Latest version **1.0.1** (published 2018-11-03) · FREE license · 0 weekly downloads

## Install

```sh
npm install value-index-pair-interface
pnpm add value-index-pair-interface
yarn add value-index-pair-interface
bun add value-index-pair-interface
```

## 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.1 |
| Published | 2018-11-03 |
| First published | 2018-11-03 |
| Weekly downloads | 0 |
| License | FREE |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 1.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Steve Thompson |
| Maintainers | writetome51 |
| Keywords | typescript, interface, object, array-item, item, value, index |

## Links

- npm: https://www.npmjs.com/package/value-index-pair-interface
- npm.io page: https://npm.io/package/value-index-pair-interface

## Alternatives

- [@openai/codex-sdk](https://npm.io/package/@openai/codex-sdk.md) — 731.4K weekly downloads
- [babel-plugin-transform-react-jsx](https://npm.io/package/babel-plugin-transform-react-jsx.md) — 565.0K weekly downloads
- [babel-helper-remove-or-void](https://npm.io/package/babel-helper-remove-or-void.md) — 508.5K weekly downloads
- [@pnpm/store-controller-types](https://npm.io/package/@pnpm/store-controller-types.md) — 186.9K weekly downloads
- [react-native-signature-canvas](https://npm.io/package/react-native-signature-canvas.md) — 155.6K weekly downloads

## Recent versions

- 1.0.1 (latest) — 2018-11-03
- 1.0.0 — 2018-11-03

## README

To include in your project:

`import { IValueIndexPair } from 'value-index-pair-interface/IValueIndexPair';`

This is an interface for an object representing a single array item:

```
export interface IValueIndexPair {
    value: any;
    index: number; // integer
}
```
 
Usage Example:

You need to extract some items from an array.  But not only do you need the values,   
you need their indexes too, so you write this function, specifying that it returns   
an array of IValueIndexPairs:
```
function getValueAndIndex(  
    testFunction(item, index?, array?) => boolean,  
    array  
): IValueIndexPair[]
```
This lets everyone know it will return an array looking something like this:
```
[
	{value: 'some text', index: 5},  
	{value: 10, index: 15},  
	{value: false, index: 33}  
	...more items...
]
```

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