Socket
Book a DemoInstallSign in
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

to
3.0.8

2

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

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

'use strict';
function Collection(collection) {
if (typeof collection === 'undefined') {
if (collection === undefined) {
this.items = [];

@@ -14,3 +14,3 @@ } else {

if (typeof key === 'undefined') {
if (key === undefined) {
collection = this.items.filter(function (element, index, self) {

@@ -45,3 +45,3 @@ return self.indexOf(element) === index;

if (typeof key === 'undefined') {
if (key === undefined) {
for (let i = 0; i < this.items.length; i++) {

@@ -78,3 +78,3 @@ total += this.items[i];

if (typeof key === 'undefined') {
if (key === undefined) {
if (length % 2 === 0) {

@@ -104,3 +104,3 @@ return (this.items[length / 2 - 1] + this.items[length / 2]) / 2;

const _values = values.filter(function (value) {
if (typeof key !== 'undefined') {
if ( key !== undefined) {
return value.key === item[key];

@@ -114,3 +114,3 @@ }

if (!_values.length) {
if (typeof key !== 'undefined') {
if (key !== undefined) {
values.push({ key: item[key], count: 1 });

@@ -264,3 +264,3 @@ } else {

Collection.prototype.where = function (key, operator, value) {
if (typeof value === 'undefined') {
if ( value === undefined) {
value = operator;

@@ -356,3 +356,3 @@ operator = '===';

Collection.prototype.pluck = function (value, key) {
if (typeof key !== 'undefined') {
if ( key !== undefined) {
const collection = {};

@@ -377,3 +377,3 @@

Collection.prototype.implode = function (key, glue) {
if (typeof glue === 'undefined') {
if ( glue === undefined) {
return this.items.join(key);

@@ -495,3 +495,3 @@ }

Collection.prototype.contains = function (key, value) {
if (typeof value !== 'undefined') {
if ( value !== undefined) {
return (this.items.hasOwnProperty(key) && this.items[key] === value);

@@ -564,3 +564,3 @@ }

Collection.prototype.flatten = function (depth) {
if (typeof depth === 'undefined') {
if (depth === undefined) {
depth = Infinity;

@@ -647,3 +647,3 @@ }

Collection.prototype.prepend = function (value, key) {
if (typeof key !== 'undefined') {
if (key !== undefined) {
return this.put(key, value);

@@ -943,2 +943,2 @@ }

return new Collection(collection);
};
};
SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.