var mapRange = function(from, to, s) { // mapRange expects ranges generated by _.range var a1 = from[0]; var a2 = from[from.length - 1]; var b1 = to[0]; var b2 = to[to.length - 1]; return b1 + (s - a1) * (b2 - b1) / (a2 - a1); }; // The range function is exclusive var fromRange = _.range(0, 11); var toRange = _.range(-1, 1); // .map constructs a new array fromRange = fromRange.map(function(s) { return mapRange(fromRange, toRange, s); }); console.log(fromRange);