Copy of array without value.
import { Arrays } from 'https://unpkg.com/ixfx/dist/data.js';
const data = [100, 20, 40];
const filtered = Arrays.without(data, 20); // [100, 40]
import { Arrays } from 'https://unpkg.com/ixfx/dist/data.js';
const data = [{name: `Alice`}, {name:`Sam`}];
// This wouldn't work as expected, because the default comparer uses instance,
// not value:
Arrays.without(data, {name: `Alice`});
// So instead we can use a value comparer:
Arrays.without(data, {name:`Alice`}, isEqualValueDefault);
import { Arrays } from 'https://unpkg.com/ixfx/dist/data.js';
const data = [{name: `Alice`}, {name:`Sam`}];
Arrays.without(data, {name:`ALICE`}, (a, b) => {
return (a.name.toLowerCase() === b.name.toLowerCase());
});
Consider remove to remove an item by index.
Returns an array with value(s) omitted. If value is not found, result will be a copy of input. Value checking is completed via the provided
comparer
function. By default checking whethera === b
. To compare based on value, use theisEqualValueDefault
comparer.