Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit dc6379b

Browse filesBrowse 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
Copy full SHA for dc6379b

File tree

Expand file treeCollapse file tree

1 file changed

+3
-5
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+3
-5
lines changed
Open diff view settings
Collapse file

‎lib/internal/fs/utils.js‎

Copy file name to clipboardExpand all lines: lib/internal/fs/utils.js
+3-5Lines 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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.