diff --git a/platform/persistence/couch/src/CouchPersistenceProvider.js b/platform/persistence/couch/src/CouchPersistenceProvider.js index 2e0cec8807..ac0aaca304 100644 --- a/platform/persistence/couch/src/CouchPersistenceProvider.js +++ b/platform/persistence/couch/src/CouchPersistenceProvider.js @@ -54,12 +54,6 @@ define( this.path = path; } - function bind(fn, thisArg) { - return function () { - return fn.apply(thisArg, arguments); - }; - } - // Pull out a list of document IDs from CouchDB's // _all_docs response function getIdsFromAllDocs(allDocs) { @@ -117,29 +111,29 @@ define( }; CouchPersistenceProvider.prototype.listObjects = function () { - return this.get("_all_docs").then(bind(getIdsFromAllDocs, this)); + return this.get("_all_docs").then(getIdsFromAllDocs.bind(this)); }; CouchPersistenceProvider.prototype.createObject = function (space, key, value) { return this.put(key, new CouchDocument(key, value)) - .then(bind(this.checkResponse, this)); + .then(this.checkResponse.bind(this)); }; CouchPersistenceProvider.prototype.readObject = function (space, key) { - return this.get(key).then(bind(this.getModel, this)); + return this.get(key).then(this.getModel.bind(this)); }; CouchPersistenceProvider.prototype.updateObject = function (space, key, value) { var rev = this.revs[key]; return this.put(key, new CouchDocument(key, value, rev)) - .then(bind(this.checkResponse, this)); + .then(this.checkResponse.bind(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(this.checkResponse, this)); + .then(this.checkResponse.bind(this)); }; return CouchPersistenceProvider; diff --git a/platform/persistence/elastic/src/ElasticPersistenceProvider.js b/platform/persistence/elastic/src/ElasticPersistenceProvider.js index 564029b4c7..970f5cca26 100644 --- a/platform/persistence/elastic/src/ElasticPersistenceProvider.js +++ b/platform/persistence/elastic/src/ElasticPersistenceProvider.js @@ -58,12 +58,6 @@ define( this.path = path; } - function bind(fn, thisArg) { - return function () { - return fn.apply(thisArg, arguments); - }; - } - // Issue a request using $http; get back the plain JS object // from the expected JSON response ElasticPersistenceProvider.prototype.request = function (subpath, method, value, params) { @@ -141,11 +135,11 @@ define( ElasticPersistenceProvider.prototype.createObject = function (space, key, value) { - return this.put(key, value).then(bind(this.checkResponse, this)); + return this.put(key, value).then(this.checkResponse.bind(this)); }; ElasticPersistenceProvider.prototype.readObject = function (space, key) { - return this.get(key).then(bind(this.getModel, this)); + return this.get(key).then(this.getModel.bind(this)); }; ElasticPersistenceProvider.prototype.updateObject = function (space, key, value) { @@ -158,7 +152,7 @@ define( }; ElasticPersistenceProvider.prototype.deleteObject = function (space, key) { - return this.del(key).then(bind(this.checkResponse, this)); + return this.del(key).then(this.checkResponse.bind(this)); }; return ElasticPersistenceProvider;