Socket
Socket
Sign inDemoInstall

to-property-key-x

Package Overview
Dependencies
30
Maintainers
1
Versions
28
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    to-property-key-x

Converts argument to a value that can be used as a property key.


Version published
Weekly downloads
4.7K
decreased by-27.68%
Maintainers
1
Install size
2.46 MB
Created
Weekly downloads
 

Readme

Source

Travis status Dependency status devDependency status npm version jsDelivr hits bettercodehub score Coverage Status

to-property-key-x

Converts argument to a value that can be used as a property key.

Version: 2.0.2
Author: Xotic750 Xotic750@gmail.com
License: MIT
Copyright: Xotic750

module.exports(argument)string | symbol

This method Converts argument to a value that can be used as a property key.

Kind: Exported function
Returns: string | symbol - The converted argument.
Throws:

  • TypeError If argument is not a symbol and is not coercible to a string.
ParamTypeDescription
argument*The argument to onvert to a property key.

Example

import toPropertyKey from 'to-property-key-x';

console.log(toPropertyKey()); // 'undefined'
console.log(toPropertyKey(1)); // '1'
console.log(toPropertyKey(true)); // 'true'

const symbol = Symbol('a');
console.log(toPropertyKey(symbol)); // symbol

toPropertyKey(Object.create(null)); // TypeError

Keywords

FAQs

Last updated on 28 Aug 2019

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