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 1.0.2 to 1.0.3

2

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

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

@@ -182,3 +182,3 @@ 'use strict';

if (Object.keys(collection).indexOf(resolvedKey) === -1) {
if (!collection.hasOwnProperty(resolvedKey)) {
collection[resolvedKey] = [];

@@ -185,0 +185,0 @@ }

@@ -373,2 +373,71 @@ 'use strict';

});
const collection2 = collect([{
"id": 10,
"title": "Quia dolorem consequatur voluptatibus totam doloribus impedit.",
"description": "Consequuntur et ab cum sit omnis architecto maiores est voluptate cupiditate odio sed assumenda.",
"value": "6",
"order": null,
"parent_id": null,
"estimate_id": 10,
"created_at": "2016-09-26 17:08:40",
"updated_at": "2016-09-26 17:08:40"
}, {
"id": 21,
"title": "Quia dolorem consequatur voluptatibus totam doloribus impedit.",
"description": "Consequuntur et ab cum sit omnis architecto maiores est voluptate cupiditate odio sed assumenda.",
"value": "6",
"order": null,
"parent_id": 10,
"estimate_id": 10,
"created_at": "2016-09-26 17:08:40",
"updated_at": "2016-09-26 17:08:40"
}, {
"id": 22,
"title": "Quia dolorem consequatur voluptatibus totam doloribus impedit.",
"description": "Consequuntur et ab cum sit omnis architecto maiores est voluptate cupiditate odio sed assumenda.",
"value": "6",
"order": null,
"parent_id": 10,
"estimate_id": 10,
"created_at": "2016-09-26 17:08:40",
"updated_at": "2016-09-26 17:08:40"
}]);
const grouped3 = collection2.groupBy('parent_id');
expect(grouped3.all()).to.eql({
10: [{
"id": 21,
"title": "Quia dolorem consequatur voluptatibus totam doloribus impedit.",
"description": "Consequuntur et ab cum sit omnis architecto maiores est voluptate cupiditate odio sed assumenda.",
"value": "6",
"order": null,
"parent_id": 10,
"estimate_id": 10,
"created_at": "2016-09-26 17:08:40",
"updated_at": "2016-09-26 17:08:40"
}, {
"id": 22,
"title": "Quia dolorem consequatur voluptatibus totam doloribus impedit.",
"description": "Consequuntur et ab cum sit omnis architecto maiores est voluptate cupiditate odio sed assumenda.",
"value": "6",
"order": null,
"parent_id": 10,
"estimate_id": 10,
"created_at": "2016-09-26 17:08:40",
"updated_at": "2016-09-26 17:08:40"
}],
null: [{
"id": 10,
"title": "Quia dolorem consequatur voluptatibus totam doloribus impedit.",
"description": "Consequuntur et ab cum sit omnis architecto maiores est voluptate cupiditate odio sed assumenda.",
"value": "6",
"order": null,
"parent_id": null,
"estimate_id": 10,
"created_at": "2016-09-26 17:08:40",
"updated_at": "2016-09-26 17:08:40"
}]
});
});

@@ -375,0 +444,0 @@

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