Skip to content

Commit

Permalink
Removed comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Fonoster Team committed Jan 13, 2019
1 parent 900e97a commit e20da73
Showing 1 changed file with 1 addition and 15 deletions.
16 changes: 1 addition & 15 deletions mod/utils/obj_util.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,12 @@
var hasOwnProperty = Object.prototype.hasOwnProperty

export default function isEmpty(obj) {

// null and undefined are "empty"
if (obj == null) return true

// Assume if it has a length property with a non-zero value
// that that property is correct.
if (obj.length > 0) return false
if (obj.length === 0) return true

// If it isn't an object at this point
// it is empty, but it can't be anything *but* empty
// Is it empty? Depends on your application.
if (typeof obj !== "object") return true

// Otherwise, does it have any properties of its own?
// Note that this doesn't handle
// toString and valueOf enumeration bugs in IE < 9
for (var key in obj) {
if (hasOwnProperty.call(obj, key)) return false
}

return true
}
}

0 comments on commit e20da73

Please sign in to comment.