Skip to main content
Version: Next

createTransformRequestFunction

Callable

  • createTransformRequestFunction(__namedParameters): (request) => RequestOptions | false | unchanged

  • Turns the globs and pseudoUrls input editor values into a transformRequestFunction that skips requests matching no pattern (all requests pass when no pattern is given) and applies the options of the matched pattern. When a URL matches multiple patterns, the first one wins, with globs checked before pseudo-URLs. The matched pattern's options shallowly override the request's fields, including userData (no deep merge, like in v3).

    await enqueueLinks({ transformRequestFunction: createTransformRequestFunction({ globs: input.globs }) });

    Parameters

    Returns (request) => RequestOptions | false | unchanged

      • (request): RequestOptions | false | unchanged
      • Parameters

        • request: RequestOptions

        Returns RequestOptions | false | unchanged