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

primitive key may get error #69

Open
honchy opened this issue Dec 25, 2015 · 2 comments
Open

primitive key may get error #69

honchy opened this issue Dec 25, 2015 · 2 comments

Comments

@honchy
Copy link

honchy commented Dec 25, 2015

in folder lib utils.js

    if (cursor[_subkey] === undefined) {
        console.log('undefined ' + cursor);
        cursor[_subkey] = {}
    }

where cursor[_subkey] is a primitive value ,like boolean , cursor[_subkey] = {} may get undefined value.

so code below

    // Increment cursor used to track the object at the current depth
    cursor = cursor[_subkey]

will still got an undefind value.

I just don't much about rc, I found this problem when I install another project.

tks

@honchy
Copy link
Author

honchy commented Dec 25, 2015

I try to fix this like code blow

    // Build sub-object if nothing already exists at the keypath
    if (cursor[_subkey] === undefined) {
        cursor = {}
    } else {
        // Increment cursor used to track the object at the current depth
        cursor = cursor[_subkey]
    }

And It sems works.

@legodude17
Copy link

Above that there is this line:

if (!_subkey || typeof cursor !== 'object')
          return

That should make it so that now primitive keys actually get to that point.

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

2 participants