You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
357 B
20 lines
357 B
4 years ago
|
# `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)
|