utils/utils.js
function (travisYML, newVersion, newCodeName, existingVersions) {
  // Should only add the new version if it is not present in any form
  if (existingVersions.versions.length === 0) return travisYML
  const nodeVersionIndex = getNodeVersionIndex(existingVersions.versions, newVersion, newCodeName)
  const travisYMLLines = travisYML.split('\n')
  // We only need to do something if the new version isn’t present
  if (nodeVersionIndex === -1) {
    let delimiter = ''
    let leadingSpaces = ''
    if (existingVersions.versions && existingVersions.versions.length > 0) {
      if (existingVersions.versions[0].match(/"/)) {
        delimiter = '"'
      }
      if (existingVersions.versions[0].match(/'/)) {
        delimiter = "'"
      }
      leadingSpaces = existingVersions.versions[0].match(/^([ ]*)/)[1]
    }
    // splice the new version back onto the end of the node version list in the original travisYMLLines array,
    // unless it wasn’t an array but an inline definition of a single version, eg: `node_js: 9`
    if (existingVersions.versions.length === 1 && existingVersions.startIndex === existingVersions.endIndex) {
      // A single node version was defined in inline format, now we want to define two versions in array format
      travisYMLLines.splice(existingVersions.startIndex, 1, 'node_js:')
      travisYMLLines.splice(existingVersions.startIndex + 1, 0, `${leadingSpaces}- ${existingVersions.versions[0]}`)
      travisYMLLines.splice(existingVersions.startIndex + 2, 0, `${leadingSpaces}- ${delimiter}${newVersion}${delimiter}`)
    } else {
      // Multiple node versions were defined in array format
      travisYMLLines.splice(existingVersions.endIndex + 1, 0, `${leadingSpaces}- ${delimiter}${newVersion}${delimiter}`)
    }
  }
  return travisYMLLines.join('\n')
}
function (travisYML, newVersion, newCodeName, existingVersions) {
  // Should only add the new version if it is not present in any form
  if (existingVersions.versions.length === 0) return travisYML
  const nodeVersionIndex = getNodeVersionIndex(existingVersions.versions, newVersion, newCodeName)
  const travisYMLLines = travisYML.split('\n')
  // We only need to do something if the new version isn’t present
  if (nodeVersionIndex === -1) {
    let delimiter = ''
    let leadingSpaces = ''
    if (existingVersions.versions && existingVersions.versions.length > 0) {
      if (existingVersions.versions[0].match(/"/)) {
        delimiter = '"'
      }
      if (existingVersions.versions[0].match(/'/)) {
        delimiter = "'"
      }
      leadingSpaces = existingVersions.versions[0].match(/^([ ]*)/)[1]
    }
    // splice the new version back onto the end of the node version list in the original travisYMLLines array,
    // unless it wasn’t an array but an inline definition of a single version, eg: `node_js: 9`
    if (existingVersions.versions.length === 1 && existingVersions.startIndex === existingVersions.endIndex) {
      // A single node version was defined in inline format, now we want to define two versions in array format
      travisYMLLines.splice(existingVersions.startIndex, 1, 'node_js:')
      travisYMLLines.splice(existingVersions.startIndex + 1, 0, `${leadingSpaces}- ${existingVersions.versions[0]}`)
      travisYMLLines.splice(existingVersions.startIndex + 2, 0, `${leadingSpaces}- ${delimiter}${newVersion}${delimiter}`)
    } else {
      // Multiple node versions were defined in array format
      travisYMLLines.splice(existingVersions.endIndex + 1, 0, `${leadingSpaces}- ${delimiter}${newVersion}${delimiter}`)
    }
  }
  return travisYMLLines.join('\n')
}
Stop! YAMLtime! existingVersions is the output of getNodeVersionsFromTravisYML