Skip to content

Commit

Permalink
add note to readme about sparse arrays
Browse files Browse the repository at this point in the history
  • Loading branch information
nlf committed Jul 31, 2014
1 parent be8cacc commit 8d8ad61
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,13 @@ Riddler.parse('a[1]=c&a[0]=b');

Note that the only difference between an index in an array and a key in an object is that the value between the brackets must be a number to create an array.

When creating arrays with specific indices, riddler will compact a sparse array to only the existing values preserving their order:

```javascript
Riddler.parse('a[1]=b&a[15]=c');
// { a: ['b', 'c'] }
```

If you mix notations, riddler will merge the two items into an object:

```javascript
Expand Down

0 comments on commit 8d8ad61

Please sign in to comment.