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

machinepack-arrays

Package Overview
Dependencies
Maintainers
4
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

machinepack-arrays - npm Package Compare versions

Comparing version 4.1.0 to 4.2.0

30

machines/map.js

@@ -52,2 +52,5 @@ module.exports = {

},
skip: {
friendlyName: 'skip item'
},
success: {

@@ -106,7 +109,14 @@ friendlyName: 'next item',

// Track the index of all iterations which trigger the `exclude` exit.
var excludedIndices = [];
// Start iterating...
iteratorFn(inputs.array, function enumerator(item, next) {
var indices = _.keys(inputs.array);
iteratorFn(indices, function enumerator(currentIndex, next) {
// Increment iterations counter and track current index
var currentIndex = numIterationsStarted;
// We iterate over indices instead of the items themselves to avoid
// parallel execution throwing us off.
var item = inputs.array[currentIndex];
// Increment iterations counter
numIterationsStarted++;

@@ -129,2 +139,9 @@

// Exclude (skip item) exit
// (implies that we should exclude this item from the result set)
exclude: function (){
excludedIndices.push(currentIndex);
next();
},
// Default (success) exit

@@ -140,2 +157,9 @@ // (implies that we should continue iterating)

}
// Remove items that were skipped above.
if (excludedIndices.length > 0) {
var retainedIndices = _.difference(indices, excludedIndices);
transformedArray = _.at(transformedArray, retainedIndices);
}
return exits.success(transformedArray);

@@ -142,0 +166,0 @@ });

2

package.json
{
"name": "machinepack-arrays",
"version": "4.1.0",
"version": "4.2.0",
"description": "Work with arrays.",

@@ -5,0 +5,0 @@ "scripts": {

@@ -85,4 +85,19 @@ {

]
},
{
"using": {
"array": [
10,
20,
30
],
"itemExample": 1,
"iteratee": "if (inputs.index % 2 === 0) { /* exclude even-numbered indices */ return exits.exclude(); } return exits.success(inputs.item+inputs.index);"
},
"outcome": "success",
"returns": [
21
]
}
]
}
}
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