Skip to content

Commit dc6379b

Browse files
cjihrigdanielleadams
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 <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 f85d347 commit dc6379b

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

lib/internal/fs/utils.js

+3-5
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)