Skip to content

Latest commit

 

History

History
33 lines (25 loc) · 846 Bytes

README.md

File metadata and controls

33 lines (25 loc) · 846 Bytes

isPOJO

check whether an object is a Plain Javascript Object

Install

$ npm install @gyumeijie/is-pojo

Usage

const isPlainObject = require('@gyumeijie/is-pojo');

isPlainObject({})  //true
isPlainObject(Object.create(null))  //true
isPlainObject(Object.create(Object.prototype))  //true
isPlainObject({ constructor: function Foo() {} })  //true
isPlainObject(Object.create({}))  //false
isPlainObject('string')  //false
isPlainObject(undefined)  //false
isPlainObject(1)  //false
isPlainObject(() => {})  //false
isPlainObject([])  //false
isPlainObject([1, 2, 3, 4])  //false
isPlainObject(new Date())  //false
isPlainObject(/regexp/)  //false

License

MIT © Gyumeijie