diff options
author | Nathan-SR <144961007+Nathan-SR@users.noreply.github.com> | 2025-03-04 04:32:50 -0500 |
---|---|---|
committer | Nathan-SR <144961007+Nathan-SR@users.noreply.github.com> | 2025-03-04 04:32:50 -0500 |
commit | 95abdada5a275fc258fa72781f7f3c40c0b306ea (patch) | |
tree | 6d729cebe0937ae81108005de9895b5398d1f475 /src/extensions/Extensions_Array.ts | |
parent | 0a8f3739cf5c30852f18751a4c05d81e0dabe928 (diff) | |
parent | 215ad40efa2e343e290d18bffbc55884829f1a0d (diff) |
Merge branch 'master' of https://github.com/brown-dash/Dash-Web into Merge
Diffstat (limited to 'src/extensions/Extensions_Array.ts')
-rw-r--r-- | src/extensions/Extensions_Array.ts | 10 |
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() { |