Skip to content

Commit

Permalink
standard: use camel case all the time
Browse files Browse the repository at this point in the history
  • Loading branch information
watson committed May 7, 2016
1 parent 78befcf commit bdc467a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
16 changes: 8 additions & 8 deletions lib/service.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,25 +31,25 @@ function Service (opts) {
}

Service.prototype._records = function () {
var records = [rr_ptr(this), rr_srv(this), rr_txt(this)]
var records = [rrPtr(this), rrSrv(this), rrTxt(this)]

var self = this
var interfaces = os.networkInterfaces()
Object.keys(interfaces).forEach(function (name) {
interfaces[name].forEach(function (addr) {
if (addr.internal) return
if (addr.family === 'IPv4') {
records.push(rr_a(self, addr.address))
records.push(rrA(self, addr.address))
} else {
records.push(rr_aaaa(self, addr.address))
records.push(rrAaaa(self, addr.address))
}
})
})

return records
}

function rr_ptr (service) {
function rrPtr (service) {
return {
name: service.type + TLD,
type: 'PTR',
Expand All @@ -58,7 +58,7 @@ function rr_ptr (service) {
}
}

function rr_srv (service) {
function rrSrv (service) {
return {
name: service.fqdn,
type: 'SRV',
Expand All @@ -70,7 +70,7 @@ function rr_srv (service) {
}
}

function rr_txt (service) {
function rrTxt (service) {
return {
name: service.fqdn,
type: 'TXT',
Expand All @@ -79,7 +79,7 @@ function rr_txt (service) {
}
}

function rr_a (service, ip) {
function rrA (service, ip) {
return {
name: service.host,
type: 'A',
Expand All @@ -88,7 +88,7 @@ function rr_a (service, ip) {
}
}

function rr_aaaa (service, ip) {
function rrAaaa (service, ip) {
return {
name: service.host,
type: 'AAAA',
Expand Down
6 changes: 3 additions & 3 deletions test/service.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@ var test = require('tape')
var Service = require('../lib/service')

var getAddressesRecords = function (host) {
var addresses_records = []
var records = []
var itrs = os.networkInterfaces()
for (var i in itrs) {
var addrs = itrs[i]
for (var j in addrs) {
if (addrs[j].internal === false) {
addresses_records.push({ data: addrs[j].address, name: host, ttl: 120, type: addrs[j].family === 'IPv4' ? 'A' : 'AAAA' })
records.push({ data: addrs[j].address, name: host, ttl: 120, type: addrs[j].family === 'IPv4' ? 'A' : 'AAAA' })
}
}
}
return addresses_records
return records
}

test('no name', function (t) {
Expand Down

0 comments on commit bdc467a

Please sign in to comment.