From a78c0a2d45c06c630fcf2fefd01c62eb72049fab Mon Sep 17 00:00:00 2001 From: Jason Kneen Date: Wed, 18 Dec 2019 11:09:39 +0000 Subject: [PATCH] formatting --- reste.js | 27 ++++++++++----------------- 1 file changed, 10 insertions(+), 17 deletions(-) diff --git a/reste.js b/reste.js index 3310ada..e85d653 100644 --- a/reste.js +++ b/reste.js @@ -2,7 +2,7 @@ var main = function () { var reste = this; var config = {}, - requestHeaders = []; + requestHeaders = []; function log(message) { if (config.debug && message) { @@ -200,7 +200,6 @@ var main = function () { requestHeaders.push({ name: header, value: headers[header] }); - } }; @@ -217,7 +216,6 @@ var main = function () { requestHeaders.push({ name: Object.keys(header)[0], value: header[Object.keys(header)[0]] }); - } }; @@ -236,9 +234,9 @@ var main = function () { reste[args.name] = function (params, onLoad, onError) { var body, - method = "GET", - url, - deferred; + method = "GET", + url, + deferred; if (args.post) method = "POST"; if (args.get) method = "GET"; @@ -298,12 +296,11 @@ var main = function () { params: body, headers: args.requestHeaders || args.headers, beforePost: args.beforePost, - beforeSend: args.beforeSend }, - onLoad, onError); + beforeSend: args.beforeSend }, onLoad, onError); } else { var m, - missing = [], - re = /(\<\w*\>)/g; + missing = [], + re = /(\<\w*\>)/g; if (config.autoValidateParams) { while ((m = re.exec(url)) !== null) { @@ -324,8 +321,7 @@ var main = function () { params: body, headers: args.requestHeaders || args.headers, beforePost: args.beforePost, - beforeSend: args.beforeSend }, - onLoad, onError); + beforeSend: args.beforeSend }, onLoad, onError); } } @@ -398,7 +394,6 @@ var main = function () { return this.__transform; } }); - if (args.collections) { args.collections.forEach(function (collection) { Alloy.Collections[collection.name] = Alloy.Collections[collection.name] || new Backbone.Collection(); @@ -417,8 +412,7 @@ var main = function () { if (model instanceof Backbone.Collection && modelConfig && modelConfig.collections) { var collectionConfig = _.where(modelConfig.collections, { - name: model._name })[ - 0]; + name: model._name })[0]; var methodCall = reste[collectionConfig.read]; @@ -533,8 +527,7 @@ var main = function () { } : onError = null; reste[modelConfig.create]({ - body: body }, - function (e) { + body: body }, function (e) { if (e.code > 200) { onError(e);