-
-
Notifications
You must be signed in to change notification settings - Fork 0
identifier
function isIdentifier<T extends string>(it: T): it is Identifier<T>;Checks if a given string is a valid JavaScript identifier, meaning it can be used as the name of a variable, function, property, label, or export.
| Name | Info |
|---|---|
it |
The value to check. |
true if the value is a valid identifier, false otherwise.
Primitives
import { isIdentifier } from "jsr:@nick/is/identifier";
console.log(isIdentifier("a")); // true
console.log(isIdentifier("1")); // false
console.log(isIdentifier("export")); // falsefunction isIdentifier(it: unknown): it is Identifier;Checks if a given value is a valid JavaScript identifier, meaning it can be used as the name of a variable, function, property, label, or export.
| Name | Info |
|---|---|
it |
The value to check. |
true if the value is a valid identifier, false otherwise.
Primitives
import { isIdentifier } from "jsr:@nick/is/identifier";
console.log(isIdentifier("a")); // true
console.log(isIdentifier("1")); // false
console.log(isIdentifier("export")); // falsefunction isIdentifier(it: unknown): it is Identifier;Checks if a given value is a valid JavaScript identifier, meaning it can be used as the name of a variable, function, property, label, or export.
| Name | Info |
|---|---|
it |
The value to check. |
true if the value is a valid identifier, false otherwise.
Primitives
import { isIdentifier } from "jsr:@nick/is/identifier";
console.log(isIdentifier("a")); // true
console.log(isIdentifier("1")); // false
console.log(isIdentifier("exportm z=-0fdxz")); // trueexport type Identifier<T extends string = string> = Brand<T, "Identifier">;Utility type brand that represents a valid JavaScript identifier. This is a
string that can be used as a name of a variable, function, property, label, or
export. It is a subtype of string and is used to distinguish between regular
strings and identifiers.
-
Textendsstring(default:string)
Primitives
export type ReservedWord = reserved[number];Represents a reserved word in JavaScript that cannot be used as an identifier,
such as export, default, class, etc.
Primitives
identifier reserved