From aaf8a232573c17424b4077c3372b0cff2bbbb4a1 Mon Sep 17 00:00:00 2001 From: Joeylene <23741509+jorenrui@users.noreply.github.com> Date: Sat, 23 Mar 2024 16:40:10 +0800 Subject: [PATCH] feat: add array.deepFirst and array.deepLast properties --- lib/helpers/array.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/helpers/array.js b/lib/helpers/array.js index bb63bb5..708bdc0 100644 --- a/lib/helpers/array.js +++ b/lib/helpers/array.js @@ -72,6 +72,14 @@ export class MiniArray extends Array { return this.at(-1) } + get deepFirst() { + return this.deepFlat().first + } + + get deepLast() { + return this.deepFlat().last + } + deepFlat() { return this.flat(Infinity) }