2.0.1 • Published 6 years ago
bejs v2.0.1
to be, or not to be, that is the question
Simple, light-weight assertions framework for javascript
More than 190 validation methods
Installation
Node.js
npm install bejs --save
Browser
Local
<script src="node_modules/bejs/dist/be.min.js"></script>
CDN unpkg
<script src="https://unpkg.com/bejs/dist/be.min.js"></script>
CDN jsDeliver
<script src="https://cdn.jsdelivr.net/npm/bejs/dist/be.min.js"></script>
Example
const be = require('bejs');
// call a method
be.boolean(true);
// call interface "not"
be.not.boolean(1);
// call interface "all" and passing arguments
be.all.boolean(true, false, true);
// call interface "all" and passing array
be.all.boolean([true, false, true]);
// call interface "any" and passing arguments
be.any.boolean(true, false, 1);
// call interface "err" to throw an error if assertions are not satisfied
be.err.equal('hello world', 'hello world!'); // throw AssertionError
// call interface "err" passing a custom error message
be.err('the string must be equal to "hello world!"').equal('hello world', 'hello world!'); // throw AssertionError
// call others interfaces from "err"
be.err.any.array([], {}, '');
As unit test with Mocha
describe('a test', () => {
it('should be ok', (done)=>{
be.err(done).email('fabio@rica.li');
});
it('should be false', ()=>{
be.err.false(2 === 3);
});
});
Documentation
See https://be.js.org
Changelog
You can view the changelog here
License
beJS is open-sourced software licensed under the MIT license
Author
Fabio Ricali
Davide Polano
2.0.1
6 years ago
2.0.0
6 years ago
1.16.0
6 years ago
1.14.0
6 years ago
1.13.0
7 years ago
1.12.2
7 years ago
1.12.1
7 years ago
1.11.0
7 years ago
1.10.0
7 years ago
1.9.0
7 years ago
1.8.0
7 years ago
1.7.3
7 years ago
1.7.2
7 years ago
1.7.1
7 years ago
1.7.0
7 years ago
1.6.3
7 years ago
1.6.2
7 years ago
1.6.1
7 years ago
1.6.0
7 years ago
1.5.0
7 years ago
1.4.1
7 years ago
1.4.0
7 years ago
1.3.1
7 years ago
1.2.1
7 years ago
1.2.0
7 years ago
1.1.3
7 years ago
1.1.2
7 years ago
1.1.1
7 years ago
1.1.0
7 years ago
1.0.20
7 years ago
1.0.19
7 years ago
1.0.18
7 years ago
1.0.17
7 years ago
1.0.16
7 years ago
1.0.15
7 years ago