Created
November 10, 2023 03:04
-
-
Save davecra/85e7118ecf2984d4c703f4d6a1ec26fe to your computer and use it in GitHub Desktop.
Encodes a URL in a format the Graph API References will accept
This file contains 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
/** | |
* Encodes the URL ins the special planner format that is for oif but not quite | |
* following the encodeURIComponent() specification... | |
* @param {String} url | |
* @returns {String} | |
*/ | |
#encodePlannerExternalReferenceUrl = (url) => { | |
// Encode specific characters: : . _ | |
const encodedUrl = url.replace(/:/g, "%3A").replace(/\./g, "%2E").replace(/ /g, "%20"); | |
return encodedUrl; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment