-
Notifications
You must be signed in to change notification settings - Fork 16
/
find-up.node.txt
59 lines (46 loc) · 4.02 KB
/
find-up.node.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
FIND-UP
/=+===============================+=\
/ : : \
)==: FIND-UP :==(
\ :_______________________________: /
\=+===============================+=/
ALTERNATIVE ==> # - find-up (preferred):
# - can return multiple matching, instead of first matching
# - custom cwd
# - stop|limit recursion
# - look only for either directory or regular file
# - [no-]follow symlinks
# - escalade (preferred if need small):
# - 3x faster
# - 3x smaller
# - can execute logic on each parent directory
VERSION ==> #6.3.0
findUpMultiple[Sync](FILE[, OPTS])#Looks for FILE in current directory, then up recursively.
->[PROMISE_]'PATH'_ARR #Returns all matching 'PATH' (empty ARR if none)
#FILE can be:
# - 'PATH'[_ARR]
# - FUNC('DIR')->VAL where VAL can be:
# - [PROMISE_]'PATH'
# - undefined: no match
# - findUpStop:
# - stop iteration
# - fired on each 'DIR'
#OPTS:
# - cwd 'PATH'|URL (def: process.cwd())
# - stopAt 'DIR' (def: root)
# - limit NUM (def: Infinity):
# - maximum amount of 'PATH' to return
# - only return at most one 'PATH' per directory
# - any OPTS from LOCATE-PATH (see its doc)
findUp[Sync](...)
->[PROMISE_]'PATH' #Same as findUpMultiple[Sync](...) but returning the first matching 'PATH', or undefined if none.
/=+===============================+=\
/ : : \
)==: PKG-DIR :==(
\ :_______________________________: /
\=+===============================+=/
VERSION ==> #7.0.0
packageDirectory[Sync](OPTS)
[->[PROMISE_]'DIR'] #Uses FIND-UP for package.json, i.e. returns package root directory (LPREFIX)