Actions35
- Cleaning Actions
- Coercion Actions
- Comparison Actions
- Increment Actions
- Parsing Actions
- Range Actions
- Sorting Actions
- Validation Actions
Overview
This node provides semantic versioning (semver) comparison utilities, allowing users to compare two version strings using various comparison operations. The "Less Than" operation specifically checks if the first version is strictly less than the second version according to semver rules.
Common scenarios where this node is useful include:
- Automating deployment pipelines by checking if a software version is older than a target version.
- Validating version constraints in package management or dependency resolution workflows.
- Conditional logic based on version ordering, such as triggering updates only if a newer version is available.
For example, you can input version "1.2.3" as Version 1 and "1.2.4" as Version 2, and the node will return true because "1.2.3" is less than "1.2.4".
Properties
| Name | Meaning |
|---|---|
| Version 1 | The first version string to compare (e.g., "1.2.3"). |
| Version 2 | The second version string to compare (e.g., "1.2.4"). |
| Options | Collection of optional flags affecting comparison behavior: |
| - Loose: Whether to use loose parsing for version strings (boolean). | |
| - Include Prerelease: Whether to include prerelease versions in range matching (boolean). | |
| - RTL (Right to Left): Not applicable for this resource-operation combination. |
Output
The node outputs a JSON object with the following structure:
{
"operation": "lt",
"version1": "1.2.3",
"version2": "1.2.4",
"result": true
}
operation: The performed operation, here always"lt"for "less than".version1: The first input version string.version2: The second input version string.result: A boolean indicating whetherversion1is less thanversion2.
No binary data output is produced by this node.
Dependencies
- This node uses the external
semverlibrary for all version parsing and comparison logic. - No external API keys or services are required.
- No special n8n environment variables or credentials are needed.
Troubleshooting
- Invalid version strings: If either version string is not a valid semver format, the comparison may fail or return unexpected results. Ensure inputs conform to semantic versioning standards.
- Loose parsing option: Enabling "Loose" parsing allows non-strict version formats but may lead to ambiguous comparisons; use with caution.
- Error messages: Errors typically indicate invalid input versions or unknown resources/operations. Verify that the Resource is set to "Comparison" and Operation to "Less Than".
- Continue On Fail: If enabled, errors for individual items will be returned in the output JSON under an
errorfield instead of stopping execution.