aboutsummaryrefslogtreecommitdiff
path: root/src/extensions
diff options
context:
space:
mode:
Diffstat (limited to 'src/extensions')
-rw-r--r--src/extensions/ArrayExtensions.ts37
-rw-r--r--src/extensions/General/Extensions.ts9
-rw-r--r--src/extensions/General/ExtensionsTypings.ts8
-rw-r--r--src/extensions/StringExtensions.ts17
4 files changed, 0 insertions, 71 deletions
diff --git a/src/extensions/ArrayExtensions.ts b/src/extensions/ArrayExtensions.ts
deleted file mode 100644
index 8e125766d..000000000
--- a/src/extensions/ArrayExtensions.ts
+++ /dev/null
@@ -1,37 +0,0 @@
-export default class ArrayExtension {
- private readonly property: string;
- private readonly body: <T>(this: Array<T>) => any;
-
- constructor(property: string, body: <T>(this: Array<T>) => any) {
- this.property = property;
- this.body = body;
- }
-
- assign() {
- Object.defineProperty(Array.prototype, this.property, {
- value: this.body,
- enumerable: false
- });
- }
-
-}
-
-/**
- * IMPORTANT: Any extension you add here *must* have a corresponding type definition
- * in the Array<T> interface in ./General/ExtensionsTypings.ts. Otherwise,
- * Typescript will not recognize your new function.
- */
-const extensions = [
- new ArrayExtension("lastElement", function () {
- if (!this.length) {
- return undefined;
- }
- return this[this.length - 1];
- })
-];
-
-function Assign() {
- extensions.forEach(extension => extension.assign());
-}
-
-export { Assign }; \ No newline at end of file
diff --git a/src/extensions/General/Extensions.ts b/src/extensions/General/Extensions.ts
deleted file mode 100644
index 4b6d05d5f..000000000
--- a/src/extensions/General/Extensions.ts
+++ /dev/null
@@ -1,9 +0,0 @@
-import { Assign as ArrayAssign } from "../ArrayExtensions";
-import { Assign as StringAssign } from "../StringExtensions";
-
-function AssignAllExtensions() {
- ArrayAssign();
- StringAssign();
-}
-
-export { AssignAllExtensions }; \ No newline at end of file
diff --git a/src/extensions/General/ExtensionsTypings.ts b/src/extensions/General/ExtensionsTypings.ts
deleted file mode 100644
index 370157ed0..000000000
--- a/src/extensions/General/ExtensionsTypings.ts
+++ /dev/null
@@ -1,8 +0,0 @@
-interface Array<T> {
- lastElement(): T;
-}
-
-interface String {
- removeTrailingNewlines(): string;
- hasNewline(): boolean;
-} \ No newline at end of file
diff --git a/src/extensions/StringExtensions.ts b/src/extensions/StringExtensions.ts
deleted file mode 100644
index 2c76e56c8..000000000
--- a/src/extensions/StringExtensions.ts
+++ /dev/null
@@ -1,17 +0,0 @@
-function Assign() {
-
- String.prototype.removeTrailingNewlines = function () {
- let sliced = this;
- while (sliced.endsWith("\n")) {
- sliced = sliced.substring(0, this.length - 1);
- }
- return sliced as string;
- };
-
- String.prototype.hasNewline = function () {
- return this.endsWith("\n");
- };
-
-}
-
-export { Assign }; \ No newline at end of file