directory-tree 3.5.0 → 3.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -28,4 +28,5 @@ jobs:
28
28
  cache: 'npm'
29
29
  - run: npm ci
30
30
  - run: npm run build --if-present
31
- - run: npm test
31
+ - run: npm test
32
+ - run: npm run test-ts
package/README.md CHANGED
@@ -1,9 +1,9 @@
1
- [![Build Status](https://api.travis-ci.com/mihneadb/node-directory-tree.svg?branch=master)](https://api.travis-ci.com/mihneadb/node-directory-tree.svg?branch=master)
2
-
3
1
  # directory-tree
4
2
 
5
3
  Creates a JavaScript object representing a directory tree.
6
4
 
5
+ This library gets [~100k downloads per week](http://npm-stats.org/#/directory-tree). If you find it useful, feel free to <a href="https://www.buymeacoffee.com/pXhXnSXSbN"><img src="https://img.buymeacoffee.com/button-api/?text=Buy me a coffee.&emoji=&slug=pXhXnSXSbN&button_colour=FFDD00&font_colour=000000&font_family=Cookie&outline_colour=000000&coffee_colour=ffffff" /></a>
6
+
7
7
  ## Install
8
8
 
9
9
  ```bash
package/dark.svg ADDED
@@ -0,0 +1,118 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!-- Generator: Adobe Illustrator 22.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3
+ <svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
4
+ viewBox="0 0 1050 200" style="enable-background:new 0 0 1050 200;" xml:space="preserve">
5
+ <style type="text/css">
6
+ .st0{fill:#121212;}
7
+ .st1{fill:#FFFFFF;}
8
+ .st2{filter:url(#Adobe_OpacityMaskFilter);}
9
+ .st3{opacity:0.678;mask:url(#e_1_);fill:#FFFFFF;enable-background:new ;}
10
+ .st4{filter:url(#Adobe_OpacityMaskFilter_1_);}
11
+ .st5{opacity:0.696;mask:url(#g_1_);fill:#FFFFFF;enable-background:new ;}
12
+ .st6{filter:url(#Adobe_OpacityMaskFilter_2_);}
13
+ .st7{mask:url(#i_1_);fill:#FFFFFF;}
14
+ </style>
15
+ <g id="button">
16
+ <path id="dark" class="st0" d="M1018,200H32c-17.7,0-32-14.3-32-32L0,32C0,14.3,14.3,0,32,0l986,0c17.7,0,32,14.3,32,32v136
17
+ C1050,185.7,1035.7,200,1018,200z"/>
18
+ </g>
19
+ <g id="donate">
20
+ <g>
21
+ <path class="st1" d="M73.3,110.6c0-13.1,6.8-21.4,17.2-21.4c5.9,0,10.6,3.1,12.8,7.7h0.2V79.3c0-3.3,2-5.1,4.8-5.1
22
+ s4.9,1.8,4.9,5.1v47.9c0,3.1-2,4.9-4.8,4.9s-4.9-1.7-4.9-4.9V124h-0.2c-2,4.8-6.4,8-12.9,8C80,132,73.3,123.8,73.3,110.6z
23
+ M103.5,110.6c0-8.1-4-13.4-10.2-13.4c-6.3,0-10.2,5.2-10.2,13.4c0,8.2,3.9,13.4,10.2,13.4C99.5,124,103.5,118.8,103.5,110.6z"/>
24
+ <path class="st1" d="M205.5,131.7c-3.3,0-5.2-2-5.2-5.7v-19.7c0-5.4-2.7-8.5-7.5-8.5c-5.4,0-8.7,3.9-8.7,10.4v17.8
25
+ c0,3.6-1.9,5.7-5.2,5.7s-5.2-2-5.2-5.7V95c0-3.4,2-5.5,5.1-5.5c3.1,0,4.9,1.8,5,5.2v2.5h0.5c1.6-4.9,6.3-8,12.3-8
26
+ c8.8,0,13.8,5.2,13.8,14.3v22.5C210.6,129.7,208.8,131.7,205.5,131.7z"/>
27
+ <path class="st1" d="M232,131.9c-8.1,0-13.6-5.1-13.6-12.6c0-7.7,5.7-12.4,15.1-12.4h9.8v-3.4c0-4.2-2.6-6.4-7.3-6.4
28
+ c-3.1,0-5.4,1.2-7.7,3.2c-1.2,0.9-2.3,1.4-3.9,1.4c-2.3,0-3.7-1.5-3.7-3.6c0-2.4,1.7-4.9,5.3-6.7c2.6-1.4,6.1-2.1,10.6-2.1
29
+ c10.9,0,17,5.2,17,14.3v22.7c0,3.5-1.8,5.5-5,5.5c-2.7,0-4.5-1.5-4.8-4.2v-1.4h-0.5C241.1,129.8,237,131.9,232,131.9z
30
+ M235.4,124.5c4.5,0,7.9-3,7.9-7v-4.3h-8c-4.2,0-6.7,2-6.7,5.4C228.6,122.1,231.4,124.5,235.4,124.5z"/>
31
+ <path class="st1" d="M266.3,98.3h-2.1c-2.8,0-4.4-1.5-4.4-4s1.6-4,4.4-4h2.3v-5.4c0-3.6,1.8-5.5,5-5.5c3.2,0,5,2,5,5.5v5.4h4.1
32
+ c2.8,0,4.4,1.5,4.4,4s-1.6,4-4.4,4h-4v20.9c0,3.8,1,5,4.1,5c1.1,0,1.8-0.2,2.7-0.2c1.8,0,3,1.2,3,3.1c0,1.5-0.7,2.8-2.1,3.7
33
+ c-1.4,0.9-3.6,1.4-6.4,1.4c-8.2,0-11.7-3.4-11.7-11.9V98.3z"/>
34
+ <path class="st1" d="M291.3,108c0-11.3,7.5-19,18.6-19c10.5,0,18,7.5,18,17.7c0,4.6-1.3,6.2-5.2,6.2h-21v1.8
35
+ c0,5.8,3.7,9.5,9.8,9.5c3.2,0,5.5-0.8,7.3-2.3c2-1.5,2.7-2.1,4.3-2.1c2.1,0,3.6,1.5,3.6,3.8c0,1.8-1.1,3.6-3.1,5
36
+ c-2.7,2.3-7.5,3.7-12.8,3.7c-12.1,0-19.6-7.1-19.6-18.9V108z M318.1,106.4L318.1,106.4c0-5.7-3.1-9.4-8-9.4
37
+ c-5.1,0-8.3,3.8-8.3,9.3v0.1H318.1z"/>
38
+ <path class="st1" d="M359.5,97.1c-0.3-1.2-0.4-1.9-0.4-2.5c0-2.9,2.1-5,5.2-5c2.7,0,4.5,1.8,5,5.1l5.2,25.9h0.5l6.2-24.5
39
+ c1.2-4.8,2.9-6.6,6.3-6.6c3.4,0,5.2,1.8,6.4,6.6l6.3,24.5h0.5l5.4-25.9c0.6-3.2,2.4-5.1,5-5.1c3.1,0,5,2,5,4.7
40
+ c0,0.6-0.2,1.5-0.5,2.7l-7.2,26.5c-1.7,6.2-3.7,8.2-7.3,8.2c-3.9,0-5.9-2-7.5-8.2l-6-21.8h-0.4l-5.8,21.8
41
+ c-1.6,6.3-3.4,8.2-7.3,8.2c-3.8,0-5.9-2.1-7.5-8.2L359.5,97.1z"/>
42
+ <path class="st1" d="M426.9,74c3.4,0,5.9,2.3,5.9,5.4s-2.5,5.4-5.9,5.4c-3.3,0-5.8-2.3-5.8-5.4S423.6,74,426.9,74z M426.9,131.7
43
+ c-3.2,0-5.1-2-5.1-5.7V95.2c0-3.8,2-5.7,5.2-5.7c3.2,0,5.1,2,5.1,5.7v30.9C432.1,129.8,430.1,131.7,426.9,131.7z"/>
44
+ <path class="st1" d="M444,98.3h-2.1c-2.8,0-4.4-1.5-4.4-4s1.6-4,4.4-4h2.3v-5.4c0-3.6,1.8-5.5,5-5.5c3.2,0,5,2,5,5.5v5.4h4.1
45
+ c2.8,0,4.4,1.5,4.4,4s-1.6,4-4.4,4h-4v20.9c0,3.8,1,5,4.1,5c1.1,0,1.8-0.2,2.7-0.2c1.8,0,3,1.2,3,3.1c0,1.5-0.7,2.8-2.1,3.7
46
+ c-1.4,0.9-3.6,1.4-6.4,1.4c-8.2,0-11.7-3.4-11.7-11.9V98.3z"/>
47
+ <path class="st1" d="M501.1,131.7c-3.3,0-5.2-2-5.2-5.7v-19.6c0-5.4-2.8-8.5-7.6-8.5c-5.3,0-8.8,4-8.8,10.4v17.8
48
+ c0,3.6-1.9,5.7-5.2,5.7s-5.1-2-5.1-5.7V80.6c0-3.6,1.8-5.7,5.2-5.7c3.3,0,5.1,2.1,5.1,5.7v16.6h0.5c1.4-4.7,6.5-8,12.4-8
49
+ c8.6,0,13.8,5.4,13.8,14.4v22.4C506.3,129.7,504.4,131.7,501.1,131.7z"/>
50
+ </g>
51
+ <path id="heart_2_" class="st1" d="M154.3,89.2c-4.3,0-8.5,2.1-10.8,6.7c-2.3-4.6-6.5-6.7-10.8-6.7c-6.7,0-12.7,4.7-12.7,13.1
52
+ c0,14.2,19.4,21.4,23.5,29.9c4.1-8.5,23.5-15.7,23.5-29.9C167,93.3,160.3,89.2,154.3,89.2z M150.2,99.2c3,0,5.7,2,5.7,6
53
+ c0,6.3-8.3,10.6-12.8,15.2c-4.4-4.6-12.8-8.9-12.8-15.2c0-3.9,2.6-6,5.7-6c4.1,0,6.2,4.6,7,6.8C144,103.8,146.2,99.2,150.2,99.2z"
54
+ />
55
+ </g>
56
+ <g id="PayPal">
57
+ <path class="st1" d="M888.7,89.7c-1.2,8-7.3,8-13.2,8h-3.4l2.4-14.9c0.1-0.9,0.9-1.6,1.8-1.6h1.5c4,0,7.8,0,9.7,2.3
58
+ C888.8,84.9,889.1,86.9,888.7,89.7 M886.1,68.9h-22.2c-1.5,0-2.8,1.1-3,2.6l-9,56.9c-0.2,1,0.5,2,1.5,2.1c0.1,0,0.2,0,0.3,0h11.4
59
+ c1.1,0,2-0.8,2.1-1.8l2.5-16.1c0.2-1.5,1.5-2.6,3.1-2.6h7c14.6,0,23.1-7.1,25.3-21.1c1-6.1,0-11-2.8-14.3
60
+ C899.2,70.9,893.6,68.9,886.1,68.9 M730.2,89.7c-1.2,8-7.3,8-13.2,8h-3.4l2.4-14.9c0.1-0.9,0.9-1.6,1.8-1.6h1.5c4,0,7.8,0,9.7,2.3
61
+ C730.3,84.9,730.7,86.9,730.2,89.7 M727.7,68.9h-22.2c-1.5,0-2.8,1.1-3.1,2.6l-9,56.9c-0.2,1,0.5,2,1.5,2.1c0.1,0,0.2,0,0.3,0h10.6
62
+ c1.5,0,2.8-1.1,3-2.6l2.4-15.4c0.2-1.5,1.5-2.6,3-2.6h7c14.6,0,23.1-7.1,25.3-21.1c1-6.1,0-11-2.8-14.3
63
+ C740.7,70.9,735.1,68.9,727.7,68.9 M779.3,110.2c-1,6.1-5.9,10.2-12,10.2c-3.1,0-5.6-1-7.1-2.9c-1.6-1.9-2.2-4.5-1.7-7.5
64
+ c1-6,5.9-10.2,11.9-10.2c3,0,5.5,1,7.1,2.9C779.1,104.5,779.7,107.2,779.3,110.2 M794.1,89.5h-10.6c-0.9,0-1.7,0.7-1.8,1.6l-0.5,3
65
+ l-0.7-1.1c-2.3-3.3-7.4-4.5-12.6-4.5c-11.8,0-21.8,8.9-23.7,21.4c-1,6.2,0.4,12.2,4,16.3c3.2,3.8,7.9,5.4,13.4,5.4
66
+ c9.5,0,14.7-6.1,14.7-6.1l-0.5,3c-0.2,1,0.5,2,1.5,2.1c0.1,0,0.2,0,0.3,0h9.6c1.5,0,2.8-1.1,3-2.6l5.8-36.4c0.2-1-0.5-2-1.5-2.1
67
+ C794.3,89.5,794.2,89.5,794.1,89.5 M937.7,110.2c-1,6.1-5.9,10.2-12,10.2c-3.1,0-5.6-1-7.1-2.9c-1.6-1.9-2.2-4.5-1.7-7.5
68
+ c1-6,5.9-10.2,11.9-10.2c3,0,5.5,1,7.1,2.9C937.5,104.5,938.2,107.2,937.7,110.2 M952.5,89.5h-10.6c-0.9,0-1.7,0.7-1.8,1.6l-0.5,3
69
+ l-0.7-1.1c-2.3-3.3-7.4-4.5-12.6-4.5c-11.8,0-21.8,8.9-23.7,21.4c-1,6.2,0.4,12.2,4,16.3c3.2,3.8,7.9,5.4,13.4,5.4
70
+ c9.5,0,14.7-6.1,14.7-6.1l-0.5,3c-0.2,1,0.5,2,1.5,2.1c0.1,0,0.2,0,0.3,0h9.6c1.5,0,2.8-1.1,3-2.6l5.8-36.4c0.2-1-0.5-2-1.5-2.1
71
+ C952.7,89.5,952.6,89.5,952.5,89.5 M850.7,89.5H840c-1,0-2,0.5-2.6,1.4l-14.7,21.7l-6.3-20.9c-0.4-1.3-1.6-2.2-3-2.2H803
72
+ c-1,0-1.9,0.8-1.9,1.9c0,0.2,0,0.4,0.1,0.6l11.8,34.5L802,142.1c-0.9,1.2,0,2.9,1.5,2.9h10.7c1,0,2-0.5,2.5-1.3l35.6-51.3
73
+ C853.1,91.1,852.2,89.5,850.7,89.5 M965.1,70.5l-9.1,58c-0.2,1,0.5,2,1.5,2.1c0.1,0,0.2,0,0.3,0h9.2c1.5,0,2.8-1.1,3-2.6l9-56.9
74
+ c0.2-1-0.5-2-1.5-2.1c-0.1,0-0.2,0-0.3,0h-10.3C966,68.9,965.2,69.6,965.1,70.5"/>
75
+ <g>
76
+ <defs>
77
+ <filter id="Adobe_OpacityMaskFilter" filterUnits="userSpaceOnUse" x="575" y="47" width="83.1" height="98">
78
+ <feColorMatrix type="matrix" values="1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0"/>
79
+ </filter>
80
+ </defs>
81
+ <mask maskUnits="userSpaceOnUse" x="575" y="47" width="83.1" height="98" id="e_1_">
82
+ <g class="st2">
83
+ <path id="d_1_" class="st1" d="M575,47h83.1v98H575V47z"/>
84
+ </g>
85
+ </mask>
86
+ <path class="st3" d="M649.9,71.9c1.2-7.6,0-12.8-4.1-17.5c-4.5-5.2-12.7-7.4-23.2-7.4H592c-2.1,0-4,1.6-4.3,3.7L575,131.1
87
+ c-0.2,1.4,0.7,2.8,2.2,3c0.1,0,0.3,0,0.4,0h18.8l-1.3,8.2c-0.2,1.2,0.7,2.4,1.9,2.6c0.1,0,0.2,0,0.4,0h15.9c1.9,0,3.5-1.4,3.8-3.2
88
+ l0.2-0.8l3-18.9l0.2-1c0.3-1.9,1.9-3.2,3.8-3.2h2.4c15.4,0,27.4-6.2,30.9-24.3c1.5-7.5,0.7-13.8-3.2-18.3
89
+ C653,73.9,651.6,72.8,649.9,71.9"/>
90
+ <defs>
91
+ <filter id="Adobe_OpacityMaskFilter_1_" filterUnits="userSpaceOnUse" x="575" y="47" width="75.3" height="87.1">
92
+ <feColorMatrix type="matrix" values="1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0"/>
93
+ </filter>
94
+ </defs>
95
+ <mask maskUnits="userSpaceOnUse" x="575" y="47" width="75.3" height="87.1" id="g_1_">
96
+ <g class="st4">
97
+ <path id="f_1_" class="st1" d="M575,47h75.3v87.1H575V47z"/>
98
+ </g>
99
+ </mask>
100
+ <path class="st5" d="M649.9,71.9c1.2-7.6,0-12.8-4.1-17.5c-4.5-5.2-12.7-7.4-23.2-7.4H592c-2.1,0-4,1.6-4.3,3.7L575,131.1
101
+ c-0.2,1.4,0.7,2.8,2.2,3c0.1,0,0.3,0,0.4,0h18.8l4.7-30l-0.1,0.9c0.3-2.1,2.1-3.7,4.3-3.7h8.9c17.6,0,31.3-7.1,35.3-27.8
102
+ C649.7,73.1,649.8,72.5,649.9,71.9"/>
103
+ <defs>
104
+ <filter id="Adobe_OpacityMaskFilter_2_" filterUnits="userSpaceOnUse" x="575" y="47" width="75.3" height="87.1">
105
+ <feColorMatrix type="matrix" values="1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0"/>
106
+ </filter>
107
+ </defs>
108
+ <mask maskUnits="userSpaceOnUse" x="575" y="47" width="75.3" height="87.1" id="i_1_">
109
+ <g class="st6">
110
+ <path id="h_1_" class="st1" d="M575,47h75.3v87.1H575V47z"/>
111
+ </g>
112
+ </mask>
113
+ <path class="st7" d="M606.2,72c0.3-1.9,1.9-3.2,3.8-3.2h23.9c2.8,0,5.5,0.2,7.9,0.6c0.7,0.1,1.4,0.2,2,0.4
114
+ c0.9,0.2,1.9,0.5,2.8,0.8c1.1,0.4,2.2,0.8,3.3,1.4c1.2-7.6,0-12.8-4.1-17.5c-4.5-5.2-12.7-7.4-23.2-7.4H592c-2.1,0-4,1.6-4.3,3.7
115
+ L575,131.1c-0.2,1.4,0.7,2.8,2.2,3c0.1,0,0.3,0,0.4,0h18.8l4.7-30L606.2,72L606.2,72z"/>
116
+ </g>
117
+ </g>
118
+ </svg>
package/index.d.ts CHANGED
@@ -34,7 +34,7 @@ declare namespace directoryTree {
34
34
  depth?: number;
35
35
  }
36
36
 
37
- export type DirectoryTreeCallback<TCustom extends IObj = IObj> = (
37
+ export type DirectoryTreeCallback<TCustom extends Record<string, any> = Record<string, any>> = (
38
38
  item: DirectoryTree<TCustom>,
39
39
  path: string,
40
40
  stats: Stats
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "directory-tree",
3
- "version": "3.5.0",
3
+ "version": "3.5.2",
4
4
  "description": "Convert a directory tree to a JS object.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -22,14 +22,17 @@
22
22
  "command-line-usage": "^6.1.1"
23
23
  },
24
24
  "devDependencies": {
25
+ "@types/node": "^18.11.17",
25
26
  "chai": "^2.3.0",
26
- "mocha": "^8.3.2"
27
+ "mocha": "^10.2.0",
28
+ "typescript": "^4.9.4"
27
29
  },
28
30
  "bin": "bin/index.js",
29
31
  "engines": {
30
32
  "node": ">=10.0"
31
33
  },
32
34
  "scripts": {
33
- "test": "mocha"
35
+ "test": "mocha",
36
+ "test-ts": "./node_modules/.bin/tsc index.d.ts"
34
37
  }
35
38
  }
package/.travis.yml DELETED
@@ -1,3 +0,0 @@
1
- language: node_js
2
- node_js:
3
- - "10.0"