hunk.code_window:     "is-retry-allowed": "1.1.0",
       "js-yaml": "3.6.1",
       "json2yaml": "1.1.0",
       "link-dir": "1.0.1",
       "load-json-file": "2.0.0",
       "lockfile": "1.0.1",
       "lodash.clonedeep": "4.5.0",
       "lodash.memoize": "4.1.2",
  
hunk.labels: keep keep keep replace keep keep keep keep
hunk.after_edit:     "link-dir": "1.0.2",
  
hunk.file_path: package.json
hunk.type: replace
file: import osHomedir = require('os-homedir')
  import path = require('path')
  
  export default function expandTilde (filepath: string) {
    const home = getHomedir()
  
    if (!isHomepath(filepath)) {
      return filepath
    }
    return path.resolve(home, filepath.substr(2))
  }
  
  function getHomedir () {
    const home = osHomedir()
    if (!home) throw new Error('Could not find the homedir')
    return home
  }
  
  export function isHomepath (filepath: string) {
    return filepath.indexOf('~/') === 0 || filepath.indexOf('~\\') === 0
  }
  