# @f/pending-value

> A thin abstraction over promises that makes them retargetable, so that you can represent a single value that may be asynchronously computed and re-computed.

Latest version **1.0.0** (published 2016-01-18) · MIT license · 0 weekly downloads

## Install

```sh
npm install @f/pending-value
pnpm add @f/pending-value
yarn add @f/pending-value
bun add @f/pending-value
```

## 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.0 |
| Published | 2016-01-18 |
| First published | 2016-01-18 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Maintainers | f |

## Links

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

## Recent versions

- 1.0.0 (latest) — 2016-01-18

## README

# pending-value

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

A thin abstraction over promises that makes them retargetable, so that you can represent a single value that may be asynchronously computed and re-computed.

## Installation

    $ npm install @f/pending-value

## Usage

You should use `pendingValue` when you have a thing that may be recomputed or rebuilt over time, but you want to abstract that fact away from the code that uses it. For instance, watching a browserify bundle:

```js
var pendingValue = require('@f/pending-value')
var browserify = require('browserify')
var concat = require('concat-stream')
var watchify = require('watchify')
var route = require('koa-route')
var fs = require('fs')

var js = pendingValue()
var b = browserify({
  entries: 'entry.js',
  cache: {},
  packageCache: {},
  plugin: [watchify]
})

b.on('update', bundle)
bundle()

function bundle() {
  js.pending()
  b.bundle().pipe(concat(str = js.ready(str))
}

app.use(route.get('/bundle.js', function *() {
  this.body = yield js.value()
})
```

## API

### pendingValue()

**Returns:** An object with three methods. `pending()`, `ready(value)`, and `value()`. `pending()` puts the structure back into its loading state, blocking all requests for `value` until `ready` is called with a new value.

## License

MIT

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

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