Skip to content

Commit

Permalink
Conform to style guide
Browse files Browse the repository at this point in the history
  • Loading branch information
sjoerddal-pti committed Oct 13, 2021
1 parent ca5d12d commit 58f9679
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const CallType = require('@malijs/call-types')
const METHOD_PROPS = ['name', 'options', 'type', 'requestStream', 'responseStream',
'requestName', 'responseName', 'path', 'requestType', 'responseType', 'originalName']

function getCallTypeFromCall(call) {
function getCallTypeFromCall (call) {
const name = Object.getPrototypeOf(call).constructor.name

if (name.indexOf('ServerUnaryCall') === 0) {
Expand All @@ -17,7 +17,7 @@ function getCallTypeFromCall(call) {
}
}

function getCallTypeFromDescriptor(descriptor) {
function getCallTypeFromDescriptor (descriptor) {
if (!descriptor.requestStream && !descriptor.responseStream) {
return CallType.UNARY
} else if (!descriptor.requestStream && descriptor.responseStream) {
Expand All @@ -29,14 +29,14 @@ function getCallTypeFromDescriptor(descriptor) {
}
}

function getDesiredMethodProps(method) {
function getDesiredMethodProps (method) {
return METHOD_PROPS.reduce((accumulator, currentKey) => {
accumulator[currentKey] = method[currentKey]
return accumulator
}, {})
}

function getServiceDefinitions(proto) {
function getServiceDefinitions (proto) {
const services = {}

const visited = new Set()
Expand Down Expand Up @@ -113,17 +113,17 @@ function getServiceDefinitions(proto) {
return services
}

function getServiceNameFromPath(path) {
function getServiceNameFromPath (path) {
const parts = path.split('/')
return parts[1]
}

function getMethodNameFromPath(path) {
function getMethodNameFromPath (path) {
const parts = path.split('/')
return parts[parts.length - 1]
}

function getPackageNameFromPath(path) {
function getPackageNameFromPath (path) {
const sName = getServiceNameFromPath(path)
if (sName.indexOf('.') === -1) {
return ''
Expand All @@ -134,7 +134,7 @@ function getPackageNameFromPath(path) {
return parts.join('.')
}

function getShortServiceNameFromPath(path) {
function getShortServiceNameFromPath (path) {
const sName = getServiceNameFromPath(path)
if (sName.indexOf('.') === -1) {
return sName
Expand All @@ -144,7 +144,7 @@ function getShortServiceNameFromPath(path) {
return parts.pop()
}

function isService(v) {
function isService (v) {
if (v && v.service) {
const vKeys = Object.keys(v.service)

Expand Down

0 comments on commit 58f9679

Please sign in to comment.