Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

gatsby-page-utils

Package Overview
Dependencies
Maintainers
8
Versions
387
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gatsby-page-utils - npm Package Compare versions

Comparing version 3.12.0-next.1 to 3.13.0-next.0

19

dist/apply-trailing-slash-option.js

@@ -5,15 +5,20 @@ "use strict";

exports.applyTrailingSlashOption = void 0;
const endsWithSuffixes = (suffixes, input) => {
for (const suffix of suffixes) {
if (input.endsWith(suffix)) return true;
}
return false;
};
const suffixes = [`.html`, `.json`, `.js`, `.map`, `.txt`, `.xml`, `.pdf`];
const applyTrailingSlashOption = (input, option = `always`) => {
const hasHtmlSuffix = input.endsWith(`.html`);
const hasXmlSuffix = input.endsWith(`.xml`);
const hasPdfSuffix = input.endsWith(`.pdf`);
if (input === `/`) return input;
if (hasHtmlSuffix || hasXmlSuffix || hasPdfSuffix) {
option = `never`;
const hasTrailingSlash = input.endsWith(`/`);
if (endsWithSuffixes(suffixes, input)) {
return input;
}
if (option === `always`) {
return input.endsWith(`/`) ? input : `${input}/`;
return hasTrailingSlash ? input : `${input}/`;
}
if (option === `never`) {
return input.endsWith(`/`) ? input.slice(0, -1) : input;
return hasTrailingSlash ? input.slice(0, -1) : input;
}

@@ -20,0 +25,0 @@ return input;

{
"name": "gatsby-page-utils",
"version": "3.12.0-next.1",
"version": "3.13.0-next.0",
"description": "Gatsby library that helps creating pages",

@@ -33,3 +33,3 @@ "main": "dist/index.js",

"fs-exists-cached": "^1.0.0",
"gatsby-core-utils": "^4.12.0-next.1",
"gatsby-core-utils": "^4.13.0-next.0",
"glob": "^7.2.3",

@@ -43,3 +43,3 @@ "lodash": "^4.17.21",

"@types/micromatch": "^4.0.2",
"babel-preset-gatsby-package": "^3.12.0-next.0",
"babel-preset-gatsby-package": "^3.13.0-next.0",
"cross-env": "^7.0.3",

@@ -55,3 +55,3 @@ "rimraf": "^5.0.1",

},
"gitHead": "1ebae562b846165da217da3ee726b3201909f9a1"
"gitHead": "e6e2fb4fddd1f076531b01ea2bd6fe4f43655f8c"
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc