Launch Week Day 5: Introducing Reachability for PHP.Learn More
Socket
Book a DemoSign in
Socket

is-subdomain-valid

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

is-subdomain-valid

checks if subdomain is valid

latest
Source
npmnpm
Version
1.0.0
Version published
Maintainers
1
Created
Source

is-subdomain-valid

checks if subdomain is valid

Build Status

npm install is-subdomain-valid
const isSubdomainValid = require('./');

const valid = [
    'test',
    'something-something',
    '123test',
    'awesome-subdomain',
    'SuBsubsub',
    'coca-cola',
    'pepsi',
    'otl',
    'otl-ventures',
];

const invalid = [
    'with space',
    'something.something',
    '#qw3',
    'letter@3',
    'me2!9',
    'S<>ee',
    'Trala/la',
    'dot.dot.dot',
    ' something',
    'something ',
    '+e',
    'e+',
    'e3%',
];

valid.forEach((subdomain) => {
    it(`should mark \`${subdomain}\` as valid`, () => {
        expect(isSubdomainValid(subdomain)).toBe(true);
    });
});

invalid.forEach((subdomain) => {
    it(`should mark \`${subdomain}\` as invalid`, () => {
        expect(isSubdomainValid(subdomain)).toBe(false);
    });
});

FAQs

Package last updated on 15 May 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts