underscore.js - shortest way to convert a list to an array
arrays, javascript, underscore.js
Solution
The shortest way would be to use underscore's _.toArray(list) method:
"Converts the list (anything that can be iterated over), into a real Array. Useful for transmuting the arguments object."
Example:
(function(){ return _.toArray(arguments).slice(1); })(1, 2, 3, 4);
=> [2, 3, 4]
Problem
What is the shortest way to convert a list (a `FileList` object, or another array-ish browser data structure) to an array using underscore? Curretly I use this (in CoffeeScript): ``` files = _.map(fileList, (it)->it) ``` but I was wondering if there is a shorter way.