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

is-valid-hostname

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

is-valid-hostname - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

2

index.js

@@ -5,3 +5,3 @@ module.exports = function isValidHostname(value, opts) {

const validHostnameChars = /^([a-zA-Z0-9-.]+){1,253}$/g
const validHostnameChars = /^[a-zA-Z0-9-.]{1,253}\.?$/g
if (!validHostnameChars.test(value)) {

@@ -8,0 +8,0 @@ return false

{
"name": "is-valid-hostname",
"version": "0.1.0",
"version": "0.1.1",
"description": "Validate hostname based on RFC-3696",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -5,6 +5,7 @@ var test = require('tape')

test('is valid hostname', function (t) {
t.plan(85)
t.plan(87)
// tld and subdomains
t.equal(isValidHostname('example.com'), true)
t.equal(isValidHostname('example.com.'), true)
t.equal(isValidHostname('foo.example.com'), true)

@@ -14,2 +15,3 @@ t.equal(isValidHostname('bar.foo.example.com'), true)

t.equal(isValidHostname('a.com'), true)
t.equal(isValidHostname('.com.'), false)
t.equal(isValidHostname('a.b'), true)

@@ -16,0 +18,0 @@ t.equal(isValidHostname('foo.bar.baz'), true)

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