as-assert
TypeScript icon, indicating that this package has built-in type declarations

0.3.0 • Public • Published

as-assert is a simple library containing assertion functions.

import Assert from 'as-assert/out/Assert';

var a = null;
var b = undefined;
var c = 0;
var d = '';
var e = false;
var f = [];
var g = function() {};
var h = NaN;

console.log(Assert.isSet(a)); // Error
console.log(Assert.isSet(b)); // Error
console.log(Assert.isSet(c));
console.log(Assert.isSet(d));
console.log(Assert.isSet(e));
console.log(Assert.isSet(f));
console.log(Assert.isSet(g));
console.log(Assert.isSet(h));

console.log(Assert.isArray(a)); // Error
console.log(Assert.isArray(b)); // Error
console.log(Assert.isArray(c)); // Error
console.log(Assert.isArray(d)); // Error
console.log(Assert.isArray(e)); // Error
console.log(Assert.isArray(f));
console.log(Assert.isArray(g)); // Error
console.log(Assert.isArray(h)); // Error

console.log(Assert.isString(a)); // Error
console.log(Assert.isString(b)); // Error
console.log(Assert.isString(c)); // Error
console.log(Assert.isString(d));
console.log(Assert.isString(e)); // Error
console.log(Assert.isString(f)); // Error
console.log(Assert.isString(g)); // Error
console.log(Assert.isString(h)); // Error

console.log(Assert.isNumber(a)); // Error
console.log(Assert.isNumber(b)); // Error
console.log(Assert.isNumber(c));
console.log(Assert.isNumber(d)); // Error
console.log(Assert.isNumber(e)); // Error
console.log(Assert.isNumber(f)); // Error
console.log(Assert.isNumber(g)); // Error
console.log(Assert.isNumber(h));

console.log(Assert.isBoolean(a)); // Error
console.log(Assert.isBoolean(b)); // Error
console.log(Assert.isBoolean(c)); // Error
console.log(Assert.isBoolean(d)); // Error
console.log(Assert.isBoolean(e));
console.log(Assert.isBoolean(f)); // Error
console.log(Assert.isBoolean(g)); // Error
console.log(Assert.isBoolean(h)); // Error

console.log(Assert.isFunction(a)); // Error
console.log(Assert.isFunction(b)); // Error
console.log(Assert.isFunction(c)); // Error
console.log(Assert.isFunction(d)); // Error
console.log(Assert.isFunction(e)); // Error
console.log(Assert.isFunction(f)); // Error
console.log(Assert.isFunction(g));
console.log(Assert.isFunction(h)); // Error

Package Sidebar

Install

npm i as-assert

Weekly Downloads

0

Version

0.3.0

License

none

Unpacked Size

5.67 kB

Total Files

6

Last publish

Collaborators

  • astussig