Skip to content

[Replacement]: is-path-in-cwd #1022

Closed

Description

@outslept

Package to replace

is-path-in-cwd

Suggested replacement(s)

const isPathInCwd = (p) => {
  const relation = path.relative(process.cwd(), p);
  return Boolean(
    relation &&
    relation !== '..' &&
    !relation.startsWith(`..${path.sep}`) &&
    relation !== path.resolve(p)
  );
};

related #1009

Manifest type

micro-utility (tiny utility replaceable with native code or removal)

Rationale

inlinable

Availability

No response

Code example (optional)

Activity

  1. added
    accepted
    on Aug 27, 2026
  2. dreyfus92 commented on Aug 27, 2026

    @dreyfus92
    Member

    one suggestion for the docs: no need to duplicate the whole function here. the entry can just point at the is-path-inside one and say it's isPathInside(p, process.cwd()). keeps the two from drifting apart.

  3. gameroman commented on Aug 27, 2026

    @gameroman
    Contributor

    one suggestion for the docs: no need to duplicate the whole function here. the entry can just point at the is-path-inside one and say it's isPathInside(p, process.cwd()). keeps the two from drifting apart.

    Is that possible with the current structure?

  4. dreyfus92 commented on Aug 27, 2026

    @dreyfus92
    Member

    Is that possible with the current structure?

    yep. cwd.md, globby.md and mississippi.md already link to other module pages with relative markdown links. the manifest entry stays its own thing, the md file just gets short.

  5. gameroman commented on Aug 27, 2026

    @gameroman
    Contributor

    Makes sense if we do a documented replacement 👍

    Was just pointing out that if we did it as "micro-utility" then we couldn't do that

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    accepted

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions