Skip to content

Commit

Permalink
One-line export
Browse files Browse the repository at this point in the history
  • Loading branch information
vjeux committed Dec 22, 2011
1 parent 00b7645 commit 9ae7371
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 20 deletions.
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "jDataView",
"version": "1.0.0",
"version": "1.0.2",
"description": "A unique way to read a binary file in the browser and the server.",
"keywords": ["buffer", "binary", "file", "read"],
"homepage": "http://blog.vjeux.com/2011/javascript/jdataview-read-binary-file.html",
Expand Down
24 changes: 5 additions & 19 deletions src/jdataview.js
Expand Up @@ -6,16 +6,7 @@
// http://blog.vjeux.com/ <vjeuxx@gmail.com>
//

(function () {

var all;
if (typeof self !== 'undefined') {
all = self;
} else if (typeof window !== 'undefined') {
all = window;
} else if (typeof global !== 'undefined') {
all = global;
}
(function (global) {

var compatibility = {
ArrayBuffer: typeof ArrayBuffer !== 'undefined',
Expand Down Expand Up @@ -355,13 +346,6 @@ for (var type in dataTypes) {
})(type);
}

// Browser + Web Worker
all.jDataView = jDataView;
// NodeJS + NPM
if (typeof module !== 'undefined') {
module.exports = jDataView;
}

if (typeof jQuery !== 'undefined' && jQuery.fn.jquery >= "1.6.2") {
var convertResponseBodyToText = function (byteArray) {
// http://jsperf.com/vbscript-binary-download/6
Expand All @@ -371,7 +355,7 @@ if (typeof jQuery !== 'undefined' && jQuery.fn.jquery >= "1.6.2") {
} catch (e) {
// http://stackoverflow.com/questions/1919972/how-do-i-access-xhr-responsebody-for-binary-data-from-javascript-in-ie
// http://miskun.com/javascript/internet-explorer-and-binary-files-data-access/
var IEBinaryToArray_ByteStr_Script =
var IEBinaryToArray_ByteStr_Script =
"Function IEBinaryToArray_ByteStr(Binary)\r\n"+
" IEBinaryToArray_ByteStr = CStr(Binary)\r\n"+
"End Function\r\n"+
Expand Down Expand Up @@ -462,4 +446,6 @@ if (typeof jQuery !== 'undefined' && jQuery.fn.jquery >= "1.6.2") {
});
}

})();
global.jDataView = (global.module || {}).exports = jDataView;

})(this);

0 comments on commit 9ae7371

Please sign in to comment.