3 var cld = require('cld');
4 var Promise = require('bluebird');
6 module.exports = exports = function languageDetector(text) {
7 return Promise.fromCallback(function(callback) {
8 cld.detect(text, callback);
13 .then(function(result) {
14 if (!result || !result.languages || !result.languages.length) return;
16 var primary = result.languages[0];