"use strict"; // Simple data type to represent a query path and corresponding schema path tied together, because these are basically always used together, and it would bloat up the implementation code otherwise function createInstance({ queryPath, schemaPath, queryObject, schemaObject }) { return { query: queryPath, schema: schemaPath, child: function (property, { queryOverride, schemaOverride } = {}) { return createInstance({ queryPath: queryPath.concat([ property ]), schemaPath: schemaPath.concat([ property ]), queryObject: queryOverride ?? queryObject[property], schemaObject: schemaOverride ?? schemaObject[property] }); } }; } module.exports = function createCursor({ query, schema }) { return createInstance({ queryPath: [], schemaPath: [], queryObject: query, schemaObject: schema }); };