New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.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.0 to 0.1.1

14

index.js
'use strict';
var ncname = require('ncname');

@@ -23,2 +24,15 @@ var reservedNames = [

if (/^\d/i.test(name)) {
throw new Error('Custom element names must not start with a digit');
}
if (/^-/i.test(name)) {
throw new Error('Custom element names must not start with a hyphen');
}
// http://www.w3.org/TR/custom-elements/#concepts
if (!ncname.test(name.replace(/-/g, ''))) {
throw new Error('Invalid element name.');
}
if (reservedNames.indexOf(name) !== -1) {

@@ -25,0 +39,0 @@ throw new Error('The supplied element name is reserved and can\'t be used. See: http://www.w3.org/TR/custom-elements/#concepts');

5

package.json
{
"name": "validate-element-name",
"version": "0.1.0",
"version": "0.1.1",
"description": "Validate the name of a custom element",

@@ -37,2 +37,5 @@ "license": "MIT",

],
"dependencies": {
"ncname": "^0.1.0"
},
"devDependencies": {

@@ -39,0 +42,0 @@ "mocha": "*"

2

readme.md

@@ -5,3 +5,5 @@ # 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`.
## Install

@@ -8,0 +10,0 @@

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