MCPcopy Create free account
hub / github.com/dailydotdev/apps / add

Function add

packages/world-kit/src/record.js:135–150  ·  view source on GitHub ↗
(kind, args)

Source from the content-addressed store, hash-verified

133 const palette = Object.freeze(Object.fromEntries(keys.map((k) => [k, k])));
134
135 const add = (kind, args) => {
136 const spec = GEOM[kind];
137 const a = spec.args.map(([name, min, max, dflt], i) => {
138 const raw = args[i] ?? dflt;
139 if (!isNum(raw)) {
140 throw new Fail(`${kind}(): argument "${name}" must be a finite number, got ${JSON.stringify(raw)}`, ops.length);
141 }
142 if (raw < min || raw > max) {
143 throw new Fail(`${kind}(): argument "${name}" is ${raw}, outside the allowed ${min} to ${max}`, ops.length);
144 }
145 return spec.args[i][3] !== undefined ? Math.round(raw) : raw;
146 });
147 const op = { g: kind, a, m: 'stone', o: {}, p: [0, 0, 0], r: [0, 0, 0], s: [1, 1, 1] };
148 ops.push(op);
149 return new Shape(op);
150 };
151
152 const api = {
153 P: palette,

Callers 7

createRecorderFunction · 0.70
MentionedToolsWidgetFunction · 0.50
SquadStackFunction · 0.50
ProfileUserStackFunction · 0.50
ProfileUserHotTakesFunction · 0.50
ProfileUserGearFunction · 0.50

Calls 2

isNumFunction · 0.85
pushMethod · 0.80

Tested by

no test coverage detected