cds-plugin-handlers
Version:
Plugin for CAP to use a handler for each entity structured by folder for each service
13 lines (10 loc) • 498 B
text/typescript
import { resolve } from 'path';
import { promises } from 'fs';
export function camelize(str: string): string {
return str.toLowerCase().replace(/(?:^\w|[A-Z]|\b\w)/g, function (word, index) {
return index == 0 ? word.toLowerCase() : word.toUpperCase();
}).replace(/\s+/g, '');
}
export function titleize (str: string): string {
return str.toLowerCase().split(' ').map(word => word.length === 2 ? word.toUpperCase() : word.charAt(0).toUpperCase() + word.slice(1)).join(' ');
}