22. Favtileでの例
twapi_url = (path, options) ->
defaults =
include_entities: true
suppress_response_codes: true
options[k] = v for own k, v of defaults when not options[k]?
options =
("#{k}=#{encodeURIComponent v}" for own k, v of options).join("&")
"https://api.twitter.com/1#{path}.json?#{options}&callback=?"
console.log twapi_url "/search", q:"CoffeeScript"
TwitterのAPIのURLを組み立てる関数
32. オブジェクトリテラル
twapi_url = (path, options) ->
defaults =
include_entities: true
suppress_response_codes: true
options[k] = v for own k, v of defaults when not options[k]?
options =
("#{k}=#{encodeURIComponent v}" for own k, v of options).join("&")
"https://api.twitter.com/1#{path}.json?#{options}&callback=?"
console.log twapi_url "/search", q:"CoffeeScript"
TwitterのAPIのURLを組み立てる関数
38. 変数展開
twapi_url = (path, options) ->
defaults =
include_entities: true
suppress_response_codes: true
options[k] = v for own k, v of defaults when not options[k]?
options =
("#{k}=#{encodeURIComponent v}" for own k, v of options).join("&")
"https://api.twitter.com/1#{path}.json?#{options}&callback=?"
console.log twapi_url "/search", q:"CoffeeScript"
TwitterのAPIのURLを組み立てる関数