Skip to content

stripIndent not stripping 1st line of variables #208

@latipun7

Description

@latipun7

I have this line of code:
code

but, the 1st line of variables that contain their line break and indent not stripped at 1st line, it takes the 8 spaces indent from the code. (sorry if the description not very descriptive or hard to understand)

the result is like this:
console.log(JSON.stringify(meta, null, 2)) :

{
  "code": "ERR_INVALID_ARG_TYPE"
}

console.log(stack) :

TypeError [ERR_INVALID_ARG_TYPE]: Error msg
    at stackTrace (internal/validators.js:122:11)
    ...etc

but this is the result of the stripIndent of them:

Variable that contain "\n    " would not strip for their 1st line below this.
        {
  "code": "ERR_INVALID_ARG_TYPE"
}
        TypeError [ERR_INVALID_ARG_TYPE]: Error msg
    at validateString (internal/validators.js:122:11)
    ...etc

notice the difference. Their 1st line not stripped. They take 8 spaces, same as the code.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions