@@ -82,56 +82,56 @@ class ActionBuilder {
82
82
return this . xml
83
83
}
84
84
85
- say ( text , attributes = { } ) {
86
- const params = { ...attributes , text }
85
+ say ( text , attributes = { } ) {
86
+ const params = { ...attributes , text }
87
87
88
- let validationError
88
+ let validationError
89
89
90
- const _validateParams = function ( ) {
91
- const errors = [ ]
90
+ const _validateParams = function ( ) {
91
+ const errors = [ ]
92
92
93
- // text validation
94
- if ( params . text === undefined || params . text === null || params . text === '' ) {
95
- errors . push ( 'text can\'t be blank' )
96
- } else if ( typeof params . text !== 'string' ) {
97
- errors . push ( 'text must be a string' )
98
- }
93
+ // text validation
94
+ if ( params . text === undefined || params . text === null || params . text === '' ) {
95
+ errors . push ( 'text can\'t be blank' )
96
+ } else if ( typeof params . text !== 'string' ) {
97
+ errors . push ( 'text must be a string' )
98
+ }
99
99
100
- // voice validation
101
- if ( params . voice !== undefined ) {
102
- const choices = [ 'man' , 'woman' ]
103
- if ( ! choices . includes ( params . voice ) ) {
104
- errors . push ( 'invalid option' )
100
+ // voice validation
101
+ if ( params . voice !== undefined ) {
102
+ const choices = [ 'man' , 'woman' ]
103
+ if ( ! choices . includes ( params . voice ) ) {
104
+ errors . push ( 'invalid option' )
105
+ }
105
106
}
106
- }
107
107
108
- // playBeep validation
109
- if ( params . playBeep !== undefined ) {
110
- if ( typeof params . playBeep !== 'boolean' ) {
111
- errors . push ( 'invalid option' )
108
+ // playBeep validation
109
+ if ( params . playBeep !== undefined ) {
110
+ if ( typeof params . playBeep !== 'boolean' ) {
111
+ errors . push ( 'invalid option' )
112
+ }
112
113
}
113
- }
114
114
115
- if ( errors . length > 0 ) {
116
- validationError = new Error ( errors . join ( '; ' ) )
115
+ if ( errors . length > 0 ) {
116
+ validationError = new Error ( errors . join ( '; ' ) )
117
+ }
117
118
}
118
- }
119
119
120
- _validateParams ( )
120
+ _validateParams ( )
121
121
122
- if ( validationError ) {
123
- throw validationError
124
- }
122
+ if ( validationError ) {
123
+ throw validationError
124
+ }
125
125
126
- const action = {
127
- tag : 'Say' ,
128
- text,
129
- attributes
130
- }
126
+ const action = {
127
+ tag : 'Say' ,
128
+ text,
129
+ attributes
130
+ }
131
131
132
- this . buildAction ( action )
133
- return this
134
- }
132
+ this . buildAction ( action )
133
+ return this
134
+ }
135
135
136
136
play ( url ) {
137
137
const attributes = { url }
0 commit comments