@hpcc-js/util
Advanced tools
Comparing version 0.0.32 to 0.0.33
@@ -58,2 +58,21 @@ (function (global, factory) { | ||
} | ||
function compare(before, after) { | ||
var retVal = { | ||
unchanged: [], | ||
removed: [], | ||
added: after.slice(0) | ||
}; | ||
for (var _i = 0, before_1 = before; _i < before_1.length; _i++) { | ||
var row = before_1[_i]; | ||
var otherIdx = retVal.added.indexOf(row); | ||
if (otherIdx >= 0) { | ||
retVal.unchanged.push(row); | ||
retVal.added.splice(otherIdx, 1); | ||
} | ||
else { | ||
retVal.removed.push(row); | ||
} | ||
} | ||
return retVal; | ||
} | ||
@@ -1152,3 +1171,3 @@ /*! ***************************************************************************** | ||
SAXStackParser.prototype.walkDoc = function (node) { | ||
this.startXMLNode(node); | ||
var xmlNode = this._startXMLNode(node); | ||
if (node.attributes) { | ||
@@ -1160,2 +1179,3 @@ for (var i = 0; i < node.attributes.length; ++i) { | ||
} | ||
this.startXMLNode(xmlNode); | ||
if (node.childNodes) { | ||
@@ -1172,4 +1192,14 @@ for (var i = 0; i < node.childNodes.length; ++i) { | ||
} | ||
this.endXMLNode(node); | ||
this.endXMLNode(this.stack.pop()); | ||
}; | ||
SAXStackParser.prototype._startXMLNode = function (node) { | ||
var newNode = new XMLNode(node.nodeName); | ||
if (!this.stack.depth()) { | ||
this.root = newNode; | ||
} | ||
else { | ||
this.stack.top().appendChild(newNode); | ||
} | ||
return this.stack.push(newNode); | ||
}; | ||
SAXStackParser.prototype.parse = function (xml) { | ||
@@ -1188,13 +1218,4 @@ var domParser = new DOMParser(); | ||
SAXStackParser.prototype.startXMLNode = function (node) { | ||
var newNode = new XMLNode(node.nodeName); | ||
if (!this.stack.depth()) { | ||
this.root = newNode; | ||
} | ||
else { | ||
this.stack.top().appendChild(newNode); | ||
} | ||
return this.stack.push(newNode); | ||
}; | ||
SAXStackParser.prototype.endXMLNode = function (_node) { | ||
return this.stack.pop(); | ||
SAXStackParser.prototype.endXMLNode = function (node) { | ||
}; | ||
@@ -1215,4 +1236,4 @@ SAXStackParser.prototype.attributes = function (key, val) { | ||
XML2JSONParser.prototype.startXMLNode = function (node) { | ||
var e = _super.prototype.startXMLNode.call(this, node); | ||
switch (e.name) { | ||
_super.prototype.startXMLNode.call(this, node); | ||
switch (node.name) { | ||
case "xs:element": | ||
@@ -1225,7 +1246,5 @@ break; | ||
} | ||
return e; | ||
}; | ||
XML2JSONParser.prototype.endXMLNode = function (node) { | ||
var e = this.stack.top(); | ||
switch (e.name) { | ||
switch (node.name) { | ||
case "xs:element": | ||
@@ -1238,3 +1257,3 @@ break; | ||
} | ||
return _super.prototype.endXMLNode.call(this, node); | ||
_super.prototype.endXMLNode.call(this, node); | ||
}; | ||
@@ -1394,2 +1413,3 @@ return XML2JSONParser; | ||
exports.find = find; | ||
exports.compare = compare; | ||
exports.Cache = Cache; | ||
@@ -1396,0 +1416,0 @@ exports.Dictionary = Dictionary; |
@@ -1,2 +0,2 @@ | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e(t["@hpcc-js/util"]={})}(this,function(t){"use strict";function e(t,e){function r(){this.constructor=t}g(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}function r(t){var e="function"==typeof Symbol&&t[Symbol.iterator],r=0;return e?e.call(t):{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}}}function n(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),s=[];try{for(;(void 0===e||e-- >0)&&!(n=i.next()).done;)s.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return s}function o(t){return this instanceof o?(this.v=t,this):new o(t)}function i(t,e){for(;t.length<e;)t="0"+t;return t}function s(t,e){if(0===e.length)return t;for(var r=0;r<e.length;++r)t=(t<<5)-t+e.charCodeAt(r),t|=0;return t<0?-2*t:t}function a(t,e,r){return Object.keys(e).sort().reduce(function(t,n){return u(t,e[n],n,r)},t)}function u(t,e,r,n){var o=s(s(s(t,r),c(e)),typeof e);return null===e?s(o,"null"):void 0===e?s(o,"undefined"):"object"==typeof e?-1!==n.indexOf(e)?s(o,"[Circular]"+r):(n.push(e),a(o,e,n)):s(o,e.toString())}function c(t){return Object.prototype.toString.call(t)}function h(t){return i(u(0,t,"",[]).toString(16),8)}function p(t,e){if(void 0!==t&&void 0!==e){for(var r=0,n=t.split(".");r<n.length;r++){var o=n[r];if(!e.hasOwnProperty(o))return;e=e[o]}return e}}function f(t,e){var r={};for(var n in e){var o=e[n];o instanceof Array||"object"==typeof o&&(o=l(t[n],o)),n in t&&(t[n]===o||n in r&&r[n]===o)||(t[n]=o)}return t}function l(t){void 0===t&&(t={});for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];if("object"!=typeof t)throw new Error('Destination "'+t+'" must be an object.');for(var n=0,o=e;n<o.length;n++)f(t,o[n]);return t}function d(t,e){if("string"!=typeof e)return t;if(0===e.length)return t;for(;0===t.indexOf(e);)t=t.substring(1);for(;v(t,e);)t=t.substring(0,t.length-1);return t}function v(t,e,r){var n=t.toString();("number"!=typeof r||!isFinite(r)||Math.floor(r)!==r||r>n.length)&&(r=n.length),r-=e.length;var o=n.lastIndexOf(e,r);return-1!==o&&o===r}var g=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])},y=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++){e=arguments[r];for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o])}return t},_=function(){function t(t){this._cache={},this._calcID=t}return t.hash=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return h(y({},t))},t.prototype.has=function(t){return this._calcID(t)in this._cache},t.prototype.set=function(t){return this._cache[this._calcID(t)]=t,t},t.prototype.get=function(t,e){var r=this._cache[this._calcID(t)];return r||this.set(e())},t}(),b=function(){function t(t){if(this.store={},t)for(var e in t)this.set(e,t[e])}return t.prototype.set=function(t,e){var r=this.store[t];return this.store[t]=e,r},t.prototype.get=function(t){return this.store[t]},t.prototype.has=function(t){return void 0!==this.store[t]},t.prototype.remove=function(t){delete this.store[t]},t.prototype.keys=function(){var t=[];for(var e in this.store)t.push(e);return t},t.prototype.values=function(){var t=[];for(var e in this.store)t.push(this.store[e]);return t},t}(),w=function(){function t(t,e,r,n){this._graph=t,this._parent=e,this._id=r,this._attrs=new b(n)}return t.prototype.className=function(){return this.constructor.name},t.prototype.id=function(){return this._id},t.prototype.attrs=function(){return this._attrs},t.prototype.parent=function(){return this._parent},t.prototype.hasECLDefinition=function(){return void 0!==this._attrs.get("definition")},t.prototype.getECLDefinition=function(){var t=/([a-z]:\\(?:[-\w\.\d]+\\)*(?:[-\w\.\d]+)?|(?:\/[\w\.\-]+)+)\((\d*),(\d*)\)/.exec(this._attrs.get("definition"));if(t){var e=t[1],r=t[2],n=t[3];return e.replace("/./","/"),{id:this.id(),file:e,line:+r,column:+n}}throw new Error("Bad definition: "+this._attrs.get("definition"))},t}(),E=function(t){function r(e,r,n,o){void 0===o&&(o={});var i=t.call(this,e,r,n,o)||this;return i._subgraphs=new b,i._vertices=new b,i._edges=new b,r&&r.addSubgraph(i),i}return e(r,t),r.prototype.destroy=function(){var t=this;this._parent&&this._parent.removeSubgraph(this),this._edges.values().forEach(function(e){return t._graph.destroyEdge(e)}),this._vertices.values().forEach(function(e){return t._graph.destroyVertex(e)}),this._subgraphs.values().forEach(function(e){return t._graph.destroySubgraph(e)})},r.prototype.remove=function(){this._graph.destroySubgraph(this)},r.prototype.createSubgraph=function(t,e){return this._graph.createSubgraph(this,t,e)},r.prototype.addSubgraph=function(t){if(this._subgraphs.has(t.id()))throw new Error("Subgraph already exists");this._subgraphs.set(t.id(),t)},r.prototype.removeSubgraph=function(t){if(!this._subgraphs.has(t.id()))throw new Error("Subgraph does not exist");this._subgraphs.remove(t.id())},r.prototype.createVertex=function(t,e,r){return this._graph.createVertex(this,t,e,r)},r.prototype.addVertex=function(t){if(this._vertices.has(t.id()))throw new Error("Vertex already exists");this._vertices.set(t.id(),t)},r.prototype.removeVertex=function(t){if(!this._vertices.has(t.id()))throw new Error("Vertex does not exist");this._vertices.remove(t.id())},r.prototype.createEdge=function(t,e,r,n){return this._graph.createEdge(this,t,e,r,n)},r.prototype.addEdge=function(t){if(this._edges.has(t.id()))throw new Error("Edge already exists");this._edges.set(t.id(),t)},r.prototype.removeEdge=function(t){if(!this._edges.has(t.id()))throw new Error("Edge does not exist");this._edges.remove(t.id())},r.prototype.add=function(t){t instanceof r?this.addSubgraph(t):t instanceof m?this.addVertex(t):this.addEdge(t)},r.prototype.subgraphs=function(){return this._subgraphs.values()},r.prototype.vertices=function(){return this._vertices.values()},r.prototype.edges=function(){return this._edges.values()},r.prototype.getNearestDefinition=function(t){if(void 0===t&&(t=!1),this.hasECLDefinition())return this.getECLDefinition();var e=this.vertices();t&&(e=e.reverse());var r=null;return e.some(function(e){return!!(r=e.getNearestDefinition(t))}),r},r}(w),m=function(t){function r(e,r,n,o,i){var s=t.call(this,e,r,n,i)||this;return s.inEdges=[],s.outEdges=[],s._label=o,r.addVertex(s),s}return e(r,t),r.prototype.destroy=function(){var t=this;this._parent&&this._parent.removeVertex(this),this.inEdges.forEach(function(e){return t._graph.destroyEdge(e)}),this.outEdges.forEach(function(e){return t._graph.destroyEdge(e)})},r.prototype.label=function(){return this._label},r.prototype.addInEdge=function(t){this.inEdges.push(t)},r.prototype.removeInEdge=function(t){var e=this.inEdges.indexOf(t);if(e<0)throw new Error("In edge does not exist");this.inEdges.splice(e,1)},r.prototype.addOutEdge=function(t){this.outEdges.push(t)},r.prototype.removeOutEdge=function(t){var e=this.outEdges.indexOf(t);if(e<0)throw new Error("Out edge does not exist");this.outEdges.splice(e,1)},r.prototype.getNearestDefinition=function(t){if(void 0===t&&(t=!0),this.hasECLDefinition())return this.getECLDefinition();var e=null;return this.inEdges.some(function(r){return!!(e=r.getNearestDefinition(t))}),e},r}(w),S=function(t){function r(e,r,n,o,i,s){var a=t.call(this,e,r,n,s)||this;if(!o)throw new Error("Missing source vertex");if(!i)throw new Error("Missing target vertex");return r.addEdge(a),a.source=o,a.source.addOutEdge(a),a.target=i,a.target.addInEdge(a),a}return e(r,t),r.prototype.sourceID=function(){return this.source.id()},r.prototype.targetID=function(){return this.target.id()},r.prototype.destroy=function(){this._parent&&this._parent.removeEdge(this),this.source.removeOutEdge(this),this.target.removeInEdge(this)},r.prototype.getNearestDefinition=function(t){return void 0===t&&(t=!1),this.hasECLDefinition()?this.getECLDefinition():this.source.getNearestDefinition(t)},r}(E),O=function(){function t(t,e){this._allSubgraphs=new b,this._allVertices=new b,this._allEdges=new b,this._attrs=new b,this._root=new E(this,null,t,e),this._allSubgraphs.set(t,this._root)}return t.prototype.className=function(){return"Graph"},t.prototype.id=function(){return this._root.id()},t.prototype.attrs=function(){return this._attrs},t.prototype.parent=function(){return null},t.prototype.remove=function(){},t.prototype.subgraphs=function(){return this._root.subgraphs()},t.prototype.vertices=function(){return this._root.vertices()},t.prototype.edges=function(){return this._root.edges()},t.prototype.createSubgraph=function(t,e,r){if(this._allSubgraphs.has(e))throw new Error("Subgraph already exists");var n=new E(this,this._allSubgraphs.get(t.id()),e,r);return this._allSubgraphs.set(e,n),n},t.prototype.destroySubgraph=function(t){var e=this._allSubgraphs.get(t.id());if(!e)throw new Error("Subgraph does not exist");this._allSubgraphs.remove(e.id()),e.destroy()},t.prototype.createVertex=function(t,e,r,n){if(this._allVertices.has(e))throw new Error("Vertex already exists");var o=new m(this,this._allSubgraphs.get(t.id()),e,r,n);return this._allVertices.set(e,o),o},t.prototype.destroyVertex=function(t){var e=this._allVertices.get(t.id());if(!e)throw new Error("Vertex does not exist");this._allVertices.remove(e.id()),e.destroy()},t.prototype.createEdge=function(t,e,r,n,o){if(this._allEdges.has(e))throw new Error("Edge already exists");var i=new S(this,this._allSubgraphs.get(t.id()),e,this._allVertices.get(r),this._allVertices.get(n),o);return this._allEdges.set(e,i),i},t.prototype.destroyEdge=function(t){var e=this._allEdges.get(t.id());if(!e)throw new Error("Edge does not exist");this._allEdges.remove(e.id()),e.destroy()},t.prototype.allSubgraph=function(t){return this._allSubgraphs.get(t)},t.prototype.allSubgraphs=function(){var t=this;return this._allSubgraphs.values().filter(function(e){return e!==t._root})},t.prototype.allVertex=function(t){return this._allVertices.get(t)},t.prototype.allVertices=function(){return this._allVertices.values()},t.prototype.allEdge=function(t){return this._allEdges.get(t)},t.prototype.allEdges=function(){return this._allEdges.values()},t.prototype.getNearestDefinition=function(t){return void 0===t&&(t=!1),this._root.getNearestDefinition(t)},t.prototype.breakpointLocations=function(t){for(var e=[],r=0,n=this._allVertices.values();r<n.length;r++){var o=n[r];if(o.hasECLDefinition()){var i=o.getECLDefinition();(i&&!t||t===i.file)&&e.push(i)}}return e.sort(function(t,e){return t.line-e.line})},t}(),x=function(){function t(){this.stack=[]}return t.prototype.push=function(t){return this.stack.push(t),t},t.prototype.pop=function(){return this.stack.pop()},t.prototype.top=function(){return this.stack.length?this.stack[this.stack.length-1]:void 0},t.prototype.depth=function(){return this.stack.length},t}(),D=new Function("try{return global;}catch(e){return window;}")(),L=new Function("try{return this===window;}catch(e){return false;}"),I=new Function("try{return this===global;}catch(e){return false;}"),k=new Function("try{return process.env.TRAVIS;}catch(e){return false;}");!function(t){t[t.debug=0]="debug",t[t.info=1]="info",t[t.notice=2]="notice",t[t.warning=3]="warning",t[t.error=4]="error",t[t.critical=5]="critical",t[t.alert=6]="alert",t[t.emergency=7]="emergency"}(t.Level||(t.Level={}));var V={debug:"cyan",info:"green",notice:"grey",warning:"blue",error:"red",critical:"magenta",alert:"magenta",emergency:"magenta"},N=function(){function e(){}return e.prototype.write=function(e,r,n,o){I?console.log("["+e+"] "+t.Level[r].toUpperCase()+" "+n+": "+o):console.log("["+e+"] %c"+t.Level[r].toUpperCase()+"%c "+n+": "+o,"color:"+V[t.Level[r]],"")},e}(),C=function(){function e(){this._levelStack=new x,this._level=t.Level.info,this._filter="",this._writer=new N}return e.Instance=function(){return this._instance||(this._instance=new this)},e.prototype.stringify=function(t){var e=[];return JSON.stringify(t,function(t,r){if("object"==typeof r&&null!==r){if(-1!==e.indexOf(r))return;e.push(r)}return r},2)},e.prototype.writer=function(t){return void 0===t?this._writer:(this._writer=t,this)},e.prototype.log=function(t,e,r){t<this._level||this._filter&&this._filter!==e||("string"!=typeof r&&(r=this.stringify(r)),this._writer.write((new Date).toISOString(),t,e,r))},e.prototype.debug=function(e,r){this.log(t.Level.debug,e,r)},e.prototype.info=function(e,r){this.log(t.Level.info,e,r)},e.prototype.notice=function(e,r){this.log(t.Level.notice,e,r)},e.prototype.warning=function(e,r){this.log(t.Level.warning,e,r)},e.prototype.error=function(e,r){this.log(t.Level.error,e,r)},e.prototype.critical=function(e,r){this.log(t.Level.critical,e,r)},e.prototype.alert=function(e,r){this.log(t.Level.alert,e,r)},e.prototype.emergency=function(e,r){this.log(t.Level.emergency,e,r)},e.prototype.level=function(t){return void 0===t?this._level:(this._level=t,this)},e.prototype.pushLevel=function(t){return this._levelStack.push(this._level),this._level=t,this},e.prototype.popLevel=function(){return this._level=this._levelStack.pop(),this},e.prototype.filter=function(t){return void 0===t?this._filter:(this._filter=t,this)},e}(),j=C.Instance(),M=function(){function t(t){this._scopeID=t}return t.prototype.debug=function(t){j.debug(this._scopeID,t)},t.prototype.info=function(t){j.info(this._scopeID,t)},t.prototype.notice=function(t){j.notice(this._scopeID,t)},t.prototype.warning=function(t){j.warning(this._scopeID,t)},t.prototype.error=function(t){j.error(this._scopeID,t)},t.prototype.critical=function(t){j.critical(this._scopeID,t)},t.prototype.alert=function(t){j.alert(this._scopeID,t)},t.prototype.emergency=function(t){j.emergency(this._scopeID,t)},t.prototype.pushLevel=function(t){return j.pushLevel(t),this},t.prototype.popLevel=function(){return j.popLevel(),this},t}(),P=function(){function t(t,e,r){this.eventTarget=t,this.eventID=e,this.callback=r}return t.prototype.release=function(){this.eventTarget.removeObserver(this.eventID,this.callback)},t.prototype.unwatch=function(){this.release()},t}(),T=function(){function t(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this._eventObservers={},this._knownEvents=t}return t.prototype.addObserver=function(t,e){var r=this._eventObservers[t];return r||(r=[],this._eventObservers[t]=r),r.push(e),new P(this,t,e)},t.prototype.removeObserver=function(t,e){var r=this._eventObservers[t];if(r)for(var n=r.length-1;n>=0;--n)r[n]===e&&r.splice(n,1);return this},t.prototype.dispatchEvent=function(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];var n=this._eventObservers[t];if(n)for(var o=0,i=n;o<i.length;o++)i[o].apply(void 0,e);return this},t.prototype._hasObserver=function(t){var e=this._eventObservers[t];for(var r in e)if(e[r])return!0;return!1},t.prototype.hasObserver=function(t){if(void 0!==t)return this._hasObserver(t);for(var e in this._eventObservers)if(this._hasObserver(e))return!0;return!1},t}(),F=function(){function t(t){this.name="",this.$={},this._children=[],this.content="",this.name=t}return t.prototype.appendAttribute=function(t,e){this.$[t]=e},t.prototype.appendContent=function(t){this.content+=t},t.prototype.appendChild=function(t){this._children.push(t)},t.prototype.children=function(t){return void 0===t?this._children:this._children.filter(function(e){return e.name===t})},t}(),X=function(){function t(){this.stack=new x}return t.prototype.walkDoc=function(t){if(this.startXMLNode(t),t.attributes)for(r=0;r<t.attributes.length;++r){var e=t.attributes.item(r);this.attributes(e.nodeName,e.nodeValue)}if(t.childNodes)for(var r=0;r<t.childNodes.length;++r){var n=t.childNodes.item(r);n.nodeType===n.TEXT_NODE?this.characters(n.nodeValue):this.walkDoc(n)}this.endXMLNode(t)},t.prototype.parse=function(t){var e=(new DOMParser).parseFromString(t,"application/xml");this.startDocument(),this.walkDoc(e),this.endDocument()},t.prototype.startDocument=function(){},t.prototype.endDocument=function(){},t.prototype.startXMLNode=function(t){var e=new F(t.nodeName);return this.stack.depth()?this.stack.top().appendChild(e):this.root=e,this.stack.push(e)},t.prototype.endXMLNode=function(t){return this.stack.pop()},t.prototype.attributes=function(t,e){this.stack.top().appendAttribute(t,e)},t.prototype.characters=function(t){this.stack.top().appendContent(t)},t}(),A=function(t){function r(){return null!==t&&t.apply(this,arguments)||this}return e(r,t),r.prototype.startXMLNode=function(e){var r=t.prototype.startXMLNode.call(this,e);return r.name,r},r.prototype.endXMLNode=function(e){return this.stack.top().name,t.prototype.endXMLNode.call(this,e)},r}(X),R=function(){function t(){this._espState={},this._espStateCache={},this._events=new T}return t.prototype.clear=function(t){this._espState={},this._espStateCache={},void 0!==t&&this.set(t)},t.prototype.get=function(t,e){return void 0===t?this._espState:this.has(t)?this._espState[t]:e},t.prototype.set=function(t,e,r){return void 0===r&&(r=!1),"string"==typeof t?this.setSingle(t,e,r):this.setAll(t)},t.prototype.setSingle=function(t,e,r){var n=this._espStateCache[t],o=h(e);if(n!==o){this._espStateCache[t]=o;var i=this._espState[t];this._espState[t]=e;var s={id:t,oldValue:i,newValue:e};return r||(this._events.dispatchEvent("propChanged",s),this._events.dispatchEvent("changed",[s])),s}return null},t.prototype.setAll=function(t){var e=[];for(var r in t)if(t.hasOwnProperty(r)){var n=this.setSingle(r,t[r],!0);n&&e.push(n)}if(e.length){for(var o=0,i=e;o<i.length;o++){var s=i[o];this._events.dispatchEvent("propChanged",s)}this._events.dispatchEvent("changed",e)}return e},t.prototype.has=function(t){return void 0!==this._espState[t]},t.prototype.addObserver=function(t,e,r){if(this.isCallback(e)){if("changed"!==t)throw new Error("Invalid eventID: "+t);return this._events.addObserver(t,e)}if("propChanged"!==t)throw new Error("Invalid eventID: "+t);return this._events.addObserver(t,function(t){t.id===e&&r(t)})},t.prototype.on=function(t,e,r){if(this.isCallback(e))switch(t){case"changed":this._events.addObserver(t,e)}else switch(t){case"propChanged":this._events.addObserver(t,function(t){t.id===e&&r(t)})}return this},t.prototype.isCallback=function(t){return"function"==typeof t},t.prototype.hasEventListener=function(){return this._events.hasObserver()},t}();t.find=function(t,e){if(null==t)throw new TypeError('"o" is null or not defined');var r=t.length>>>0;if("function"!=typeof e)throw new TypeError("predicate must be a function");for(var n=arguments[1],o=0;o<r;){var i=t[o];if(e.call(n,i,o,t))return i;o++}},t.Cache=_,t.Dictionary=b,t.espTime2Seconds=function(t){if(!t)return 0;if(!isNaN(Number(t)))return Number(t);var e=t.indexOf("ns");if(-1!==e)return parseFloat(t.substr(0,e))/1e9;var r=t.indexOf("ms");if(-1!==r)return parseFloat(t.substr(0,r))/1e3;var n=t.indexOf("s");if(-1!==n&&-1===t.indexOf("days"))return parseFloat(t.substr(0,n));for(var o=t.split(" days "),i=o.length>1?parseFloat(o[0]):0,s=0,a=(o.length>1?o[1]:o[0]).split(":").reverse(),u=0;u<a.length;++u)s+=parseFloat(a[u])*Math.pow(60,u);return 24*i*60*60+s},t.Graph=O,t.hashSum=h,t.Logging=C,t.logger=j,t.ScopedLogging=M,t.scopedLogger=function(t,e){return void 0===e&&(e=!0),e&&j.filter(t),new M(t)},t.inner=p,t.exists=function(t,e){return void 0!==p(t,e)},t.deepMixin=l,t.deepMixinT=function(t){void 0===t&&(t={});for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];return l.apply(void 0,[t].concat(e))},t.Observable=T,t.root=D,t.isBrowser=L,t.isNode=I,t.isTravis=k,t.XMLNode=F,t.SAXStackParser=X,t.xml2json=function(t){var e=new A;return e.parse(t),e.root},t.Stack=x,t.StateObject=R,t.trim=d,t.endsWith=v,t.join=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return(t.length&&t[0].length&&"/"===t[0].charAt(0)?"/":"")+t.map(function(t){return d(t,"/")}).join("/")},t.__extends=e,t.__assign=y,t.__rest=function(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols)for(var o=0,n=Object.getOwnPropertySymbols(t);o<n.length;o++)e.indexOf(n[o])<0&&(r[n[o]]=t[n[o]]);return r},t.__decorate=function(t,e,r,n){var o,i=arguments.length,s=i<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s},t.__param=function(t,e){return function(r,n){e(r,n,t)}},t.__metadata=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},t.__awaiter=function(t,e,r,n){return new(r||(r=Promise))(function(o,i){function s(t){try{u(n.next(t))}catch(t){i(t)}}function a(t){try{u(n.throw(t))}catch(t){i(t)}}function u(t){t.done?o(t.value):new r(function(e){e(t.value)}).then(s,a)}u((n=n.apply(t,e||[])).next())})},t.__generator=function(t,e){function r(t){return function(e){return n([t,e])}}function n(r){if(o)throw new TypeError("Generator is already executing.");for(;u;)try{if(o=1,i&&(s=i[2&r[0]?"return":r[0]?"throw":"next"])&&!(s=s.call(i,r[1])).done)return s;switch(i=0,s&&(r=[0,s.value]),r[0]){case 0:case 1:s=r;break;case 4:return u.label++,{value:r[1],done:!1};case 5:u.label++,i=r[1],r=[0];continue;case 7:r=u.ops.pop(),u.trys.pop();continue;default:if(s=u.trys,!(s=s.length>0&&s[s.length-1])&&(6===r[0]||2===r[0])){u=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]<s[3])){u.label=r[1];break}if(6===r[0]&&u.label<s[1]){u.label=s[1],s=r;break}if(s&&u.label<s[2]){u.label=s[2],u.ops.push(r);break}s[2]&&u.ops.pop(),u.trys.pop();continue}r=e.call(t,u)}catch(t){r=[6,t],i=0}finally{o=s=0}if(5&r[0])throw r[1];return{value:r[0]?r[1]:void 0,done:!0}}var o,i,s,a,u={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return a={next:r(0),throw:r(1),return:r(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a},t.__exportStar=function(t,e){for(var r in t)e.hasOwnProperty(r)||(e[r]=t[r])},t.__values=r,t.__read=n,t.__spread=function(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(n(arguments[e]));return t},t.__await=o,t.__asyncGenerator=function(t,e,r){function n(t){p[t]&&(h[t]=function(e){return new Promise(function(r,n){f.push([t,e,r,n])>1||i(t,e)})})}function i(t,e){try{s(p[t](e))}catch(t){c(f[0][3],t)}}function s(t){t.value instanceof o?Promise.resolve(t.value.v).then(a,u):c(f[0][2],t)}function a(t){i("next",t)}function u(t){i("throw",t)}function c(t,e){t(e),f.shift(),f.length&&i(f[0][0],f[0][1])}if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var h,p=r.apply(t,e||[]),f=[];return h={},n("next"),n("throw"),n("return"),h[Symbol.asyncIterator]=function(){return this},h},t.__asyncDelegator=function(t){function e(e,i){t[e]&&(r[e]=function(r){return(n=!n)?{value:o(t[e](r)),done:"return"===e}:i?i(r):r})}var r,n;return r={},e("next"),e("throw",function(t){throw t}),e("return"),r[Symbol.iterator]=function(){return this},r},t.__asyncValues=function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator];return e?e.call(t):"function"==typeof r?r(t):t[Symbol.iterator]()},Object.defineProperty(t,"__esModule",{value:!0})}); | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e(t["@hpcc-js/util"]={})}(this,function(t){"use strict";function e(t,e){function r(){this.constructor=t}g(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}function r(t){var e="function"==typeof Symbol&&t[Symbol.iterator],r=0;return e?e.call(t):{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}}}function n(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),s=[];try{for(;(void 0===e||e-- >0)&&!(n=i.next()).done;)s.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return s}function o(t){return this instanceof o?(this.v=t,this):new o(t)}function i(t,e){for(;t.length<e;)t="0"+t;return t}function s(t,e){if(0===e.length)return t;for(var r=0;r<e.length;++r)t=(t<<5)-t+e.charCodeAt(r),t|=0;return t<0?-2*t:t}function a(t,e,r){return Object.keys(e).sort().reduce(function(t,n){return u(t,e[n],n,r)},t)}function u(t,e,r,n){var o=s(s(s(t,r),c(e)),typeof e);return null===e?s(o,"null"):void 0===e?s(o,"undefined"):"object"==typeof e?-1!==n.indexOf(e)?s(o,"[Circular]"+r):(n.push(e),a(o,e,n)):s(o,e.toString())}function c(t){return Object.prototype.toString.call(t)}function h(t){return i(u(0,t,"",[]).toString(16),8)}function p(t,e){if(void 0!==t&&void 0!==e){for(var r=0,n=t.split(".");r<n.length;r++){var o=n[r];if(!e.hasOwnProperty(o))return;e=e[o]}return e}}function f(t,e){var r={};for(var n in e){var o=e[n];o instanceof Array||"object"==typeof o&&(o=l(t[n],o)),n in t&&(t[n]===o||n in r&&r[n]===o)||(t[n]=o)}return t}function l(t){void 0===t&&(t={});for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];if("object"!=typeof t)throw new Error('Destination "'+t+'" must be an object.');for(var n=0,o=e;n<o.length;n++)f(t,o[n]);return t}function d(t,e){if("string"!=typeof e)return t;if(0===e.length)return t;for(;0===t.indexOf(e);)t=t.substring(1);for(;v(t,e);)t=t.substring(0,t.length-1);return t}function v(t,e,r){var n=t.toString();("number"!=typeof r||!isFinite(r)||Math.floor(r)!==r||r>n.length)&&(r=n.length),r-=e.length;var o=n.lastIndexOf(e,r);return-1!==o&&o===r}var g=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])},y=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++){e=arguments[r];for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o])}return t},_=function(){function t(t){this._cache={},this._calcID=t}return t.hash=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return h(y({},t))},t.prototype.has=function(t){return this._calcID(t)in this._cache},t.prototype.set=function(t){return this._cache[this._calcID(t)]=t,t},t.prototype.get=function(t,e){var r=this._cache[this._calcID(t)];return r||this.set(e())},t}(),b=function(){function t(t){if(this.store={},t)for(var e in t)this.set(e,t[e])}return t.prototype.set=function(t,e){var r=this.store[t];return this.store[t]=e,r},t.prototype.get=function(t){return this.store[t]},t.prototype.has=function(t){return void 0!==this.store[t]},t.prototype.remove=function(t){delete this.store[t]},t.prototype.keys=function(){var t=[];for(var e in this.store)t.push(e);return t},t.prototype.values=function(){var t=[];for(var e in this.store)t.push(this.store[e]);return t},t}(),w=function(){function t(t,e,r,n){this._graph=t,this._parent=e,this._id=r,this._attrs=new b(n)}return t.prototype.className=function(){return this.constructor.name},t.prototype.id=function(){return this._id},t.prototype.attrs=function(){return this._attrs},t.prototype.parent=function(){return this._parent},t.prototype.hasECLDefinition=function(){return void 0!==this._attrs.get("definition")},t.prototype.getECLDefinition=function(){var t=/([a-z]:\\(?:[-\w\.\d]+\\)*(?:[-\w\.\d]+)?|(?:\/[\w\.\-]+)+)\((\d*),(\d*)\)/.exec(this._attrs.get("definition"));if(t){var e=t[1],r=t[2],n=t[3];return e.replace("/./","/"),{id:this.id(),file:e,line:+r,column:+n}}throw new Error("Bad definition: "+this._attrs.get("definition"))},t}(),E=function(t){function r(e,r,n,o){void 0===o&&(o={});var i=t.call(this,e,r,n,o)||this;return i._subgraphs=new b,i._vertices=new b,i._edges=new b,r&&r.addSubgraph(i),i}return e(r,t),r.prototype.destroy=function(){var t=this;this._parent&&this._parent.removeSubgraph(this),this._edges.values().forEach(function(e){return t._graph.destroyEdge(e)}),this._vertices.values().forEach(function(e){return t._graph.destroyVertex(e)}),this._subgraphs.values().forEach(function(e){return t._graph.destroySubgraph(e)})},r.prototype.remove=function(){this._graph.destroySubgraph(this)},r.prototype.createSubgraph=function(t,e){return this._graph.createSubgraph(this,t,e)},r.prototype.addSubgraph=function(t){if(this._subgraphs.has(t.id()))throw new Error("Subgraph already exists");this._subgraphs.set(t.id(),t)},r.prototype.removeSubgraph=function(t){if(!this._subgraphs.has(t.id()))throw new Error("Subgraph does not exist");this._subgraphs.remove(t.id())},r.prototype.createVertex=function(t,e,r){return this._graph.createVertex(this,t,e,r)},r.prototype.addVertex=function(t){if(this._vertices.has(t.id()))throw new Error("Vertex already exists");this._vertices.set(t.id(),t)},r.prototype.removeVertex=function(t){if(!this._vertices.has(t.id()))throw new Error("Vertex does not exist");this._vertices.remove(t.id())},r.prototype.createEdge=function(t,e,r,n){return this._graph.createEdge(this,t,e,r,n)},r.prototype.addEdge=function(t){if(this._edges.has(t.id()))throw new Error("Edge already exists");this._edges.set(t.id(),t)},r.prototype.removeEdge=function(t){if(!this._edges.has(t.id()))throw new Error("Edge does not exist");this._edges.remove(t.id())},r.prototype.add=function(t){t instanceof r?this.addSubgraph(t):t instanceof m?this.addVertex(t):this.addEdge(t)},r.prototype.subgraphs=function(){return this._subgraphs.values()},r.prototype.vertices=function(){return this._vertices.values()},r.prototype.edges=function(){return this._edges.values()},r.prototype.getNearestDefinition=function(t){if(void 0===t&&(t=!1),this.hasECLDefinition())return this.getECLDefinition();var e=this.vertices();t&&(e=e.reverse());var r=null;return e.some(function(e){return!!(r=e.getNearestDefinition(t))}),r},r}(w),m=function(t){function r(e,r,n,o,i){var s=t.call(this,e,r,n,i)||this;return s.inEdges=[],s.outEdges=[],s._label=o,r.addVertex(s),s}return e(r,t),r.prototype.destroy=function(){var t=this;this._parent&&this._parent.removeVertex(this),this.inEdges.forEach(function(e){return t._graph.destroyEdge(e)}),this.outEdges.forEach(function(e){return t._graph.destroyEdge(e)})},r.prototype.label=function(){return this._label},r.prototype.addInEdge=function(t){this.inEdges.push(t)},r.prototype.removeInEdge=function(t){var e=this.inEdges.indexOf(t);if(e<0)throw new Error("In edge does not exist");this.inEdges.splice(e,1)},r.prototype.addOutEdge=function(t){this.outEdges.push(t)},r.prototype.removeOutEdge=function(t){var e=this.outEdges.indexOf(t);if(e<0)throw new Error("Out edge does not exist");this.outEdges.splice(e,1)},r.prototype.getNearestDefinition=function(t){if(void 0===t&&(t=!0),this.hasECLDefinition())return this.getECLDefinition();var e=null;return this.inEdges.some(function(r){return!!(e=r.getNearestDefinition(t))}),e},r}(w),S=function(t){function r(e,r,n,o,i,s){var a=t.call(this,e,r,n,s)||this;if(!o)throw new Error("Missing source vertex");if(!i)throw new Error("Missing target vertex");return r.addEdge(a),a.source=o,a.source.addOutEdge(a),a.target=i,a.target.addInEdge(a),a}return e(r,t),r.prototype.sourceID=function(){return this.source.id()},r.prototype.targetID=function(){return this.target.id()},r.prototype.destroy=function(){this._parent&&this._parent.removeEdge(this),this.source.removeOutEdge(this),this.target.removeInEdge(this)},r.prototype.getNearestDefinition=function(t){return void 0===t&&(t=!1),this.hasECLDefinition()?this.getECLDefinition():this.source.getNearestDefinition(t)},r}(E),O=function(){function t(t,e){this._allSubgraphs=new b,this._allVertices=new b,this._allEdges=new b,this._attrs=new b,this._root=new E(this,null,t,e),this._allSubgraphs.set(t,this._root)}return t.prototype.className=function(){return"Graph"},t.prototype.id=function(){return this._root.id()},t.prototype.attrs=function(){return this._attrs},t.prototype.parent=function(){return null},t.prototype.remove=function(){},t.prototype.subgraphs=function(){return this._root.subgraphs()},t.prototype.vertices=function(){return this._root.vertices()},t.prototype.edges=function(){return this._root.edges()},t.prototype.createSubgraph=function(t,e,r){if(this._allSubgraphs.has(e))throw new Error("Subgraph already exists");var n=new E(this,this._allSubgraphs.get(t.id()),e,r);return this._allSubgraphs.set(e,n),n},t.prototype.destroySubgraph=function(t){var e=this._allSubgraphs.get(t.id());if(!e)throw new Error("Subgraph does not exist");this._allSubgraphs.remove(e.id()),e.destroy()},t.prototype.createVertex=function(t,e,r,n){if(this._allVertices.has(e))throw new Error("Vertex already exists");var o=new m(this,this._allSubgraphs.get(t.id()),e,r,n);return this._allVertices.set(e,o),o},t.prototype.destroyVertex=function(t){var e=this._allVertices.get(t.id());if(!e)throw new Error("Vertex does not exist");this._allVertices.remove(e.id()),e.destroy()},t.prototype.createEdge=function(t,e,r,n,o){if(this._allEdges.has(e))throw new Error("Edge already exists");var i=new S(this,this._allSubgraphs.get(t.id()),e,this._allVertices.get(r),this._allVertices.get(n),o);return this._allEdges.set(e,i),i},t.prototype.destroyEdge=function(t){var e=this._allEdges.get(t.id());if(!e)throw new Error("Edge does not exist");this._allEdges.remove(e.id()),e.destroy()},t.prototype.allSubgraph=function(t){return this._allSubgraphs.get(t)},t.prototype.allSubgraphs=function(){var t=this;return this._allSubgraphs.values().filter(function(e){return e!==t._root})},t.prototype.allVertex=function(t){return this._allVertices.get(t)},t.prototype.allVertices=function(){return this._allVertices.values()},t.prototype.allEdge=function(t){return this._allEdges.get(t)},t.prototype.allEdges=function(){return this._allEdges.values()},t.prototype.getNearestDefinition=function(t){return void 0===t&&(t=!1),this._root.getNearestDefinition(t)},t.prototype.breakpointLocations=function(t){for(var e=[],r=0,n=this._allVertices.values();r<n.length;r++){var o=n[r];if(o.hasECLDefinition()){var i=o.getECLDefinition();(i&&!t||t===i.file)&&e.push(i)}}return e.sort(function(t,e){return t.line-e.line})},t}(),x=function(){function t(){this.stack=[]}return t.prototype.push=function(t){return this.stack.push(t),t},t.prototype.pop=function(){return this.stack.pop()},t.prototype.top=function(){return this.stack.length?this.stack[this.stack.length-1]:void 0},t.prototype.depth=function(){return this.stack.length},t}(),D=new Function("try{return global;}catch(e){return window;}")(),L=new Function("try{return this===window;}catch(e){return false;}"),I=new Function("try{return this===global;}catch(e){return false;}"),k=new Function("try{return process.env.TRAVIS;}catch(e){return false;}");!function(t){t[t.debug=0]="debug",t[t.info=1]="info",t[t.notice=2]="notice",t[t.warning=3]="warning",t[t.error=4]="error",t[t.critical=5]="critical",t[t.alert=6]="alert",t[t.emergency=7]="emergency"}(t.Level||(t.Level={}));var N={debug:"cyan",info:"green",notice:"grey",warning:"blue",error:"red",critical:"magenta",alert:"magenta",emergency:"magenta"},V=function(){function e(){}return e.prototype.write=function(e,r,n,o){I?console.log("["+e+"] "+t.Level[r].toUpperCase()+" "+n+": "+o):console.log("["+e+"] %c"+t.Level[r].toUpperCase()+"%c "+n+": "+o,"color:"+N[t.Level[r]],"")},e}(),C=function(){function e(){this._levelStack=new x,this._level=t.Level.info,this._filter="",this._writer=new V}return e.Instance=function(){return this._instance||(this._instance=new this)},e.prototype.stringify=function(t){var e=[];return JSON.stringify(t,function(t,r){if("object"==typeof r&&null!==r){if(-1!==e.indexOf(r))return;e.push(r)}return r},2)},e.prototype.writer=function(t){return void 0===t?this._writer:(this._writer=t,this)},e.prototype.log=function(t,e,r){t<this._level||this._filter&&this._filter!==e||("string"!=typeof r&&(r=this.stringify(r)),this._writer.write((new Date).toISOString(),t,e,r))},e.prototype.debug=function(e,r){this.log(t.Level.debug,e,r)},e.prototype.info=function(e,r){this.log(t.Level.info,e,r)},e.prototype.notice=function(e,r){this.log(t.Level.notice,e,r)},e.prototype.warning=function(e,r){this.log(t.Level.warning,e,r)},e.prototype.error=function(e,r){this.log(t.Level.error,e,r)},e.prototype.critical=function(e,r){this.log(t.Level.critical,e,r)},e.prototype.alert=function(e,r){this.log(t.Level.alert,e,r)},e.prototype.emergency=function(e,r){this.log(t.Level.emergency,e,r)},e.prototype.level=function(t){return void 0===t?this._level:(this._level=t,this)},e.prototype.pushLevel=function(t){return this._levelStack.push(this._level),this._level=t,this},e.prototype.popLevel=function(){return this._level=this._levelStack.pop(),this},e.prototype.filter=function(t){return void 0===t?this._filter:(this._filter=t,this)},e}(),j=C.Instance(),M=function(){function t(t){this._scopeID=t}return t.prototype.debug=function(t){j.debug(this._scopeID,t)},t.prototype.info=function(t){j.info(this._scopeID,t)},t.prototype.notice=function(t){j.notice(this._scopeID,t)},t.prototype.warning=function(t){j.warning(this._scopeID,t)},t.prototype.error=function(t){j.error(this._scopeID,t)},t.prototype.critical=function(t){j.critical(this._scopeID,t)},t.prototype.alert=function(t){j.alert(this._scopeID,t)},t.prototype.emergency=function(t){j.emergency(this._scopeID,t)},t.prototype.pushLevel=function(t){return j.pushLevel(t),this},t.prototype.popLevel=function(){return j.popLevel(),this},t}(),P=function(){function t(t,e,r){this.eventTarget=t,this.eventID=e,this.callback=r}return t.prototype.release=function(){this.eventTarget.removeObserver(this.eventID,this.callback)},t.prototype.unwatch=function(){this.release()},t}(),T=function(){function t(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this._eventObservers={},this._knownEvents=t}return t.prototype.addObserver=function(t,e){var r=this._eventObservers[t];return r||(r=[],this._eventObservers[t]=r),r.push(e),new P(this,t,e)},t.prototype.removeObserver=function(t,e){var r=this._eventObservers[t];if(r)for(var n=r.length-1;n>=0;--n)r[n]===e&&r.splice(n,1);return this},t.prototype.dispatchEvent=function(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];var n=this._eventObservers[t];if(n)for(var o=0,i=n;o<i.length;o++)i[o].apply(void 0,e);return this},t.prototype._hasObserver=function(t){var e=this._eventObservers[t];for(var r in e)if(e[r])return!0;return!1},t.prototype.hasObserver=function(t){if(void 0!==t)return this._hasObserver(t);for(var e in this._eventObservers)if(this._hasObserver(e))return!0;return!1},t}(),X=function(){function t(t){this.name="",this.$={},this._children=[],this.content="",this.name=t}return t.prototype.appendAttribute=function(t,e){this.$[t]=e},t.prototype.appendContent=function(t){this.content+=t},t.prototype.appendChild=function(t){this._children.push(t)},t.prototype.children=function(t){return void 0===t?this._children:this._children.filter(function(e){return e.name===t})},t}(),F=function(){function t(){this.stack=new x}return t.prototype.walkDoc=function(t){var e=this._startXMLNode(t);if(t.attributes)for(n=0;n<t.attributes.length;++n){var r=t.attributes.item(n);this.attributes(r.nodeName,r.nodeValue)}if(this.startXMLNode(e),t.childNodes)for(var n=0;n<t.childNodes.length;++n){var o=t.childNodes.item(n);o.nodeType===o.TEXT_NODE?this.characters(o.nodeValue):this.walkDoc(o)}this.endXMLNode(this.stack.pop())},t.prototype._startXMLNode=function(t){var e=new X(t.nodeName);return this.stack.depth()?this.stack.top().appendChild(e):this.root=e,this.stack.push(e)},t.prototype.parse=function(t){var e=(new DOMParser).parseFromString(t,"application/xml");this.startDocument(),this.walkDoc(e),this.endDocument()},t.prototype.startDocument=function(){},t.prototype.endDocument=function(){},t.prototype.startXMLNode=function(t){},t.prototype.endXMLNode=function(t){},t.prototype.attributes=function(t,e){this.stack.top().appendAttribute(t,e)},t.prototype.characters=function(t){this.stack.top().appendContent(t)},t}(),A=function(t){function r(){return null!==t&&t.apply(this,arguments)||this}return e(r,t),r.prototype.startXMLNode=function(e){t.prototype.startXMLNode.call(this,e),e.name},r.prototype.endXMLNode=function(e){e.name,t.prototype.endXMLNode.call(this,e)},r}(F),R=function(){function t(){this._espState={},this._espStateCache={},this._events=new T}return t.prototype.clear=function(t){this._espState={},this._espStateCache={},void 0!==t&&this.set(t)},t.prototype.get=function(t,e){return void 0===t?this._espState:this.has(t)?this._espState[t]:e},t.prototype.set=function(t,e,r){return void 0===r&&(r=!1),"string"==typeof t?this.setSingle(t,e,r):this.setAll(t)},t.prototype.setSingle=function(t,e,r){var n=this._espStateCache[t],o=h(e);if(n!==o){this._espStateCache[t]=o;var i=this._espState[t];this._espState[t]=e;var s={id:t,oldValue:i,newValue:e};return r||(this._events.dispatchEvent("propChanged",s),this._events.dispatchEvent("changed",[s])),s}return null},t.prototype.setAll=function(t){var e=[];for(var r in t)if(t.hasOwnProperty(r)){var n=this.setSingle(r,t[r],!0);n&&e.push(n)}if(e.length){for(var o=0,i=e;o<i.length;o++){var s=i[o];this._events.dispatchEvent("propChanged",s)}this._events.dispatchEvent("changed",e)}return e},t.prototype.has=function(t){return void 0!==this._espState[t]},t.prototype.addObserver=function(t,e,r){if(this.isCallback(e)){if("changed"!==t)throw new Error("Invalid eventID: "+t);return this._events.addObserver(t,e)}if("propChanged"!==t)throw new Error("Invalid eventID: "+t);return this._events.addObserver(t,function(t){t.id===e&&r(t)})},t.prototype.on=function(t,e,r){if(this.isCallback(e))switch(t){case"changed":this._events.addObserver(t,e)}else switch(t){case"propChanged":this._events.addObserver(t,function(t){t.id===e&&r(t)})}return this},t.prototype.isCallback=function(t){return"function"==typeof t},t.prototype.hasEventListener=function(){return this._events.hasObserver()},t}();t.find=function(t,e){if(null==t)throw new TypeError('"o" is null or not defined');var r=t.length>>>0;if("function"!=typeof e)throw new TypeError("predicate must be a function");for(var n=arguments[1],o=0;o<r;){var i=t[o];if(e.call(n,i,o,t))return i;o++}},t.compare=function(t,e){for(var r={unchanged:[],removed:[],added:e.slice(0)},n=0,o=t;n<o.length;n++){var i=o[n],s=r.added.indexOf(i);s>=0?(r.unchanged.push(i),r.added.splice(s,1)):r.removed.push(i)}return r},t.Cache=_,t.Dictionary=b,t.espTime2Seconds=function(t){if(!t)return 0;if(!isNaN(Number(t)))return Number(t);var e=t.indexOf("ns");if(-1!==e)return parseFloat(t.substr(0,e))/1e9;var r=t.indexOf("ms");if(-1!==r)return parseFloat(t.substr(0,r))/1e3;var n=t.indexOf("s");if(-1!==n&&-1===t.indexOf("days"))return parseFloat(t.substr(0,n));for(var o=t.split(" days "),i=o.length>1?parseFloat(o[0]):0,s=0,a=(o.length>1?o[1]:o[0]).split(":").reverse(),u=0;u<a.length;++u)s+=parseFloat(a[u])*Math.pow(60,u);return 24*i*60*60+s},t.Graph=O,t.hashSum=h,t.Logging=C,t.logger=j,t.ScopedLogging=M,t.scopedLogger=function(t,e){return void 0===e&&(e=!0),e&&j.filter(t),new M(t)},t.inner=p,t.exists=function(t,e){return void 0!==p(t,e)},t.deepMixin=l,t.deepMixinT=function(t){void 0===t&&(t={});for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];return l.apply(void 0,[t].concat(e))},t.Observable=T,t.root=D,t.isBrowser=L,t.isNode=I,t.isTravis=k,t.XMLNode=X,t.SAXStackParser=F,t.xml2json=function(t){var e=new A;return e.parse(t),e.root},t.Stack=x,t.StateObject=R,t.trim=d,t.endsWith=v,t.join=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return(t.length&&t[0].length&&"/"===t[0].charAt(0)?"/":"")+t.map(function(t){return d(t,"/")}).join("/")},t.__extends=e,t.__assign=y,t.__rest=function(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols)for(var o=0,n=Object.getOwnPropertySymbols(t);o<n.length;o++)e.indexOf(n[o])<0&&(r[n[o]]=t[n[o]]);return r},t.__decorate=function(t,e,r,n){var o,i=arguments.length,s=i<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s},t.__param=function(t,e){return function(r,n){e(r,n,t)}},t.__metadata=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},t.__awaiter=function(t,e,r,n){return new(r||(r=Promise))(function(o,i){function s(t){try{u(n.next(t))}catch(t){i(t)}}function a(t){try{u(n.throw(t))}catch(t){i(t)}}function u(t){t.done?o(t.value):new r(function(e){e(t.value)}).then(s,a)}u((n=n.apply(t,e||[])).next())})},t.__generator=function(t,e){function r(t){return function(e){return n([t,e])}}function n(r){if(o)throw new TypeError("Generator is already executing.");for(;u;)try{if(o=1,i&&(s=i[2&r[0]?"return":r[0]?"throw":"next"])&&!(s=s.call(i,r[1])).done)return s;switch(i=0,s&&(r=[0,s.value]),r[0]){case 0:case 1:s=r;break;case 4:return u.label++,{value:r[1],done:!1};case 5:u.label++,i=r[1],r=[0];continue;case 7:r=u.ops.pop(),u.trys.pop();continue;default:if(s=u.trys,!(s=s.length>0&&s[s.length-1])&&(6===r[0]||2===r[0])){u=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]<s[3])){u.label=r[1];break}if(6===r[0]&&u.label<s[1]){u.label=s[1],s=r;break}if(s&&u.label<s[2]){u.label=s[2],u.ops.push(r);break}s[2]&&u.ops.pop(),u.trys.pop();continue}r=e.call(t,u)}catch(t){r=[6,t],i=0}finally{o=s=0}if(5&r[0])throw r[1];return{value:r[0]?r[1]:void 0,done:!0}}var o,i,s,a,u={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return a={next:r(0),throw:r(1),return:r(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a},t.__exportStar=function(t,e){for(var r in t)e.hasOwnProperty(r)||(e[r]=t[r])},t.__values=r,t.__read=n,t.__spread=function(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(n(arguments[e]));return t},t.__await=o,t.__asyncGenerator=function(t,e,r){function n(t){p[t]&&(h[t]=function(e){return new Promise(function(r,n){f.push([t,e,r,n])>1||i(t,e)})})}function i(t,e){try{s(p[t](e))}catch(t){c(f[0][3],t)}}function s(t){t.value instanceof o?Promise.resolve(t.value.v).then(a,u):c(f[0][2],t)}function a(t){i("next",t)}function u(t){i("throw",t)}function c(t,e){t(e),f.shift(),f.length&&i(f[0][0],f[0][1])}if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var h,p=r.apply(t,e||[]),f=[];return h={},n("next"),n("throw"),n("return"),h[Symbol.asyncIterator]=function(){return this},h},t.__asyncDelegator=function(t){function e(e,i){t[e]&&(r[e]=function(r){return(n=!n)?{value:o(t[e](r)),done:"return"===e}:i?i(r):r})}var r,n;return r={},e("next"),e("throw",function(t){throw t}),e("return"),r[Symbol.iterator]=function(){return this},r},t.__asyncValues=function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator];return e?e.call(t):"function"==typeof r?r(t):t[Symbol.iterator]()},Object.defineProperty(t,"__esModule",{value:!0})}); | ||
//# sourceMappingURL=util.min.js.map |
export declare function find<T>(o: T[], predicate: (value: T, index: number) => boolean): T | undefined; | ||
export interface IDifferences { | ||
unchanged: any[]; | ||
removed: any[]; | ||
added: any[]; | ||
} | ||
export declare function compare(before: any[], after: any[]): IDifferences; |
@@ -34,1 +34,20 @@ // Based on: https://tc39.github.io/ecma262/#sec-array.prototype.find | ||
} | ||
export function compare(before, after) { | ||
var retVal = { | ||
unchanged: [], | ||
removed: [], | ||
added: after.slice(0) | ||
}; | ||
for (var _i = 0, before_1 = before; _i < before_1.length; _i++) { | ||
var row = before_1[_i]; | ||
var otherIdx = retVal.added.indexOf(row); | ||
if (otherIdx >= 0) { | ||
retVal.unchanged.push(row); | ||
retVal.added.splice(otherIdx, 1); | ||
} | ||
else { | ||
retVal.removed.push(row); | ||
} | ||
} | ||
return retVal; | ||
} |
@@ -19,7 +19,8 @@ import { StringAnyMap } from "./dictionary"; | ||
private walkDoc(node); | ||
private _startXMLNode(node); | ||
parse(xml: string): void; | ||
startDocument(): void; | ||
endDocument(): void; | ||
startXMLNode(node: Node): XMLNode; | ||
endXMLNode(_node: Node): XMLNode; | ||
startXMLNode(node: XMLNode): void; | ||
endXMLNode(node: XMLNode): void; | ||
attributes(key: string, val: any): void; | ||
@@ -26,0 +27,0 @@ characters(text: string): void; |
@@ -36,3 +36,3 @@ import * as tslib_1 from "tslib"; | ||
SAXStackParser.prototype.walkDoc = function (node) { | ||
this.startXMLNode(node); | ||
var xmlNode = this._startXMLNode(node); | ||
if (node.attributes) { | ||
@@ -44,2 +44,3 @@ for (var i = 0; i < node.attributes.length; ++i) { | ||
} | ||
this.startXMLNode(xmlNode); | ||
if (node.childNodes) { | ||
@@ -56,4 +57,14 @@ for (var i = 0; i < node.childNodes.length; ++i) { | ||
} | ||
this.endXMLNode(node); | ||
this.endXMLNode(this.stack.pop()); | ||
}; | ||
SAXStackParser.prototype._startXMLNode = function (node) { | ||
var newNode = new XMLNode(node.nodeName); | ||
if (!this.stack.depth()) { | ||
this.root = newNode; | ||
} | ||
else { | ||
this.stack.top().appendChild(newNode); | ||
} | ||
return this.stack.push(newNode); | ||
}; | ||
SAXStackParser.prototype.parse = function (xml) { | ||
@@ -72,13 +83,4 @@ var domParser = new DOMParser(); | ||
SAXStackParser.prototype.startXMLNode = function (node) { | ||
var newNode = new XMLNode(node.nodeName); | ||
if (!this.stack.depth()) { | ||
this.root = newNode; | ||
} | ||
else { | ||
this.stack.top().appendChild(newNode); | ||
} | ||
return this.stack.push(newNode); | ||
}; | ||
SAXStackParser.prototype.endXMLNode = function (_node) { | ||
return this.stack.pop(); | ||
SAXStackParser.prototype.endXMLNode = function (node) { | ||
}; | ||
@@ -100,4 +102,4 @@ SAXStackParser.prototype.attributes = function (key, val) { | ||
XML2JSONParser.prototype.startXMLNode = function (node) { | ||
var e = _super.prototype.startXMLNode.call(this, node); | ||
switch (e.name) { | ||
_super.prototype.startXMLNode.call(this, node); | ||
switch (node.name) { | ||
case "xs:element": | ||
@@ -110,7 +112,5 @@ break; | ||
} | ||
return e; | ||
}; | ||
XML2JSONParser.prototype.endXMLNode = function (node) { | ||
var e = this.stack.top(); | ||
switch (e.name) { | ||
switch (node.name) { | ||
case "xs:element": | ||
@@ -123,3 +123,3 @@ break; | ||
} | ||
return _super.prototype.endXMLNode.call(this, node); | ||
_super.prototype.endXMLNode.call(this, node); | ||
}; | ||
@@ -126,0 +126,0 @@ return XML2JSONParser; |
export declare function find<T>(o: T[], predicate: (value: T, index: number) => boolean): T | undefined; | ||
export interface IDifferences { | ||
unchanged: any[]; | ||
removed: any[]; | ||
added: any[]; | ||
} | ||
export declare function compare(before: any[], after: any[]): IDifferences; |
@@ -46,2 +46,22 @@ (function (factory) { | ||
exports.find = find; | ||
function compare(before, after) { | ||
var retVal = { | ||
unchanged: [], | ||
removed: [], | ||
added: after.slice(0) | ||
}; | ||
for (var _i = 0, before_1 = before; _i < before_1.length; _i++) { | ||
var row = before_1[_i]; | ||
var otherIdx = retVal.added.indexOf(row); | ||
if (otherIdx >= 0) { | ||
retVal.unchanged.push(row); | ||
retVal.added.splice(otherIdx, 1); | ||
} | ||
else { | ||
retVal.removed.push(row); | ||
} | ||
} | ||
return retVal; | ||
} | ||
exports.compare = compare; | ||
}); |
@@ -19,7 +19,8 @@ import { StringAnyMap } from "./dictionary"; | ||
private walkDoc(node); | ||
private _startXMLNode(node); | ||
parse(xml: string): void; | ||
startDocument(): void; | ||
endDocument(): void; | ||
startXMLNode(node: Node): XMLNode; | ||
endXMLNode(_node: Node): XMLNode; | ||
startXMLNode(node: XMLNode): void; | ||
endXMLNode(node: XMLNode): void; | ||
attributes(key: string, val: any): void; | ||
@@ -26,0 +27,0 @@ characters(text: string): void; |
@@ -47,3 +47,3 @@ (function (factory) { | ||
SAXStackParser.prototype.walkDoc = function (node) { | ||
this.startXMLNode(node); | ||
var xmlNode = this._startXMLNode(node); | ||
if (node.attributes) { | ||
@@ -55,2 +55,3 @@ for (var i = 0; i < node.attributes.length; ++i) { | ||
} | ||
this.startXMLNode(xmlNode); | ||
if (node.childNodes) { | ||
@@ -67,4 +68,14 @@ for (var i = 0; i < node.childNodes.length; ++i) { | ||
} | ||
this.endXMLNode(node); | ||
this.endXMLNode(this.stack.pop()); | ||
}; | ||
SAXStackParser.prototype._startXMLNode = function (node) { | ||
var newNode = new XMLNode(node.nodeName); | ||
if (!this.stack.depth()) { | ||
this.root = newNode; | ||
} | ||
else { | ||
this.stack.top().appendChild(newNode); | ||
} | ||
return this.stack.push(newNode); | ||
}; | ||
SAXStackParser.prototype.parse = function (xml) { | ||
@@ -83,13 +94,4 @@ var domParser = new DOMParser(); | ||
SAXStackParser.prototype.startXMLNode = function (node) { | ||
var newNode = new XMLNode(node.nodeName); | ||
if (!this.stack.depth()) { | ||
this.root = newNode; | ||
} | ||
else { | ||
this.stack.top().appendChild(newNode); | ||
} | ||
return this.stack.push(newNode); | ||
}; | ||
SAXStackParser.prototype.endXMLNode = function (_node) { | ||
return this.stack.pop(); | ||
SAXStackParser.prototype.endXMLNode = function (node) { | ||
}; | ||
@@ -111,4 +113,4 @@ SAXStackParser.prototype.attributes = function (key, val) { | ||
XML2JSONParser.prototype.startXMLNode = function (node) { | ||
var e = _super.prototype.startXMLNode.call(this, node); | ||
switch (e.name) { | ||
_super.prototype.startXMLNode.call(this, node); | ||
switch (node.name) { | ||
case "xs:element": | ||
@@ -121,7 +123,5 @@ break; | ||
} | ||
return e; | ||
}; | ||
XML2JSONParser.prototype.endXMLNode = function (node) { | ||
var e = this.stack.top(); | ||
switch (e.name) { | ||
switch (node.name) { | ||
case "xs:element": | ||
@@ -134,3 +134,3 @@ break; | ||
} | ||
return _super.prototype.endXMLNode.call(this, node); | ||
_super.prototype.endXMLNode.call(this, node); | ||
}; | ||
@@ -137,0 +137,0 @@ return XML2JSONParser; |
{ | ||
"name": "@hpcc-js/util", | ||
"version": "0.0.32", | ||
"version": "0.0.33", | ||
"description": "hpcc-js - Utilities", | ||
@@ -24,6 +24,6 @@ "main": "lib/index.js", | ||
"devDependencies": { | ||
"@hpcc-js/bundle": "^0.0.8", | ||
"@hpcc-js/bundle": "^0.0.9", | ||
"rimraf": "^2.6.1", | ||
"typedoc": "^0.7.1", | ||
"typescript": "^2.4.1" | ||
"typescript": "^2.4.2" | ||
}, | ||
@@ -30,0 +30,0 @@ "repository": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
381827
4798