is-plain-object
Advanced tools
Comparing version 0.1.0 to 1.0.0
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; | ||
}; |
{ | ||
"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._ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
1
0
70
3803
1
4
11
+ Addedisobject@^0.2.0
+ Addedisobject@0.2.0(transitive)