Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clash with unitedstates/citation namespace #6

Open
adelevie opened this issue Nov 27, 2013 · 2 comments
Open

Clash with unitedstates/citation namespace #6

adelevie opened this issue Nov 27, 2013 · 2 comments

Comments

@adelevie
Copy link
Owner

var fs = require('fs');
var walverine = require('walverine');
var _ = require('underscore');
require('citation');
var text = fs.readFileSync('sample1.txt','utf8');
var citations = Citation.find(text);
_.each(citations, function(citation) {
  console.log(citation);
});
var courtCases = walverine.get_citations(text);
console.log(courtCases.length);
_.each(courtCases, function(courtCase) {
  console.log(courtCase);
});

Output:

/Users/adelevie/programming/citations.io/node_modules/walverine/walverine.js:653
    var citation = new Citation(volume, reporter, page);
                   ^
TypeError: object is not a function
    at Object.Walverine.extract_base_citation (/Users/adelevie/programming/citations.io/node_modules/walverine/walverine.js:653:20)
    at Object.Walverine.get_citations (/Users/adelevie/programming/citations.io/node_modules/walverine/walverine.js:1101:29)
    at Object.<anonymous> (/Users/adelevie/programming/citations.io/parse.js:15:28)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Function.Module.runMain (module.js:497:10)
    at startup (node.js:119:16)
    at node.js:901:3

A simple fix would be to find/replace Citation in Walverine, and call it something like WalverineCitation.

Any objections?

@konklone
Copy link
Contributor

konklone commented Feb 8, 2014

This is Citation's fault - it shouldn't leak a namespace at all. You should be forced to say...

var Citation = require('citation')

...to "capture" the citation module in the name of your choice. I'm fixing this now in Citation, and I think Walverine should work the same way.

I'm not sure why this is, but right now, when I do a require('walverine'), I get this in the node REPL:

> Walverine
ReferenceError: Walverine is not defined
    at repl:1:2
    at REPLServer.self.eval (repl.js:110:21)
    at Interface.<anonymous> (repl.js:239:12)
    at Interface.EventEmitter.emit (events.js:95:17)
    at Interface._onLine (readline.js:202:10)
    at Interface._line (readline.js:531:8)
    at Interface._ttyWrite (readline.js:760:14)
    at ReadStream.onkeypress (readline.js:99:10)
    at ReadStream.EventEmitter.emit (events.js:98:17)
    at emitKey (readline.js:1095:12)
> WalverineCitation
[Function]

@konklone
Copy link
Contributor

konklone commented Feb 9, 2014

Fixed it in Citation at unitedstates/citation@ab19821

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants