toPackageName
Turns a directory name into a valid package name.
Turns a directory name into a valid package name.
Import#
ts
import { toPackageName } from "create-shadow-app";
Signature#
ts
function toPackageName(directory: string, path: PathApi = nodePath): string | undefined
Parameters#
| Name | Description |
|---|---|
directory |
A path; only its last segment is used. |
path |
The path functions of the platform. Default: this machine's. |
Returns#
The name (My App! becomes my-app), or undefined when nothing usable remains.
Examples#
ts
toPackageName("/tmp/My Cool_App"); // "my-cool_app"