Skip to content

Commit c9bd0c5

Browse files
Uzlopaktargos
authored andcommitted
lib: use primordials for navigator.userAgent
PR-URL: #50467 Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com> Reviewed-By: Vinícius Lourenço Claro Cardoso <contact@viniciusl.com.br> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Ethan Arrowood <ethan@arrowood.dev>
1 parent f70a2dd commit c9bd0c5

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/internal/navigator.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
const {
44
ObjectDefineProperties,
5+
StringPrototypeIndexOf,
6+
StringPrototypeSlice,
57
Symbol,
68
} = primordials;
79

@@ -23,7 +25,7 @@ const nodeVersion = process.version;
2325
class Navigator {
2426
// Private properties are used to avoid brand validations.
2527
#availableParallelism;
26-
#userAgent = `Node.js/${nodeVersion.slice(1, nodeVersion.indexOf('.'))}`;
28+
#userAgent = `Node.js/${StringPrototypeSlice(nodeVersion, 1, StringPrototypeIndexOf(nodeVersion, '.'))}`;
2729

2830
constructor() {
2931
if (arguments[0] === kInitialize) {

0 commit comments

Comments
 (0)