https://github.com/lucacicada/voidlib
Collection of useful libraries for JavaScript and TypeScript
https://github.com/lucacicada/voidlib
node support utils walk
Last synced: about 1 month ago
JSON representation
Collection of useful libraries for JavaScript and TypeScript
- Host: GitHub
- URL: https://github.com/lucacicada/voidlib
- Owner: lucacicada
- License: mit
- Created: 2025-07-16T20:03:07.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2025-07-20T09:37:50.000Z (11 months ago)
- Last Synced: 2025-07-20T09:48:58.564Z (11 months ago)
- Topics: node, support, utils, walk
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/voidlib
- Size: 57.6 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# voidlib
Collection of useful libraries for JavaScript and TypeScript.
Most notably:
## nonNullable
Useful function to filter out `null` and `undefined` values from a type.
```ts
import { nonNullable } from 'voidlib'
arr.filter(nonNullable) // arr is now of type T[]
```
## walk
Powerful utility to walk through directories and files in a given path.
```ts
import { walk } from 'voidlib/node'
for await (const file of walk('/path/to/dir', {
recursive: true,
// Only yield files, nothing else
include: entry => entry.isFile() && entry.name.endsWith('.ts'),
// Do not recurse into hidden directories
recurse: entry => !entry.name.startsWith('.'),
})) {
console.log(file) // file is a TypeScript (.ts) file
}
```
## deferPromise
Create a deferred promise that can be resolved or rejected later.
```ts
const p = deferPromise()
p.resolve('Hello, world!')
await p.promise // 'Hello, world!'
```
## task
Unwrap an inlined promise, return a promise task that can be awaited.
```ts
const t = task()
p.resolve('Hello, world!')
await p // 'Hello, world!'
```