1 // Translate for example "-name" to [ 'name', 'DESC' ]
2 function getSort (value: string) {
4 let direction: 'ASC' | 'DESC'
6 if (value.substring(0, 1) === '-') {
8 field = value.substring(1)
14 return [ field, direction ]
17 function addMethodsToModel (model: any, classMethods: Function[], instanceMethods: Function[] = []) {
18 classMethods.forEach(m => model[m.name] = m)
19 instanceMethods.forEach(m => model.prototype[m.name] = m)
22 // ---------------------------------------------------------------------------