[Build] Remove apparent strict violations

...from persistence providers.
This commit is contained in:
Victor Woeltjen 2016-03-04 11:18:25 -08:00
parent 9526207af8
commit 19c9fcd369
2 changed files with 14 additions and 13 deletions

View File

@ -69,24 +69,24 @@ define(
// Check the response to a create/update/delete request;
// track the rev if it's valid, otherwise return false to
// indicate that the request failed.
function checkResponse(response) {
CouchPersistenceProvider.prototype.checkResponse = function (response) {
if (response && response.ok) {
this.revs[response.id] = response.rev;
return response.ok;
} else {
return false;
}
}
};
// Get a domain object model out of CouchDB's response
function getModel(response) {
CouchPersistenceProvider.prototype.getModel = function (response) {
if (response && response.model) {
this.revs[response[ID]] = response[REV];
return response.model;
} else {
return undefined;
}
}
};
// Issue a request using $http; get back the plain JS object
// from the expected JSON response
@ -122,24 +122,24 @@ define(
CouchPersistenceProvider.prototype.createObject = function (space, key, value) {
return this.put(key, new CouchDocument(key, value))
.then(bind(checkResponse, this));
.then(bind(this.checkResponse, this));
};
CouchPersistenceProvider.prototype.readObject = function (space, key) {
return this.get(key).then(bind(getModel, this));
return this.get(key).then(bind(this.getModel, this));
};
CouchPersistenceProvider.prototype.updateObject = function (space, key, value) {
var rev = this.revs[key];
return this.put(key, new CouchDocument(key, value, rev))
.then(bind(checkResponse, this));
.then(bind(this.checkResponse, this));
};
CouchPersistenceProvider.prototype.deleteObject = function (space, key, value) {
var rev = this.revs[key];
return this.put(key, new CouchDocument(key, value, rev, true))
.then(bind(checkResponse, this));
.then(bind(this.checkResponse, this));
};
return CouchPersistenceProvider;

View File

@ -108,14 +108,14 @@ define(
};
// Get a domain object model out of ElasticSearch's response
function getModel(response) {
ElasticPersistenceProvider.prototype.getModel = function (response) {
if (response && response[SRC]) {
this.revs[response[ID]] = response[REV];
return response[SRC];
} else {
return undefined;
}
}
};
// Check the response to a create/update/delete request;
// track the rev if it's valid, otherwise return false to
@ -145,15 +145,16 @@ define(
};
ElasticPersistenceProvider.prototype.readObject = function (space, key) {
return this.get(key).then(bind(getModel, this));
return this.get(key).then(bind(this.getModel, this));
};
ElasticPersistenceProvider.prototype.updateObject = function (space, key, value) {
var self = this;
function checkUpdate(response) {
return this.checkResponse(response, key);
return self.checkResponse(response, key);
}
return this.put(key, value, { version: this.revs[key] })
.then(bind(checkUpdate, this));
.then(checkUpdate);
};
ElasticPersistenceProvider.prototype.deleteObject = function (space, key, value) {