New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@use/core

Package Overview
Dependencies
Maintainers
2
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@use/core - npm Package Compare versions

Comparing version 0.1.0 to 0.2.0

9

CHANGES.md

@@ -1,3 +0,10 @@

0.1.0 - UNRELEASED
**0.2.0 - 2016/12/13**
1. add "base options" to `gen()`
2. update scope customizing test to use base options
3. add explanation about "base options" to README
**0.1.0 - 2016/12/04**
1. initial working version with tests

8

lib/index.js

@@ -45,3 +45,3 @@ // Generated by CoffeeScript 1.11.1

gen = function(scope) {
gen = function(scope, baseOptions) {
var theUse;

@@ -64,9 +64,9 @@ if (scope == null) {

theUse = function(plugin, options) {
return scope.use(this, scope, plugin, options);
return scope.use(this, scope, plugin, scope.combine(baseOptions, options));
};
theUse.use = function(plugin, options) {
return scope.use(scope, scope, plugin, options);
return scope.use(scope, scope, plugin, scope.combine(baseOptions, options));
};
theUse.withOptions = function(defaultOptions) {
return scope.withOptions(scope, defaultOptions);
return scope.withOptions(scope, scope.combine(baseOptions, defaultOptions));
};

@@ -73,0 +73,0 @@ return theUse;

{
"name": "@use/core",
"version": "0.1.0",
"version": "0.2.0",
"description": "Add use() function for easy plugin ability.",

@@ -5,0 +5,0 @@ "main": "lib",

@@ -73,3 +73,2 @@ # @use/core

```javascript
function plugin(options, thing) {

@@ -82,5 +81,6 @@ // `this` is the `thing`, same as param #2.

// `options` is the combined options provided to:
// 1. `thing.use = use.withOptions(defaultOptions)`
// 2. `thing.use(fn, pluginOptions)`
// #2 overrides #1.
// 1. `use.gen(baseOptions)`
// 2. `thing.use = use.withOptions(defaultOptions)`
// 3. `thing.use(fn, pluginOptions)`
// #3 overrides #2, #2 overrides #1.
// options may be null

@@ -163,2 +163,3 @@ }

## Usage: Specify Plugin Options

@@ -195,2 +196,3 @@

## Usage: Enhance Itself

@@ -223,2 +225,3 @@

## Usage: Generate Your Own to Enhance

@@ -256,2 +259,16 @@

use = use.gen(customScope)
// also, you can specify some "base options" which are available to all plugins,
// and, are below the "default options" of withOptions()
use = use.gen({}, {
some: 'base options'
})
// these options would override "base options"
use = use.withOptions({ some: 'default options'})
thing = { use:use }
// these options would override both the "base options" and "default options"
thing.use('some plugin', { some: 'plugin options'})
```

@@ -258,0 +275,0 @@

Sorry, the diff of this file is not supported yet

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