Skip to content

Commit

Permalink
Merge pull request #38 from LinusU/prefer-const
Browse files Browse the repository at this point in the history
Prefer const over let
  • Loading branch information
pofider authored Nov 25, 2018
2 parents 6f82b03 + 5ab02fb commit 7176d85
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 15 deletions.
11 changes: 4 additions & 7 deletions lib/render/engineScript.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ module.exports = function (inputs, callback, done) {

let isFromCache = true

let engine = (template) => {
const engine = (template) => {
const key = template + ':' + inputs.engine

if (!compiledCache.get(key)) {
Expand All @@ -56,9 +56,6 @@ module.exports = function (inputs, callback, done) {
inputs.parentModuleDirectory
]

let consoleFromSandbox
let consoleMessages = []

function respondWrap (rawErr, content) {
let err

Expand Down Expand Up @@ -146,8 +143,8 @@ module.exports = function (inputs, callback, done) {
}
)

consoleMessages = messages
consoleFromSandbox = consoleSandbox
const consoleMessages = messages
const consoleFromSandbox = consoleSandbox

let templateHelpers = inputs.template.helpers
let originalTemplateHelpersStr
Expand All @@ -166,7 +163,7 @@ module.exports = function (inputs, callback, done) {

templateHelpers = {}

for (let fn in sandboxContext) {
for (const fn in sandboxContext) {
if (typeof sandboxContext[fn] === 'function') {
templateHelpers[fn] = sandboxContext[fn]
}
Expand Down
2 changes: 1 addition & 1 deletion lib/render/safeSandbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ module.exports = (_sandbox, options = {}) => {
return result
}

for (let name in sandbox) {
for (const name in sandbox) {
vm._internal.Contextify.globalValue(sandbox[name], name)
}

Expand Down
4 changes: 2 additions & 2 deletions lib/store/collection.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ module.exports = (entitySet, provider, model) => ({
return docs.map((doc) => {
const newDoc = Object.assign({}, doc)

for (let prop in newDoc) {
for (const prop in newDoc) {
if (!prop) {
continue
}
Expand All @@ -158,7 +158,7 @@ module.exports = (entitySet, provider, model) => ({
return docs.map((doc) => {
const newDoc = Object.assign({}, doc)

for (let prop in newDoc) {
for (const prop in newDoc) {
if (!prop) {
continue
}
Expand Down
2 changes: 1 addition & 1 deletion lib/store/documentStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ function typeDefToJSONSchema (model, def) {
const propDef = def[key]
const collectionTypeRegExp = /^Collection\((\S+)\)$/
let type = propDef.type
let extraSchema = propDef.schema
const extraSchema = propDef.schema
let isCollection = false

if (propDef == null || type == null) {
Expand Down
6 changes: 3 additions & 3 deletions test/render/engineTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const safeSandboxPath = path.join(__dirname, '../../lib/render/safeSandbox')

describe('engine', () => {
describe('engine with dedicated-process strategy', () => {
let scriptManager = ScriptManager({ strategy: 'dedicated-process' })
const scriptManager = ScriptManager({ strategy: 'dedicated-process' })

beforeEach((done) => {
scriptManager.ensureStarted(done)
Expand All @@ -17,7 +17,7 @@ describe('engine', () => {
})

describe('engine with http-server strategy', () => {
let scriptManager = ScriptManager({ strategy: 'http-server' })
const scriptManager = ScriptManager({ strategy: 'http-server' })

beforeEach((done) => {
scriptManager.ensureStarted(done)
Expand All @@ -29,7 +29,7 @@ describe('engine', () => {
})

describe('engine with in-process strategy', function () {
let scriptManager = ScriptManager({ strategy: 'in-process' })
const scriptManager = ScriptManager({ strategy: 'in-process' })

beforeEach((done) => {
scriptManager.ensureStarted(done)
Expand Down
2 changes: 1 addition & 1 deletion test/reporterTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ describe('reporter', () => {
}
})
stdMocks.restore()
let stdoutContent = stdMocks.flush()
const stdoutContent = stdMocks.flush()
stdoutContent.stdout.length.should.be.eql(0)

const allTransportsAreSilent = Object.keys(reporter.logger.transports).every(function (transportName) {
Expand Down

0 comments on commit 7176d85

Please sign in to comment.