|
Last change
on this file was a762898, checked in by istevanoska <ilinastevanoska@…>, 5 months ago |
|
Added visualizations
|
-
Property mode
set to
100644
|
|
File size:
834 bytes
|
| Line | |
|---|
| 1 | /**
|
|---|
| 2 | * Checks if the `subset` array is entirely contained within the `superset` array.
|
|---|
| 3 | *
|
|---|
| 4 | *
|
|---|
| 5 | * @template T - The type of elements contained in the arrays.
|
|---|
| 6 | * @param {T[]} superset - The array that may contain all elements of the subset.
|
|---|
| 7 | * @param {T[]} subset - The array to check against the superset.
|
|---|
| 8 | * @returns {boolean} - Returns `true` if all elements of the `subset` are present in the `superset`, otherwise returns `false`.
|
|---|
| 9 | *
|
|---|
| 10 | * @example
|
|---|
| 11 | * ```typescript
|
|---|
| 12 | * const superset = [1, 2, 3, 4, 5];
|
|---|
| 13 | * const subset = [2, 3, 4];
|
|---|
| 14 | * isSubset(superset, subset); // true
|
|---|
| 15 | * ```
|
|---|
| 16 | *
|
|---|
| 17 | * @example
|
|---|
| 18 | * ```typescript
|
|---|
| 19 | * const superset = ['a', 'b', 'c'];
|
|---|
| 20 | * const subset = ['a', 'd'];
|
|---|
| 21 | * isSubset(superset, subset); // false
|
|---|
| 22 | * ```
|
|---|
| 23 | */
|
|---|
| 24 | declare function isSubset<T>(superset: readonly T[], subset: readonly T[]): boolean;
|
|---|
| 25 |
|
|---|
| 26 | export { isSubset };
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.