npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@yukiakai/find-up

v1.1.7

Published

A flexible find-up implementation supporting string, RegExp, CJS/ESM dual build, and custom matcher.

Readme

@yukiakai/find-up

NPM Version NPM Downloads

Build Status codecov

Find the first file matching a given pattern in the current directory or the nearest ancestor directory, with support for both CommonJS and ESM, and extended matching capabilities including RegExp, symlink control, and custom matchers callback.

Useful for finding files or folders (like package.json, .git, or config files) by walking upward from a starting directory.


Installation

npm install @yukiakai/find-up

Works with both require() and import thanks to dual CJS/ESM build.


Usage

Basic usage

import { findUp } from '@yukiakai/find-up'

// Find 'package.json' starting from current directory and walking upward
const path = findUp('package.json')
console.log(path)

Match multiple names

findUp(['pnpm-lock.yaml', 'yarn.lock', 'package-lock.json'])

Match using RegExp

findUp(/^config\..*\.json$/)

Match folders instead of files

// Return full path including matched folder name
findUp(['node_modules', 'dist'], {
  type: 'folder',
  includeMatchedPath: true
})
// → /root/project/node_modules

Custom matcher callback

import fs from 'node:fs'

findUp('config.json', {
  matcher: (path) => {
    const content = fs.readFileSync(path, 'utf8')
	// Return true to accept (stop searching), false to continue searching.
    return true
  }
})

API

See docs: API Docs

findUp(
  name: string | RegExp | (string | RegExp)[],
  options?: FindUpOptions
): string | undefined

Options

| Name | Type | Default | Description | |----------------------|-----------------------------------|---------------------|-------------------------------------------------------------| | basedir | string | process.cwd() | Directory to start searching from | | matcher | (path: string) => () | – | Called when a matching file is found. Return false to skip. | | type | file \| folder | file | Whether to match files or directories | | includeMatchedPath | boolean | false | If true, returns full path including the matched name | | allowSymlinks | boolean | true | Whether to allow matching symlinks | | stopAt | string \| string[] | - | Stop searching when encountering these folders |


Features

  • ✅ Supports both CommonJS and ESM
  • ✅ Supports string, string[], RegExp, RegExp[]
  • ✅ Supports stop at
  • ✅ File or folder matching
  • ✅ Optional symlink filtering
  • Custom matcher callback — inspect file content, metadata, or path before accepting match
  • ✅ TypeScript types included
  • ✅ Optional: return full matched path (includeMatchedPath)

Example: Find .git folder

const gitFolder = findUp('.git', { type: 'folder' })
if (gitFolder) {
  console.log('Found .git at:', gitFolder)
}

Comparison

| Feature | @yukiakai/find-up | find-up | findup-sync | |------------------------------------|-------------------|---------------|---------------| | Supports CJS & ESM | ✅ | ❌ (ESM only) | ❌ (CJS only) | | Supports RegExp | ✅ | ❌ | ✅ | | Supports array of names/patterns | ✅ | ✅ | ✅ | | File/folder type filtering | ✅ | ✅ | ❌ | | Matcher can read file content | ✅ | ❌ | ❌ | | Supports Symlinks | ✅ | ✅ | ❌ | | Zero dependency | ✅ | ❌ | ❌ |


Changelog

See full release notes in CHANGELOG.md


License

MIT © yukiakai