Fix code style in README.md. (#72)
This commit is contained in:
parent
c44b3126f8
commit
edacd4b839
@ -161,16 +161,16 @@ expect(result).to.eql({ scores: { team1: 0, team2: 1 } });
|
|||||||
Non-trivial array manipulations, such as element removal/insertion/sorting, can be implemented with functions. Because there are so many possible manipulations, we don't provide any helpers and leave this up to you. Simply ensure your function is pure and does not mutate its arguments.
|
Non-trivial array manipulations, such as element removal/insertion/sorting, can be implemented with functions. Because there are so many possible manipulations, we don't provide any helpers and leave this up to you. Simply ensure your function is pure and does not mutate its arguments.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
function addTodo(todos) { return [].concat(todos, [{done: false}]); }
|
function addTodo(todos) { return [].concat(todos, [{ done: false }]); }
|
||||||
var state = {
|
var state = {
|
||||||
todos: [
|
todos: [
|
||||||
{done: false},
|
{ done: false },
|
||||||
{done: false}
|
{ done: false }
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
var result = u({ todos: addTodo }, state);
|
var result = u({ todos: addTodo }, state);
|
||||||
|
|
||||||
expect(result).to.eql({ todos: [{ done: false}, { done: false }, { done: false }]});
|
expect(result).to.eql({ todos: [{ done: false }, { done: false }, { done: false }]});
|
||||||
```
|
```
|
||||||
|
|
||||||
#### When null or undefined object, updeep uses a default object
|
#### When null or undefined object, updeep uses a default object
|
||||||
|
Loading…
Reference in New Issue
Block a user