collect.js
Advanced tools
Comparing version 3.0.11 to 3.0.12
{ | ||
"name": "collect.js", | ||
"version": "3.0.11", | ||
"version": "3.0.12", | ||
"description": "Convenient and dependency free wrapper for working with arrays and objects.", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -729,3 +729,7 @@ 'use strict'; | ||
if (fn === undefined) { | ||
collection.sort(); | ||
if (this.every(item => typeof item === 'number')) { | ||
collection.sort((a, b) => a - b); | ||
} else { | ||
collection.sort(); | ||
} | ||
} else { | ||
@@ -732,0 +736,0 @@ collection.sort(fn); |
@@ -1364,8 +1364,8 @@ 'use strict'; | ||
it('should sort the collection', function () { | ||
const collection = collect([5, 3, 1, 2, 4]); | ||
const collection = collect([5, 3, 1, 2, 10, 4]); | ||
const sorted = collection.sort(); | ||
expect(sorted.all()).to.eql([1, 2, 3, 4, 5]); | ||
expect(collection.all()).to.eql([5, 3, 1, 2, 4]); | ||
expect(sorted.all()).to.eql([1, 2, 3, 4, 5, 10]); | ||
expect(collection.all()).to.eql([5, 3, 1, 2, 10, 4]); | ||
@@ -1372,0 +1372,0 @@ const collection2 = collect([5, 3, 1, 2, 4]); |
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
220610
2086