# simple-assert

> Vanilla Assertions

Latest version **2.0.0** (published 2023-07-21) · MIT license · 0 weekly downloads

## Install

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

## Health

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

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.0 |
| Published | 2023-07-21 |
| First published | 2013-07-18 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >= 14.16 |
| Dependencies | 1 |
| Unpacked size | 13.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 7 |
| Author | Jake Luer |
| Maintainers | chaijs, keithamus |

## Links

- npm: https://www.npmjs.com/package/simple-assert
- Repository: https://github.com/chaijs/simple-assert
- Homepage: https://github.com/chaijs/simple-assert#readme
- Issues: https://github.com/chaijs/simple-assert/issues
- npm.io page: https://npm.io/package/simple-assert

## Dependencies (1)

- [assertion-error](https://npm.io/package/assertion-error.md) ^2.0.0

## Recent versions

- 2.0.0 (latest) — 2023-07-21
- 1.0.0 — 2013-07-18

## README

# simple-assert [![Build Status](https://travis-ci.org/chaijs/simple-assert.png?branch=master)](https://travis-ci.org/chaijs/simple-assert)

> Vanilla Assertions

A simple `assert` wrapper around [chaijs/assertion-error](https://github.com/chaijs/assertion-error). This probably
won't be useful to the average user unless you are a minimalist; you probably want [Chai](https://github.com/chaijs/chai).
We use it to avoid circular dependencies when testing Chai's dependencies.

## Installation

### Node.js

`simple-assert` is available on [npm](http://npmjs.org).

    $ npm install simple-assert

### Component

`simple-assert` is available as a [component](https://github.com/component/component).

    $ component install chaijs/simple-assert

## Usage

### assert (expr[, msg])

* **@param** _{Mixed}_ expression to test for truthiness
* **@param** _{String}_ message on failure

Perform a truthy assertion.

```js
var assert = require('simple-assert');
assert(true, 'true is truthy');
assert(1, '1 is truthy');
assert('string', 'string is truthy');
```


### assert.not (expr[, msg])

* **@param** _{Mixed}_ express to test for falsiness
* **@param** _{String}_ messag eon failure

Perform a falsey assertion.

```js
db.get(123, function (err, doc) {
  assert.not(err, 'db.get returned error');
  // ...
});
```


### assert.fail ([msg])

* **@param** _{String}_ failure message

Force an `AssertionError` to be thrown.

```js
switch (res.statusCode) {
  case 200:
    // ..
    break;
  case 404:
    // ..
    break;
  default:
    assert.fail('Unknown response statusCode');
}
```

## License

(The MIT License)

Copyright (c) 2012 Jake Luer <jake@alogicalparadox.com> (http://alogicalparadox.com)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

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