code: function normalizePattern(
    pattern /*: string*/,
  ) /*: {
    hasVersion: boolean,
    name: string,
    range: string,
  }*/ {
    let hasVersion = false
    let range = 'latest'
    let name = pattern
  
    // if we're a scope then remove the @ and add it back later
    let isScoped = false
    if (name[0] === '@') {
      isScoped = true
      name = name.slice(1)
    }
  
    // take first part as the name
    const parts = name.split('@')
    if (parts.length > 1) {
      name = parts.shift()
      range = parts.join('@')
  
      if (range) {
        hasVersion = true
      } else {
        range = '*'
      }
    }
  
    // add back @ scope suffix
    if (isScoped) {
      name = `@${name}`
    }
  
    return {name, range, hasVersion}
  }
docs: /*::
  type Package = string
  type Lockfile = {|
  version: number,
  packages: {
  flowgen: {[key: string]: Package},
  custom: {[key: string]: Package},
  flowTyped: {[key: string]: Package},
  stub: {[key: string]: Package},
  builtin: {[key: string]: Package}
  }
  |}