Skip to content

Commit

Permalink
fix: code documentation of the attribute helper class
Browse files Browse the repository at this point in the history
  • Loading branch information
SGrueber authored and shauke committed Jan 10, 2022
1 parent 2e3f5bf commit 44111ab
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/app/core/models/attribute/attribute.helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import { Attribute } from './attribute.model';

export class AttributeHelper {
/**
* Get a specific product attribute by attribute name.
* @param product The Product for which to get the attribute
* @param attributeName The attribute name of the attribute to get
* @returns The matching product attribute
* Gets a specific attribute by attribute name.
* @param attributes An array of attributes belonging to an object (e.g. product, basket etc.).
* @param attributeName The attribute name of the attribute to get.
* @returns The matching attribute.
*/
static getAttributeByAttributeName(attributes: Attribute[], attributeName: string): Attribute {
if (!attributes) {
Expand All @@ -15,7 +15,11 @@ export class AttributeHelper {
}

/**
* check if attribute is available and return value, otherwise undefined
* Gets an attribute value of an attribute within an attribute array.
* Checks if the attribute is available and returns the value, otherwise undefined.
* @param attributes An array of attributes belonging to an object (e.g. product, basket etc.).
* @param attributeName The attribute name of the appropriate attribute.
* @returns The matching attribute value.
*/
static getAttributeValueByAttributeName<T>(attributes: Attribute[], attributeName: string) {
const attribute = AttributeHelper.getAttributeByAttributeName(attributes, attributeName);
Expand Down

0 comments on commit 44111ab

Please sign in to comment.