MCPcopy Create free account
hub / github.com/cortex-js/compute-engine / formOk

Function formOk

benchmarks/audit/audit.ts:200–206  ·  view source on GitHub ↗
(form: string, text: string)

Source from the content-addressed store, hash-verified

198 });
199}
200function formOk(form: string, text: string) {
201 if (form === 'polynomial') return !/sqrt|√|abs|\|/i.test(text) && !/\^\s*\(?-?\d*\s*\/\s*\d/.test(text) && !/\^-?0?\.\d/.test(text);
202 // "expanded" = no remaining grouped factor. CE's plain-text form
203 // parenthesizes multi-digit exponents (x^(31)) — those are not groups.
204 if (form === 'expanded') return !text.replace(/\^\(-?\d+\)/g, '^#').includes('(');
205 return true;
206}
207function classify(c: any, res: any) {
208 if (!res || res.status === 'error') return { v: 'error', note: res?.error };
209 if (res.status === 'timeout') return { v: 'error', note: 'timeout' };

Callers 1

classifyFunction · 0.85

Calls 1

replaceMethod · 0.65

Tested by

no test coverage detected