@hpcc-js/util
Advanced tools
Comparing version 0.0.28 to 0.0.29
191
dist/util.js
@@ -15,2 +15,4 @@ (function (global, factory) { | ||
style.type = 'text/css'; | ||
head.appendChild(style); | ||
if (style.styleSheet){ | ||
@@ -21,6 +23,39 @@ style.styleSheet.cssText = css; | ||
} | ||
head.appendChild(style); | ||
return returnValue; | ||
} | ||
// Based on: https://tc39.github.io/ecma262/#sec-array.prototype.find | ||
function find(o, predicate) { | ||
// 1. Let O be ? ToObject(this value). | ||
if (o == null) { | ||
throw new TypeError('"o" is null or not defined'); | ||
} | ||
// 2. Let len be ? ToLength(? Get(O, "length")). | ||
// tslint:disable-next-line:no-bitwise | ||
var len = o.length >>> 0; | ||
// 3. If IsCallable(predicate) is false, throw a TypeError exception. | ||
if (typeof predicate !== "function") { | ||
throw new TypeError("predicate must be a function"); | ||
} | ||
// 4. If thisArg was supplied, let T be thisArg; else let T be undefined. | ||
var thisArg = arguments[1]; | ||
// 5. Let k be 0. | ||
var k = 0; | ||
// 6. Repeat, while k < len | ||
while (k < len) { | ||
// a. Let Pk be ! ToString(k). | ||
// b. Let kValue be ? Get(O, Pk). | ||
// c. Let testResult be ToBoolean(? Call(predicate, T, « kValue, k, O »)). | ||
// d. If testResult is true, return kValue. | ||
var kValue = o[k]; | ||
if (predicate.call(thisArg, kValue, k, o)) { | ||
return kValue; | ||
} | ||
// e. Increase k by 1. | ||
k++; | ||
} | ||
// 7. Return undefined. | ||
return undefined; | ||
} | ||
/*! ***************************************************************************** | ||
@@ -60,2 +95,130 @@ Copyright (c) Microsoft Corporation. All rights reserved. | ||
function __rest(s, e) { | ||
var t = {}; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) | ||
t[p] = s[p]; | ||
if (s != null && typeof Object.getOwnPropertySymbols === "function") | ||
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0) | ||
t[p[i]] = s[p[i]]; | ||
return t; | ||
} | ||
function __decorate(decorators, target, key, desc) { | ||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; | ||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); | ||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; | ||
return c > 3 && r && Object.defineProperty(target, key, r), r; | ||
} | ||
function __param(paramIndex, decorator) { | ||
return function (target, key) { decorator(target, key, paramIndex); } | ||
} | ||
function __metadata(metadataKey, metadataValue) { | ||
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); | ||
} | ||
function __awaiter(thisArg, _arguments, P, generator) { | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator.throw(value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
}); | ||
} | ||
function __generator(thisArg, body) { | ||
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; | ||
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; | ||
function verb(n) { return function (v) { return step([n, v]); }; } | ||
function step(op) { | ||
if (f) throw new TypeError("Generator is already executing."); | ||
while (_) try { | ||
if (f = 1, y && (t = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t; | ||
if (y = 0, t) op = [0, t.value]; | ||
switch (op[0]) { | ||
case 0: case 1: t = op; break; | ||
case 4: _.label++; return { value: op[1], done: false }; | ||
case 5: _.label++; y = op[1]; op = [0]; continue; | ||
case 7: op = _.ops.pop(); _.trys.pop(); continue; | ||
default: | ||
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } | ||
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } | ||
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } | ||
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } | ||
if (t[2]) _.ops.pop(); | ||
_.trys.pop(); continue; | ||
} | ||
op = body.call(thisArg, _); | ||
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } | ||
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; | ||
} | ||
} | ||
function __exportStar(m, exports) { | ||
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; | ||
} | ||
function __values(o) { | ||
var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0; | ||
if (m) return m.call(o); | ||
return { | ||
next: function () { | ||
if (o && i >= o.length) o = void 0; | ||
return { value: o && o[i++], done: !o }; | ||
} | ||
}; | ||
} | ||
function __read(o, n) { | ||
var m = typeof Symbol === "function" && o[Symbol.iterator]; | ||
if (!m) return o; | ||
var i = m.call(o), r, ar = [], e; | ||
try { | ||
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); | ||
} | ||
catch (error) { e = { error: error }; } | ||
finally { | ||
try { | ||
if (r && !r.done && (m = i["return"])) m.call(i); | ||
} | ||
finally { if (e) throw e.error; } | ||
} | ||
return ar; | ||
} | ||
function __spread() { | ||
for (var ar = [], i = 0; i < arguments.length; i++) | ||
ar = ar.concat(__read(arguments[i])); | ||
return ar; | ||
} | ||
function __await(v) { | ||
return this instanceof __await ? (this.v = v, this) : new __await(v); | ||
} | ||
function __asyncGenerator(thisArg, _arguments, generator) { | ||
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); | ||
var g = generator.apply(thisArg, _arguments || []), i, q = []; | ||
return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i; | ||
function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; } | ||
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } | ||
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } | ||
function fulfill(value) { resume("next", value); } | ||
function reject(value) { resume("throw", value); } | ||
function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } | ||
} | ||
function __asyncDelegator(o) { | ||
var i, p; | ||
return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i; | ||
function verb(n, f) { if (o[n]) i[n] = function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; }; } | ||
} | ||
function __asyncValues(o) { | ||
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); | ||
var m = o[Symbol.asyncIterator]; | ||
return m ? m.call(o) : typeof __values === "function" ? __values(o) : o[Symbol.iterator](); | ||
} | ||
// Ported to TypeScript from: https://github.com/bevacqua/hash-sum | ||
@@ -802,9 +965,3 @@ function pad(hash, len) { | ||
*/ | ||
/** | ||
* inner - return inner property of Object | ||
* Usage: inner("some.prop.to.locate", obj); | ||
* | ||
* @param prop - property to locate | ||
* @param obj - object to locate property in | ||
*/ function inner(prop, obj) { | ||
function inner(prop, obj) { | ||
if (prop === void 0 || obj === void 0) | ||
@@ -1232,2 +1389,3 @@ return void 0; | ||
exports.find = find; | ||
exports.Cache = Cache; | ||
@@ -1237,2 +1395,3 @@ exports.Dictionary = Dictionary; | ||
exports.Graph = Graph; | ||
exports.hashSum = hashSum; | ||
exports.Logging = Logging; | ||
@@ -1259,2 +1418,18 @@ exports.logger = logger; | ||
exports.join = join; | ||
exports.__extends = __extends; | ||
exports.__assign = __assign; | ||
exports.__rest = __rest; | ||
exports.__decorate = __decorate; | ||
exports.__param = __param; | ||
exports.__metadata = __metadata; | ||
exports.__awaiter = __awaiter; | ||
exports.__generator = __generator; | ||
exports.__exportStar = __exportStar; | ||
exports.__values = __values; | ||
exports.__read = __read; | ||
exports.__spread = __spread; | ||
exports.__await = __await; | ||
exports.__asyncGenerator = __asyncGenerator; | ||
exports.__asyncDelegator = __asyncDelegator; | ||
exports.__asyncValues = __asyncValues; | ||
@@ -1261,0 +1436,0 @@ Object.defineProperty(exports, '__esModule', { value: true }); |
@@ -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"]=t["@hpcc-js/util"]||{})}(this,function(t){"use strict";function e(t,e){function r(){this.constructor=t}l(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}function r(t,e){for(;t.length<e;)t="0"+t;return t}function n(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 i(t,e,r){return Object.keys(e).sort().reduce(function(t,n){return o(t,e[n],n,r)},t)}function o(t,e,r,o){var a=n(n(n(t,r),s(e)),typeof e);return null===e?n(a,"null"):void 0===e?n(a,"undefined"):"object"==typeof e?-1!==o.indexOf(e)?n(a,"[Circular]"+r):(o.push(e),i(a,e,o)):n(a,e.toString())}function s(t){return Object.prototype.toString.call(t)}function a(t){return r(o(0,t,"",[]).toString(16),8)}function u(t,e){if(void 0!==t&&void 0!==e){for(var r=0,n=t.split(".");r<n.length;r++){var i=n[r];if(!e.hasOwnProperty(i))return;e=e[i]}return e}}function h(t,e){var r={};for(var n in e){var i=e[n];i instanceof Array||"object"==typeof i&&(i=p(t[n],i)),n in t&&(t[n]===i||n in r&&r[n]===i)||(t[n]=i)}return t}function p(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,i=e;n<i.length;n++)h(t,i[n]);return t}function c(t,e){if("string"!=typeof e)return t;if(0===e.length)return t;for(;0===t.indexOf(e);)t=t.substring(1);for(;f(t,e);)t=t.substring(0,t.length-1);return t}function f(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 i=n.lastIndexOf(e,r);return-1!==i&&i===r}var l=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])},d=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++){e=arguments[r];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])}return t},g=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 a(d({},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}(),v=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}(),y=function(){function t(t,e,r,n){this._graph=t,this._parent=e,this._id=r,this._attrs=new v(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}(),_=function(t){function r(e,r,n,i){void 0===i&&(i={});var o=t.call(this,e,r,n,i)||this;return o._subgraphs=new v,o._vertices=new v,o._edges=new v,r&&r.addSubgraph(o),o}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 b?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}(y),b=function(t){function r(e,r,n,i,o){var s=t.call(this,e,r,n,o)||this;return s.inEdges=[],s.outEdges=[],s._label=i,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}(y),w=function(t){function r(e,r,n,i,o,s){var a=t.call(this,e,r,n,s)||this;if(!i)throw new Error("Missing source vertex");if(!o)throw new Error("Missing target vertex");return r.addEdge(a),a.source=i,a.source.addOutEdge(a),a.target=o,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=function(){function t(t,e){this._allSubgraphs=new v,this._allVertices=new v,this._allEdges=new v,this._attrs=new v,this._root=new _(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 _(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 i=new b(this,this._allSubgraphs.get(t.id()),e,r,n);return this._allVertices.set(e,i),i},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,i){if(this._allEdges.has(e))throw new Error("Edge already exists");var o=new w(this,this._allSubgraphs.get(t.id()),e,this._allVertices.get(r),this._allVertices.get(n),i);return this._allEdges.set(e,o),o},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 i=n[r];if(i.hasECLDefinition()){var o=i.getECLDefinition();(o&&!t||t===o.file)&&e.push(o)}}return e.sort(function(t,e){return t.line-e.line})},t}(),m=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}(),S=new Function("try{return global;}catch(e){return window;}")(),O=new Function("try{return this===window;}catch(e){return false;}"),x=new Function("try{return this===global;}catch(e){return false;}"),D=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 L={debug:"cyan",info:"green",notice:"grey",warning:"blue",error:"red",critical:"magenta",alert:"magenta",emergency:"magenta"},k=function(){function e(){}return e.prototype.write=function(e,r,n,i){x?console.log("["+e+"] "+t.Level[r].toUpperCase()+" "+n+": "+i):console.log("["+e+"] %c"+t.Level[r].toUpperCase()+"%c "+n+": "+i,"color:"+L[t.Level[r]],"")},e}(),I=function(){function e(){this._levelStack=new m,this._level=t.Level.info,this._filter="",this._writer=new k}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}(),N=I.Instance(),V=function(){function t(t){this._scopeID=t}return t.prototype.debug=function(t){N.debug(this._scopeID,t)},t.prototype.info=function(t){N.info(this._scopeID,t)},t.prototype.notice=function(t){N.notice(this._scopeID,t)},t.prototype.warning=function(t){N.warning(this._scopeID,t)},t.prototype.error=function(t){N.error(this._scopeID,t)},t.prototype.critical=function(t){N.critical(this._scopeID,t)},t.prototype.alert=function(t){N.alert(this._scopeID,t)},t.prototype.emergency=function(t){N.emergency(this._scopeID,t)},t.prototype.pushLevel=function(t){return N.pushLevel(t),this},t.prototype.popLevel=function(){return N.popLevel(),this},t}(),C=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}(),j=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 C(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 i=0,o=n;i<o.length;i++)o[i].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}(),M=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 m}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 M(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}(),X=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}(F),A=function(){function t(){this._espState={},this._espStateCache={},this._events=new j}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],i=a(e);if(n!==i){this._espStateCache[t]=i;var o=this._espState[t];this._espState[t]=e;var s={id:t,oldValue:o,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 i=0,o=e;i<o.length;i++){var s=o[i];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.Cache=g,t.Dictionary=v,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 i=t.split(" days "),o=i.length>1?parseFloat(i[0]):0,s=0,a=(i.length>1?i[1]:i[0]).split(":").reverse(),u=0;u<a.length;++u)s+=parseFloat(a[u])*Math.pow(60,u);return 24*o*60*60+s},t.Graph=E,t.Logging=I,t.logger=N,t.ScopedLogging=V,t.scopedLogger=function(t,e){return void 0===e&&(e=!0),e&&N.filter(t),new V(t)},t.inner=u,t.exists=function(t,e){return void 0!==u(t,e)},t.deepMixin=p,t.deepMixinT=function(t){void 0===t&&(t={});for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];return p.apply(void 0,[t].concat(e))},t.Observable=j,t.root=S,t.isBrowser=O,t.isNode=x,t.isTravis=D,t.XMLNode=M,t.SAXStackParser=F,t.xml2json=function(t){var e=new X;return e.parse(t),e.root},t.Stack=m,t.StateObject=A,t.trim=c,t.endsWith=f,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 c(t,"/")}).join("/")},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"]=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})}); | ||
//# sourceMappingURL=util.min.js.map |
// Based on: https://tc39.github.io/ecma262/#sec-array.prototype.find | ||
// Based on: https://tc39.github.io/ecma262/#sec-array.prototype.find | ||
export function find(o, predicate) { | ||
@@ -4,0 +3,0 @@ // 1. Let O be ? ToObject(this value). |
@@ -0,1 +1,2 @@ | ||
export * from "./array"; | ||
export * from "./cache"; | ||
@@ -5,2 +6,3 @@ export * from "./dictionary"; | ||
export * from "./graph"; | ||
export * from "./hashSum"; | ||
export * from "./logging"; | ||
@@ -15,1 +17,2 @@ export * from "./object"; | ||
export * from "./url"; | ||
export * from "tslib"; |
@@ -0,1 +1,2 @@ | ||
export * from "./array"; | ||
export * from "./cache"; | ||
@@ -5,2 +6,3 @@ export * from "./dictionary"; | ||
export * from "./graph"; | ||
export * from "./hashSum"; | ||
export * from "./logging"; | ||
@@ -15,1 +17,3 @@ export * from "./object"; | ||
export * from "./url"; | ||
// Third Party --- | ||
export * from "tslib"; |
@@ -8,9 +8,3 @@ /** | ||
*/ | ||
/** | ||
* inner - return inner property of Object | ||
* Usage: inner("some.prop.to.locate", obj); | ||
* | ||
* @param prop - property to locate | ||
* @param obj - object to locate property in | ||
*/ export function inner(prop, obj) { | ||
export function inner(prop, obj) { | ||
if (prop === void 0 || obj === void 0) | ||
@@ -17,0 +11,0 @@ return void 0; |
@@ -0,1 +1,2 @@ | ||
export * from "./array"; | ||
export * from "./cache"; | ||
@@ -5,2 +6,3 @@ export * from "./dictionary"; | ||
export * from "./graph"; | ||
export * from "./hashSum"; | ||
export * from "./logging"; | ||
@@ -15,1 +17,2 @@ export * from "./object"; | ||
export * from "./url"; | ||
export * from "tslib"; |
@@ -7,23 +7,25 @@ (function (factory) { | ||
else if (typeof define === "function" && define.amd) { | ||
define(["require", "exports", "./cache", "./dictionary", "./esp", "./graph", "./logging", "./object", "./observer", "./platform", "./saxParser", "./stack", "./stateful", "./string", "./url"], factory); | ||
define(["require", "exports", "tslib", "./array", "./cache", "./dictionary", "./esp", "./graph", "./hashSum", "./logging", "./object", "./observer", "./platform", "./saxParser", "./stack", "./stateful", "./string", "./url", "tslib"], factory); | ||
} | ||
})(function (require, exports) { | ||
"use strict"; | ||
function __export(m) { | ||
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; | ||
} | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
__export(require("./cache")); | ||
__export(require("./dictionary")); | ||
__export(require("./esp")); | ||
__export(require("./graph")); | ||
__export(require("./logging")); | ||
__export(require("./object")); | ||
__export(require("./observer")); | ||
__export(require("./platform")); | ||
__export(require("./saxParser")); | ||
__export(require("./stack")); | ||
__export(require("./stateful")); | ||
__export(require("./string")); | ||
__export(require("./url")); | ||
var tslib_1 = require("tslib"); | ||
tslib_1.__exportStar(require("./array"), exports); | ||
tslib_1.__exportStar(require("./cache"), exports); | ||
tslib_1.__exportStar(require("./dictionary"), exports); | ||
tslib_1.__exportStar(require("./esp"), exports); | ||
tslib_1.__exportStar(require("./graph"), exports); | ||
tslib_1.__exportStar(require("./hashSum"), exports); | ||
tslib_1.__exportStar(require("./logging"), exports); | ||
tslib_1.__exportStar(require("./object"), exports); | ||
tslib_1.__exportStar(require("./observer"), exports); | ||
tslib_1.__exportStar(require("./platform"), exports); | ||
tslib_1.__exportStar(require("./saxParser"), exports); | ||
tslib_1.__exportStar(require("./stack"), exports); | ||
tslib_1.__exportStar(require("./stateful"), exports); | ||
tslib_1.__exportStar(require("./string"), exports); | ||
tslib_1.__exportStar(require("./url"), exports); | ||
// Third Party --- | ||
tslib_1.__exportStar(require("tslib"), exports); | ||
}); |
{ | ||
"name": "@hpcc-js/util", | ||
"version": "0.0.28", | ||
"version": "0.0.29", | ||
"description": "hpcc-js - Utilities", | ||
@@ -24,6 +24,6 @@ "main": "lib/index.js", | ||
"devDependencies": { | ||
"@hpcc-js/bundle": "^0.0.4", | ||
"@hpcc-js/bundle": "^0.0.5", | ||
"rimraf": "^2.6.1", | ||
"typedoc": "^0.7.1", | ||
"typescript": "^2.3.4" | ||
"typescript": "^2.4.1" | ||
}, | ||
@@ -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
377179
4724