From f7b5f80bb798714536dd0549d18c85f4d765eda7 Mon Sep 17 00:00:00 2001 From: Lehtinen Teemu <lehtint6@t31300-lr146.org.aalto.fi> Date: Tue, 10 Dec 2019 13:49:35 +0200 Subject: [PATCH] Use let when appropriate --- README.md | 8 +++++--- index.js | 19 +++++++++++-------- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index a38a713..7b060f4 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,14 @@ # acos-webdev-iwdap Content package for Acos-servers that adds web development exercises -designed for *Introduction to Web Development and Programming*. +where student experiments with web using a browser inspector tool. ## Installation -For the time being, this package requires that `acos-webdev` package has been installed manually. +This package requires that `acos-webdev` package has been installed +as a dependency. ## Testing -Tests are written with WebDriverIO, refer to the `acos-server` documentation on testing. +Tests are written with WebDriverIO, refer to the `acos-server` +documentation on testing. diff --git a/index.js b/index.js index b316f30..033d2a9 100644 --- a/index.js +++ b/index.js @@ -1,23 +1,26 @@ /* global module, require, __dirname, console */ /* jshint globalstrict: true */ 'use strict'; -var nj = require('nunjucks'); -var fs = require('fs'); +let nj = require('nunjucks'); +let fs = require('fs'); -var AcosMod = function () {}; +let AcosMod = function () {}; -var baseDir = __dirname; -var content = JSON.parse(fs.readFileSync(baseDir + '/content.json', 'utf8')); +let baseDir = __dirname; +let content = JSON.parse(fs.readFileSync(baseDir + '/content.json', 'utf8')); AcosMod.initialize = function (req, params, handlers, cb) { - var templateDir = baseDir + '/templates/'; + let templateDir = baseDir + '/templates/'; nj.configure(templateDir, { autoescape: false }); - var config = content[params.name]; + + let config = content[params.name]; config.abFlag = params.abFlag; + if (config.template) { config.html = nj.render(config.template, config); } - var templateParam = { + + let templateParam = { id: 'acos-webdev-inspector-' + params.name, config: JSON.stringify(config), acceptTest: config.acceptTest, -- GitLab