### Install Project Dependencies (npm)
Source: https://github.com/caneara/iodine/blob/master/README.md
This command installs all necessary project dependencies using npm. It should be run after cloning the repository to set up the development environment.
```bash
npm install
```
--------------------------------
### Install Node.js dependencies for Iodine project
Source: https://github.com/caneara/iodine/blob/master/LEGACY.md
This command installs all required Node.js packages for the Iodine project, ensuring all development and testing tools are available.
```bash
npm install
```
--------------------------------
### Install Iodine via CDN
Source: https://github.com/caneara/iodine/blob/master/LEGACY.md
This snippet shows how to include Iodine.js in an HTML project using a Content Delivery Network (CDN). The 'defer' attribute ensures the script executes after the HTML is parsed.
```html
```
--------------------------------
### Install Iodine via NPM
Source: https://github.com/caneara/iodine/blob/master/LEGACY.md
This snippet demonstrates how to install Iodine.js in a project using Node Package Manager (NPM), a common package manager for JavaScript.
```shell
npm i @kingshott/iodine
```
--------------------------------
### Install Iodine via NPM
Source: https://github.com/caneara/iodine/blob/master/README.md
This command demonstrates how to add Iodine.js to a project using the Node Package Manager (NPM). It installs the latest version of the '@caneara/iodine' package into your project's dependencies.
```js
npm i @caneara/iodine
```
--------------------------------
### Install Iodine via CDN
Source: https://github.com/caneara/iodine/blob/master/README.md
This snippet shows how to include Iodine.js in an HTML page using a Content Delivery Network (CDN). The 'defer' attribute ensures the script executes after the document is parsed, preventing render-blocking.
```html
```
--------------------------------
### Retrieve Error Message with Parameters in Iodine (JavaScript)
Source: https://github.com/caneara/iodine/blob/master/LEGACY.md
Demonstrates how to get error messages for rules that require parameters. The parameter can be supplied either as part of the rule string (e.g., 'min:7') or as a separate argument.
```javascript
Iodine.getErrorMessage('min:7'); // string
Iodine.getErrorMessage('min', 7); // string
```
--------------------------------
### Perform Basic Integer Validation with Iodine
Source: https://github.com/caneara/iodine/blob/master/README.md
This example demonstrates how to use Iodine's individual assertion methods, specifically 'assertInteger', to check if a variable is an integer. These methods return a boolean indicating the validation result.
```js
let item_1 = 7;
let item_2 = 'string';
Iodine.assertInteger(item_1); // true
Iodine.assertInteger(item_2); // false
```
--------------------------------
### Validate Multiple Items with Iodine
Source: https://github.com/caneara/iodine/blob/master/README.md
This example demonstrates how to use 'Iodine.assert' to validate multiple items, typically for form submissions. It takes two objects: one for the items to be validated and another for their respective validation rules, returning a comprehensive report.
```js
const items = {
name : 5,
email : 'test@example.com',
password : 'abcdefgh',
};
const rules = {
name : ['required', 'string'],
email : ['required', 'email'],
password : ['required'],
};
Iodine.assert(items, rules);
```
--------------------------------
### Set Custom Error Messages for Iodine Validation Rules
Source: https://github.com/caneara/iodine/blob/master/LEGACY.md
This example shows how to define custom error messages for validation rules in Iodine, including those you've created. The `setErrorMessages` method allows mapping rule names to custom messages, which can include placeholders like `[FIELD]` and `[PARAM]` for dynamic content.
```JavaScript
Iodine.addRule('equals', (value, param) => value == param);
Iodine.setErrorMessages({ equals : '[FIELD] must be equal to \'[PARAM]\'' });
```
--------------------------------
### Define a Custom Validation Rule in Iodine (No Parameters)
Source: https://github.com/caneara/iodine/blob/master/LEGACY.md
This example demonstrates how to add a new custom validation rule to the Iodine library using the `addRule` method. The rule 'lowerCase' checks if a value is entirely lowercase. Iodine automatically prefixes custom rule names with 'is' and capitalizes the first letter.
```JavaScript
Iodine.addRule('lowerCase', (value) => value === value.toLowerCase());
```
--------------------------------
### Run tests for Iodine project
Source: https://github.com/caneara/iodine/blob/master/LEGACY.md
This command executes the test suite for the Iodine project, verifying the correctness of existing and new rules.
```bash
npm run test
```
--------------------------------
### Run Project Tests (npm)
Source: https://github.com/caneara/iodine/blob/master/README.md
This command executes the test suite for the Iodine project using npm. It verifies the correctness of the codebase and any new contributions.
```bash
npm run test
```
--------------------------------
### Using Iodine.assertMin for basic validation
Source: https://github.com/caneara/iodine/blob/master/README.md
Demonstrates basic usage of `Iodine.assertMin` with integer values to check if they meet a specified minimum threshold. This method provides a straightforward way to apply simple validation rules.
```javascript
let item_1 = 7;
let item_2 = 4;
Iodine.assertMin(item_1, 5); // true
Iodine.assertMin(item_2, 5); // false
```
--------------------------------
### Applying object-based rules with Iodine.assert
Source: https://github.com/caneara/iodine/blob/master/README.md
Illustrates using `Iodine.assert` with an array of rules where a rule is defined as an object. This format, e.g., `{ rule : 'min', param : 7 }`, provides a more structured way to pass parameters to validation rules.
```javascript
Iodine.assert(8, ['required', 'integer', { rule : 'min', param : 7 }, 'max:10']);
```
--------------------------------
### Import Iodine in a JavaScript project
Source: https://github.com/caneara/iodine/blob/master/LEGACY.md
This snippet shows how to import the Iodine library into a JavaScript project using ES module syntax, suitable for projects with build tools or modern environments. It then instantiates a new Iodine object.
```javascript
import { Iodine } from '@kingshott/iodine';
const iodine = new Iodine();
```
--------------------------------
### Test Single Asynchronous Rule in Iodine (JavaScript)
Source: https://github.com/caneara/iodine/blob/master/LEGACY.md
Illustrates how to test a value against a single custom asynchronous rule using its generated method (e.g., `isTimeoutEquals`) with the `await` keyword, ensuring the Promise resolves before the result is returned.
```javascript
let result = await Iodine.isTimeoutEquals(1, 1);
```
--------------------------------
### Iodine Available Validation Rules Reference
Source: https://github.com/caneara/iodine/blob/master/LEGACY.md
A comprehensive reference of built-in validation rules provided by the Iodine library. Each rule is detailed with its name, parameters, and a description of its validation logic.
```APIDOC
Rule: isAfter(date/integer)
Description: Verify that the item is a Date after a given Date or timestamp
Rule: isAfterOrEqual(date/integer)
Description: Verify that the item is a Date after or equal to a given Date or timestamp
Rule: isArray
Description: Verify that the item is an array
Rule: isBefore(date/integer)
Description: Verify that the item is a Date before a given Date or timestamp
Rule: isBeforeOrEqual(date/integer)
Description: Verify that the item is a Date before or equal to a given Date or timestamp
Rule: isBoolean
Description: Verify that the item is either true or false
Rule: isDate
Description: Verify that the item is a Date object
Rule: isDifferent(value)
Description: Verify that the item is different to the supplied value (uses loose compare)
Rule: isEndingWith(value)
Description: Verify that the item ends with the given value
Rule: isEmail
Description: Verify that the item is a valid email address
Rule: isFalsy
Description: Verify that the item is either false, 'false', 0 or '0'
Rule: isIn(array)
Description: Verify that the item is within the given array
Rule: isInteger
Description: Verify that the item is an integer
Rule: isJson
Description: Verify that the item is a parsable JSON object string
Rule: isMaxLength(limit)
Description: Verify that the item's character length does not exceed the given limit
Rule: isMinLength(limit)
Description: Verify that the item's character length is not under the given limit
Rule: isMax(limit)
Description: Verify that the item's numerical value does not exceed the given limit
Rule: isMin(limit)
Description: Verify that the item's numerical value is not under the given limit
Rule: isNotIn(array)
Description: Verify that the item is not within the given array
Rule: isNumeric
Description: Verify that the item is number or a numeric string
Rule: isOptional
Description: Allow for optional values (only for use with multiple checks)
Rule: isRegexMatch(exp)
Description: Verify that the item satisfies the given regular expression
Rule: isRequired
Description: Verify that the item is not null, undefined or an empty string
Rule: isSame(value)
Description: Verify that the item is the same as the supplied value (uses loose compare)
Rule: isStartingWith(value)
Description: Verify that the item starts with the given value
Rule: isString
Description: Verify that the item is a string
Rule: isTruthy
Description: Verify that the item is either true, 'true', 1 or '1'
Rule: isUrl
Description: Verify that the item is a valid URL
Rule: isUuid
Description: Verify that the item is a UUID
```
--------------------------------
### Import Iodine as ES Module
Source: https://github.com/caneara/iodine/blob/master/README.md
This snippet illustrates how to import Iodine as an ES module, allowing you to create a new instance of the validation library. This approach is suitable for projects utilizing module bundlers or requiring custom Iodine instances.
```js
import Iodine from '@caneara/iodine';
const instance = new Iodine();
```
--------------------------------
### Allowing optional values with Iodine.assert
Source: https://github.com/caneara/iodine/blob/master/README.md
Demonstrates how to use the 'optional' rule with `Iodine.assert` to allow values to be optional during validation. It is crucial that 'optional' is the first rule in the array for it to function correctly.
```javascript
let item_1 = 7;
let item_2 = null;
let item_3 = 'string';
Iodine.assert(item_1, ['optional', 'integer']);
Iodine.assert(item_2, ['optional', 'integer']);
Iodine.assert(item_3, ['optional', 'integer']);
```
--------------------------------
### Test Multiple Asynchronous Rules in Iodine (JavaScript)
Source: https://github.com/caneara/iodine/blob/master/LEGACY.md
Explains the correct methods (`asyncIs`, `asyncIsValid`) to use when validating a value against multiple rules, especially when any of them are asynchronous. It also highlights incorrect usage of synchronous methods with asynchronous rules.
```javascript
// Right
await Iodine.asyncIs(1, ['required', 'timeoutEquals:1']));
await Iodine.asyncIsValid(1, ['required', 'integer', 'timeoutEquals:1']));
// Wrong
await Iodine.Is(1, ['required', 'timeoutEquals:1']));
await Iodine.IsValid(1, ['required', 'integer', 'timeoutEquals:1']));
// Wrong
Iodine.Is(1, ['required', 'timeoutEquals:1']));
Iodine.IsValid(1, ['required', 'integer', 'timeoutEquals:1']));
```
--------------------------------
### Applying string-based rules with Iodine.assert
Source: https://github.com/caneara/iodine/blob/master/README.md
Shows how to use `Iodine.assert` with an array of string-based rules for complex validation. This method allows combining multiple rules like 'required', 'integer', and 'min:5' for a single item.
```javascript
let item_1 = 7;
let item_2 = 4;
Iodine.assert(item_1, ['required', 'integer', 'min:5']);
Iodine.assert(item_2, ['required', 'integer', 'min:5']);
```
--------------------------------
### Pass parameters to rules in multiple Iodine checks
Source: https://github.com/caneara/iodine/blob/master/LEGACY.md
This snippet illustrates how to include parameters for rules within the array of multiple checks using a semicolon separator (e.g., 'min:5'). This allows for dynamic rule configuration within the 'Iodine.is' method.
```javascript
let item_1 = 7;
let item_2 = 4;
Iodine.is(item_1, ['required', 'integer', 'min:5']); // true
Iodine.is(item_2, ['required', 'integer', 'min:5']); // string - 'min:5'
```
--------------------------------
### Use additional parameters with single Iodine validation rules
Source: https://github.com/caneara/iodine/blob/master/LEGACY.md
This snippet shows how to pass additional parameters to single validation rules, such as 'isMin', to specify criteria like a minimum value. It demonstrates how the rule evaluates based on the provided parameter.
```javascript
let item_1 = 7;
let item_2 = 4;
Iodine.isMin(item_1, 5); // true
Iodine.isMin(item_2, 5); // false
```
--------------------------------
### Iodine Deprecated Validation Rules and Replacements
Source: https://github.com/caneara/iodine/blob/master/LEGACY.md
A list of validation rules in Iodine that are no longer recommended for use. Each entry includes the deprecated rule, its description, and the suggested replacement rules.
```APIDOC
Rule: isMaximum(limit)
Description: Verify that the item does not exceed the given limit (number or char length)
Replacement: isMax for numerical value. isMaxLength for character length
Rule: isMinimum(limit)
Description: Verify that the item is not under the given limit (number or char length)
Replacement: isMin for numerical value. isMinLength for character length
```
--------------------------------
### Iodine Built-in Validation Rules Reference
Source: https://github.com/caneara/iodine/blob/master/README.md
A comprehensive reference of all pre-defined validation rules available in Iodine, including their functional names, string keys for programmatic access, and a brief description of their purpose and expected input types.
```APIDOC
Rule: assertAfter(date/integer)
String Key: 'after'
Description: Verify that the item is a `Date` after a given `Date` or timestamp
Rule: assertAfterOrEqual(date/integer)
String Key: 'afterOrEqual'
Description: Verify that the item is a `Date` after or equal to a given `Date` or timestamp
Rule: assertArray
String Key: 'array'
Description: Verify that the item is an `array`
Rule: assertBefore(date/integer)
String Key: 'before'
Description: Verify that the item is a `Date` before a given `Date` or timestamp
Rule: assertBeforeOrEqual(date/integer)
String Key: 'beforeOrEqual'
Description: Verify that the item is a `Date` before or equal to a given `Date` or timestamp
Rule: assertBoolean
String Key: 'boolean'
Description: Verify that the item is either `true` or `false`
Rule: assertDate
String Key: 'date'
Description: Verify that the item is a `Date` object
Rule: assertDifferent(value)
String Key: 'different'
Description: Verify that the item is different to the supplied value (uses loose compare)
Rule: assertEnds(value)
String Key: 'ends'
Description: Verify that the item ends with the given value
Rule: assertEmail
String Key: 'email'
Description: Verify that the item is a valid email address
Rule: assertFalsy
String Key: 'falsy'
Description: Verify that the item is either `false`, `'false'`, `0` or `'0'`
Rule: assertIn(array)
String Key: 'in'
Description: Verify that the item is within the given `array`
Rule: assertInteger
String Key: 'integer'
Description: Verify that the item is an `integer`
Rule: assertJson
String Key: 'json'
Description: Verify that the item is a parsable JSON object `string`
Rule: assertMaxLength(limit)
String Key: 'maxLength'
Description: Verify that the item's character length does not exceed the given limit
Rule: assertMinLength(limit)
String Key: 'minLength'
Description: Verify that the item's character length is not under the given limit
Rule: assertMax(limit)
String Key: 'max'
Description: Verify that the item's numerical value does not exceed the given limit
Rule: assertMin(limit)
String Key: 'min'
Description: Verify that the item's numerical value is not under the given limit
Rule: assertNotIn(array)
String Key: 'notIn'
Description: Verify that the item is not within the given `array`
Rule: assertNumeric
String Key: 'numeric'
Description: Verify that the item is `number` or a numeric `string`
Rule: assertOptional
String Key: 'optional'
Description: Allow for optional values (only for use with multiple checks)
Rule: assertRegexMatch(exp)
String Key: 'regexMatch'
Description: Verify that the item satisfies the given regular expression
Rule: assertRequired
String Key: 'required'
Description: Verify that the item is not `null`, `undefined` or an empty `string`
Rule: assertSame(value)
String Key: 'same'
Description: Verify that the item is the same as the supplied value (uses loose compare)
Rule: assertStartsWith(value)
String Key: 'startsWith'
Description: Verify that the item starts with the given value
Rule: assertString
String Key: 'string'
Description: Verify that the item is a `string`
Rule: assertTruthy
String Key: 'truthy'
Description: Verify that the item is either `true`, `'true'`, `1` or `'1'`
Rule: assertUrl
String Key: 'url'
Description: Verify that the item is a valid URL
Rule: assertUuid
String Key: 'uuid'
Description: Verify that the item is a `UUID`
```
--------------------------------
### Handle optional values in Iodine validation rules
Source: https://github.com/caneara/iodine/blob/master/LEGACY.md
This snippet demonstrates how to use the 'optional' rule to allow values to be skipped if they are 'null' or undefined, while still applying other rules if the value is present. The 'optional' rule must be the first in the list.
```javascript
let item_1 = 7;
let item_2 = null;
let item_3 = 'string';
Iodine.is(item_1, ['optional', 'integer']); // true
Iodine.is(item_2, ['optional', 'integer']); // true
Iodine.is(item_3, ['optional', 'integer']); // string - 'integer'
```
--------------------------------
### Perform multiple validation checks with Iodine's 'is' method
Source: https://github.com/caneara/iodine/blob/master/LEGACY.md
This snippet illustrates how to use the main 'Iodine.is' method to validate an item against an array of rules. It returns 'true' if all rules pass, or the name of the first failed rule if validation fails.
```javascript
let item_1 = 7;
let item_2 = 'string';
Iodine.is(item_1, ['required', 'integer']); // true
Iodine.is(item_2, ['required', 'integer']); // string - 'integer'
```
--------------------------------
### Define custom Iodine rule with parameters
Source: https://github.com/caneara/iodine/blob/master/README.md
Shows how to create a custom validation rule that accepts an additional parameter. The parameter is passed as the second argument to the closure.
```js
Iodine.rule('equals', (value, param) => value == param);
```
--------------------------------
### Define Asynchronous Custom Rule in Iodine (JavaScript)
Source: https://github.com/caneara/iodine/blob/master/LEGACY.md
Demonstrates how to add a custom asynchronous validation rule to the Iodine library. The rule must return a Promise, allowing for operations like timeouts or external API calls before resolving the validation result.
```javascript
Iodine.addRule('timeoutEquals', (value, param) => new Promise(resolve => setTimeout(resolve(value == param), 10)));
```
--------------------------------
### Define a Custom Validation Rule in Iodine (With Parameter)
Source: https://github.com/caneara/iodine/blob/master/LEGACY.md
This snippet illustrates how to create a custom validation rule in Iodine that accepts an additional parameter. The 'equals' rule compares a value against a provided parameter. The parameter is passed as the second argument to the rule's closure.
```JavaScript
Iodine.addRule('equals', (value, param) => value == param);
```
--------------------------------
### Set Custom Error Messages for Localization in Iodine (JavaScript)
Source: https://github.com/caneara/iodine/blob/master/LEGACY.md
Explains how to replace Iodine's default error messages with custom ones, enabling localization. The `setErrorMessages` method accepts an object mapping rule names to their new message strings, which can include `[FIELD]` and `[PARAM]` placeholders.
```javascript
Iodine.setErrorMessages({ same: `Field must be '[PARAM]'` }); // English
Iodine.setErrorMessages({ same: `Champ doit ĂȘtre '[PARAM]'` }); // French
```
--------------------------------
### Customizing field-specific error messages in Iodine (single rule)
Source: https://github.com/caneara/iodine/blob/master/README.md
Explains how to pass an object to the `assert` method to define a custom error message for a specific rule on a single field. This allows for highly granular control over error messages based on context.
```javascript
Iodine.assert(value, ['required'], { 'required' : 'The "Label" must be present.' });
```
--------------------------------
### Perform single validation checks with Iodine
Source: https://github.com/caneara/iodine/blob/master/LEGACY.md
This snippet demonstrates how to use Iodine's prefixed 'is' methods (e.g., 'isInteger') to perform single validation checks on individual items. It returns 'true' or 'false' based on whether the item passes the validation.
```javascript
let item_1 = 7;
let item_2 = 'string';
Iodine.isInteger(item_1); // true
Iodine.isInteger(item_2); // false
```
--------------------------------
### Define simple custom Iodine validation rule
Source: https://github.com/caneara/iodine/blob/master/README.md
Demonstrates how to add a new validation rule to Iodine using the `rule` method. The rule checks if a string is lowercase.
```js
Iodine.rule('lowerCase', (value) => value === value.toLowerCase());
```
--------------------------------
### Customizing field-specific error messages in Iodine (multiple rules)
Source: https://github.com/caneara/iodine/blob/master/README.md
Shows how to use the `assert` method with separate `items`, `rules`, and `errors` objects to define custom error messages for multiple fields. This approach provides a structured way to manage complex validation scenarios with tailored error feedback.
```javascript
let items = {
name : '',
};
let rules = {
name : ['required']
};
let errors = {
name : {
required : 'The "Label" must be present.'
}
};
Iodine.assert(items, rules, errors);
```
--------------------------------
### Iodine custom rule naming convention
Source: https://github.com/caneara/iodine/blob/master/README.md
Illustrates the correct and incorrect ways to name custom validation rules in Iodine. The system automatically prefixes 'assert' and capitalizes the first letter.
```js
Iodine.rule('lowerCase'); // right
Iodine.rule('assertLowerCase'); // wrong
```
--------------------------------
### Retrieve Default Error Message in Iodine (JavaScript)
Source: https://github.com/caneara/iodine/blob/master/LEGACY.md
Shows how to retrieve the default error message for a specific validation rule using the `getErrorMessage` method. This returns a string representing the predefined error text.
```javascript
Iodine.getErrorMessage('array'); // string
```
--------------------------------
### Add or Update Single Error Message in Iodine (JavaScript)
Source: https://github.com/caneara/iodine/blob/master/LEGACY.md
Demonstrates how to add a new custom error message or update an existing one for a specific rule using the `setErrorMessage` method, providing fine-grained control over individual messages.
```javascript
Iodine.setErrorMessage("passwordConfirmation", "Does not match password");
```
--------------------------------
### Validate Single Item Against Multiple Rules with Iodine
Source: https://github.com/caneara/iodine/blob/master/README.md
This snippet illustrates how to use the main 'Iodine.assert' method to validate a single item against an array of rules. Unlike individual assertions, this method returns a detailed report object instead of a boolean.
```js
let item_1 = 7;
let item_2 = 'string';
Iodine.assert(item_1, ['required', 'integer']);
Iodine.assert(item_2, ['required', 'integer']);
```
--------------------------------
### Globally customizing Iodine error messages
Source: https://github.com/caneara/iodine/blob/master/README.md
Shows how to use `Iodine.setErrorMessages` to replace the default error messages globally for the Iodine library. This method accepts an object mapping rule names to custom message strings, supporting `[FIELD]` and `[PARAM]` placeholders.
```javascript
Iodine.setErrorMessages({ same : `[FIELD] must be '[PARAM]'` }); // English
Iodine.setErrorMessages({ same : `[FIELD] doit ĂȘtre '[PARAM]'` }); // French
```
--------------------------------
### Set Default Field Name for Error Messages in Iodine (JavaScript)
Source: https://github.com/caneara/iodine/blob/master/LEGACY.md
Shows how to change the default placeholder text ('Value') that appears in error messages when no specific field name is provided. This is useful for consistent localization.
```javascript
Iodine.setDefaultFieldName('Valeur');
```
--------------------------------
### Validate an object against a schema with Iodine's 'isValidSchema'
Source: https://github.com/caneara/iodine/blob/master/LEGACY.md
This snippet demonstrates how to use 'Iodine.isValidSchema' to validate an entire object against a defined schema, where each property has its own array of validation rules. This method returns a boolean indicating overall schema validity.
```javascript
Iodine.isValidSchema({
email : 'welcome@to.iodine',
password : 'abcdefgh',
fullname : 'John Doe'
}, {
email : ['required', 'email'],
password : ['required', 'minLength:6'],
fullname : ['required', 'minLength:3']
}); // true
```
--------------------------------
### Retrieve Error Message with Field Name in Iodine (JavaScript)
Source: https://github.com/caneara/iodine/blob/master/LEGACY.md
Illustrates how to include a field name within the error message. By passing an object with a 'field' property to `getErrorMessage`, the placeholder `[FIELD]` in the message will be replaced.
```javascript
Iodine.getErrorMessage('min:7', { field: ''}); // string
Iodine.getErrorMessage('min', { field: '', param: 7}); // string
```
--------------------------------
### Add custom error message for Iodine rule
Source: https://github.com/caneara/iodine/blob/master/README.md
Explains how to associate a custom error message with a validation rule using `setErrorMessage`. Placeholders like `[FIELD]` and `[PARAM]` can be used in the message string.
```js
Iodine.rule('equals', (value, param) => value == param);
Iodine.setErrorMessage('equals', "[FIELD] must be equal to '[PARAM]'");
```
--------------------------------
### Customizing single error messages in Iodine
Source: https://github.com/caneara/iodine/blob/master/README.md
Illustrates using `Iodine.setErrorMessage` to update or add a single custom error message for a specific rule. This is useful when only a few error messages need to be modified without replacing the entire set.
```javascript
Iodine.setErrorMessage('passwordConfirmation', 'Does not match password');
```
--------------------------------
### Perform strict boolean validation with Iodine's 'isValid' method
Source: https://github.com/caneara/iodine/blob/master/LEGACY.md
This snippet shows how to use the 'Iodine.isValid' helper method for multiple checks when only a boolean result is desired, indicating whether the value passed all validation checks, without returning the failed rule name.
```javascript
let item_1 = 7;
let item_2 = 'string';
Iodine.isValid(item_1, ['required', 'integer']); // true
Iodine.isValid(item_2, ['required', 'integer']); // false
```
--------------------------------
### Iodine Multiple Item Validation Report Structure
Source: https://github.com/caneara/iodine/blob/master/README.md
This JSON object shows the detailed report structure returned by 'Iodine.assert' when validating multiple items. It includes an overall 'valid' status and a 'fields' object containing individual validation reports for each item, mirroring the single item report structure.
```js
{
valid : false,
fields : {
name : {
valid : false,
rule : 'string',
error : 'Value must be a string',
},
email : {
valid : true,
rule : '',
error : '',
},
password : {
valid : true,
rule : '',
error : '',
}
},
}
```
--------------------------------
### Setting the default field name for Iodine error messages
Source: https://github.com/caneara/iodine/blob/master/README.md
Demonstrates how to use `Iodine.setDefaultFieldName` to change the default field name used in error messages when explicit field names are not provided. This method must be called before `assert` to take effect.
```javascript
Iodine.setDefaultFieldName('Valeur');
```
--------------------------------
### Iodine Single Item Validation Success Report Structure
Source: https://github.com/caneara/iodine/blob/master/README.md
This JSON object shows the structure of the report returned by 'Iodine.assert' when a single item successfully passes all validation rules. It includes a 'valid' status and empty 'rule' and 'error' fields, indicating no failures.
```js
{
valid : true,
rule : '',
error : '',
}
```
--------------------------------
### Iodine Single Item Validation Failure Report Structure
Source: https://github.com/caneara/iodine/blob/master/README.md
This JSON object illustrates the structure of the report returned by 'Iodine.assert' when a single item fails validation. It indicates 'valid: false' and provides the 'rule' that failed along with an associated 'error' message.
```js
{
valid : false,
rule : 'integer',
error : 'Value must be an integer',
}
```
=== COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.