All files / src/preds isPlainObj.ts

88.89% Statements 8/9
83.33% Branches 5/6
100% Functions 1/1
88.89% Lines 8/9
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21  15x 15x     1824x   339x 339x 339x             1485x   15x    
import isObj from "./isObj";
 
export default function isPlainObject( x ) {
// Basic check for Type object that's not null
  if ( isObj( x ) ) {
 
    // If Object.getPrototypeOf supported, use it
    if (E typeof Object.getPrototypeOf == 'function' ) {
      var proto = Object.getPrototypeOf( x );
      return proto === Object.prototype || proto === null;
    }
 
    // Otherwise, use internal class
    // This should be reliable as if getPrototypeOf not supported, is pre-ES5
    return Object.prototype.toString.call( x ) == '[object Object]';
  }
 
  // Not an object
  return false;
}