Difference between revisions of "Core"
From CCIL
(Created page with " === Include === ==== Maven ==== <pre> </pre> === API === ==== String Prototypes ==== ===== contains ===== <pre> String.prototype.contains = function(str, ignoreCase) {...") |
|||
Line 36: | Line 36: | ||
return target.replace(new RegExp(search, 'g'), replacement); | return target.replace(new RegExp(search, 'g'), replacement); | ||
}; | }; | ||
+ | </pre> | ||
+ | |||
+ | ==== Utils ==== | ||
+ | |||
+ | ===== isFunction ===== | ||
+ | |||
+ | <pre> | ||
+ | CCIL.utils.isFunction = function(functionToCheck) { | ||
+ | var getType = {}; | ||
+ | return functionToCheck | ||
+ | && getType.toString.call(functionToCheck) === '[object Function]'; | ||
+ | } | ||
+ | </pre> | ||
+ | |||
+ | ===== isDefined ===== | ||
+ | |||
+ | <pre> | ||
+ | CCIL.utils.isDefined = function(val) { | ||
+ | return !CCIL.utils.isUndefined(val); | ||
+ | } | ||
+ | </pre> | ||
+ | |||
+ | ===== isUndefined ===== | ||
+ | |||
+ | <pre> | ||
+ | CCIL.utils.isUndefined = function(val) { | ||
+ | return (typeof val === 'undefined'); | ||
+ | } | ||
+ | </pre> | ||
+ | |||
+ | ===== isNull ===== | ||
+ | |||
+ | <pre> | ||
+ | CCIL.utils.isNull = function(val) { | ||
+ | return url === null; | ||
+ | } | ||
+ | </pre> | ||
+ | |||
+ | ===== isVal ===== | ||
+ | |||
+ | <pre> | ||
+ | CCIL.utils.isVal = function(val) { | ||
+ | return CCIL.utils.isDefined(val) && (!CCIL.utils.isNull(val)); | ||
+ | } | ||
</pre> | </pre> |
Revision as of 08:30, 15 April 2017
Contents
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)); }