Socket
Socket
Sign inDemoInstall

yq

Package Overview
Dependencies
0
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    yq

Anthor async control flow by generator without promise.


Version published
Weekly downloads
193
increased by37.86%
Maintainers
1
Install size
6.34 kB
Created
Weekly downloads
 

Readme

Source

yq

Anthor async control flow by generator without promise.

No Promise

const yq = require('yq')
const fs = require('fs')

let readFile = function *() {
  var caller = yield
  fs.readFile('example', { encoding: 'utf-8' }, function (err, content) {
    if (err) {
      caller.error(err)
    } else {
      caller.success(content)
    }
  })
}

Yield

const yq = require('yq')
const readFile = yq.yield(require('fs').readFile)

yq(function *() {
  var content = yield readFile('example', { encoding: 'utf-8' })
  console.log(content) // ...
})

Keywords

FAQs

Last updated on 24 Mar 2015

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc