Socket
Socket
Sign inDemoInstall

base-option

Package Overview
Dependencies
40
Maintainers
2
Versions
10
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.6.2 to 0.7.0

52

index.js

@@ -15,2 +15,3 @@ /*!

if (this.isRegistered('base-options')) return;
var Options = utils.Options;

@@ -21,11 +22,12 @@ var define = utils.define;

// shallow clone options
var opts = utils.merge({}, options);
var self = this;
// original constructor reference
var ctor = this.constructor;
Options.call(this, utils.merge(this.options, opts));
Options.call(this, utils.merge(this.options, options));
/**
* Mixin `Options.prototype` methods
*/
this.visit('define', Options.prototype);
var opts = this.options;

@@ -46,4 +48,4 @@ /**

define(this.option, 'set', function(key, val) {
set(self.options, key, val);
return self.options;
set(opts, key, val);
return opts;
});

@@ -66,3 +68,3 @@

define(this.option, 'get', function(key) {
return get(self.options, key);
return get(opts, key);
});

@@ -85,20 +87,30 @@

define(this.option, 'create', function(options) {
var opts = new Options(utils.merge({}, self.options));
define(opts, 'merge', opts.option.bind(opts));
define(opts, '_callbacks', opts._callbacks);
var inst = new Options(utils.merge({}, opts));
if (options) {
opts.merge.apply(opts, arguments);
inst.option.apply(inst, arguments);
}
return opts;
define(inst.options, 'set', function(key, val) {
set(this, key, val);
return this;
});
define(inst.options, 'get', function(key) {
return get(this, key);
});
define(inst.options, 'merge', function() {
var args = [].concat.apply([], [].slice.call(arguments));
args.unshift(this);
return utils.merge.apply(utils.merge, args);
});
define(inst, '_callbacks', inst._callbacks);
return inst.options;
});
// restore original constructor
this.constructor = ctor;
// prevent the plugin from
// being passed to `run`
if (opts.run !== false) {
return fn;
}
define(this, 'constructor', ctor);
return fn;
};
};
{
"name": "base-option",
"description": "Adds a few options methods to base, like `option`, `enable` and `disable`. See the readme for the full API.",
"version": "0.6.2",
"version": "0.7.0",
"homepage": "https://github.com/node-base/base-option",

@@ -6,0 +6,0 @@ "author": "Jon Schlinkert (https://github.com/jonschlinkert)",

@@ -215,3 +215,3 @@ # base-option [![NPM version](https://img.shields.io/npm/v/base-option.svg)](https://www.npmjs.com/package/base-option) [![Build Status](https://img.shields.io/travis/node-base/base-option.svg)](https://travis-ci.org/node-base/base-option)

### [.option.set](index.js#L43)
### [.option.set](index.js#L45)

@@ -233,3 +233,3 @@ Set option `key` on `app.options` with the given `value`

### [.option.get](index.js#L62)
### [.option.get](index.js#L64)

@@ -251,3 +251,3 @@ Get option `key` from `app.options`

### [.option.create](index.js#L80)
### [.option.create](index.js#L82)

@@ -314,2 +314,2 @@ Returns a shallow clone of `app.options` with all of the options methods, as well as a `.merge` method for merging options onto the cloned object.

_This file was generated by [verb](https://github.com/verbose/verb), v0.9.0, on March 02, 2016._
_This file was generated by [verb](https://github.com/verbose/verb), v0.9.0, on March 09, 2016._
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