Installation
Quick Take
Purpose
It’s a function which validates strings (first character of it), is it suitable to be in an HTML attribute’s name. See the official spec for HTML attribute names.
API — isAttrNameChar()
The main function isAttrNameChar()
is imported like this:
It’s a function which takes one input argument:
Input argument | Type | Obligatory | Description |
---|---|---|---|
str Type: String Obligatory: yes | |||
str | String | yes | The character to evaluate. |
The function always returns a boolean and never throws errors.
In case of non-string input or empty string, it just returns false
.
If the input string is longer than 1
, its first character is used.
Also
If you need a comprehensive list of all possible HTML attribute names, check out html-all-known-attributes
.