@nodescript/stdlib
Version:
Standard Node Definitions
32 lines (31 loc) • 728 B
JavaScript
export const module = {
version: '1.0.2',
moduleName: 'Array / Index Of',
description: `
Returns the index of specified in the array, or -1 if the value does not exist in the array.
`,
keywords: [],
params: {
array: {
schema: {
type: 'array',
items: { type: 'any' },
},
},
value: {
schema: { type: 'any' },
},
from: {
schema: { type: 'number', default: 0 },
},
},
result: {
schema: {
type: 'number',
}
},
};
export const compute = params => {
const { array, value, from } = params;
return array.indexOf(value, from);
};