MCPcopy Create free account
hub / github.com/jquery/jquery-ui / objectValuesSubset

Function objectValuesSubset

external/qunit/qunit.js:375–393  ·  view source on GitHub ↗

* Recursively clone an object into a plain object, taking only the * subset of own enumerable properties that exist a given model. * * @param {any} obj * @param {any} model * @return {Object}

(obj, model)

Source from the content-addressed store, hash-verified

373 * @return {Object}
374 */
375 function objectValuesSubset(obj, model) {
376 // Return primitive values unchanged to avoid false positives or confusing
377 // results from assert.propContains().
378 // E.g. an actual null or false wrongly equaling an empty object,
379 // or an actual string being reported as object not matching a partial object.
380 if (obj !== Object(obj)) {
381 return obj;
382 }
383
384 // Unlike objectValues(), subset arrays to a plain objects as well.
385 // This enables subsetting [20, 30] with {1: 30}.
386 var subset = {};
387 for (var key in model) {
388 if (hasOwn$1.call(model, key) && hasOwn$1.call(obj, key)) {
389 subset[key] = objectValuesSubset(obj[key], model[key]);
390 }
391 }
392 return subset;
393 }
394 function extend(a, b, undefOnly) {
395 for (var prop in b) {
396 if (hasOwn$1.call(b, prop)) {

Callers 1

qunit.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…