Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export default function( addExtensions ) {
const evaluator = new XPathJS.XPathEvaluator();
/*
* Note: it's inefficient to extend XPathJS here (for every model instance)
* instead of just once in the prototype.
*
* However, this is done to prevent breaking Medic Mobile.
* The performance impact is probably negligible, since we don't instantiate
* models very often.
*
* In any case, you don't have to use it like this. It was done for
* Enketo Validate only. In an app that doesn't override enketo-xpathjs,
* I'd recommend using `require('extension')(require('enketo-xpathjs'))` instead
* and leave the addExtensions parameter empty here.
*/
if ( typeof addExtensions === 'function' ) {
addExtensions( XPathJS );