Skip to content

Commit

Permalink
fs: keep return type of options.filter in cpsync consistent with doc
Browse files Browse the repository at this point in the history
  • Loading branch information
kylo5aby committed Apr 11, 2024
1 parent 52f8dcf commit dd46bce
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions lib/internal/fs/cp/cp-sync.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ const {
parse,
resolve,
} = require('path');
const { isPromise } = require('util/types');

function cpSyncFn(src, dest, opts) {
// Warn about using preserveTimestamps on 32-bit node
Expand All @@ -64,7 +63,7 @@ function cpSyncFn(src, dest, opts) {
function checkPathsSync(src, dest, opts) {
if (opts.filter) {
const shouldCopy = opts.filter(src, dest);
if (isPromise(shouldCopy)) {
if (typeof shouldCopy !== 'boolean') {
throw new ERR_INVALID_RETURN_VALUE('boolean', 'filter', shouldCopy);
}
if (!shouldCopy) return { __proto__: null, skipped: true };
Expand Down

0 comments on commit dd46bce

Please sign in to comment.