Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Format array of objects #117

Open
YarovoiVadym opened this issue May 17, 2018 · 5 comments
Open

Format array of objects #117

YarovoiVadym opened this issue May 17, 2018 · 5 comments
Labels

Comments

@YarovoiVadym
Copy link

YarovoiVadym commented May 17, 2018

This object:

[
    {
        name: 'name',
        value: 'value'
    },
    {
        name: 'name',
        value: 'value'
    },
    {
        name: 'name',
        valueFrom: {
            name: 'value',
            key: ''
        }
    }
]

After YAML.stringify I expect this:

- name: name
  value: value
- name: name
  value: value
- name: name
  valueFrom:
      name: value
      key: ""

but instead of expected result I get this:

-
   name: name
   value: value
-
   name: name
   value: value
-
   name: name
   valueFrom:
     name: value
     key: ""

It's not right YAML formatting

@JoshBeveridge
Copy link

@jeremyfa Any chance that these issues are still being looked at in terms of fixes/work arounds? Cheers!

@jeremyfa
Copy link
Owner

Hi, unfortunately I didn't have much time to take a look at it yet, but I agree that it should be fixed!

@JoshBeveridge
Copy link

@jeremyfa Thanks for getting back to me! I'll keep my eyes on this project for a fix in the future, it would be super helpful for a step in a project I'm working on. Cheers!

@YarovoiVadym
Copy link
Author

YarovoiVadym commented Jun 14, 2018

@joshdrink Hi, in a project I'm working on, I have used this RegEx for a temporary fix of this issue:
data.replace(/(\s+\-)\s*\n\s+/g, '$1 ');
Maybe it will be helpful to you.

@JoshBeveridge
Copy link

@YarovoiVadym You're a life saver! This worked perfectly. :)

@jeremyfa jeremyfa added the bug label Jul 17, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants