@reldens/utils 0.46.0 → 0.47.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/shortcuts.js +22 -1
- package/package.json +1 -1
package/lib/shortcuts.js
CHANGED
|
@@ -47,6 +47,11 @@ class Shortcuts
|
|
|
47
47
|
return -1 !== dataArray.indexOf(value);
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
+
isNotEmptyArray(dataArray)
|
|
51
|
+
{
|
|
52
|
+
return (this.isArray(dataArray) && 0 < dataArray.length);
|
|
53
|
+
}
|
|
54
|
+
|
|
50
55
|
isFunction(callback)
|
|
51
56
|
{
|
|
52
57
|
return (callback && 'function' === typeof callback);
|
|
@@ -302,7 +307,7 @@ class Shortcuts
|
|
|
302
307
|
let obj = {};
|
|
303
308
|
for(let [key, value] of formData){
|
|
304
309
|
if(obj[key] !== undefined){
|
|
305
|
-
if(!
|
|
310
|
+
if(!this.isArray(obj[key])){
|
|
306
311
|
obj[key] = [obj[key]];
|
|
307
312
|
}
|
|
308
313
|
obj[key].push(value);
|
|
@@ -458,6 +463,22 @@ class Shortcuts
|
|
|
458
463
|
.replace(/vbscript:/gi, '');
|
|
459
464
|
}
|
|
460
465
|
|
|
466
|
+
camelCase(str)
|
|
467
|
+
{
|
|
468
|
+
return str.replace(/[_\s]+(.)?/g, (_, c) => c ? c.toUpperCase() : '');
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
capitalizedCamelCase(str)
|
|
472
|
+
{
|
|
473
|
+
let camelStr = this.camelCase(str);
|
|
474
|
+
return camelStr.charAt(0).toUpperCase() + camelStr.slice(1);
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
kebabCase(str)
|
|
478
|
+
{
|
|
479
|
+
return str.replace(/[_\s]+/g, '-');
|
|
480
|
+
}
|
|
481
|
+
|
|
461
482
|
}
|
|
462
483
|
|
|
463
484
|
module.exports = new Shortcuts();
|