-
Notifications
You must be signed in to change notification settings - Fork 19
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
[do not merge] Allow optional converters #12
Conversation
@@ -3,6 +3,8 @@ import { validateConverters, visitNode } from './helpers'; | |||
|
|||
const ERR_INVALID_XML = 'XMLToReact: Unable to parse invalid XML input. Please input valid XML.'; | |||
|
|||
const noop = () => {}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
noop
and throwError
could move to helpers?
@@ -56,7 +60,6 @@ export default class XMLToReact { | |||
return null; | |||
} | |||
|
|||
return visitNode(tree.documentElement, 0, this.converters, data); | |||
return visitNode(tree.documentElement, 0, this.converters, data, this.onConverterNotFound); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
5 params... i don't love it
@@ -82,7 +82,7 @@ export function getChildren(node) { | |||
* @return {Object} React element | |||
* @private | |||
*/ | |||
export function visitNode(node, index, converters, data) { | |||
export function visitNode(node, index, converters, data, onConverterNotFound) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think i'll change the function signature to something like (node, {/*the rest*/})
but i can try that on master
closing as abandoned |
This is an initial PoC to allow for default pass-through conversion of nodes (see #10)
I'm making this available for early feedback.
Dependencies
Outstanding tasks