Files
Daniel SchmidtandRotem Mizrachi-Meidan 38f6932da1 Move generation to babel 7 (#762)
* update babel to version 7

This enables us to generate better comments

* use new addComment function of babel to generate nicer comments

* improve tightly coupled test
2018-10-13 21:44:09 +03:00

23 lines
540 B
JavaScript

const t = require("@babel/types");
function capitalizeFirstLetter(string) {
return string.charAt(0).toUpperCase() + string.slice(1);
}
function methodNameToSnakeCase(name) {
return name
.split(':')
.map((item, index) =>
index === 0 ? item : capitalizeFirstLetter(item)
).join('');
}
function callGlobal(sanitizerName) {
return argIdentifier =>
t.callExpression(t.identifier(sanitizerName), [t.identifier(argIdentifier)]);
}
module.exports = {
methodNameToSnakeCase,
callGlobal
};