Skip to content

Syntax of arguments #2

@tamtakoe

Description

@tamtakoe

Instead of 4 arguments in function:

 facebook: function(facebook, contacts, user, path)

You can use every argument for every nested level

 facebook: function(facebook, contacts, user)

F. e.

var obj = {
    a: {
        b: {
            c: {
                d: '123'
            }
        }
    }
}

var schema = {
    a: {
        b: {
            c: {
                e: (e, c, b, a, obj) => {
                    //If you want to get original object it will be guaranteed last argument
                    obj = Array.from(arguments).pop();
                    //But it's easier to use this
                    obj = this
                }
            }
        }
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions