New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@antoniovdlc/defer

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@antoniovdlc/defer - npm Package Compare versions

Comparing version 0.1.1 to 0.1.2

2

package.json
{
"name": "@antoniovdlc/defer",
"version": "0.1.1",
"version": "0.1.2",
"description": "Go-like defer functions in JavaScript.",

@@ -5,0 +5,0 @@ "main": "dist/index.cjs.js",

@@ -54,3 +54,3 @@ # defer

For sync functions, `defer` simply puts the `fn` at the bottom of the call stack using `setTimeout(fn, 0)`.
For sync functions, `defer` simply puts the `fn` on the call stack using `setTimeout(fn, 0)`.
For async functions, it is a bit more tricky, and we keep track of deferred functions within the `caller` itself, via the property `__$_deferArr`.

@@ -64,2 +64,7 @@ > Using `defer` in async functions requires them to be wrapper with `deferrable` to work properly.

`defer`red functions are run sequentially, and as such, if one function throws an error, the following `defer`red functions won't run.
`defer`red functions in a `deferrable` will not run if the wrapped function throws an error.
## Examples

@@ -70,3 +75,3 @@

function main() {
defer(() => console.log("world");
defer(() => console.log("world"), main);
console.log("hello");

@@ -81,6 +86,6 @@ }

function f() {
defer(() => console.log("1), f);
defer(() => console.log("1"), f);
console.log("2");
defer(() => console.log("3"), f);
console.log("4")
console.log("4");
}

@@ -101,3 +106,3 @@

defer(() => console.log("3"), fn);
console.log("4")
console.log("4");
});

@@ -104,0 +109,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc