To do this, you can use the semver module:
4000+ other modules on npm use this module instead of re-implementing version parsing and with 25 million monthly downloads, it has been tested quite extensively.
In this module, what you need to do is basically single-line (divided into 3 lines for readability)
const newest = jsondata .map(o => o.data.replace(/.* /, '')) .sort(semver.rcompare)[0];
Now console.log(newest); prints: 10.12.13
Or, if you want to save the whole object:
const newest = jsondata .map(o => [o, o.data.replace(/.* /, '')]) .sort((a, b) => semver.rcompare(a[1], b[1]))[0][0];
Now console.log(newest); prints: { data: 'MacOS Sierra 10.12.13' }
Remember to use: const semver = require('semver');
source share