<!-- TITLE/ -->
<h1>Extract Options & Callback</h1>
<!-- /TITLE -->
<!-- BADGES/ -->
<span class="badge-travisci"><a href="http://travis-ci.org/bevry/extract-opts" title="Check this project's build status on TravisCI"><img src="https://img.shields.io/travis/bevry/extract-opts/master.svg" alt="Travis CI Build Status" /></a></span>
<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>
<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>
<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>
<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>
<br class="badge-separator" />
<span class="badge-slackin"><a href="https://slack.bevry.me" title="Join this project's slack community"><img src="https://slack.bevry.me/badge.svg" alt="Slack community badge" /></a></span>
<span class="badge-patreon"><a href="http://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>
<span class="badge-gratipay"><a href="https://www.gratipay.com/bevry" title="Donate weekly to this project using Gratipay"><img src="https://img.shields.io/badge/gratipay-donate-yellow.svg" alt="Gratipay donate button" /></a></span>
<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>
<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>
<span class="badge-bitcoin"><a href="https://bevry.me/bitcoin" title="Donate once-off to this project using Bitcoin"><img src="https://img.shields.io/badge/bitcoin-donate-yellow.svg" alt="Bitcoin donate button" /></a></span>
<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>
<!-- /BADGES -->
<!-- DESCRIPTION/ -->
Extract the options and callback from a function's arguments easily
<!-- /DESCRIPTION -->
<!-- INSTALL/ -->
<h2>Install</h2>
<a href="https://npmjs.com" title="npm is a package manager for javascript"><h3>NPM</h3></a><ul>
<li>Install: <code>npm install --save extract-opts</code></li>
<li>Module: <code>require('extract-opts')</code></li></ul>
<a href="http://browserify.org" title="Browserify lets you require('modules') in the browser by bundling up all of your dependencies"><h3>Browserify</h3></a><ul>
<li>Install: <code>npm install --save extract-opts</code></li>
<li>Module: <code>require('extract-opts')</code></li>
<li>CDN URL: <code>//wzrd.in/bundle/extract-opts@3.3.1</code></li></ul>
<a href="http://enderjs.com" title="Ender is a full featured package manager for your browser"><h3>Ender</h3></a><ul>
<li>Install: <code>ender add extract-opts</code></li>
<li>Module: <code>require('extract-opts')</code></li></ul>
<h3><a href="https://github.com/bevry/editions" title="Editions are the best way to produce and consume packages you care about.">Editions</a></h3>
<p>This package is published with the following editions:</p>
<ul><li><code>extract-opts</code> aliases <code>extract-opts/index.js</code> which uses <a href="https://github.com/bevry/editions" title="Editions are the best way to produce and consume packages you care about.">Editions</a> to automatically select the correct edition for the consumers environment</li>
<li><code>extract-opts/source/index.js</code> is Source + <a href="https://babeljs.io/docs/learn-es2015/" title="ECMAScript Next">ESNext</a> + <a href="https://nodejs.org/dist/latest-v5.x/docs/api/modules.html" title="Node/CJS Modules">Require</a></li>
<li><code>extract-opts/es2015/index.js</code> is <a href="https://babeljs.io" title="The compiler for writing next generation JavaScript">Babel</a> Compiled + <a href="http://babeljs.io/docs/plugins/preset-es2015/" title="ECMAScript 2015">ES2015</a> + <a href="https://nodejs.org/dist/latest-v5.x/docs/api/modules.html" title="Node/CJS Modules">Require</a></li></ul>
<p>Older environments may need <a href="https://babeljs.io/docs/usage/polyfill/" title="A polyfill that emulates missing ECMAScript environment features">Babel's Polyfill</a> or something similar.</p>
<!-- /INSTALL -->
## Usage
``` javascript
var log = console.log.bind(console)
var extractOptsAndCallback = require('extract-opts')
// fs.readFile(filename, [options], callback)
function readFile (filename, opts, next) {
// Extract options and callback
var args = extractOptsAndCallback(opts, next)
opts = args[0]
next = args[1]
// Forward for simplicities sake
require('fs').readFile(filename, opts, next)
}
// Test it
readFile('package.json', log) // works with no options
readFile('package.json', null, log) // works with null options
readFile('package.json', {next: log}) // works with just options
```
### Customisation
Extract Options and Callback also supports a third argument.
You can use this third argument to customize the `completionCallbackNames` property that defaults to `['next']`.
This is useful if your completion callback has other names besides `next`.
Allowing you to do the following:
``` javascript
var log = console.log.bind(console)
function extractOptsAndCallback (opts, next, config) {
if ( config == null ) config = {}
if ( config.completionCallbackNames == null ) config.completionCallbackNames = ['next', 'complete', 'done']
return require('extract-opts')(opts, next, config)
}
# The readFile method as before
# Test it
readFile('package.json', {next: log}) # works the standard completion callback name
readFile('package.json', {complete: log}) # works with our custom completion callback name
readFile('package.json', {done: log}) # works with our custom completion callback name
```
<!-- HISTORY/ -->
<h2>History</h2>
<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>
<!-- /HISTORY -->
<!-- CONTRIBUTE/ -->
<h2>Contribute</h2>
<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>
<!-- /CONTRIBUTE -->
<!-- BACKERS/ -->
<h2>Backers</h2>
<h3>Maintainers</h3>
These amazing people are maintaining this project:
<ul><li><a href="https://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>
<h3>Sponsors</h3>
No sponsors yet! Will you be the first?
<span class="badge-patreon"><a href="http://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>
<span class="badge-gratipay"><a href="https://www.gratipay.com/bevry" title="Donate weekly to this project using Gratipay"><img src="https://img.shields.io/badge/gratip
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
DR5加强版扩展插件(Delicious Retouch 5)是一个非常优秀的ps磨皮插件,包含多种适用于人像修饰的功能,主要有人像磨皮、平滑皮肤、去除瑕疵、美白牙齿、美白皮肤、修饰眼部等实用的功能,而且您还可以使用DR5磨皮插件为照片添加多种滤镜效果,适用于影楼快速美容磨皮以及摄影师人像后期处理等方面。小编现为您带来DR5加强版扩展插件下载,支持ps cc 2019,需要的朋友快来下载使用吧! dr5磨皮插件介绍 dr5 Delicious Retouch 5(简称dr5插件扩展面板)是一款很优秀的Photoshop人像美容插件。dr5扩展面板专注人像修饰,插件中包含多种适用于人像修
资源详情
资源评论
资源推荐
收起资源包目录
Photoshop2021 磨皮插件(Mac版)DR5加强版扩展插件+安装教程 (1455个子文件)
FontList.as 779B
FontList.as 779B
FontList.as 779B
style.css 36KB
jasmine.css 19KB
jasmine.css 19KB
jasmine.css 19KB
exmo_main.css 6KB
demo.css 2KB
style.css 1KB
styles.css 431B
adobe-ico.css 0B
.debug 257B
.npminstall.done 54B
.npminstall.done 54B
.npminstall.done 54B
.npminstall.done 54B
.npminstall.done 54B
.npminstall.done 54B
.npminstall.done 54B
.npminstall.done 54B
.npminstall.done 54B
.npminstall.done 54B
.npminstall.done 54B
.npminstall.done 54B
.npminstall.done 54B
.npminstall.done 54B
.npminstall.done 54B
.npminstall.done 54B
.npminstall.done 54B
.npminstall.done 54B
.npminstall.done 54B
.npminstall.done 54B
.npminstall.done 54B
.npminstall.done 54B
.npminstall.done 54B
.npminstall.done 54B
.npminstall.done 54B
.npminstall.done 54B
.npminstall.done 54B
.npminstall.done 54B
.npminstall.done 54B
.npminstall.done 54B
.npminstall.done 54B
.npminstall.done 54B
.npminstall.done 54B
.npminstall.done 54B
.npminstall.done 54B
.npminstall.done 54B
.npminstall.done 54B
.npminstall.done 54B
.npminstall.done 54B
.npminstall.done 54B
.npminstall.done 54B
.DS_Store 6KB
.DS_Store 6KB
icomoon.eot 129KB
.eslintrc 286B
.eslintrc 286B
.eslintrc 286B
.flowconfig 272B
.flowconfig 272B
.flowconfig 272B
.flowconfig 272B
.flowconfig 272B
.flowconfig 272B
.flowconfig 272B
.flowconfig 272B
.flowconfig 272B
.flowconfig 272B
.flowconfig 272B
.flowconfig 272B
.flowconfig 272B
.flowconfig 272B
.flowconfig 272B
.flowconfig 272B
.flowconfig 272B
.flowconfig 272B
.flowconfig 272B
.flowconfig 272B
.flowconfig 272B
.flowconfig 272B
.flowconfig 272B
.flowconfig 272B
.flowconfig 272B
.flowconfig 272B
.flowconfig 272B
.flowconfig 272B
.flowconfig 272B
.flowconfig 272B
demo.html 503KB
index.html 11KB
index.html 3KB
index.html 3KB
index.html 3KB
spec_runner.html 965B
spec_runner.html 965B
spec_runner.html 965B
ExStigmata2-Sample.iml 458B
vue.js 252KB
共 1455 条
- 1
- 2
- 3
- 4
- 5
- 6
- 15
A.凌晨两点半
- 粉丝: 0
- 资源: 1
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论1