Skip to content

Instantly share code, notes, and snippets.

@markbrown4
Last active December 29, 2015 09:39
Show Gist options
  • Save markbrown4/7651846 to your computer and use it in GitHub Desktop.
Save markbrown4/7651846 to your computer and use it in GitHub Desktop.
coffeescript FTW
# coffee
formatData = (data)->
for d in data
date: convertTimestampToDate(d.x)
price: d.y || 0
id: d.x
# js
formatData = function(data) {
var results = [];
for (var i = 0, len = data.length; i < len; i++) {
var d = data[i];
results.push({
date: convertTimestampToDate(d.x),
price: d.y || 0,
id: d.x
});
}
return results;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment