1
0
Fork 0
Code Issues Pull requests Projects Releases 2 Packages Wiki Activity Actions Pages

Add JavaScript and TypeScript reference adapter

This commit is contained in:
Andraxion 2026-07-29 14:39:53 -04:00
parent cb52bf8ae6
commit 58c0196be5
11 changed files with 1341 additions and 0 deletions

View file

@ -0,0 +1,8 @@
import { Service } from "./service.mjs";
export { clamp } from "./shared.js";
throw new Error("The reference adapter must never execute project code");
export function applicationName() {
return Service.name;
}

View file

@ -0,0 +1,14 @@
import { clamp } from "./shared.js";
export class Service {
run(value) {
return clamp(value);
}
}
export const buildService = (enabled) => {
if (enabled) {
return new Service();
}
return null;
};

View file

@ -0,0 +1,11 @@
export const DEFAULT_LIMIT = 3;
export function clamp(value, limit = DEFAULT_LIMIT) {
if (value < 0) {
return 0;
}
if (value > limit) {
return limit;
}
return value;
}

View file

@ -0,0 +1,5 @@
export { Service } from "./service.mjs";
export function execute(worker, value) {
return worker.run(value);
}