isSubset es-toolkit
Checks if one array is a subset of another array.
Usage
isSubset(superset, subset)
Use isSubset when you want to check if all elements of one array are contained in another array. This is useful for verifying subset relationships or checking if permissions, features, tags, etc., are within the allowed range.
Special cases are also handled correctly.
Parameters
supersetreadonly T[]required
The superset array that may contain all elements of the subset.
subsetreadonly T[]required
The subset array to check if it's contained in the superset.
Returns
Returns true if all elements of the subset are contained in the superset, otherwise returns false.
Source: es-toolkit
Re-exported verbatim from es-toolkit. Implementation, edge cases, and performance behavior are owned upstream. This page mirrors the documentation at the pinned version; the linked source is authoritative.