| 1 |
/* |
| 2 |
Funciton Type: Array Function |
| 3 |
Usage: Helps to clone an item next to it. |
| 4 |
*/ |
| 5 |
if (typeof Array.prototype.pushAfter === "undefined") { |
| 6 |
Array.prototype.pushAfter = function(index, item) { |
| 7 |
var deepClone = JSON.parse(JSON.stringify(item)); |
| 8 |
this.splice(index + 1, 0, deepClone); |
| 9 |
}; |
| 10 |
} |
| 11 |
|
| 12 |
if (typeof String.prototype.ucFirst === "undefined") { |
| 13 |
String.prototype.ucFirst = function() { |
| 14 |
return this.charAt(0).toUpperCase() + this.slice(1); |
| 15 |
} |
| 16 |
} |
| 17 |
|
| 18 |
if (typeof String.prototype.ucWords === "undefined") { |
| 19 |
String.prototype.ucWords = function() { |
| 20 |
return this.split(' ').map(word => { |
| 21 |
return word.charAt(0).toUpperCase() + word.slice(1) |
| 22 |
}).join(' '); |
| 23 |
} |
| 24 |
} |
| 25 |
|
| 26 |
// import lodash methods |
| 27 |
// and assign it as prefixed property to window object |
| 28 |
window._ff = { |
| 29 |
includes: require('lodash/includes'), |
| 30 |
startCase: require('lodash/startCase'), |
| 31 |
map: require('lodash/map'), |
| 32 |
each: require('lodash/each'), |
| 33 |
chunk: require('lodash/chunk'), |
| 34 |
has: require('lodash/has'), |
| 35 |
snakeCase: require('lodash/snakeCase'), |
| 36 |
cloneDeep: require('lodash/cloneDeep'), |
| 37 |
filter: require('lodash/filter'), |
| 38 |
isEmpty: require('lodash/isEmpty'), |
| 39 |
unique: (value, index, self) => self.indexOf(value) === index |
| 40 |
}; |
| 41 |
|