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

sub-map node not change when mapping #93

Open
wanewang opened this issue May 10, 2017 · 0 comments
Open

sub-map node not change when mapping #93

wanewang opened this issue May 10, 2017 · 0 comments

Comments

@wanewang
Copy link
Contributor

I would like to have a sub-map when mapping so I don't have to type the path repeatedly
e.x. json is

[
    "test": "abc",
    "sub": [
        "int": 9,
        "string": "8"
    ]
]

and my mapping function is

try mainString <~> map["test"]
let subMap = map["sub"]
try subInt <~> subMap["int"]
try subString <~> subMap["string"]

but when I do let subMap = map["sub"]
the subMap.node is still original node since subscript only change result

// file Map.swift line 102
public subscript(keys: [PathIndex]) -> Map {
    lastPath = keys
    result = node[keys]
    return self
}

should it also change node to node[keys]?

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