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

always use lodash.get #74

Merged
merged 1 commit into from Oct 5, 2015
Merged

Conversation

lipp
Copy link
Contributor

@lipp lipp commented Oct 5, 2015

makes nested option absolete

@knownasilya
Copy link
Collaborator

Are there any reasons that someone wouldn't want the nested option always enabled? Since this would require a major version bump.

@lipp
Copy link
Contributor Author

lipp commented Oct 5, 2015

@knownasilya I don't think so. The PR ignores the nested options entriely. I don't think someone specified "nested" field strings by accident.

@knownasilya
Copy link
Collaborator

I meant more like if they didn't use nested before, and now it's using nested by default (because of this PR), would it break anything?

@lipp
Copy link
Contributor Author

lipp commented Oct 5, 2015

no, this wouldn't break anything.

knownasilya pushed a commit that referenced this pull request Oct 5, 2015
@knownasilya knownasilya merged commit 30bb2a1 into zemirco:master Oct 5, 2015
@knownasilya
Copy link
Collaborator

The only thing that would break is they would see an error when using the nested option. Looks like it'll have to be a major bump.

@lipp
Copy link
Contributor Author

lipp commented Oct 5, 2015

good spot!

@lipp
Copy link
Contributor Author

lipp commented Oct 5, 2015

i was thinking of adding custom defaults to single fields like this

json2csv({ data: myCars, 
  fields: ['car', 'prize', 'color'], 
  defaultValue: ['No Name', 0, 'likely black']}, ...

what do you think?

@lipp lipp deleted the always-use-lodash-get branch October 5, 2015 14:19
@knownasilya
Copy link
Collaborator

Great idea, it would fulfill #71

@knownasilya
Copy link
Collaborator

call it defaultValues, since it's an array, and it works with fields.

@lipp
Copy link
Contributor Author

lipp commented Oct 5, 2015

ok

knownasilya pushed a commit that referenced this pull request Oct 22, 2015
* `nested` has been removed as an option. All fields support nesting by default. See #74.

* `fields` has been overhauled to accept an object (see #78) with the following form:
  - `label` - optional, defaults to the value of `value`
  - `value` - required, Can be a string, or a function that receives the row as a param, see the README.
  - `default` - optional, overrides the `defaultValue` option.

  It can also just be a string, which is the `value`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants