From 8041475aab2b8efad7d2857027331bd626d26312 Mon Sep 17 00:00:00 2001 From: Agustin Henze Date: Wed, 26 Aug 2015 07:57:04 -0300 Subject: Imported Upstream version 7.6.4 --- bower_components/moment/src/lib/parse/regex.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'bower_components/moment/src/lib/parse') diff --git a/bower_components/moment/src/lib/parse/regex.js b/bower_components/moment/src/lib/parse/regex.js index 23091a0..9e7d678 100644 --- a/bower_components/moment/src/lib/parse/regex.js +++ b/bower_components/moment/src/lib/parse/regex.js @@ -22,8 +22,15 @@ import hasOwnProp from '../utils/has-own-prop'; var regexes = {}; +function isFunction (sth) { + // https://github.com/moment/moment/issues/2325 + return typeof sth === 'function' && + Object.prototype.toString.call(sth) === '[object Function]'; +} + + export function addRegexToken (token, regex, strictRegex) { - regexes[token] = typeof regex === 'function' ? regex : function (isStrict) { + regexes[token] = isFunction(regex) ? regex : function (isStrict) { return (isStrict && strictRegex) ? strictRegex : regex; }; } -- cgit v1.2.3