Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

unlimited-curry

Package Overview
Dependencies
Maintainers
3
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

unlimited-curry - npm Package Compare versions

Comparing version 1.3.2 to 1.3.3

dist/src/unlimited-curry-factory/caller-promise-factory-factory.js

157

dist/src/index.js
'use strict';
var returnFromPromise = 1;
var returnFromCallback = 0;
var getFrom = function getFrom(from, dataArgument) {
var workData = dataArgument;
var returnArrayChunks = workData.returnArrayChunks.slice(from);
var returnArray = [];
returnArrayChunks.forEach(function (chunkData) {
return chunkData.forEach(function (pieceData) {
return returnArray.push(pieceData);
});
});
var data = { returnArray: returnArray, returnArrayChunks: returnArrayChunks };
var returnObject = { data: data, getFrom: getFrom };
var command = {
has: function has(command) {
return returnObject.data.returnArrayChunks.some(function (argumentArray) {
return argumentArray[0] === command;
});
},
get: function get(command) {
return returnObject.data.returnArrayChunks.filter(function (argumentArray) {
return argumentArray[0] === command;
});
},
getArguments: function getArguments(command, commands) {
return this.get(command, commands).map(function (command) {
return command.slice(1);
});
}
};
returnObject.command = command;
return returnObject;
};
var safetyExecutor = function safetyExecutor(data, callback) {
var timeoutSate = null;
if (callback && typeof callback === 'function') {
timeoutSate = setTimeout(callback, 0, 2, data);
}
return timeoutSate;
};
var UnlimitedCurry = function UnlimitedCurry(callback) {
var timeoutSate = null;
var level = 0;
var returnArray = [];
var returnArrayChunks = [];
var state = {
timeoutSate: timeoutSate,
level: level,
returnArray: returnArray,
returnArrayChunks: returnArrayChunks,
resetMe: false,
reset: function reset() {
if (this.resetMe) {
this.level = 0;
this.returnArray = [];
this.returnArrayChunks = [];
this.resetMe = false;
}
},
clone: function clone() {
return {
timeoutSate: timeoutSate,
level: this.level,
returnArray: this.returnArray.slice(0),
returnArrayChunks: this.returnArrayChunks.slice(0),
resetMe: this.resetMe,
reset: this.reset,
clone: this.clone,
getData: this.getData
};
},
getData: function getData() {
var me = this;
return getFrom(0, { returnArrayChunks: me.returnArrayChunks });
}
};
var caller = function caller() {
// parameters
if (!caller.called) {
caller.called = true;
return caller;
}
state.reset();
state.level++;
var callerArguments = Array.from(arguments);
if (callerArguments.length) {
state.returnArrayChunks.push(callerArguments);
}
var data = caller.data = getFrom(0, { returnArrayChunks: state.returnArrayChunks });
caller.p = function () {
return new Promise(function (resolve, reject) {
clearTimeout(state.timeoutSate);
var conedState = state.clone();
var ret = false;
var data = conedState.getData();
if (typeof callback === 'function') {
ret = callback(returnFromPromise, data);
} else {
ret = data;
}
state.resetMe = true;
return resolve(ret);
});
};
/* istanbul ignore else */
if (!arguments.length) {
/* istanbul ignore else */
if (callback) {
/* istanbul ignore else */
if (typeof callback === 'function') {
clearTimeout(state.timeoutSate);
state.resetMe = true;
return callback(returnFromCallback, data);
}
}
/* istanbul ignore else */
if (!callback) {
return data;
}
}
/* istanbul ignore else */
if (arguments.length) {
/* istanbul ignore else */
if (state.timeoutSate) {
clearTimeout(state.timeoutSate);
}
state.timeoutSate = safetyExecutor(data, callback);
}
state.level++;
return caller;
};
return caller(state.returnArray);
};
module.exports = exports = UnlimitedCurry;
var unlimitedCurryFactory = require('./unlimited-curry-factory');
var unlimitedCurryFactoryInitiator = unlimitedCurryFactory(false, true)(function (error, parameters) {
return unlimitedCurryFactory(parameters);
});
module.exports = exports = unlimitedCurryFactoryInitiator();
exports.extra = unlimitedCurryFactoryInitiator;
{
"name": "unlimited-curry",
"version": "1.3.2",
"version": "1.3.3",
"description": "Unlimited curry",

@@ -84,6 +84,6 @@ "main": "dist/src/index.js",

"/build/",
"/tmp/"
"/tmp/",
"/src/index.js"
]
},
"gitHead": "75b905e4c4e804f5e5a58e41b560b076e10d7a34"
}
}
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