I'd like to use CoffeeScript with Nano.js, a minimalistic CouchDB module. In JavaScript, the requirements are:
var nano开发者_Python百科 = require('nano')('http://127.0.0.1:5984');
However, there is no documentation on how to write this in CoffeeScript?
nano = require 'nano', 'http://127.0.0.1:5984'
Results in:
nano = require('nano', 'http://127.0.0.1:5984');
Which doesn't work.
Since you are calling a function which calls a function, doing what you tried is ambiguous. Parentheses are required in CoffeeScript to resolve ambiguity. Have you tried this:
nano = require('nano')('http://127.0.0.1:5984')
Or, if you really want to go without parens, you could do this:
nano = require 'nano'
nano = nano 'http://127.0.0.1:5984'
Or just
nano = require('nano') 'http://127.0.0.1:5984'
精彩评论