Skip to content

Commit

Permalink
Use SafeRexExp for separator module
Browse files Browse the repository at this point in the history
  • Loading branch information
finleyjb committed Jan 15, 2025
1 parent 05dc699 commit fa3ca12
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions ext/node/polyfills/path/separator.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
// Copyright 2018-2025 the Deno authors. MIT license.

// TODO(petamoriken): enable prefer-primordials for node polyfills
// deno-lint-ignore-file prefer-primordials

import { primordials } from "ext:core/mod.js";
import { isWindows } from "ext:deno_node/_util/os.ts";

const { SafeRegExp } = primordials;

export const SEP = isWindows ? "\\" : "/";
export const SEP_PATTERN = isWindows ? /[\\/]+/ : /\/+/;
export const SEP_PATTERN = isWindows
? new SafeRegExp("[\\/]+")
: new SafeRegExp("\/+");

0 comments on commit fa3ca12

Please sign in to comment.