Comparing version 0.10.4 to 0.11.0
@@ -202,2 +202,17 @@ (function (global, factory) { | ||
/** | ||
* curryN : Number n -> (a, b, ..., n -> v) -> a -> b -> ... -> n -> v | ||
* | ||
* @since v0.1.0 | ||
*/ | ||
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(arity, [], fn) | ||
} | ||
}) | ||
/** | ||
* complement : (*... -> Boolean) -> (*... -> Boolean) | ||
@@ -208,3 +223,3 @@ * | ||
function complement (fn) { | ||
return _curryN(fn.length, [], function () { | ||
return curryN(fn.length, function () { | ||
return !fn.apply(this, arguments) | ||
@@ -246,18 +261,2 @@ }) | ||
/** | ||
* curryN : Number n -> (a, b, ..., n -> v) -> a -> b -> ... -> n -> v | ||
* | ||
* @since v0.1.0 | ||
*/ | ||
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(arity, [], fn) | ||
} | ||
}) | ||
/** | ||
* curry : (a, b, ..., j -> v) -> a -> b -> ... -> j -> v | ||
@@ -552,2 +551,15 @@ * | ||
/** | ||
* | ||
* @param {Function} get | ||
* @param {Function} set | ||
* @returns {Function} | ||
*/ | ||
var lens = _curry2(function lens (getter, setter) { | ||
return { | ||
get: getter, | ||
set: setter, | ||
} | ||
}) | ||
/** | ||
* map : (a -> b) -> [a] -> [b] | ||
@@ -630,2 +642,12 @@ * | ||
/** | ||
* @param {Lens} lens | ||
* @param {Function} fn | ||
* @param {Object|*} target | ||
* @returns {*} | ||
*/ | ||
var over = _curry3(function over (lens, fn, target) { | ||
return set(lens, fn(lens.get(target)), target) | ||
}) | ||
/** | ||
* prop : String -> {k:v} -> v | ||
@@ -653,8 +675,19 @@ * | ||
*/ | ||
var rangeBy = _curry3(function rangeBy (inc, i, end) { | ||
var rangeBy = _curry3(function rangeBy (inc, start, end) { | ||
var ys = [] | ||
, times | ||
for (; i < end; i += inc) { | ||
ys.push(i) | ||
// TODO: should (some of) these throw? | ||
if ( | ||
inc === 0 || | ||
inc > 0 && start > end || | ||
inc < 0 && start < end | ||
) { | ||
return [] | ||
} | ||
times = Math.abs(Math.ceil((end - start) / inc)) | ||
for (var i = 0; i < times; i++) { | ||
ys.push(start + (inc * i)) | ||
} | ||
return ys | ||
@@ -664,3 +697,3 @@ }) | ||
/** | ||
* range : Number -> [Number] | ||
* range : Number -> Number -> [Number] | ||
* | ||
@@ -699,2 +732,12 @@ * @since v0.7.0 | ||
/** | ||
* @param {Lens} lens | ||
* @param {*} value | ||
* @param {Object|*} target | ||
* @returns {*} | ||
*/ | ||
var set$1 = _curry3(function set (lens, value, target) { | ||
return lens.set(value, target) | ||
}) | ||
/** | ||
* sum : [Number] -> Number | ||
@@ -801,2 +844,11 @@ * | ||
/** | ||
* @param {Lens} lens | ||
* @param {Object|*} target | ||
* @returns {*} | ||
*/ | ||
var view = _curry2(function view (lens, target) { | ||
return lens.get(target) | ||
}) | ||
/** | ||
* without : [a] -> [a] -> [a] | ||
@@ -888,2 +940,3 @@ * | ||
exports.last = last; | ||
exports.lens = lens; | ||
exports.map = map; | ||
@@ -893,2 +946,3 @@ exports.merge = merge; | ||
exports.of = of; | ||
exports.over = over; | ||
exports.pipe = pipe; | ||
@@ -905,2 +959,3 @@ exports.prop = prop; | ||
exports.reverse = reverse; | ||
exports.set = set$1; | ||
exports.sum = sum; | ||
@@ -915,2 +970,3 @@ exports.tail = tail; | ||
exports.toPairs = toPairs; | ||
exports.view = view; | ||
exports.without = without; | ||
@@ -917,0 +973,0 @@ exports.zip = zip; |
{ | ||
"name": "redash", | ||
"version": "0.10.4", | ||
"description": "", | ||
"version": "0.11.0", | ||
"description": "Compact library for writing performant functional JavaScript", | ||
"main": "dist/redash.js", | ||
@@ -6,0 +6,0 @@ "directories": { |
19892
858