0.8.0 • Published 10 months ago

@strudel.cycles/eval v0.8.0

Weekly downloads
-
License
AGPL-3.0-or-later
Repository
github
Last release
10 months ago

@strudel.cycles/eval

This package contains the strudel code transformer and evaluator. It allows creating strudel patterns from input code that is optimized for minimal keystrokes and human readability.

Deprecation Note

This package will not be developed further. Consider using @strudel.cycles/transpiler as a replacement.

Install

npm i @strudel.cycles/eval --save

Example

import { evalScope } from '@strudel.cycles/core';
import { evaluate } from '@strudel.cycles/eval';

evalScope(
  import('@strudel.cycles/core'),
  // import other strudel packages here
); // add strudel to eval scope

async function run(code) {
  const { pattern } = await evaluate(code);
  const events = pattern.firstCycle();
  console.log(events.map((e) => e.show()).join('\n'));
}

run('sequence([a3, [b3, c4]])');

yields:

(0/1 -> 1/2, 0/1 -> 1/2, a3)
(1/2 -> 3/4, 1/2 -> 3/4, b3)
(3/4 -> 1/1, 3/4 -> 1/1, c4)

play with @strudel.cycles/eval on codesandbox

Dev Notes

shift-traverser is currently monkey patched because its package.json uses estraverse@^4.2.0, which does not support the spread operator (Error: Unknown node type SpreadProperty.). By monkey patched, I mean I copied the source of shift-traverser to a subfolder and installed the dependencies (shift-spec + estraverse@^5.3.0)

0.8.0

10 months ago

0.7.1

1 year ago

0.7.0

1 year ago

0.6.2

1 year ago

0.6.1

1 year ago

0.6.0

1 year ago

0.5.0

1 year ago

0.3.0

2 years ago

0.4.1

1 year ago

0.3.2

2 years ago

0.4.0

1 year ago

0.3.1

2 years ago

0.1.2

2 years ago

0.2.0

2 years ago

0.1.3

2 years ago

0.1.0

2 years ago

0.1.1

2 years ago

0.0.3

2 years ago

0.0.5

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago