BeJS
Simple, light-weight assertions framework for javascript
Install / Use
/learn @fabioricali/BeJSREADME
to be, or not to be, that is the question <br/><br/><br/> <a href="https://travis-ci.org/fabioricali/beJS" target="_blank"><img src="https://travis-ci.org/fabioricali/beJS.svg?branch=master" title="Build Status"/></a> <a href="https://coveralls.io/github/fabioricali/beJS?branch=master" target="_blank"><img src="https://coveralls.io/repos/github/fabioricali/beJS/badge.svg?branch=master" title="Coverage Status"/></a> <a href="https://opensource.org/licenses/MIT" target="_blank"><img src="https://img.shields.io/badge/License-MIT-yellow.svg" title="License: MIT"/></a> <img src="https://img.shields.io/badge/node.js-%3E%3D6-blue.svg" title="Node.js version"/> <img src="https://img.shields.io/badge/team-terrons-orange.svg" title="Team Terrons"/>
Simple, light-weight assertions framework for javascript
More than 190 validation methods
</div>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 <a target="_blank" href="https://be.js.org">https://be.js.org</a>
Changelog
You can view the changelog <a target="_blank" href="https://github.com/fabioricali/beJS/blob/master/CHANGELOG.md">here</a>
License
beJS is open-sourced software licensed under the <a target="_blank" href="http://opensource.org/licenses/MIT">MIT license</a>
Author
<a target="_blank" href="http://rica.li">Fabio Ricali</a>
<a target="_blank" href="https://www.mdslab.org">Davide Polano</a>
Related Skills
node-connect
349.9kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
109.8kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
349.9kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
349.9kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
