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

redash

Package Overview
Dependencies
Maintainers
1
Versions
39
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

redash - npm Package Compare versions

Comparing version 0.1.1 to 0.2.2

dist/redash.js

6

jsconfig.json
{
"compilerOptions": {
"target": "ES6"
}
"compilerOptions": {
"target": "ES6"
}
}
{
"name": "redash",
"version": "0.1.1",
"version": "0.2.2",
"description": "",
"main": "redash.js",
"main": "dist/redash.js",
"directories": {

@@ -11,3 +11,3 @@ "test": "tests"

"lint": "eslint src/**/*.js",
"bundle": "rollup --format iife --name Redash -i redash.js -o dist/redash.js",
"bundle": "rollup --format umd --name Redash -i src/redash.js -o dist/redash.js",
"minify": "uglifyjs dist/redash.js --compress --mangle -o dist/redash.min.js",

@@ -23,2 +23,4 @@ "compile": "npm run bundle && npm run minify",

"eslint": "^1.9.0",
"eslint-config-standard": "^4.4.0",
"eslint-plugin-standard": "^1.3.1",
"karma": "^0.13.15",

@@ -25,0 +27,0 @@ "karma-chai": "^0.1.0",

Redash
======
[![Coverage Status](https://coveralls.io/repos/davezuko/redash/badge.svg?branch=master&service=github)](https://coveralls.io/github/davezuko/redash?branch=master)
[![Build Status](https://travis-ci.org/davezuko/redash.svg?branch=master)](https://travis-ci.org/davezuko/redash)
Redash is a lightweight, functional-first library meant to fill the gap between Ramda and Lodash. All functions are auto-curried and expect data as the last argument to encourage composition. This library's ultimate goal is to remain as lightweight as possible; that means zero dependencies and an incredibly focused API that will give you the right tools for the job and nothing more.
## Redash vs. Ramda vs. Lodash
Category | Redash | Ramda | Lodash | Lodash-FP
------------------ | ------ | ----- | ------ | ---------
Minified (kb) | 3.65 | 39.1 | 60.8 | 66
Immutable | Yes | Yes | No | Yes
Functional First | Yes | Yes | No | No
Reference Equality | Yes | No | Yes | Yes
Value Equality | No | Yes | No | No
IE 9+ | Yes | Yes | Yes | Yes

@@ -1,4 +0,4 @@

import _curryN from './internal/_curryN'
import _curry2 from './internal/_curry2'
var add = _curryN(2, [], function add (a, b) {
var add = _curry2(function add (a, b) {
return a + b

@@ -5,0 +5,0 @@ })

@@ -0,7 +1,16 @@

import _curry1 from './internal/_curry1'
import _curry2 from './internal/_curry2'
import _curry3 from './internal/_curry3'
import _curryN from './internal/_curryN'
var curry = function curry (fn) {
return _curryN(fn.length, [], fn)
switch (fn.length) {
case 0: return fn
case 1: return _curry1(fn)
case 2: return _curry2(fn)
case 3: return _curry3(fn)
default: return _curryN(fn.length, [], fn)
}
}
export default curry
export default curry

@@ -0,8 +1,16 @@

import _curry1 from './internal/_curry1'
import _curry2 from './internal/_curry2'
import _curry3 from './internal/_curry3'
import _curryN from './internal/_curryN'
// TODO: should be curried
var curryN = function curryN (arity, fn) {
return _curryN(arity, [], fn)
}
var curryN = _curry2(function curryN (arity, fn) {
switch (arity) {
case 0: return fn
case 1: return _curry1(fn)
case 2: return _curry2(fn)
case 3: return _curry3(fn)
default: return _curryN(fn.length, [], fn)
}
})
export default curryN
export default curryN

@@ -1,4 +0,4 @@

import _curryN from './internal/_curryN'
import _curry2 from './internal/_curry2'
var filter = _curryN(2, [], function filter (fn, xs) {
var filter = _curry2(function filter (fn, xs) {
var i = 0

@@ -5,0 +5,0 @@ , len = xs.length

@@ -1,4 +0,4 @@

import _curryN from './internal/_curryN'
import _curry2 from './internal/_curry2'
var findIndex = _curryN(2, [], function findIndex (pred, xs) {
var findIndex = _curry2(function findIndex (pred, xs) {
var i = 0

@@ -5,0 +5,0 @@ , len = xs.length

@@ -1,4 +0,4 @@

import _curryN from './internal/_curryN'
import _curry2 from './internal/_curry2'
var flatMap = _curryN(2, [], function flatMap (fn, xs) {
var flatMap = _curry2(function flatMap (fn, xs) {
var i = 0

@@ -5,0 +5,0 @@ , len = xs.length

@@ -1,4 +0,4 @@

import _curryN from './internal/_curryN'
import _curry2 from './internal/_curry2'
var forEach = _curryN(2, [], function forEach (fn, xs) {
var forEach = _curry2(function forEach (fn, xs) {
var i = 0

@@ -5,0 +5,0 @@ , len = xs.length

@@ -5,2 +5,2 @@ var head = function head (xs) {

export default head
export default head

@@ -1,4 +0,4 @@

import _curryN from './internal/_curryN'
import _curry2 from './internal/_curry2'
var indexOf = _curryN(2, [], function indexOf (y, xs) {
var indexOf = _curry2(function indexOf (y, xs) {
var i = 0

@@ -5,0 +5,0 @@ , len = xs.length

import _slice from './_slice'
import _arity from './_arity'
export default function _curryN (arity, applied, fn) {
return function () {
/**
* @description something
* @param {Number} arity - the target arity
* @param {Number} applied - the array of already-applied arguments
* @param {Function} fn - the function to be called once all arguments are supplied
* @returns {Function}
*/
function _curryN (arity, applied, fn) {
return _arity(arity, function () {
var newApplied = applied.concat(_slice.call(arguments))
return newApplied.length >= arity ?
fn.apply(null, newApplied) : _curryN(arity, newApplied, fn)
}
return newApplied.length >= arity
? fn.apply(null, newApplied)
: _curryN(arity, newApplied, fn)
})
}
export default _curryN

@@ -5,2 +5,2 @@ var last = function last (xs) {

export default last
export default last

@@ -1,4 +0,4 @@

import _curryN from './internal/_curryN'
import _curry2 from './internal/_curry2'
var map = _curryN(2, [], function map (fn, xs) {
var map = _curry2(function map (fn, xs) {
var i = 0

@@ -5,0 +5,0 @@ , len = xs.length

@@ -1,4 +0,4 @@

import _curryN from './internal/_curryN'
import _curry2 from './internal/_curry2'
var prop = _curryN(2, [], function prop (p, x) {
var prop = _curry2(function prop (p, x) {
return x[p]

@@ -5,0 +5,0 @@ })

@@ -1,4 +0,4 @@

import _curryN from './internal/_curryN'
import _curry3 from './internal/_curry3'
var propEq = _curryN(3, [], function propEq (p, y, x) {
var propEq = _curry3(function propEq (p, y, x) {
return x[p] === y

@@ -5,0 +5,0 @@ })

@@ -1,4 +0,4 @@

import _curryN from './internal/_curryN'
import _curry3 from './internal/_curry3'
var reduce = _curryN(3, [], function reduce (fn, y, xs) {
var reduce = _curry3(function reduce (fn, y, xs) {
var i = 0

@@ -5,0 +5,0 @@ , len = xs.length

@@ -1,4 +0,4 @@

import _curryN from './internal/_curryN'
import _curry3 from './internal/_curry3'
var reduceRight = _curryN(3, [], function reduceRight (fn, y, xs) {
var reduceRight = _curry3(function reduceRight (fn, y, xs) {
var i = xs.length - 1

@@ -5,0 +5,0 @@

@@ -1,4 +0,4 @@

import _curryN from './internal/_curryN'
import _curry2 from './internal/_curry2'
var reject = _curryN(2, [], function reject (fn, xs) {
var reject = _curry2(function reject (fn, xs) {
var i = 0

@@ -5,0 +5,0 @@ , len = xs.length

@@ -1,4 +0,4 @@

import _curryN from './internal/_curryN'
import _curry2 from './internal/_curry2'
var take = _curryN(2, [], function take (n, xs) {
var take = _curry2(function take (n, xs) {
return xs.slice(0, n)

@@ -5,0 +5,0 @@ })

@@ -1,4 +0,4 @@

import _curryN from './internal/_curryN'
import _curry2 from './internal/_curry2'
var takeUntil = _curryN(2, [], function takeUntil (fn, xs) {
var takeUntil = _curry2(function takeUntil (fn, xs) {
var i = 0

@@ -5,0 +5,0 @@ , len = xs.length

var curry = Redash.curry
describe('(Function) curry', function () {
var _add3 = function (a, b, c) { return a + b + c }
it('Should be a function.', function () {
expect(curry).to.be.a('function')
})
it('Should return a function.', function () {
expect(curry(_add3)).to.be.a('function')
})
it('Should curry based off of function length.', function () {

@@ -20,10 +20,10 @@ var curr0 = curry(function () { return [].slice.call(arguments) })

var curr3 = curry(function (a, b, c) { return [].slice.call(arguments) })
expect(curr0).to.be.a('function')
expect(curr0()).to.deep.equal([])
expect(curr1).to.be.a('function')
expect(curr1()).to.be.a('function')
expect(curr1(1)).to.deep.equal([1])
expect(curr2).to.be.a('function')

@@ -34,3 +34,3 @@ expect(curr2()).to.be.a('function')

expect(curr2(1)(2)).to.deep.equal([1, 2])
expect(curr3).to.be.a('function')

@@ -43,21 +43,55 @@ expect(curr3()).to.be.a('function')

})
it('Should not bind additional arguments.', function () {
var curried = curry(_add3, 1, 2, 3)
expect(curried).to.be.a('function')
expect(curried(10, 100, 1000)).to.equal(1110)
})
it('Should ignore invocations that don\'t supply arguments.', function () {
var curried = curry(_add3)
expect(curried()()()()()()()).to.be.a('function')
})
it('Should only invoke the function once all arguments are supplied.', function () {
var curried = curry(_add3)
expect(curried()()(1)()(2)()(3)).to.equal(6)
})
it('Should report the correct arity via function.length.', function () {
var curried0 = curry(function () {})
var curried1 = curry(function (a0) {})
var curried2 = curry(function (a0, a1) {})
var curried3 = curry(function (a0, a1, a2) {})
var curried4 = curry(function (a0, a1, a2, a3) {})
var curried5 = curry(function (a0, a1, a2, a3, a4) {})
var curried6 = curry(function (a0, a1, a2, a3, a4, a5) {})
var curried7 = curry(function (a0, a1, a2, a3, a4, a5, a6) {})
var curried8 = curry(function (a0, a1, a2, a3, a4, a5, a6, a7) {})
var curried9 = curry(function (a0, a1, a2, a3, a4, a5, a6, a7, a8) {})
var curried10 = curry(function (a0, a1, a2, a3, a4, a5, a6, a7, a8, a9) {})
expect(curried0).to.have.length(0)
expect(curried1).to.have.length(1)
expect(curried2).to.have.length(2)
expect(curried3).to.have.length(3)
expect(curried4).to.have.length(4)
expect(curried5).to.have.length(5)
expect(curried6).to.have.length(6)
expect(curried7).to.have.length(7)
expect(curried8).to.have.length(8)
expect(curried9).to.have.length(9)
expect(curried10).to.have.length(10)
})
it('Should throw if the target function has an arity > 10.', function () {
var test = function () {
curry(function (a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) {})
}
expect(test).to.throw(/Arity must be less than or equal to 10/)
})
})

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