node-query/node_modules/getargs/example.js

16 lines
332 B
JavaScript
Raw Normal View History

2014-10-22 10:11:40 -04:00
var getArgs = require('./index')
function ajax(url, opts, callback){
var args = getArgs(
'url:string|array,[opts]:object,[callback]:function',
arguments)
console.log(JSON.stringify(args, null, ' '))
}
ajax()
ajax('/submit')
ajax(['/submit'])
ajax('/submit', {method: 'POST', params: {foo: 'bar'}}, function(dat){
})