@newdash/newdash
Version:
javascript/typescript utility library
30 lines (29 loc) • 1.1 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const baseDifference_1 = __importDefault(require("./.internal/baseDifference"));
const isArrayLikeObject_1 = __importDefault(require("./isArrayLikeObject"));
/**
* Creates an array excluding all given values using
* [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
* for equality comparisons.
*
* **Note:** Unlike `pull`, this method returns a new array.
*
* @since 0.1.0
* @category Array
* @param {Array} array The array to inspect.
* @param {...*} [values] The values to exclude.
* @returns {Array} Returns the new array of filtered values.
* @see difference, union, unionBy, unionWith, xor, xorBy, xorWith
* @example
*
* without([2, 1, 2, 3], 1, 2)
* // => [3]
*/
function without(array, ...values) {
return (0, isArrayLikeObject_1.default)(array) ? (0, baseDifference_1.default)(array, values) : [];
}
exports.default = without;