Skip to content

Commit ffc2217

Browse files
tommmyyjethrolarson
authored andcommitted
adding ramda-extension
1 parent 6fbf525 commit ffc2217

File tree

4 files changed

+1600
-14
lines changed

4 files changed

+1600
-14
lines changed

.eslintrc.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@
33
plugins: [markdown]
44
rules:
55
no-unused-vars: 0
6+
eqeqeq: 0
67
no-undef: 0
78
no-extend-native: 0

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
"eslint": "^6.6.0",
2222
"eslint-config-standard": "^6.0.0",
2323
"eslint-plugin-markdown": "^1.0.0-beta.6",
24+
"eslint-plugin-promise": "^4.2.1",
2425
"eslint-plugin-standard": "^3.0.1",
2526
"pre-commit": "^1.2.2",
2627
"roadmarks": "^1.6.3"

readme.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,9 @@ ie. they allow referencing a scope after the block in which the variables were d
115115

116116

117117
```js
118-
const addTo = x => y => x + y;
119-
var addToFive = addTo(5);
120-
addToFive(3); //returns 8
118+
const addTo = x => y => x + y
119+
var addToFive = addTo(5)
120+
addToFive(3) // returns 8
121121
```
122122
The function ```addTo()``` returns a function(internally called ```add()```), lets store it in a variable called ```addToFive``` with a curried call having parameter 5.
123123

@@ -439,7 +439,7 @@ const f = x => x + 1
439439
const g = x => x * 2
440440

441441
;[1, 2, 3].map(x => f(g(x))) // = [3, 5, 7]
442-
;[1, 2, 3].map(g).map(f) // = [3, 5, 7]
442+
;[1, 2, 3].map(g).map(f) // = [3, 5, 7]
443443
```
444444

445445
## Pointed Functor
@@ -704,7 +704,7 @@ A homomorphism is just a structure preserving map. In fact, a functor is just a
704704
```js
705705
A.of(f).ap(A.of(x)) == A.of(f(x))
706706

707-
Either.of(_.toUpper).ap(Either.of("oreos")) == Either.of(_.toUpper("oreos"))
707+
Either.of(_.toUpper).ap(Either.of('oreos')) == Either.of(_.toUpper('oreos'))
708708
```
709709

710710
### Catamorphism
@@ -723,9 +723,9 @@ An `unfold` function. An `unfold` is the opposite of `fold` (`reduce`). It gener
723723

724724
```js
725725
const unfold = (f, seed) => {
726-
function go(f, seed, acc) {
727-
const res = f(seed);
728-
return res ? go(f, res[1], acc.concat([res[0]])) : acc;
726+
function go (f, seed, acc) {
727+
const res = f(seed)
728+
return res ? go(f, res[1], acc.concat([res[0]])) : acc
729729
}
730730
return go(f, seed, [])
731731
}
@@ -753,8 +753,7 @@ In paramorphism, your reducer's arguments are the current value, the reduction o
753753
// Obviously not safe for lists containing `undefined`,
754754
// but good enough to make the point.
755755
const para = (reducer, accumulator, elements) => {
756-
if (elements.length === 0)
757-
return accumulator
756+
if (elements.length === 0) { return accumulator }
758757

759758
const head = elements[0]
760759
const tail = elements.slice(1)
@@ -763,7 +762,7 @@ const para = (reducer, accumulator, elements) => {
763762
}
764763

765764
const suffixes = list => para(
766-
(x, xs, suffxs) => [xs, ... suffxs],
765+
(x, xs, suffxs) => [xs, ...suffxs],
767766
[],
768767
list
769768
)
@@ -991,7 +990,7 @@ A **function** `f :: A => B` is an expression - often called arrow or lambda exp
991990

992991
```js
993992
// times2 :: Number -> Number
994-
const times2 = n => n * 2
993+
const times2 = n => n * 2;
995994

996995
[1, 2, 3].map(times2) // [2, 4, 6]
997996
```
@@ -1010,7 +1009,7 @@ sum([]) // TypeError: Reduce of empty array with no initial value
10101009
const first = a => a[0]
10111010
first([42]) // 42
10121011
first([]) // undefined
1013-
//or even worse:
1012+
// or even worse:
10141013
first([[42]])[0] // 42
10151014
first([])[0] // Uncaught TypeError: Cannot read property '0' of undefined
10161015

@@ -1042,7 +1041,7 @@ sum([]) // 0
10421041
const first = a => a.length ? Some(a[0]) : None()
10431042
first([42]).map(a => console.log(a)) // 42
10441043
first([]).map(a => console.log(a)) // console.log won't execute at all
1045-
//our previous worst case
1044+
// our previous worst case
10461045
first([[42]]).map(a => console.log(a[0])) // 42
10471046
first([]).map(a => console.log(a[0])) // won't execte, so we won't have error here
10481047
// more of that, you will know by function return type (Option)
@@ -1069,6 +1068,7 @@ Making your partial functions total ones, these kinds of runtime errors can be p
10691068
* [Immer](https://github.com/mweststrate/immer)
10701069
* [Ramda](https://github.com/ramda/ramda)
10711070
* [ramda-adjunct](https://github.com/char0n/ramda-adjunct)
1071+
* [ramda-extension](https://github.com/tommmyy/ramda-extension)
10721072
* [Folktale](http://folktale.origamitower.com/)
10731073
* [monet.js](https://cwmyers.github.io/monet.js/)
10741074
* [lodash](https://github.com/lodash/lodash)

0 commit comments

Comments
 (0)