MCPcopy Create free account
hub / github.com/Snowflyt/tinyeffect / range

Function range

test/README.example.proof.ts:523–530  ·  view source on GitHub ↗
(start: number, stop: number)

Source from the content-addressed store, hash-verified

521 const log: EffectFactory<Log> = effect("println");
522
523 const range = (start: number, stop: number): Effected<TypeError | RangeError | Log, number[]> =>
524 effected(function* () {
525 if (start >= stop) return yield* rangeError("Start must be less than stop");
526 if (!Number.isInteger(start) || !Number.isInteger(stop))
527 return yield* typeError("Start and stop must be integers");
528 yield* log(`Generating range from ${start} to ${stop}`);
529 return Array.from({ length: stop - start }, (_, i) => start + i);
530 });
531
532 const handleErrorAsResult = <R, E extends Effect, ErrorName extends string>(
533 self: Effected<Effect.Error<ErrorName> | E, R>,

Callers 7

range2Function · 0.70
range3Function · 0.70
range4Function · 0.70
tolerantRangeFunction · 0.70
range5Function · 0.70
range6Function · 0.70
range7Function · 0.70

Calls 2

effectedFunction · 0.90
fromMethod · 0.80

Tested by

no test coverage detected