Skip to content

Commit 367be7e

Browse files
committed
Merge pull request g00fy-#253 from jharting/pickerUpdate-regexp
pickerUpdate event - make it possible to use RegExp to target specifi…
2 parents 73249bd + 1b9f368 commit 367be7e

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

app/scripts/datePickerUtils.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,9 +221,19 @@ angular.module('datePicker').factory('datePickerUtils', function () {
221221

222222
return result;
223223
},
224+
//Checks if an event targeted at a specific picker, via either a string name, or an array of strings.
224225
eventIsForPicker: function (targetIDs, pickerID) {
225-
//Checks if an event targeted at a specific picker, via either a string name, or an array of strings.
226-
return (angular.isArray(targetIDs) && targetIDs.indexOf(pickerID) > -1 || targetIDs === pickerID);
226+
function matches(id) {
227+
if (id instanceof RegExp) {
228+
return id.test(pickerID);
229+
}
230+
return id === pickerID;
231+
}
232+
233+
if (angular.isArray(targetIDs)) {
234+
return targetIDs.some(matches);
235+
}
236+
return matches(targetIDs);
227237
}
228238
};
229239
});

0 commit comments

Comments
 (0)