Files
scriptc/tests/corpus/array-from-value.mjs
Chris Tate 2069684b40 Expand static Effect support across common APIs (#598)
* Expand static Effect support across common APIs

* Preserve compiler parity across expanded Effect patterns

* Fix compiler regressions exposed by Effect coverage

* Bound shared type conversion traversal

* Clarify conversion contracts and tidy fixtures

* Run every Effect fixture in CI shards

* Preserve inferred array assignments in concurrent Effect programs

* Record inferred array fixture compiler ordering
2026-10-01 02:49:31 -05:00

19 lines
779 B
JavaScript

const from = Array.from;
console.log(from.length, from.name);
console.log(from === Array.from, JSON.stringify(from("a😀b")));
console.log(JSON.stringify(from([1, 2], (value, index) => value + index)));
const receiver = { offset: 10 };
console.log(JSON.stringify(from([1, 2], function (value) { return this.offset + value; }, receiver)));
const source = { 0: "a", 1: "b", length: 2 };
console.log(JSON.stringify(from(source, (value, index) => {
if (index === 0) source[1] = "changed";
return value;
})));
let closed = 0;
function* values() {
try { yield 1; yield 2; } finally { closed++; }
}
try { from(values(), () => { throw new Error("mapper"); }); }
catch (error) { console.log(error.message, closed); }
try { from([], 1); } catch (error) { console.log(error.name); }