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

Function range

test/README.example.spec.ts:834–841  ·  view source on GitHub ↗
(start: number, stop: number)

Source from the content-addressed store, hash-verified

832 const log: EffectFactory<Log> = effect("println");
833
834 const range = (start: number, stop: number): Effected<TypeError | RangeError | Log, number[]> =>
835 effected(function* () {
836 if (start >= stop) return yield* rangeError("Start must be less than stop");
837 if (!Number.isInteger(start) || !Number.isInteger(stop))
838 return yield* typeError("Start and stop must be integers");
839 yield* log(`Generating range from ${start} to ${stop}`);
840 return Array.from({ length: stop - start }, (_, i) => start + i);
841 });
842
843 const range2 = (start: number, stop: number) => handleErrorAsResult(range(start, stop));
844

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