1.4.1 • Published 5 months ago

custom-url-check v1.4.1

Weekly downloads
7
License
MIT
Repository
github
Last release
5 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.4.1

5 months ago

1.4.0

8 months ago

1.2.8

2 years ago

1.3.0

2 years ago

1.2.9

2 years ago

1.2.7

3 years ago

1.2.6

3 years ago

1.2.4

4 years ago

1.2.3

4 years ago

1.2.2

4 years ago

1.2.1

4 years ago

1.2.0

5 years ago

1.1.9

5 years ago

1.1.8

5 years ago

1.1.7

5 years ago

1.1.6

5 years ago

1.1.5

5 years ago

1.1.4

5 years ago

1.1.3

5 years ago

1.1.2

5 years ago

1.1.1

5 years ago

1.1.0

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago