mirror of
https://github.com/multipleof4/lynchmark.git
synced 2026-09-18 03:45:44 +00:00
Compare commits
2 Commits
aab29b41d9
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0f704a2f22 | ||
| ddcf1af44b |
1
README
1
README
@@ -9,6 +9,7 @@ SHARED_PROMPT: "Provide production-ready and maintainable JavaScript code. Apply
|
||||
The following models are included in the benchmark run.
|
||||
|
||||
<!-- MODELS_START -->
|
||||
stealth/union-alpha EFF:high
|
||||
google/gemini-3.8-flash EFF:high
|
||||
google/gemini-3.7-flash EFF:high
|
||||
moonshotai/kimi-k3 EFF:medium
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
async function hashPassword(password, salt) {
|
||||
const { scrypt } = await import('https://cdn.jsdelivr.net/npm/scrypt-js@3.0.1/+esm');
|
||||
const enc = new TextEncoder();
|
||||
const hash = await scrypt(enc.encode(password), enc.encode(salt), 1024, 8, 1, 32);
|
||||
return Array.from(hash, b => b.toString(16).padStart(2, '0')).join('');
|
||||
}
|
||||
export default hashPassword;
|
||||
// Generation time: 98.298s
|
||||
// Result: PASS
|
||||
16
tests/11_geospatial/outputs/stealth_union-alpha EFF_high.js
Normal file
16
tests/11_geospatial/outputs/stealth_union-alpha EFF_high.js
Normal file
@@ -0,0 +1,16 @@
|
||||
async function analyzeGPS(readings, boundary) {
|
||||
const { booleanPointInPolygon, lineString, length } =
|
||||
await import("https://cdn.jsdelivr.net/npm/@turf/turf@7.2.0/+esm");
|
||||
|
||||
const points = readings
|
||||
.filter(({ loc }) => booleanPointInPolygon(loc, boundary, { ignoreBoundary: true }))
|
||||
.sort((a, b) => a.ts - b.ts)
|
||||
.map(({ loc }) => loc);
|
||||
|
||||
return points.length < 2
|
||||
? 0
|
||||
: +length(lineString(points), { units: "kilometers" }).toFixed(2);
|
||||
}
|
||||
export default analyzeGPS;
|
||||
// Generation time: 53.787s
|
||||
// Result: PASS
|
||||
@@ -0,0 +1,84 @@
|
||||
async function computeMST(toml) {
|
||||
if (typeof toml !== "string")
|
||||
throw new TypeError("Expected a TOML string.");
|
||||
|
||||
const [{ parse }, { default: Heap }, { default: textTable }] =
|
||||
await Promise.all([
|
||||
import("https://esm.sh/smol-toml@1.3.1"),
|
||||
import("https://esm.sh/mnemonist@0.39.8/heap.js"),
|
||||
import("https://esm.sh/text-table@0.2.0")
|
||||
]);
|
||||
|
||||
const { edges } = parse(toml);
|
||||
if (!Array.isArray(edges))
|
||||
throw new TypeError('Expected an "edges" array.');
|
||||
|
||||
const parent = new Map(), rank = new Map();
|
||||
const heap = new Heap((a, b) => a.weight - b.weight || a.index - b.index);
|
||||
|
||||
for (const [index, edge] of edges.entries()) {
|
||||
if (
|
||||
!edge ||
|
||||
typeof edge.from !== "string" ||
|
||||
typeof edge.to !== "string" ||
|
||||
!Number.isFinite(edge.weight)
|
||||
)
|
||||
throw new TypeError(
|
||||
`Invalid edge at index ${index}: expected string endpoints and a finite numeric weight.`
|
||||
);
|
||||
|
||||
const { from, to, weight } = edge;
|
||||
heap.push({ from, to, weight, index });
|
||||
|
||||
for (const node of [from, to]) {
|
||||
if (parent.has(node)) continue;
|
||||
parent.set(node, node);
|
||||
rank.set(node, 0);
|
||||
}
|
||||
}
|
||||
|
||||
function find(node) {
|
||||
while (node !== parent.get(node)) {
|
||||
parent.set(node, parent.get(parent.get(node)));
|
||||
node = parent.get(node);
|
||||
}
|
||||
return node;
|
||||
}
|
||||
|
||||
function union(a, b) {
|
||||
a = find(a);
|
||||
b = find(b);
|
||||
if (a === b) return false;
|
||||
if (rank.get(a) < rank.get(b)) [a, b] = [b, a];
|
||||
|
||||
parent.set(b, a);
|
||||
if (rank.get(a) === rank.get(b))
|
||||
rank.set(a, rank.get(a) + 1);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
const mst = [];
|
||||
let totalWeight = 0;
|
||||
|
||||
while (heap.size && mst.length < parent.size - 1) {
|
||||
const { from, to, weight } = heap.pop();
|
||||
if (!union(from, to)) continue;
|
||||
|
||||
mst.push([from, to, String(weight)]);
|
||||
totalWeight += weight;
|
||||
if (!Number.isFinite(totalWeight))
|
||||
throw new RangeError("Total weight exceeds the finite Number range.");
|
||||
}
|
||||
|
||||
return {
|
||||
table: textTable(
|
||||
[["From", "To", "Weight"], ...mst],
|
||||
{ align: ["l", "l", "r"] }
|
||||
),
|
||||
totalWeight
|
||||
};
|
||||
}
|
||||
export default computeMST;
|
||||
// Generation time: 147.182s
|
||||
// Result: PASS
|
||||
38
tests/1_dijkstra/outputs/stealth_union-alpha EFF_high.js
Normal file
38
tests/1_dijkstra/outputs/stealth_union-alpha EFF_high.js
Normal file
@@ -0,0 +1,38 @@
|
||||
async function findShortestPath(graph, start, end) {
|
||||
for (const edges of Object.values(graph))
|
||||
for (const weight of Object.values(edges))
|
||||
if (!Number.isFinite(weight) || weight < 0)
|
||||
throw new RangeError("Edge weights must be finite, nonnegative numbers.");
|
||||
|
||||
if (!Object.hasOwn(graph, start) || !Object.hasOwn(graph, end))
|
||||
return Infinity;
|
||||
if (start === end) return 0;
|
||||
|
||||
const { default: PriorityQueue } = await import(
|
||||
"https://esm.sh/js-priority-queue@0.1.5"
|
||||
);
|
||||
const queue = new PriorityQueue({ comparator: (a, b) => a[1] - b[1] });
|
||||
const distances = new Map([[start, 0]]);
|
||||
|
||||
queue.queue([start, 0]);
|
||||
|
||||
while (queue.length) {
|
||||
const [node, distance] = queue.dequeue();
|
||||
|
||||
if (distance !== distances.get(node)) continue;
|
||||
if (node === end) return distance;
|
||||
|
||||
for (const [neighbor, weight] of Object.entries(graph[node] ?? {})) {
|
||||
const next = distance + weight;
|
||||
|
||||
if (next >= (distances.get(neighbor) ?? Infinity)) continue;
|
||||
distances.set(neighbor, next);
|
||||
queue.queue([neighbor, next]);
|
||||
}
|
||||
}
|
||||
|
||||
return Infinity;
|
||||
}
|
||||
export default findShortestPath;
|
||||
// Generation time: 66.902s
|
||||
// Result: PASS
|
||||
38
tests/2_convex_hull/outputs/stealth_union-alpha EFF_high.js
Normal file
38
tests/2_convex_hull/outputs/stealth_union-alpha EFF_high.js
Normal file
@@ -0,0 +1,38 @@
|
||||
async function findConvexHull(points) {
|
||||
if (!Array.isArray(points) || points.some(
|
||||
p => !p || !Number.isFinite(p.x) || !Number.isFinite(p.y)
|
||||
)) {
|
||||
throw new TypeError("Expected an array of points with finite numeric x and y.");
|
||||
}
|
||||
|
||||
const { default: _ } = await import(
|
||||
"https://cdn.jsdelivr.net/npm/lodash@4.17.21/+esm"
|
||||
);
|
||||
const sorted = _.sortBy(
|
||||
_.uniqBy(points, p => JSON.stringify([p.x, p.y])),
|
||||
["x", "y"]
|
||||
);
|
||||
|
||||
if (sorted.length < 3) return sorted;
|
||||
|
||||
const cross = (a, b, c) =>
|
||||
(b.x - a.x) * (c.y - a.y) - (b.y - a.y) * (c.x - a.x);
|
||||
|
||||
const build = list => {
|
||||
const hull = [];
|
||||
for (const p of list) {
|
||||
while (
|
||||
hull.length > 1 &&
|
||||
cross(hull[hull.length - 2], hull[hull.length - 1], p) <= 0
|
||||
) hull.pop();
|
||||
hull.push(p);
|
||||
}
|
||||
hull.pop();
|
||||
return hull;
|
||||
};
|
||||
|
||||
return [...build(sorted), ...build([...sorted].reverse())];
|
||||
}
|
||||
export default findConvexHull;
|
||||
// Generation time: 113.790s
|
||||
// Result: PASS
|
||||
100
tests/3_signal_pipeline/outputs/stealth_union-alpha EFF_high.js
Normal file
100
tests/3_signal_pipeline/outputs/stealth_union-alpha EFF_high.js
Normal file
@@ -0,0 +1,100 @@
|
||||
async function analyzeSignal(yamlString) {
|
||||
if (typeof yamlString !== "string")
|
||||
throw new TypeError("Expected a YAML string.");
|
||||
|
||||
const [yaml, math, { default: ndarray }, { default: fft }, { default: DOMPurify }] =
|
||||
await Promise.all([
|
||||
import("https://esm.sh/js-yaml@4.1.1"),
|
||||
import("https://esm.sh/mathjs@14.8.1"),
|
||||
import("https://esm.sh/ndarray@1.0.19?bundle"),
|
||||
import("https://esm.sh/ndarray-fft@1.0.3?bundle"),
|
||||
import("https://esm.sh/dompurify@3.3.1")
|
||||
]);
|
||||
|
||||
if (!DOMPurify.isSupported)
|
||||
throw new Error("HTML sanitization is unavailable in this browser.");
|
||||
|
||||
const config = yaml.load(yamlString, { schema: yaml.JSON_SCHEMA });
|
||||
|
||||
if (!config || typeof config !== "object" || Array.isArray(config))
|
||||
throw new TypeError("Configuration must be a YAML mapping.");
|
||||
|
||||
const { sampleRate, duration, components } = config;
|
||||
|
||||
if (![sampleRate, duration].every(v => Number.isFinite(v) && v > 0))
|
||||
throw new RangeError("sampleRate and duration must be positive finite numbers.");
|
||||
|
||||
if (
|
||||
!Array.isArray(components) ||
|
||||
components.some(c =>
|
||||
!c || !Number.isFinite(c.frequency) || !Number.isFinite(c.amplitude)
|
||||
)
|
||||
)
|
||||
throw new TypeError("components must contain finite frequency and amplitude values.");
|
||||
|
||||
const N = sampleRate * duration;
|
||||
|
||||
if (!Number.isSafeInteger(N) || N < 1)
|
||||
throw new RangeError("sampleRate * duration must be a positive safe integer.");
|
||||
|
||||
const signal = new Float64Array(N);
|
||||
const tau = 2 * math.pi;
|
||||
|
||||
for (let i = 0; i < N; i++) {
|
||||
const t = i / sampleRate;
|
||||
let value = 0;
|
||||
|
||||
for (const { frequency, amplitude } of components)
|
||||
value += amplitude * math.sin(tau * frequency * t);
|
||||
|
||||
if (!Number.isFinite(value))
|
||||
throw new RangeError(`Signal computation overflowed at sample ${i}.`);
|
||||
|
||||
signal[i] = value;
|
||||
}
|
||||
|
||||
const real = ndarray(signal, [N]);
|
||||
const imag = ndarray(new Float64Array(N), [N]);
|
||||
|
||||
fft(1, real, imag);
|
||||
|
||||
const spectrum = new Float64Array(Math.floor(N / 2) + 1);
|
||||
const candidates = [];
|
||||
|
||||
for (let k = 0; k < spectrum.length; k++) {
|
||||
const magnitude = math.sqrt(real.get(k) ** 2 + imag.get(k) ** 2) / (N / 2);
|
||||
|
||||
if (!Number.isFinite(magnitude))
|
||||
throw new RangeError(`Spectrum computation overflowed at bin ${k}.`);
|
||||
|
||||
spectrum[k] = magnitude;
|
||||
|
||||
if (magnitude > 0.1)
|
||||
candidates.push({ frequencyHz: k * sampleRate / N, magnitude });
|
||||
}
|
||||
|
||||
const peaks = candidates
|
||||
.sort((a, b) => b.magnitude - a.magnitude)
|
||||
.map(({ frequencyHz, magnitude }) => ({
|
||||
frequencyHz: Math.round(frequencyHz),
|
||||
magnitude: Number(magnitude.toFixed(2))
|
||||
}));
|
||||
|
||||
const table =
|
||||
"<table><tr><th>Frequency (Hz)</th><th>Magnitude</th></tr>" +
|
||||
peaks.map(({ frequencyHz, magnitude }) =>
|
||||
`<tr><td>${frequencyHz}</td><td>${magnitude.toFixed(2)}</td></tr>`
|
||||
).join("") +
|
||||
"</table>";
|
||||
|
||||
const html = DOMPurify.sanitize(table, {
|
||||
ALLOWED_TAGS: ["table", "tbody", "tr", "th", "td"],
|
||||
ALLOWED_ATTR: [],
|
||||
RETURN_TRUSTED_TYPE: false
|
||||
});
|
||||
|
||||
return { peaks, html, signalLength: N };
|
||||
}
|
||||
export default analyzeSignal;
|
||||
// Generation time: 203.858s
|
||||
// Result: PASS
|
||||
@@ -0,0 +1,43 @@
|
||||
async function hexchain(toml) {
|
||||
const { parse } = await import('https://cdn.jsdelivr.net/npm/smol-toml@1.0.1/+esm');
|
||||
const config = parse(toml);
|
||||
const Ajv = (await import('https://cdn.jsdelivr.net/npm/ajv@8.12.0/+esm')).default;
|
||||
const ajv = new Ajv();
|
||||
const schema = {
|
||||
type: 'object',
|
||||
required: ['seed', 'count', 'label'],
|
||||
properties: {
|
||||
seed: { type: 'string' },
|
||||
count: { type: 'integer', minimum: 1, maximum: 10000 },
|
||||
label: { type: 'string', minLength: 1 }
|
||||
}
|
||||
};
|
||||
if (!ajv.validate(schema, config)) return { valid: false, errors: ajv.errorsText() };
|
||||
const seedrandom = (await import('https://cdn.jsdelivr.net/npm/seedrandom@3.0.5/+esm')).default;
|
||||
const rng = new seedrandom(config.seed);
|
||||
const nums = Array.from({ length: config.count }, () => rng());
|
||||
const { mean, standardDeviation, median } = await import('https://cdn.jsdelivr.net/npm/simple-statistics@7.8.3/+esm');
|
||||
const stats = {
|
||||
mean: +mean(nums).toFixed(6),
|
||||
stddev: +standardDeviation(nums).toFixed(6),
|
||||
median: +median(nums).toFixed(6)
|
||||
};
|
||||
const table = (await import('https://cdn.jsdelivr.net/npm/text-table@0.2.0/+esm')).default;
|
||||
const tableString = table([
|
||||
['Stat', 'Value'],
|
||||
['mean', String(stats.mean)],
|
||||
['stddev', String(stats.stddev)],
|
||||
['median', String(stats.median)]
|
||||
]);
|
||||
const DOMPurify = (await import('https://cdn.jsdelivr.net/npm/dompurify@3.0.6/+esm')).default;
|
||||
return {
|
||||
valid: true,
|
||||
label: config.label,
|
||||
stats,
|
||||
table: DOMPurify.sanitize('<pre class="stats">' + tableString + '</pre>'),
|
||||
count: config.count
|
||||
};
|
||||
}
|
||||
export default hexchain;
|
||||
// Generation time: 164.666s
|
||||
// Result: PASS
|
||||
@@ -0,0 +1,11 @@
|
||||
let loader;
|
||||
|
||||
export async function parseMarkdown(markdown) {
|
||||
loader ||= import('https://esm.sh/marked@12').then((m) => m.marked);
|
||||
const marked = await loader;
|
||||
const source = typeof markdown === 'string' ? markdown : '';
|
||||
return marked.parse(source, { gfm: true, breaks: false });
|
||||
}
|
||||
export default parseMarkdown;
|
||||
// Generation time: 59.989s
|
||||
// Result: PASS
|
||||
@@ -0,0 +1,36 @@
|
||||
async function processCSV(csv, { filterColumn, filterValue, groupBy, aggregateColumn, operation }) {
|
||||
const { default: Papa } = await import('https://cdn.jsdelivr.net/npm/papaparse@5.4.1/papaparse.min.js');
|
||||
const { default: _ } = await import('https://cdn.jsdelivr.net/npm/lodash@4.17.21/lodash.min.js');
|
||||
|
||||
const parsed = Papa.parse(csv, { header: true, skipEmptyLines: true });
|
||||
const data = parsed.data;
|
||||
|
||||
const filtered = data.filter(row => row[filterColumn] == filterValue);
|
||||
|
||||
const grouped = _.groupBy(filtered, groupBy);
|
||||
|
||||
const results = Object.keys(grouped).map(groupVal => {
|
||||
const rows = grouped[groupVal];
|
||||
const nums = rows.map(r => {
|
||||
const val = Number(r[aggregateColumn]);
|
||||
return isNaN(val) ? 0 : val;
|
||||
});
|
||||
|
||||
let result;
|
||||
if (operation === 'sum') {
|
||||
result = nums.reduce((a, b) => a + b, 0);
|
||||
} else if (operation === 'avg') {
|
||||
const sum = nums.reduce((a, b) => a + b, 0);
|
||||
result = sum / nums.length;
|
||||
} else if (operation === 'count') {
|
||||
result = nums.length;
|
||||
}
|
||||
|
||||
return { [groupBy]: groupVal, result };
|
||||
});
|
||||
|
||||
return results;
|
||||
}
|
||||
export default processCSV;
|
||||
// Generation time: 72.324s
|
||||
// Result: FAIL
|
||||
49
tests/7_scheduler/outputs/stealth_union-alpha EFF_high.js
Normal file
49
tests/7_scheduler/outputs/stealth_union-alpha EFF_high.js
Normal file
@@ -0,0 +1,49 @@
|
||||
async function findAvailableSlots(cal1, cal2, constraints) {
|
||||
const { DateTime } = await import('https://esm.sh/luxon@3.4.4');
|
||||
const { durationMinutes, searchRange, workHours } = constraints;
|
||||
const s = DateTime.fromISO(searchRange.start, { zone: 'utc' });
|
||||
const e = DateTime.fromISO(searchRange.end, { zone: 'utc' });
|
||||
const dur = { minutes: durationMinutes };
|
||||
const busy = [...cal1, ...cal2]
|
||||
.map(x => [DateTime.fromISO(x.start, { zone: 'utc' }), DateTime.fromISO(x.end, { zone: 'utc' })])
|
||||
.filter(([a, b]) => b > s && a < e)
|
||||
.map(([a, b]) => [a < s ? s : a, b > e ? e : b])
|
||||
.sort((a, b) => a[0] - b[0]);
|
||||
const merged = [];
|
||||
for (const [a, b] of busy) {
|
||||
const last = merged[merged.length - 1];
|
||||
if (!last || a > last[1]) merged.push([a, b]);
|
||||
else if (b > last[1]) last[1] = b;
|
||||
}
|
||||
const [wsh, wsm] = workHours.start.split(':').map(Number);
|
||||
const [weh, wem] = workHours.end.split(':').map(Number);
|
||||
const slots = [];
|
||||
for (let day = s.startOf('day'); day <= e; day = day.plus({ days: 1 })) {
|
||||
const ws = day.set({ hour: wsh, minute: wsm, second: 0, millisecond: 0 });
|
||||
const we = day.set({ hour: weh, minute: wem, second: 0, millisecond: 0 });
|
||||
const winS = ws < s ? s : ws;
|
||||
const winE = we > e ? e : we;
|
||||
if (winS >= winE) continue;
|
||||
let cur = winS;
|
||||
for (const [a, b] of merged) {
|
||||
if (b <= cur) continue;
|
||||
if (a >= winE) break;
|
||||
if (a > cur) add(cur, a < winE ? a : winE);
|
||||
if (b > cur) cur = b > winE ? winE : b;
|
||||
if (cur >= winE) break;
|
||||
}
|
||||
if (cur < winE) add(cur, winE);
|
||||
}
|
||||
function add(a, b) {
|
||||
let t = a;
|
||||
while (t.plus(dur) <= b) {
|
||||
const n = t.plus(dur);
|
||||
slots.push({ start: t.toUTC().toISO(), end: n.toUTC().toISO() });
|
||||
t = n;
|
||||
}
|
||||
}
|
||||
return slots;
|
||||
}
|
||||
export default findAvailableSlots;
|
||||
// Generation time: 191.955s
|
||||
// Result: PASS
|
||||
@@ -0,0 +1,29 @@
|
||||
async function validateJSON(data, schema) {
|
||||
if (!schema || typeof schema !== "object" || Array.isArray(schema))
|
||||
throw new TypeError("Schema must be a JSON Schema object.");
|
||||
|
||||
const [{ default: Ajv }, { default: addFormats }] = await Promise.all([
|
||||
import("https://esm.sh/ajv@8.17.1"),
|
||||
import("https://esm.sh/ajv-formats@3.0.1?deps=ajv@8.17.1")
|
||||
]);
|
||||
|
||||
const ajv = new Ajv({ allErrors: true, strict: false });
|
||||
addFormats(ajv);
|
||||
|
||||
const validate = ajv.compile(schema);
|
||||
if (validate.$async)
|
||||
throw new TypeError("Asynchronous schema extensions are not supported.");
|
||||
|
||||
const valid = validate(data);
|
||||
return {
|
||||
valid,
|
||||
errors: valid
|
||||
? []
|
||||
: (validate.errors ?? []).map(
|
||||
({ instancePath, message }) => `${instancePath || "/"}: ${message}`
|
||||
)
|
||||
};
|
||||
}
|
||||
export default validateJSON;
|
||||
// Generation time: 99.796s
|
||||
// Result: PASS
|
||||
@@ -0,0 +1,63 @@
|
||||
async function createStreamVisualizer(asyncIterable, options = {}) {
|
||||
const { maxPoints, alpha, width, height, yDomain } = options;
|
||||
|
||||
if (typeof asyncIterable?.[Symbol.asyncIterator] !== "function")
|
||||
throw new TypeError("Expected an async iterable.");
|
||||
|
||||
if (!Number.isSafeInteger(maxPoints) || maxPoints < 1)
|
||||
throw new RangeError("maxPoints must be a positive safe integer.");
|
||||
|
||||
if (!Number.isFinite(alpha) || alpha < 0 || alpha > 1)
|
||||
throw new RangeError("alpha must be between 0 and 1.");
|
||||
|
||||
if (![width, height].every(n => Number.isFinite(n) && n >= 0))
|
||||
throw new RangeError("width and height must be finite and nonnegative.");
|
||||
|
||||
if (
|
||||
!Array.isArray(yDomain) ||
|
||||
yDomain.length !== 2 ||
|
||||
!yDomain.every(Number.isFinite) ||
|
||||
yDomain[0] >= yDomain[1]
|
||||
)
|
||||
throw new RangeError("yDomain must contain two increasing finite numbers.");
|
||||
|
||||
const domain = [...yDomain];
|
||||
const d3 = await import("https://cdn.jsdelivr.net/npm/d3@7.9.0/+esm");
|
||||
const buffer = [];
|
||||
let cursor = 0, ema;
|
||||
|
||||
for await (const point of asyncIterable) {
|
||||
const { timestamp, value } = point ?? {};
|
||||
const time = timestamp instanceof Date ? timestamp.getTime() : timestamp;
|
||||
|
||||
if (!Number.isFinite(time) || !Number.isFinite(value))
|
||||
throw new TypeError("Each point needs a valid timestamp and finite value.");
|
||||
|
||||
ema = ema === undefined ? value : alpha * value + (1 - alpha) * ema;
|
||||
buffer[cursor] = { timestamp: time, value, ema };
|
||||
cursor = (cursor + 1) % maxPoints;
|
||||
}
|
||||
|
||||
const data = buffer.length === maxPoints
|
||||
? buffer.slice(cursor).concat(buffer.slice(0, cursor))
|
||||
: buffer;
|
||||
|
||||
if (!data.length) return { data, path: "" };
|
||||
|
||||
const x = d3.scaleLinear()
|
||||
.domain([data[0].timestamp, data[data.length - 1].timestamp])
|
||||
.range([0, width]);
|
||||
|
||||
const y = d3.scaleLinear()
|
||||
.domain(domain)
|
||||
.range([height, 0]);
|
||||
|
||||
const path = d3.line()
|
||||
.x(d => x(d.timestamp))
|
||||
.y(d => y(d.ema))(data) ?? "";
|
||||
|
||||
return { data, path };
|
||||
}
|
||||
export default createStreamVisualizer;
|
||||
// Generation time: 101.222s
|
||||
// Result: PASS
|
||||
Reference in New Issue
Block a user