Permalink
Browse files

Improved module loading

  • Loading branch information...
1 parent aceb26b commit 3b966c76683cb3dcc3d29390efbe0825b14331cf @dachev committed Jan 14, 2012
Showing with 9 additions and 10 deletions.
  1. +6 −0 index.js
  2. +2 −2 package.json
  3. +1 −8 test/runner.js
View
6 index.js
@@ -0,0 +1,6 @@
+try {
+ module.exports = require('./build/default/cld');
+} catch(e) {
+ // node v0.5.5+
+ module.exports = require('./build/Release/cld');
+}
View
4 package.json
@@ -2,8 +2,8 @@
"name": "cld",
"description": "A straight port of the CLD (Compact Language Detector) library embedded in Google's Chromium browser. The library detects the language from provided UTF8 text. It's implemented in C++, with very basic Node bindings.",
"keywords": ["language", "detect", "language detection"],
- "version": "0.0.4",
- "main": "./build/default/cld",
+ "version": "0.0.5",
+ "main": "./index",
"dependencies": {
},
"author": {
View
9 test/runner.js
@@ -1,16 +1,9 @@
#!/usr/bin/env node
-var cld = null;
+var cld = require('../index');
var data = require('./data');
var assert = require('assert');
-try {
- cld = require('../build/default/cld');
-} catch(e) {
- // node v0.5.5+
- cld = require('../build/Release/cld');
-}
-
function runOne(expectedLangName, text, shouldBeReliable) {
var detectionResult = cld.detect(text);

0 comments on commit 3b966c7

Please sign in to comment.