diff options
author | Marius David Wieschollek <passwords.public@mdns.eu> | 2020-12-23 14:28:30 +0300 |
---|---|---|
committer | Marius David Wieschollek <passwords.public@mdns.eu> | 2020-12-23 14:28:30 +0300 |
commit | 883f48f584a8854475807abe82ac035f0f89dff0 (patch) | |
tree | a441c53e9c910720822f5d627db3eeddc9747221 | |
parent | 6e64e4b0b9c76e4284fcfe4261d5c276bb502faf (diff) | |
parent | 4644509da59a2794df5277461b1b8eedc02ab7eb (diff) |
Merge branch 'stable'
# Conflicts:
# package.json
-rw-r--r-- | src/Classes/EnhancedApi.js | 19 | ||||
-rw-r--r-- | src/Classes/SimpleApi.js | 20 |
2 files changed, 19 insertions, 20 deletions
diff --git a/src/Classes/EnhancedApi.js b/src/Classes/EnhancedApi.js index 59379af..605df4b 100644 --- a/src/Classes/EnhancedApi.js +++ b/src/Classes/EnhancedApi.js @@ -1,3 +1,4 @@ +import Url from 'url-parse'; import SimpleApi from './SimpleApi'; import Encryption from './Encryption'; import EventEmitter from 'eventemitter3'; @@ -1355,4 +1356,22 @@ export default class EnhancedApi extends SimpleApi { } }; } + + // noinspection JSMethodCanBeStatic + /** + * + * @param url + * @param component + * @returns {*} + */ + parseUrl(url, component = null) { + if(url === undefined) return null; + + if(url.indexOf('://') === -1) url = `http://${url}`; + + let link = Url(url); + if(component !== null) return link[component]; + + return link; + } }
\ No newline at end of file diff --git a/src/Classes/SimpleApi.js b/src/Classes/SimpleApi.js index 70b3af1..5ca8430 100644 --- a/src/Classes/SimpleApi.js +++ b/src/Classes/SimpleApi.js @@ -903,26 +903,6 @@ export default class SimpleApi { /** * * @param url - * @param component - * @returns {*} - */ - parseUrl(url, component = null) { - if(url === undefined) return null; - let link = document.createElement('a'); - - if(url.indexOf('://') === -1) url = `http://${url}`; - - link.setAttribute('href', url); - - if(component !== null) return link[component]; - - return link; - } - - // noinspection JSMethodCanBeStatic - /** - * - * @param url * @param data * @returns {*} */ |