Skip to content

Commit 1b97188

Browse files
committed
fs: don't hard code name in validatePosition()
The name of the position being validated by validatePosition() was not being used. Instead, the string 'position' was being used everywhere. It worked out because the only call sites were using the name 'position' as well. PR-URL: #44767 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Daeyeon Jeong <daeyeon.dev@gmail.com> Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com> Reviewed-By: Kohei Ueno <kohei.ueno119@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
1 parent df92b3c commit 1b97188

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

lib/internal/fs/utils.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -884,17 +884,15 @@ const validateStringAfterArrayBufferView = hideStackFrames((buffer, name) => {
884884

885885
const validatePosition = hideStackFrames((position, name) => {
886886
if (typeof position === 'number') {
887-
validateInteger(position, 'position');
887+
validateInteger(position, name);
888888
} else if (typeof position === 'bigint') {
889889
if (!(position >= -(2n ** 63n) && position <= 2n ** 63n - 1n)) {
890-
throw new ERR_OUT_OF_RANGE('position',
890+
throw new ERR_OUT_OF_RANGE(name,
891891
`>= ${-(2n ** 63n)} && <= ${2n ** 63n - 1n}`,
892892
position);
893893
}
894894
} else {
895-
throw new ERR_INVALID_ARG_TYPE('position',
896-
['integer', 'bigint'],
897-
position);
895+
throw new ERR_INVALID_ARG_TYPE(name, ['integer', 'bigint'], position);
898896
}
899897
});
900898

0 commit comments

Comments
 (0)