Skip to content

Commit

Permalink
Concat evaluation for XPath (#326)
Browse files Browse the repository at this point in the history
  • Loading branch information
ArnaudBuchholz committed Nov 25, 2019
1 parent 8d60f79 commit 4b8c89d
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions src/xml/xpath/concat.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/**
* @file XML XPath Concat object
* @since 1.0.1
*/
/*#ifndef(UMD)*/
"use strict";
/*global _gpfErrorDeclare*/ // Declare new gpf.Error names
/*global _gpfIgnore*/
/*global _gpfDefine*/
/*global _gpfXmlXPathBase*/
/*exported _gpfXmlXPathConcat*/
/*#endif*/

var _gpfXmlXPathConcat = _gpfDefine({
$class: "gpf.xml.xpath.Concat",
$extend: _gpfXmlXPathBase,

_xpath: [],

/**
* @inheritdoc
* @since 1.0.1
*/
select: function (contextNode, namespaces) {
return this._xpath.reduce(function (nodes, xpath) {
nodes = nodes.concat(xpath.evaluate(contextNode, namespaces));
}, []);
},

/**
* Implementation of the | operator
*
* @class gpf.xml.xpath.Concat
* @since 1.0.1
*/
constructor: function () {
this._xpath = [];
}
});

0 comments on commit 4b8c89d

Please sign in to comment.