
Product
Announcing Socket Fix 2.0
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
@stdlib/assert-has-symbol-support
Advanced tools
@stdlib/assert-has-symbol-support is a package that allows you to check if the runtime environment supports ES6 symbols. This can be useful for ensuring compatibility and feature detection in JavaScript applications.
Check Symbol Support
This feature allows you to check if the current environment supports ES6 symbols. The function returns a boolean value indicating the presence or absence of symbol support.
const hasSymbolSupport = require('@stdlib/assert-has-symbol-support');
if (hasSymbolSupport()) {
console.log('Symbols are supported.');
} else {
console.log('Symbols are not supported.');
}
The 'has-symbols' package checks for native Symbol support in the runtime environment. It provides similar functionality to @stdlib/assert-has-symbol-support by returning a boolean value indicating whether symbols are supported.
The 'is-symbol' package checks if a given value is a symbol. While it does not directly check for symbol support in the environment, it can be used in conjunction with other packages to achieve similar goals.
The 'core-js' package is a comprehensive polyfill library that includes support for ES6 symbols among many other features. It can be used to ensure compatibility across different environments, but it is more heavyweight compared to @stdlib/assert-has-symbol-support.
We believe in a future in which the web is a preferred environment for numerical computation. To help realize this future, we've built stdlib. stdlib is a standard library, with an emphasis on numerical and scientific computation, written in JavaScript (and C) for execution in browsers and in Node.js.
The library is fully decomposable, being architected in such a way that you can swap out and mix and match APIs and functionality to cater to your exact preferences and use cases.
When you use stdlib, you can be absolutely certain that you are using the most thorough, rigorous, well-written, studied, documented, tested, measured, and high-quality code out there.
To join us in bringing numerical computing to the web, get started by checking us out on GitHub, and please consider financially supporting stdlib. We greatly appreciate your continued support!
Detect native
Symbol
support.
npm install @stdlib/assert-has-symbol-support
var hasSymbolSupport = require( '@stdlib/assert-has-symbol-support' );
Detects if a runtime environment supports ES2015 Symbol
.
var bool = hasSymbolSupport();
// returns <boolean>
var hasSymbolSupport = require( '@stdlib/assert-has-symbol-support' );
var bool = hasSymbolSupport();
if ( bool ) {
console.log( 'Environment has Symbol support.' );
} else {
console.log( 'Environment lacks Symbol support.' );
}
@stdlib/assert-has-symbol-support-cli
: CLI package for use as a command-line utility.@stdlib/assert-has-iterator-symbol-support
: detect native Symbol.iterator support.This package is part of stdlib, a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more.
For more information on the project, filing bug reports and feature requests, and guidance on how to develop stdlib, see the main project repository.
See LICENSE.
Copyright © 2016-2024. The Stdlib Authors.
FAQs
Detect native Symbol support.
We found that @stdlib/assert-has-symbol-support demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 open source maintainers collaborating on the project.
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.
Product
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
Security News
Socket CEO Feross Aboukhadijeh joins Risky Business Weekly to unpack recent npm phishing attacks, their limited impact, and the risks if attackers get smarter.
Product
Socket’s new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.