aboutsummaryrefslogtreecommitdiff
path: root/src/extensions/Extensions_Array.ts
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2025-03-16 19:02:56 -0400
committerbobzel <zzzman@gmail.com>2025-03-16 19:02:56 -0400
commitdf708c90d8356934d2e3d9123129c761d328c1fe (patch)
tree98b0588710ac8ca00c303960da0851614aacf597 /src/extensions/Extensions_Array.ts
parent7d9fae09e8906e5636f6ea695ad560797b08d023 (diff)
parentf4042257be7359734a0dd35cedbf03fe4aa14cf1 (diff)
Merge branch 'DocCreatorMenu-work' of https://github.com/brown-dash/Dash-Web into DocCreatorMenu-work
Diffstat (limited to 'src/extensions/Extensions_Array.ts')
-rw-r--r--src/extensions/Extensions_Array.ts10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/extensions/Extensions_Array.ts b/src/extensions/Extensions_Array.ts
index a50fb330f..d61585e28 100644
--- a/src/extensions/Extensions_Array.ts
+++ b/src/extensions/Extensions_Array.ts
@@ -1,14 +1,13 @@
export default class ArrayExtension {
private readonly property: string;
- private readonly body: <T>(this: Array<T>) => any;
+ private readonly body: <T>(this: Array<T>, args: unknown) => unknown;
- constructor(property: string, body: <T>(this: Array<T>) => any) {
+ constructor(property: string, body: <T>(this: Array<T>, args: unknown) => unknown) {
this.property = property;
this.body = body;
}
assign() {
- // eslint-disable-next-line no-extend-native
Object.defineProperty(Array.prototype, this.property, {
value: this.body,
enumerable: false,
@@ -28,6 +27,11 @@ const extensions = [
}
return this[this.length - 1];
}),
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
+ new ArrayExtension('getIndex', function (val: any) {
+ const index = this.indexOf(val);
+ return index === -1 ? undefined : index;
+ }),
];
function Assign() {