Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

collect.js

Package Overview
Dependencies
Maintainers
1
Versions
149
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

collect.js - npm Package Compare versions

Comparing version 4.0.21 to 4.0.22

2

package.json
{
"name": "collect.js",
"version": "4.0.21",
"version": "4.0.22",
"description": "Convenient and dependency free wrapper for working with arrays and objects.",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

@@ -1335,2 +1335,43 @@ # <img src="https://raw.githubusercontent.com/ecrmnn/collect.js/master/collectjs.jpg" alt="collect.js">

You can use "dot notation" to access nested values
```js
const collection = collect([{
name: 'John',
roles: [{
name: 'Editor',
}, {
name: 'Admin',
}],
}]);
const plucked = collection.pluck('roles.0.name');
plucked.all();
//=> ['Editor']
```
"Dot notation" supports "wildcard"
```js
const collection = collect([{
name: 'John',
roles: [{
name: 'Editor',
}, {
name: 'Admin',
}],
}]);
const plucked = collection.pluck('roles.*.name');
plucked.all();
//=> [
//=> [
//=> 'Editor',
//=> 'Admin',
//=> ],
//=> ]
```
#### ``pop()``

@@ -1337,0 +1378,0 @@ The pop method removes and returns the last item from the collection:

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc