Created
October 15, 2021 14:21
-
-
Save manchicken/a9a2af089f45196802259e7402f1e7c5 to your computer and use it in GitHub Desktop.
url-string-antipattern-before
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { URL } = require('url') | |
const BASE_URL = 'https://api.foobar.com/api/bookmark' | |
const bookmark_url = 'https://www.reddit.com/r/chickens/search/?q=silkie&restrict_sr=1' | |
const constructed_url = `${BASE_URL}/?url=${bookmark_url}` | |
console.log(constructed_url) | |
console.log(new URL(constructed_url) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment