File tree Expand file tree Collapse file tree 2 files changed +5
-12
lines changed Expand file tree Collapse file tree 2 files changed +5
-12
lines changed Original file line number Diff line number Diff line change @@ -30,17 +30,10 @@ export function dedent(
30
30
strings : $ReadOnlyArray < string > ,
31
31
...values : $ReadOnlyArray < string >
32
32
) : string {
33
- let str = '' ;
33
+ let str = strings [ 0 ] ;
34
34
35
- for ( let i = 0 ; i < strings . length ; ++ i ) {
36
- str += strings [ i ] ;
37
- if ( i < values . length ) {
38
- // istanbul ignore next (Ignore else inside Babel generated code)
39
- const value = values [ i ] ;
40
-
41
- str += value ; // interpolation
42
- }
35
+ for ( let i = 1 ; i < strings . length ; ++ i ) {
36
+ str += values [ i - 1 ] + strings [ i ] ; // interpolation
43
37
}
44
-
45
38
return dedentString ( str ) ;
46
39
}
Original file line number Diff line number Diff line change 1
1
import { expect } from 'chai' ;
2
2
import { describe , it } from 'mocha' ;
3
3
4
- import { dedent } from '../../__testUtils__/dedent' ;
4
+ import { dedent , dedentString } from '../../__testUtils__/dedent' ;
5
5
6
6
import { DirectiveLocation } from '../../language/directiveLocation' ;
7
7
@@ -158,7 +158,7 @@ describe('Type System Printer', () => {
158
158
159
159
expectPrintedSchema ( schema ) . to . equal (
160
160
// $FlowFixMe[incompatible-call]
161
- dedent ( String . raw `
161
+ dedentString ( String . raw `
162
162
type Query {
163
163
singleField(argOne: String = "tes\t de\fault"): String
164
164
}
You can’t perform that action at this time.
0 commit comments