From e918b396ecd14c61f40b6350841999eb0333b992 Mon Sep 17 00:00:00 2001 From: Iain Diamond Date: Sat, 10 Sep 2016 06:39:05 +0100 Subject: [PATCH] Update monad example (#115) Monad description mentions 'of' function; update the example to use this. --- readme.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/readme.md b/readme.md index 57b0296..7a28a12 100644 --- a/readme.md +++ b/readme.md @@ -488,10 +488,10 @@ Array.prototype.chain = function (f) { } // Usage -;['cat,dog', 'fish,bird'].chain((a) => a.split(',')) // ['cat', 'dog', 'fish', 'bird'] +;Array.of('cat,dog', 'fish,bird').chain((a) => a.split(',')) // ['cat', 'dog', 'fish', 'bird'] // Contrast to map -;['cat,dog', 'fish,bird'].map((a) => a.split(',')) // [['cat', 'dog'], ['fish', 'bird']] +;Array.of('cat,dog', 'fish,bird').map((a) => a.split(',')) // [['cat', 'dog'], ['fish', 'bird']] ``` `of` is also known as `return` in other functional languages.