From ba19153a0560e6b32b4633a72a327a1200261ad0 Mon Sep 17 00:00:00 2001 From: Sindre Sorhus Date: Wed, 8 Nov 2023 23:41:19 +0700 Subject: [PATCH] Accept `URL` for `stopAt` option --- index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index 647a1ce..e0b8004 100644 --- a/index.js +++ b/index.js @@ -9,7 +9,7 @@ export const findUpStop = Symbol('findUpStop'); export async function findUpMultiple(name, options = {}) { let directory = path.resolve(toPath(options.cwd) || ''); const {root} = path.parse(directory); - const stopAt = path.resolve(directory, options.stopAt || root); + const stopAt = path.resolve(directory, toPath(options.stopAt ?? root)); const limit = options.limit || Number.POSITIVE_INFINITY; const paths = [name].flat(); @@ -53,7 +53,7 @@ export async function findUpMultiple(name, options = {}) { export function findUpMultipleSync(name, options = {}) { let directory = path.resolve(toPath(options.cwd) || ''); const {root} = path.parse(directory); - const stopAt = options.stopAt || root; + const stopAt = path.resolve(directory, toPath(options.stopAt) ?? root); const limit = options.limit || Number.POSITIVE_INFINITY; const paths = [name].flat();