@@ -6,6 +6,7 @@ import bind from './helpers/bind.js';
66
77const { toString} = Object . prototype ;
88const { getPrototypeOf} = Object ;
9+ const { iterator, toStringTag} = Symbol ;
910
1011const kindOf = ( cache => thing => {
1112 const str = toString . call ( thing ) ;
@@ -132,7 +133,7 @@ const isPlainObject = (val) => {
132133 }
133134
134135 const prototype = getPrototypeOf ( val ) ;
135- return ( prototype === null || prototype === Object . prototype || Object . getPrototypeOf ( prototype ) === null ) && ! ( Symbol . toStringTag in val ) && ! ( Symbol . iterator in val ) ;
136+ return ( prototype === null || prototype === Object . prototype || Object . getPrototypeOf ( prototype ) === null ) && ! ( toStringTag in val ) && ! ( iterator in val ) ;
136137}
137138
138139/**
@@ -483,13 +484,13 @@ const isTypedArray = (TypedArray => {
483484 * @returns {void }
484485 */
485486const forEachEntry = ( obj , fn ) => {
486- const generator = obj && obj [ Symbol . iterator ] ;
487+ const generator = obj && obj [ iterator ] ;
487488
488- const iterator = generator . call ( obj ) ;
489+ const _iterator = generator . call ( obj ) ;
489490
490491 let result ;
491492
492- while ( ( result = iterator . next ( ) ) && ! result . done ) {
493+ while ( ( result = _iterator . next ( ) ) && ! result . done ) {
493494 const pair = result . value ;
494495 fn . call ( obj , pair [ 0 ] , pair [ 1 ] ) ;
495496 }
@@ -610,7 +611,7 @@ const toFiniteNumber = (value, defaultValue) => {
610611 * @returns {boolean }
611612 */
612613function isSpecCompliantForm ( thing ) {
613- return ! ! ( thing && isFunction ( thing . append ) && thing [ Symbol . toStringTag ] === 'FormData' && thing [ Symbol . iterator ] ) ;
614+ return ! ! ( thing && isFunction ( thing . append ) && thing [ toStringTag ] === 'FormData' && thing [ iterator ] ) ;
614615}
615616
616617const toJSONObject = ( obj ) => {
@@ -679,6 +680,10 @@ const asap = typeof queueMicrotask !== 'undefined' ?
679680
680681// *********************
681682
683+
684+ const isIterable = ( thing ) => thing != null && isFunction ( thing [ iterator ] ) ;
685+
686+
682687export default {
683688 isArray,
684689 isArrayBuffer,
@@ -734,5 +739,6 @@ export default {
734739 isAsyncFn,
735740 isThenable,
736741 setImmediate : _setImmediate ,
737- asap
742+ asap,
743+ isIterable
738744} ;
0 commit comments