[]previous and next page

candidateName

The directory's last segment, lowercased and with every character a package name cannot hold turned into -.

The directory's last segment, lowercased and with every character a package name cannot hold turned into -. It is not yet a valid name: check it with packageNameProblem. Empty when nothing usable remains.

Import#

ts
import { candidateName } from "create-shadow-app";

Signature#

ts
function candidateName(directory: string, path: PathApi = nodePath): string

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 candidate, possibly empty.

Examples#

ts
candidateName("/tmp/http"); // "http", which packageNameProblem refuses