Skip to content

Latest commit

 

History

History
20 lines (16 loc) · 487 Bytes

File metadata and controls

20 lines (16 loc) · 487 Bytes

Simple Estimator

The simple estimator just adds a fixed complexity to every field that is queried. This can be used as the last estimator in the chain to return the default value.

Usage

import queryComplexity, {simpleEstimator} from 'graphql-query-complexity';

const rule = queryComplexity({
  estimators: [
    simpleEstimator({
      // Add a default complexity of 1 for each queried field
      defaultComplexity: 1
    })
  ]
  // ... other config
});