UNPKG

corde

Version:

A simple library for Discord bot tests

39 lines (29 loc) 784 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true, }); exports.isPartialOf = void 0; function isPartialOf(sample, holder) { if (!sample && !holder) { return true; } if ((!sample && holder) || (sample && !holder)) { return false; } const sampleProps = Object.getOwnPropertyNames(sample); for (let i = 0; i < sampleProps.length; i++) { const propName = sampleProps[i]; const sampleProp = sample[propName]; const holderProp = holder[propName]; if (typeof sampleProp === "object") { const result = isPartialOf(holderProp, sampleProp); if (!result) { return false; } } else if (holderProp !== sampleProp) { return false; } } return true; } exports.isPartialOf = isPartialOf;