Class Support

Detect native class support.

Usage

var hasClassSupport = require( '@stdlib/assert/has-class-support' );

hasClassSupport()

Detects if a runtime environment supports ES2015 class.

var bool = hasClassSupport();
// returns <boolean>

Notes

  • The implementation uses code evaluation, which may be problematic in browser contexts enforcing a strict content security policy (CSP).

Examples

var hasClassSupport = require( '@stdlib/assert/has-class-support' );

var bool = hasClassSupport();
if ( bool ) {
    console.log( 'Environment has native class support.' );
} else {
    console.log( 'Environment lacks native class support.' );
}

CLI

Usage

Usage: has-class-support [options]

Options:

  -h,    --help                Print this message.
  -V,    --version             Print the package version.

Examples

$ has-class-support
<boolean>
Did you find this page helpful?