Search code examples
angulartypescriptangular-cliangular-schematics

What is the helper function for "lowercase" when writing an Angular schematic template?


I'm working on building a simple angular schematic template following a tutorial here. All going well. This tutorial uses a helper function (dasherize) to convert the file name from AwesomeWrap to hello-awesome-wrap.

hello-__name@dasherize__

I want to change this functionality in my own implementation to simply ensure file names are lower case, so AwesomeWrap should be awesomewrap.

This functionality doesn't seem well documented though (or not that I can find) and I can't find a list of available functions for this. I tried creating a file view-__name@lowercase__.ts but lowercase didn't seem an available function.

When I run schematics .:sensor --name=test, I get the error message:

Error: Pipe "lowercase" is not defined.

So what is the correct syntax for this? Is there a list of available transforms that can be performed in this way?


Solution

  • There is currently no lowercase in the Angular Schematics Devkit package.

    You can see all the supported functions here: https://github.com/angular/angular-cli/blob/master/packages/angular_devkit/core/src/utils/strings.ts

    If you need a lowercase function you can open a Pull Request for this file and add it.