Socket
Socket
Sign inDemoInstall

@supercharge/collections

Package Overview
Dependencies
Maintainers
3
Versions
41
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@supercharge/collections - npm Package Compare versions

Comparing version 3.1.4 to 3.2.0

dist/sync-collection-iterator.d.ts

10

dist/sync-collection.d.ts
import { PendingAsyncCollection } from './pending-async-collection';
export declare class SyncCollection<T> {
export declare class SyncCollection<T> implements Iterable<T> {
/**

@@ -14,2 +14,8 @@ * Stores the list of items in the collection.

/**
* Returns an iterable of the values in the collection.
*
* @returns {IterableIterator}
*/
[Symbol.iterator](): IterableIterator<T>;
/**
* Returns the array of items.

@@ -38,3 +44,3 @@ *

/**
* Breaks the collection into multiple, smaller collections of the given `size`.
* Split the collection into multiple, smaller collections of the given `size`.
*

@@ -41,0 +47,0 @@ * @param {Number} size

50

dist/sync-collection.js

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

/**
* Returns an iterable of the values in the collection.
*
* @returns {IterableIterator}
*/
[Symbol.iterator]() {
return this.items[Symbol.iterator]();
}
/**
* Returns the array of items.

@@ -36,3 +44,3 @@ *

/**
* Breaks the collection into multiple, smaller collections of the given `size`.
* Split the collection into multiple, smaller collections of the given `size`.
*

@@ -92,3 +100,3 @@ * @param {Number} size

}
return goodies_1.isAsyncFunction(predicate)
return (0, goodies_1.isAsyncFunction)(predicate)
? this.proxy('count', predicate).all()

@@ -110,3 +118,3 @@ : this.filter(predicate).size();

every(predicate) {
return goodies_1.isAsyncFunction(predicate)
return (0, goodies_1.isAsyncFunction)(predicate)
? this.proxy('every', predicate)

@@ -116,3 +124,3 @@ : this.items.every(predicate);

filter(predicate) {
return goodies_1.isAsyncFunction(predicate)
return (0, goodies_1.isAsyncFunction)(predicate)
? this.proxy('filter', predicate)

@@ -122,3 +130,3 @@ : new SyncCollection(this.items.filter(predicate));

filterIf(condition, predicate) {
if (goodies_1.isAsyncFunction(predicate)) {
if ((0, goodies_1.isAsyncFunction)(predicate)) {
return this.proxy('filterIf', predicate, condition);

@@ -131,3 +139,3 @@ }

find(predicate) {
return goodies_1.isAsyncFunction(predicate)
return (0, goodies_1.isAsyncFunction)(predicate)
? this.proxy('find', predicate).all()

@@ -140,3 +148,3 @@ : this.items.find(predicate);

}
return goodies_1.isAsyncFunction(predicate)
return (0, goodies_1.isAsyncFunction)(predicate)
? this.proxy('first', predicate).all()

@@ -154,3 +162,3 @@ : this.find(predicate);

flatMap(action) {
return goodies_1.isAsyncFunction(action)
return (0, goodies_1.isAsyncFunction)(action)
? this.proxy('flatMap', action)

@@ -160,3 +168,3 @@ : this.map(action).collapse();

forEach(action) {
return goodies_1.isAsyncFunction(action)
return (0, goodies_1.isAsyncFunction)(action)
? this.proxy('forEach', action).all()

@@ -186,3 +194,3 @@ : this.items.forEach(action);

has(predicate) {
if (goodies_1.isAsyncFunction(predicate)) {
if ((0, goodies_1.isAsyncFunction)(predicate)) {
return this.proxy('has', predicate);

@@ -250,3 +258,3 @@ }

}
return goodies_1.isAsyncFunction(predicate)
return (0, goodies_1.isAsyncFunction)(predicate)
? this.proxy('last', predicate).all()

@@ -256,3 +264,3 @@ : this.filter(predicate).last();

map(action) {
return goodies_1.isAsyncFunction(action)
return (0, goodies_1.isAsyncFunction)(action)
? this.proxy('map', action)

@@ -337,3 +345,3 @@ : new SyncCollection(this.items.map(action));

pop() {
return goodies_1.tap(this.clone().last(), () => {
return (0, goodies_1.tap)(this.clone().last(), () => {
this.items.pop();

@@ -350,3 +358,3 @@ });

push(...items) {
return goodies_1.tap(this, () => {
return (0, goodies_1.tap)(this, () => {
this.items.push(...items);

@@ -356,3 +364,3 @@ });

reduce(reducer, accumulator) {
if (goodies_1.isAsyncFunction(reducer)) {
if ((0, goodies_1.isAsyncFunction)(reducer)) {
return this.proxy('reduce', reducer, accumulator).all();

@@ -366,3 +374,3 @@ }

reduceRight(reducer, accumulator) {
if (goodies_1.isAsyncFunction(reducer)) {
if ((0, goodies_1.isAsyncFunction)(reducer)) {
return this.proxy('reduceRight', reducer, accumulator).all();

@@ -377,3 +385,3 @@ }

reject(predicate) {
if (goodies_1.isAsyncFunction(predicate)) {
if ((0, goodies_1.isAsyncFunction)(predicate)) {
return this.proxy('reject', predicate);

@@ -400,3 +408,3 @@ }

shift() {
return goodies_1.tap(this.clone().first(), () => {
return (0, goodies_1.tap)(this.clone().first(), () => {
this.items.shift();

@@ -444,3 +452,3 @@ });

some(predicate) {
return goodies_1.isAsyncFunction(predicate)
return (0, goodies_1.isAsyncFunction)(predicate)
? this.proxy('some', predicate).all()

@@ -538,3 +546,3 @@ : this.items.some(predicate);

uniqueBy(selector) {
if (goodies_1.isAsyncFunction(selector)) {
if ((0, goodies_1.isAsyncFunction)(selector)) {
return this.proxy('uniqueBy', selector);

@@ -571,3 +579,3 @@ }

unshift(...items) {
return goodies_1.tap(this, () => {
return (0, goodies_1.tap)(this, () => {
this.items.unshift(...items);

@@ -574,0 +582,0 @@ });

{
"name": "@supercharge/collections",
"description": "Supercharge collections",
"version": "3.1.4",
"version": "3.2.0",
"author": "Marcus Pöhls <marcus@superchargejs.com>",

@@ -10,19 +10,17 @@ "bugs": {

"dependencies": {
"@supercharge/goodies": "~1.8.0",
"@supercharge/goodies": "~1.10.0",
"@supercharge/queue-datastructure": "~2.1.0"
},
"devDependencies": {
"@hapi/code": "~8.0.2",
"@hapi/lab": "~24.1.0",
"@hapi/code": "~8.0.3",
"@hapi/lab": "~24.3.2",
"@supercharge/tsconfig": "~1.0.0",
"@typescript-eslint/eslint-plugin": "~4.14.1",
"eslint": "~7.18.0",
"eslint-config-standard": "~16.0.2",
"eslint-config-standard-with-typescript": "~20.0.0",
"eslint-plugin-import": "~2.22.1",
"@typescript-eslint/eslint-plugin": "~4.32.0",
"eslint": "~7.32.0",
"eslint-config-standard": "~16.0.3",
"eslint-config-standard-with-typescript": "~21.0.1",
"eslint-plugin-import": "~2.25.2",
"eslint-plugin-node": "~11.1.0",
"eslint-plugin-promise": "~4.2.1",
"eslint-plugin-standard": "~4.1.0",
"sinon": "~9.2.4",
"typescript": "~4.1.3"
"eslint-plugin-promise": "~5.1.0",
"typescript": "~4.4.4"
},

@@ -29,0 +27,0 @@ "engines": {

@@ -129,3 +129,3 @@ <div align="center">

> [superchargejs.com](https://superchargejs.com) &nbsp;&middot;&nbsp;
> GitHub [@supercharge](https://github.com/supercharge/) &nbsp;&middot;&nbsp;
> GitHub [@supercharge](https://github.com/supercharge) &nbsp;&middot;&nbsp;
> Twitter [@superchargejs](https://twitter.com/superchargejs)
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