nbubna / Case

String case utitility: convert, identify, flip, extend
http://nbubna.github.io/Case/
MIT License
282 stars 23 forks source link

1.1.0 is broken on Node.js #8

Closed tallesl closed 10 years ago

tallesl commented 10 years ago
$ npm install case
case@1.1.0 node_modules/case
$ node
> require('case')
ReferenceError: window is not defined
    at Object.<anonymous> (/home/ubuntu/playground/node_modules/case/dist/Case.js:125:18)
    at Object.<anonymous> (/home/ubuntu/playground/node_modules/case/dist/Case.js:128:4)
    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 Module.require (module.js:364:17)
    at require (module.js:380:17)
    at repl:1:2
    at REPLServer.self.eval (repl.js:110:21)

I guess the problem lies on these 2 lines.

nbubna commented 10 years ago

I think that should do it, but i'm in a hurry, so i'll confess to not testing it. Please let me know if i bombed this in my haste. I'll be back later this evening. :)

tallesl commented 10 years ago

Still broken on Node...

Now the require gives no error, but all properties are undefined.

$ npm install case
case@1.1.1 node_modules/case
$ node
> var Case = require('case')
undefined
> Case.upper('test')
TypeError: Object #<Object> has no method 'upper'
    at repl:1:7
    at REPLServer.self.eval (repl.js:110:21)
    at Interface.<anonymous> (repl.js:239:12)
    at Interface.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.emit (events.js:98:17)
    at emitKey (readline.js:1095:12)
> Case.upper
undefined

It's probably not exporting correctly for Node (module.exports).

tallesl commented 10 years ago

Working OK now.

Thanks :+1: