Skip to content

Commit

Permalink
Fix the function of judging the commonJS environment
Browse files Browse the repository at this point in the history
  • Loading branch information
xch89820 committed Apr 5, 2014
1 parent 871c25a commit f2ffe97
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 7 deletions.
2 changes: 1 addition & 1 deletion cptable.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 15 additions & 5 deletions cputils.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
if(typeof cptable === "undefined" && typeof require !== "undefined") var cptable = require('./cptable');

(function(cpt){
(function(root, factory){
"use strict";
if(typeof cptable === "undefined" && typeof require !== "undefined"){
var cpt = require('./cptable');
if (typeof module !== 'undefined' && module.exports){
module.exports = factory(cpt);
}else{
root.cptable = factory(cpt);
}
}else{
throw "cptable not found";
}
}(this, function(cpt){
var magic = {
"1200":"utf16le",
"1201":"utf16be",
Expand Down Expand Up @@ -72,6 +82,6 @@ if(typeof cptable === "undefined" && typeof require !== "undefined") var cptable
return cpt[cp] || magic[cp];
};
cpt.utils = { decode: decode, encode: encode, hascp: hascp, magic: magic };
})(cptable);
return cpt;
}));

if(typeof module !== "undefined") module.exports = cptable;
2 changes: 1 addition & 1 deletion sbcs.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit f2ffe97

Please sign in to comment.