Implement a function conformsTo(obj, source) that checks if the given object satisfies the conditions defined in the source object.
The function should:
true if for every key in source, the corresponding value in obj passes the predicate function in source.false otherwise.source does not exist in obj, treat it as failing the predicate.Example
const obj = { a: 5, b: 10 }; const source = { a: x => x > 0, b: y => y < 20 }; conformsTo(obj, source); // true const source2 = { a: x => x < 0 }; conformsTo(obj, source2); // false
JavaScript Function
No test results yet
Click "Run" to execute tests