Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prefer const over let #174

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
6 changes: 3 additions & 3 deletions lib/generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ generator.newModel = function (schema, definitions) {
properties: {}
}

let properties = generator.createProperties(schema, definitions)
const properties = generator.createProperties(schema, definitions)
model.properties = _.reduce(properties, (memo, value, key) => {
if (value.required) {
model.required.push(key)
Expand All @@ -59,7 +59,7 @@ generator.newModel = function (schema, definitions) {
model.description = modelDescription
}

let modelName = utils.generateNameWithFallback(schema, definitions, model)
const modelName = utils.generateNameWithFallback(schema, definitions, model)
definitions[modelName] = model

return {
Expand Down Expand Up @@ -108,7 +108,7 @@ generator.extractAsDefinition = function (schema, definitions, definition) {
if (definition.type === 'array') {
const required = definition.required
delete definition.required
let name = utils.generateNameWithFallback(schema, definitions, definition)
const name = utils.generateNameWithFallback(schema, definitions, definition)
definitions[name] = definition

return {
Expand Down
4 changes: 2 additions & 2 deletions lib/resources.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const _ = require('lodash')
const utils = require('./utils')
const Hoek = require('hoek')
const generator = require('./generator')
let schema = require('./schema')
const schema = require('./schema')
const Joi = require('joi')

const internals = {
Expand Down Expand Up @@ -196,7 +196,7 @@ module.exports = function (settings, routes, tags) {
const statusResponseSchema = _.get(routeSettings, 'response.status')

// Process response
let responses = internals.prepareResponses(definitions, routesPluginOptions, defaultResponseSchema, statusResponseSchema)
const responses = internals.prepareResponses(definitions, routesPluginOptions, defaultResponseSchema, statusResponseSchema)
operation.responses = responses
operation.produces = routesPluginOptions.produces || settings.produces

Expand Down
2 changes: 1 addition & 1 deletion lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ utils.parseBaseModelAttributes = function (schema) {
const defaultValue = _.get(schema, '_flags.default')
const format = utils.getFormat(schema)
const collectionFormat = utils.getMeta(schema, 'collectionFormat')
let enumValues = _.get(schema, '_flags.allowOnly') === true ? _.filter(_.get(schema, '_valids._set'), _.isString) : undefined
const enumValues = _.get(schema, '_flags.allowOnly') === true ? _.filter(_.get(schema, '_valids._set'), _.isString) : undefined

const baseModel = {
required: required
Expand Down
2 changes: 1 addition & 1 deletion test/generator-test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict'

const Lab = require('lab')
let lab = exports.lab = Lab.script()
const lab = exports.lab = Lab.script()

const describe = lab.experiment
const it = lab.test
Expand Down
2 changes: 1 addition & 1 deletion test/plugin-test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict'

const Lab = require('lab')
let lab = exports.lab = Lab.script()
const lab = exports.lab = Lab.script()

const describe = lab.experiment
const it = lab.test
Expand Down
2 changes: 1 addition & 1 deletion test/resources-test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict'

const Lab = require('lab')
let lab = exports.lab = Lab.script()
const lab = exports.lab = Lab.script()
const describe = lab.experiment
const it = lab.test
const Code = require('code')
Expand Down
2 changes: 1 addition & 1 deletion test/schema-example-test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict'

const Lab = require('lab')
let lab = exports.lab = Lab.script()
const lab = exports.lab = Lab.script()
const describe = lab.experiment
const it = lab.test
const Joi = require('joi')
Expand Down
2 changes: 1 addition & 1 deletion test/utils-test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict'

const Lab = require('lab')
let lab = exports.lab = Lab.script()
const lab = exports.lab = Lab.script()

const describe = lab.experiment
const it = lab.test
Expand Down