From 863fce310b965adcdfe29c3de9d34f0b0459cd73 Mon Sep 17 00:00:00 2001 From: Slobodan Stojanovic Date: Sat, 24 Oct 2015 14:01:53 +0200 Subject: [PATCH] Update docs - add template strings and arrow functions where applicable --- docs/api/index.md | 4 ++-- docs/guide.md | 8 +++----- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/docs/api/index.md b/docs/api/index.md index e3db9bf..aad0ad7 100644 --- a/docs/api/index.md +++ b/docs/api/index.md @@ -64,7 +64,7 @@ app.use(function *(next){ const start = new Date; yield next; const ms = new Date - start; - this.set('X-Response-Time', ms + 'ms'); + this.set('X-Response-Time', `${ms}ms`); }); // logger @@ -73,7 +73,7 @@ app.use(function *(next){ const start = new Date; yield next; const ms = new Date - start; - console.log('%s %s - %s', this.method, this.url, ms); + console.log(`${this.method} ${this.url} - ${ms}`); }); // response diff --git a/docs/guide.md b/docs/guide.md index 62779af..d8b9d3f 100644 --- a/docs/guide.md +++ b/docs/guide.md @@ -17,7 +17,7 @@ function *responseTime(next) { const start = new Date; yield next; const ms = new Date - start; - this.set('X-Response-Time', ms + 'ms'); + this.set('X-Response-Time', `${ms}ms`); } app.use(responseTime); @@ -30,7 +30,7 @@ app.use(function *(next){ const start = new Date; yield next; const ms = new Date - start; - this.set('X-Response-Time', ms + 'ms'); + this.set('X-Response-Time', `${ms}ms`); }); ``` @@ -223,9 +223,7 @@ const fs = require('co-fs'); app.use(function *(){ const paths = yield fs.readdir('docs'); - const files = yield paths.map(function(path){ - return fs.readFile('docs/' + path, 'utf8'); - }); + const files = yield paths.map(path => fs.readFile(`docs/${path}`, 'utf8')); this.type = 'markdown'; this.body = files.join('');