Core

From CCIL
Revision as of 08:30, 15 April 2017 by Atanas.ilchev (Talk | contribs)

Jump to: navigation, search


Include

Maven


API

String Prototypes

contains
String.prototype.contains = function(str, ignoreCase) {
	  return (ignoreCase ? this.toUpperCase() : this)
	    .indexOf(ignoreCase ? str.toUpperCase() : str) >= 0;
};
endsWith
String.prototype.endsWith = function(suffix) {
	return this.indexOf(suffix, this.length - suffix.length) !== -1;
};
replaceAll
String.prototype.replaceAll = function(search, replacement) {
	var target = this;
	return target.replace(new RegExp(search, 'g'), replacement);
};

Utils

isFunction
CCIL.utils.isFunction = function(functionToCheck) {
	var getType = {};
	return functionToCheck
			&& getType.toString.call(functionToCheck) === '[object Function]';
}
isDefined
CCIL.utils.isDefined = function(val) {
	return !CCIL.utils.isUndefined(val);
}
isUndefined
CCIL.utils.isUndefined = function(val) {
	return (typeof val === 'undefined');
}
isNull
CCIL.utils.isNull = function(val) {
	return url === null;
}
isVal
CCIL.utils.isVal = function(val) {
	return CCIL.utils.isDefined(val) && (!CCIL.utils.isNull(val));
}