module powerbi . extensibility . visual { function param { DataViewObjects } objects param { string } objectName param { string } propertyName param { T } defaultValue export function getValue < T > ( objects , objectName , propertyName , defaultValue ) { if ( objects ) { let object = objects [ objectName ] ; if ( object ) { let property = < T > object [ propertyName ] ; if ( property !== undefined ) { return property ; } } } return defaultValue ; } function param { DataViewObjects } objects param { string } objectName param { string } propertyName param { T } defaultValue export function getValueMinMax < T > ( objects , objectName , propertyName , defaultValue , minVal , maxVal ) { if ( objects ) { let object = objects [ objectName ] ; if ( object ) { let property = < T > object [ propertyName ] ; if ( property < minVal ) { return minVal ; } if ( property > maxVal ) { return maxVal ; } if ( property !== undefined ) { return property ; } } } return defaultValue ; } function param { DataViewObjects } objects param { string } objectName param { string } propertyName param { T } defaultValue export function getValueNumberMinMax ( objects , objectName , propertyName , defaultValue , minValue , maxValue ) { if ( objects ) { let object = objects [ objectName ] ; if ( object ) { let property = object [ propertyName ] ; if ( property !== undefined ) { if ( property > maxValue ) { return maxValue ; } if ( property < minValue ) { return minValue ; } return property ; } } } return defaultValue ; } function param { string } inVal param { string } contrVal param { string } contrVal2Compare param { boolean } logic param { string } outValIfCondTrue export function ifStringReturnString ( inVal , contrVal , contrVal2Compare , outValIfCondTrue , logic , applyNow ) { if ( applyNow && contrVal === contrVal2Compare && logic === true ) return outValIfCondTrue ; if ( applyNow && contrVal !== contrVal2Compare && logic === false ) return outValIfCondTrue ; return inVal ; } export function ifStringReturnStringClustersMethod ( numClustersMethods , numOfClusters ) { if ( numOfClusters !== "auto" ) return "None" ; if ( numOfClusters === "auto" && numClustersMethods === "None" ) return "fast" ; return numClustersMethods ; } export function inMinMax ( a , mi , ma ) { if ( a < mi ) return mi ; if ( a > ma ) return ma ; return a ; } function param { DataViewCategoryColumn } category param { number } index param { string } objectName param { string } propertyName param { T } defaultValue export function getCategoricalObjectValue < T > ( category , index , objectName , propertyName , defaultValue ) { let categoryObjects = category . objects ; if ( categoryObjects ) { let categoryObject = categoryObjects [ index ] ; if ( categoryObject ) { let object = categoryObject [ objectName ] ; if ( object ) { let property = < T > object [ propertyName ] ; if ( property !== undefined ) { return property ; } } } } return defaultValue ; } }