Sha256: a1e592bfb52b85529e14647713738642534c46536f2dca3e7bb7fd11cba2678a

Contents?: true

Size: 1.14 KB

Versions: 104

Compression:

Stored size: 1.14 KB

Contents

/*eslint complexity: ["error", 12]*/
/**
 * Determines which CheckOption to use, either defined on the rule options, global check options or the check itself
 * @param  {Check} check    The Check object
 * @param  {String} ruleID  The ID of the rule
 * @param  {Object} options Options object as passed to main API
 * @return {Object}         The resolved object with `options` and `enabled` keys
 */
axe.utils.getCheckOption = function(check, ruleID, options) {
	var ruleCheckOption = (((options.rules && options.rules[ruleID]) || {})
		.checks || {})[check.id];
	var checkOption = (options.checks || {})[check.id];

	var enabled = check.enabled;
	var opts = check.options;

	if (checkOption) {
		if (checkOption.hasOwnProperty('enabled')) {
			enabled = checkOption.enabled;
		}
		if (checkOption.hasOwnProperty('options')) {
			opts = checkOption.options;
		}
	}

	if (ruleCheckOption) {
		if (ruleCheckOption.hasOwnProperty('enabled')) {
			enabled = ruleCheckOption.enabled;
		}
		if (ruleCheckOption.hasOwnProperty('options')) {
			opts = ruleCheckOption.options;
		}
	}

	return {
		enabled: enabled,
		options: opts,
		absolutePaths: options.absolutePaths
	};
};

Version data entries

104 entries across 104 versions & 1 rubygems

Version Path
govuk_publishing_components-21.16.3 node_modules/axe-core/lib/core/utils/get-check-option.js
govuk_publishing_components-21.16.2 node_modules/axe-core/lib/core/utils/get-check-option.js
govuk_publishing_components-21.16.1 node_modules/axe-core/lib/core/utils/get-check-option.js
govuk_publishing_components-21.16.0 node_modules/axe-core/lib/core/utils/get-check-option.js
govuk_publishing_components-21.15.2 node_modules/axe-core/lib/core/utils/get-check-option.js
govuk_publishing_components-21.15.1 node_modules/axe-core/lib/core/utils/get-check-option.js
govuk_publishing_components-21.15.0 node_modules/axe-core/lib/core/utils/get-check-option.js
govuk_publishing_components-21.14.0 node_modules/axe-core/lib/core/utils/get-check-option.js
govuk_publishing_components-21.13.5 node_modules/axe-core/lib/core/utils/get-check-option.js
govuk_publishing_components-21.13.4 node_modules/axe-core/lib/core/utils/get-check-option.js
govuk_publishing_components-21.13.3 node_modules/axe-core/lib/core/utils/get-check-option.js
govuk_publishing_components-21.13.2 node_modules/axe-core/lib/core/utils/get-check-option.js
govuk_publishing_components-21.13.1 node_modules/axe-core/lib/core/utils/get-check-option.js
govuk_publishing_components-21.13.0 node_modules/axe-core/lib/core/utils/get-check-option.js
govuk_publishing_components-21.12.0 node_modules/axe-core/lib/core/utils/get-check-option.js
govuk_publishing_components-21.11.0 node_modules/axe-core/lib/core/utils/get-check-option.js
govuk_publishing_components-21.10.0 node_modules/axe-core/lib/core/utils/get-check-option.js
govuk_publishing_components-21.9.0 node_modules/axe-core/lib/core/utils/get-check-option.js
govuk_publishing_components-21.8.1 node_modules/axe-core/lib/core/utils/get-check-option.js
govuk_publishing_components-21.8.0 node_modules/axe-core/lib/core/utils/get-check-option.js