Node assert Shim
An implementation of the Node.js v15.6.0 assert module for Node.js 10 and later.
Warning: This module is a work-in-progress, on an as-needed basis, which
is why I'm publishing it in the @kevinoid
namespace. If/When reasonable API
coverage is achieved, I'll plan to publish without a namespace and promote it
more broadly. See Implemented APIs for progress.
Introductory Example
const assert = require('@kevinoid/assert-shim');
assert.match('Hello World', /hello/i);
This code will work on any Node.js version supported by this module.
Features
- Does not modify
assert
module. - Forward-compatible, drop-in replacement for
assert
module. All properties ofassert
are exported fromassert-shim
to make switching between the two easy. -
assert
module functions are used when available. (i.e.require('@kevinoid/assert-shim').match === require('assert').match
on Node.js versions which provideassert.match
(v13.6/v12.16 or later).
Installation
This package can be installed using npm, either globally or locally, by running:
npm install @kevinoid/assert-shim
API Docs
This module provides the same API as assert from Node.js v15.
Implemented APIs
Contributing
Contributions are appreciated. Contributors agree to abide by the Contributor Covenant Code of Conduct. If this is your first time contributing to a Free and Open Source Software project, consider reading How to Contribute to Open Source in the Open Source Guides.
If the desired change is large, complex, backwards-incompatible, can have significantly differing implementations, or may not be in scope for this project, opening an issue before writing the code can avoid frustration and save a lot of time and effort.
License
This project is available under the terms of the MIT License (The same license as Node.js). See the summary at TLDRLegal.