mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ADF-2969] Moved doc tools to new tools folder (#3314)
* [ADF-2969] Moved doc tools to new tools folder * [ADF-2969] Added files missing from schematic * [ADF-2969] Added missing files to schematic
This commit is contained in:
committed by
Eugenio Romano
parent
9d0ccff189
commit
60644d9917
35
tools/doc/ngHelpers.js
Normal file
35
tools/doc/ngHelpers.js
Normal file
@@ -0,0 +1,35 @@
|
||||
module.exports = {
|
||||
"ngNameToDisplayName": ngNameToDisplayName,
|
||||
"dekebabifyName": dekebabifyName,
|
||||
"kebabifyClassName": kebabifyClassName,
|
||||
"classTypes": ["component", "directive", "model", "pipe", "service", "widget"]
|
||||
}
|
||||
|
||||
|
||||
function ngNameToDisplayName(ngName) {
|
||||
var mainSections = ngName.split(".");
|
||||
mainSections[0] = dekebabifyName(mainSections[0]);
|
||||
return mainSections.join(" ");
|
||||
}
|
||||
|
||||
|
||||
function displayNameToNgName(name) {
|
||||
var noSpaceName = ngName.replace(/ ([a-zA-Z])/, "$1".toUpperCase());
|
||||
return noSpaceName.substr(0, 1).toUpperCase() + noSpaceName.substr(1);
|
||||
}
|
||||
|
||||
|
||||
function dekebabifyName(name) {
|
||||
var result = name.replace(/-/g, " ");
|
||||
result = result.substr(0, 1).toUpperCase() + result.substr(1);
|
||||
return result;
|
||||
}
|
||||
|
||||
function kebabifyClassName(name) {
|
||||
var result = name.replace(/(Component|Directive|Interface|Model|Pipe|Service|Widget)$/, match => {
|
||||
return "." + match.toLowerCase();
|
||||
});
|
||||
|
||||
result = result.replace(/([A-Z])/g, "-$1");
|
||||
return result.substr(1).toLowerCase();
|
||||
}
|
Reference in New Issue
Block a user