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

@applitools/functional-commons

Package Overview
Dependencies
Maintainers
15
Versions
47
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@applitools/functional-commons - npm Package Compare versions

Comparing version 1.3.7 to 1.4.1

4

package.json
{
"name": "@applitools/functional-commons",
"version": "1.3.7",
"version": "1.4.1",
"description": "",

@@ -42,5 +42,5 @@ "main": "src/functional-commons.js",

"eslint-plugin-prettier": "^3.0.1",
"mocha": "^6.0.2",
"mocha": "^6.1.2",
"prettier": "^1.16.4"
}
}

@@ -94,44 +94,16 @@ 'use strict'

// Returns a function which reverses the order of the
// arguments to the passed in function when invoked.
function flip(fn) {
return function() {
var args = [].slice.call(arguments)
return fn.apply(this, args.reverse())
}
}
// Returns a new function that curries the original
// function's arguments from right to left.
function rightCurry(fn, n) {
var arity = n || fn.length,
fn = flip(fn)
return function curried() {
var args = [].slice.call(arguments),
context = this
function group(prop, list) {
return list.reduce(function(grouped, item) {
const key = item[prop]
return args.length >= arity
? fn.apply(context, args.slice(0, arity))
: function() {
var rest = [].slice.call(arguments)
return curried.apply(context, args.concat(rest))
}
}
}
grouped[key] = grouped[key] || []
const toString = Object.prototype.toString
const isFunction = function(o) {
return toString.call(o) == '[object Function]'
}
grouped[key].push(item)
function group(list, prop) {
return list.reduce(function(grouped, item) {
var key = isFunction(prop) ? prop.apply(this, [item]) : item[prop]
grouped[key] = grouped[key] || []
grouped[key].push(item)
return grouped
}, {})
}
// our right curried version of `group()`
const groupBy = rightCurry(group)
const groupBy = prop => list => group(prop, list)
/**

@@ -466,4 +438,4 @@ * @param {{[x: string]: any}} object

diff,
rightCurry,
group,
groupBy,
}
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