| angular.module('xos.UITutorial') |
| .service('ResponseHandler', function(TemplateHandler){ |
| this.parseObject = (obj, comma = '') => { |
| obj = _.omit(obj, exclude); |
| return TemplateHandler.jsonObject({'obj': obj, comma: comma}); |
| this.parseCollection = (array) => { |
| array = array.map((o, i) => `${this.parseObject(o, i === (array.length - 1) ? '':',')}`); |
| return TemplateHandler.jsonCollection({'collection': array}); |
| this.parse = (res, jsCode, done) => { |
| res = this.parseCollection(res); |
| res = this.parseObject(res); |
| done(TemplateHandler.resourcesResponse({ |