v1
2/4/2022 by user3297291 -00
Setup HTML - click to add setup HTML
disable setup JavaScript
Setup JavaScript
const obj = {
    name: undefined,
  age: 15,
  school: 'Some school'
}

const size = x => x.length;
const keys = x => Object.keys(x);
const every = (x, y) => y.every(x);
const includes = x => y => x.includes(y);

const hasOnlyDirect = (obj,props) => {
	var objProps = Object.keys(obj)
	return objProps.length == props.length && props.every(p => objProps.includes(p))
};

const hasOnlyFn = (obj,props) => {
    const objProps = keys(obj)
    return size(objProps) == size(props) && every(includes(objProps), props);
};
delete caserun single casemove downdrag and drop case


ready



hasOnlyDirect(obj,['name','age']) //return false
hasOnlyDirect(obj,['name','age','city']) //return false
hasOnlyDirect(obj,['name','age','school']) //return true
delete caserun single casemove updrag and drop case


ready



hasOnlyFn(obj,['name','age']) //return false
hasOnlyFn(obj,['name','age','city']) //return false
hasOnlyFn(obj,['name','age','school']) //return true
Test Case - click to add another test case
Teardown JS - click to add teardown JavaScript
Output (DOM) - click to monitor output (DOM) while test is running
RUN