code: function (version1, version2)
      {
        // if one or both inputs are valid, return NaN
        if (!exports.isString(version1) || !exports.isString(version2))
        {
          return NaN;
        }
  
        // split on dot
        var version1Parts = version1.split('.');
        var version2Parts = version2.split('.');
  
        // add trailing zeros to make the parts arrays the same length
        while (version1Parts.length < version2Parts.length)
        {
          version1Parts.push('0');
        }
        while (version2Parts.length < version1Parts.length)
        {
          version2Parts.push('0');
        }
  
        // compare elements in the two arrays one by one
        var result = 0;
        var version1Part, version2Part;
        for (var index = 0, length = version1Parts.length; index < length; index++)
        {
          // convert to number before doing any arithmetic
          version1Part = Number(version1Parts[index]);
          version2Part = Number(version2Parts[index]);
  
          // if one or both values are not numerical, consider the input invalid
          if (!exports.isNumber(version1Part) || !exports.isNumber(version2Part))
          {
            result = NaN;
            break;
          }
  
          // if the two values are different, pick the
          // correct result based on which value is smaller
          if (version1Part !== version2Part)
          {
            result = version1Part < version2Part ? -1 : 1;
            break;
          }
        }
  
        return result;
      }
docs: Compares two version numbers of the form 'a.b.c' where a, b and c are
  numbers (e.g. '1.0.12'). If one or both inputs are invalid versions, the
  function will return NaN, otherwise, it will return -1 if the first
  version is smaller, 1 if the first version is bigger, and 0 if the two
  versions are equal.
  
  @param {String} version1
  @param {String} version2
  
  @returns {Number}