[](https://www.npmjs.org/package/walk-back)
[](https://www.npmjs.org/package/walk-back)
[](https://github.com/75lb/walk-back/network/dependents?dependent_type=REPOSITORY)
[](https://github.com/75lb/walk-back/network/dependents?dependent_type=PACKAGE)
[](https://travis-ci.org/75lb/walk-back)
[](https://github.com/feross/standard)
# walk-back
## walk-back
Walk up the directory tree until the specified path is found.
**Example**
```js
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**
```js
> 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 \<75pound@gmail.com\>.
Tested by [test-runner](https://github.com/test-runner-js/test-runner). Documented by [jsdoc-to-markdown](https://github.com/jsdoc2md/jsdoc-to-markdown).