Skip to content

Commit e5a08ee

Browse files
committed
fix: update code to es2015+
1 parent e65789d commit e5a08ee

8 files changed

Lines changed: 271 additions & 299 deletions

File tree

‎.eslintrc.js‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ module.exports = {
1616
"comma-dangle": ["error", "always-multiline"],
1717
indent: ["error", "tab", { SwitchCase: 1 }],
1818
"no-tabs": "off",
19+
"no-var": "error",
20+
"prefer-const": "error",
21+
"object-shorthand": "error",
1922
"no-restricted-globals": [
2023
"error",
2124
{

‎examples/advanced/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@
1111
"author": "Eric Ferraiuolo <eferraiuolo@gmail.com>",
1212
"license": "BSD",
1313
"dependencies": {
14-
"express": "^4.7.2"
14+
"express": "^4.17.1"
1515
}
1616
}

‎examples/advanced/public/echo.js‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@
55
// This will prompt the user for a message, then echo it out by rendering the
66
// message using the shared template which was exposed by the server.
77
(function () {
8-
var button = document.getElementById("say");
8+
const button = document.getElementById("say");
99

1010
button.addEventListener("click", function (e) {
11-
var message = prompt("Say Something:", "Yo yo");
12-
var echo = document.createElement("div");
11+
const message = prompt("Say Something:", "Yo yo");
12+
const echo = document.createElement("div");
1313

14-
echo.innerHTML = Handlebars.templates.echo({ message: message });
14+
echo.innerHTML = Handlebars.templates.echo({ message });
1515
document.body.appendChild(echo);
1616
}, false);
1717
}());

‎examples/advanced/server.js‎

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
"use strict";
22

3-
var Promise = global.Promise || require("promise");
3+
const Promise = global.Promise || require("promise");
44

5-
var express = require("express");
6-
var exphbs = require("../../"); // "express-handlebars"
7-
var helpers = require("./lib/helpers");
5+
const express = require("express");
6+
const exphbs = require("../../"); // "express-handlebars"
7+
const helpers = require("./lib/helpers");
88

9-
var app = express();
9+
const app = express();
1010

1111
// Create `ExpressHandlebars` instance with a default layout.
12-
var hbs = exphbs.create({
13-
helpers: helpers,
12+
const hbs = exphbs.create({
13+
helpers,
1414

1515
// Uses multiple partials dirs, templates in "shared/templates/" are shared
1616
// with the client-side of the app (see below).
@@ -34,7 +34,7 @@ function exposeTemplates (req, res, next) {
3434
precompiled: true,
3535
}).then(function (templates) {
3636
// RegExp to remove the ".handlebars" extension from the template names.
37-
var extRegex = new RegExp(hbs.extname + "$");
37+
const extRegex = new RegExp(hbs.extname + "$");
3838

3939
// Creates an array of templates which are exposed via
4040
// `res.locals.templates`.
@@ -77,7 +77,7 @@ app.get("/exclaim", function (req, res) {
7777

7878
// This overrides _only_ the default `yell()` helper.
7979
helpers: {
80-
yell: function (msg) {
80+
yell (msg) {
8181
return (msg + "!!!");
8282
},
8383
},

‎examples/basic/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@
1111
"author": "Eric Ferraiuolo <eferraiuolo@gmail.com>",
1212
"license": "BSD",
1313
"dependencies": {
14-
"express": "^4.7.2"
14+
"express": "^4.17.1"
1515
}
1616
}

‎examples/basic/server.js‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
"use strict";
22

3-
var express = require("express");
4-
var exphbs = require("../../"); // "express-handlebars"
3+
const express = require("express");
4+
const exphbs = require("../../"); // "express-handlebars"
55

6-
var app = express();
6+
const app = express();
77

88
app.engine("handlebars", exphbs());
99
app.set("view engine", "handlebars");

‎index.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
"use strict";
88

9-
var ExpressHandlebars = require("./lib/express-handlebars");
9+
const ExpressHandlebars = require("./lib/express-handlebars");
1010

1111
exports = module.exports = exphbs;
1212
exports.create = create;

0 commit comments

Comments
 (0)