2018-04-06 13:51:52 +00:00
|
|
|
const preFormattedBlockNames = {
|
|
|
|
'api-projects': 'API Projects',
|
|
|
|
'basic-css': 'Basic CSS',
|
|
|
|
'basic-html-and-html5': 'Basic HTML and HTML5',
|
|
|
|
'css-flexbox': 'CSS Flexbox',
|
|
|
|
'css-grid': 'CSS Grid',
|
|
|
|
devops: 'DevOps',
|
|
|
|
es6: 'ES6',
|
|
|
|
'information-security-with-helmetjs': 'Information Security with HelmetJS',
|
|
|
|
jquery: 'jQuery',
|
|
|
|
'json-apis-and-ajax': 'JSON APIs and Ajax',
|
|
|
|
'mongodb-and-mongoose': 'MongoDB and Mongoose',
|
2018-12-03 09:56:18 +00:00
|
|
|
'the-dom': 'The DOM',
|
|
|
|
'apis-and-microservices': 'APIs and Microservices',
|
2020-02-24 18:40:32 +00:00
|
|
|
'apis-and-microservices-projects': 'APIs and Microservices Projects',
|
|
|
|
'scientific-computing-with-python': 'Scientific Computing with Python',
|
|
|
|
'data-analysis-with-python': 'Data Analysis with Python',
|
2020-07-02 11:50:43 +00:00
|
|
|
'machine-learning-with-python': 'Machine Learning with Python',
|
2019-11-05 01:56:32 +00:00
|
|
|
tensorflow: 'TensorFlow',
|
2019-12-09 10:37:02 +00:00
|
|
|
'basic-javascript-rpg-game': 'Basic JavaScript RPG Game',
|
2020-07-24 16:13:46 +00:00
|
|
|
'basic-html-cat-photo-app': 'HTML Cat Photo App',
|
2020-09-04 02:12:42 +00:00
|
|
|
'basic-css-cafe-menu': 'CSS Cafe Menu',
|
2019-11-05 03:09:40 +00:00
|
|
|
'css-variables-skyline': 'CSS Variables Skyline',
|
2019-12-08 00:11:14 +00:00
|
|
|
'javascript-spreadsheet': 'JavaScript Spreadsheet',
|
|
|
|
'intermediate-javascript-calorie-counter':
|
2020-02-26 04:53:07 +00:00
|
|
|
'Intermediate JavaScript Calorie Counter',
|
2020-06-24 07:22:14 +00:00
|
|
|
'd3-dashboard': 'D3 Dashboard'
|
2018-04-06 13:51:52 +00:00
|
|
|
};
|
|
|
|
|
2018-04-17 14:24:17 +00:00
|
|
|
const noFormatting = ['and', 'for', 'of', 'the', 'up', 'with'];
|
2018-04-06 13:51:52 +00:00
|
|
|
|
|
|
|
exports.blockNameify = function blockNameify(phrase) {
|
|
|
|
const preFormatted = preFormattedBlockNames[phrase] || '';
|
|
|
|
if (preFormatted) {
|
|
|
|
return preFormatted;
|
|
|
|
}
|
2018-04-17 14:24:17 +00:00
|
|
|
return phrase
|
|
|
|
.split('-')
|
|
|
|
.map(word => {
|
2018-04-06 13:51:52 +00:00
|
|
|
if (noFormatting.indexOf(word) !== -1) {
|
|
|
|
return word;
|
|
|
|
}
|
|
|
|
if (word === 'javascript') {
|
|
|
|
return 'JavaScript';
|
|
|
|
}
|
|
|
|
return word.charAt(0).toUpperCase() + word.slice(1);
|
|
|
|
})
|
|
|
|
.join(' ');
|
|
|
|
};
|