machinepack-arrays
Advanced tools
Comparing version 5.2.0 to 5.3.0
@@ -22,2 +22,3 @@ module.exports = { | ||
firstArray: { | ||
friendlyName: 'First array', | ||
description: 'The first array', | ||
@@ -29,2 +30,3 @@ example: ['*'], | ||
secondArray: { | ||
friendlyName: 'Second array', | ||
description: 'The second array', | ||
@@ -48,5 +50,5 @@ example: ['*'], | ||
success: { | ||
friendlyName: 'then', | ||
description: 'Returns a new array consisting of the items of both arrays, in order.', | ||
variableName: 'newArray', | ||
outputFriendlyName: 'Concatenated Array', | ||
outputDescription: 'The result of concatenating the input arrays.', | ||
getExample: function (inputs, env){ | ||
@@ -53,0 +55,0 @@ var _ = env._; |
@@ -22,2 +22,3 @@ module.exports = { | ||
array: { | ||
friendlyName: 'Array', | ||
description: 'The homogeneous array to build.', | ||
@@ -39,4 +40,4 @@ example: ['*'], | ||
description: 'Returns new array.', | ||
variableName: 'newArray', | ||
friendlyName: 'then', | ||
outputFriendlyName: 'New Array', | ||
outputDescription: 'A new array.', | ||
like: 'array' | ||
@@ -43,0 +44,0 @@ } |
@@ -13,2 +13,3 @@ module.exports = { | ||
array: { | ||
friendlyName: 'Array', | ||
description: 'The array to loop over', | ||
@@ -43,11 +44,11 @@ example: ['*'], | ||
error: { | ||
friendlyName: 'break with error', | ||
friendlyName: 'Break with error', | ||
description: 'Something went wrong- stop iterating and skip over all remaining items.' | ||
}, | ||
halt: { | ||
friendlyName: 'break', | ||
friendlyName: 'Break', | ||
description: 'Everything is ok, but stop iterating and skip over all remaining items.' | ||
}, | ||
success: { | ||
friendlyName: 'next item', | ||
friendlyName: 'Next item', | ||
description: 'Continue to next item, or if there are no more items, stop.' | ||
@@ -61,2 +62,3 @@ } | ||
series: { | ||
friendlyName: 'One item at a time?', | ||
description: 'Whether to run iteratee on one item at a time (in series)', | ||
@@ -63,0 +65,0 @@ extendedDescription: 'By default, all items are run at the same time (in parallel)', |
@@ -40,8 +40,8 @@ module.exports = { | ||
notFound: { | ||
friendlyName: 'not found', | ||
friendlyName: 'Not found', | ||
description: 'Array does not contain specified item.' | ||
}, | ||
success: { | ||
friendlyName: 'found', | ||
variableName: 'foundAtIndex', | ||
outputFriendlyName: 'Found at index', | ||
outputDescription: 'The index where the array item is located.', | ||
description: 'Returns the array index where the item is located (starting with 0)', | ||
@@ -48,0 +48,0 @@ example: 8 |
@@ -40,8 +40,8 @@ module.exports = { | ||
notFound: { | ||
friendlyName: 'not found', | ||
friendlyName: 'Not found', | ||
description: 'Array does not contain an item matching the specified criteria.' | ||
}, | ||
success: { | ||
friendlyName: 'found', | ||
variableName: 'foundItem', | ||
outputFriendlyName: 'Found item', | ||
outputDescription: 'The first item in the that matches the criteria.', | ||
description: 'Returns the matching dictionary.', | ||
@@ -48,0 +48,0 @@ itemOf: 'array' |
@@ -40,3 +40,4 @@ module.exports = { | ||
success: { | ||
variableName: 'foundItems', | ||
outputFriendlyName: 'Found items', | ||
outputDescription: 'The array of items matching the criteria.', | ||
description: 'Returns the matching dictionaries.', | ||
@@ -43,0 +44,0 @@ like: 'array' |
@@ -43,8 +43,8 @@ module.exports = { | ||
notFound: { | ||
friendlyName: 'not found', | ||
friendlyName: 'Not found', | ||
description: 'Array does not contain specified item.' | ||
}, | ||
success: { | ||
friendlyName: 'found', | ||
variableName: 'foundAtIndex', | ||
outputFriendlyName: 'Found at index', | ||
outputDescription: 'The index where the array item is located.', | ||
description: 'Returns the array index where the item is located (starting with 0)', | ||
@@ -51,0 +51,0 @@ example: 8 |
@@ -52,2 +52,3 @@ module.exports = { | ||
notFound: { | ||
friendlyName: 'Not found', | ||
description: 'The array does not have enough items for anything to exist at the specified index.', | ||
@@ -58,2 +59,4 @@ }, | ||
description: 'Returns the new array.', | ||
outputFriendlyName: 'Array with inserted item', | ||
outputDescription: 'The resulting array after inserting the new item.', | ||
like: 'array' | ||
@@ -60,0 +63,0 @@ }, |
@@ -35,2 +35,3 @@ module.exports = { | ||
notFound: { | ||
friendlyName: 'Not found', | ||
description: 'The array is empty, so it doesn\'t have any items.', | ||
@@ -41,2 +42,4 @@ }, | ||
description: 'Returns the last item in the array.', | ||
outputFriendlyName: 'Last item', | ||
outputDescription: 'The last item in the array.', | ||
itemOf: 'array' | ||
@@ -43,0 +46,0 @@ }, |
@@ -32,3 +32,5 @@ module.exports = { | ||
description: 'Returns the number of items in the array.', | ||
example: 32 | ||
example: 32, | ||
outputFriendlyName: 'Array length', | ||
outputDescription: 'The length of the array.' | ||
} | ||
@@ -35,0 +37,0 @@ |
@@ -9,6 +9,10 @@ module.exports = { | ||
extendedDescription: 'Unlike the native Javascript `.map()` function, the Map machine is not guaranteed to return an array with the same length as the input. This is due to the availability of the `skip` exit in the iteratee, which allows for skipping an array item completely.', | ||
moreInfoUrl: 'http://node-machine.org/machinepack-arrays/map', | ||
inputs: { | ||
array: { | ||
friendlyName: 'Array', | ||
description: 'The array to loop over', | ||
@@ -23,2 +27,3 @@ example: ['*'], | ||
example: ['*'], | ||
constant: true, | ||
isExemplar: true | ||
@@ -32,3 +37,3 @@ }, | ||
contract: { | ||
provides: { | ||
inputs: { | ||
item: { | ||
@@ -50,14 +55,18 @@ friendlyName: 'Current item', | ||
}, | ||
expects: { | ||
exits: { | ||
error: { | ||
friendlyName: 'break with error', | ||
friendlyName: 'Break with error', | ||
description: 'Something went wrong- stop iterating and skip over all remaining items.' | ||
}, | ||
skip: { | ||
friendlyName: 'skip item' | ||
friendlyName: 'Skip item', | ||
description: 'Skip to next item, or if there are no more items, stop.', | ||
extendedDescription: 'If the `skip` exit is used, then the length of the Map machine\'s output array will be shorter than the length of the input array.' | ||
}, | ||
success: { | ||
friendlyName: 'next item', | ||
friendlyName: 'Next item', | ||
description: 'Continue to next item, or if there are no more items, stop.', | ||
itemOf: 'resultExemplar' | ||
itemOf: 'resultExemplar', | ||
outputFriendlyName: 'Transformed item', | ||
outputDescription: 'The result of running the current item through the iteratee machine' | ||
} | ||
@@ -70,2 +79,3 @@ }, | ||
series: { | ||
friendlyName: 'One item at a time?', | ||
description: 'Whether to run iteratee on one item at a time (in series)', | ||
@@ -84,2 +94,3 @@ extendedDescription: 'By default, all items are run at the same time (in parallel)', | ||
description: 'Done.', | ||
outputFriendlyName: 'Mapped array', | ||
outputDescription: 'A modified copy of the provided array.', | ||
@@ -86,0 +97,0 @@ like: 'resultExemplar' |
@@ -45,2 +45,3 @@ module.exports = { | ||
notFound: { | ||
friendlyName: 'Not found', | ||
description: 'The array doesn\'t have an item at the specified index.' | ||
@@ -51,3 +52,5 @@ }, | ||
description: 'Returns the item at the specified index within the array.', | ||
itemOf: 'array' | ||
itemOf: 'array', | ||
outputFriendlyName: 'Nth array item', | ||
outputDescription: 'The item of the array at the specified index.' | ||
}, | ||
@@ -54,0 +57,0 @@ |
@@ -68,3 +68,5 @@ module.exports = { | ||
return ['*']; | ||
} | ||
}, | ||
outputName: 'Plucked array', | ||
outputDescription: 'The array of values gathered by plucking the specified key out of each array item.' | ||
} | ||
@@ -71,0 +73,0 @@ |
@@ -13,2 +13,3 @@ module.exports = { | ||
array: { | ||
friendlyName: 'Array', | ||
description: 'The array to loop over', | ||
@@ -48,13 +49,15 @@ example: ['*'], | ||
error: { | ||
friendlyName: 'break with error', | ||
friendlyName: 'Break with error', | ||
description: 'Something went wrong- stop iterating and skip over all remaining items.' | ||
}, | ||
halt: { | ||
friendlyName: 'break', | ||
friendlyName: 'Break', | ||
description: 'Everything is ok, but stop iterating and skip over all remaining items.' | ||
}, | ||
success: { | ||
friendlyName: 'next item', | ||
friendlyName: 'Next item', | ||
description: 'Continue to next item, or if there are no more items, stop.', | ||
like: 'initialValue' // same type as the `initialValue` input of the calling machine | ||
like: 'initialValue', // same type as the `initialValue` input of the calling machine | ||
outputFriendlyName: 'Transformed result', | ||
outputDescription: 'The accumulated result after running the current item through the iteratee machine.' | ||
} | ||
@@ -70,3 +73,4 @@ }, | ||
extendedDescription: 'The type of the final result must be compatible with the initial value, as well as the partial result provided to the iteratee during each iteration.', | ||
like: 'initialValue', | ||
example: '*', | ||
constant: true, | ||
isExemplar: true | ||
@@ -77,3 +81,3 @@ }, | ||
friendlyName: 'Initial value', | ||
description: 'The initial value for the accumulated result (defaults to the empty version of the provided "Result example")', | ||
description: 'The initial value for the accumulated result', | ||
extendedDescription: 'Note that the final accumulated result must have a compatible type!', | ||
@@ -99,4 +103,4 @@ example: '*' | ||
success: { | ||
friendlyName: 'then', | ||
description: 'Done.', | ||
outputFriendlyName: 'Result of reduce', | ||
outputDescription: 'The accumulated result value.', | ||
@@ -103,0 +107,0 @@ like: 'initialValue' |
@@ -45,2 +45,3 @@ module.exports = { | ||
notFound: { | ||
friendlyName: 'Not found', | ||
description: 'The array does not have enough items for anything to exist at the specified index.', | ||
@@ -51,3 +52,6 @@ }, | ||
description: 'Returns the new array.', | ||
like: 'array' | ||
like: 'array', | ||
outputFriendlyName: 'Array with replaced item', | ||
outputDescription: 'The resulting array after replacing the specified item.' | ||
}, | ||
@@ -54,0 +58,0 @@ |
@@ -42,3 +42,5 @@ module.exports = { | ||
description: 'Done.', | ||
like: 'array' | ||
like: 'array', | ||
outputFriendlyName: 'Reversed array', | ||
outputDescription: 'The result of reversing the input array.' | ||
} | ||
@@ -45,0 +47,0 @@ |
@@ -16,2 +16,3 @@ module.exports = { | ||
array: { | ||
friendlyName: 'Array', | ||
example: ['*'], | ||
@@ -32,2 +33,3 @@ description: 'The array of items to pick from.', | ||
emptyArray: { | ||
friendlyName: 'Empty array', | ||
description: 'The provided array has no items.' | ||
@@ -37,6 +39,7 @@ }, | ||
success: { | ||
friendlyName: 'then', | ||
description: 'Returns a randomly selected item.', | ||
variableName: 'randomItem', | ||
itemOf: 'array' | ||
itemOf: 'array', | ||
outputFriendlyName: 'Random item', | ||
outputDescription: 'A random item selected from the array.' | ||
} | ||
@@ -43,0 +46,0 @@ |
@@ -55,3 +55,6 @@ module.exports = { | ||
description: 'Done.', | ||
like: 'array' | ||
like: 'array', | ||
outputFriendlyName: 'Array slice', | ||
outputDescription: 'The requested slice of the input array.' | ||
}, | ||
@@ -58,0 +61,0 @@ |
@@ -43,3 +43,6 @@ module.exports = { | ||
description: 'Done.', | ||
like: 'array' | ||
like: 'array', | ||
outputFriendlyName: 'Sorted array', | ||
outputDescription: 'The resulting array after sorting by the specified key.' | ||
} | ||
@@ -46,0 +49,0 @@ |
@@ -39,3 +39,6 @@ module.exports = { | ||
description: 'Returns the sorted array.', | ||
example: [2] | ||
example: [2], | ||
outputFriendlyName: 'Sorted array', | ||
outputDescription: 'The resulting array after sorting by ascending value.' | ||
}, | ||
@@ -42,0 +45,0 @@ |
@@ -39,3 +39,5 @@ module.exports = { | ||
description: 'Returns the sorted array.', | ||
example: ['Roger Wilco'] | ||
example: ['Roger Wilco'], | ||
outputFriendlyName: 'Sorted array', | ||
outputDescription: 'The resulting array after sorting by ascending value' | ||
}, | ||
@@ -42,0 +44,0 @@ |
@@ -46,4 +46,6 @@ module.exports = { | ||
description: 'Returns a duplicate-free version of the array.', | ||
friendlyName: 'then', | ||
like: 'array' | ||
like: 'array', | ||
outputFriendlyName: 'De-duplicated Array', | ||
outputDescription: 'The resulting array after removing duplicate items.' | ||
} | ||
@@ -50,0 +52,0 @@ |
@@ -19,2 +19,3 @@ module.exports = { | ||
array: { | ||
friendlyName: 'Array', | ||
description: 'The array to remove duplicates from.', | ||
@@ -36,4 +37,6 @@ example: ['*'], | ||
description: 'Returns duplicate-free version of array.', | ||
friendlyName: 'then', | ||
like: 'array' | ||
like: 'array', | ||
outputFriendlyName: 'De-duplicated Array', | ||
outputDescription: 'The resulting array after removing duplicate items.' | ||
} | ||
@@ -40,0 +43,0 @@ |
{ | ||
"name": "machinepack-arrays", | ||
"version": "5.2.0", | ||
"version": "5.3.0", | ||
"description": "Work with arrays.", | ||
@@ -5,0 +5,0 @@ "scripts": { |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
72240
2764
0