Skip to content

Commit

Permalink
docs: fix readme
Browse files Browse the repository at this point in the history
  • Loading branch information
mesqueeb committed Feb 4, 2021
1 parent 06fc6dc commit 5c17e43
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,19 +92,21 @@ const copy1 = copy(original)
const copy2 = copy(original, { nonenumerable: true })
(copy2.id === '001') // true
```
<!-- prettier-ignore-end -->

## Limit to specific props

You can limit to specific props.

```js
const original = { name: 'Flareon', type: ['fire'], id: '136' }
const copy = copy(original, { props: ['name'] })(copy === { name: 'Flareon' })
const copy = copy(original, { props: ['name'] })

(copy === { name: 'Flareon' }) // true
```

> Please note, if the props you have specified are non-enumerable, you will also need to pass `{nonenumerable: true}`.
<!-- prettier-ignore-end -->
## Source code

The source code is literally just these lines. Most of the magic comes from the isPlainObject function from the [is-what library](https://github.com/mesqueeb/is-what).
Expand Down

0 comments on commit 5c17e43

Please sign in to comment.