Skip to content

Commit 983466e

Browse files
cjihrigjuanarbol
authored andcommitted
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 <[email protected]> Reviewed-By: Daeyeon Jeong <[email protected]> Reviewed-By: Mohammed Keyvanzadeh <[email protected]> Reviewed-By: Kohei Ueno <[email protected]> Reviewed-By: Tobias Nießen <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]>
1 parent 5d48fa5 commit 983466e

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
@@ -906,17 +906,15 @@ const validatePrimitiveStringAfterArrayBufferView = hideStackFrames((buffer, nam
906906

907907
const validatePosition = hideStackFrames((position, name) => {
908908
if (typeof position === 'number') {
909-
validateInteger(position, 'position');
909+
validateInteger(position, name);
910910
} else if (typeof position === 'bigint') {
911911
if (!(position >= -(2n ** 63n) && position <= 2n ** 63n - 1n)) {
912-
throw new ERR_OUT_OF_RANGE('position',
912+
throw new ERR_OUT_OF_RANGE(name,
913913
`>= ${-(2n ** 63n)} && <= ${2n ** 63n - 1n}`,
914914
position);
915915
}
916916
} else {
917-
throw new ERR_INVALID_ARG_TYPE('position',
918-
['integer', 'bigint'],
919-
position);
917+
throw new ERR_INVALID_ARG_TYPE(name, ['integer', 'bigint'], position);
920918
}
921919
});
922920

0 commit comments

Comments
 (0)