Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonkneen committed Dec 18, 2019
1 parent dfad714 commit a78c0a2
Showing 1 changed file with 10 additions and 17 deletions.
27 changes: 10 additions & 17 deletions reste.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ var main = function () {
var reste = this;

var config = {},
requestHeaders = [];
requestHeaders = [];

function log(message) {
if (config.debug && message) {
Expand Down Expand Up @@ -200,7 +200,6 @@ var main = function () {
requestHeaders.push({
name: header,
value: headers[header] });

}
};

Expand All @@ -217,7 +216,6 @@ var main = function () {
requestHeaders.push({
name: Object.keys(header)[0],
value: header[Object.keys(header)[0]] });

}
};

Expand All @@ -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";
Expand Down Expand Up @@ -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) {
Expand All @@ -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);
}
}

Expand Down Expand Up @@ -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();
Expand All @@ -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];

Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit a78c0a2

Please sign in to comment.