Skip to content

Commit

Permalink
Removed old dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
gabriel.csollei committed Jul 24, 2018
1 parent 2bdb265 commit 5237514
Show file tree
Hide file tree
Showing 19 changed files with 130 additions and 7 deletions.
1 change: 1 addition & 0 deletions out/TestCase.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ export declare class TestCase {
static readonly man: string[];
static readonly woman: string[];
static readonly nothing: string[];
static functionSum(a: number, b: any): number;
}
6 changes: 6 additions & 0 deletions out/TestCase.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
var TestCase = /** @class */ (function () {
function TestCase() {
}
TestCase.functionSum = function (a, b) {
if (isNaN(a) || isNaN(b)) {
throw new Error("Wrong params");
}
return a + b;
};
TestCase.phoneNumbers = [
"+421905123456",
"00421905123456",
Expand Down
7 changes: 7 additions & 0 deletions out/dom/CanvasManager.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var NotBrowserException_1 = require("../errors/NotBrowserException");
var CanvasManager = /** @class */ (function () {
function CanvasManager(arg1, arg2, arg3) {
if (arg1 instanceof HTMLCanvasElement) {
Expand All @@ -12,6 +13,9 @@ var CanvasManager = /** @class */ (function () {
this.localCanvas = CanvasManager.imageToCanvas(arg1);
}
else {
if (typeof document === "undefined") {
throw new NotBrowserException_1.NotBrowserException();
}
this.localCanvas = document.createElement("canvas");
if (arg1 && arg2) {
this.setCanvasSize(arg1, arg2);
Expand Down Expand Up @@ -49,6 +53,9 @@ var CanvasManager = /** @class */ (function () {
ctx.shadowOffsetY = y;
};
CanvasManager.imageToCanvas = function (image) {
if (typeof document === "undefined") {
throw new NotBrowserException_1.NotBrowserException();
}
var canvas = document.createElement("canvas");
canvas.width = image.width;
canvas.height = image.height;
Expand Down
1 change: 1 addition & 0 deletions out/dom/ElementBuilder.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
// TODO: need to be checked if app is running in browser
var localContext = document;
var ElementBuilder = /** @class */ (function () {
function ElementBuilder(elementName, parent) {
Expand Down
1 change: 1 addition & 0 deletions out/dom/Get.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"use strict";
// TODO: need to be checked if app is running in browser
Object.defineProperty(exports, "__esModule", { value: true });
var localContext = typeof document !== "undefined" ? document : null;
var Get = /** @class */ (function () {
Expand Down
2 changes: 1 addition & 1 deletion out/gtools.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion out/gtools.web.js

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions out/math/Vector2f.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,9 @@ export declare class Vector2f {
y: number;
x: number;
constructor(x: number, y: number);
set(arg1: Vector2f | number, arg2?: number): Vector2f;
add(arg1: Vector2f | number, arg2?: number): Vector2f;
div(arg1: Vector2f | number, arg2?: number): Vector2f;
mul(arg1: Vector2f | number, arg2?: number): Vector2f;
sub(arg1: Vector2f | number, arg2?: number): Vector2f;
}
53 changes: 53 additions & 0 deletions out/math/Vector2f.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,65 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var process = function (op, arg1, arg2) {
if (typeof arg2 === "number") {
op(arg1, arg2);
}
else {
if (typeof arg1 === "number") {
op(arg1, arg1);
}
else {
op(arg1.x, arg1.y);
}
}
};
var Vector2f = /** @class */ (function () {
function Vector2f(x, y) {
this.y = 0;
this.x = 0;
this.x = x;
this.y = y;
}
Vector2f.prototype.set = function (arg1, arg2) {
var _this = this;
process(function (x, y) {
_this.x = x;
_this.y = y;
}, arg1, arg2);
return this;
};
Vector2f.prototype.add = function (arg1, arg2) {
var _this = this;
process(function (x, y) {
_this.x += x;
_this.y += y;
}, arg1, arg2);
return this;
};
Vector2f.prototype.div = function (arg1, arg2) {
var _this = this;
process(function (x, y) {
_this.x /= x;
_this.y /= y;
}, arg1, arg2);
return this;
};
Vector2f.prototype.mul = function (arg1, arg2) {
var _this = this;
process(function (x, y) {
_this.x *= x;
_this.y *= y;
}, arg1, arg2);
return this;
};
Vector2f.prototype.sub = function (arg1, arg2) {
var _this = this;
process(function (x, y) {
_this.x -= x;
_this.y -= y;
}, arg1, arg2);
return this;
};
return Vector2f;
}());
exports.Vector2f = Vector2f;
1 change: 1 addition & 0 deletions out/utils/ArrayUtils.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ export declare class ArrayUtils {
* @returns {T | null}
*/
static getRandom<T = any>(args: T[]): T | null;
static getNRandom<T = any>(args: T[], count: number): T[];
/**
* Method return copy of array with only distinct elements
*
Expand Down
16 changes: 16 additions & 0 deletions out/utils/ArrayUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,22 @@ var ArrayUtils = /** @class */ (function () {
}
return args[Math.floor(Math.random() * args.length)];
};
ArrayUtils.getNRandom = function (args, count) {
if (!Array.isArray(args)) {
return args;
}
if (args.length === 0 || count === 0) {
return [];
}
if (args.length <= count) {
return args;
}
var result = new Set();
while (result.size <= count) {
result.add(ArrayUtils.getRandom(args));
}
return Array.from(result);
};
/**
* Method return copy of array with only distinct elements
*
Expand Down
10 changes: 10 additions & 0 deletions out/utils/DomUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Object.defineProperty(exports, "__esModule", { value: true });
var Checkers_1 = require("../dom/Checkers");
var Get_1 = require("../dom/Get");
var NotBrowserException_1 = require("../errors/NotBrowserException");
/**
* @typedef {Object} SizeObject
* @property {number} width
Expand All @@ -20,6 +21,9 @@ var DomUtils = /** @class */ (function () {
* @returns {number}
*/
DomUtils.getWindowHeight = function () {
if (typeof window === "undefined") {
throw new NotBrowserException_1.NotBrowserException();
}
return window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
};
/**
Expand All @@ -28,6 +32,9 @@ var DomUtils = /** @class */ (function () {
* @returns {number}
*/
DomUtils.getWindowWidth = function () {
if (typeof window === "undefined") {
throw new NotBrowserException_1.NotBrowserException();
}
return window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
};
/**
Expand Down Expand Up @@ -135,6 +142,9 @@ var DomUtils = /** @class */ (function () {
* @returns {HTMLElement}
*/
DomUtils.createElement = function (name, attr, cont, style) {
if (typeof document === "undefined") {
throw new NotBrowserException_1.NotBrowserException();
}
var el;
if (typeof name === "object") {
return DomUtils.createElement(name.name, name.attr || {}, name.cont || "", name.style);
Expand Down
2 changes: 2 additions & 0 deletions out/utils/MathUtils.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ export declare class MathUtils {
static lerp(a: number, b: number, val: number): number;
static log2i(value: number): number;
static lamp(min: number, max: number, scale: number): number;
static randomInt(min: number, max: number): number;
static random(min: number, max: number): number;
static average(args: number[]): number;
static diff(num1: number, num2: number): number;
}
7 changes: 7 additions & 0 deletions out/utils/MathUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,13 @@ var MathUtils = /** @class */ (function () {
MathUtils.lamp = function (min, max, scale) {
return MathUtils.clamp((max - min) * scale + min, min, max);
};
MathUtils.randomInt = function (min, max) {
return Math.floor(MathUtils.random(min, max));
};
MathUtils.random = function (min, max) {
var diff = max - min;
return min + Math.random() * diff;
};
MathUtils.average = function (args) {
var sum = 0;
for (var _i = 0, args_1 = args; _i < args_1.length; _i++) {
Expand Down
3 changes: 0 additions & 3 deletions out/utils/MiscUtils.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
/**
* @typedef {(Object)} any
*/
export interface StringMap {
[s: string]: string;
}
Expand Down
6 changes: 5 additions & 1 deletion out/utils/MiscUtils.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/**
* @typedef {(Object)} any
*/
Object.defineProperty(exports, "__esModule", { value: true });
var NotBrowserException_1 = require("../errors/NotBrowserException");
var MiscUtils = /** @class */ (function () {
function MiscUtils() {
}
Expand Down Expand Up @@ -132,6 +133,9 @@ var MiscUtils = /** @class */ (function () {
return result;
};
MiscUtils.includeFile = function (file) {
if (typeof document === "undefined") {
throw new NotBrowserException_1.NotBrowserException();
}
var script = document.createElement("script");
script.src = file;
script.type = "text/javascript";
Expand Down
1 change: 1 addition & 0 deletions out/utils/Runtime.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export declare class Runtime {
static isString(obj: string): string;
static isNumber(obj: number): number;
static isFunction<T>(obj: T): T;
static checkFunction(func: Function, args?: any[], thisArg?: typeof Runtime): boolean;
static isBoolean(obj: boolean): boolean;
static min(obj: number, value: number): number;
static max(obj: number, value: number): number;
Expand Down
12 changes: 12 additions & 0 deletions out/utils/Runtime.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,18 @@ var Runtime = /** @class */ (function () {
}
return obj;
};
// tslint:disable-next-line
Runtime.checkFunction = function (func, args, thisArg) {
if (args === void 0) { args = []; }
if (thisArg === void 0) { thisArg = this; }
try {
func.apply(thisArg, args);
return true;
}
catch (e) {
return false;
}
};
Runtime.isBoolean = function (obj) {
if (useRuntimeCheckers && !Checkers_1.Checkers.isBoolean(obj)) {
throw new WrongTypeException_1.WrongTypeException("boolean");
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
"mocha": "^5.2.0",
"nyc": "^12.0.2",
"ts-node": "^7.0.0",
"hazelnut": "file:../Hazelnut/index",
"tslint": "^5.10.0",
"coveralls": "^3.0.2",
"mocha-lcov-reporter": "^1.3.0",
Expand Down

0 comments on commit 5237514

Please sign in to comment.