generatePrefix = (body, node, info, prefixGenerator, delim, history) => {
  if (typeof prefixGenerator === 'function') {
    let prefix = history.get(body);

    if (prefix != null) {
      return prefix;
    }

    prefix = prefixGenerator(node, info) + delim;
    history.set(body, prefix);
    return prefix;
  }

  if (typeof prefixGenerator === 'string') {
    return prefixGenerator + delim;
  }

  if (prefixGenerator === false) {
    return '';
  }

  if (info.path != null && info.path.length > 0) {
    return escapeIdentifierName(getBasename(info.path)) + delim;
  }

  return 'prefix' + delim;
}
Generates a prefix for the given string.

@param {string} body An arbitrary string.
@param {import('../lib/types.js').XastElement} node XML node that the identifier belongs to.
@param {import('../lib/types.js').PluginInfo} info
@param {((node: import('../lib/types.js').XastElement, info: import('../lib/types.js').PluginInfo) => string) | string | boolean | undefined} prefixGenerator Some way of obtaining a prefix.
@param {string} delim Content to insert between the prefix and original value.
@param {Map<string, string>} history Map of previously generated prefixes to IDs.
@returns {string} A generated prefix.