1.0.1 • Published 1 year ago

@public-function/unique-promise v1.0.1

Weekly downloads
-
License
MIT
Repository
-
Last release
1 year ago

Unique Promise

NPM Version NPM Install Size

A typical use case would be some express routes that resolve database queries that should only be called once and respond with the same result to all requests.

import uniquePromise from '@public-function/unqiue-promise';

const executeLongRunningFunction = async () => {
    // is only called once
}

const results = await Promise.all([
    uniquePromise('some-id', executeLongRunningFunction),
    uniquePromise('some-id', executeLongRunningFunction),
]);
1.0.1

1 year ago

1.0.0

1 year ago

0.1.0

1 year ago