'use strict';
module.exports = function (ms) {
	ms = ms || 0;

	var promise = new Promise(function (resolve) {
		setTimeout(resolve, ms);
	});

	function thunk(result) {
		return new Promise(function (resolve) {
			setTimeout(function () {
				resolve(result);
			}, ms);
		});
	}

	thunk.then = promise.then.bind(promise);

	return thunk;
};

'use strict';
module.exports = function (ms) {
	ms = ms || 0;

	var promise = new Promise(function (resolve) {
		setTimeout(resolve, ms);
	});

	function thunk(result) {
		return new Promise(function (resolve) {
			setTimeout(function () {
				resolve(result);
			}, ms);
		});
	}

	thunk.then = promise.then.bind(promise);
	thunk.catch = promise.catch.bind(promise);

	return thunk;
};

Make the thunk more Promise-like.
Make the thunk more Promise-like.

It's a lot more useful if you have `.catch`, otherwise you can't use it as a promise.
