Socket
Socket
Sign inDemoInstall

async-to-gen

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

async-to-gen - npm Package Compare versions

Comparing version 1.0.3 to 1.0.4

2

package.json
{
"name": "async-to-gen",
"version": "1.0.3",
"version": "1.0.4",
"description": "Transform async functions to generator functions with speed and simplicity.",

@@ -5,0 +5,0 @@ "author": "Lee Byron <lee@leebyron.com> (http://leebyron.com/)",

@@ -90,2 +90,23 @@ async-to-gen

#### Async I/O
Async functions are great for writing asynchronous code that *looks* synchronous,
and that's perfect for writing code that needs to perform async I/O operations.
One of the original motivations for Node.js was [non-blocking I/O](https://www.youtube.com/watch?v=ztspvPYybIY), perfect! However its core libraries
[do not yet support Promises](https://github.com/nodejs/node/pull/5020), nor do many popular libraries written for Node 😭.
Do not fret, we can fix this with [promisify-node](https://github.com/nodegit/promisify-node)!
```js
const promisify = require('promisify-node');
const fs = promisify('fs');
async function emojify(filePath) {
const contents = await fs.readFile(filePath, 'utf8')
const edited = contents.replace(/:\)/g, '😉')
await fs.writeFile(filePath, edited, 'utf8')
}
```
#### Mocha

@@ -165,6 +186,8 @@

When `async-to-gen` transforms async functions, it does not affect the location
of lines in a file, leading to easier to understand stack traces when debugging.
When `async-to-gen` transforms async functions, it makes as few edits as
possible, and does not affect the location of lines in a file, leading to easier
to understand stack traces when debugging.
It also includes a very small (217 byte) conversion function at the bottom of the file.
It also includes a very small (217 character) conversion function at the bottom
of the file.

@@ -184,5 +207,5 @@ **Before:**

return yield x
})}
}())}
function __async(f){/* small helper function */}
function __async(g){/* small helper function */}
```

Sorry, the diff of this file is not supported yet

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