From 19c9fcd3691ea86db583905bfc653c5a75130d44 Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Fri, 4 Mar 2016 11:18:25 -0800 Subject: [PATCH] [Build] Remove apparent strict violations ...from persistence providers. --- .../couch/src/CouchPersistenceProvider.js | 16 ++++++++-------- .../elastic/src/ElasticPersistenceProvider.js | 11 ++++++----- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/platform/persistence/couch/src/CouchPersistenceProvider.js b/platform/persistence/couch/src/CouchPersistenceProvider.js index 6e7a1c6aaf..21579eb5f9 100644 --- a/platform/persistence/couch/src/CouchPersistenceProvider.js +++ b/platform/persistence/couch/src/CouchPersistenceProvider.js @@ -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; diff --git a/platform/persistence/elastic/src/ElasticPersistenceProvider.js b/platform/persistence/elastic/src/ElasticPersistenceProvider.js index 75208c9aac..8ffb5d0232 100644 --- a/platform/persistence/elastic/src/ElasticPersistenceProvider.js +++ b/platform/persistence/elastic/src/ElasticPersistenceProvider.js @@ -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) {