{"size": 598, "ext": "js", "max_stars_repo_path": "test/array/fill.js", "max_stars_repo_name": "kasperisager/bundstreg", "max_stars_repo_stars_event_min_datetime": "2016-03-24T18:18:57.000Z", "max_stars_repo_stars_event_max_datetime": "2016-03-24T18:18:57.000Z", "max_issues_repo_path": "test/array/fill.js", "max_issues_repo_name": "kasperisager/bundstreg", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "test/array/fill.js", "max_forks_repo_name": "kasperisager/bundstreg", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 1, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 29.9, "max_line_length": 71, "alphanum_fraction": 0.5050167224}
import test from 'ava';
import {fill} from '../../lib/array/fill';

test('fill()', async t => {
  const a = [1, 2, 3, 4];

  t.deepEqual(fill(a, 5), [5, 5, 5, 5]);
  t.deepEqual(fill(a, 5, 2), [1, 2, 5, 5]);
  t.deepEqual(fill(a, 5, -1), [1, 2, 3, 5]);
  t.deepEqual(fill(a, 5, 1, 3), [1, 5, 5, 4]);
  t.deepEqual(fill(a, 5, 1, 5), [1, 5, 5, 5]);
  t.deepEqual(fill(a, 5, -5, 3), [5, 5, 5, 4]);
  t.deepEqual(fill(a, 5, 3, 1), [1, 2, 3, 4]);
  t.deepEqual(fill(a, 5, 1, -2), [1, 5, 3, 4]);
});

test('fill() returns an empty array if no array is given', async t => {
  t.deepEqual(fill(), []);
});
