Skip to content

Function: isSymbol() ​

isSymbol(inp): boolean

Tell whether a value is a symbol primitive (Symbol('id'), Symbol.for('id'), Symbol.iterator). A symbol wrapped in an object (Object(Symbol())) is not one.

Parameters ​

inp ​

any

The value to test, of any type.

Returns ​

boolean

true when typeof inp is 'symbol', false otherwise.

Example ​

typescript
import {isSymbol} from 'lakutata/utils'

console.log(isSymbol(Symbol('id')), isSymbol('id'))
//true false

Released under the MIT License.