Socket
Socket
Sign inDemoInstall

extract-opts

Package Overview
Dependencies
Maintainers
1
Versions
45
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

extract-opts - npm Package Compare versions

Comparing version 2.2.0 to 3.0.0

HISTORY.md

10

LICENSE.md

@@ -1,10 +0,2 @@

(The MIT License)
Copyright © 2013+ [Bevry Pty Ltd](http://bevry.me) <us@bevry.me>
Copyright © 2011-2012 [Benjamin Lupton](http://balupton.com) <b@lupton.cc>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
<!-- LICENSEFILE -->

@@ -1,12 +0,9 @@

// Generated by CoffeeScript 1.6.3
var extractOpts, typeChecker;
// Generated by CoffeeScript 1.9.1
(function() {
var typeChecker;
typeChecker = require('typechecker');
typeChecker = require('typechecker');
extractOpts = {
extractOpts: function(opts, next, config) {
return extractOpts.extractOptsAndCallback(opts, next, config);
},
extractOptsAndCallback: function(opts, next, config) {
var completionCallbackName, _i, _len, _ref;
module.exports = function(opts, next, config) {
var completionCallbackName, i, len, ref;
if (config == null) {

@@ -27,5 +24,5 @@ config = {};

if (!next) {
_ref = config.completionCallbackNames;
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
completionCallbackName = _ref[_i];
ref = config.completionCallbackNames;
for (i = 0, len = ref.length; i < len; i++) {
completionCallbackName = ref[i];
next = opts[completionCallbackName];

@@ -40,5 +37,4 @@ delete opts[completionCallbackName];

return [opts, next];
}
};
};
module.exports = extractOpts;
}).call(this);
{
"title": "Extract Options",
"name": "extract-opts",
"version": "2.2.0",
"version": "3.0.0",
"description": "Extract the options and callback from a function's arguments easily",

@@ -9,3 +10,15 @@ "homepage": "https://github.com/bevry/extract-opts",

],
"author": "Bevry Pty Ltd <us@bevry.me> (http://bevry.me)",
"badges": {
"travis": true,
"npm": true,
"npmdownloads": true,
"david": true,
"daviddev": true,
"gratipay": "bevry",
"flattr": "344188/balupton-on-Flattr",
"paypal": "QB8GQPZAH84N6",
"bitcoin": "https://coinbase.com/checkouts/9ef59f5479eec1d97d63382c9ebcb93a",
"wishlist": "http://amzn.com/w/2F8TXKSNAFG4V"
},
"author": "2013+ Bevry Pty Ltd <us@bevry.me> (http://bevry.me), 2011+ Benjamin Lupton <b@lupton.cc> (https://github.com/balupton)",
"maintainers": [

@@ -28,10 +41,10 @@ "Benjamin Lupton <b@lupton.cc> (https://github.com/balupton)"

"dependencies": {
"typechecker": "~2.0.1"
"typechecker": "^2.0.8"
},
"devDependencies": {
"coffee-script": "~1.6.2",
"joe": "~1.2.0",
"joe-reporter-console": "~1.2.1",
"chai": "~1.5.0",
"eachr": "~2.0.2"
"coffee-script": "^1.9.1",
"joe": "^1.6.0",
"joe-reporter-console": "^1.2.1",
"chai": "^2.1.1",
"eachr": "^2.0.4"
},

@@ -44,3 +57,6 @@ "directories": {

},
"main": "./out/lib/extract-opts.js"
"main": "./out/lib/extract-opts.js",
"cakeConfiguration": {
"COFFEE_SRC_PATH": "src"
}
}

@@ -1,22 +0,16 @@

# Extract Opts
[![Build Status](https://secure.travis-ci.org/bevry/extract-opts.png?branch=master)](http://travis-ci.org/bevry/extract-opts)
[![NPM version](https://badge.fury.io/js/extract-opts.png)](https://npmjs.org/package/extract-opts)
[![Flattr this project](https://raw.github.com/balupton/flattr-buttons/master/badge-89x18.gif)](http://flattr.com/thing/344188/balupton-on-Flattr)
<!-- TITLE -->
Extract the options and callback from a function's arguments easily
<!-- BADGES -->
<!-- DESCRIPTION -->
<!-- INSTALL -->
## Install
1. [Install Node.js](http://bevry.me/node/install)
2. `npm install --save extract-opts`
## Usage
``` javascript
var extractOpts = require('extract-opts').extractOpts;
var extractOpts = require('extract-opts')

@@ -26,27 +20,24 @@ // fs.readFile(filename, [options], callback)

// Extract options and callback
var args = extractOpts(opts, callback);
opts = args[0];
callback = args[1];
var args = extractOpts(opts, callback)
opts = args[0]
callback = args[1]
// Forward for simplicities sake
require('fs').readFile(filename, opts, callback);
require('fs').readFile(filename, opts, callback)
};
// Test it
var next = console.log.bind(console);
readFile('package.json', next); // works with no options
readFile('package.json', null, next); // works with null options
readFile('package.json', {next:next}); // works with just options
var next = console.log.bind(console)
readFile('package.json', next) // works with no options
readFile('package.json', null, next) // works with null options
readFile('package.json', {next:next}) // works with just options
```
<!-- HISTORY -->
## History
[You can discover the history inside the `History.md` file](https://github.com/bevry/extract-opts/blob/master/History.md#files)
<!-- CONTRIBUTE -->
<!-- BACKERS -->
## License
Licensed under the incredibly [permissive](http://en.wikipedia.org/wiki/Permissive_free_software_licence) [MIT License](http://creativecommons.org/licenses/MIT/)
<br/>Copyright © 2013+ [Bevry Pty Ltd](http://bevry.me)
<br/>Copyright © 2011-2012 [Benjamin Arthur Lupton](http://balupton.com)
<!-- LICENSE -->

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