# lazy-eval-array

> Lazily Evaluates Arrays via a function that is called on-read

Latest version **0.0.2** (published 2017-07-17) · MIT license · 0 weekly downloads

## Install

```sh
npm install lazy-eval-array
pnpm add lazy-eval-array
yarn add lazy-eval-array
bun add lazy-eval-array
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.2 |
| Published | 2017-07-17 |
| First published | 2017-05-07 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=4 |
| Dependencies | 3 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Nick The Sick |
| Maintainers | nperez0111 |

## Links

- npm: https://www.npmjs.com/package/lazy-eval-array
- Repository: https://github.com/nperez0111/lazy-eval-array
- Homepage: https://github.com/nperez0111/lazy-eval-array#readme
- Issues: https://github.com/nperez0111/lazy-eval-array/issues
- npm.io page: https://npm.io/package/lazy-eval-array

## Dependencies (3)

- [is-fn](https://npm.io/package/is-fn.md) ^1.0.0
- [fast-memoize](https://npm.io/package/fast-memoize.md) ^2.2.7
- [proxify-objects](https://npm.io/package/proxify-objects.md) 0.0.5

## Recent versions

- 0.0.2 (latest) — 2017-07-17
- 0.0.1 — 2017-05-07

## README

# lazy-eval-array [![Build Status](https://travis-ci.org/nperez0111/lazy-eval-array.svg?branch=master)](https://travis-ci.org/nperez0111/lazy-eval-array)

> Lazily Evaluates Arrays via a function that is called on-read of an array's value 


## Install

```
$ npm install --save lazy-eval-array
```


## Usage

```js
const lazy = require('lazy-eval-array');

const arr = lazy( [ 0, 1, 2, 3, () => 4 ] )
arr[3]// => 4

const arr = lazy( [ 0, 1, 2, 3, function() {return this.x} ], { x: 20 } )
arr[3]// => 20 

const arr = lazy( [ (index)=>index, 1, 2, 3, (index,input1,input2)=>input1+input2 ], null, 10, 3 )
arr[0]// => 0
arr[3]// => 13
```


## API

### lazyEvalArray(input, ctx,[ arg1,arg2,argN... ])

#### input

Type: `Array`

The array that is being lazily evaluted.

#### ctx

Type: `Object`

This is the context in which the function will be run in. A.K.A what this will be when the function is run.

##### ags(1-N)

Type: `Anything`

These are the parameters that the inner function is called with. The first parameter that is called if the current index. Meaning the function signature is:
`function (current Index, args1, args2, argsN)`

### lazyEvalArray.noMemoization(input, ctx,[ arg1, arg2, argN... ])

Same as above but would not memoize the output of the function ran

### lazyEvalArray.promisify(input, ctx,[ arg1, arg2, argN... ])

Resolves all values as promises normalizing output of each function as well as each value

### lazyEvalArray.promisify.noMemoization(input, ctx,[ arg1, arg2, argN... ])

Same as above but will not cache the output of the functions ran

## License

MIT © [Nick The Sick](http://nickthesick.com)

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