I just tried Streamline for the first time in an actual project, and
it's freaking awesome. Our test cases that were nested 8 levels deep
are now actually comprehensible!
However, we've ran into one other gotcha -- it doesn't work when we
use the also-elegant underscore.js (
http://documentcloud.github.com/underscore/
)!
I worried it might not work, since it also uses the underscore
character ( _ ), but I hoped we might be fine since we never use it in
the functional style -- e.g. _([1,2,3]).each(...) -- but rather always
the OOP style -- e.g. _.each([1,2,3], ...). That is, we always use it
only as an object (static class) rather than as a function.
Unfortunately, that doesn't seem to matter. Here's a super simple test
case:
var _ = require('underscore');
_.each([1, 2, 3], console.log);
And trying to compile that throws:
Error: error streamlining /Users/akishore/Projects/Foo/bar.js: :
invalid use of '_' parameter on line 1
at Object.transform (/usr/lib/node/.npm/streamline/0.1.10/package/
lib/transform.js:1499:10)
at _transformIt (/usr/lib/node/.npm/streamline/0.1.10/package/lib/
register.js:73:31)
at Object.loadFile (/usr/lib/node/.npm/streamline/0.1.10/package/
lib/register.js:81:11)
at Object..js (/usr/lib/node/.npm/streamline/0.1.10/package/lib/
register.js:37:26)
at Module.load (module.js:315:31)
at Function._load (module.js:276:12)
at require (module.js:327:19)
at Object.<anonymous> (/Users/akishore/Projects/Foo/bar.js:3:1)
at Module._compile (module.js:383:26)
at Object.<anonymous> (module.js:389:10)
Has anyone else ran into this? Any suggestions? Underscore.js is also
a very valuable library that I'd love to be able to use within my
Streamline files.
I realize I can import it as a different variable name than
underscore, but that renders the code a lot less readable /
immediately recognizable.
Thanks in advance!
Aseem