diff --git a/lib/datastore/dataset.js b/lib/datastore/dataset.js index e8ed4fdcaeb..a268914f1c4 100644 --- a/lib/datastore/dataset.js +++ b/lib/datastore/dataset.js @@ -115,8 +115,9 @@ function Dataset(options) { options.apiEndpoint = 'http://' + options.apiEndpoint; } + var trailingSlashes = new RegExp('/*$'); this.apiEndpoint = options.apiEndpoint || 'https://www.googleapis.com'; - this.apiEndpoint = this.apiEndpoint.replace(/\/*$/, ''); + this.apiEndpoint = this.apiEndpoint.replace(trailingSlashes, ''); this.namespace = options.namespace; this.projectId = options.projectId; @@ -134,6 +135,7 @@ nodeutil.inherits(Dataset, DatastoreRequest); * @param {object=} options - Configuration object. * @param {...*=} options.path - Key path. * @param {string=} options.namespace - Optional namespace. + * @return {Key} A newly created Key from the options given. * * @example * var key; @@ -153,8 +155,6 @@ nodeutil.inherits(Dataset, DatastoreRequest); * namespace: 'My-NS', * path: ['Company', 123] * }); - * - * @return {Key} A newly created Key from the options given. */ Dataset.prototype.key = function(options) { options = util.is(options, 'object') ? options : {