-
-
Notifications
You must be signed in to change notification settings - Fork 232
/
config.js
22 lines (19 loc) · 960 Bytes
/
config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// default config is writen in config.yml
// and some dynamic function config to write in this config.js
// used with crd-leetcode-cli.
const transform_markdown_table = (dataArr) => {
const beforeDescription = `The markdown table is generated by [crd-leetcode-cli](https://github.com/MuYunyun/create-react-doc/tree/master/packages/leetcode-cli)`;
let result = beforeDescription + '\n' +
'| # | Title | Explanation | Difficulty | Type |' +
'\n' +
'|:---:|:---:|:---:|:---:|:---:|';
for (let i = 0; i < dataArr.length; i++) {
result += `\n| ${dataArr[i].questionId} | [${dataArr[i].title
}](https://leetcode.com/problems/${dataArr[i].titleSlug
}/) | [Analyze](https://github.com/MuYunyun/blog/blob/master/LeetCode/${dataArr[i].questionId
}.${dataArr[i].title.split(' ').join('_')}.md) | ${dataArr[i].difficulty
} | ${dataArr[i].topicTags} |`;
}
return result;
};
module.exports = { transform_markdown_table }