express check if object is empty
snippet in javascript

express check if object is empty

user6212

if(Object.keys(obj).length === 0) {

}

react native object is empty

user117

//when this.state.errors object is empty 
if (Object.keys(this.state.errors).length == 0) {
  this.props.updateUser(user);
  this.props.navigation.goBack();
}