From: Kunal Marwaha Date: Tue, 10 Jan 2017 15:49:38 +0000 (-0500) Subject: Use isFunction instead of instanceof Function X-Git-Tag: 2.18.0~33^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1f8efb4e237bebbe17edaab4208f10de4f2416f4;p=thirdparty%2Fmoment.git Use isFunction instead of instanceof Function --- diff --git a/src/lib/format/format.js b/src/lib/format/format.js index 33486f1d5..03f5c584f 100644 --- a/src/lib/format/format.js +++ b/src/lib/format/format.js @@ -1,4 +1,5 @@ import zeroFill from '../utils/zero-fill'; +import isFunction from '../utils/is-function'; export var formattingTokens = /(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g; @@ -55,7 +56,7 @@ function makeFormatFunction(format) { return function (mom) { var output = '', i; for (i = 0; i < length; i++) { - output += array[i] instanceof Function ? array[i].call(mom, format) : array[i]; + output += isFunction(array[i]) ? array[i].call(mom, format) : array[i]; } return output; };