es-toolkit 1.22.0-dev.693 → 1.22.0-dev.694

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.
@@ -7,6 +7,11 @@
7
7
  * whether to continue dropping elements. The function is called with each element, index, and array, and dropping
8
8
  * continues as long as it returns true.
9
9
  * @returns {T[]} A new array with the elements remaining after the predicate returns false.
10
+ *
11
+ * @example
12
+ * const array = [1, 2, 3, 4, 5];
13
+ * const result = dropWhile(array, x => x < 3);
14
+ * result will be [3, 4, 5] since elements less than 3 are dropped.
10
15
  */
11
16
  declare function dropWhile<T>(arr: readonly T[], canContinueDropping: (item: T, index: number, arr: readonly T[]) => unknown): T[];
12
17
  /**
@@ -16,6 +21,11 @@ declare function dropWhile<T>(arr: readonly T[], canContinueDropping: (item: T,
16
21
  * @param {T[]} arr - The array from which to drop elements.
17
22
  * @param {Partial<T>} objectToDrop - An object specifying the properties to match for dropping elements.
18
23
  * @returns {T[]} A new array with the elements remaining after the predicate returns false.
24
+ *
25
+ * @example
26
+ * const array = [{ a: 1 }, { a: 2 }, { a: 3 }];
27
+ * const result = dropWhile(array, { a: 1 });
28
+ * result will be [{ a: 2 }, { a: 3 }] since the first object matches the properties of the provided object.
19
29
  */
20
30
  declare function dropWhile<T>(arr: readonly T[], objectToDrop: Partial<T>): T[];
21
31
  /**
@@ -25,6 +35,11 @@ declare function dropWhile<T>(arr: readonly T[], objectToDrop: Partial<T>): T[];
25
35
  * @param {T[]} arr - The array from which to drop elements.
26
36
  * @param {[keyof T, unknown]} propertyToDrop - A tuple containing the property key and the value to match for dropping elements.
27
37
  * @returns {T[]} A new array with the elements remaining after the predicate returns false.
38
+ *
39
+ * @example
40
+ * const array = [{ id: 1 }, { id: 2 }, { id: 3 }];
41
+ * const result = dropWhile(array, ['id', 1]);
42
+ * result will be [{ id: 2 }, { id: 3 }] since the first object has the id property matching the value 1.
28
43
  */
29
44
  declare function dropWhile<T>(arr: readonly T[], propertyToDrop: [keyof T, unknown]): T[];
30
45
  /**
@@ -34,6 +49,11 @@ declare function dropWhile<T>(arr: readonly T[], propertyToDrop: [keyof T, unkno
34
49
  * @param {T[]} arr - The array from which to drop elements.
35
50
  * @param {string} propertyToDrop - The name of the property to match for dropping elements.
36
51
  * @returns {T[]} A new array with the elements remaining after the predicate returns false.
52
+ *
53
+ * @example
54
+ * const array = [{ isActive: true }, { isActive: true }, { isActive: false }];
55
+ * const result = dropWhile(array, 'isActive');
56
+ * result will be [{ isActive: false }] since it drops elements until it finds one with a falsy isActive property.
37
57
  */
38
58
  declare function dropWhile<T>(arr: readonly T[], propertyToDrop: string): T[];
39
59
 
@@ -7,6 +7,11 @@
7
7
  * whether to continue dropping elements. The function is called with each element, index, and array, and dropping
8
8
  * continues as long as it returns true.
9
9
  * @returns {T[]} A new array with the elements remaining after the predicate returns false.
10
+ *
11
+ * @example
12
+ * const array = [1, 2, 3, 4, 5];
13
+ * const result = dropWhile(array, x => x < 3);
14
+ * result will be [3, 4, 5] since elements less than 3 are dropped.
10
15
  */
11
16
  declare function dropWhile<T>(arr: readonly T[], canContinueDropping: (item: T, index: number, arr: readonly T[]) => unknown): T[];
12
17
  /**
@@ -16,6 +21,11 @@ declare function dropWhile<T>(arr: readonly T[], canContinueDropping: (item: T,
16
21
  * @param {T[]} arr - The array from which to drop elements.
17
22
  * @param {Partial<T>} objectToDrop - An object specifying the properties to match for dropping elements.
18
23
  * @returns {T[]} A new array with the elements remaining after the predicate returns false.
24
+ *
25
+ * @example
26
+ * const array = [{ a: 1 }, { a: 2 }, { a: 3 }];
27
+ * const result = dropWhile(array, { a: 1 });
28
+ * result will be [{ a: 2 }, { a: 3 }] since the first object matches the properties of the provided object.
19
29
  */
20
30
  declare function dropWhile<T>(arr: readonly T[], objectToDrop: Partial<T>): T[];
21
31
  /**
@@ -25,6 +35,11 @@ declare function dropWhile<T>(arr: readonly T[], objectToDrop: Partial<T>): T[];
25
35
  * @param {T[]} arr - The array from which to drop elements.
26
36
  * @param {[keyof T, unknown]} propertyToDrop - A tuple containing the property key and the value to match for dropping elements.
27
37
  * @returns {T[]} A new array with the elements remaining after the predicate returns false.
38
+ *
39
+ * @example
40
+ * const array = [{ id: 1 }, { id: 2 }, { id: 3 }];
41
+ * const result = dropWhile(array, ['id', 1]);
42
+ * result will be [{ id: 2 }, { id: 3 }] since the first object has the id property matching the value 1.
28
43
  */
29
44
  declare function dropWhile<T>(arr: readonly T[], propertyToDrop: [keyof T, unknown]): T[];
30
45
  /**
@@ -34,6 +49,11 @@ declare function dropWhile<T>(arr: readonly T[], propertyToDrop: [keyof T, unkno
34
49
  * @param {T[]} arr - The array from which to drop elements.
35
50
  * @param {string} propertyToDrop - The name of the property to match for dropping elements.
36
51
  * @returns {T[]} A new array with the elements remaining after the predicate returns false.
52
+ *
53
+ * @example
54
+ * const array = [{ isActive: true }, { isActive: true }, { isActive: false }];
55
+ * const result = dropWhile(array, 'isActive');
56
+ * result will be [{ isActive: false }] since it drops elements until it finds one with a falsy isActive property.
37
57
  */
38
58
  declare function dropWhile<T>(arr: readonly T[], propertyToDrop: string): T[];
39
59
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "es-toolkit",
3
3
  "description": "A state-of-the-art, high-performance JavaScript utility library with a small bundle size and strong type annotations.",
4
- "version": "1.22.0-dev.693+ac1e79e0",
4
+ "version": "1.22.0-dev.694+e9123bea",
5
5
  "homepage": "https://es-toolkit.slash.page",
6
6
  "bugs": "https://github.com/toss/es-toolkit/issues",
7
7
  "repository": {