* -> Bool
check parameter is an object, delegate to lodash.isPlainObject which is, > Checks if value is a plain object, that is, an object created by the Object constructor or one with a [[Prototype]] of null.
check parameter is an array.
check against undefined
.
[*] -> [*] -> [*]
concat two arrays.
a -> [a] -> [a]
push an element to array.
a -> a
identity function.
a -> b -> a | b
a function accepts a default value and returns a new function. This function
will return the passed value if it is not one of null
, undefined
or NaN
var hasDefault = huan.defaultTo(42);
hasDefault(null); // 42
hasDefault(20); // 20
a function first takes a number n
, which determine how to split the second parameter xs
, which
is a list.
Number n => n -> [a] -> [[a]]
var a = [1,2,3,4,5];
var splitByTo(2)(a);// [[1,2], [3,4], [5]]
also known as chain
, which concats results from functions
(a -> [a]) -> [a] -> [a]
[a] -> [b] -> {a: b}
receives two arrays (a, b) and associate them into object, with a
as key, b
as value.
a.length < b.length -> b will be cut
a.length > b.length -> b's value will be undefined
[k] -> {k: v} -> {k: v}
[k] -> {k: v} -> {k: v}
String a => a -> [{a: v}] -> [v]
[k] -> [{k: v}] -> [{k: v}]
[a] -> [[a]]
v -> [k] -> {k: v} -> {k: v}
(a -> Bool) -> {k: v} -> [v]
{k: v} -> [v]
String k => (a -> k) -> [a] -> {k: [a]}
Splits a list into sub-lists stored in an object, based on the result of calling a String-returning function on each element, and grouping the results according to values returned.
Dispatches to the groupBy method of the second argument, if present.
Acts as a transducer if a transformer is given in list position.
huan.groupBy(function(lang) {
return (lang.name === 'js' || lang.name === 'php') ? 'not-typed' : 'type';
},
[{name: 'js'}, {name: 'php'}, {name: 'haskell'}, {name: 'scala'}]
);
=>
{
'not-typed': [{name: 'js'}, {name: 'php'}],
typed: [{name: 'scala'}, {name: 'haskell'}]
}