在 NGXS 中使用大写或小写过滤 Angular

Filtering With Uppercase or Lowercase in NGXS Angular

我在 filtering/searching 中遇到问题,它应该匹配字符串的精确小写或大写。不管lowercase/uppercase如何,我怎么能search/filter。请看这个linkCLICK HERE

@Selector()
  static nameFilter(name: string ){
    return createSelector([AppState], (state: any)=> {
      return state.app.people.filter(
        (p: People) => {
          console.log(p, name)
          if (name){
            if (p.name.includes(name)) {return p}
          } 
          else return p
        }
      ).sort(
        (a: any, b: any) => {
          return a - b
        }
      )
    })
  }

过滤前全部转为小写:

if (p.name.toLowerCase().includes(name.toLowerCase())) {return p}