js/clients/SparkCore.js
function (name, args) {
        //logger.log('transform args', { coreID: this.getHexCoreID() });
        if (!args) {
            return null;
        }

        if (!this.hasFnState()) {
            logger.error("_transformArguments called without any function state!", { coreID: this.getHexCoreID() });
            return null;
        }

        //TODO: lowercase function keys on new state format
        name = name.toLowerCase();
        var fn = this.coreFnState[name];
        if (!fn || !fn.args) {
            //maybe it's the old protocol?
            var f = this.coreFnState.f;
            if (f && utilities.arrayContainsLower(f, name)) {
                //logger.log("_transformArguments - using old format", { coreID: this.getHexCoreID() });
                //current / simplified function format (one string arg, int return type)
                fn = {
                    returns: "int",
                    args: [
                        [null, "string" ]
                    ]
                };
            }
        }

        if (!fn || !fn.args) {
            //logger.error("_transformArguments: core doesn't know fn: ", { coreID: this.getHexCoreID(), name: name, state: this.coreFnState });
            return null;
        }

        //  "HelloWorld": { returns: "string", args: [ {"name": "string"}, {"adjective": "string"}  ]} };
        return messages.buildArguments(args, fn.args);
    }
function (name, args) {
        //logger.log('transform args', { coreID: this.getHexCoreID() });
        if (!args) {
            return null;
        }

        if (!this.hasFnState()) {
            logger.error("_transformArguments called without any function state!", { coreID: this.getHexCoreID() });
            return null;
        }

        //TODO: lowercase function keys on new state format
        name = name.toLowerCase();
        var fn = this.coreFnState[name];
        if (!fn || !fn.args) {
            //maybe it's the old protocol?
            var f = this.coreFnState.f;
            if (f && utilities.arrayContainsLower(f, name)) {
                //logger.log("_transformArguments - using old format", { coreID: this.getHexCoreID() });
                //current / simplified function format (one string arg, int return type)
                fn = {
                    returns: "int",
                    args: [
                        [null, "string" ]
                    ]
                };
            }
        }

        if (!fn || !fn.args) {
            //logger.error("_transformArguments: core doesn't know fn: ", { coreID: this.getHexCoreID(), name: name, state: this.coreFnState });
            return null;
        }

        //  "HelloWorld": { returns: "string", args: [ {"name": "string"}, {"adjective": "string"}  ]} };
        return messages.buildArguments(args, fn.args);
    }
function ( name , args ) { //logger.log('transform args', { coreID: this.getHexCoreID() }); if ( ! args ) { return null ; } if ( ! this . hasFnState ( ) ) { logger . error ( "_transformArguments called without any function state!" , { coreID : this . getHexCoreID ( ) } ) ; return null ; } //TODO: lowercase function keys on new state format name = name . toLowerCase ( ) ; var fn = this . coreFnState [ name ] ; if ( ! fn || ! fn . args ) { //maybe it's the old protocol? var f = this . coreFnState . f ; if ( f && utilities . arrayContainsLower ( f , name ) ) { //logger.log("_transformArguments - using old format", { coreID: this.getHexCoreID() }); //current / simplified function format (one string arg, int return type) fn = { returns : "int" , args : [ [ null , "string" ] ] } ; } } if ( ! fn || ! fn . args ) { //logger.error("_transformArguments: core doesn't know fn: ", { coreID: this.getHexCoreID(), name: name, state: this.coreFnState }); return null ; } //  "HelloWorld": { returns: "string", args: [ {"name": "string"}, {"adjective": "string"}  ]} }; return messages . buildArguments ( args , fn . args ) ; }
transforms our object into a nice coap query string
@param name
@param args
@private
transforms our object into a nice coap query string