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

@josecarlosrz/array-helper

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@josecarlosrz/array-helper - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

unique.js

65

index.js
module.exports = {
unique: function(array) {
forEach: async function(array, closure) {
return array.filter(function(value, index, that) {
return that.indexOf(value) === index;
});
let thisArg;
if (arguments.length > 2) {
thisArg = arguments[2];
}
for (let i = 0; i < array.length; i++) {
await closure.call(thisArg, array[i], i, array);
}
},
forEach: async function(array) {
find: async function(array, closure) {

@@ -20,3 +26,7 @@ let thisArg;

for (let i = 0; i < array.length; i++) {
await closure.call(thisArg, array[i], i, array);
if (await closure.call(thisArg, array[i], i, array)) {
return array[i];
}
}

@@ -26,2 +36,22 @@

findIndex: async function(array, closure) {
let thisArg;
if (arguments.length > 2) {
thisArg = arguments[2];
}
for (let i = 0; i < array.length; i++) {
if (await closure.call(thisArg, array[i], i, array)) {
return i;
}
}
return -1;
},
map: async function(array, closure) {

@@ -91,2 +121,22 @@

every: async function(array, closure) {
let thisArg;
if (arguments.length > 2) {
thisArg = arguments[2];
}
for (let i = 0; i < array.length; i++) {
if (!await closure.call(thisArg, array[i], i, array)) {
return false;
}
}
return true;
},
reduce: async function(array, closure, value = null) {

@@ -104,3 +154,3 @@

for (let i = array.length; i >= 0; i--) {
for (let i = array.length - 1; i >= 0; i--) {
value = await closure(value, array[i], i, array);

@@ -114,3 +164,4 @@ }

shuffle: require('./shuffle'),
unique: require('./unique'),
};

2

package.json
{
"name": "@josecarlosrz/array-helper",
"version": "1.0.0",
"version": "1.0.1",
"description": "Array helper to have async behavior and some util methods",

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

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