Skip to content

Commit

Permalink
chore: add some jsdocs here
Browse files Browse the repository at this point in the history
  • Loading branch information
brennj committed Aug 16, 2023
1 parent 05acf5f commit da5c220
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/jsonLogic.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,18 @@ function clean(values = {}) {
}, {});
}

/**
* Creates a Yup validation test function with custom JSON Logic for a specific field.
*
* @param {Object} options - The options for creating the validation function.
* @param {Object} options.field - The field configuration object.
* @param {string} options.field.name - The name of the field.
* @param {Object} options.validations - The validations object containing validation scopes and rules.
* @param {Object} options.config - Additional configuration options.
* @param {string} options.config.id - The ID of the validation rule.
* @param {string} [options.config.parentID='root'] - The ID of the validation rule scope.
* @returns {Function} A Yup validation test function.
*/
export function yupSchemaWithCustomJSONLogic({ field, validations, config, id }) {
const { parentID = 'root' } = config;
const validation = validations.getScope(parentID).validationMap.get(id);
Expand Down

0 comments on commit da5c220

Please sign in to comment.