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

Fix unkown nodejs version #123

Merged
merged 1 commit into from
Mar 1, 2017

Conversation

bilby91
Copy link
Contributor

@bilby91 bilby91 commented Mar 1, 2017

When running in react-native, the version property is no available, this
fix will make the library not crash in those scenarios.

@bilby91
Copy link
Contributor Author

bilby91 commented Mar 1, 2017

Resolves #122

@jdalton jdalton added the bug label Mar 1, 2017
platform.js Outdated
@@ -772,7 +772,8 @@
name = 'Node.js';
arch = data.arch;
os = data.platform;
version = /[\d.]+/.exec(data.version)[0];
var version = /[\d.]+/.exec(data.version)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @bilby91!

You don't have to use var as it's already defined above.

@bilby91 bilby91 force-pushed the fix-unkown-node-version branch from 0775bb9 to ea5b123 Compare March 1, 2017 18:36
@bilby91
Copy link
Contributor Author

bilby91 commented Mar 1, 2017

@jdalton You are right! Fixed!

platform.js Outdated
@@ -772,7 +772,8 @@
name = 'Node.js';
arch = data.arch;
os = data.platform;
version = /[\d.]+/.exec(data.version)[0];
version = /[\d.]+/.exec(data.version)
version = (version && version.length > 0) ? version[0] : 'unknown';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The check can be simplified. When performing an exec it will either be an array with at least 1 element or null so the check can be version ? version[0] : 'unknown'.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
When running in react-native, the version property is no available, this
fix will make the library not crash in those scenarios.
@bilby91 bilby91 force-pushed the fix-unkown-node-version branch from ea5b123 to f9f6564 Compare March 1, 2017 19:50
@jdalton jdalton merged commit c4602c0 into bestiejs:master Mar 1, 2017
@jdalton
Copy link
Member

jdalton commented Mar 1, 2017

Thank you!

@bilby91
Copy link
Contributor Author

bilby91 commented Mar 1, 2017

@jdalton Thank you for the quick interaction 👏🏻. Any plans for a new npm release ?

@jdalton
Copy link
Member

jdalton commented Mar 1, 2017

There's a couple other fixes I'd like to land but there should be a new release within the week.

@bilby91
Copy link
Contributor Author

bilby91 commented Mar 1, 2017

@jdalton Great! Will be waiting for the release then. Thanks again !

@bilby91 bilby91 deleted the fix-unkown-node-version branch March 1, 2017 22:28
@bilby91 bilby91 restored the fix-unkown-node-version branch March 1, 2017 22:28
@bilby91 bilby91 mentioned this pull request Mar 30, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Development

Successfully merging this pull request may close these issues.

None yet

2 participants