All Downloads are FREE. Search and download functionalities are using the official Maven repository.

node_modules.p-finally.index.js Maven / Gradle / Ivy

The newest version!
'use strict';
module.exports = (promise, onFinally) => {
	onFinally = onFinally || (() => {});

	return promise.then(
		val => new Promise(resolve => {
			resolve(onFinally());
		}).then(() => val),
		err => new Promise(resolve => {
			resolve(onFinally());
		}).then(() => {
			throw err;
		})
	);
};




© 2015 - 2024 Weber Informatics LLC | Privacy Policy