Skip to content

Instantly share code, notes, and snippets.

@davecra
Created November 10, 2023 03:04
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
Encodes a URL in a format the Graph API References will accept
/**
* 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