Skip to content

sindresorhus/validate-element-name

main
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

validate-element-name

Validate the name of a custom element

Custom element names should start with a-z and contain a-z and at least one - with optionally 0-9.

You should not use the x-, polymer-, ng- prefixes.

Install

$ npm install validate-element-name

Usage

import validateElementName from 'validate-element-name';

validate('unicorn');
//=> {isValid: false, message: 'Custom element names must contain a hyphen. Example: unicorn-cake'}

See cli.js for real-world usage.

CLI

$ npm install --global validate-element-name
$ validate-element-name --help

  Usage
    $ validate-element-name <element-name>

  Example
    $ validate-element-name s-slider
    ✔︎ Valid element name.