Socket
Socket
Sign inDemoInstall

@supercharge/collections

Package Overview
Dependencies
1
Maintainers
3
Versions
41
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.1.0 to 2.2.0

6

CHANGELOG.md
# Changelog
## [2.2.0](https://github.com/supercharge/collections/compare/v2.1.0...v2.2.0) - 2020-07-02
### Added
- `filterIf(condition, callback)` method: a variant of the the `filter` method only filtering the collection if the `condition` evaluates to true
## [2.1.0](https://github.com/supercharge/collections/compare/v2.0.0...v2.1.0) - 2020-06-30

@@ -4,0 +10,0 @@

@@ -111,2 +111,12 @@ export declare class CollectionProxy {

/**
* A variant of the `filter` method running the (async) testing
* function only if the given `condition` is `true`.
*
* @param {Boolean} condition
* @param {Function} callback
*
* @returns {Array}
*/
filterIf(condition: boolean, callback: Function): this;
/**
* Asynchronous version of Array#find(), running the (async) testing

@@ -113,0 +123,0 @@ * function in sequence. Returns the first item in the collection

@@ -134,2 +134,14 @@ 'use strict';

/**
* A variant of the `filter` method running the (async) testing
* function only if the given `condition` is `true`.
*
* @param {Boolean} condition
* @param {Function} callback
*
* @returns {Array}
*/
filterIf(condition, callback) {
return this.enqueue('filterIf', callback, condition);
}
/**
* Asynchronous version of Array#find(), running the (async) testing

@@ -136,0 +148,0 @@ * function in sequence. Returns the first item in the collection

@@ -89,2 +89,12 @@ export declare class Collection {

/**
* A variant of the `filter` method running the (async) testing
* function only if the given `condition` is `true`.
*
* @param {Function} callback
* @param {Boolean} condition
*
* @returns {Array}
*/
filterIf(callback: Function, condition: boolean): Promise<any[]>;
/**
* Asynchronous version of Array#find(), running the (async) testing

@@ -91,0 +101,0 @@ * function in sequence. Returns the first item in the collection

@@ -123,2 +123,16 @@ 'use strict';

/**
* A variant of the `filter` method running the (async) testing
* function only if the given `condition` is `true`.
*
* @param {Function} callback
* @param {Boolean} condition
*
* @returns {Array}
*/
async filterIf(callback, condition) {
return condition
? this.filter(callback)
: this.items;
}
/**
* Asynchronous version of Array#find(), running the (async) testing

@@ -125,0 +139,0 @@ * function in sequence. Returns the first item in the collection

2

package.json
{
"name": "@supercharge/collections",
"description": "Supercharge collections",
"version": "2.1.0",
"version": "2.2.0",
"author": "Marcus Pöhls <marcus@superchargejs.com>",

@@ -6,0 +6,0 @@ "bugs": {

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc