initial commit

This commit is contained in:
JJ Kasper
2018-05-17 14:31:05 -05:00
commit 2c90d2e7dd
79 changed files with 10684 additions and 0 deletions

18
util/parseSort.js Normal file
View File

@@ -0,0 +1,18 @@
export default sort => {
let key, ascDesc;
switch(typeof sort) {
case 'object': {
key = Object.keys(sort).pop();
ascDesc = sort[key];
break;
}
case 'string': {
const parts = sort.split(':');
key = parts[0];
ascDesc = parts[1];
break;
}
default: break;
}
return `$sort[${key}]=${ascDesc}`;
};