has-symbols
's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.Name | Version | Size | License | Type | Vulnerabilities |
---|
"Has-symbols" is an npm package that is designed to determine if the JavaScript environment supports Symbol functionality. JavaScript Symbols are a unique and immutable data type that may be used as an identifier for object properties. With "has-symbols", you can check if this feature is supported natively, without any workarounds or shams.
The use of "has-symbols" is straightforward. You first need to install the package using the command npm install has-symbols
. Then you can require the module in your JavaScript file and use it to check if the environment has native support for Symbols.
Here is a usage example:
var hasSymbols = require('has-symbols');
if(hasSymbols()) {
console.log("The environment supports native Symbol functionality");
}else {
console.log("The environment does not support native Symbol functionality");
}
In the example above, the hasSymbols()
function will return true if the environment natively supports JavaScript's Symbol feature, and false if it does not. Additionally, there is also a hasSymbolsKinda()
function which can be used to check if the environment has a Symbol sham that mostly follows the spec.
The documentation for "has-symbols" can be found in the README file of the package's GitHub repository. For more details on how to use this package as well as details on supported Symbol shams like 'get-own-property-symbols' and 'core-js', you can visit the GitHub repository at git://github.com/inspect-js/has-symbols.git.