@atomist/sdm
Version:
Atomist Software Delivery Machine SDK
30 lines • 1.23 kB
TypeScript
/**
* If removing invalid characters from the name results in an empty
* string, this value is used as the name. You do not want more than
* one application per namespace to end up using this.
*/
export declare const defaultValidName = "valid-name";
/**
* Ensure the provided name is a valid Kubernetes resouce name. The
* validation regular expression for a resource is
* `/^[a-z]([-a-z0-9]*[a-z0-9])?$/` and it must be between 1 and 63
* characters long.
*
* @param name The resource name
* @return A valid resource name based on the input
*/
export declare function validName(name: string): string;
/**
* Determine if the `value` matches the `matcher`.
* The matching rules are as follows:
*
* - If the `matcher` is a string, `value` and `matcher` must be equal (===).
* - If `matcher` is a regular expression, `value` must match the regular expression according to RegExp.test().
* - If no `matcher` is provided, any `value` matches.
*
* @param value String to match
* @param matcher String or RegExp to match against
* @return `true` if it is a match, `false` otherwise
*/
export declare function nameMatch(value: string, matcher?: string | RegExp): boolean;
//# sourceMappingURL=name.d.ts.map