@@ -107,6 +107,7 @@ interface UnindentFunction extends StringOrTemplateFunction {
107107export const unindent : UnindentFunction = ( ...params ) : any => {
108108 let trimStart = true ;
109109 let trimEnd = true ;
110+
110111 const unindentImpl : StringOrTemplateFunction = ( ...params ) => {
111112 const string = isString ( params [ 0 ] )
112113 ? params [ 0 ]
@@ -175,12 +176,12 @@ export const unindent: UnindentFunction = (...params): any => {
175176 return unindentImpl ;
176177 }
177178
178- // Direct call mode
179+ // Direct call mode: unindent(str) or unindent`template`
179180 if ( isString ( params [ 0 ] ) || isArray ( params [ 0 ] ) ) {
180181 return unindentImpl ( ...( params as [ any ] ) ) ;
181182 }
182183
183- throw new TypeError ( "Invalid arguments." ) ;
184+ throw new TypeError ( `First parameter has an invalid type: " ${ typeof params [ 0 ] } "` ) ;
184185} ;
185186
186187interface IndentFunction {
@@ -249,7 +250,7 @@ export const indent: IndentFunction = (...params) => {
249250 . join ( "\n" ) ;
250251 } ;
251252
252- // indent(_, trimStart?, trimEnd?)
253+ // Factory function mode: indent(_, trimStart?, trimEnd?)
253254 if (
254255 ( isBoolean ( params [ 1 ] ) || params [ 1 ] === undefined ) &&
255256 ( isBoolean ( params [ 2 ] ) || params [ 2 ] === undefined )
@@ -258,21 +259,21 @@ export const indent: IndentFunction = (...params) => {
258259 trimEnd = params [ 2 ] !== false ;
259260 }
260261
261- // indent(indentNumber)
262+ // Factory function mode: indent(indentNumber)
262263 if ( isNumber ( params [ 0 ] ) ) {
263264 indentString = " " . repeat ( params [ 0 ] ) ;
264265
265266 return indentImpl ;
266267 }
267268
268- // indent(indentString)
269+ // Factory function mode: indent(indentString)
269270 if ( isString ( params [ 0 ] ) ) {
270271 indentString = params [ 0 ] ;
271272
272273 return indentImpl ;
273274 }
274275
275- throw new TypeError ( "Invalid arguments." ) ;
276+ throw new TypeError ( `First parameter has an invalid type: " ${ typeof params [ 0 ] } "` ) ;
276277} ;
277278
278279/**
0 commit comments