Skip to content

AngularJS assert module provides a set of assertion functions for verifying invariants.

License

Notifications You must be signed in to change notification settings

ContaSystemer/angularjs-assert

Repository files navigation

Description

AngularJS assert module provides a set of assertion functions for verifying invariants.

Install

Include the file in HTML

<script src="/node_modules/@contasystemer/angularjs-assert/src/angularjs-assert.js"></script>

or require the file

require('@contasystemer/angularjs-assert');

In angular, include the module into your app.

angular.module('app', ['conta.assert']);

Usage

csAssert.ok(angular.isObject(result), 'Result should be an object');

It's an equvivalent of:

if (angular.isObject(result) === false) {
    throw new Error('Result should be an object');
}