Skip to content
This repository was archived by the owner on Apr 11, 2024. It is now read-only.

Commit c4602c0

Browse files
bilby91jdalton
authored andcommitted
Fix unkown nodejs version (#123)
When running in react-native, the version property is no available, this fix will make the library not crash in those scenarios.
1 parent e645a59 commit c4602c0

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

platform.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -772,7 +772,8 @@
772772
name = 'Node.js';
773773
arch = data.arch;
774774
os = data.platform;
775-
version = /[\d.]+/.exec(data.version)[0];
775+
version = /[\d.]+/.exec(data.version)
776+
version = version ? version[0] : 'unknown';
776777
}
777778
}
778779
else if (rhino) {

0 commit comments

Comments
 (0)