collect.js
Advanced tools
Comparing version 3.0.22 to 3.0.26
{ | ||
"name": "collect.js", | ||
"version": "3.0.22", | ||
"version": "3.0.26", | ||
"description": "Convenient and dependency free wrapper for working with arrays and objects.", | ||
"main": "src/index.js", | ||
"typings": "index.d.ts", | ||
"scripts": { | ||
"test": "node_modules/.bin/mocha test/tests.js", | ||
"test:watch": "node_modules/.bin/mocha -w test/tests.js" | ||
"test:watch": "node_modules/.bin/mocha -w test/tests.js", | ||
"coverage": "node_modules/.bin/nyc mocha test/tests.js", | ||
"reporter": "node_modules/.bin/nyc report --reporter=html" | ||
}, | ||
@@ -44,4 +47,5 @@ "repository": { | ||
"chai": "^3.5.0", | ||
"mocha": "^2.4.5" | ||
"mocha": "^2.4.5", | ||
"nyc": "^11.0.2" | ||
} | ||
} | ||
} |
@@ -1690,3 +1690,37 @@ # <img src="https://raw.githubusercontent.com/ecrmnn/collect.js/master/collectjs.jpg" alt="collect.js"> | ||
``` | ||
**Less than or equal operator ``(<=)``** | ||
```js | ||
const filtered = collection.where('price', '<=', 100); | ||
filtered.all(); | ||
//=> [ | ||
//=> {product: 'Chair', price: 100}, | ||
//=> {product: 'Door', price: 100} | ||
//=> ] | ||
``` | ||
**Greater than operator ``(>)``** | ||
```js | ||
const filtered = collection.where('price', '>', 100); | ||
filtered.all(); | ||
//=> [ | ||
//=> {product: 'Desk', price: 200}, | ||
//=> {product: 'Bookcase', price: 150} | ||
//=> ] | ||
``` | ||
**Greater than or equal operator ``(>=)``** | ||
```js | ||
const filtered = collection.where('price', '>=', 150); | ||
filtered.all(); | ||
//=> [ | ||
//=> {product: 'Desk', price: 200}, | ||
//=> {product: 'Bookcase', price: 150} | ||
//=> ] | ||
``` | ||
#### ``whereIn()`` | ||
@@ -1693,0 +1727,0 @@ The whereIn method filters the collection by a given key / value contained within the given array. |
@@ -5,8 +5,10 @@ 'use strict'; | ||
const chunks = []; | ||
let index = 0; | ||
while (this.items.length) { | ||
chunks.push(this.items.splice(0, size)); | ||
} | ||
do { | ||
chunks.push(this.items.slice(index, index + size)); | ||
index += size; | ||
} while (index < this.items.length); | ||
return new this.constructor(chunks); | ||
}; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
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
329525
102
1783
4
1674
1