#[inline]
pub fn is_component_tag(tag: &str) -> bool {
tag.contains('-') || tag.chars().next().is_some_and(|c| c.is_ascii_uppercase())
}
#[inline]
pub fn is_builtin_directive(name: &str) -> bool {
matches!(
name,
"if" | "else"
| "else-if"
| "for"
| "show"
| "bind"
| "on"
| "model"
| "slot"
| "text"
| "html"
| "cloak"
| "once"
| "pre"
| "memo"
)
}
#[inline]
pub fn is_keyword(s: &str) -> bool {
matches!(
s,
"true"
| "false"
| "null"
| "undefined"
| "this"
| "arguments"
| "if"
| "else"
| "for"
| "while"
| "do"
| "switch"
| "case"
| "break"
| "continue"
| "return"
| "throw"
| "try"
| "catch"
| "finally"
| "new"
| "delete"
| "typeof"
| "void"
| "in"
| "of"
| "instanceof"
| "function"
| "class"
| "const"
| "let"
| "var"
| "async"
| "await"
| "yield"
| "import"
| "export"
| "default"
| "from"
| "as"
)
}
#[cfg(test)]
mod tests {
use super::{is_builtin_directive, is_component_tag};
#[test]
fn test_is_component_tag() {
assert!(is_component_tag("MyComponent"));
assert!(is_component_tag("my-component"));
assert!(!is_component_tag("div"));
assert!(!is_component_tag("span"));
}
#[test]
fn test_is_builtin_directive() {
assert!(is_builtin_directive("if"));
assert!(is_builtin_directive("for"));
assert!(is_builtin_directive("model"));
assert!(!is_builtin_directive("custom"));
}
}