Skip to content
This repository was archived by the owner on Sep 8, 2020. It is now read-only.

Commit 19737e9

Browse files
committed
default to empty array so reduce doesnt fail
1 parent e5ce331 commit 19737e9

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/calendar.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ angular.module('ui.calendar', [])
108108
var self;
109109

110110
var getTokens = function () {
111-
return (angular.isFunction(arraySource) ? arraySource() : arraySource).reduce(
111+
return ((angular.isFunction(arraySource) ? arraySource() : arraySource) || []).reduce(
112112
function (rslt, el) {
113113
var token = tokenFn(el);
114114
map[token] = el;
@@ -207,7 +207,7 @@ angular.module('ui.calendar', [])
207207
// Configure to use locale names by default
208208
var tValues = function (data) {
209209
// convert {0: "Jan", 1: "Feb", ...} to ["Jan", "Feb", ...]
210-
return Object.keys(data).reduce(
210+
return (Object.keys(data) || []).reduce(
211211
function (rslt, el) {
212212
rslt[el] = data[el];
213213
return rslt;

0 commit comments

Comments
 (0)