/
ng-gc-utils.js
45 lines (42 loc) · 1001 Bytes
/
ng-gc-utils.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
'use strict';
angular.module('gc.utils', [
'gc.utils.arrayOperations',
'gc.utils.emptyObject',
'gc.utils.mixin',
'gc.utils.throttle',
'gc.utils.debounce',
'gc.utils.param',
'gc.utils.getFormattedDateTime',
'gc.utils.validDateFormat',
'gc.utils.addToFixed',
'gc.utils.getStartAt',
'gc.utils.getEarliestStartAt',
'gc.utils.getStartAtAfterToday'
]).factory('utils', [
'arrayOperations',
'emptyObject',
'mixin',
'throttle',
'debounce',
'param',
'getFormattedDateTime',
'validDateFormat',
'addToFixed',
'getStartAt',
'getEarliestStartAt',
'getStartAtAfterToday',
function utilsService() {
var utils = {};
var slice = Array.prototype.slice;
slice.call(arguments).forEach(function(arg) {
Object.keys(arg).forEach(function(key) {
if (utils[key]) {
throw new Error('util function "' + key + '" is already defined');
} else {
utils[key] = arg[key];
}
});
});
return utils;
}
]);