Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
Added keepArray option to don't transform array into indexed object
  • Loading branch information
murilobd committed May 12, 2020
1 parent 67142e7 commit 2262089
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,33 @@ Result:
}
```

### Keep array

Set keepArray to true.

```javascript
var dot = require('dot-object');

var obj = {
id: 'my-id',
other: [1, 2, 3],
some: { array: ['A', 'B'] }
};

dot.keepArray = true;
var tgt = dot.dot(obj);

console.log(tgt);
```
Result:
```json
{
"id": "my-id",
"other": [1, 2, 3],
"some.array": ["A", "B"]
}
```

## Using a different separator

If you do not like dot notation, you are free to specify a different separator.
Expand Down

0 comments on commit 2262089

Please sign in to comment.