API Docs for: 1.0

src/js/util.js

/*! @file util.js */

/*
 * part of the 'Transfinite Ordinal Calculator'
 * author: Claudio Kressibucher
 * license: GNU LGPL
 */

/* JSHINT global declaration */
/*global oGui:true, util:true */

var util;

/**
 * static class with util functions
 * @class util
 * @static
 */
util = (function() {
	"use strict";

	return {

		/**
		 * outputs an error if expr -- converted to boolean -- represents
		 * "false".
		 * @method assert
		 * @param expr An expression that is evaluated as boolean
		 * @param msg The error message to show if expr is evaluated as false
		 * @return {boolean} The expr evaluated as boolean
		 */
		assert : function(expr, msg) {
			var ret = true;
			if (!expr) {
				oGui.dbgErr("--> Assertion Error" + (": "+msg || ''));
				ret = false;
			}
			return ret;
		}
	};
}());