mirror of
https://github.com/cp6/my-idlers.git
synced 2025-04-21 02:28:35 +00:00
20 lines
No EOL
357 B
Markdown
20 lines
No EOL
357 B
Markdown
# `pull()`
|
|
|
|
The pull method removes and returns an item from the collection by its key:
|
|
|
|
```js
|
|
const collection = collect({
|
|
firstname: 'Michael',
|
|
lastname: 'Cera',
|
|
});
|
|
|
|
collection.pull('lastname');
|
|
|
|
// Cera
|
|
|
|
collection.all();
|
|
|
|
// { firstname: 'Michael' }
|
|
```
|
|
|
|
[View source on GitHub](https://github.com/ecrmnn/collect.js/blob/master/src/methods/pull.js) |