{"id":15497386,"url":"https://github.com/heapwolf/yl","last_synced_at":"2025-04-22T22:27:29.422Z","repository":{"id":18873543,"uuid":"22090673","full_name":"heapwolf/yl","owner":"heapwolf","description":"A tiny flow control module that destructures.","archived":false,"fork":false,"pushed_at":"2016-06-15T03:27:00.000Z","size":9,"stargazers_count":22,"open_issues_count":1,"forks_count":5,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-19T12:45:38.705Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/heapwolf.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-07-22T04:26:35.000Z","updated_at":"2021-06-14T02:59:30.000Z","dependencies_parsed_at":"2022-07-23T01:46:28.697Z","dependency_job_id":null,"html_url":"https://github.com/heapwolf/yl","commit_stats":null,"previous_names":["hij1nx/yl"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heapwolf%2Fyl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heapwolf%2Fyl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heapwolf%2Fyl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heapwolf%2Fyl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/heapwolf","download_url":"https://codeload.github.com/heapwolf/yl/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250333372,"owners_count":21413365,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-02T08:33:18.052Z","updated_at":"2025-04-22T22:27:29.406Z","avatar_url":"https://github.com/heapwolf.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SYNOPSIS\nA tiny flow control module that destructures.\n\n# CODE\n\n```js\nmodule.exports = f =\u003e {\n\n  if (!f.prototype.throw) return function() {\n    const args = Array.from(arguments)\n    return f.bind.apply(f, [null, ...args])\n  }\n\n  const gen = f()\n\n  ~function nextCallback() {\n    const next = gen.next(Array.from(arguments))\n    if (!next.done) next.value(nextCallback)\n  }()\n}\n```\n\n# EXAMPLE\n\n```js\nconst { run, wrap } = require('yl')\nconst fs = require('fs')\nconst assert = require('assert')\n\nrun(function* () {\n\n  const [statError, s] = yield wrap(fs.stat)('./index.js')\n\n  if (statError) return console.error(statError)\n\n  const [readError, f] = yield wrap(fs.readFile)('./index.js')\n\n  assert.equal(f.length, s.size)\n})\n```\n\nOr you could wrap everything initially...\n\n```js\nconst { run, wrap } = require('yl')\nconst fs = wrap(require('fs'))\nconst assert = require('assert')\n\nrun(function* () {\n\n  const [statError, s] = yield fs.stat('./index.js')\n  const [readError, f] = yield fs.readFile('./index.js')\n\n  assert.equal(f.length, s.size)\n})\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fheapwolf%2Fyl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fheapwolf%2Fyl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fheapwolf%2Fyl/lists"}