{"title":"Extract Options & Callback","name":"extract-opts","version":"4.3.0-next.1575880873.fd190477a5f30c8517ff89b49ad5b2e74ffcb812","description":"Extract the options and callback from a function's arguments easily","homepage":"https://github.com/bevry/extract-opts","license":"MIT","keywords":["opts","options","cb","callback","next","flow","args","optional","arguments","extract"],"badges":{"list":["travisci","npmversion","npmdownloads","daviddm","daviddmdev","---","githubsponsors","patreon","flattr","liberapay","buymeacoffee","opencollective","crypto","paypal","wishlist"],"config":{"githubSponsorsUsername":"balupton","buymeacoffeeUsername":"balupton","cryptoURL":"https://bevry.me/crypto","flattrUsername":"balupton","liberapayUsername":"bevry","opencollectiveUsername":"bevry","patreonUsername":"bevry","paypalURL":"https://bevry.me/paypal","wishlistURL":"https://bevry.me/wishlist","travisTLD":"com"}},"funding":"https://bevry.me/fund","author":{"name":"2013+ Bevry Pty Ltd","email":"us@bevry.me","url":"http://bevry.me"},"maintainers":[{"email":"b@lupton.cc","name":"balupton"},{"email":"us@bevry.me","name":"bevryme"}],"contributors":[{"name":"Benjamin Lupton","email":"b@lupton.cc","url":"http://balupton.com"},{"name":"Sean Fridman","email":"mail@seanfridman.com","url":"http://seanfridman.com"},{"name":"Matt Bierner","url":"http://mattbierner.com"},{"name":"dependabot-preview[bot]","url":"http://github.com/apps/dependabot-preview"}],"bugs":{"url":"https://github.com/bevry/extract-opts/issues"},"repository":{"type":"git","url":"git+https://github.com/bevry/extract-opts.git"},"engines":{"node":">=8"},"editions":[{"description":"esnext source code with require for modules","directory":"source","entry":"index.js","tags":["javascript","esnext","require"],"engines":{"node":"8 || 10 || 12","browsers":false}},{"description":"esnext compiled for browsers with require for modules","directory":"edition-browsers","entry":"index.js","tags":["javascript","require"],"engines":{"node":false,"browsers":"defaults"}}],"type":"commonjs","main":"source/index.js","browser":"edition-browsers/index.js","dependencies":{"eachr":"^4.5.0","typechecker":"^6.2.0"},"devDependencies":{"@babel/cli":"^7.7.5","@babel/core":"^7.7.5","@babel/plugin-proposal-object-rest-spread":"^7.7.4","@babel/preset-env":"^7.7.6","assert-helpers":"^5.8.0","eachr":"^4.5.0","eslint":"^6.7.2","eslint-config-bevry":"^2.2.0","eslint-config-prettier":"^6.7.0","eslint-plugin-babel":"^5.3.0","eslint-plugin-prettier":"^3.1.1","kava":"^4.3.0","prettier":"^1.19.1","projectz":"^1.15.0","valid-directory":"^1.5.0"},"scripts":{"our:clean":"rm -Rf ./docs ./edition* ./es2015 ./es5 ./out ./.next","our:compile":"npm run our:compile:edition-browsers","our:compile:edition-browsers":"env BABEL_ENV=edition-browsers babel --out-dir ./edition-browsers ./source","our:deploy":"echo no need for this project","our:meta":"npm run our:meta:projectz","our:meta:projectz":"projectz compile","our:release":"npm run our:release:prepare && npm run our:release:check-changelog && npm run our:release:check-dirty && npm run our:release:tag && npm run our:release:push","our:release:check-changelog":"cat ./HISTORY.md | grep v$npm_package_version || (echo add a changelog entry for v$npm_package_version && exit -1)","our:release:check-dirty":"git diff --exit-code","our:release:prepare":"npm run our:clean && npm run our:compile && npm run our:test && npm run our:meta","our:release:push":"git push origin master && git push origin --tags","our:release:tag":"export MESSAGE=$(cat ./HISTORY.md | sed -n \"/## v$npm_package_version/,/##/p\" | sed 's/## //' | awk 'NR>1{print buf}{buf = $0}') && test \"$MESSAGE\" || (echo 'proper changelog entry not found' && exit -1) && git tag v$npm_package_version -am \"$MESSAGE\"","our:setup":"npm run our:setup:install","our:setup:install":"npm install","our:test":"npm run our:verify && npm test","our:verify":"npm run our:verify:directory && npm run our:verify:eslint && npm run our:verify:prettier","our:verify:directory":"npx valid-directory","our:verify:eslint":"eslint --fix --ignore-pattern '**/*.d.ts' --ignore-pattern '**/vendor/' --ignore-pattern '**/node_modules/' --ext .mjs,.js,.jsx,.ts,.tsx ./source","our:verify:prettier":"prettier --write ./source/**","test":"node ./source/test.js"},"eslintConfig":{"extends":["bevry"]},"prettier":{"semi":false,"singleQuote":true},"babel":{"env":{"edition-browsers":{"sourceType":"script","presets":[["@babel/preset-env",{"targets":"defaults","modules":false}]],"plugins":["@babel/proposal-object-rest-spread"]}}},"gitHead":"fd190477a5f30c8517ff89b49ad5b2e74ffcb812","readme":"<!-- TITLE/ -->\n\n<h1>Extract Options & Callback</h1>\n\n<!-- /TITLE -->\n\n\n<!-- BADGES/ -->\n\n<span class=\"badge-travisci\"><a href=\"http://travis-ci.com/bevry/extract-opts\" title=\"Check this project's build status on TravisCI\"><img src=\"https://img.shields.io/travis/com/bevry/extract-opts/master.svg\" alt=\"Travis CI Build Status\" /></a></span>\n<span class=\"badge-npmversion\"><a href=\"https://npmjs.org/package/extract-opts\" title=\"View this project on NPM\"><img src=\"https://img.shields.io/npm/v/extract-opts.svg\" alt=\"NPM version\" /></a></span>\n<span class=\"badge-npmdownloads\"><a href=\"https://npmjs.org/package/extract-opts\" title=\"View this project on NPM\"><img src=\"https://img.shields.io/npm/dm/extract-opts.svg\" alt=\"NPM downloads\" /></a></span>\n<span class=\"badge-daviddm\"><a href=\"https://david-dm.org/bevry/extract-opts\" title=\"View the status of this project's dependencies on DavidDM\"><img src=\"https://img.shields.io/david/bevry/extract-opts.svg\" alt=\"Dependency Status\" /></a></span>\n<span class=\"badge-daviddmdev\"><a href=\"https://david-dm.org/bevry/extract-opts#info=devDependencies\" title=\"View the status of this project's development dependencies on DavidDM\"><img src=\"https://img.shields.io/david/dev/bevry/extract-opts.svg\" alt=\"Dev Dependency Status\" /></a></span>\n<br class=\"badge-separator\" />\n<span class=\"badge-githubsponsors\"><a href=\"https://github.com/sponsors/balupton\" title=\"Donate to this project using GitHub Sponsors\"><img src=\"https://img.shields.io/badge/github-donate-yellow.svg\" alt=\"GitHub Sponsors donate button\" /></a></span>\n<span class=\"badge-patreon\"><a href=\"https://patreon.com/bevry\" title=\"Donate to this project using Patreon\"><img src=\"https://img.shields.io/badge/patreon-donate-yellow.svg\" alt=\"Patreon donate button\" /></a></span>\n<span class=\"badge-flattr\"><a href=\"https://flattr.com/profile/balupton\" title=\"Donate to this project using Flattr\"><img src=\"https://img.shields.io/badge/flattr-donate-yellow.svg\" alt=\"Flattr donate button\" /></a></span>\n<span class=\"badge-liberapay\"><a href=\"https://liberapay.com/bevry\" title=\"Donate to this project using Liberapay\"><img src=\"https://img.shields.io/badge/liberapay-donate-yellow.svg\" alt=\"Liberapay donate button\" /></a></span>\n<span class=\"badge-buymeacoffee\"><a href=\"https://buymeacoffee.com/balupton\" title=\"Donate to this project using Buy Me A Coffee\"><img src=\"https://img.shields.io/badge/buy%20me%20a%20coffee-donate-yellow.svg\" alt=\"Buy Me A Coffee donate button\" /></a></span>\n<span class=\"badge-opencollective\"><a href=\"https://opencollective.com/bevry\" title=\"Donate to this project using Open Collective\"><img src=\"https://img.shields.io/badge/open%20collective-donate-yellow.svg\" alt=\"Open Collective donate button\" /></a></span>\n<span class=\"badge-crypto\"><a href=\"https://bevry.me/crypto\" title=\"Donate to this project using Cryptocurrency\"><img src=\"https://img.shields.io/badge/crypto-donate-yellow.svg\" alt=\"crypto donate button\" /></a></span>\n<span class=\"badge-paypal\"><a href=\"https://bevry.me/paypal\" title=\"Donate to this project using Paypal\"><img src=\"https://img.shields.io/badge/paypal-donate-yellow.svg\" alt=\"PayPal donate button\" /></a></span>\n<span class=\"badge-wishlist\"><a href=\"https://bevry.me/wishlist\" title=\"Buy an item on our wishlist for us\"><img src=\"https://img.shields.io/badge/wishlist-donate-yellow.svg\" alt=\"Wishlist browse button\" /></a></span>\n\n<!-- /BADGES -->\n\n\n<!-- DESCRIPTION/ -->\n\nExtract the options and callback from a function's arguments easily\n\n<!-- /DESCRIPTION -->\n\n\n<!-- INSTALL/ -->\n\n<h2>Install</h2>\n\n<a href=\"https://npmjs.com\" title=\"npm is a package manager for javascript\"><h3>npm</h3></a>\n<ul>\n<li>Install: <code>npm install --save extract-opts</code></li>\n<li>Require: <code>require('extract-opts')</code></li>\n</ul>\n\n<a href=\"https://jspm.io\" title=\"Native ES Modules CDN\"><h3>jspm</h3></a>\n\n``` html\n<script type=\"module\">\n    import * as pkg from '//dev.jspm.io/extract-opts'\n</script>\n```\n\n<h3><a href=\"https://editions.bevry.me\" title=\"Editions are the best way to produce and consume packages you care about.\">Editions</a></h3>\n\n<p>This package is published with the following editions:</p>\n\n<ul><li><code>extract-opts</code> aliases <code>extract-opts/source/index.js</code></li>\n<li><code>extract-opts/source/index.js</code> is esnext source code with require for modules</li>\n<li><code>extract-opts/edition-browsers/index.js</code> is esnext compiled for browsers with require for modules</li></ul>\n\n<!-- /INSTALL -->\n\n\n## Usage\n\n``` javascript\nvar log = console.log.bind(console)\nvar extractOptsAndCallback = require('extract-opts')\n\n// fs.readFile(filename, [options], callback)\nfunction readFile (filename, opts, next) {\n\t// Extract options and callback\n\tvar args = extractOptsAndCallback(opts, next)\n\topts = args[0]\n\tnext = args[1]\n\n\t// Forward for simplicities sake\n\trequire('fs').readFile(filename, opts, next)\n}\n\n// Test it\nreadFile('package.json', log)          // works with no options\nreadFile('package.json', null, log)    // works with null options\nreadFile('package.json', {next: log})  // works with just options\n```\n\n### Customisation\n\nExtract Options and Callback also supports a third argument.\nYou can use this third argument to customize the `completionCallbackNames` property that defaults to `['next']`.\nThis is useful if your completion callback has other names besides `next`.\nAllowing you to do the following:\n\n``` javascript\nvar log = console.log.bind(console)\nfunction extractOptsAndCallback (opts, next, config) {\n\tif ( config == null )  config = {}\n\tif ( config.completionCallbackNames == null )  config.completionCallbackNames = ['next', 'complete', 'done']\n\treturn require('extract-opts')(opts, next, config)\n}\n\n// The readFile method as before\n\n// Test it\nreadFile('package.json', {next: log})        // works the standard completion callback name\nreadFile('package.json', {complete: log})    // works with our custom completion callback name\nreadFile('package.json', {done: log})        // works with our custom completion callback name\n```\n\n\n<!-- HISTORY/ -->\n\n<h2>History</h2>\n\n<a href=\"https://github.com/bevry/extract-opts/blob/master/HISTORY.md#files\">Discover the release history by heading on over to the <code>HISTORY.md</code> file.</a>\n\n<!-- /HISTORY -->\n\n\n<!-- CONTRIBUTE/ -->\n\n<h2>Contribute</h2>\n\n<a href=\"https://github.com/bevry/extract-opts/blob/master/CONTRIBUTING.md#files\">Discover how you can contribute by heading on over to the <code>CONTRIBUTING.md</code> file.</a>\n\n<!-- /CONTRIBUTE -->\n\n\n<!-- BACKERS/ -->\n\n<h2>Backers</h2>\n\n<h3>Maintainers</h3>\n\nThese amazing people are maintaining this project:\n\n<ul><li><a href=\"http://balupton.com\">Benjamin Lupton</a> — <a href=\"https://github.com/bevry/extract-opts/commits?author=balupton\" title=\"View the GitHub contributions of Benjamin Lupton on repository bevry/extract-opts\">view contributions</a></li></ul>\n\n<h3>Sponsors</h3>\n\nNo sponsors yet! Will you be the first?\n\n<span class=\"badge-githubsponsors\"><a href=\"https://github.com/sponsors/balupton\" title=\"Donate to this project using GitHub Sponsors\"><img src=\"https://img.shields.io/badge/github-donate-yellow.svg\" alt=\"GitHub Sponsors donate button\" /></a></span>\n<span class=\"badge-patreon\"><a href=\"https://patreon.com/bevry\" title=\"Donate to this project using Patreon\"><img src=\"https://img.shields.io/badge/patreon-donate-yellow.svg\" alt=\"Patreon donate button\" /></a></span>\n<span class=\"badge-flattr\"><a href=\"https://flattr.com/profile/balupton\" title=\"Donate to this project using Flattr\"><img src=\"https://img.shields.io/badge/flattr-donate-yellow.svg\" alt=\"Flattr donate button\" /></a></span>\n<span class=\"badge-liberapay\"><a href=\"https://liberapay.com/bevry\" title=\"Donate to this project using Liberapay\"><img src=\"https://img.shields.io/badge/liberapay-donate-yellow.svg\" alt=\"Liberapay donate button\" /></a></span>\n<span class=\"badge-buymeacoffee\"><a href=\"https://buymeacoffee.com/balupton\" title=\"Donate to this project using Buy Me A Coffee\"><img src=\"https://img.shields.io/badge/buy%20me%20a%20coffee-donate-yellow.svg\" alt=\"Buy Me A Coffee donate button\" /></a></span>\n<span class=\"badge-opencollective\"><a href=\"https://opencollective.com/bevry\" title=\"Donate to this project using Open Collective\"><img src=\"https://img.shields.io/badge/open%20collective-donate-yellow.svg\" alt=\"Open Collective donate button\" /></a></span>\n<span class=\"badge-crypto\"><a href=\"https://bevry.me/crypto\" title=\"Donate to this project using Cryptocurrency\"><img src=\"https://img.shields.io/badge/crypto-donate-yellow.svg\" alt=\"crypto donate button\" /></a></span>\n<span class=\"badge-paypal\"><a href=\"https://bevry.me/paypal\" title=\"Donate to this project using Paypal\"><img src=\"https://img.shields.io/badge/paypal-donate-yellow.svg\" alt=\"PayPal donate button\" /></a></span>\n<span class=\"badge-wishlist\"><a href=\"https://bevry.me/wishlist\" title=\"Buy an item on our wishlist for us\"><img src=\"https://img.shields.io/badge/wishlist-donate-yellow.svg\" alt=\"Wishlist browse button\" /></a></span>\n\n<h3>Contributors</h3>\n\nThese amazing people have contributed code to this project:\n\n<ul><li><a href=\"http://balupton.com\">Benjamin Lupton</a> — <a href=\"https://github.com/bevry/extract-opts/commits?author=balupton\" title=\"View the GitHub contributions of Benjamin Lupton on repository bevry/extract-opts\">view contributions</a></li>\n<li><a href=\"http://seanfridman.com\">Sean Fridman</a> — <a href=\"https://github.com/bevry/extract-opts/commits?author=sfrdmn\" title=\"View the GitHub contributions of Sean Fridman on repository bevry/extract-opts\">view contributions</a></li>\n<li><a href=\"http://mattbierner.com\">Matt Bierner</a> — <a href=\"https://github.com/bevry/extract-opts/commits?author=mjbvz\" title=\"View the GitHub contributions of Matt Bierner on repository bevry/extract-opts\">view contributions</a></li>\n<li><a href=\"http://github.com/apps/dependabot-preview\">dependabot-preview[bot]</a> — <a href=\"https://github.com/bevry/extract-opts/commits?author=dependabot-preview[bot]\" title=\"View the GitHub contributions of dependabot-preview[bot] on repository bevry/extract-opts\">view contributions</a></li></ul>\n\n<a href=\"https://github.com/bevry/extract-opts/blob/master/CONTRIBUTING.md#files\">Discover how you can contribute by heading on over to the <code>CONTRIBUTING.md</code> file.</a>\n\n<!-- /BACKERS -->\n\n\n<!-- LICENSE/ -->\n\n<h2>License</h2>\n\nUnless stated otherwise all works are:\n\n<ul><li>Copyright &copy; 2013+ <a href=\"http://bevry.me\">Bevry Pty Ltd</a></li>\n<li>Copyright &copy; 2011+ <a href=\"http://balupton.com\">Benjamin Lupton</a></li></ul>\n\nand licensed under:\n\n<ul><li><a href=\"http://spdx.org/licenses/MIT.html\">MIT License</a></li></ul>\n\n<!-- /LICENSE -->\n","readmeFilename":"README.md","_id":"extract-opts@4.3.0-next.1575880873.fd190477a5f30c8517ff89b49ad5b2e74ffcb812","_nodeVersion":"12.13.1","_npmVersion":"6.12.1","dist":{"integrity":"sha512-8ma6J0r4vQtl4+aIYUOVRvdTtgo3Smsb0FQb39zMtx9ORRzwqyMQ6hduuzvtY9QYRtxwkLSVcl+T8vfQmuvy6Q==","shasum":"3b5ad874f4dc8f0e99ff2ee315388385f38f12cf","tarball":"http://registry-npm.ywwl.com/extract-opts/download/extract-opts-4.3.0-next.1575880873.fd190477a5f30c8517ff89b49ad5b2e74ffcb812.tgz","fileCount":8,"unpackedSize":22788,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJd7girCRA9TVsSAnZWagAAT8IQAISjR9GII8NQLC7EOWTB\nbeJT9OWgizMZOD0wGQlK6hP13tTC7h2mk17brh04iwERnvq1azMXOYYOL+N9\nM8bb59uc0Kow84BBryQwC8HkHAWhKXZ1FztwNi4wCf7ZSOgr8FvU7jFPVNQf\nj175E/zXY97byj1HkO6gU+gE6zq+V9ffQDtYEvhxEIauLNdYDzM2jYfWRaLC\neGiIM7t9+t293a6d1m9mcNmx5p7103o3vZMDRSdM+gHlRHXW9zF3BErxme7k\n14VsabvVoYCzKahV1QbgN3O88WaB7pjbediF0LnMsgu3e63l+ug1/ZIkwvOr\naRJ98NWSEGu08JiL8x8SvPwLTqd9kCs8psFAlJRltJ7/ZTTj97impEiJ3RuV\nwLaDm1bpCRUFQF8wRHSaBNIU67gqO+eO4CHvGowsnfj9H+yDVu8ZSZT7DZdy\nEt4H/h32i8V5iCH4ORJn2xmdMLr6SMyifM6pa7VSyzMKKPRpJ5CrJPLYSfWe\nasZYuFsIjBAlRn6HUtHjqT6Ewbs0OLglzuU2W+5MWDc2pIfCuZz1WMzTHkUq\n/0zAFXyGE0TTHLBbYBFCm6TFUzrgDn2urXuK077XEZeoRtsno4R5pGQq6JI7\nf2OCaW0ICNj7Km1dExXUohvhJ46NdTSXWOwC9ZMI3yxdn0e09nCrzUKTBgaJ\ndWEq\r\n=D5Ji\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIACVGaVhZwIMHSR0KXpX+LlxQvyux/gPFaEJ2nj11i8FAiEA9Jnq/9pMBY3brhmMjgDUGWa++IYkmZ6AYBL1OqWHMMo="}],"size":6169,"noattachment":false,"key":"/extract-opts/-/extract-opts-4.3.0-next.1575880873.fd190477a5f30c8517ff89b49ad5b2e74ffcb812.tgz"},"_npmUser":{"name":"bevryme","email":"us@bevry.me"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/extract-opts_4.3.0-next.1575880873.fd190477a5f30c8517ff89b49ad5b2e74ffcb812_1575880874854_0.8488767635467007"},"_hasShrinkwrap":false,"publish_time":1575880874988,"_cnpm_publish_time":1575880874988,"dist-tags":{"latest":"5.9.0","next":"5.9.0-next.1704166718.5bd0f119cd9a664e5e7424e155a561d720e12151"}}