Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

is-plain-object

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

is-plain-object - npm Package Compare versions

Comparing version 0.1.0 to 1.0.0

LICENSE

10

index.js
/*!
* is-plain-object <https://github.com/jonschlinkert/is-plain-object>
*
* Copyright (c) 2014 Jon Schlinkert, contributors.
* Licensed under the MIT License
* Copyright (c) 2014-2015, Jon Schlinkert.
* Licensed under the MIT License.
*/

@@ -10,4 +10,6 @@

var isObject = require('isobject');
module.exports = function isPlainObject(o) {
return !!o && typeof o === 'object' && o.constructor === Object;
};
return isObject(o) && o.constructor === Object;
};

44

package.json
{
"name": "is-plain-object",
"description": "Return `true` if the given `value` is an object created by the `Object` constructor.",
"version": "0.1.0",
"description": "Returns true if an object was created by the `Object` constructor.",
"version": "1.0.0",
"homepage": "https://github.com/jonschlinkert/is-plain-object",

@@ -17,8 +17,22 @@ "author": {

},
"licenses": [
{
"type": "MIT",
"url": "https://github.com/jonschlinkert/is-plain-object/blob/master/LICENSE-MIT"
}
"license": {
"type": "MIT",
"url": "https://github.com/jonschlinkert/is-plain-object/blob/master/LICENSE"
},
"files": [
"index.js"
],
"main": "index.js",
"engines": {
"node": ">=0.10.0"
},
"scripts": {
"test": "mocha"
},
"dependencies": {
"isobject": "^0.2.0"
},
"devDependencies": {
"mocha": "*"
},
"keywords": [

@@ -35,15 +49,3 @@ "object",

"type"
],
"main": "index.js",
"engines": {
"node": ">=0.10.0"
},
"scripts": {
"test": "mocha -R spec"
},
"devDependencies": {
"verb": "~0.2.6",
"chai": "~1.9.1",
"mocha": "*"
}
}
]
}

@@ -1,8 +0,9 @@

# is-plain-object [![NPM version](https://badge.fury.io/js/is-plain-object.png)](http://badge.fury.io/js/is-plain-object)
# is-plain-object [![NPM version](https://badge.fury.io/js/is-plain-object.svg)](http://badge.fury.io/js/is-plain-object)
> Return `true` if the given `value` is an object created by the `Object` constructor.
> Returns true if an object was created by the `Object` constructor.
## Install
#### [npm](npmjs.org)
Use [isobject](https://github.com/jonschlinkert/isobject) if you only want to check if the value is an object and not an array or null.
## Install with [npm](npmjs.org)
```bash

@@ -12,8 +13,10 @@ npm i is-plain-object --save

## Run tests
## Running tests
Install dev dependencies.
```bash
npm test
npm i -d && npm test
```
## Usage

@@ -23,29 +26,32 @@

var isPlainObject = require('is-plain-object');
```
**true** when created by the `Object` constructor.
```js
isPlainObject(Object.create({}));
//=> true
isPlainObject(Object.create(Object.prototype));
//=> true
isPlainObject({foo: 'bar'});
//=> true
isPlainObject({});
//=> true
```
**false** when not created by the `Object` constructor.
```js
isPlainObject(1);
//=> false
isPlainObject(['foo', 'bar']);
//=> false
isPlainObject([]);
//=> false
isPlainObject(new Foo);
//=> false
isPlainObject(null);
//=> false
isPlainObject(Object.create(null));
//=> false
isPlainObject(Object.create({}));
//=> true
isPlainObject({foo: 'bar'});
//=> true
isPlainObject({});
//=> true
```

@@ -61,3 +67,3 @@

## License
Copyright (c) 2014 Jon Schlinkert, contributors.
Copyright (c) 2015 Jon Schlinkert
Released under the MIT license

@@ -67,2 +73,2 @@

_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on September 21, 2014._
_This file was generated by [verb](https://github.com/assemble/verb) on February 25, 2015._
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc