collect.js
Advanced tools
Comparing version 1.0.2 to 1.0.3
{ | ||
"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 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
208186
1824