Skip to content

Instantly share code, notes, and snippets.

@davecra
Created November 10, 2023 03:04
Show Gist options
  • Save davecra/85e7118ecf2984d4c703f4d6a1ec26fe to your computer and use it in GitHub Desktop.
Save davecra/85e7118ecf2984d4c703f4d6a1ec26fe to your computer and use it in GitHub Desktop.
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