Skip to content
This repository was archived by the owner on Jan 20, 2020. It is now read-only.

BytecodeAgency/Functionals

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Functionals

Maintained by Bytecode Digital Agency

Motivation

// TODO

  • Ramda is too complicated and bloated
  • Underscores has limitations and is not intuitive
  • For Bytecode

Installation

The only requirement for using this package is having NodeJS 10. Other versions are not officially supported.

Install using yarn add functionals or npm i functionals.

Import using

import F from 'functionals';
const F = require('functionals');

Usage

// TODO

TODO

  • Configure Typescript
  • Add automated testing suite
  • Configure CI
  • Add trycatch
trycatch({
    try: something(),
    catch: somethingElse(),
})
  • Add if-then-else
conditionally({
    if: something,
    then: somethingElse,
    else: otherwise,
})
  • Add piping
pipe(initialValue, [
    functionWithoutArgs,
    anotherFunctionWithoutArgs,
    [functionWithArgs, arg2, arg3], // the piped value is arg1
])
  • Add deep merge
deepmerge({key: value, key2: {key: value}}, {key2: {key: newValue}})
// Output is {key: value, key2: {key: newValue}}
  • Add flatten array
flatten([1, 2, [3, 4]])
// Output is [1, 2, 3, 4]
  • Add most common in array
mostCommon([1, 2, 2, 3, 3, 3]) // Outputs 3
  • Add random number generator
random(10, 100) // Random (pseudo-randmo) number (integer) between 10 and 100
  • Add array splitter (Elixir style)
const testArr = [1, 2, 3, 4]
const [head, tail] = F.headTail(testArr)
// Output: head = 1, tail = [2, 3, 4]
  • Add largest in array
  • If possible, add tail recursion support
  • Setup documentation page

License

Apache 2.0

About

Functional NodeJS/Javascript helpers

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published