getPatternVersion(pattern, pkg) {
    const tilde = this.flags.tilde;
    const configPrefix = String(this.config.getOption('save-prefix'));
    const exact = this.flags.exact || Boolean(this.config.getOption('save-exact')) || configPrefix === '';

    var _normalizePattern = (0, (_normalizePattern2 || _load_normalizePattern()).normalizePattern)(pattern);

    const hasVersion = _normalizePattern.hasVersion,
          range = _normalizePattern.range;

    let version;

    if ((0, (_index || _load_index()).getExoticResolver)(pattern)) {
      // wasn't a name/range tuple so this is just a raw exotic pattern
      version = pattern;
    } else if (hasVersion && range && ((_semver || _load_semver()).default.satisfies(pkg.version, range) || (0, (_index || _load_index()).getExoticResolver)(range))) {
      // if the user specified a range then use it verbatim
      version = range;
    }

    if (!version || (_semver || _load_semver()).default.valid(version)) {
      let prefix = configPrefix || '^';

      if (tilde) {
        prefix = '~';
      } else if (version || exact) {
        prefix = '';
      }
      version = `${prefix}${pkg.version}`;
    }

    return version;
  }
returns version for a pattern based on Manifest