mirror of
https://bitbucket.org/bellord13/kit.git
synced 2026-11-13 19:06:11 +03:00
fix
This commit is contained in:
@@ -7,13 +7,46 @@ __PluginManager__.register('support', function(module, exports, require, global)
|
||||
return str[0].toUpperCase() + str.slice(1);
|
||||
}
|
||||
};
|
||||
|
||||
function uniqueId (length = 32, firstLetter = true) {
|
||||
var idStr = '';
|
||||
if(length < 1) return idStr;
|
||||
if(firstLetter) {
|
||||
length && (idStr = (Math.floor((Math.random() * 25)) + 10).toString(36));
|
||||
if (length === 1) return idStr;
|
||||
}
|
||||
do {
|
||||
idStr += (Math.floor((Math.random() * 35))).toString(36);
|
||||
} while (idStr.length < length);
|
||||
return (idStr);
|
||||
}
|
||||
function valueEx(value) {
|
||||
var arg = [];
|
||||
if(arguments.length > 1)
|
||||
for(var i = 1; arguments.length - 1 >= i;i++) {
|
||||
arg.push(arguments[i]);
|
||||
}
|
||||
if(typeof value === 'function') {
|
||||
return value.apply(this, arg);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
function empty(val){
|
||||
return arguments.length === 0 ||
|
||||
val === undefined ||
|
||||
val === null ||
|
||||
Number.isNaN(val) === true ||
|
||||
val === '' ||
|
||||
val === 0 ||
|
||||
val === false;
|
||||
}
|
||||
/**
|
||||
* @memberof kitCore
|
||||
* @instance
|
||||
* @memberOf kit
|
||||
*/
|
||||
var support = {
|
||||
str: str,
|
||||
uniqueId,
|
||||
valueEx,
|
||||
empty
|
||||
};
|
||||
|
||||
return module.exports = support;
|
||||
|
||||
Reference in New Issue
Block a user