Skip to content

Instantly share code, notes, and snippets.

View staghouse's full-sized avatar

Eric Lakatos staghouse

View GitHub Profile
@staghouse
staghouse / Sorting function for objects
Created February 13, 2019 11:08
Expects a string with a ':' delimiter. Meant for Vue.js select markup elements and table rendering
sortBy(event = '') {
let values = event.currentTarget
? event.currentTarget.value.split(':')
: event.split(':');
let cfg = {
prop: values[0],
desc: values[1] ? -1 : 1,
parser: function(x) {
return x;
},