lib/index.js
function delay(millis, obj) {
	return new Promise((resolve, reject) => {

		let resolveImpl = d => {
			if (d === null || d === undefined) {
				resolve(d)
			} else if (d instanceof Promise || typeof d.then === 'function' && typeof d.catch === 'function') {
				d.then(resolve).catch(reject)
			} else if (typeof d === 'function') {
				resolveImpl(d())
			} else {
				resolve(d)
			}
		}
		setTimeout(() => resolveImpl(obj), millis)
	})
}
function delay(millis, obj) {
	return new Promise((resolve, reject) => {

		let resolveImpl = d => {
			if (d === null || d === undefined) {
				resolve(d)
			} else if (d instanceof Promise || typeof d.then === 'function' && typeof d.catch === 'function') {
				d.then(resolve).catch(reject)
			} else if (typeof d === 'function') {
				resolveImpl(d())
			} else {
				resolve(d)
			}
		}
		setTimeout(() => resolveImpl(obj), millis)
	})
}
function delay ( millis , obj ) { return new Promise ( ( resolve , reject ) => { let resolveImpl = d => { if ( d === null || d === undefined ) { resolve ( d ) } else if ( d instanceof Promise || typeof d . then === 'function' && typeof d . catch === 'function' ) { d . then ( resolve ) . catch ( reject ) } else if ( typeof d === 'function' ) { resolveImpl ( d ( ) ) } else { resolve ( d ) } } setTimeout ( ( ) => resolveImpl ( obj ) , millis ) } ) }
Return a promise which resolves the provided data after specified delay.

@param    {number}	millis - Delay before resolving of the promise
@param    {promise|function|object}	obj - If promise, it will be resolved/rejected in a delayed manner; if function, it's return value will be resolved. Otherwise the obj is resolved directly.

@return {Promise} - A promise that resolves after millis delay
Return a promise which resolves the provided data after specified delay .