
Security News
CVE Volume Surges Past 48,000 in 2025 as WordPress Plugin Ecosystem Drives Growth
CVE disclosures hit a record 48,185 in 2025, driven largely by vulnerabilities in third-party WordPress plugins.
A small helper for getting only the last result of an asynchronous operation you perform multiple times in a row.
Pretty commonly, when performing asynchronous operations, you might fire off multiple of them, but then only care about the last result that comes back. A common example is searching:
$(searchEl).on("input", function (ev) {
doSearch(searchEl.value).then(updateUIWithResults).done();
});
But consider this scenario:
This isn't what you wanted! Once you sent off the search for "dog," you want to ignore any results from the previous search for "do."
Well, this package will solve your problems.
This package's main module has as its default export a single function, last, which you can use to wrap naïve
functions into smart ones that will ignore all but the last result. It works with any function that returns a
Promises/A+-compliant promise. Once you do that, your code can look just as pretty as the
above example, but this time it will actually be correct!
var last = require("last");
var smartSearch = last(doSearch);
$(searchEl).on("input", function (ev) {
smartSearch(searchEl.value).then(updateUIWithResults).done();
});
The wrapped function will return a promise of the same type as that returned by the original. And once you call the wrapped function again, you will be guaranteed that previously-returned pending promises stay pending forever, so you don't have to worry about them coming back later than your new promise.
FAQs
A small helper for getting only the last result of an asynchronous operation you perform multiple times in a row.
We found that last demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
CVE disclosures hit a record 48,185 in 2025, driven largely by vulnerabilities in third-party WordPress plugins.

Security News
Socket CEO Feross Aboukhadijeh joins Insecure Agents to discuss CVE remediation and why supply chain attacks require a different security approach.

Security News
Tailwind Labs laid off 75% of its engineering team after revenue dropped 80%, as LLMs redirect traffic away from documentation where developers discover paid products.