static __registerFilter(filter, target) {
    const { name, filter: filterFn } = filter;
    if (typeof name !== 'string')
      throw new Error("Can't register filter; filter.name must be a string");
    if (typeof filterFn !== 'function')
      throw new Error("Can't register filter; filter.filter must be a function");
    this.deleteExistingHook(target, 'filters', name);

    // make sure to trigger the setter
    target.hooks = deepmerge(target.hooks, {
      filters: {
        [name]: filterFn,
      },
    });
    return target;
  }
@param {Filter} filter
@param {typeof Register | Register} target