Skip to content
This repository has been archived by the owner on Aug 17, 2023. It is now read-only.

Prefer const over let #1

Merged
merged 1 commit into from Oct 13, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions examples/simple.js
Expand Up @@ -11,9 +11,9 @@ const router = new Router()

router
.get('/auth', function * () {
let user = yield this.parseBody()
const user = yield this.parseBody()
// verify with user.name and user.passwd, get user._id
let token = this.signToken({
const token = this.signToken({
name: user.name,
_id: user._id
})
Expand Down
4 changes: 2 additions & 2 deletions index.js
Expand Up @@ -48,7 +48,7 @@ function toaToken (app, secretOrPrivateKeys, options) {
if (this._toaJsonWebToken) return this._toaJsonWebToken

let token
let authorization = this.get('authorization')
const authorization = this.get('authorization')

if (getToken) token = getToken.call(this)
if (!token && authorization) {
Expand Down Expand Up @@ -84,7 +84,7 @@ JWT.prototype.decodeToken = function (token, options) {

JWT.prototype.verifyToken = function (token, options) {
let error = null
let secretOrPrivateKeys = this.secretOrPrivateKeys
const secretOrPrivateKeys = this.secretOrPrivateKeys

for (let i = 0, len = secretOrPrivateKeys.length - 1; i <= len; i++) {
try {
Expand Down
2 changes: 1 addition & 1 deletion test/index.js
Expand Up @@ -10,7 +10,7 @@ const Toa = require('toa')
const toaToken = require('../')

function assertContains (src, dst) {
let keys = Object.keys(dst)
const keys = Object.keys(dst)
for (let i = 0; i < keys.length; i++) {
assert.strictEqual(src[keys[i]], dst[keys[i]])
}
Expand Down