> For the complete documentation index, see [llms.txt](https://jscula.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://jscula.gitbook.io/docs/object/pick.md).

# pick()

Returns a new object with only selected keys.

```javascript
const user = { id: 1, name: 'Ada', password: 'secret' };

pick(user, ['id', 'name']); // { id: 1, name: 'Ada' }
```

### Use cases

Use `pick()` to build a request payload from approved fields.

### More examples

Create a profile payload without administrative fields:

```javascript
const formState = {
  name: 'Ada',
  email: 'ada@example.com',
  isAdmin: true
};

const profile = pick(formState, ['name', 'email']);
// { name: 'Ada', email: 'ada@example.com' }
```
