UNPKG

tastypie

Version:

Tastypie is a webservice API framework for Node.js based on Django's Tastypie Framework. It provides a convenient, yet powerful and highly customizable, abstraction for creating REST-style interfaces

29 lines (22 loc) 662 B
var max = require('./max'); var map = require('./map'); function getLength(arr) { return arr == null ? 0 : arr.length; } /** * Merges together the values of each of the arrays with the values at the * corresponding position. */ function zip(arr){ var len = arr ? max(map(arguments, getLength)) : 0, results = [], i = -1; while (++i < len) { // jshint loopfunc: true results.push(map(arguments, function(item) { return item == null ? undefined : item[i]; })); } return results; } module.exports = zip;