From 8d0f3891067b5708454ee117386cc7cbd4fb7b16 Mon Sep 17 00:00:00 2001 From: Aaron Jensen Date: Wed, 5 Aug 2015 00:39:56 -0700 Subject: [PATCH] Update full example in readme --- README.md | 46 ++++++++++++++++++++++++++++------------------ 1 file changed, 28 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index 425bd12..315152b 100644 --- a/README.md +++ b/README.md @@ -33,11 +33,15 @@ supports [partial application][currying], so the parameter order is: var u = require('updeep'); var person = { - name: { - first: 'Bill', - last: 'Sagat', - }, - children: ['Marty', 'Ashley'], + name: { first: 'Bill', last: 'Sagat' }, + children: [ + { name: 'Mary-Kate', age: 7 }, + { name: 'Ashley', age: 7 } + ], + todo: [ + 'Be funny', + 'Manage household' + ], email: 'bill@example.com', version: 1 }; @@ -45,23 +49,29 @@ var person = { var inc = function(i) { return i + 1; } var newPerson = u({ - name: { - first: 'Bob', - }, - children: { 0: 'Mary-Kate' }, + // Change first name + name: { first: 'Bob' }, + // Increment all children's ages + children: u.map({ age: inc }), + // Update email email: 'bob@example.com', + // Remove todo + todo: u.reject('Be funny'), + // Increment version version: inc }, person); - // => { -// name: { -// first: 'Bob', -// last: 'Sagat', -// }, -// children: ['Mary-Kate', 'Ashley'], -// email: 'bob@example.com', -// version: 2 -// } +// name: { first: 'Bob', last: 'Sagat' }, +// children: [ +// { name: 'Mary-Kate', age: 8 }, +// { name: 'Ashley', age: 8 } +// ], +// todo: [ +// 'Manage household' +// ], +// email: 'bob@example.com', +// version: 2 +//} ``` **NOTE**: All functions are curried, so if you see `f(x(, y))`, it can be called with either `f(x, y)` or `f(x)(y)`.