Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

collect.js

Package Overview
Dependencies
Maintainers
1
Versions
149
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

collect.js - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

2

package.json
{
"name": "collect.js",
"version": "1.0.1",
"version": "1.0.2",
"description": "Convenient and dependency free wrapper for working with arrays and objects.",

@@ -5,0 +5,0 @@ "main": "src/index.js",

@@ -170,3 +170,3 @@ # <img src="https://raw.githubusercontent.com/ecrmnn/collect.js/master/collectjs.jpg" alt="collect.js">

#### ``diff()``
The diff method compares the collection against another collection or a plain PHP array based on its values. This method will return the values in the original collection that are not present in the given collection:
The diff method compares the collection against another collection or a plain array based on its values. This method will return the values in the original collection that are not present in the given collection:
```js

@@ -183,3 +183,3 @@ const collection = collect([1, 2, 3, 4, 5]);

#### ``diffKeys()``
The diffKeys method compares the collection against another collection or a plain PHP array based on its keys. This method will return the key / value pairs in the original collection that are not present in the given collection:
The diffKeys method compares the collection against another collection or a plain object based on its keys. This method will return the key / value pairs in the original collection that are not present in the given collection:
```js

@@ -186,0 +186,0 @@ const collection = collect({

@@ -264,2 +264,6 @@ 'use strict';

Collection.prototype.diff = function (values) {
if (values instanceof Collection) {
values = values.all();
}
const collection = this.items.filter(function (item) {

@@ -266,0 +270,0 @@ return values.indexOf(item) === -1;

@@ -505,2 +505,6 @@ 'use strict';

expect(collection.all()).to.eql([1, 2, 3, 4, 5]);
const diffCollection = collect([1, 2, 3, 9]);
const diff2 = collection.diff(diffCollection);
expect(diff2.all()).to.eql([4, 5]);
});

@@ -833,2 +837,6 @@

expect(collection.all()).to.eql(data);
const diffCollection = collect(diff);
const _diff2 = collection.diffKeys(diffCollection);
expect(_diff2.all()).to.eql({a: 'a', c: 'c'});
});

@@ -835,0 +843,0 @@

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