diff options
author | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2022-05-20 10:28:38 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-20 10:28:38 -0400 |
commit | 31e20c889e467aa4ba64b0b5baf602adc1359371 (patch) | |
tree | a033db935a817b2d407ec20843176610a87a6e16 /ext/js/background/profile-conditions-util.js | |
parent | ae0ad227c0fd293609a21e5cc1d2a4b85fe7c520 (diff) |
ESlint JSdoc (#2148)
* Install eslint-plugin-jsdoc
* Initial rules setup
* Update lists
* Use @returns rather than @return
* Remove error throwing code which is never executed
* Fix issues relating to @throws
* General error fixes
* Update Display type documentation
* Various doc fixes
* Fix invalid tuple syntax
* Doc updates
* Remove unused
* Doc updates
* Enable jsdoc/require-returns
* Update rules
* Update remaining rules
Diffstat (limited to 'ext/js/background/profile-conditions-util.js')
-rw-r--r-- | ext/js/background/profile-conditions-util.js | 35 |
1 files changed, 19 insertions, 16 deletions
diff --git a/ext/js/background/profile-conditions-util.js b/ext/js/background/profile-conditions-util.js index fd2991f8..e9bd7a19 100644 --- a/ext/js/background/profile-conditions-util.js +++ b/ext/js/background/profile-conditions-util.js @@ -24,6 +24,20 @@ */ class ProfileConditionsUtil { /** + * A group of conditions. + * @typedef {object} ProfileConditionGroup + * @property {ProfileCondition[]} conditions The list of conditions for this group. + */ + + /** + * A single condition. + * @typedef {object} ProfileCondition + * @property {string} type The type of the condition. + * @property {string} operator The condition operator. + * @property {string} value The value to compare against. + */ + + /** * Creates a new instance. */ constructor() { @@ -78,20 +92,9 @@ class ProfileConditionsUtil { /** * Creates a new JSON schema descriptor for the given set of condition groups. - * @param conditionGroups An array of condition groups in the following format: - * conditionGroups = [ - * { - * conditions: [ - * { - * type: (condition type: string), - * operator: (condition sub-type: string), - * value: (value to compare against: string) - * }, - * ... - * ] - * }, - * ... - * ] + * @param {ProfileConditionGroup[]} conditionGroups An array of condition groups. + * For a profile match, all of the items must return successfully in at least one of the groups. + * @returns {JsonSchema} A new `JsonSchema` object. */ createSchema(conditionGroups) { const anyOf = []; @@ -125,8 +128,8 @@ class ProfileConditionsUtil { /** * Creates a normalized version of the context object to test, * assigning dependent fields as needed. - * @param context A context object which is used during schema validation. - * @returns A normalized context object. + * @param {object} context A context object which is used during schema validation. + * @returns {object} A normalized context object. */ normalizeContext(context) { const normalizedContext = Object.assign({}, context); |