self-explain

0.10.22 • Public • Published

self-explained

self explained tools - starting with "assert"

Install

$ npm install self-explained

extending npm-version downloads build coverage climate dependencies qa-control

language: English also available in: Spanish

Use

var assert = require('self-exlain').assert;
 
var alpha = 10;
var betha = 7;
 
assert(alpha / 2 > betha -1);

It controls the expression like assert does. If the expression evaluates to false it will show the expression and the value. (also throws the Exception)

ASSERT FAILED
alpha / 2 > betha -1 ==== false

Much more info

var assert = require('self-exlain').assert;
 
var alpha = 10;
var betha = 7;
 
eval(assert(alpha / 2 > betha -1));

Adding eval to the assert It will shows the evaluation of all subexpressions

ASSERT FAILED
alpha / 2 > betha -1 ==== false
alpha / 2 ==== 5
betha -1 ==== 6
alpha ==== 10
betha ==== 7

Exceptions

Function assertCatch controls that an Error been throwed.

assertCatch(function{
    if(error){
        throw new Error('an error');
    }
}, /an error/);

Tests with real devices

NPM version Device OS nav
0.10.0 HTC Desire Android 2.2.2 Android 2.2.2
0.10.0 Samgsung Galaxy Note 4 Android 5.1.1 Samsung Internet 4.0.0
0.10.2 Samgsung Galaxy Note 4 Android 6.0.1 Chrome Mobile 50.0.2661
0.10.0 Blue Vivo Air LTE Android 5.0.2 Chrome Mobile 50.0.2661
0.10.0 iPad mini Retina iOS 8.4.0 Mobile Safari 8.0.0
0.10.0 VMWare WinXP IE 8.0.0

License

MIT

Readme

Keywords

none

Package Sidebar

Install

npm i self-explain

Weekly Downloads

20

Version

0.10.22

License

MIT

Unpacked Size

234 kB

Total Files

5

Last publish

Collaborators

  • tute