MCPcopy Index your code
hub / github.com/gridstack/gridstack.js / defaults

Method defaults

src/utils.ts:421–436  ·  view source on GitHub ↗
(target, ...sources)

Source from the content-addressed store, hash-verified

419 */
420 // eslint-disable-next-line
421 static defaults(target, ...sources): {} {
422
423 sources.forEach(source => {
424 for (const key in source) {
425 if (!source.hasOwnProperty(key)) return;
426 if (target[key] === null || target[key] === undefined) {
427 target[key] = source[key];
428 } else if (typeof source[key] === 'object' && typeof target[key] === 'object') {
429 // property is an object, recursively add it's field over... #1373
430 Utils.defaults(target[key], source[key]);
431 }
432 }
433 });
434
435 return target;
436 }
437
438 /**
439 * Compare two objects for equality (shallow comparison).

Callers 4

prepareNodeMethod · 0.80
constructorMethod · 0.80
addWidgetMethod · 0.80
utils-spec.tsFile · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected