protected tryFindOption()

in eng/tools/typespec-validation/src/rules/sdk-tspconfig-validation.ts [118:126]


  protected tryFindOption(config: any): Record<string, any> | undefined {
    let option: Record<string, any> | undefined = config?.options?.[this.emitterName];
    for (const segment of this.keyToValidate.split(".")) {
      if (option && typeof option === "object" && !Array.isArray(option) && segment in option)
        option = option![segment];
      else return undefined;
    }
    return option;
  }