isSymbolArray

Test if a value is an array-like object containing only symbols.

Usage

var isSymbolArray = require( '@stdlib/assert/is-symbol-array' );

isSymbolArray( value )

Tests if a value is an array-like object containing only symbols.

var bool = isSymbolArray( [ Symbol( 'beep' ), Symbol( 'boop' ) ] );
// returns true

bool = isSymbolArray( [ 'beep', 'boop' ] );
// returns false

isSymbolArray.primitives( value )

Tests if a value is an array-like object containing only symbol primitives.

var bool = isSymbolArray.primitives( [ Symbol( 'beep' ), Symbol( 'boop' ) ] );
// returns true

bool = isSymbolArray.primitives( [ Symbol( 'beep' ), Object( Symbol( 'boop' ) ) ] );
// returns false

isSymbolArray.objects( value )

Tests if a value is an array-like object containing only Symbol objects.

var bool = isSymbolArray.objects( [ Object( Symbol( 'beep' ) ), Object( Symbol( 'boop' ) ) ] );
// returns true

bool = isSymbolArray.objects( [ Symbol( 'beep' ), Symbol( 'boop' ) ] );
// returns false

Examples

var hasSymbols = require( '@stdlib/utils/detect-symbol-support' )();
var isSymbolArray = require( '@stdlib/assert/is-symbol-array' );

var bool;

if ( hasSymbols ) {
    bool = isSymbolArray( [ Symbol( 'beep' ), Symbol( 'boop' ) ] );
    // returns true

    bool = isSymbolArray( [ Symbol( 'beep' ), 'boop' ] );
    // returns false

    bool = isSymbolArray( Symbol( 'beep' ) );
    // returns false
} else {
    console.log( 'Environment does not support symbols.' );
}
bool = isSymbolArray( [ 'beep', 'boop' ] );
// returns false

bool = isSymbolArray( [] );
// returns false

bool = isSymbolArray( 'abc' );
// returns false

bool = isSymbolArray( null );
// returns false