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

Data Stringified Before dataTransform Option #40

Open
pjobson opened this issue Apr 14, 2016 · 1 comment
Open

Data Stringified Before dataTransform Option #40

pjobson opened this issue Apr 14, 2016 · 1 comment

Comments

@pjobson
Copy link

pjobson commented Apr 14, 2016

In this example it returns string in each of the rendered columns, this shows me that the values are pre-stringified before they get to the transform, instead of after which seems more appropriate.

I'd like to do a transform based on the value I passed in rather than a pre-stringified version. If my pre-transformed data is the boolean false, I'd like to be able to test (data===false) or (!data) then do a custom transform. In the existing code false is stringified to "false" so my tests of course fail. I don't want to de-stringify it back to the boolean in case the original value happens to be the the string "false".

Sample code:

var columns = columnify([
    { test: false      },
    { test: new Date() },
    { test: true       },
    { test: 1          },
    { test: 10000      },
    { test: /test/     }
], {
    config: {
        test: {
            dataTransform: function (data) {
                return typeof(data);
            }
        }
    }
});

Renders

TEST
string
string
string
string
string
string
@grinich
Copy link

grinich commented Oct 17, 2018

+1

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

2 participants