mirror of https://github.com/CrimsonTome/tldr.git
Fix build-index.js coding style (#1101)
- Use single quotes consistently - Insert space before parenthesis in anonymous function declarationswaldyrious/alt-syntax
parent
7555812d12
commit
27123e215a
|
@ -1,6 +1,6 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var glob = require("glob");
|
var glob = require('glob');
|
||||||
|
|
||||||
function parsePlatform(pagefile) {
|
function parsePlatform(pagefile) {
|
||||||
return pagefile.split(/\//)[1];
|
return pagefile.split(/\//)[1];
|
||||||
|
@ -11,7 +11,7 @@ function parsePagename(pagefile) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function buildShortPagesIndex(files) {
|
function buildShortPagesIndex(files) {
|
||||||
var reducer = function(index, file) {
|
var reducer = function (index, file) {
|
||||||
var os = parsePlatform(file);
|
var os = parsePlatform(file);
|
||||||
var page = parsePagename(file);
|
var page = parsePagename(file);
|
||||||
if (index[page]) {
|
if (index[page]) {
|
||||||
|
@ -28,7 +28,7 @@ function buildShortPagesIndex(files) {
|
||||||
function buildPagesIndex(shortIndex) {
|
function buildPagesIndex(shortIndex) {
|
||||||
return Object.keys(shortIndex)
|
return Object.keys(shortIndex)
|
||||||
.sort()
|
.sort()
|
||||||
.map(function(page) {
|
.map(function (page) {
|
||||||
return {
|
return {
|
||||||
name: page,
|
name: page,
|
||||||
platform: shortIndex[page]
|
platform: shortIndex[page]
|
||||||
|
@ -43,7 +43,7 @@ function saveIndex(index) {
|
||||||
console.log(JSON.stringify(indexFile));
|
console.log(JSON.stringify(indexFile));
|
||||||
}
|
}
|
||||||
|
|
||||||
glob("pages/**/*.md", function (er, files) {
|
glob('pages/**/*.md', function (er, files) {
|
||||||
var shortIndex = buildShortPagesIndex(files);
|
var shortIndex = buildShortPagesIndex(files);
|
||||||
var index = buildPagesIndex(shortIndex);
|
var index = buildPagesIndex(shortIndex);
|
||||||
saveIndex(index);
|
saveIndex(index);
|
||||||
|
|
Loading…
Reference in New Issue