@sapphire/node-utilities 1.1.0-next.f555c82.0 β†’ 1.1.0-pr-434.d192d9e.0

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.
package/CHANGELOG.md CHANGED
@@ -0,0 +1,10 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ # [@sapphire/node-utilities@1.0.0](https://github.com/sapphiredev/utilities/tree/@sapphire/node-utilities@1.0.0) - (2022-10-02)
6
+
7
+ ## πŸš€ Features
8
+
9
+ - Add `@sapphire/node-utilities` (#468) ([1606208](https://github.com/sapphiredev/utilities/commit/1606208ce2e1ca8a6b307d14ce7f119e6c914a97))
10
+
package/README.md CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  # @sapphire/node-utilities
6
6
 
7
- **Common JavaScript utilities for the Sapphire Community.**
7
+ **Common NodeJS utilities for the Sapphire Community.**
8
8
 
9
9
  [![GitHub](https://img.shields.io/github/license/sapphiredev/utilities)](https://github.com/sapphiredev/utilities/blob/main/LICENSE.md)
10
10
  [![codecov](https://codecov.io/gh/sapphiredev/utilities/branch/main/graph/badge.svg?token=OEGIV6RFDO)](https://codecov.io/gh/sapphiredev/utilities)
@@ -13,6 +13,15 @@
13
13
 
14
14
  </div>
15
15
 
16
+ **Table of Contents**
17
+
18
+ - [Features](#features)
19
+ - [Installation](#installation)
20
+ - [Usage](#usage)
21
+ - [`findFilesRecursively`](#findfilesrecursively)
22
+ - [Buy us some doughnuts](#buy-us-some-doughnuts)
23
+ - [Contributors ✨](#contributors-)
24
+
16
25
  ## Features
17
26
 
18
27
  - Written in TypeScript
@@ -27,6 +36,32 @@ You can use the following command to install this package, or replace `npm insta
27
36
  npm install @sapphire/node-utilities
28
37
  ```
29
38
 
39
+ ## Usage
40
+
41
+ ### `findFilesRecursively`
42
+
43
+ Recursively searches for files in a directory and returns an [`AsyncIterableIterator`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#the_async_iterator_and_async_iterable_protocols) of the found paths.
44
+
45
+ ```ts
46
+ import { findFilesRecursively } from '@sapphire/node-utilities';
47
+
48
+ const files = findFilesRecursively('./src');
49
+ for await (const file of files) {
50
+ console.log(file);
51
+ }
52
+
53
+ // This, for example, could log:
54
+ // /root/src/index.js
55
+ // /root/src/database.csv
56
+ // /root/src/lib/utils/constants.json
57
+
58
+ // Alternate forms:
59
+ const files = findFilesRecursivelyStringStartsWith('./src', 'index'); // filename starts with "index"
60
+ const files = findFilesRecursivelyStringEndsWith('./src', '.js'); // filename ends with ".js"
61
+ const files = findFilesRecursivelyStringIncludes('./src', 'database'); // filename includes "database"
62
+ const files = findFilesRecursivelyRegex('./src', /\.[tj]sx?$/); // filename matches the regex
63
+ ```
64
+
30
65
  ---
31
66
 
32
67
  ## Buy us some doughnuts
@@ -100,6 +135,14 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
100
135
  <td align="center"><a href="https://github.com/EvolutionX-10"><img src="https://avatars.githubusercontent.com/u/85353424?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Evo</b></sub></a><br /><a href="https://github.com/sapphiredev/utilities/commits?author=EvolutionX-10" title="Code">πŸ’»</a></td>
101
136
  <td align="center"><a href="https://enes.ovh/"><img src="https://avatars.githubusercontent.com/u/61084101?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Enes GenΓ§</b></sub></a><br /><a href="https://github.com/sapphiredev/utilities/commits?author=enxg" title="Code">πŸ’»</a></td>
102
137
  <td align="center"><a href="https://github.com/muchnameless"><img src="https://avatars.githubusercontent.com/u/12682826?v=4?s=100" width="100px;" alt=""/><br /><sub><b>muchnameless</b></sub></a><br /><a href="https://github.com/sapphiredev/utilities/commits?author=muchnameless" title="Code">πŸ’»</a></td>
138
+ <td align="center"><a href="https://github.com/r-priyam"><img src="https://avatars.githubusercontent.com/u/50884372?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Priyam</b></sub></a><br /><a href="https://github.com/sapphiredev/utilities/commits?author=r-priyam" title="Code">πŸ’»</a></td>
139
+ <td align="center"><a href="https://github.com/legendhimslef"><img src="https://avatars.githubusercontent.com/u/69213593?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Voxelli</b></sub></a><br /><a href="https://github.com/sapphiredev/utilities/commits?author=legendhimslef" title="Code">πŸ’»</a></td>
140
+ <td align="center"><a href="https://github.com/CitTheDev"><img src="https://avatars.githubusercontent.com/u/94020875?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Cit The Dev</b></sub></a><br /><a href="https://github.com/sapphiredev/utilities/commits?author=CitTheDev" title="Code">πŸ’»</a></td>
141
+ </tr>
142
+ <tr>
143
+ <td align="center"><a href="https://www.goestav.com/"><img src="https://avatars.githubusercontent.com/u/27970303?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Goestav</b></sub></a><br /><a href="https://github.com/sapphiredev/utilities/commits?author=goestav" title="Code">πŸ’»</a></td>
144
+ <td align="center"><a href="https://github.com/didinele"><img src="https://avatars.githubusercontent.com/u/27137376?v=4?s=100" width="100px;" alt=""/><br /><sub><b>DD</b></sub></a><br /><a href="https://github.com/sapphiredev/utilities/commits?author=didinele" title="Code">πŸ’»</a></td>
145
+ <td align="center"><a href="https://steamcommunity.com/id/06000208"><img src="https://avatars.githubusercontent.com/u/52764066?v=4?s=100" width="100px;" alt=""/><br /><sub><b>amber</b></sub></a><br /><a href="https://github.com/sapphiredev/utilities/commits?author=06000208" title="Code">πŸ’»</a></td>
103
146
  </tr>
104
147
  </table>
105
148
 
package/dist/index.js CHANGED
@@ -1,7 +1,5 @@
1
1
  'use strict';
2
2
 
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
3
  var promises = require('fs/promises');
6
4
  var path = require('path');
7
5
 
@@ -40,4 +38,5 @@ exports.findFilesRecursivelyRegex = findFilesRecursivelyRegex;
40
38
  exports.findFilesRecursivelyStringEndsWith = findFilesRecursivelyStringEndsWith;
41
39
  exports.findFilesRecursivelyStringIncludes = findFilesRecursivelyStringIncludes;
42
40
  exports.findFilesRecursivelyStringStartsWith = findFilesRecursivelyStringStartsWith;
41
+ //# sourceMappingURL=out.js.map
43
42
  //# sourceMappingURL=index.js.map
package/dist/index.mjs CHANGED
@@ -32,4 +32,5 @@ function findFilesRecursivelyRegex(path, regex) {
32
32
  __name(findFilesRecursivelyRegex, "findFilesRecursivelyRegex");
33
33
 
34
34
  export { findFilesRecursively, findFilesRecursivelyRegex, findFilesRecursivelyStringEndsWith, findFilesRecursivelyStringIncludes, findFilesRecursivelyStringStartsWith };
35
+ //# sourceMappingURL=out.js.map
35
36
  //# sourceMappingURL=index.mjs.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sapphire/node-utilities",
3
- "version": "1.1.0-next.f555c82.0",
3
+ "version": "1.1.0-pr-434.d192d9e.0",
4
4
  "description": "Node specific JavaScript utilities for the Sapphire Community",
5
5
  "author": "@sapphire",
6
6
  "license": "MIT",
@@ -55,12 +55,12 @@
55
55
  "access": "public"
56
56
  },
57
57
  "devDependencies": {
58
- "@favware/cliff-jumper": "^1.8.8",
59
- "@vitest/coverage-c8": "^0.23.4",
60
- "tsup": "^6.2.3",
61
- "typedoc": "^0.23.15",
62
- "typedoc-json-parser": "^5.0.1",
63
- "typescript": "^4.8.4",
64
- "vitest": "^0.23.4"
58
+ "@favware/cliff-jumper": "^1.9.0",
59
+ "@vitest/coverage-c8": "^0.26.2",
60
+ "tsup": "^6.5.0",
61
+ "typedoc": "^0.23.23",
62
+ "typedoc-json-parser": "^7.0.2",
63
+ "typescript": "^4.9.4",
64
+ "vitest": "^0.26.2"
65
65
  }
66
66
  }