huan
FP
Last updated 5 years ago by geastwood .
MIT · Original npm · Tarball · package.json
$ cnpm install huan 
SYNC missed versions from official npm registry.

API

defaultTo

a -> b -> a | b

var hasDefault = huan.defaultTo(42);
hasDefault(null); // 42
hasDefault(20); // 20

chunk

Number n => n -> [a] -> [[a]]

flatMap

(a -> [a]) -> [a] -> [a]

difference

[a] -> [a] - [a]

mapObj

filterObj

reduceObj

omit

[k] -> {k: v} -> {k: v}

pick

[k] -> {k: v} -> {k: v}

pluck

String a => a -> [{a: v}] -> [v]

project

[k] -> [{k: v}] -> [{k: v}]

pair

[a] -> [[a]]

patch

v -> [k] -> {k: v} -> {k: v}

valueIf

(a -> Bool) -> {k: v} -> [v]

values

{k: v} -> [v]

groupBy

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';
  },
  {
    'not-typed': [{name: 'js'}, {name: 'php'}],
    typed: [{name: 'scala'}, {name: 'haskell'}]
  }
);

Current Tags

  • 0.0.13                                ...           latest (4 years ago)

13 Versions

  • 0.0.13                                ...           4 years ago
  • 0.0.12                                ...           5 years ago
  • 0.0.11                                ...           5 years ago
  • 0.0.10                                ...           5 years ago
  • 0.0.9                                ...           5 years ago
  • 0.0.8                                ...           5 years ago
  • 0.0.7                                ...           5 years ago
  • 0.0.6                                ...           5 years ago
  • 0.0.5                                ...           5 years ago
  • 0.0.4                                ...           5 years ago
  • 0.0.3                                ...           5 years ago
  • 0.0.2                                ...           5 years ago
  • 0.0.1                                ...           5 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (4)
Dev Dependencies (1)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |