{"size": 564, "ext": "js", "max_stars_repo_path": "src/features/targeting/utils/useSuppressed.js", "max_stars_repo_name": "The-Speck/box-ui-elements", "max_stars_repo_stars_event_min_datetime": "2017-10-03T01:53:24.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-30T22:42:15.000Z", "max_issues_repo_path": "src/features/targeting/utils/useSuppressed.js", "max_issues_repo_name": "The-Speck/box-ui-elements", "max_issues_repo_issues_event_min_datetime": "2017-10-26T03:18:49.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-29T08:09:16.000Z", "max_forks_repo_path": "src/features/targeting/utils/useSuppressed.js", "max_forks_repo_name": "The-Speck/box-ui-elements", "max_forks_repo_forks_event_min_datetime": "2017-10-02T23:11:29.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-24T11:38:46.000Z"}
{"max_stars_count": 673, "max_issues_count": 2087, "max_forks_count": 282, "avg_line_length": 29.6842105263, "max_line_length": 112, "alphanum_fraction": 0.7074468085}
// @flow
import neverTargeted from '../neverTargeted';
import { type TargetingApi } from '../types';

/**
 * Returns a targetingApi that will be targeted as long as the input targeting api is targeted
 * and should suppress is false.
 */
const useSuppressed = (useTargetingApi: () => TargetingApi, useShouldSuppress: () => boolean): TargetingApi => {
    const targetingApi = useTargetingApi();
    const shouldSuppress = useShouldSuppress();
    if (shouldSuppress) {
        return neverTargeted;
    }
    return targetingApi;
};

export default useSuppressed;
