# vivifyer

> A map that creates a default object if one does not exist.

Latest version **3.0.2** (published 2022-02-07) · MIT license · 0 weekly downloads

## Install

```sh
npm install vivifyer
pnpm add vivifyer
yarn add vivifyer
bun add vivifyer
```

## 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 | 3.0.2 |
| Published | 2022-02-07 |
| First published | 2017-03-19 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 5.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Alan Gutierrez |
| Maintainers | bigeasy |
| Keywords | bluey, map |

## Links

- npm: https://www.npmjs.com/package/vivifyer
- Repository: https://github.com/bigeasy/vivifyer
- Issues: https://github.com/bigeasy/vivifyer/issues
- npm.io page: https://npm.io/package/vivifyer

## Recent versions

- 3.0.2 (latest) — 2022-02-07
- 3.0.1 — 2021-09-20
- 3.0.0 — 2021-07-23
- 2.1.2 — 2021-07-22
- 2.1.1 — 2021-01-02
- 2.1.0 — 2020-12-24
- 2.0.3 — 2020-05-05
- 2.0.2 — 2019-10-23
- 2.0.1 — 2019-10-12
- 2.0.0 — 2019-07-11
- 1.0.1 — 2019-04-17
- 1.0.0 — 2019-03-02
- 0.0.7 — 2018-11-25
- 0.0.6 — 2018-07-26
- 0.0.5 — 2018-06-05
- … 5 more at https://npm.io/package/vivifyer/versions

## README

[![Actions Status](https://github.com/bigeasy/vivifyer/workflows/Node%20CI/badge.svg)](https://github.com/bigeasy/vivifyer/actions)
[![codecov](https://codecov.io/gh/bigeasy/vivifyer/branch/master/graph/badge.svg)](https://codecov.io/gh/bigeasy/vivifyer)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

A map that creates a default object if one does not exist.

| What          | Where                                         |
| --- | --- |
| Discussion    | https://github.com/bigeasy/vivifyer/issues/1  |
| Documentation | https://bigeasy.github.io/vivifyer            |
| Source        | https://github.com/bigeasy/vivifyer           |
| Issues        | https://github.com/bigeasy/vivifyer/issues    |
| CI            | https://travis-ci.org/bigeasy/vivifyer        |
| Coverage:     | https://codecov.io/gh/bigeasy/vivifyer        |
| License:      | MIT                                           |

```
npm install vivifyer
```

## Overview

Extant is an implementation of SQL's COALESCE that I've used for some time to
deal with the fact that JavaScript truthiness will treat `''` and `0` as true so
the `||` operator can't always be used to create given or default one-liner.

```javascript
const { compare, raise, equal } = require('vivifyer')
```

We use the name "extant" on NPM because we want the first extant argument.

## Living `README.md`

This `README.md` is also a unit test using the
[Proof](https://github.com/bigeasy/proof) unit test framework. We'll use the
Proof `okay` function to assert out statements in the readme. A Proof unit test
generally looks like this.

```javascript
require('proof')(4, async okay => {
    okay('always okay')
    okay(true, 'okay if true')
    okay(1, 1, 'okay if equal')
    okay({ value: 1 }, { value: 1 }, 'okay if deep strict equal')
})
```

You can run this unit test yourself to see the output from the various
code sections of the readme.

```text
git clone git@github.com:bigeasy/vivifyer.git
cd vivifyer
npm install --no-package-lock --no-save
node test/readme.t.js
```

## Usage

The `'extant'` module exports a single `coalesce` function.

```javascript
const vivifyer = require('vivifyer')
```

Note that Extant is SQL's `COALESCE`. It returns the first non-null-like value,
that is the first value that is not `== null`, which would be `null` or
`undefined`. If there is no such argument it returns `null`.

```javascript
okay('test')
```

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