-
Notifications
You must be signed in to change notification settings - Fork 6
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
Support custom clone operation #10
Comments
5 tasks
b0o
added a commit
to b0o/meta-updater
that referenced
this issue
Feb 1, 2024
This method is used to clone the object returned by `read` before passing it to `update`. This is useful when the object returned by `read` is not trivially cloneable. One use case is when trying to preserve comments in a JSONC file using `json-comments`, which uses symbol properties on the object to store comments. The default `clone` method would not preserve these symbol properties, so a custom `clone` method is needed. Fixes pnpm#10
b0o
added a commit
to b0o/meta-updater
that referenced
this issue
Feb 1, 2024
This method is used to clone the object returned by `read` before passing it to `update`. This is useful when the object returned by `read` is not trivially cloneable. One use case is when trying to preserve comments in a JSONC file using the `comment-json` package, which uses symbol properties on the object to store comments. The default `clone` method would not preserve these symbol properties, so a custom `clone` method is needed. Fixes pnpm#10
b0o
added a commit
to b0o/meta-updater
that referenced
this issue
Feb 1, 2024
This method is used to clone the object returned by `read` before passing it to `update`. This is useful when the object returned by `read` is not trivially cloneable. One use case is when trying to preserve comments in a JSONC file using the `comment-json` package, which uses symbol properties on the object to store comments. The default `clone` method would not preserve these symbol properties, so a custom `clone` method is needed. Fixes pnpm#10
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'm trying to update a yaml file while preserving comments, using the
yaml
npm library. In order to preserve comments, I need the parsed file to be ayaml.Document
, but that cannot be cloned using the defaultclone
method provided bymeta-updater
. It would be great if custom formats supported an optionalclone
field that I could use to provide my own cloning methodology (I'd just useDocument.clone
).I would be happy to contribute a PR
Fwiw, the error I get today is as follows:
The text was updated successfully, but these errors were encountered: