Skip to content

Instantly share code, notes, and snippets.

@karlbright
Last active August 29, 2015 14:15
Show Gist options
  • Save karlbright/399d20cb5f303f56c3e5 to your computer and use it in GitHub Desktop.
Save karlbright/399d20cb5f303f56c3e5 to your computer and use it in GitHub Desktop.
function pullProperties = function(obj, props) {
return _.filter(obj, function(prop) {
return _.includes(props, prop);
})
}
Slider.prototype.getActual = function(dataset) {
if(!dataset.actual) return [];
_.map(dataset.actual, function(item) {
return pullProperties(item, ['output', 'minValue','maxValue']);
})
}
Slider.prototype.getIdeal = function(dataset) {
if(!dataset.actual) return [];
_.map(dataset.actual, function(item) {
return pullProperties(item, ['minValue','maxValue']);
})
}
Slider.prototype.getIdealAndActual = function(dataset) {
return {
ideal: this.getIdeal(dataset),
actual: this.getActual(dataset)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment