validate-element-name

Validate the name of a custom element

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
validate-element-name
3903.0.02 years ago9 years agoMinified + gzip package size for validate-element-name in KB

Readme

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.