Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add checks variable modifiers #662

Open
wants to merge 3 commits into
base: v4
Choose a base branch
from
Open

Add checks variable modifiers #662

wants to merge 3 commits into from

Conversation

Stef-00012
Copy link

@Stef-00012 Stef-00012 commented Jan 12, 2025

For numbers:

  • >X: Greater than X 1
  • >=X: Greater or equal to X 1
  • =X: Equal to X 1
  • <=X: Lesser or equal to X 1
  • <X: less than X 1

For strings:

  • =Y: Equals to Y 2
  • ~Y: Contains/Includes Y 2
  • $Y: Starts with Y 2
  • ^Y: Ends with Y 2
  • exists: If the string is not null or empty ""

For booleans:
istrue: Is true

they work like so
{type.prop::mod["true string"||"false string"]}

Example:
{file.maxViews::>0["{file.views}/{file.maxViews}"||""]}
This will return

  • <views>/<max_views> (eg. 2/7) when maxViews is greater than 0
  • Nothing when it's 0, less than 0 or null

Footnotes

  1. X is any number 2 3 4 5

  2. Y is any string 2 3 4

src/lib/parser/index.ts Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants