{"size": 636, "ext": "js", "max_stars_repo_path": "tests/main.test.js", "max_stars_repo_name": "iamnapo/average", "max_stars_repo_stars_event_min_datetime": "2021-06-29T20:11:57.000Z", "max_stars_repo_stars_event_max_datetime": "2021-06-29T20:11:57.000Z", "max_issues_repo_path": "tests/main.test.js", "max_issues_repo_name": "iamnapo/average", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "tests/main.test.js", "max_forks_repo_name": "iamnapo/average", "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": 39.75, "max_line_length": 115, "alphanum_fraction": 0.5644654088}
import test from "ava";

import average from "../index.js";

test("main", (t) => {
	t.is(average([0, 1, 2, 3, 4, 5]), 2.5);
	t.is(average([0, 1, 2, 3, 4, 5], { excludeZeroes: true }), 3);
	t.is(average([0, 1, 2, 3, 4, 5], { excludeFalsies: true }), 3);
	t.is(average([0, 1, 2, Number.NaN, undefined]), Number.NaN);
	t.is(average([0, 1, 2, Number.NaN, undefined], { excludeZeroes: true }), Number.NaN);
	t.is(average([0, 1, 2, Number.NaN, undefined], { excludeFalsies: true }), 1.5);
	t.is(average([{ name: "iamnapo", age: 28 }, { age: 28 }, { name: "Alice", age: 25 }], { get: (v) => v.age }), 27);
	t.is(average([]), Number.NaN);
});

