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

feature request: consolidate fields+fieldName options into a transform Object[] #78

Closed
azhang opened this issue Oct 7, 2015 · 0 comments

Comments

@azhang
Copy link
Collaborator

azhang commented Oct 7, 2015

For example:

{
  fields: [
    // Support label -> simple path
    {
      label: 'some label',
      value: 'path.to.something'
    },
    // Support label -> derived value
    {
      label: 'some label', // Supporting duplicate labels
      value: function(row) {
        return row.path1 + row.path2;
      }
    },
    // Support pathname -> pathvalue (label optional, keeps backwards compatibility)
    'simplepath'
    'path.to.value'
  ]
}
azhang pushed a commit to azhang/json2csv that referenced this issue Oct 8, 2015
{
  fields: [
    // Support label -> simple path
    {
      label: 'some label',
      value: 'path.to.something'
    },
    // Support label -> derived value
    {
      label: 'some label', // Supporting duplicate labels
      value: function(row) {
        return row.path1 + row.path2;
      }
    },
    // Support pathname -> pathvalue (label optional, keeps backwards compatibility)
    'simplepath'
    'path.to.value'
  ]
}
knownasilya pushed a commit that referenced this issue Oct 8, 2015
Feature/super fields (for feature request #78)
@azhang azhang closed this as completed Oct 9, 2015
knownasilya pushed a commit that referenced this issue 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

No branches or pull requests

1 participant