{"size": 380, "ext": "js", "max_stars_repo_path": "test.js", "max_stars_repo_name": "sindresorhus/lazy-value", "max_stars_repo_stars_event_min_datetime": "2017-01-15T14:30:52.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-10T22:14:55.000Z", "max_issues_repo_path": "test.js", "max_issues_repo_name": "sindresorhus/lazy-value", "max_issues_repo_issues_event_min_datetime": "2018-08-06T07:16:41.000Z", "max_issues_repo_issues_event_max_datetime": "2018-08-06T07:47:15.000Z", "max_forks_repo_path": "test.js", "max_forks_repo_name": "sindresorhus/lazy-value", "max_forks_repo_forks_event_min_datetime": "2017-08-16T08:51:50.000Z", "max_forks_repo_forks_event_max_datetime": "2021-06-03T09:24:58.000Z"}
{"max_stars_count": 64, "max_issues_count": 1, "max_forks_count": 5, "avg_line_length": 15.8333333333, "max_line_length": 40, "alphanum_fraction": 0.5421052632}
import test from 'ava';
import lazyValue from './index.js';

test('main', t => {
	let index = 0;
	const value = lazyValue(() => ++index);
	t.is(value(), 1);
	t.is(value(), 1);
	t.is(value(), 1);
});

test('works with `null`', t => {
	let index = 0;

	const value = lazyValue(() => {
		index++;
		return null;
	});

	t.is(value(), null);
	t.is(value(), null);
	t.is(index, 1);
});
