Skip to content
This repository has been archived by the owner on Dec 19, 2023. It is now read-only.

refactor: switch from var => let/const #53

Merged
merged 2 commits into from
Jun 22, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 9 additions & 9 deletions src/change.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@

'use strict';

var common = require('@google-cloud/common');
var util = require('util');
const common = require('@google-cloud/common');
const util = require('util');

/**
* @class
Expand All @@ -32,7 +32,7 @@ var util = require('util');
* const change = zone.change('change-id');
*/
function Change(zone, id) {
var methods = {
const methods = {
/**
* @typedef {array} ChangeExistsResponse
* @property {boolean} 0 Whether the {@link Change} exists.
Expand Down Expand Up @@ -61,7 +61,7 @@ function Change(zone, id) {
* // If the callback is omitted, we'll return a Promise.
* //-
* change.exists().then(function(data) {
* var exists = data[0];
* const exists = data[0];
* });
*/
exists: true,
Expand Down Expand Up @@ -106,8 +106,8 @@ function Change(zone, id) {
* // If the callback is omitted, we'll return a Promise.
* //-
* change.get().then(function(data) {
* var change = data[0];
* var apiResponse = data[1];
* const change = data[0];
* const apiResponse = data[1];
* });
*/
get: true,
Expand Down Expand Up @@ -156,8 +156,8 @@ function Change(zone, id) {
* // If the callback is omitted, we'll return a Promise.
* //-
* change.getMetadata().then(function(data) {
* var metadata = data[0];
* var apiResponse = data[1];
* const metadata = data[0];
* const apiResponse = data[1];
* });
*/
getMetadata: true,
Expand Down Expand Up @@ -223,7 +223,7 @@ util.inherits(Change, common.ServiceObject);
* });
*/
Change.prototype.create = function(config, callback) {
var self = this;
const self = this;

this.parent.createChange(config, function(err, change, apiResponse) {
if (err) {
Expand Down
26 changes: 13 additions & 13 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@

'use strict';

var arrify = require('arrify');
var common = require('@google-cloud/common');
var extend = require('extend');
var is = require('is');
var util = require('util');
const arrify = require('arrify');
const common = require('@google-cloud/common');
const extend = require('extend');
const is = require('is');
const util = require('util');

var Zone = require('./zone.js');
const Zone = require('./zone.js');

/**
* @typedef {object} ClientConfig
Expand Down Expand Up @@ -85,7 +85,7 @@ function DNS(options) {

options = common.util.normalizeArguments(this, options);

var config = {
const config = {
baseUrl: 'https://www.googleapis.com/dns/v1',
scopes: [
'https://www.googleapis.com/auth/ndev.clouddns.readwrite',
Expand Down Expand Up @@ -156,7 +156,7 @@ util.inherits(DNS, common.Service);
* });
*/
DNS.prototype.createZone = function(name, config, callback) {
var self = this;
const self = this;

if (!name) {
throw new Error('A zone name is required.');
Expand All @@ -183,7 +183,7 @@ DNS.prototype.createZone = function(name, config, callback) {
return;
}

var zone = self.zone(resp.name);
const zone = self.zone(resp.name);
zone.metadata = resp;

callback(null, zone, resp);
Expand Down Expand Up @@ -237,7 +237,7 @@ DNS.prototype.createZone = function(name, config, callback) {
* });
*/
DNS.prototype.getZones = function(query, callback) {
var self = this;
const self = this;

if (is.fn(query)) {
callback = query;
Expand All @@ -255,13 +255,13 @@ DNS.prototype.getZones = function(query, callback) {
return;
}

var zones = arrify(resp.managedZones).map(function(zone) {
var zoneInstance = self.zone(zone.name);
const zones = arrify(resp.managedZones).map(function(zone) {
const zoneInstance = self.zone(zone.name);
zoneInstance.metadata = zone;
return zoneInstance;
});

var nextQuery = null;
let nextQuery = null;

if (resp.nextPageToken) {
nextQuery = extend({}, query, {
Expand Down
20 changes: 10 additions & 10 deletions src/record.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@

'use strict';

var arrify = require('arrify');
var common = require('@google-cloud/common');
var extend = require('extend');
var format = require('string-format-obj');
const arrify = require('arrify');
const common = require('@google-cloud/common');
const extend = require('extend');
const format = require('string-format-obj');

/**
* Create a Resource Record object.
Expand Down Expand Up @@ -89,7 +89,7 @@ function Record(zone, type, metadata) {
* @returns {Record}
*/
Record.fromZoneRecord_ = function(zone, type, bindData) {
var typeToZoneFormat = {
const typeToZoneFormat = {
a: '{ip}',
aaaa: '{ip}',
cname: '{alias}',
Expand All @@ -101,7 +101,7 @@ Record.fromZoneRecord_ = function(zone, type, bindData) {
txt: '{txt}',
};

var metadata = {
const metadata = {
data: format(typeToZoneFormat[type.toLowerCase()], bindData),
name: bindData.name,
ttl: bindData.ttl,
Expand Down Expand Up @@ -154,8 +154,8 @@ Record.fromZoneRecord_ = function(zone, type, bindData) {
* // If the callback is omitted, we'll return a Promise.
* //-
* record.delete().then(function(data) {
* var change = data[0];
* var apiResponse = data[1];
* const change = data[0];
* const apiResponse = data[1];
* });
*/
Record.prototype.delete = function(callback) {
Expand All @@ -168,7 +168,7 @@ Record.prototype.delete = function(callback) {
* @returns {object}
*/
Record.prototype.toJSON = function() {
var recordObject = extend({}, this.metadata, {
const recordObject = extend({}, this.metadata, {
type: this.type.toUpperCase(),
});

Expand All @@ -186,7 +186,7 @@ Record.prototype.toJSON = function() {
* @returns {string}
*/
Record.prototype.toString = function() {
var json = this.toJSON();
const json = this.toJSON();

return (json.rrdatas || [{}])
.map(function(data) {
Expand Down
Loading