UNPKG

@newdash/newdash

Version:

javascript/typescript utility library

26 lines (25 loc) 1.05 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const baseIsMatch_1 = __importDefault(require("./baseIsMatch")); const getMatchData_1 = __importDefault(require("./getMatchData")); const matchesStrictComparable_1 = __importDefault(require("./matchesStrictComparable")); /** * The base implementation of `matches` which doesn't clone `source`. * * @private * @param {Object} source The object of property values to match. * @returns {Function} Returns the new spec function. */ function baseMatches(source) { const matchData = (0, getMatchData_1.default)(source); if (matchData.length == 1 && matchData[0][2]) { return (0, matchesStrictComparable_1.default)(matchData[0][0], matchData[0][1]); } return function (object) { return object === source || (0, baseIsMatch_1.default)(object, source, matchData); }; } exports.default = baseMatches;