Skip to main content
isSymbol - util - Node documentation
function isSymbol

Usage in Deno

import { isSymbol } from "node:util";
isSymbol(object: unknown): object is symbol
Deprecated

Since v4.0.0 - Use typeof value === 'symbol' instead.

Returns true if the given object is a Symbol. Otherwise, returns false.

import util from 'node:util';

util.isSymbol(5);
// Returns: false
util.isSymbol('foo');
// Returns: false
util.isSymbol(Symbol('foo'));
// Returns: true

Parameters

object: unknown

Return Type

object is symbol