Skip to content

Home > robinson > isExternal

isExternal() function

This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.

判断是否为外链

Signature:

typescript
declare function isExternal(path: any): boolean;
declare function isExternal(path: any): boolean;

Parameters

ParameterTypeDescription
pathany路径

Returns:

boolean

{boolean} - 一个布尔值。

Example

JavaScript
 let path = 'https://example.com'; isExternal(path) // true
 let path = '/internal/path'; isExternal(path)// false
 let path = 'https://example.com'; isExternal(path) // true
 let path = '/internal/path'; isExternal(path)// false

Released under the MIT License.