Skip to content

Commit 7b8d9a5

Browse files
committed
Add basic 'is plugin type' test.
1 parent 349a34d commit 7b8d9a5

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/ansible.ts

+5
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,8 @@
77
export function isFQCN(input: string): boolean {
88
return input.match(/^[a-z0-9_]+\.[a-z0-9_]+(?:\.[a-z0-9_]+)+$/) !== null;
99
}
10+
11+
export function isPluginType(input: string): boolean {
12+
/* We do not want to hard-code a list of valid plugin types that might be inaccurate, so we simply check whether this is a valid kind of Python identifier usually used for plugin types. If ansible-core ever adds one with digits, we'll have to update this. */
13+
return /^[a-z_]+$/.test(input);
14+
}

0 commit comments

Comments
 (0)