pirosikick's diary

君のハートにunshift

この再帰呼び出しはちょっと感動したよ。

お久しぶりです。サボりました(_ _(--;(_ _(--; ペコペコ

oauth.js -
oauth -


API needz authorized? - Google Project Hosting

    percentEncode: function percentEncode(s) {
        if (s == null) {
            return "";
        }
        if (s instanceof Array) {
            var e = "";
            for (var i = 0; i < s.length; ++s) {
                if (e != "") e += '&';
                e += OAuth.percentEncode(s[i]);
            }
            return e;
        }
        s = encodeURIComponent(s);
        // Now replace the values which encodeURIComponent doesn't do
        // encodeURIComponent ignores: - _ . ! ~ * ' ( )
        // OAuth dictates the only ones you can ignore are: - _ . ~
        // Source: http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Global_Functions:encodeURIComponent
        s = s.replace(/\!/g, "%21");
        s = s.replace(/\*/g, "%2A");
        s = s.replace(/\'/g, "%27");
        s = s.replace(/\(/g, "%28");
        s = s.replace(/\)/g, "%29");
        return s;
    }

配列が引数で渡されて、その要素を引数として同じ関数を呼び出すと今度は下の方の処理が実行されるっていう感じ。

あぁなんかわくわくしたぜ!