diff options
Diffstat (limited to 'bower_components/moment/src/lib/parse')
| -rw-r--r-- | bower_components/moment/src/lib/parse/regex.js | 9 |
1 files changed, 8 insertions, 1 deletions
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; }; } |
