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
ilog-0.4.0 node_modules/buffer/test/node/test-buffer-iterator.js
ilog-0.3.3 node_modules/buffer/test/node/test-buffer-iterator.js
sumomo-0.8.7 data/sumomo/api_modules/node_modules/buffer/test/node/test-buffer-iterator.js
sumomo-0.8.6 data/sumomo/api_modules/node_modules/buffer/test/node/test-buffer-iterator.js
jester-data-8.0.0 node_modules/buffer/test/node/test-buffer-iterator.js
ezii-os-5.2.1 node_modules/buffer/test/node/test-buffer-iterator.js
ezii-os-2.0.1 node_modules/buffer/test/node/test-buffer-iterator.js
ezii-os-1.1.0 node_modules/buffer/test/node/test-buffer-iterator.js
ezii-os-1.0.0 node_modules/buffer/test/node/test-buffer-iterator.js
ezii-os-0.0.0.1.0 node_modules/buffer/test/node/test-buffer-iterator.js
ezii-os-0.0.0.0.1 node_modules/buffer/test/node/test-buffer-iterator.js
optimacms-0.4.3 spec/dummy/node_modules/buffer/test/node/test-buffer-iterator.js
optimacms-0.4.2 spec/dummy/node_modules/buffer/test/node/test-buffer-iterator.js
locomotivecms-4.0.0.alpha1 app/javascript/node_modules/buffer/test/node/test-buffer-iterator.js
sumomo-0.8.4 data/sumomo/api_modules/node_modules/buffer/test/node/test-buffer-iterator.js
locomotivecms-3.4.0 app/javascript/node_modules/buffer/test/node/test-buffer-iterator.js
cortex-0.1.3 spec/dummy/node_modules/buffer/test/node/test-buffer-iterator.js
sumomo-0.8.3 data/sumomo/api_modules/node_modules/buffer/test/node/test-buffer-iterator.js
sumomo-0.8.2 data/sumomo/api_modules/node_modules/buffer/test/node/test-buffer-iterator.js
sumomo-0.8.1 data/sumomo/api_modules/node_modules/buffer/test/node/test-buffer-iterator.js