Sha256: eefa8e0375235f80cf17bb2a1d4fb39482310c05fa78f47e4fcaa0f22581a055

Contents?: true

Size: 925 Bytes

Versions: 72

Compression:

Stored size: 925 Bytes

Contents

'use strict';
var Buffer = require('../../').Buffer;


var assert = require('assert');

var buffer = Buffer.from([1, 2, 3, 4, 5]);
var arr;
var b;

// buffers should be iterable

arr = [];

for (b of buffer)
  arr.push(b);

assert.deepStrictEqual(arr, [1, 2, 3, 4, 5]);


// buffer iterators should be iterable

arr = [];

for (b of buffer[Symbol.iterator]())
  arr.push(b);

assert.deepStrictEqual(arr, [1, 2, 3, 4, 5]);


// buffer#values() should return iterator for values

arr = [];

for (b of buffer.values())
  arr.push(b);

assert.deepStrictEqual(arr, [1, 2, 3, 4, 5]);


// buffer#keys() should return iterator for keys

arr = [];

for (b of buffer.keys())
  arr.push(b);

assert.deepStrictEqual(arr, [0, 1, 2, 3, 4]);


// buffer#entries() should return iterator for entries

arr = [];

for (b of buffer.entries())
  arr.push(b);

assert.deepStrictEqual(arr, [
  [0, 1],
  [1, 2],
  [2, 3],
  [3, 4],
  [4, 5]
]);

Version data entries

72 entries across 71 versions & 15 rubygems

Version Path
sumomo-0.10.8 data/sumomo/api_modules/node_modules/buffer/test/node/test-buffer-iterator.js
optimacms-0.1.61 spec/dummy/node_modules/buffer/test/node/test-buffer-iterator.js
sumomo-0.10.4 data/sumomo/api_modules/node_modules/buffer/test/node/test-buffer-iterator.js
sumomo-0.10.3 data/sumomo/api_modules/node_modules/buffer/test/node/test-buffer-iterator.js
sumomo-0.10.2 data/sumomo/api_modules/node_modules/buffer/test/node/test-buffer-iterator.js
sumomo-0.10.1 data/sumomo/api_modules/node_modules/buffer/test/node/test-buffer-iterator.js
sumomo-0.10.0 data/sumomo/api_modules/node_modules/buffer/test/node/test-buffer-iterator.js
sumomo-0.9.0 data/sumomo/api_modules/node_modules/buffer/test/node/test-buffer-iterator.js
sumomo-0.8.22 data/sumomo/api_modules/node_modules/buffer/test/node/test-buffer-iterator.js
sumomo-0.8.21 data/sumomo/api_modules/node_modules/buffer/test/node/test-buffer-iterator.js
sumomo-0.8.20 data/sumomo/api_modules/node_modules/buffer/test/node/test-buffer-iterator.js
sumomo-0.8.17 data/sumomo/api_modules/node_modules/buffer/test/node/test-buffer-iterator.js
sumomo-0.8.16 data/sumomo/api_modules/node_modules/buffer/test/node/test-buffer-iterator.js
disco_app-0.18.0 test/dummy/node_modules/buffer/test/node/test-buffer-iterator.js
disco_app-0.18.2 test/dummy/node_modules/buffer/test/node/test-buffer-iterator.js
sumomo-0.8.15 data/sumomo/api_modules/node_modules/buffer/test/node/test-buffer-iterator.js
disco_app-0.16.1 test/dummy/node_modules/buffer/test/node/test-buffer-iterator.js
sumomo-0.8.14 data/sumomo/api_modules/node_modules/buffer/test/node/test-buffer-iterator.js
sumomo-0.8.13 data/sumomo/api_modules/node_modules/buffer/test/node/test-buffer-iterator.js
disco_app-0.15.2 test/dummy/node_modules/buffer/test/node/test-buffer-iterator.js