esnext.iterator.dispose.js 680 B

1234567891011121314151617
  1. 'use strict';
  2. // https://github.com/tc39/proposal-explicit-resource-management
  3. var call = require('../internals/function-call');
  4. var defineBuiltIn = require('../internals/define-built-in');
  5. var getMethod = require('../internals/get-method');
  6. var hasOwn = require('../internals/has-own-property');
  7. var wellKnownSymbol = require('../internals/well-known-symbol');
  8. var IteratorPrototype = require('../internals/iterators-core').IteratorPrototype;
  9. var DISPOSE = wellKnownSymbol('dispose');
  10. if (!hasOwn(IteratorPrototype, DISPOSE)) {
  11. defineBuiltIn(IteratorPrototype, DISPOSE, function () {
  12. var $return = getMethod(this, 'return');
  13. if ($return) call($return, this);
  14. });
  15. }