Skip to content

Commit

Permalink
refactor: es6-fy (#70)
Browse files Browse the repository at this point in the history
  • Loading branch information
curbengh authored and tomap committed Aug 10, 2019
1 parent d63fda6 commit 2395a94
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions scripts/build_highlight_alias.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
'use strict';

var hljs = require('highlight.js');
var languages = hljs.listLanguages();
const hljs = require('highlight.js');
const languages = hljs.listLanguages();
const fs = require('fs');

var result = {
const result = {
languages: languages,
aliases: {}
};

languages.forEach(function(lang) {
languages.forEach(lang => {
result.aliases[lang] = lang;

var def = require('highlight.js/lib/languages/' + lang)(hljs);
var aliases = def.aliases;
const def = require('highlight.js/lib/languages/' + lang)(hljs);
const aliases = def.aliases;

if (aliases) {
aliases.forEach(function(alias) {
aliases.forEach(alias => {
result.aliases[alias] = lang;
});
}
Expand All @@ -27,4 +27,3 @@ stream.write(JSON.stringify(result));
stream.on('end', () => {
stream.end();
});

0 comments on commit 2395a94

Please sign in to comment.