aboutsummaryrefslogtreecommitdiff
path: root/node_modules/option-chain/index.js
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2019-03-27 21:01:33 +0100
committerFlorian Dold <florian.dold@gmail.com>2019-03-27 21:01:33 +0100
commitcc97a4dd2a967e1c2273bd5f4c5f49a5bf2e2585 (patch)
tree92c5d88706a6ffc654d1b133618d357890e7096b /node_modules/option-chain/index.js
parent3771b4d6b67b34c130f3a9a1a15f42deefdb2eda (diff)
remove node_modules
Diffstat (limited to 'node_modules/option-chain/index.js')
-rw-r--r--node_modules/option-chain/index.js55
1 files changed, 0 insertions, 55 deletions
diff --git a/node_modules/option-chain/index.js b/node_modules/option-chain/index.js
deleted file mode 100644
index 99798bbea..000000000
--- a/node_modules/option-chain/index.js
+++ /dev/null
@@ -1,55 +0,0 @@
-'use strict';
-module.exports = (options, fn, target) => {
- const chainables = options.chainableMethods || {};
- const spread = options.spread;
- const defaults = Object.assign({}, options.defaults);
-
- function extend(target, getter, ctx) {
- for (const key of Object.keys(chainables)) {
- Object.defineProperty(target, key, {
- enumerable: true,
- configurable: true,
- get() {
- return wrap(getter, chainables[key], ctx || this);
- }
- });
- }
- }
-
- function wrap(createOpts, extensionOpts, ctx) {
- function wrappedOpts() {
- return Object.assign(createOpts(), extensionOpts);
- }
-
- function wrappedFn() {
- let args = new Array(arguments.length);
-
- for (let i = 0; i < args.length; i++) {
- args[i] = arguments[i];
- }
-
- if (spread) {
- args.unshift(wrappedOpts());
- } else {
- args = [wrappedOpts(), args];
- }
-
- return fn.apply(ctx || this, args);
- }
-
- extend(wrappedFn, wrappedOpts, ctx);
-
- return wrappedFn;
- }
-
- function copyDefaults() {
- return Object.assign({}, defaults);
- }
-
- if (target) {
- extend(target, copyDefaults);
- return target;
- }
-
- return wrap(copyDefaults);
-};