🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more

es6-symbol

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
e

es6-symbol

ECMAScript 6 Symbol polyfill

3.1.4
latest
67

Supply Chain Security

100

Vulnerability

100

Quality

51

Maintenance

100

License

Socket optimized override available

Maintenance

Package can be replaced with a Socket optimized override.

Found 1 instance in 1 package

Dependencies have 2 high alerts.

Protestware or potentially unwanted behavior

Version published
Weekly downloads
9.5M
-4.92%
Maintainers
1
Weekly downloads
 
Created
Issues
2

What is es6-symbol?

The es6-symbol npm package provides a polyfill for the Symbol type introduced in ECMAScript 6. It offers a way to create unique identifiers that can be used as property keys in objects without the risk of name clashes. This is particularly useful for creating private or special properties that should not interfere with other properties in the object.

What are es6-symbol's main functionalities?

Creating symbols

This feature allows the creation of symbols, which can be used as unique identifiers. The code sample demonstrates how to create a symbol using the es6-symbol package.

var symbol = require('es6-symbol');
var mySymbol = symbol('mySymbol');

Using symbols as property keys

Symbols can be used as property keys in objects. This code sample shows how to assign and access a property in an object using a symbol as the key.

var symbol = require('es6-symbol');
var mySymbol = symbol('mySymbol');
var obj = {};
obj[mySymbol] = 'value';
console.log(obj[mySymbol]); // 'value'

Well-known symbols

The package provides access to well-known symbols defined by the ECMAScript specification, such as Symbol.iterator. This code sample demonstrates how to access a well-known symbol.

var symbol = require('es6-symbol');
var iteratorSymbol = symbol.iterator;
console.log(typeof iteratorSymbol); // 'symbol'

Other packages similar to es6-symbol

FAQs

Package last updated on 01 Mar 2024

Did you know?

Socket

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