MCPcopy Create free account
hub / github.com/cortex-js/compute-engine / unwrapOrPropagate

Function unwrapOrPropagate

src/compute-engine/interval/util.ts:204–222  ·  view source on GitHub ↗
(
  ...inputs: Array<Interval | IntervalResult>
)

Source from the content-addressed store, hash-verified

202 if (result.kind === 'singular') return result.value;
203 return undefined;
204}
205
206/**
207 * Unwrap an interval from either a plain Interval or an IntervalResult.
208 *
209 * Used by arithmetic operations to accept both formats for convenience.
210 * Returns undefined if the input is an IntervalResult without an enclosure
211 * (empty, entire, or a pole).
212 */
213export function unwrap(input: Interval | IntervalResult): Interval | undefined {
214 // Check if it's an IntervalResult
215 if ('kind' in input) return getValue(input);
216 // Plain interval
217 return input;
218}
219
220/**
221 * Unwrap and propagate errors from IntervalResult inputs.
222 *
223 * If any input has no enclosure (empty, entire, or a pole), returns that
224 * result. Otherwise returns the unwrapped intervals. A finite jump (a
225 * `singular` result that carries a `value`) is unwrapped to its enclosure so

Callers 15

sqrtFunction · 0.90
squareFunction · 0.90
powFunction · 0.90
powIntervalFunction · 0.90
powRationalFunction · 0.90
nthRootFunction · 0.90
expFunction · 0.90
lnFunction · 0.90
log10Function · 0.90
log2Function · 0.90
absFunction · 0.90
floorFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected