Skip to content

Instantly share code, notes, and snippets.

@jabyrd3
Created August 4, 2015 13:53
Show Gist options
  • Save jabyrd3/0093a39de3c21746f12e to your computer and use it in GitHub Desktop.
Save jabyrd3/0093a39de3c21746f12e to your computer and use it in GitHub Desktop.
this.dimensions = function () {
return _.chain(points)
.filter(function (item) {
if (item !== 'Z') {
return item;
}
})
.map(function (point) {
var command = point[0];
point = point.substr(1, point.length)
.split(',');
if (command !== 'Z') {
return {
command: command,
x: parseInt(point[0], 10),
y: parseInt(point[1], 10)
};
} else {
return false;
};
})
.sortBy(function (i) {
return i.x + i.y;
})
.last()
.value();
}();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment