lodash: check object is empty

Your example object is not empty so instead perhaps you want to test if all properties are undefined

let o = {foo: undefined};
!_.values(o).some(x => x !== undefined); // true

_.isEmpty(obj, true)

var obj = {
  'firstName': undefined
, 'lastName' : undefined
};

console.log(_.isEmpty(obj)); // false
console.log(_.isEmpty({})); // true
<script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.4/lodash.js"></script>

Please, see http://www.ericfeminella.com/blog/2012/08/18/determining-if-an-object-is-empty-with-underscore-lo-dash/