]> git.ipfire.org Git - thirdparty/moment.git/commitdiff
Fix #4072: Use indexOf util for IE8 compatibility
authorAsh Searle <ash@hexmen.com>
Fri, 21 Jul 2017 17:11:20 +0000 (18:11 +0100)
committerIskren Chernev <iskren.chernev@gmail.com>
Mon, 7 Aug 2017 19:01:51 +0000 (22:01 +0300)
src/lib/duration/valid.js

index 842585f32212f99244448465bb5a80a0c6aa7def..033fd5b0f04491f3ecaf36afea22564f527eac43 100644 (file)
@@ -1,4 +1,5 @@
 import toInt from '../utils/to-int';
+import indexOf from '../utils/index-of';
 import {Duration} from './constructor';
 import {createDuration} from './create';
 
@@ -6,7 +7,7 @@ var ordering = ['year', 'quarter', 'month', 'week', 'day', 'hour', 'minute', 'se
 
 export default function isDurationValid(m) {
     for (var key in m) {
-        if (!(ordering.indexOf(key) !== -1 && (m[key] == null || !isNaN(m[key])))) {
+        if (!(indexOf.call(ordering, key) !== -1 && (m[key] == null || !isNaN(m[key])))) {
             return false;
         }
     }