]> git.ipfire.org Git - thirdparty/moment.git/commitdiff
Use isFunction instead of === 'function'
authorIskren Chernev <iskren.chernev@gmail.com>
Mon, 9 Nov 2015 05:25:31 +0000 (21:25 -0800)
committerIskren Chernev <iskren.chernev@gmail.com>
Mon, 9 Nov 2015 05:29:28 +0000 (21:29 -0800)
src/lib/moment/calendar.js

index 6480c862ebfd4fce18b720ec59ced8b639f89c69..bc5092ca88ed9780b5f6bd661f36596311efaa6b 100644 (file)
@@ -1,5 +1,6 @@
 import { createLocal } from '../create/local';
 import { cloneWithOffset } from '../units/offset';
+import isFunction from '../utils/is-function';
 
 export function calendar (time, formats) {
     // We want to compare the start of today, vs this.
@@ -14,7 +15,7 @@ export function calendar (time, formats) {
             diff < 2 ? 'nextDay' :
             diff < 7 ? 'nextWeek' : 'sameElse';
 
-    var output = formats && (typeof formats[format] === 'function' ? formats[format]() : formats[format]);
+    var output = formats && (isFunction(formats[format]) ? formats[format]() : formats[format]);
 
     return this.format(output || this.localeData().calendar(format, this, createLocal(now)));
 }