Socket
Socket
Sign inDemoInstall

is-data-descriptor

Package Overview
Dependencies
6
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    is-data-descriptor

Returns true if a value has the characteristics of a valid JavaScript data descriptor.


Version published
Weekly downloads
30M
decreased by-5.08%
Maintainers
1
Install size
50.4 kB
Created
Weekly downloads
 

Package description

What is is-data-descriptor?

The is-data-descriptor npm package is used to determine if an object is a valid data descriptor. Data descriptors are object keys that have attributes like value, writable, enumerable, and configurable. This package checks if a given object conforms to the specification of a data descriptor.

What are is-data-descriptor's main functionalities?

Check if an object is a data descriptor

This feature allows you to verify if a given object is a valid data descriptor by checking its properties and their respective values.

const isDataDescriptor = require('is-data-descriptor');

const descriptor = {value: 'value', writable: true, enumerable: true, configurable: true};
const result = isDataDescriptor(descriptor); // result is true

Other packages similar to is-data-descriptor

Changelog

Source

v0.1.3 - 2015-10-04

Commits

  • files prop b0b7700

Readme

Source

is-data-descriptor NPM version

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.

// `value` can be anything
isDataDesc({value: 'foo'})
isDataDesc({value: function() {}})
isDataDesc({value: true})
//=> true

false when not an object

isDataDesc('a')
//=> false
isDataDesc(null)
//=> false
isDataDesc([])
//=> false

false when the object has invalid properties

isDataDesc({value: 'foo', bar: 'baz'})
//=> false
isDataDesc({value: 'foo', bar: 'baz'})
//=> false
isDataDesc({value: 'foo', get: function(){}})
//=> false
isDataDesc({get: function(){}, value: 'foo'})
//=> false

false when a value is not the correct type

isDataDesc({value: 'foo', enumerable: 'foo'})
//=> false
isDataDesc({value: 'foo', configurable: 'foo'})
//=> false
isDataDesc({value: 'foo', writable: 'foo'})
//=> false

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.

Keywords

FAQs

Last updated on 04 Oct 2015

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc