MCPcopy Create free account
hub / github.com/FlowiseAI/Flowise / _matchCronField

Function _matchCronField

packages/server/src/services/schedule/utils.ts:175–199  ·  view source on GitHub ↗
(field: string, value: number, min: number)

Source from the content-addressed store, hash-verified

173// Cron field helpers (used by computeNextRunAt)
174// ---------------------------------------------------------------------------
175function _matchCronField(field: string, value: number, min: number): boolean {
176 if (field === '*') return true
177 for (const part of field.split(',')) {
178 if (part.includes('/')) {
179 const [rangeStr, stepStr] = part.split('/')
180 const step = parseInt(stepStr, 10)
181 if (isNaN(step)) continue
182 if (rangeStr === '*') {
183 if ((value - min) % step === 0) return true
184 } else if (rangeStr.includes('-')) {
185 const [start, end] = rangeStr.split('-').map(Number)
186 if (value >= start && value <= end && (value - start) % step === 0) return true
187 } else {
188 const start = parseInt(rangeStr, 10)
189 if (value >= start && (value - start) % step === 0) return true
190 }
191 } else if (part.includes('-')) {
192 const [start, end] = part.split('-').map(Number)
193 if (value >= start && value <= end) return true
194 } else {
195 if (value === parseInt(part, 10)) return true
196 }
197 }
198 return false
199}
200
201/**
202 * Day-of-month matcher that additionally supports the `L` token, which fires only on the

Callers 3

_matchDomFieldFunction · 0.85
_cronMatchesParsedFunction · 0.85
computeNextRunAtFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected