Skip to content

Commit 62888b8

Browse files
committed
Harden argument input validation
1 parent f1ddf15 commit 62888b8

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

index.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,9 @@ export class TopBun {
7676
* @param {CurrentOpts} [opts] - The options for the site build
7777
*/
7878
constructor (src, dest, opts = /** @type {CurrentOpts} */ ({})) {
79-
assert(src, 'src is a required argument')
80-
assert(dest, 'dest is a required argument')
79+
if (!src || typeof src !== 'string') throw new TypeError('src should be a (non-empty) string')
80+
if (!dest || typeof dest !== 'string') throw new TypeError('dest should be a (non-empty) string')
81+
if (!opts || typeof opts !== 'object') throw new TypeError('opts should be an object')
8182

8283
this.#src = src
8384
this.#dest = dest

0 commit comments

Comments
 (0)