Browse Source

Minor cleanups, and RequireJS integration fix

pull/181/head
Matthew Holt 10 years ago
parent
commit
347befde6c
  1. 15
      papaparse.js

15
papaparse.js

@ -20,7 +20,7 @@
global.Papa.BYTE_ORDER_MARK = "\ufeff"; global.Papa.BYTE_ORDER_MARK = "\ufeff";
global.Papa.BAD_DELIMITERS = ["\r", "\n", "\"", global.Papa.BYTE_ORDER_MARK]; global.Papa.BAD_DELIMITERS = ["\r", "\n", "\"", global.Papa.BYTE_ORDER_MARK];
global.Papa.WORKERS_SUPPORTED = !!global.Worker; global.Papa.WORKERS_SUPPORTED = !!global.Worker;
global.Papa.SCRIPT_PATH = null; // Must be set manually if using workers and Papa Parse is loaded asynchronously global.Papa.SCRIPT_PATH = null; // Must be set by your code if you use workers and this lib is loaded asynchronously
// Configurable chunk sizes for local and remote files, respectively // Configurable chunk sizes for local and remote files, respectively
global.Papa.LocalChunkSize = 1024 * 1024 * 10; // 10 MB global.Papa.LocalChunkSize = 1024 * 1024 * 10; // 10 MB
@ -34,6 +34,10 @@
global.Papa.FileStreamer = FileStreamer; global.Papa.FileStreamer = FileStreamer;
global.Papa.StringStreamer = StringStreamer; global.Papa.StringStreamer = StringStreamer;
// Wireup with RequireJS
if (isFunction(global.define) && global.define.amd)
global.define(function() { return global.Papa; });
if (global.jQuery) if (global.jQuery)
{ {
var $ = global.jQuery; var $ = global.jQuery;
@ -1323,18 +1327,11 @@
function bindFunction(f, self) function bindFunction(f, self)
{ {
return function() { return function() { f.apply(self, arguments); };
f.apply(self, arguments);
}
} }
function isFunction(func) function isFunction(func)
{ {
return typeof func === 'function'; return typeof func === 'function';
} }
// if requirejs is available, return Papa
if (isFunction(define) && define.amd) {
define( function() { return global.Papa; });
}
})(this); })(this);

Loading…
Cancel
Save