Sha256: 2b7df5129910fdb7d18b9ed821caed730e1ed845a3f62520e81075021c1a0c8f

Contents?: true

Size: 745 Bytes

Versions: 35

Compression:

Stored size: 745 Bytes

Contents

var flatten = require('./index'),
    util = require('util'),
    assert = require('assert');

[
  [ [1, [ 2, 3]], [1, [2, 3]], 0],
  [ [1, 2, 3 ], [1, 2, 3] ],
  [ ['a', ['b', ['c']]], ['a', 'b', 'c'] ],
  [ [2, [4, 6], 8, [[10]]], [2, 4, 6, 8, 10] ],
  [ [1, [2, [3, [4, [5]]]]], [1, 2, 3, [4, [5]]], 2 ] // depth of 2
].forEach(function (t) {
  assert.deepEqual(flatten(t[0], t[2]), t[1], 
    util.format('☠☠☠☠☠☠☠☠☠ %s ☠☠☠☠☠☠☠☠☠', formatCall(t))
  );
  console.log('✓ %s', formatCall(t));
});

function formatCall(t) {
  if (typeof t[2] === 'undefined') {
    return util.format('`flatten(%j) == %j`', t[0], t[1]);
  }
  else {
    return util.format('`flatten(%j, %j) == %j`', t[0], t[2], t[1]);
  }
}

Version data entries

35 entries across 34 versions & 12 rubygems

Version Path
optimacms-0.1.61 spec/dummy/node_modules/flatten/test.js
disco_app-0.18.0 test/dummy/node_modules/flatten/test.js
disco_app-0.18.2 test/dummy/node_modules/flatten/test.js
disco_app-0.16.1 test/dummy/node_modules/flatten/test.js
disco_app-0.15.2 test/dummy/node_modules/flatten/test.js
disco_app-0.18.4 test/dummy/node_modules/flatten/test.js
disco_app-0.18.1 test/dummy/node_modules/flatten/test.js
disco_app-0.12.7.pre.puma.pre.3 test/dummy/node_modules/flatten/test.js
disco_app-0.14.0 test/dummy/node_modules/flatten/test.js
disco_app-0.13.6.pre.puma.pre.3 test/dummy/node_modules/flatten/test.js
tang-0.2.1 spec/tang_app/node_modules/flatten/test.js
groonga-client-model-6.0.0 test/apps/rails6.0.3.5/node_modules/flatten/test.js
groonga-client-model-6.0.0 test/apps/rails6.1.3/node_modules/flatten/test.js
ruby2js-4.0.4 lib/tasks/testrails/node_modules/flatten/test.js
ruby2js-4.0.3 lib/tasks/testrails/node_modules/flatten/test.js
tang-0.2.0 spec/tang_app/node_modules/flatten/test.js
tang-0.1.0 spec/tang_app/node_modules/flatten/test.js
tang-0.0.9 spec/tang_app/node_modules/flatten/test.js
enju_library-0.3.8 spec/dummy/node_modules/flatten/test.js
ilog-0.4.1 node_modules/flatten/test.js