小编Tal*_*l Z的帖子

如何使用 lodash 检查另一个数组中的数组值

我的查询过滤器

export const resolvers = {
    Query: {
        allItems: (_, { value }) => getAllLinks()
            .then(result => filter(result, val => val.custom_attributes
                .find(customVal =>
                    customVal.attribute_code === 'category_ids' && isEqual(customVal.value, value)
                )
                )),
    },
Run Code Online (Sandbox Code Playgroud)

我的架构

const typeDefs = `
    type Item  {
        id: ID!
        name: String
        price: Float
        custom_attributes: [CUSTOM_ATTRIBUTES]
    }

    union CUSTOM_ATTRIBUTES = CustomString | CustomArray 

   type CustomString {
    attribute_code: String
    value: String
  }

  type CustomArray {
    attribute_code: String
    value: [String]

  } 

  type Query {
    allItems(value : [String]): [Item]!

  }
`; …
Run Code Online (Sandbox Code Playgroud)

javascript lodash graphql

1
推荐指数
1
解决办法
4097
查看次数

标签 统计

graphql ×1

javascript ×1

lodash ×1