]> git.ipfire.org Git - thirdparty/moment.git/commitdiff
Use isFunction instead of instanceof Function
authorKunal Marwaha <marwahaha@berkeley.edu>
Tue, 10 Jan 2017 15:49:38 +0000 (10:49 -0500)
committerIskren Chernev <iskren.chernev@gmail.com>
Thu, 2 Mar 2017 09:38:24 +0000 (11:38 +0200)
src/lib/format/format.js

index 33486f1d566d6712869e84fc4bc7a3de16d97b1a..03f5c584fc0b074c12bf8aa7ecbced54d9dc0c2e 100644 (file)
@@ -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;
     };