From e8fa12f73ce880ab0eff0420800287bc4edaed3f Mon Sep 17 00:00:00 2001 From: Nathan Esau Date: Sat, 13 Jun 2020 09:21:17 -0400 Subject: [PATCH 1/2] add ts support --- lib/config.js | 3 ++- lib/helper.js | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/config.js b/lib/config.js index ed390f04..040d9b33 100644 --- a/lib/config.js +++ b/lib/config.js @@ -29,7 +29,8 @@ const DEFAULT_CONFIG = { 'ruby', 'rust', 'scala', - 'swift' + 'swift', + 'typescript' ], urls: { // base urls diff --git a/lib/helper.js b/lib/helper.js index c4f881aa..d256103e 100644 --- a/lib/helper.js +++ b/lib/helper.js @@ -45,7 +45,8 @@ const LANGS = [ {lang: 'ruby', ext: '.rb', style: '#'}, {lang: 'rust', ext: '.rs', style: 'c'}, {lang: 'scala', ext: '.scala', style: 'c'}, - {lang: 'swift', ext: '.swift', style: 'c'} + {lang: 'swift', ext: '.swift', style: 'c'}, + {lang: 'typescript', ext: '.ts', style: 'c'} ]; const h = {}; From d3193bc8a22ab8f27a89ab71a2873451ee74a92a Mon Sep 17 00:00:00 2001 From: --global <--global> Date: Tue, 16 Jun 2020 08:54:19 -0400 Subject: [PATCH 2/2] add ts tests --- test/test_helper.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test/test_helper.js b/test/test_helper.js index 18a2979d..a09fb6d9 100644 --- a/test/test_helper.js +++ b/test/test_helper.js @@ -136,6 +136,7 @@ describe('helper', function() { assert.equal(h.langToExt('scala'), '.scala'); assert.equal(h.langToExt('swift'), '.swift'); assert.equal(h.langToExt('rust'), '.rs'); + assert.equal(h.langToExt('typescript'), '.ts'); }); }); // #langToExt @@ -158,6 +159,7 @@ describe('helper', function() { assert.equal(h.extToLang('~/leetcode/../file.sql'), 'mysql'); assert.equal(h.extToLang('/home/skygragon/file.dat'), 'unknown'); assert.equal(h.extToLang('~/leetcode/file.rs'), 'rust'); + assert.equal(h.extToLang('~/leetcode/file.ts'), 'typescript'); }); }); // #extToLang @@ -182,6 +184,7 @@ describe('helper', function() { assert.deepEqual(h.langToCommentStyle('ruby'), RUBY_STYLE); assert.deepEqual(h.langToCommentStyle('scala'), C_STYLE); assert.deepEqual(h.langToCommentStyle('swift'), C_STYLE); + assert.deepEqual(h.langToCommentStyle('typescript'), C_STYLE); }); }); // #langToCommentStyle