From c0cec976375514bc4b2239b7fde1314e5c83583e Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Thu, 18 Aug 2022 10:59:22 +0200 Subject: [PATCH] fix(extname): avoid regex look-behinds for safari support (#42) --- src/path.ts | 4 ++-- src/utils.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/path.ts b/src/path.ts index f613336..48f5e1e 100644 --- a/src/path.ts +++ b/src/path.ts @@ -182,10 +182,10 @@ export const toNamespacedPath: typeof path.toNamespacedPath = function (p) { } // extname -const _EXTNAME_RE = /(?) { return aliases } -const FILENAME_RE = /(?<=^|[\\/])([^\\/]+?)(?=(\.[^.]+)?$)/ +const FILENAME_RE = /(^|[\\/])([^\\/]+?)(?=(\.[^.]+)?$)/ export function filename (path: string) { - return path.match(FILENAME_RE)?.[0] + return path.match(FILENAME_RE)?.[2] } // --- internals ---