# dash-assert

> Assertion wrapper around lodash

Latest version **1.3.1** (published 2018-03-16) · MIT license · 0 weekly downloads

## Install

```sh
npm install dash-assert
pnpm add dash-assert
yarn add dash-assert
bun add dash-assert
```

## 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.3.1 |
| Published | 2018-03-16 |
| First published | 2015-04-03 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 15 |
| Unpacked size | 16.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | David Von Lehman |
| Maintainers | dvonlehman |
| Keywords | lodash, assert, testing |

## Links

- npm: https://www.npmjs.com/package/dash-assert
- Repository: https://github.com/dvonlehman/dash-assert
- Issues: https://github.com/dvonlehman/dash-assert/issues
- npm.io page: https://npm.io/package/dash-assert

## Dependencies (15)

- [lodash.some](https://npm.io/package/lodash.some.md) ^4.6.0
- [lodash.every](https://npm.io/package/lodash.every.md) ^4.6.0
- [lodash.isnan](https://npm.io/package/lodash.isnan.md) ^3.0.2
- [lodash.isnull](https://npm.io/package/lodash.isnull.md) ^3.0.0
- [lodash.isempty](https://npm.io/package/lodash.isempty.md) ^4.4.0
- [lodash.iserror](https://npm.io/package/lodash.iserror.md) ^3.1.1
- [lodash.ismatch](https://npm.io/package/lodash.ismatch.md) ^4.4.0
- [lodash.includes](https://npm.io/package/lodash.includes.md) ^4.3.0
- [lodash.isnumber](https://npm.io/package/lodash.isnumber.md) ^3.0.3
- [lodash.isobject](https://npm.io/package/lodash.isobject.md) ^3.0.2
- [lodash.isregexp](https://npm.io/package/lodash.isregexp.md) ^4.0.1
- [lodash.isstring](https://npm.io/package/lodash.isstring.md) ^4.0.1
- [lodash.difference](https://npm.io/package/lodash.difference.md) ^4.5.0
- [lodash.isundefined](https://npm.io/package/lodash.isundefined.md) ^3.0.1
- [lodash.intersection](https://npm.io/package/lodash.intersection.md) ^4.4.0

## Alternatives

- [duck](https://npm.io/package/duck.md) — 4.2M weekly downloads
- [ava](https://npm.io/package/ava.md) — 560.2K weekly downloads
- [storybook-addon-module-mock](https://npm.io/package/storybook-addon-module-mock.md) — 71.7K weekly downloads
- [@ethereum-waffle/mock-contract](https://npm.io/package/@ethereum-waffle/mock-contract.md) — 40.0K weekly downloads
- [aws-elasticsearch-connector](https://npm.io/package/aws-elasticsearch-connector.md) — 37.4K weekly downloads

## Recent versions

- 1.3.1 (latest) — 2018-03-16
- 1.3.0 — 2018-03-16
- 1.2.0 — 2016-05-02
- 1.1.0 — 2016-03-08
- 1.0.3 — 2015-07-16
- 1.0.2 — 2015-04-17
- 1.0.1 — 2015-04-03
- 1.0.0 — 2015-04-03

## README

# dash-assert

[![NPM Version][npm-image]][npm-url]
[![NPM Downloads][downloads-image]][downloads-url]
[![Build Status][travis-image]][travis-url]
[![Test Coverage][coveralls-image]][coveralls-url]

A simple assertion wrapper library around [lodash](https://lodash.com).

Maybe BDD style assertions are what the cool kids do, but some of us still prefer old style assert statements. Personally I find it easier to reason about my tests when the key lines actually begin with the word "assert".

The Node.js [Assert](https://nodejs.org/api/assert.html) module is a good start, but has limited expressiveness. Lodash offers a very expressive API that lends itself well to testing, so conditionally throwing an AssertionError based on the result of a lodash function feels like a natural fit.

## Installation
~~~
npm install dash-assert --save-dev
~~~

## Usage
Since this library simply extends Node's [assert](https://nodejs.org/api/assert.html), use it right alongside `assert.equal`, `assert.throws`, `assert.ok`, etc.

~~~js
var assert = require('assert');
require('dash-assert');

it('returns an array', function() {
  assert.isArray(someFunction());
});
~~~

## API

### assert.isNumber(value)
Assert that that value is a number using [`isNumber`](https://lodash.com/docs#isNumber).

### assert.isNaN(value)
Assert that value is NaN using [`isNaN`](https://lodash.com/docs#isNaN).

### assert.isObject(value)
Assert that value is an object using [`isObject`](https://lodash.com/docs#isObject).

### assert.isString(value)
Assert that value is a astring using [`isString`](https://lodash.com/docs#isString).

### assert.isArray(value)
Assert that value is an array using [`isArray`](https://lodash.com/docs#isArray).

### assert.isEmpty(value)
Assert that value is empty using [`isEmpty`](https://lodash.com/docs#isEmpty).

### assert.isNotEmpty(value)
Assert that the value is not empty using the inverse of [`isEmpty`](https://lodash.com/docs#isEmpty).

### assert.isError(value)
Assert that the specified value in an `Error` type using [`isError`](https://lodash.com/docs#isError).

### assert.isNull(value)
Assert that the value is null using [`isNull`](https://lodash.com/docs#isNull).

### assert.isNotNull(value)
Assert that the value is null using the inverse of [`isNull`](https://lodash.com/docs#isNull).

### assert.isUndefined(value)
Assert that the specified value is undefined based on [`isUndefined`](https://lodash.com/docs#isUndefined).

### assert.isDefined(value)
Assert that the specified value is not undefined based on the inverse of [`isUndefined`](https://lodash.com/docs#isUndefined).

### assert.some(collection, predicate)
Assert that the predicate returns truthy for __any__ element in the collection using [`some`](https://lodash.com/docs#some).

### assert.every(collection, predicate)
Assert that the predicate returns truthy for __all__ elements of the collection using [`every`](https://lodash.com/docs#every).

### assert.isMatch(object, source)
Assert that all properties of the source are present on the object with equivalent values using [`isMatch`](https://lodash.com/docs#isMatch).

### assert.isTrue(value)
Shortcut for `assert.strictEqual(value, true)`.

### assert.isFalse(value)
Shortcut for `assert.strictEqual(value, false)`.

### assert.hasIntersect(array, otherArray)
Assert that there is at least one value in common between the two arrays based on [`intersection`](https://lodash.com/docs#intersection) having a length greater than 0.

### assert.noIntersect(array, otherArray)
Assert that the two arrays do not intersect based on [`intersection`](https://lodash.com/docs#intersection) having a length equal to 0.

### assert.noDifferences(array, otherArray)
Assert that there are no differences between the two arrays based on [`difference`](https://lodash.com/docs#difference) having a length of 0.

### assert.matchesPattern(value, regex)
Assert that the value passes a RegExp test.

### assert.isJSON(value)
Assert that value is a string that does not throw an error when passed to `JSON.parse`.

## Running Tests
~~~
npm test
~~~

[npm-image]: https://img.shields.io/npm/v/dash-assert.svg?style=flat
[npm-url]: https://npmjs.org/package/dash-assert
[travis-image]: https://img.shields.io/travis/dvonlehman/dash-assert.svg?style=flat
[travis-url]: https://travis-ci.org/dvonlehman/dash-assert
[coveralls-image]: https://img.shields.io/coveralls/dvonlehman/dash-assert.svg?style=flat
[coveralls-url]: https://coveralls.io/r/dvonlehman/dash-assert?branch=master
[downloads-image]: https://img.shields.io/npm/dm/dash-assert.svg?style=flat
[downloads-url]: https://npmjs.org/package/dash-assert

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