Sha256: 22968bccf55914dcc6ffbff6beb99a5b30cae323e4f932461f5b17c175a6b06b

Contents?: true

Size: 767 Bytes

Versions: 13

Compression:

Stored size: 767 Bytes

Contents

'use strict';
// https://github.com/tc39/proposal-iterator-helpers
var $ = require('../internals/export');
var anObject = require('../internals/an-object');
var toPositiveInteger = require('../internals/to-positive-integer');
var createIteratorProxy = require('../internals/iterator-create-proxy');

var IteratorProxy = createIteratorProxy(function (arg) {
  if (!this.remaining--) {
    this.done = true;
    return;
  }
  var result = anObject(this.next.call(this.iterator, arg));
  var done = this.done = !!result.done;
  if (!done) return result.value;
});

$({ target: 'Iterator', proto: true, real: true }, {
  take: function take(limit) {
    return new IteratorProxy({
      iterator: anObject(this),
      remaining: toPositiveInteger(limit)
    });
  }
});

Version data entries

13 entries across 13 versions & 4 rubygems

Version Path
optimacms-0.1.61 spec/dummy/node_modules/core-js/modules/esnext.iterator.take.js
tang-0.2.1 spec/tang_app/node_modules/core-js/modules/esnext.iterator.take.js
tang-0.2.0 spec/tang_app/node_modules/core-js/modules/esnext.iterator.take.js
tang-0.1.0 spec/tang_app/node_modules/core-js/modules/esnext.iterator.take.js
tang-0.0.9 spec/tang_app/node_modules/core-js/modules/esnext.iterator.take.js
enju_library-0.3.8 spec/dummy/node_modules/core-js/modules/esnext.iterator.take.js
condenser-0.3 lib/condenser/processors/node_modules/core-js-pure/modules/esnext.iterator.take.js
condenser-0.2 lib/condenser/processors/node_modules/core-js-pure/modules/esnext.iterator.take.js
condenser-0.1 lib/condenser/processors/node_modules/core-js-pure/modules/esnext.iterator.take.js
condenser-0.0.12 lib/condenser/processors/node_modules/core-js-pure/modules/esnext.iterator.take.js
condenser-0.0.11 lib/condenser/processors/node_modules/core-js-pure/modules/esnext.iterator.take.js
condenser-0.0.10 lib/condenser/processors/node_modules/core-js-pure/modules/esnext.iterator.take.js
condenser-0.0.9 lib/condenser/processors/node_modules/core-js-pure/modules/esnext.iterator.take.js