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

compose-function

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

compose-function - npm Package Compare versions

Comparing version 1.4.1 to 1.5.0

gulpfile.js

56

index.js

@@ -1,10 +0,38 @@

var arityN = require('arity-n');
var slice = Array.prototype.slice;
"use strict";
module.exports = function() {
var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; };
var functions = slice.call(arguments);
module.exports = compose;
var arityN = _interopRequire(require("arity-n"));
var compose2 = function (f, g) {
return function () {
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
return f(g.apply(null, args));
};
};
function compose() {
for (var _len = arguments.length, functions = Array(_len), _key = 0; _key < _len; _key++) {
functions[_key] = arguments[_key];
}
functions = functions.filter(function (fn) {
return typeof fn === "function";
});
var lastIdx = functions.length - 1;
var arity = 0;
if (functions.length <= 0) {
throw new Error("No functions passed");
}
if (lastIdx >= 0 && functions[lastIdx]) {

@@ -14,19 +42,3 @@ arity = functions[lastIdx].length;

return arityN(function() {
var args = slice.call(arguments),
func;
for(var i = functions.length - 1; i >= 0; i--) {
func = functions[i];
if (typeof func !== 'function') {
throw new Error('Not a function', func);
}
args = [func.apply(null, args)];
}
return args[0];
}, arity);
};
return arityN(functions.reduce(compose2), arity);
}
{
"name": "compose-function",
"version": "1.4.1",
"version": "1.5.0",
"description": "Compose new functions f(g(x))",
"main": "index.js",
"scripts": {
"test": "sjs -m ./macro test.sjs -o test.js; _mocha --reporter nyan; rm test.js"
"test": "sjs -m ./macro test.sjs -o test.js; gulp test; rm test.js"
},

@@ -27,2 +27,9 @@ "repository": {

"expect.js": "^0.3.1",
"gulp": "^3.8.11",
"gulp-6to5": "^3.0.0",
"gulp-mocha": "^2.0.0",
"gulp-rename": "^1.2.0",
"gulp-run": "^1.6.6",
"gulp-sourcemaps": "^1.3.0",
"gulp-watch": "^4.1.1",
"mocha": "^2.1.0",

@@ -29,0 +36,0 @@ "sweet.js": "^0.7.3"

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