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

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

There is a newer version: 1.1.2
Show 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