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

Remove/unset property of Node #295

Open
koenpunt opened this issue Dec 20, 2020 · 0 comments
Open

Remove/unset property of Node #295

koenpunt opened this issue Dec 20, 2020 · 0 comments

Comments

@koenpunt
Copy link
Contributor

koenpunt commented Dec 20, 2020

Is it possible to remove/unset a property of a Yams.Node object?

I'm able to add or replace properties quite easily;

var data = try Yams.compose(yaml: yamlString)
data["SomeAdditionalProp"] = Yams.Node(displayName)
data["SomeAdditionalProp2"] = "String"

But I couldn't figure out a way to remove a property. Is this possible?

As a workaround I convert the node to Any, cast that to a dictionary, filter it, and convert it to a node again, but this isn't very efficient..

Edit: I must say, in my case I'm actually trying to rename a property, which I would be able to achieve by assigning a new property, and removing the old. If however there's a way of renaming a property directly, that –of course– would work as well.

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

1 participant