Options
All
  • Public
  • Public/Protected
  • All
Menu

External module @corpuscule/utils/lib/propertyUtils

This module provides tools to work with different kinds of properties: string, symbolic, and private, — identically.

Usage

import {getName} from '@corpuscule/utils/lib/propertyUtils'

Index

Functions

Functions

getName

  • getName<P>(property: P): P extends number ? number : string
  • Extracts string name from a class property. If the property is a symbol, its description will be returned.

    Type parameters

    • P: PropertyKey

    Parameters

    • property: P

      string or symbol property.

      Example

      const foo = 'foo';
      const bar = Symbol('bar');
      
      getName(foo); // foo
      getName(bar); // bar

    Returns P extends number ? number : string

Generated using TypeDoc