Skip to content
forked from sodiray/radash

Functional utility library - modern, simple, typed, powerful

License

Notifications You must be signed in to change notification settings

rafawendel/radash

This branch is 1 commit ahead of sodiray/radash:master.

Folders and files

NameName
Last commit message
Last commit date
Feb 21, 2024
Feb 21, 2024
Feb 21, 2024
Jun 24, 2024
Dec 27, 2022
Oct 26, 2022
Jan 8, 2023
Jan 8, 2023
Jul 14, 2022
Jan 8, 2023
Sep 9, 2021
Jun 24, 2024
Nov 8, 2022
Nov 5, 2022
Dec 31, 2022

Repository files navigation

Radash

🔊 /raw-dash/

radash

Functional utility library - modern, simple, typed, powerful

bundle size npm downloads npm version MIT license

Install

yarn add radash

Usage

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

import * as _ from 'radash'

const gods = [{
  name: 'Ra',
  power: 'sun',
  rank: 100,
  culture: 'egypt'
}, {
  name: 'Loki',
  power: 'tricks',
  rank: 72,
  culture: 'norse'
}, {
  name: 'Zeus',
  power: 'lightning',
  rank: 96,
  culture: 'greek'
}]

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

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

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

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

const allGods = await _.map(gods, async ({ name }) => {
  return api.gods.findByName(name)
})

Contributing

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

About

Functional utility library - modern, simple, typed, powerful

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • TypeScript 73.8%
  • JavaScript 26.2%