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

Function makeRule

test/compute-engine/rules.test.ts:301–308  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

299 expect(result?.json).toEqual(['Add', ['Add', 1, 1], 5]);
300 });
301
302 it('a replacement that only changes the form counts as a change', () => {
303 // The rule returns the canonical variant of a raw expression: the value
304 // is structurally the same, but the form differs. Before PR #305 this
305 // was treated as "no change" and replace() returned null.
306 const expr = ce.expr(['Multiply', 2, 'x'], { form: 'raw' });
307 const rule = {
308 match: ['Multiply', '_a', '_b'],
309 replace: (e) => e.canonical,
310 };
311 const result = expr.replace(rule);

Callers 1

rules.test.tsFile · 0.85

Calls 1

numberMethod · 0.65

Tested by

no test coverage detected