UNPKG

typedash

Version:

modern, type-safe collection of utility functions

27 lines (25 loc) 962 B
const require_createTypeGuard = require('./createTypeGuard-CC3eS9IQ.cjs'); //#region src/functions/without/without.ts /** * Returns a new array containing all elements of the input array except the specified items to exclude. * @param array The input array to exclude items from. * @param itemsToExclude An iterable of items to exclude from the input array. * @returns A new array containing all elements of the input array except the specified items to exclude. * @example * ```ts * without([1, 2, 3], [2, 3]) // [1] * without(['a', 'b', 'c'], ['b', 'c']) // ['a'] * without([1, 2, 3], []) // [1, 2, 3] */ function without(array, itemsToExclude) { const isItemToExclude = require_createTypeGuard.createTypeGuard(itemsToExclude); return array.filter((item) => !isItemToExclude(item)); } //#endregion Object.defineProperty(exports, 'without', { enumerable: true, get: function () { return without; } }); //# sourceMappingURL=without-B1K1UmyO.cjs.map