1. walk-back
Walk up the directory tree until the specified path is found.
walk-back
Package: walk-back
Created by: 75lb
Last modified: Tue, 28 Jun 2022 21:33:36 GMT
Version: 5.1.0
License: MIT
Downloads: 1,859,668
Repository: https://github.com/75lb/walk-back

Install

npm install walk-back
yarn add walk-back

view on npm
npm module downloads
Gihub repo dependents
Gihub package dependents
Build Status
js-standard-style

walk-back

walk-back

Walk up the directory tree until the specified path is found.

Example

 const walkBack = require('walk-back')

walkBack(startAt, lookingFor) ⇒ string

Returns an absolute file path (if found) else null.

Kind: Exported function

Param Type Description
startAt string the directory to start in
lookingFor string the path we're looking for

Example

 > walkBack('/Users/lloyd/Documents/75lb/walk-back', 'package.json')
'/Users/lloyd/Documents/75lb/walk-back/package.json'

> walkBack('/Users/lloyd/Documents/75lb/walk-back', '75lb')
'/Users/lloyd/Documents/75lb'

> walkBack('/Users/lloyd/Documents/75lb/walk-back', '.bash_profile')
'/Users/lloyd/.bash_profile'

> walkBack('.', '.bash_profile')
'/Users/lloyd/.bash_profile'

> walkBack('/Users/lloyd/Documents/75lb/walk-back', 'non-existent.file')
null

© 2015-21 Lloyd Brookes <[email protected]>.

Tested by test-runner. Documented by jsdoc-to-markdown.

RELATED POST

Enhancing Vue.js Development: Harnessing the Potential of Vue-Loader

Enhancing Vue.js Development: Harnessing the Potential of Vue-Loader

Simplify Data Validation in Vue.js: A Step-by-Step Guide to Using Regex

Simplify Data Validation in Vue.js: A Step-by-Step Guide to Using Regex

Troubleshooting Made Easy: Common Issues and Solutions with vue-loader Without vue-cli

Troubleshooting Made Easy: Common Issues and Solutions with vue-loader Without vue-cli

Optimizing Webpack 4 with Vue CLI 3: Disabling the Cache-Loader

Optimizing Webpack 4 with Vue CLI 3: Disabling the Cache-Loader

Step-by-Step Guide: How to Add a Function to Your Vuex Plugin

Step-by-Step Guide: How to Add a Function to Your Vuex Plugin