dirDoesntExist
Description
The resolution of the promise will happen if the directory doesn't exist. The dirPath is resolved if directory is inexistent, whereas it will throw if the dirPath passed as parameter is an existing directory.
Parameter List | Returns | Rejection Errors |
---|---|---|
| Promise<string || Array> | |
Related Functions | Function Signature | |
function dirDoesntExist(dirPath[, tuple]): Promise<string || Array> |
Examples
1
2
3
4
import {dirDoesntExist} from 'puddy-m/lib/fileFunctions'
dirDoesntExist('path/to/supposed/dir')
.then(supposedDirPath=>console.log(supposedDirPath)) // prints 'path/to/supposed/dir'
1
2
3
4
import {dirDoesntExist} from 'puddy-m/lib/fileFunctions'
dirDoesntExist(true)
.catch(e=>e)
1
2
3
4
5
6
// Using it with tuple parameter
import {dirDoesntExist} from 'puddy-m/lib/fileFunctions'
dirDoesntExist('path/to/supposed/dir', [])
.then(tuple=>validateString("World", tuple))
.then(([first, second])=> first + second) // 'path/to/supposed/dirWorld'