Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

validate-element-name

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

validate-element-name - npm Package Compare versions

Comparing version 0.1.1 to 0.2.0

cli.js

10

index.js

@@ -24,2 +24,10 @@ 'use strict';

if (/^polymer-/.test(name)) {
throw new Error('Custom element names should not start with `polymer-`.\nSee: http://webcomponents.github.io/articles/how-should-i-name-my-element');
}
if (/^x-/.test(name)) {
throw new Error('Custom element names should not start with `x-`.\nSee: http://webcomponents.github.io/articles/how-should-i-name-my-element/');
}
if (/^\d/i.test(name)) {

@@ -39,3 +47,3 @@ throw new Error('Custom element names must not start with a digit');

if (reservedNames.indexOf(name) !== -1) {
throw new Error('The supplied element name is reserved and can\'t be used. See: http://www.w3.org/TR/custom-elements/#concepts');
throw new Error('The supplied element name is reserved and can\'t be used.\nSee: http://www.w3.org/TR/custom-elements/#concepts');
}

@@ -42,0 +50,0 @@

{
"name": "validate-element-name",
"version": "0.1.1",
"version": "0.2.0",
"description": "Validate the name of a custom element",
"license": "MIT",
"repository": "sindresorhus/validate-element-name",
"bin": {
"validate-element-name": "cli.js"
},
"author": {

@@ -19,5 +22,9 @@ "name": "Sindre Sorhus",

"files": [
"index.js"
"index.js",
"cli.js"
],
"keywords": [
"cli",
"bin",
"app",
"validate",

@@ -24,0 +31,0 @@ "validator",

@@ -5,3 +5,4 @@ # validate-element-name [![Build Status](https://travis-ci.org/sindresorhus/validate-element-name.svg?branch=master)](https://travis-ci.org/sindresorhus/validate-element-name)

Custom element names should start with `a-z` and contain `a-z` and at least one `-` with optionally `0-9`.
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-` or `polymer-` prefix](http://webcomponents.github.io/articles/how-should-i-name-my-element/).

@@ -32,4 +33,26 @@

## CLI
You can also use it as a CLI app by installing it globally:
```bash
$ npm install --global validate-element-name
```
#### Usage
```bash
$ validate-element-name --help
Usage
$ validate-element-name <element-name>
Example
$ validate-element-name s-slider
Valid element name 👍
```
## License
[MIT](http://opensource.org/licenses/MIT) © [Sindre Sorhus](http://sindresorhus.com)
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc