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

Give decycle caller chance to replace values at path #52

Closed
wants to merge 1 commit into from

Conversation

misterjoshua
Copy link

Give decycle's caller an opportunity to replace
the value at any given JSONPath as derez traverses
objects.

This change gives decycle a second argument
allowing the caller to provide a function which
may transform values arbitrarily.

One example use might be giving decycle awareness
of an object's preference for representing itself
in a decycled structure, especially giving
anObject.toJSON() a chance to run.

Give decycle's caller an opportunity to replace
the value at any given JSONPath as derez traverses
objects.

This change gives decycle a second argument
allowing the caller to provide a function which
may transform values arbitrarily.

One example use might be giving decycle awareness
of an object's preference for representing itself
in a decycled structure, especially giving
anObject.toJSON() a chance to run.
@douglascrockford
Copy link
Owner

It now accepts a replacer function.

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