In my blog post about npm packages, I tried to use underscore for ArangoDB. I found that the easiest way to archive this, is using the nodes package manager NPM. Node packages and modules follow the Common.JS specification, so they can be used by ArangoDB.

Why not try to use the package coffee-script as well? Install it using

and that’s it. Unfortunately, CoffeeScript use a module “path”, which is not a CommonJS module. I assume that most of the functionality is part or will be part of the module “fs”. The “path.js” from node.js is simple JavaScript code with some references like

Being brave, I simply copied the file into my module path and tried again. The next obstacle is node’s global variable “process”. Luckily, this is only used to check for Windows in the module “path”. Also ignoring the module “vm” used to execute JavaScript code, this allows one to actually load CoffeScript into ArangoDB.

So, I can now use CoffeeScript definition within ArangoDB. Some of the loaders must be adjusted to check for both “.js” and “.coffee” files. Afterwards it should be possible, to define an action in CoffeeScript as well as JavaScript.