array_to_if

Node.js module that takes an array and generates a string with a function containing conditional constructs


Keywords
array, if, else, return, generators, templates
License
GPL-3.0
Install
npm install array_to_if@0.0.2

Documentation

Build Status

Array to If

Node.js module that generates a function with сonditional branches over a given array

Install

npm i array_to_if

Example

const F = require('array_to_if')

let foo = eval(F([1,2,3,4,5], 'if (argv[0] == %%) { return argv[0]*%% } else', 0))

console.log(foo(3))