File tree Expand file tree Collapse file tree
packages/npm/indent-string Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11'use strict'
22
33module . exports = function indentString ( input , count = 1 , options ) {
4- const { includeEmptyLines = false , indent = ' ' } = {
5- __proto__ : null ,
6- ...options ,
4+ let includeEmptyLines = false
5+ let indent = ' '
6+ if (
7+ // isV2: indentString(input, indent, count) - 3 args only
8+ typeof count === 'string' &&
9+ typeof options === 'number'
10+ ) {
11+ indent = count
12+ count = options
13+ } else if (
14+ // isV3: indentString(input, count, indent)
15+ typeof count === 'number' &&
16+ typeof options === 'string'
17+ ) {
18+ indent = options
19+ } else if ( options !== null && typeof options === 'object' ) {
20+ const opts = { __proto__ : null , ...options }
21+ if ( opts . includeEmptyLines !== undefined ) {
22+ includeEmptyLines = opts . includeEmptyLines
23+ }
24+ if ( opts . indent !== undefined ) {
25+ indent = opts . indent
26+ }
727 }
828 if ( typeof input !== 'string' ) {
929 throw new TypeError (
You can’t perform that action at this time.
0 commit comments