Home
Docs
GitHub
Pricing
Blog
Log In

Run Sandworm Audit for your App

Get started
Hold on, we're currently generating a fresh version of this report
Generated on Apr 11, 2024 via pnpm

assert-plus 0.2.0

Extra assertions on top of node's assert module
Package summary
Share
0
issues
1
license
1
MIT
Package created
23 Jun 2012
Version published
10 Nov 2015
Maintainers
7
Total deps
1
Direct deps
0
License
MIT

Issues

0
This package has no issues

Licenses

MIT License

Permissive
OSI Approved
This is a human-readable summary of (and not a substitute for) the license. Disclaimer.
Can
commercial-use
modify
distribute
sublicense
private-use
Cannot
hold-liable
Must
include-copyright
include-license
1 Packages, Including:
assert-plus@0.2.0
Disclaimer

This deed highlights only some of the key features and terms of the actual license. It is not a license and has no legal value. You should carefully review all of the terms and conditions of the actual license before using the licensed material.

Sandworm is not a law firm and does not provide legal services. Distributing, displaying, or linking to this deed or the license that it summarizes does not create a lawyer-client or any other relationship.

Direct Dependencies

0
All Dependencies CSV
β“˜ This is a list of assert-plus 's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.
NameVersionSizeLicenseTypeVulnerabilities

Visualizations

Frequently Asked Questions

What does assert-plus do?

Assert-plus is a lightweight library offering enhanced features over Node's assert module. The module brings two extended functionalities, the environment variable NODE_NDEBUG that allows users to disable assertions, and API wrappers such as assert.string(myArg, 'myArg') that are designed for argument testing, improving the validation process within your code.

How do you use assert-plus?

Utilizing assert-plus involves straightforward means and requires minimal effort. The first step is to install the package through npm using npm install assert-plus. You can use it within your JavaScript function like so:

    var assert = require('assert-plus');

    function fooAccount(options, callback) {
        assert.object(options, 'options');
        assert.number(options.id, 'options.id');
        assert.bool(options.isManager, 'options.isManager');
        assert.string(options.name, 'options.name');
        assert.arrayOfString(options.email, 'options.email');
        assert.func(callback, 'callback');

        // Do stuff
        callback(null, {});
    }

In this code, we're utilizing assert-plus to ensure that the correct types are passed to a function. If the wrong type is passed, an AssertionError will be thrown.

Where are the assert-plus docs?

The comprehensive and updated documentation for assert-plus is hosted within the Readme file on the GitHub repository at https://github.com/mcavage/node-assert-plus. Here you'll find details about the API, installation guides, and code usage examples for each category of assertions provided by this powerful module.