Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@deephaven/utils

Package Overview
Dependencies
Maintainers
4
Versions
785
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@deephaven/utils - npm Package Compare versions

Comparing version 0.4.0 to 0.4.1-modules.0

49

dist/CanceledPromiseError.js

@@ -1,52 +0,13 @@

function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function _wrapNativeSuper(Class) { var _cache = typeof Map === "function" ? new Map() : undefined; _wrapNativeSuper = function _wrapNativeSuper(Class) { if (Class === null || !_isNativeFunction(Class)) return Class; if (typeof Class !== "function") { throw new TypeError("Super expression must either be null or a function"); } if (typeof _cache !== "undefined") { if (_cache.has(Class)) return _cache.get(Class); _cache.set(Class, Wrapper); } function Wrapper() { return _construct(Class, arguments, _getPrototypeOf(this).constructor); } Wrapper.prototype = Object.create(Class.prototype, { constructor: { value: Wrapper, enumerable: false, writable: true, configurable: true } }); return _setPrototypeOf(Wrapper, Class); }; return _wrapNativeSuper(Class); }
function _construct(Parent, args, Class) { if (_isNativeReflectConstruct()) { _construct = Reflect.construct; } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); }
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
function _isNativeFunction(fn) { return Function.toString.call(fn).indexOf("[native code]") !== -1; }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var CanceledPromiseError = /*#__PURE__*/function (_Error) {
_inherits(CanceledPromiseError, _Error);
class CanceledPromiseError extends Error {
constructor() {
super(...arguments);
var _super = _createSuper(CanceledPromiseError);
function CanceledPromiseError() {
var _this;
_classCallCheck(this, CanceledPromiseError);
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _super.call.apply(_super, [this].concat(args));
_defineProperty(_assertThisInitialized(_this), "isCanceled", true);
return _this;
_defineProperty(this, "isCanceled", true);
}
return CanceledPromiseError;
}( /*#__PURE__*/_wrapNativeSuper(Error));
}
export default CanceledPromiseError;
//# sourceMappingURL=CanceledPromiseError.js.map

72

dist/ColorUtils.js

@@ -1,53 +0,35 @@

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
class ColorUtils {
/**
* Checks if a background color is dark (i.e. should use a light foreground).
*
* @param {string} background the background color
*/
static isDark(background) {
var d = document.createElement('div');
d.style.display = 'none';
d.style.color = background;
var computedColor = getComputedStyle(document.body.appendChild(d)).color;
var colorTokens = computedColor.match(/\d+/g);
var color = [];
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
if (colorTokens) {
color = colorTokens.map(a => parseInt(a, 10));
} else {
throw new Error("Invalid color received. Got ".concat(computedColor));
}
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
document.body.removeChild(d);
var brightness = ColorUtils.getBrightness(color);
return brightness < 125;
} // Note: leaving this as arbitrary length number[] in case of RGBA().
var ColorUtils = /*#__PURE__*/function () {
function ColorUtils() {
_classCallCheck(this, ColorUtils);
static getBrightness(color) {
// http://www.w3.org/TR/AERT#color-contrast
return Math.round((color[0] * 299 + color[1] * 587 + color[2] * 114) / 1000);
}
_createClass(ColorUtils, null, [{
key: "isDark",
value:
/**
* Checks if a background color is dark (i.e. should use a light foreground).
*
* @param {string} background the background color
*/
function isDark(background) {
var d = document.createElement('div');
d.style.display = 'none';
d.style.color = background;
var computedColor = getComputedStyle(document.body.appendChild(d)).color;
var colorTokens = computedColor.match(/\d+/g);
var color = [];
}
if (colorTokens) {
color = colorTokens.map(function (a) {
return parseInt(a, 10);
});
} else {
throw new Error("Invalid color received. Got ".concat(computedColor));
}
document.body.removeChild(d);
var brightness = ColorUtils.getBrightness(color);
return brightness < 125;
} // Note: leaving this as arbitrary length number[] in case of RGBA().
}, {
key: "getBrightness",
value: function getBrightness(color) {
// http://www.w3.org/TR/AERT#color-contrast
return Math.round((color[0] * 299 + color[1] * 587 + color[2] * 114) / 1000);
}
}]);
return ColorUtils;
}();
export default ColorUtils;
//# sourceMappingURL=ColorUtils.js.map

@@ -1,3 +0,1 @@

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }

@@ -20,7 +18,5 @@

var DbNameValidator = function DbNameValidator() {
_classCallCheck(this, DbNameValidator);
};
class DbNameValidator {}
_defineProperty(DbNameValidator, "legalize", function (name, prefix, regex, checkReserved, i) {
_defineProperty(DbNameValidator, "legalize", (name, prefix, regex, checkReserved, i) => {
// Replace all dashes and spaces with underscores

@@ -48,9 +44,7 @@ var legalName = name.trim().replace(/[- ]/g, '_'); // Add prefix to reserved names

_defineProperty(DbNameValidator, "legalizeTableName", function (name) {
return DbNameValidator.legalize(name, TABLE_PREFIX, STERILE_TABLE_AND_NAMESPACE_REGEX, false, 0);
});
_defineProperty(DbNameValidator, "legalizeTableName", name => DbNameValidator.legalize(name, TABLE_PREFIX, STERILE_TABLE_AND_NAMESPACE_REGEX, false, 0));
_defineProperty(DbNameValidator, "legalizeColumnNames", function (headers) {
_defineProperty(DbNameValidator, "legalizeColumnNames", headers => {
var legalHeaders = [];
headers.forEach(function (header, i) {
headers.forEach((header, i) => {
var legalHeader = DbNameValidator.legalizeColumnName(header, i); // Check if the name is already in use

@@ -74,11 +68,7 @@

_defineProperty(DbNameValidator, "isValidTableName", function (name) {
return DbNameValidator.legalizeTableName(name) === name;
});
_defineProperty(DbNameValidator, "isValidTableName", name => DbNameValidator.legalizeTableName(name) === name);
_defineProperty(DbNameValidator, "isValidColumnName", function (name) {
return DbNameValidator.legalizeColumnName(name) === name;
});
_defineProperty(DbNameValidator, "isValidColumnName", name => DbNameValidator.legalizeColumnName(name) === name);
export default DbNameValidator;
//# sourceMappingURL=DbNameValidator.js.map

@@ -18,4 +18,4 @@ /**

export default {
getClosestByClassName: getClosestByClassName
getClosestByClassName
};
//# sourceMappingURL=DOMUtils.js.map

@@ -1,14 +0,14 @@

export { default as CanceledPromiseError } from './CanceledPromiseError';
export { default as ColorUtils } from './ColorUtils';
export { default as DbNameValidator } from './DbNameValidator';
export { default as DOMUtils } from './DOMUtils';
export { default as Pending } from './Pending';
export * from './PromiseUtils';
export { default as RangeUtils } from './RangeUtils';
export { default as TextUtils } from './TextUtils';
export { default as TimeoutError } from './TimeoutError';
export { default as TimeUtils } from './TimeUtils';
export { default as InvalidMetadataError } from './InvalidMetadataError';
export { default as ValidationError } from './ValidationError';
export { default as TestUtils } from './TestUtils';
export { default as CanceledPromiseError } from "./CanceledPromiseError.js";
export { default as ColorUtils } from "./ColorUtils.js";
export { default as DbNameValidator } from "./DbNameValidator.js";
export { default as DOMUtils } from "./DOMUtils.js";
export { default as Pending } from "./Pending.js";
export * from "./PromiseUtils.js";
export { default as RangeUtils } from "./RangeUtils.js";
export { default as TextUtils } from "./TextUtils.js";
export { default as TimeoutError } from "./TimeoutError.js";
export { default as TimeUtils } from "./TimeUtils.js";
export { default as InvalidMetadataError } from "./InvalidMetadataError.js";
export { default as ValidationError } from "./ValidationError.js";
export { default as TestUtils } from "./TestUtils.js";
//# sourceMappingURL=index.js.map

@@ -1,52 +0,13 @@

function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function _wrapNativeSuper(Class) { var _cache = typeof Map === "function" ? new Map() : undefined; _wrapNativeSuper = function _wrapNativeSuper(Class) { if (Class === null || !_isNativeFunction(Class)) return Class; if (typeof Class !== "function") { throw new TypeError("Super expression must either be null or a function"); } if (typeof _cache !== "undefined") { if (_cache.has(Class)) return _cache.get(Class); _cache.set(Class, Wrapper); } function Wrapper() { return _construct(Class, arguments, _getPrototypeOf(this).constructor); } Wrapper.prototype = Object.create(Class.prototype, { constructor: { value: Wrapper, enumerable: false, writable: true, configurable: true } }); return _setPrototypeOf(Wrapper, Class); }; return _wrapNativeSuper(Class); }
function _construct(Parent, args, Class) { if (_isNativeReflectConstruct()) { _construct = Reflect.construct; } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); }
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
function _isNativeFunction(fn) { return Function.toString.call(fn).indexOf("[native code]") !== -1; }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var InvalidMetadataError = /*#__PURE__*/function (_Error) {
_inherits(InvalidMetadataError, _Error);
class InvalidMetadataError extends Error {
constructor() {
super(...arguments);
var _super = _createSuper(InvalidMetadataError);
function InvalidMetadataError() {
var _this;
_classCallCheck(this, InvalidMetadataError);
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _super.call.apply(_super, [this].concat(args));
_defineProperty(_assertThisInitialized(_this), "isInvalidMetadata", true);
return _this;
_defineProperty(this, "isInvalidMetadata", true);
}
return InvalidMetadataError;
}( /*#__PURE__*/_wrapNativeSuper(Error));
}
export default InvalidMetadataError;
//# sourceMappingURL=InvalidMetadataError.js.map

@@ -1,22 +0,4 @@

function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); }
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
import { PromiseUtils } from './PromiseUtils';
import { PromiseUtils } from "./PromiseUtils.js";
/**

@@ -28,6 +10,4 @@ * Helper class for managing pending promises.

var Pending = /*#__PURE__*/function () {
function Pending() {
_classCallCheck(this, Pending);
class Pending {
constructor() {
_defineProperty(this, "pending", []);

@@ -38,66 +18,56 @@

_createClass(Pending, [{
key: "add",
value:
/**
* Begins tracking a promise. After the promise has resolved, it's removed from tracking.
* @param item Item to track.
* @param cleanup The cleanup function to use when the promise is cancelled
* @returns CancelablePromise Returns a cancelable promise.
*/
function add(item, cleanup) {
var _this = this;
/**
* Begins tracking a promise. After the promise has resolved, it's removed from tracking.
* @param item Item to track.
* @param cleanup The cleanup function to use when the promise is cancelled
* @returns CancelablePromise Returns a cancelable promise.
*/
add(item, cleanup) {
var promise = PromiseUtils.makeCancelable(item, cleanup);
this.pending.push(promise);
promise.then(() => {
this.resolve(promise);
}, () => {
this.resolve(promise);
});
return promise;
}
/**
* Remove a promise from tracking.
* @param promise Promise to stop tracking
*/
var promise = PromiseUtils.makeCancelable(item, cleanup);
this.pending.push(promise);
promise.then(function () {
_this.resolve(promise);
}, function () {
_this.resolve(promise);
});
return promise;
}
/**
* Remove a promise from tracking.
* @param promise Promise to stop tracking
*/
}, {
key: "remove",
value: function remove(promise) {
for (var i = 0; i < this.pending.length; i += 1) {
if (this.pending[i] === promise) {
this.pending.splice(i, 1);
return;
}
remove(promise) {
for (var i = 0; i < this.pending.length; i += 1) {
if (this.pending[i] === promise) {
this.pending.splice(i, 1);
return;
}
}
}, {
key: "resolve",
value: function resolve(promise) {
this.remove(promise);
this.resolved.push(promise);
}
/**
* Cancel all pending promises and remove them from tracking.
*/
}
}, {
key: "cancel",
value: function cancel() {
var allPromises = [].concat(_toConsumableArray(this.pending), _toConsumableArray(this.resolved));
resolve(promise) {
this.remove(promise);
this.resolved.push(promise);
}
/**
* Cancel all pending promises and remove them from tracking.
*/
for (var i = 0; i < allPromises.length; i += 1) {
allPromises[i].cancel();
}
this.pending = [];
this.resolved = [];
cancel() {
var allPromises = [...this.pending, ...this.resolved];
for (var i = 0; i < allPromises.length; i += 1) {
allPromises[i].cancel();
}
}]);
return Pending;
}();
this.pending = [];
this.resolved = [];
}
}
export default Pending;
//# sourceMappingURL=Pending.js.map

@@ -1,67 +0,48 @@

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
import CanceledPromiseError from "./CanceledPromiseError.js";
import TimeoutError from "./TimeoutError.js";
export class PromiseUtils {
/**
* Creates a promise that can be canceled by calling the `cancel` function
* Pass an optional `cleanupFunc` to perform actions on the resolved item after promise is cancelled.
* @param promise The item to resolve
* @param cleanup Function to cleanup the resolved item after cancelation. Called after both this promise is cancelled and the wrapped item was resolved (order does not matter).
*/
static makeCancelable(promise, cleanup) {
var hasCanceled = false;
var resolved;
var wrappedPromise = new Promise((resolve, reject) => {
Promise.resolve(promise).then(val => {
if (hasCanceled) {
if (cleanup) {
cleanup(val);
}
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
reject(new CanceledPromiseError());
} else {
resolved = val;
resolve(val);
}
}, error => hasCanceled ? reject(new CanceledPromiseError()) : reject(error));
}); // eslint-disable-next-line @typescript-eslint/no-explicit-any
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
wrappedPromise.cancel = () => {
hasCanceled = true;
import CanceledPromiseError from './CanceledPromiseError';
import TimeoutError from './TimeoutError';
export var PromiseUtils = /*#__PURE__*/function () {
function PromiseUtils() {
_classCallCheck(this, PromiseUtils);
if (resolved != null && cleanup) {
cleanup(resolved);
}
};
return wrappedPromise;
}
_createClass(PromiseUtils, null, [{
key: "makeCancelable",
value:
/**
* Creates a promise that can be canceled by calling the `cancel` function
* Pass an optional `cleanupFunc` to perform actions on the resolved item after promise is cancelled.
* @param promise The item to resolve
* @param cleanup Function to cleanup the resolved item after cancelation. Called after both this promise is cancelled and the wrapped item was resolved (order does not matter).
*/
function makeCancelable(promise, cleanup) {
var hasCanceled = false;
var resolved;
var wrappedPromise = new Promise(function (resolve, reject) {
Promise.resolve(promise).then(function (val) {
if (hasCanceled) {
if (cleanup) {
cleanup(val);
}
static isCanceled(error) {
return error instanceof CanceledPromiseError;
}
reject(new CanceledPromiseError());
} else {
resolved = val;
resolve(val);
}
}, function (error) {
return hasCanceled ? reject(new CanceledPromiseError()) : reject(error);
});
}); // eslint-disable-next-line @typescript-eslint/no-explicit-any
static isTimedOut(error) {
return error instanceof TimeoutError;
}
wrappedPromise.cancel = function () {
hasCanceled = true;
if (resolved != null && cleanup) {
cleanup(resolved);
}
};
return wrappedPromise;
}
}, {
key: "isCanceled",
value: function isCanceled(error) {
return error instanceof CanceledPromiseError;
}
}, {
key: "isTimedOut",
value: function isTimedOut(error) {
return error instanceof TimeoutError;
}
}]);
return PromiseUtils;
}();
}
//# sourceMappingURL=PromiseUtils.js.map

@@ -1,145 +0,96 @@

function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); }
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
// A number pair representing [start, end].
var RangeUtils = /*#__PURE__*/function () {
function RangeUtils() {
_classCallCheck(this, RangeUtils);
class RangeUtils {
static isValidRange(range) {
return range != null && range.length === 2 && Number.isInteger(range[0]) && Number.isInteger(range[1]) && range[0] <= range[1];
}
_createClass(RangeUtils, null, [{
key: "isValidRange",
value: function isValidRange(range) {
return range != null && range.length === 2 && Number.isInteger(range[0]) && Number.isInteger(range[1]) && range[0] <= range[1];
static validateRange(range) {
if (!RangeUtils.isValidRange(range)) {
throw new Error("Invalid range! ".concat(range));
}
}, {
key: "validateRange",
value: function validateRange(range) {
if (!RangeUtils.isValidRange(range)) {
throw new Error("Invalid range! ".concat(range));
}
}
}, {
key: "isSelected",
value: function isSelected(selectedRanges, index) {
for (var i = 0; i < selectedRanges.length; i += 1) {
var range = selectedRanges[i];
var start = range[0];
var end = range[1];
}
if (start <= index && index <= end) {
return true;
}
static isSelected(selectedRanges, index) {
for (var i = 0; i < selectedRanges.length; i += 1) {
var range = selectedRanges[i];
var start = range[0];
var end = range[1];
if (start <= index && index <= end) {
return true;
}
return false;
}
}, {
key: "selectRange",
value: function selectRange(selectedRanges, range) {
var _range = _slicedToArray(range, 2),
start = _range[0],
end = _range[1];
var ranges = _toConsumableArray(selectedRanges); // Need to consolidate the range with previous ranges
return false;
}
static selectRange(selectedRanges, range) {
var [start, end] = range;
var ranges = [...selectedRanges]; // Need to consolidate the range with previous ranges
for (var i = ranges.length - 1; i >= 0; i -= 1) {
var selectedRange = ranges[i];
var selectedStart = selectedRange[0];
var selectedEnd = selectedRange[1];
for (var i = ranges.length - 1; i >= 0; i -= 1) {
var selectedRange = ranges[i];
var selectedStart = selectedRange[0];
var selectedEnd = selectedRange[1];
if (selectedStart <= start && end <= selectedEnd) {
// Already contained within a range
return ranges;
}
if (selectedStart <= start && end <= selectedEnd) {
// Already contained within a range
return ranges;
}
if (start <= selectedEnd && selectedStart <= end) {
// Overlaps the previous range, remove this range and update the new range
start = Math.min(start, selectedStart);
end = Math.max(end, selectedEnd);
ranges.splice(i, 1);
}
if (start <= selectedEnd && selectedStart <= end) {
// Overlaps the previous range, remove this range and update the new range
start = Math.min(start, selectedStart);
end = Math.max(end, selectedEnd);
ranges.splice(i, 1);
}
ranges.push([start, end]);
return ranges;
}
}, {
key: "deselectRange",
value: function deselectRange(selectedRanges, range) {
var _range2 = _slicedToArray(range, 2),
start = _range2[0],
end = _range2[1];
var ranges = _toConsumableArray(selectedRanges); // Need to consolidate the range with previous ranges
ranges.push([start, end]);
return ranges;
}
static deselectRange(selectedRanges, range) {
var [start, end] = range;
var ranges = [...selectedRanges]; // Need to consolidate the range with previous ranges
for (var i = ranges.length - 1; i >= 0; i -= 1) {
var selectedRange = ranges[i];
var selectedStart = selectedRange[0];
var selectedEnd = selectedRange[1];
for (var i = ranges.length - 1; i >= 0; i -= 1) {
var selectedRange = ranges[i];
var selectedStart = selectedRange[0];
var selectedEnd = selectedRange[1];
if (end < selectedStart || selectedEnd < start) {// Outside of the selected range
} else if (selectedStart < start && end < selectedEnd) {
// Contained within the range, split the range
ranges[i] = [selectedStart, start - 1];
ranges.splice(i + 1, 0, [end + 1, selectedEnd]);
break;
} else if (start <= selectedStart && selectedEnd <= end) {
// Entire range should be deselected, remove from selected ranges
ranges.splice(i, 1);
} else if (selectedStart < start) {
// Overlaps end of the previous range, update the end
ranges[i] = [selectedStart, start - 1];
} else {
// Overlaps the start of the previous range, update the start
ranges[i] = [end + 1, selectedEnd];
}
if (end < selectedStart || selectedEnd < start) {// Outside of the selected range
} else if (selectedStart < start && end < selectedEnd) {
// Contained within the range, split the range
ranges[i] = [selectedStart, start - 1];
ranges.splice(i + 1, 0, [end + 1, selectedEnd]);
break;
} else if (start <= selectedStart && selectedEnd <= end) {
// Entire range should be deselected, remove from selected ranges
ranges.splice(i, 1);
} else if (selectedStart < start) {
// Overlaps end of the previous range, update the end
ranges[i] = [selectedStart, start - 1];
} else {
// Overlaps the start of the previous range, update the start
ranges[i] = [end + 1, selectedEnd];
}
return ranges;
}
/**
* Count the sum total of items in the ranges provided
*
* @param ranges The ranges to count
*/
}, {
key: "count",
value: function count(ranges) {
return ranges.reduce(function (sum, range) {
return sum + (range[1] - range[0] + 1);
}, 0);
}
}]);
return ranges;
}
/**
* Count the sum total of items in the ranges provided
*
* @param ranges The ranges to count
*/
return RangeUtils;
}();
static count(ranges) {
return ranges.reduce((sum, range) => sum + (range[1] - range[0] + 1), 0);
}
}
export default RangeUtils;
//# sourceMappingURL=RangeUtils.js.map

@@ -5,79 +5,42 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var TestUtils = /*#__PURE__*/function () {
function TestUtils() {
_classCallCheck(this, TestUtils);
class TestUtils {
static makeMockContext() {
return {
arc: jest.fn(),
beginPath: jest.fn(),
clip: jest.fn(),
closePath: jest.fn(),
createLinearGradient: jest.fn(() => ({
addColorStop: jest.fn()
})),
fill: jest.fn(),
fillRect: jest.fn(),
fillText: jest.fn(),
lineTo: jest.fn(),
measureText: jest.fn(str => ({
width: str.length * 10
})),
moveTo: jest.fn(),
rect: jest.fn(),
restore: jest.fn(),
setTransform: jest.fn(),
save: jest.fn(),
stroke: jest.fn(),
strokeRect: jest.fn(),
translate: jest.fn(),
scale: jest.fn(),
createPattern: jest.fn()
};
}
_createClass(TestUtils, null, [{
key: "makeMockContext",
value: function makeMockContext() {
return {
arc: jest.fn(),
beginPath: jest.fn(),
clip: jest.fn(),
closePath: jest.fn(),
createLinearGradient: jest.fn(function () {
return {
addColorStop: jest.fn()
};
}),
fill: jest.fn(),
fillRect: jest.fn(),
fillText: jest.fn(),
lineTo: jest.fn(),
measureText: jest.fn(function (str) {
return {
width: str.length * 10
};
}),
moveTo: jest.fn(),
rect: jest.fn(),
restore: jest.fn(),
setTransform: jest.fn(),
save: jest.fn(),
stroke: jest.fn(),
strokeRect: jest.fn(),
translate: jest.fn(),
scale: jest.fn(),
createPattern: jest.fn()
};
}
}, {
key: "flushPromises",
value: function () {
var _flushPromises = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
return regeneratorRuntime.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
_context.next = 2;
return new Promise(setImmediate);
static flushPromises() {
return _asyncToGenerator(function* () {
yield new Promise(setImmediate);
})();
}
case 2:
case "end":
return _context.stop();
}
}
}, _callee);
}));
}
function flushPromises() {
return _flushPromises.apply(this, arguments);
}
return flushPromises;
}()
}]);
return TestUtils;
}();
_defineProperty(TestUtils, "REGULAR_USER", {

@@ -84,0 +47,0 @@ name: 'test',

@@ -1,89 +0,72 @@

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
class TextUtils {
/**
* Joins a list of strings with a comma, keeping the oxford comma and adding "and" as appropriate.
* Eg.
* One
* One and Two
* One, Two, and Three
* @param items The items to join in a list
*/
static join(items) {
if (items == null || items.length === 0) {
return '';
}
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
if (items.length === 1) {
return items[0];
}
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
if (items.length === 2) {
return "".concat(items[0], " and ").concat(items[1]);
}
var TextUtils = /*#__PURE__*/function () {
function TextUtils() {
_classCallCheck(this, TextUtils);
var itemText = items.slice(0, items.length - 1).join(', ');
var lastItem = items[items.length - 1];
return "".concat(itemText, ", and ").concat(lastItem);
}
/**
* Converts text to lower case, handling null if necessary and returning an empty string
* @param text The text to convert to lower case
* @param isNullAllowed True if a null string should return an empty string from this function. If false an error is thrown if null is passed in.
*/
_createClass(TextUtils, null, [{
key: "join",
value:
/**
* Joins a list of strings with a comma, keeping the oxford comma and adding "and" as appropriate.
* Eg.
* One
* One and Two
* One, Two, and Three
* @param items The items to join in a list
*/
function join(items) {
if (items == null || items.length === 0) {
return '';
}
if (items.length === 1) {
return items[0];
}
static toLower(text) {
var isNullAllowed = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
if (items.length === 2) {
return "".concat(items[0], " and ").concat(items[1]);
if (text == null) {
if (isNullAllowed) {
return '';
}
var itemText = items.slice(0, items.length - 1).join(', ');
var lastItem = items[items.length - 1];
return "".concat(itemText, ", and ").concat(lastItem);
throw new Error('Null string passed in to TextUtils.toLower');
}
/**
* Converts text to lower case, handling null if necessary and returning an empty string
* @param text The text to convert to lower case
* @param isNullAllowed True if a null string should return an empty string from this function. If false an error is thrown if null is passed in.
*/
}, {
key: "toLower",
value: function toLower(text) {
var isNullAllowed = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
return text.toLowerCase();
}
/**
*
* @param a The string to sort
* @param b Second string to sort
* @param isAscending Whether to sort ascending or descending
*/
if (text == null) {
if (isNullAllowed) {
return '';
}
throw new Error('Null string passed in to TextUtils.toLower');
}
static sort(a, b) {
var isAscending = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
return text.toLowerCase();
if (a < b) {
return isAscending ? -1 : 1;
}
/**
*
* @param a The string to sort
* @param b Second string to sort
* @param isAscending Whether to sort ascending or descending
*/
}, {
key: "sort",
value: function sort(a, b) {
var isAscending = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
if (a > b) {
return isAscending ? 1 : -1;
}
if (a < b) {
return isAscending ? -1 : 1;
}
return 0;
}
if (a > b) {
return isAscending ? 1 : -1;
}
}
return 0;
}
}]);
return TextUtils;
}();
export default TextUtils;
//# sourceMappingURL=TextUtils.js.map

@@ -1,52 +0,13 @@

function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function _wrapNativeSuper(Class) { var _cache = typeof Map === "function" ? new Map() : undefined; _wrapNativeSuper = function _wrapNativeSuper(Class) { if (Class === null || !_isNativeFunction(Class)) return Class; if (typeof Class !== "function") { throw new TypeError("Super expression must either be null or a function"); } if (typeof _cache !== "undefined") { if (_cache.has(Class)) return _cache.get(Class); _cache.set(Class, Wrapper); } function Wrapper() { return _construct(Class, arguments, _getPrototypeOf(this).constructor); } Wrapper.prototype = Object.create(Class.prototype, { constructor: { value: Wrapper, enumerable: false, writable: true, configurable: true } }); return _setPrototypeOf(Wrapper, Class); }; return _wrapNativeSuper(Class); }
function _construct(Parent, args, Class) { if (_isNativeReflectConstruct()) { _construct = Reflect.construct; } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); }
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
function _isNativeFunction(fn) { return Function.toString.call(fn).indexOf("[native code]") !== -1; }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var TimeoutError = /*#__PURE__*/function (_Error) {
_inherits(TimeoutError, _Error);
class TimeoutError extends Error {
constructor() {
super(...arguments);
var _super = _createSuper(TimeoutError);
function TimeoutError() {
var _this;
_classCallCheck(this, TimeoutError);
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _super.call.apply(_super, [this].concat(args));
_defineProperty(_assertThisInitialized(_this), "isTimeout", true);
return _this;
_defineProperty(this, "isTimeout", true);
}
return TimeoutError;
}( /*#__PURE__*/_wrapNativeSuper(Error));
}
export default TimeoutError;
//# sourceMappingURL=TimeoutError.js.map

@@ -1,82 +0,64 @@

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
class TimeUtils {
/**
* Pretty prints a time in seconds as a format like "1h 3m 23s", "32s"
* Seconds are padded after 60s, has elapsed to reduce width changes
* Minutes aren't paded, as thats a slower change
* @param time in seconds
*/
static formatElapsedTime(time) {
if (typeof time !== 'number' || !Number.isInteger(time)) {
throw new Error("".concat(time, " is not a number that can be expressed as a formatted time"));
}
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var TimeUtils = /*#__PURE__*/function () {
function TimeUtils() {
_classCallCheck(this, TimeUtils);
var hours = Math.floor(time / 3600);
var mins = Math.floor(time % 3600 / 60);
var seconds = time % 60;
return "".concat(hours > 0 ? "".concat(hours, "h ") : '') + "".concat(mins > 0 || hours > 0 ? "".concat(mins, "m ") : '') + "".concat(time >= 60 ? "".concat(seconds, "s").padStart(3, '0') : "".concat(seconds, "s"));
}
/**
* Format the time into hh:mm:ss format, eg. '12:34:56'
* @param timeInSeconds in seconds
*/
_createClass(TimeUtils, null, [{
key: "formatElapsedTime",
value:
/**
* Pretty prints a time in seconds as a format like "1h 3m 23s", "32s"
* Seconds are padded after 60s, has elapsed to reduce width changes
* Minutes aren't paded, as thats a slower change
* @param time in seconds
*/
function formatElapsedTime(time) {
if (typeof time !== 'number' || !Number.isInteger(time)) {
throw new Error("".concat(time, " is not a number that can be expressed as a formatted time"));
}
var hours = Math.floor(time / 3600);
var mins = Math.floor(time % 3600 / 60);
var seconds = time % 60;
return "".concat(hours > 0 ? "".concat(hours, "h ") : '') + "".concat(mins > 0 || hours > 0 ? "".concat(mins, "m ") : '') + "".concat(time >= 60 ? "".concat(seconds, "s").padStart(3, '0') : "".concat(seconds, "s"));
static formatTime(timeInSeconds) {
if (typeof timeInSeconds !== 'number' || !Number.isInteger(timeInSeconds) || timeInSeconds < 0) {
throw new Error("".concat(timeInSeconds, " is not a number that can be expressed as a formatted time"));
}
/**
* Format the time into hh:mm:ss format, eg. '12:34:56'
* @param timeInSeconds in seconds
*/
}, {
key: "formatTime",
value: function formatTime(timeInSeconds) {
if (typeof timeInSeconds !== 'number' || !Number.isInteger(timeInSeconds) || timeInSeconds < 0) {
throw new Error("".concat(timeInSeconds, " is not a number that can be expressed as a formatted time"));
}
var hours = String(Math.floor(timeInSeconds / (60 * 60))).padStart(2, '0');
var divisorForMinutes = timeInSeconds % (60 * 60);
var minutes = String(Math.floor(divisorForMinutes / 60)).padStart(2, '0');
var divisorForSeconds = divisorForMinutes % 60;
var seconds = String(Math.ceil(divisorForSeconds)).padStart(2, '0');
return "".concat(hours, ":").concat(minutes, ":").concat(seconds);
}
var hours = String(Math.floor(timeInSeconds / (60 * 60))).padStart(2, '0');
var divisorForMinutes = timeInSeconds % (60 * 60);
var minutes = String(Math.floor(divisorForMinutes / 60)).padStart(2, '0');
var divisorForSeconds = divisorForMinutes % 60;
var seconds = String(Math.ceil(divisorForSeconds)).padStart(2, '0');
return "".concat(hours, ":").concat(minutes, ":").concat(seconds);
}
}, {
key: "isTimeString",
value: function isTimeString(s) {
return new RegExp(TimeUtils.TIME_PATTERN).test(s);
}
/**
* Parse time in seconds from the provided time string
* @param timeString Time string in hh:mm:ss format
*/
static isTimeString(s) {
return new RegExp(TimeUtils.TIME_PATTERN).test(s);
}
/**
* Parse time in seconds from the provided time string
* @param timeString Time string in hh:mm:ss format
*/
}, {
key: "parseTime",
value: function parseTime(timeString) {
if (!timeString || typeof timeString !== 'string') {
throw new Error("".concat(timeString, " is not a valid string"));
}
var components = timeString.split(':');
static parseTime(timeString) {
if (!timeString || typeof timeString !== 'string') {
throw new Error("".concat(timeString, " is not a valid string"));
}
if (components.length !== 3) {
throw new Error("".concat(timeString, " is not a time string that can be parsed"));
}
var components = timeString.split(':');
return Number(components[0]) * 60 * 60 + Number(components[1]) * 60 + Number(components[2]);
if (components.length !== 3) {
throw new Error("".concat(timeString, " is not a time string that can be parsed"));
}
}]);
return TimeUtils;
}();
return Number(components[0]) * 60 * 60 + Number(components[1]) * 60 + Number(components[2]);
}
}
_defineProperty(TimeUtils, "TIME_PATTERN", '([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]');

@@ -83,0 +65,0 @@

@@ -1,52 +0,13 @@

function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function _wrapNativeSuper(Class) { var _cache = typeof Map === "function" ? new Map() : undefined; _wrapNativeSuper = function _wrapNativeSuper(Class) { if (Class === null || !_isNativeFunction(Class)) return Class; if (typeof Class !== "function") { throw new TypeError("Super expression must either be null or a function"); } if (typeof _cache !== "undefined") { if (_cache.has(Class)) return _cache.get(Class); _cache.set(Class, Wrapper); } function Wrapper() { return _construct(Class, arguments, _getPrototypeOf(this).constructor); } Wrapper.prototype = Object.create(Class.prototype, { constructor: { value: Wrapper, enumerable: false, writable: true, configurable: true } }); return _setPrototypeOf(Wrapper, Class); }; return _wrapNativeSuper(Class); }
function _construct(Parent, args, Class) { if (_isNativeReflectConstruct()) { _construct = Reflect.construct; } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); }
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
function _isNativeFunction(fn) { return Function.toString.call(fn).indexOf("[native code]") !== -1; }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var ValidationError = /*#__PURE__*/function (_Error) {
_inherits(ValidationError, _Error);
class ValidationError extends Error {
constructor() {
super(...arguments);
var _super = _createSuper(ValidationError);
function ValidationError() {
var _this;
_classCallCheck(this, ValidationError);
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _super.call.apply(_super, [this].concat(args));
_defineProperty(_assertThisInitialized(_this), "isInvalid", true);
return _this;
_defineProperty(this, "isInvalid", true);
}
return ValidationError;
}( /*#__PURE__*/_wrapNativeSuper(Error));
}
export default ValidationError;
//# sourceMappingURL=ValidationError.js.map
{
"name": "@deephaven/utils",
"version": "0.4.0",
"version": "0.4.1-modules.0+babe987",
"description": "Deephaven Utils",

@@ -37,3 +37,3 @@ "author": "Deephaven Data Labs LLC",

"@babel/core": "7.12.3",
"@deephaven/tsconfig": "^0.4.0",
"@deephaven/tsconfig": "^0.4.1-modules.0+babe987",
"babel-loader": "8.1.0",

@@ -51,3 +51,3 @@ "cross-env": "^7.0.2",

},
"gitHead": "9b983b76cc5bd3785efd737d36c4c0b301734868"
"gitHead": "babe9873983923869be98e4943bfb173a7097641"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc