Created
October 15, 2021 14:36
-
-
Save manchicken/12c55a94bd03166ff33ed0596263b4c6 to your computer and use it in GitHub Desktop.
url-string-antipattern-before-1
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 encodeUrl = require('encodeurl') | |
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=${encodeUrl(bookmark_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