es-toolkit 1.10.1-dev.223 → 1.10.1-dev.224

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -206,7 +206,7 @@ import {
206
206
  } from "../chunk-JEKUA56R.mjs";
207
207
  import {
208
208
  dropRightWhile
209
- } from "../chunk-JE6JKZU3.mjs";
209
+ } from "../chunk-M7SBBYV2.mjs";
210
210
  import {
211
211
  dropWhile
212
212
  } from "../chunk-LJ2C6MVP.mjs";
package/dist/index.js CHANGED
@@ -191,6 +191,16 @@ function dropRight(arr, itemsCount) {
191
191
  return arr.slice(0, -itemsCount);
192
192
  }
193
193
 
194
+ // src/array/dropRightWhile.ts
195
+ function dropRightWhile(arr, canContinueDropping) {
196
+ for (let i = arr.length - 1; i >= 0; i--) {
197
+ if (!canContinueDropping(arr[i])) {
198
+ return arr.slice(0, i + 1);
199
+ }
200
+ }
201
+ return [];
202
+ }
203
+
194
204
  // src/array/dropWhile.ts
195
205
  function dropWhile(arr, canContinueDropping) {
196
206
  const dropEndIndex = arr.findIndex((item) => !canContinueDropping(item));
@@ -200,13 +210,6 @@ function dropWhile(arr, canContinueDropping) {
200
210
  return arr.slice(dropEndIndex);
201
211
  }
202
212
 
203
- // src/array/dropRightWhile.ts
204
- function dropRightWhile(arr, canContinueDropping) {
205
- const reversed = arr.slice().reverse();
206
- const dropped = dropWhile(reversed, canContinueDropping);
207
- return dropped.slice().reverse();
208
- }
209
-
210
213
  // src/array/fill.ts
211
214
  function fill(arr, value, start = 0, end = arr.length) {
212
215
  start = Math.max(start, 0);