Skip to content

Commit 14ec52b

Browse files
cjihrigjuanarbol
authored andcommittedOct 11, 2022
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 25e6f48 commit 14ec52b

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

904904
const validatePosition = hideStackFrames((position, name) => {
905905
if (typeof position === 'number') {
906-
validateInteger(position, 'position');
906+
validateInteger(position, name);
907907
} else if (typeof position === 'bigint') {
908908
if (!(position >= -(2n ** 63n) && position <= 2n ** 63n - 1n)) {
909-
throw new ERR_OUT_OF_RANGE('position',
909+
throw new ERR_OUT_OF_RANGE(name,
910910
`>= ${-(2n ** 63n)} && <= ${2n ** 63n - 1n}`,
911911
position);
912912
}
913913
} else {
914-
throw new ERR_INVALID_ARG_TYPE('position',
915-
['integer', 'bigint'],
916-
position);
914+
throw new ERR_INVALID_ARG_TYPE(name, ['integer', 'bigint'], position);
917915
}
918916
});
919917

0 commit comments

Comments
 (0)
Please sign in to comment.