is-data-descriptor
Returns true if a value has the characteristics of a valid JavaScript data descriptor.
Install
Install with npm
$ npm i is-data-descriptor --save
Usage
var isDataDesc = require('is-data-descriptor');
Examples
true
when the descriptor has valid properties with valid values.
isDataDesc({value: 'foo'})
isDataDesc({value: function() {}})
isDataDesc({value: true})
false
when not an object
isDataDesc('a')
isDataDesc(null)
isDataDesc([])
false
when the object has invalid properties
isDataDesc({value: 'foo', bar: 'baz'})
isDataDesc({value: 'foo', bar: 'baz'})
isDataDesc({value: 'foo', get: function(){}})
isDataDesc({get: function(){}, value: 'foo'})
false
when a value is not the correct type
isDataDesc({value: 'foo', enumerable: 'foo'})
isDataDesc({value: 'foo', configurable: 'foo'})
isDataDesc({value: 'foo', writable: 'foo'})
Related projects
Running tests
Install dev dependencies:
$ npm i -d && npm test
Contributing
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.
Author
Jon Schlinkert
License
Copyright © 2015 Jon Schlinkert
Released under the MIT license.
This file was generated by verb-cli on October 04, 2015.