UNPKG

@newrelic/gatsby-theme-newrelic

Version:

[![Community Project header](https://github.com/newrelic/opensource-website/raw/master/src/images/categories/Community_Project.png)](https://opensource.newrelic.com/oss-category/#community-project)

22 lines (16 loc) 402 B
const hasQueryParams = (urlString) => { const url = new URL(urlString); return Boolean(url.search); }; exports.appendTrailingSlash = (url) => { if (hasQueryParams(url)) { return url; } return url.endsWith('/') ? url : `${url}/`; }; exports.stripTrailingSlash = (url) => { if (hasQueryParams(url)) { return url; } return url.endsWith('/') ? url.replace(/\/$/, '') : url; };