UNPKG

webgme-engine

Version:

WebGME server and Client API without a GUI

32 lines (25 loc) 694 B
/*globals define*/ /*eslint-env node, browser*/ /*eslint no-console: 0*/ /** * @author mmaroti / https://github.com/mmaroti */ define(function () { 'use strict'; /** * Checks given condition and throws new Error if "falsy". * @param {boolean|*} cond * @param {string} [msg='ASSERT failed'] */ var assert = function (cond, msg) { if (!cond) { var error = new Error(msg || 'ASSERT failed'); if (typeof TESTING === 'undefined') { console.log('Throwing', error.stack); console.log(); } throw error; } }; return assert; });