jsbook icon indicating copy to clipboard operation
jsbook copied to clipboard

redux4的isPlainObject

Open RubyLouvre opened this issue 6 years ago • 0 comments

function isPlainObject(obj) {
  if (typeof obj !== 'object' || obj === null) return false

  let proto = obj
  while (Object.getPrototypeOf(proto) !== null) {
    proto = Object.getPrototypeOf(proto)
  }

  return Object.getPrototypeOf(obj) === proto
}

RubyLouvre avatar Apr 25 '18 03:04 RubyLouvre