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

validate.io-object

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

validate.io-object - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

38

lib/index.js

@@ -11,7 +11,7 @@ /**

* NOTES:
* [1]
* [1]
*
*
* TODO:
* [1]
* [1]
*

@@ -30,21 +30,25 @@ *

(function() {
'use strict';
'use strict';
/**
* FUNCTION: isObject( value )
* Validates if a value is a plain object; e.g., {}.
*
* @param {*} value - value to be validated
* @returns {Boolean} boolean indicating whether value is a plain object
*/
function isObject( value ) {
return ( typeof value === 'object' && value !== null && Array.isArray( value ) !== true );
} // end FUNCTION isObject()
// MODULES //
var isArray = require( 'validate.io-array' );
// EXPORTS //
module.exports = isObject;
// ISOBJECT //
})();
/**
* FUNCTION: isObject( value )
* Validates if a value is a plain object; e.g., {}.
*
* @param {*} value - value to be validated
* @returns {Boolean} boolean indicating whether value is a plain object
*/
function isObject( value ) {
return ( typeof value === 'object' && value !== null && !isArray( value ) );
} // end FUNCTION isObject()
// EXPORTS //
module.exports = isObject;
{
"name": "validate.io-object",
"version": "1.0.0",
"version": "1.0.1",
"description": "Validates if a value is a plain JavaScript object.",

@@ -29,2 +29,3 @@ "author": {

"validation",
"validate",
"valid",

@@ -36,3 +37,5 @@ "object"

},
"dependencies": {},
"dependencies": {
"validate.io-array": "^1.0.1"
},
"devDependencies": {

@@ -42,3 +45,5 @@ "chai": "1.x.x",

"istanbul": "^0.3.0",
"mocha": "1.x.x"
"mocha": "1.x.x",
"jshint": "^2.5.10",
"jshint-stylish": "^1.0.0"
},

@@ -45,0 +50,0 @@ "licenses": [

@@ -20,12 +20,16 @@ Object

To use the module,
``` javascript
var isObject = require( 'validate.io-object' );
```
console.log( isObject( {} ) );
// Returns true
console.log( isObject( [] ) );
// Returns false
#### isObject( value )
Validates if a `value` is a plain JavaScript `object`.
``` javascript
var value = {};
var bool = isObject( value );
// returns true
```

@@ -36,2 +40,13 @@

``` javascript
console.log( isObject( {} ) );
// returns true
console.log( isObject( null ) );
// returns false
console.log( isObject( [] ) );
// returns false
```
To run the example code from the top-level application directory,

@@ -48,3 +63,3 @@

Unit tests use the [Mocha](http://visionmedia.github.io/mocha) test framework with [Chai](http://chaijs.com) assertions. To run the tests, execute the following command in the top-level application directory:
Unit tests use the [Mocha](http://mochajs.org) test framework with [Chai](http://chaijs.com) assertions. To run the tests, execute the following command in the top-level application directory:

@@ -69,6 +84,7 @@ ``` bash

``` bash
$ open reports/coverage/lcov-report/index.html
$ make view-cov
```
---
## License

@@ -79,3 +95,2 @@

---
## Copyright

@@ -103,2 +118,2 @@

[github-issues-image]: http://img.shields.io/github/issues/validate-io/object.svg
[github-issues-url]: https://github.com/validate-io/object/issues
[github-issues-url]: https://github.com/validate-io/object/issues
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