es-toolkit
Version:
A state-of-the-art, high-performance JavaScript utility library with a small bundle size and strong type annotations.
26 lines (25 loc) • 736 B
JavaScript
import { isSubset as isSubset$1 } from "../../array/isSubset.mjs";
//#region src/fp/array/isSubset.ts
/**
* Creates a predicate that checks whether the piped array is a subset of superset.
*
* Every value in the piped array must be present in superset, using the main
* {@link isSubset} equality behavior.
*
* @template T - The type of elements in the arrays.
* @param superset - The array that may contain all values from the piped array.
* @returns A predicate for the piped array.
*
* @example
* import { isSubset, pipe } from 'es-toolkit/fp';
*
* pipe([1, 2], isSubset([1, 2, 3]));
* // => true
*/
function isSubset(superset) {
return function(array) {
return isSubset$1(superset, array);
};
}
//#endregion
export { isSubset };