Radash

Functional utility library - modern, simple, typed, powerful

README

Radash


:loud_sound: /raw-dash/

radash

    Functional utility library - modern, simple, typed, powerful

            Full Documentation


Install

  1. ```
  2. yarn add radash
  3. ```

Usage

A very brief kitchen sink. See the full documentation here.

  1. ```ts
  2. import * as _ from 'radash'

  3. const gods = [{
  4.   name: 'Ra',
  5.   power: 'sun',
  6.   rank: 100,
  7.   culture: 'egypt'
  8. }, {
  9.   name: 'Loki',
  10.   power: 'tricks',
  11.   rank: 72,
  12.   culture: 'norse'
  13. }, {
  14.   name: 'Zeus',
  15.   power: 'lightning',
  16.   rank: 96,
  17.   culture: 'greek'
  18. }]

  19. _.max(gods, g => g.rank) // => ra
  20. _.sum(gods, g => g.rank) // => 268
  21. _.fork(gods, g => g.culture === 'norse') // => [[loki], [ra, zeus]]
  22. _.sort(gods, g => g.rank) // => [ra, zeus, loki]
  23. _.boil(gods, (a, b) => a.rank > b.rank ? a : b) // => ra

  24. _.objectify(
  25.   gods,
  26.   g => g.name.toLowerCase(),
  27.   g => _.pick(g, ['power', 'rank', 'culture'])
  28. ) // => { ra, zeus, loki }

  29. const godName = _.get(gods, g => g[0].name)

  30. const [err, god] = await _.try(api.gods.findByName)(godName)

  31. const allGods = await _.map(gods, async ({ name }) => {
  32.   return api.gods.findByName(name)
  33. })
  34. ```

Contributing


Contributions are welcome and appreciated! Check out the contributing guide before you dive in.