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.7.1 to 1.0.0

38

cli.js
#!/usr/bin/env node
'use strict';
var logSymbols = require('log-symbols');
var pkg = require('./package.json');
var validate = require('./index');
var input = process.argv[2];
var validate = require('./');
var argv = process.argv.slice(2);
var input = argv[0];
function help() {
console.log(pkg.description);
console.log('');
console.log('Usage');
console.log(' $ validate-element-name <element-name>');
console.log('');
console.log('Example');
console.log(' $ validate-element-name s-slider');
console.log(' Valid element name 👍');
console.log([
'',
' ' + pkg.description,
'',
' Usage',
' validate-element-name <element-name>',
'',
' Example',
' validate-element-name s-slider',
' ' + logSymbols.success + ' Valid element name.'
].join('\n'));
}
if (!input || process.argv.indexOf('-h') !== -1 || process.argv.indexOf('--help') !== -1) {
if (!input || argv.indexOf('--help') !== -1) {
help();

@@ -23,3 +28,3 @@ return;

if (process.argv.indexOf('-v') !== -1 || process.argv.indexOf('--version') !== -1) {
if (argv.indexOf('--version') !== -1) {
console.log(pkg.version);

@@ -32,9 +37,10 @@ return;

if (res.isValid) {
console.log('👍 Valid element name');
if (res.message) {
console.log('\nWarning:\n' + res.message);
console.log(logSymbols.success + ' Valid element name, but...');
console.log(logSymbols.warning + ' ' + res.message);
} else {
console.log(logSymbols.success + ' Valid element name.');
}
} else {
console.error('👎 Invalid element name\n\n' + res.message);
console.error(logSymbols.error + ' ' + res.message);
}

@@ -20,4 +20,4 @@ 'use strict';

if (name.toLowerCase() !== name) {
return 'Custom element names must be lowercase.';
if (/[A-Z]/.test(name)) {
return 'Custom element names must not contain uppercase ASCII characters.';
}

@@ -45,3 +45,3 @@

}
};
}

@@ -48,0 +48,0 @@ function hasWarning(name) {

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

@@ -15,2 +12,5 @@ "name": "Sindre Sorhus",

},
"bin": {
"validate-element-name": "cli.js"
},
"engines": {

@@ -46,3 +46,4 @@ "node": ">=0.10.0"

"dependencies": {
"ncname": "^0.1.0"
"log-symbols": "^1.0.0",
"ncname": "^1.0.0"
},

@@ -49,0 +50,0 @@ "devDependencies": {

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

```bash
```sh
$ npm install --save validate-element-name

@@ -31,19 +31,15 @@ ```

You can also use it as a CLI app by installing it globally:
```bash
```sh
$ npm install --global validate-element-name
```
#### Usage
```bash
```sh
$ validate-element-name --help
Usage
$ validate-element-name <element-name>
Usage
validate-element-name <element-name>
Example
$ validate-element-name s-slider
👍 Valid element name
Example
validate-element-name s-slider
✔︎ Valid element name.
```

@@ -54,2 +50,2 @@

[MIT](http://opensource.org/licenses/MIT) © [Sindre Sorhus](http://sindresorhus.com)
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