Rename is.url to is.urlString
This commit is contained in:
parent
599eb7fd34
commit
e6de3f9002
2 changed files with 7 additions and 7 deletions
|
|
@ -190,7 +190,7 @@ namespace is { // tslint:disable-line:no-namespace
|
||||||
export const directInstanceOf = <T>(instance: unknown, klass: Class<T>): instance is T => Object.getPrototypeOf(instance) === klass.prototype;
|
export const directInstanceOf = <T>(instance: unknown, klass: Class<T>): instance is T => Object.getPrototypeOf(instance) === klass.prototype;
|
||||||
export const urlInstance = (value: unknown): value is URL => isObjectOfType<URL>(TypeName.URL)(value);
|
export const urlInstance = (value: unknown): value is URL => isObjectOfType<URL>(TypeName.URL)(value);
|
||||||
|
|
||||||
export const url = (value: unknown) => {
|
export const urlString = (value: unknown) => {
|
||||||
if (!string(value)) {
|
if (!string(value)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -583,13 +583,13 @@ test('is.urlInstance', t => {
|
||||||
t.false(is.urlInstance(null));
|
t.false(is.urlInstance(null));
|
||||||
});
|
});
|
||||||
|
|
||||||
test('is.url', t => {
|
test('is.urlString', t => {
|
||||||
const url = 'https://example.com';
|
const url = 'https://example.com';
|
||||||
t.true(is.url(url));
|
t.true(is.urlString(url));
|
||||||
t.false(is.url(new URL(url)));
|
t.false(is.urlString(new URL(url)));
|
||||||
t.false(is.url({}));
|
t.false(is.urlString({}));
|
||||||
t.false(is.url(undefined));
|
t.false(is.urlString(undefined));
|
||||||
t.false(is.url(null));
|
t.false(is.urlString(null));
|
||||||
});
|
});
|
||||||
|
|
||||||
test('is.truthy', t => {
|
test('is.truthy', t => {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue