@nevware21/ts-utils
    Preparing search index...

    Function getKnownSymbol

    • If Symbols are supported then get the property of the global Symbol, if Symbol's are not supported and noPoly is true it returns null. Used to access the well known symbols.

      Type Parameters

      • T = symbol

      Parameters

      • name: string | WellKnownSymbols

        The property name to return (if it exists) for Symbol

      • OptionalnoPoly: boolean

        Flag indicating whether to return a polyfill if symbols are not supported.

      Returns T

      The value of the property if present

      // If Symbol is supported in the runtime
      getKnownSymbol("toStringTag") === Symbol.toStringTag; // true
      getKnownSymbol(WellKnownSymbols.toStringTag) === Symbol.toStringTag; // true