API
@agape/metadata

Noun Decorator

Specifies a noun for the decorated class, property, method, or parameter.

API

@Noun(  noun: undefined | string,  plural?: string)

Noun

Specifies a noun for the decorated class, property, method, or parameter.

@paramnoun:  undefined | string
@paramplural:  string

Description

Specifies a noun for the decorated class, property, method, or parameter.

Nouns can be used when referencing the object or attribute.

This decorator sets the noun and nounPlural properties on the associated MetadataDescriptor.

Usage

Class

@Noun('product', 'products')
class Product {
  name: string;
  price: number;
}

Property

class Product {
  @Noun('SKU')
  skuCode: string;
}

Method

class ProductService {
  @Noun('product')
  getProduct(id: string): void {
    // ...
  }
}

Parameter

class ProductService {
  create(@Noun('product') product: Product): void {
    // ...
  }
}