1.3.0 • Published 6 months ago

custom-url-check v1.3.0

Weekly downloads
7
License
MIT
Repository
github
Last release
6 months ago

custom-url-check

  • Simple NPM package to check a string for a valid custom filtered URL!
  • See examples below

Install via NPM

$ npm i custom-url-check

Usage

  • Returns a Boolean indicating whether string is a valid URL and contains the specified community filter
  • filter parameter is case-insensitive
const customUrl = require('custom-url-check');

// --| customURL(url, filter);
// --| The below URL is not a valid YouTube URL
customUrl('amazon.co.uk', 'youtube');
customUrl('www.google.pl', 'YouTube');
customUrl('https://www.github.com', 'youtube');

// --| customURL(url, filter);
// --| The below URL is a valid YouTube URL
customUrl('https://www.youtube.com/', 'YouTube');
customUrl('www.youtube.com', 'youtube');
customUrl('youtube.com', 'YouTUBE');
customUrl('https://www.youtube.com/watch?v=w3jLJU7DT5E', 'Youtube');

Example

const customUrl = require('custom-url-check');

const testUrl = [
    'https://www.npmjs.com/',
    'www.googl.co.uk',
    'www.youtube.ro',
    'http://google.com',
    'https://www.google.com',
    'http://www.google.com',
    'www.google.com',
    'google.com'
];

testUrl.forEach((element) => {
    if (customUrl(element, 'GoOgLe')) {
        console.log(element + ' It\'s a valid Google URL! ✅');
    }

    else {
        console.log(element + ' Is not a valid Google URL! ❌');
    }
});

Result of the example above

1.2.8

6 months ago

1.3.0

6 months ago

1.2.9

6 months ago

1.2.7

2 years ago

1.2.6

2 years ago

1.2.4

3 years ago

1.2.3

3 years ago

1.2.2

3 years ago

1.2.1

3 years ago

1.2.0

4 years ago

1.1.9

4 years ago

1.1.8

4 years ago

1.1.7

4 years ago

1.1.6

4 years ago

1.1.5

4 years ago

1.1.4

4 years ago

1.1.3

4 years ago

1.1.2

4 years ago

1.1.1

4 years ago

1.1.0

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago