The platforms API lists multiple versions of platforms with different properties. Pull out just the essentials, and eliminate duplicates.
350362
function eliminateDuplicates(browsers) {
    var set = {};

    browsers.forEach(function (browser) {
        var osgroup = browser.os;
        var subgroup = browser.long_name;
        var version = browser.short_version;
        var device;
        var browserName;
        if (browser.api_name === "iphone")  {
            osgroup = device = "iPhone Simulator";
        } else if (browser.api_name === "ipad") {
            osgroup = device =  "iPad Simulator";
        } else if (browser.long_name === "Google Chrome") {
            browserName = 'Chrome';
        } else if (browser.long_name === "Microsoft Edge") {
            browserName = 'MicrosoftEdge';
            version = browser.long_version.substr(0, 8);
        } else if (browser.api_name === "android") {
            browserName = 'Android';
            osgroup = "Android " + browser.short_version;
            device = browser.long_name;
            if (subgroup === "Android") {
                subgroup += " " + version + " Emulator";
                device = "Android Emulator";
            }
        } else if (osgroup in OS_ID_TO_GROUPNAME) {
            osgroup = OS_ID_TO_GROUPNAME[osgroup];
        }
        set[JSON.stringify([osgroup, subgroup, version])] = {
            browserName: browserName || browser.long_name,
            platform: OS_ID_TO_GROUPNAME[browser.os] || browser.os,
            version: version,
            deviceName: device || browser.device
        };
    });

    var uniques = Object.keys(set).sort().map(function (id) {
        return set[id];
    });
    return uniques;
}
773005
function getPlatformExtension(file, platforms = SUPPORTED_PLATFORM_EXTS) {
  const last = file.lastIndexOf('.');
  const secondToLast = file.lastIndexOf('.', last - 1);
  if (secondToLast === -1) {
    return null;
  }
  const platform = file.substring(secondToLast + 1, last);
  return platforms.has(platform) ? platform : null;
}
86976
def api_version(self, v):
        """"""
        self._api_version = v
        if (self._api_version >= '2.0'):
            self.default_quality = 'default'
            self.allowed_qualities = ['default', 'color', 'bitonal', 'gray']
        else:  # versions 1.0 and 1.1
            self.default_quality = 'native'
            self.allowed_qualities = ['native', 'color', 'bitonal', 'grey']
50841
private Version findHighestMutualVersion(Versions offeredVersions) {
		Version highestSupportedVersion = null;

		for (String supportedVersion : Arrays.asList(AppConfig.SUPPORTED_VERSIONS)) {

			Version match = offeredVersions.find(supportedVersion);
			if (match != null) {
				highestSupportedVersion = match;
			}
		}
		return highestSupportedVersion;
	}
1281630
public static Map<String, Version> identify(ClassLoader classLoader) {
        if (classLoader == null) {
            classLoader = PlatformDependent.getContextClassLoader();
        }

        // Collect all properties.
        Properties props = new Properties();
        try {
            Enumeration<URL> resources = classLoader.getResources("META-INF/io.netty.versions.properties");
            while (resources.hasMoreElements()) {
                URL url = resources.nextElement();
                InputStream in = url.openStream();
                try {
                    props.load(in);
                } finally {
                    try {
                        in.close();
                    } catch (Exception ignore) {
                        // Ignore.
                    }
                }
            }
        } catch (Exception ignore) {
            // Not critical. Just ignore.
        }

        // Collect all artifactIds.
        Set<String> artifactIds = new HashSet<String>();
        for (Object o: props.keySet()) {
            String k = (String) o;

            int dotIndex = k.indexOf('.');
            if (dotIndex <= 0) {
                continue;
            }

            String artifactId = k.substring(0, dotIndex);

            // Skip the entries without required information.
            if (!props.containsKey(artifactId + PROP_VERSION) ||
                !props.containsKey(artifactId + PROP_BUILD_DATE) ||
                !props.containsKey(artifactId + PROP_COMMIT_DATE) ||
                !props.containsKey(artifactId + PROP_SHORT_COMMIT_HASH) ||
                !props.containsKey(artifactId + PROP_LONG_COMMIT_HASH) ||
                !props.containsKey(artifactId + PROP_REPO_STATUS)) {
                continue;
            }

            artifactIds.add(artifactId);
        }

        Map<String, Version> versions = new TreeMap<String, Version>();
        for (String artifactId: artifactIds) {
            versions.put(
                    artifactId,
                    new Version(
                            artifactId,
                            props.getProperty(artifactId + PROP_VERSION),
                            parseIso8601(props.getProperty(artifactId + PROP_BUILD_DATE)),
                            parseIso8601(props.getProperty(artifactId + PROP_COMMIT_DATE)),
                            props.getProperty(artifactId + PROP_SHORT_COMMIT_HASH),
                            props.getProperty(artifactId + PROP_LONG_COMMIT_HASH),
                            props.getProperty(artifactId + PROP_REPO_STATUS)));
        }

        return versions;
    }
106811
def platforms
      raw_platforms = spec.metadata.fetch('platforms', '').strip
      case raw_platforms
      when ''
        []
      when 'any', 'all', '*'
        # Based on `ls lib/fauxhai/platforms  | xargs echo`.
        %w{aix amazon arch centos chefspec debian dragonfly4 fedora freebsd gentoo
           ios_xr mac_os_x nexus omnios openbsd opensuse oracle raspbian redhat
           slackware smartos solaris2 suse ubuntu windows}.map {|p| [p] }
      when /,/
        # Comma split mode. String looks like "name, name constraint, name constraint"
        raw_platforms.split(/\s*,\s*/).map {|p| p.split(/\s+/, 2) }
      else
        # Whitepace split mode, assume no constraints.
        raw_platforms.split(/\s+/).map {|p| [p] }
      end
    end
523587
function getPlatformVersion (platformRoot) {
    var versionFile = path.join(platformRoot, 'cordova/version');

    if (!fs.existsSync(versionFile)) {
        return null;
    }

    var version = shell.cat(versionFile).match(/VERSION\s=\s["'](.*)["'];/m);
    return version && version[1];
}
1063781
def avail_platforms():
    '''
    
    '''
    ret = {}
    for platform in CMD_MAP:
        ret[platform] = True
        for cmd in CMD_MAP[platform]:
            if not salt.utils.path.which(cmd):
                ret[platform] = False
    return ret
339854
protected void resolvePropertyReplacements(Api api) {
        if (api == null) {
            return;
        }
        String endpoint = api.getEndpoint();
        endpoint = resolveProperties(endpoint);
        api.setEndpoint(endpoint);

        Map<String, String> properties = api.getEndpointProperties();
        for (Entry<String, String> entry : properties.entrySet()) {
            String value = entry.getValue();
            value = resolveProperties(value);
            entry.setValue(value);
        }

        resolvePropertyReplacements(api.getApiPolicies());
    }
1074095
def check_platform(platform)
      options = %w[ios android all]
      if platform.nil?
        puts 'No platform detected... Options: ios,android,all'
        exit
      elsif !options.include? platform.downcase
        puts "Invalid platform #{platform}"
        exit
      end
    end
1226323
function hostSupports(platform) {
    var p = platforms[platform] || {},
        hostos = p.hostos || null;
    if (!hostos)
        return true;
    if (hostos.indexOf('*') >= 0)
        return true;
    if (hostos.indexOf(process.platform) >= 0)
        return true;
    return false;
}
375224
def bundle(context, yes, bundle_name):
    """"""
    bundle_obj = context.obj['store'].bundle(bundle_name)
    if bundle_obj is None:
        click.echo(click.style('bundle not found', fg='red'))
        context.abort()
    version_obj = bundle_obj.versions[0]
    if version_obj.included_at:
        question = f"remove bundle version from file system and database: {version_obj.full_path}"
    else:
        question = f"remove bundle version from database: {version_obj.created_at.date()}"
    if yes or click.confirm(question):
        if version_obj.included_at:
            shutil.rmtree(version_obj.full_path, ignore_errors=True)
        version_obj.delete()
        context.obj['store'].commit()
        click.echo(f"version deleted: {version_obj.full_path}")
652966
def version():
    '''
    
    '''
    ret = _client_wrapper('version')
    version_re = re.compile(VERSION_RE)
    if 'Version' in ret:
        match = version_re.match(six.text_type(ret['Version']))
        if match:
            ret['VersionInfo'] = tuple(
                [int(x) for x in match.group(1).split('.')]
            )
    if 'ApiVersion' in ret:
        match = version_re.match(six.text_type(ret['ApiVersion']))
        if match:
            ret['ApiVersionInfo'] = tuple(
                [int(x) for x in match.group(1).split('.')]
            )
    return ret
190931
function(apiVersion) {
    if (!apiVersion) {
      return undefined;
    }
    var parts = apiVersion.split("/");
    if (parts.length === 1) {
      if (parts[0] === "v1") {
        return {group: '', version: parts[0]};
      }
      return {group: parts[0], version: ''};
    }
    if (parts.length === 2) {
      return {group:parts[0], version: parts[1]};
    }
    Logger.warn('Invalid apiVersion "' + apiVersion + '"');
    return undefined;
  }
201502
def match(self, version):
        """"""
        return all(spec.match(version) for spec in self.specs)
574503
def parse_type(type)
      api_ver = (@options['api_version'] || ENV['ONEVIEWSDK_API_VERSION'] || OneviewSDK.api_version).to_i
      unless OneviewSDK::SUPPORTED_API_VERSIONS.include?(api_ver)
        # Find and use the best available match for the desired API version (round down to nearest)
        valid_api_ver = OneviewSDK::SUPPORTED_API_VERSIONS.select { |x| x <= api_ver }.max || OneviewSDK::SUPPORTED_API_VERSIONS.min
        puts "WARNING: Module API version #{api_ver} is not supported. Using #{valid_api_ver}"
        api_ver = valid_api_ver
      end
      variant = @options['variant'] || ENV['ONEVIEWSDK_VARIANT']
      variant ||= OneviewSDK::API300.variant if api_ver == 300
      if variant && !SUPPORTED_VARIANTS.include?(variant)
        fail_nice "Variant '#{variant}' is not supported. Try one of #{SUPPORTED_VARIANTS}"
      end
      r = OneviewSDK.resource_named(type, api_ver, variant)
      # Try default API version as last resort
      r ||= OneviewSDK.resource_named(type, OneviewSDK.api_version, variant) unless api_ver == OneviewSDK.api_version
      return r if r && r.respond_to?(:find_by)
      valid_classes = []
      api_module = OneviewSDK.const_get("API#{api_ver}")
      api_module = api_module.const_get(variant.to_s) unless api_ver.to_i == 200
      api_module.constants.each do |c|
        klass = api_module.const_get(c)
        next unless klass.is_a?(Class) && klass.respond_to?(:find_by)
        valid_classes.push(klass.name.split('::').last)
      end
      vc = valid_classes.sort_by!(&:downcase).join("\n  ")
      var = variant ? " (variant #{variant})" : ''
      fail_nice("Invalid resource type: '#{type}'.  Valid options for API version #{api_ver}#{var} are:\n  #{vc}")
    end
619617
def get_platform_variables(ds):
    '''
    
    '''
    candidates = []
    for variable in ds.variables:
        platform = getattr(ds.variables[variable], 'platform', '')
        if platform and platform in ds.variables:
            if platform not in candidates:
                candidates.append(platform)

    platform = getattr(ds, 'platform', '')
    if platform and platform in ds.variables:
        if platform not in candidates:
            candidates.append(platform)
    return candidates