There is a way to reference functions defined elsewhere in a design doc. See:
https://blog.cloudant.com/2020/07/24/JSON-Schema-Validation.html#adding-json-schema-validation-into-a-vdu-function I haven't done this in a while but hopefully this is useful. Glynn On Fri, 1 Dec 2023, 20:36 TDAS, <[email protected]> wrote: > Is there an efficient way of using a stored function within views, without > having the function redeclared for every document that’s parsed? > > EG if it was possible to declare a function outside the doc parser: > > const matcher = ({name, title}) => {/* do stuff here */} > > const formatter = ({info}) => {/* stuff */} > > function (doc) { > if(matcher(doc)) { > emit(doc._id, formatter(doc)) > } > }
