From 9bc25a995397d7fe81dde8edb683db51a49feb0f Mon Sep 17 00:00:00 2001 From: daniil4udo Date: Mon, 30 Dec 2024 14:44:04 +0400 Subject: [PATCH 1/2] refactor: remove node's path to be able to use in client --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index efcd9ca..da48dfc 100644 --- a/index.js +++ b/index.js @@ -19,7 +19,7 @@ module.exports.parse = parse * @private */ -var basename = require('path').basename +var basename = path => path.split(/[\\/]/).pop() /** * RegExp to match non attr-char, *after* encodeURIComponent (i.e. not including "%") From 051952d0f0844c5fa58b3ff2aba16536a4de6469 Mon Sep 17 00:00:00 2001 From: daniil4udo Date: Thu, 2 Jan 2025 13:22:21 +0400 Subject: [PATCH 2/2] fix: refine basename fn --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index da48dfc..3ba14ca 100644 --- a/index.js +++ b/index.js @@ -19,7 +19,7 @@ module.exports.parse = parse * @private */ -var basename = path => path.split(/[\\/]/).pop() +var basename = path => (path ?? '').replace(/[\\/]+$/, '').split(/[\\/]/).pop(); /** * RegExp to match non attr-char, *after* encodeURIComponent (i.e. not including "%")