import * as util from 'util' ; import { clean , ucfirst , normalize } from './utility' ; import { Options } from './@types/types' ; const TEXT = { POLICYSCALE : '%s-AutoScalingPolicy' , TARGET : '%s-AutoScalingTarget' , } ; export default class Name { options : Options ; constructor ( options ) { this . options = options ; } target ( func ) { return clean ( this . build ( TEXT . TARGET , func ) ) ; } policy ( func ) { return clean ( this . build ( TEXT . POLICYSCALE , func ) ) ; } PCAliasLogicalId ( functionName ) { return `${ normalize ( functionName ) }ProvConcLambdaAlias` ; } build ( data , func ) { return [ this . prefix ( ) , ucfirst ( util . format ( data , func ) ) , this . suffix ( ) , ] . join ( '' ) ; } prefix ( ) { return ucfirst ( this . options . service ) ; } suffix ( ) { return [ this . options . stage , this . options . region ] . map ( ucfirst ) . join ( '' ) ; } }