Subroutines get access to the context with an `evaluator` property, and this signature of a context object allows for extending it with other things in the future. My suggestion would be to add an `options` key to this, containing custom options that were specified during the initial `surgeon(options)` call, such that a developer can specify custom options for their custom subroutines. A (synthetic) example: ```js let extract = surgeon({ options: { magicNumber: 42 }, subroutines: { addMagicNumber: function (input, _values, context) { return `${input} ${context.options.magicNumber}`; } } }); // ... extract("select .foo {1}[0] | read property textContents | addMagicNumber", someContent); ``` EDIT: To clarify, this is particularly useful for accommodating eg. third-party custom subroutines that can take initialization options, as well as more complex constructions where a specific surgeon invocation might specify some options for that particular extraction (like, for example, switch/match arms that are difficult to express in the DSL).
This issue appears to be discussing a feature request or bug report related to the repository. Based on the content, it seems to be resolved. The issue was opened by joepie91 and has received 1 comments.