-
Notifications
You must be signed in to change notification settings - Fork 206
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
Decode filters #50
Decode filters #50
Conversation
Provided zendBoolean default filter Udpated readme added test case
formatting
@isaacs can we kick off a discussion on this?
I also added the zendBoolean here for an illustration, but we either add more defaults, or I can separate them into standalone packages |
On and forgot - another topic, encode filters. |
I've been thinking how to make this more flexible. the nasty parts are defining default filters if specific filters weren't defined, it makes me think a flagging system is better but that would limit the use of custom filters. I haven't yet thought of a decent way to make the function call simple and allow custom filters. |
# Conflicts: # .gitignore # .travis.yml # ini.js # package.json
Forking the project instead, since no feedback |
Hi
I added the ability to specify decoding filters.
and provided a zendBoolean normalizer as a predefined filter.
It's still a pretty naive implementation in that only manipulates values.
Ideally it should be able to remove whole keys, but I would say that is additional functionality.
The reason for wanting to use filters is that it provides a nice simple way of guaranteeing that values meet an expected criteria after parsing. And it removes the need for complex object navigation in order to do it after the fact.