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

const hasOnlyLodash1= (obj, props) => _.isEqual(_.keys(obj).sort(), props.sort())

make1ValuedObj = keys => _.zipObject(keys, Array(keys.length).fill(1))
hasOnlyLodash2 = (obj, props) => _.isEqual(make1ValuedObj(_.keys(obj)), make1ValuedObj(props))


hasOnlyNative = (obj,props) => {
	var objProps = Object.keys(obj)
	return objProps.length == props.length && props.every(p => objProps.includes(p))
}
delete caserun single casemove downdrag and drop case


ready





hasOnlyLodash1(obj,['name','age']) //return false

hasOnlyLodash1(obj,['name','age','city']) //return false

hasOnlyLodash1(obj,['name','age','school']) //return true
delete caserun single casemove upmove downdrag and drop case


ready





hasOnlyLodash2(obj,['name','age']) //return false

hasOnlyLodash2(obj,['name','age','city']) //return false

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


ready





hasOnlyNative(obj,['name','age']) //return false

hasOnlyNative(obj,['name','age','city']) //return false

hasOnlyNative(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