pe-fp
TypeScript icon, indicating that this package has built-in type declarations

0.0.2 • Public • Published

pe-fp

Functional programming in plain english

TL;DR

Allows to turn this:

const cake = cooledOnDampTeaTowel(bakedIn(preheated("oven"))(whiskedUntilSmooth(mixed(["flour", "eggs", "sugar", "chocolate"]))))

expect(`A ${cake}`).toBe(
  "A room temperature cake made from whisked batter made out of flour, eggs, sugar and chocolate baked in a preheated oven"
);

Into this:

export const preparedCake = startsWith(mixed, "ingredients")
  .andThen(is(whiskedUntilSmooth))
  .andThen(is(bakedIn(preheated("oven"))))
  .andThen(is(cooledOnDampTeaTowel));
  
expect(`A ${preparedCake(["flour", "eggs", "sugar", "chocolate"])}`).toBe(
  "A room temperature cake made from whisked batter made out of flour, eggs, sugar and chocolate baked in a preheated oven"
);

Package Sidebar

Install

npm i pe-fp

Weekly Downloads

5

Version

0.0.2

License

ISC

Unpacked Size

21 kB

Total Files

25

Last publish

Collaborators

  • apokralipsa