code stringlengths 24 2.07M | docstring stringlengths 25 85.3k | func_name stringlengths 1 92 | language stringclasses 1
value | repo stringlengths 5 64 | path stringlengths 4 172 | url stringlengths 44 218 | license stringclasses 7
values |
|---|---|---|---|---|---|---|---|
function hasAny(str, substrings)
{
for (var i = 0; i < substrings.length; i++)
if (str.indexOf(substrings[i]) > -1)
return true;
return false;
} | Encloses a value around quotes if needed (makes a value safe for CSV insertion) | hasAny | javascript | mholt/PapaParse | papaparse.js | https://github.com/mholt/PapaParse/blob/master/papaparse.js | MIT |
function ChunkStreamer(config)
{
this._handle = null;
this._finished = false;
this._completed = false;
this._halted = false;
this._input = null;
this._baseIndex = 0;
this._partialLine = '';
this._rowCount = 0;
this._start = 0;
this._nextChunk = null;
this.isFirstChunk = true;
this._completeResu... | ChunkStreamer is the base prototype for various streamer implementations. | ChunkStreamer | javascript | mholt/PapaParse | papaparse.js | https://github.com/mholt/PapaParse/blob/master/papaparse.js | MIT |
function replaceConfig(config)
{
// Deep-copy the config so we can edit it
var configCopy = copy(config);
configCopy.chunkSize = parseInt(configCopy.chunkSize); // parseInt VERY important so we don't concatenate strings!
if (!config.step && !config.chunk)
configCopy.chunkSize = null; // disable Range... | ChunkStreamer is the base prototype for various streamer implementations. | replaceConfig | javascript | mholt/PapaParse | papaparse.js | https://github.com/mholt/PapaParse/blob/master/papaparse.js | MIT |
function NetworkStreamer(config)
{
config = config || {};
if (!config.chunkSize)
config.chunkSize = Papa.RemoteChunkSize;
ChunkStreamer.call(this, config);
var xhr;
if (IS_WORKER)
{
this._nextChunk = function()
{
this._readChunk();
this._chunkLoaded();
};
}
else
{
this._nextC... | ChunkStreamer is the base prototype for various streamer implementations. | NetworkStreamer | javascript | mholt/PapaParse | papaparse.js | https://github.com/mholt/PapaParse/blob/master/papaparse.js | MIT |
function getFileSize(xhr)
{
var contentRange = xhr.getResponseHeader('Content-Range');
if (contentRange === null) { // no content range, then finish!
return -1;
}
return parseInt(contentRange.substring(contentRange.lastIndexOf('/') + 1));
} | ChunkStreamer is the base prototype for various streamer implementations. | getFileSize | javascript | mholt/PapaParse | papaparse.js | https://github.com/mholt/PapaParse/blob/master/papaparse.js | MIT |
function FileStreamer(config)
{
config = config || {};
if (!config.chunkSize)
config.chunkSize = Papa.LocalChunkSize;
ChunkStreamer.call(this, config);
var reader, slice;
// FileReader is better than FileReaderSync (even in worker) - see http://stackoverflow.com/q/24708649/1048862
// But Firefox is a ... | ChunkStreamer is the base prototype for various streamer implementations. | FileStreamer | javascript | mholt/PapaParse | papaparse.js | https://github.com/mholt/PapaParse/blob/master/papaparse.js | MIT |
function StringStreamer(config)
{
config = config || {};
ChunkStreamer.call(this, config);
var remaining;
this.stream = function(s)
{
remaining = s;
return this._nextChunk();
};
this._nextChunk = function()
{
if (this._finished) return;
var size = this._config.chunkSize;
var chunk;
i... | ChunkStreamer is the base prototype for various streamer implementations. | StringStreamer | javascript | mholt/PapaParse | papaparse.js | https://github.com/mholt/PapaParse/blob/master/papaparse.js | MIT |
function ReadableStreamStreamer(config)
{
config = config || {};
ChunkStreamer.call(this, config);
var queue = [];
var parseOnData = true;
var streamHasEnded = false;
this.pause = function()
{
ChunkStreamer.prototype.pause.apply(this, arguments);
this._input.pause();
};
this.resume = functi... | ChunkStreamer is the base prototype for various streamer implementations. | ReadableStreamStreamer | javascript | mholt/PapaParse | papaparse.js | https://github.com/mholt/PapaParse/blob/master/papaparse.js | MIT |
function DuplexStreamStreamer(_config) {
var Duplex = require('stream').Duplex;
var config = copy(_config);
var parseOnWrite = true;
var writeStreamHasFinished = false;
var parseCallbackQueue = [];
var stream = null;
this._onCsvData = function(results)
{
var data = results.data;
if (!stream.push(... | ChunkStreamer is the base prototype for various streamer implementations. | DuplexStreamStreamer | javascript | mholt/PapaParse | papaparse.js | https://github.com/mholt/PapaParse/blob/master/papaparse.js | MIT |
function ParserHandle(_config)
{
// One goal is to minimize the use of regular expressions...
var MAX_FLOAT = Math.pow(2, 53);
var MIN_FLOAT = -MAX_FLOAT;
var FLOAT = /^\s*-?(\d+\.?|\.\d+|\d+\.\d+)([eE][-+]?\d+)?\s*$/;
var ISO_DATE = /^((\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z... | ChunkStreamer is the base prototype for various streamer implementations. | ParserHandle | javascript | mholt/PapaParse | papaparse.js | https://github.com/mholt/PapaParse/blob/master/papaparse.js | MIT |
function testEmptyLine(s) {
return _config.skipEmptyLines === 'greedy' ? s.join('').trim() === '' : s.length === 1 && s[0].length === 0;
} | Parses input. Most users won't need, and shouldn't mess with, the baseIndex
and ignoreLastRow parameters. They are used by streamers (wrapper functions)
when an input comes in multiple chunks, like from a file. | testEmptyLine | javascript | mholt/PapaParse | papaparse.js | https://github.com/mholt/PapaParse/blob/master/papaparse.js | MIT |
function testFloat(s) {
if (FLOAT.test(s)) {
var floatValue = parseFloat(s);
if (floatValue > MIN_FLOAT && floatValue < MAX_FLOAT) {
return true;
}
}
return false;
} | Parses input. Most users won't need, and shouldn't mess with, the baseIndex
and ignoreLastRow parameters. They are used by streamers (wrapper functions)
when an input comes in multiple chunks, like from a file. | testFloat | javascript | mholt/PapaParse | papaparse.js | https://github.com/mholt/PapaParse/blob/master/papaparse.js | MIT |
function processResults()
{
if (_results && _delimiterError)
{
addError('Delimiter', 'UndetectableDelimiter', 'Unable to auto-detect delimiting character; defaulted to \'' + Papa.DefaultDelimiter + '\'');
_delimiterError = false;
}
if (_config.skipEmptyLines)
{
_results.data = _results.dat... | Parses input. Most users won't need, and shouldn't mess with, the baseIndex
and ignoreLastRow parameters. They are used by streamers (wrapper functions)
when an input comes in multiple chunks, like from a file. | processResults | javascript | mholt/PapaParse | papaparse.js | https://github.com/mholt/PapaParse/blob/master/papaparse.js | MIT |
function needsHeaderRow()
{
return _config.header && _fields.length === 0;
} | Parses input. Most users won't need, and shouldn't mess with, the baseIndex
and ignoreLastRow parameters. They are used by streamers (wrapper functions)
when an input comes in multiple chunks, like from a file. | needsHeaderRow | javascript | mholt/PapaParse | papaparse.js | https://github.com/mholt/PapaParse/blob/master/papaparse.js | MIT |
function fillHeaderFields()
{
if (!_results)
return;
function addHeader(header, i)
{
header = stripBom(header);
if (isFunction(_config.transformHeader))
header = _config.transformHeader(header, i);
_fields.push(header);
}
if (Array.isArray(_results.data[0]))
{
for (var i ... | Parses input. Most users won't need, and shouldn't mess with, the baseIndex
and ignoreLastRow parameters. They are used by streamers (wrapper functions)
when an input comes in multiple chunks, like from a file. | fillHeaderFields | javascript | mholt/PapaParse | papaparse.js | https://github.com/mholt/PapaParse/blob/master/papaparse.js | MIT |
function addHeader(header, i)
{
header = stripBom(header);
if (isFunction(_config.transformHeader))
header = _config.transformHeader(header, i);
_fields.push(header);
} | Parses input. Most users won't need, and shouldn't mess with, the baseIndex
and ignoreLastRow parameters. They are used by streamers (wrapper functions)
when an input comes in multiple chunks, like from a file. | addHeader | javascript | mholt/PapaParse | papaparse.js | https://github.com/mholt/PapaParse/blob/master/papaparse.js | MIT |
function shouldApplyDynamicTyping(field) {
// Cache function values to avoid calling it for each row
if (_config.dynamicTypingFunction && _config.dynamicTyping[field] === undefined) {
_config.dynamicTyping[field] = _config.dynamicTypingFunction(field);
}
return (_config.dynamicTyping[field] || _config.d... | Parses input. Most users won't need, and shouldn't mess with, the baseIndex
and ignoreLastRow parameters. They are used by streamers (wrapper functions)
when an input comes in multiple chunks, like from a file. | shouldApplyDynamicTyping | javascript | mholt/PapaParse | papaparse.js | https://github.com/mholt/PapaParse/blob/master/papaparse.js | MIT |
function parseDynamic(field, value)
{
if (shouldApplyDynamicTyping(field))
{
if (value === 'true' || value === 'TRUE')
return true;
else if (value === 'false' || value === 'FALSE')
return false;
else if (testFloat(value))
return parseFloat(value);
else if (ISO_DATE.test(value))
... | Parses input. Most users won't need, and shouldn't mess with, the baseIndex
and ignoreLastRow parameters. They are used by streamers (wrapper functions)
when an input comes in multiple chunks, like from a file. | parseDynamic | javascript | mholt/PapaParse | papaparse.js | https://github.com/mholt/PapaParse/blob/master/papaparse.js | MIT |
function applyHeaderAndDynamicTypingAndTransformation()
{
if (!_results || (!_config.header && !_config.dynamicTyping && !_config.transform))
return _results;
function processRow(rowSource, i)
{
var row = _config.header ? {} : [];
var j;
for (j = 0; j < rowSource.length; j++)
{
var... | Parses input. Most users won't need, and shouldn't mess with, the baseIndex
and ignoreLastRow parameters. They are used by streamers (wrapper functions)
when an input comes in multiple chunks, like from a file. | applyHeaderAndDynamicTypingAndTransformation | javascript | mholt/PapaParse | papaparse.js | https://github.com/mholt/PapaParse/blob/master/papaparse.js | MIT |
function processRow(rowSource, i)
{
var row = _config.header ? {} : [];
var j;
for (j = 0; j < rowSource.length; j++)
{
var field = j;
var value = rowSource[j];
if (_config.header)
field = j >= _fields.length ? '__parsed_extra' : _fields[j];
if (_config.transform)
v... | Parses input. Most users won't need, and shouldn't mess with, the baseIndex
and ignoreLastRow parameters. They are used by streamers (wrapper functions)
when an input comes in multiple chunks, like from a file. | processRow | javascript | mholt/PapaParse | papaparse.js | https://github.com/mholt/PapaParse/blob/master/papaparse.js | MIT |
function guessDelimiter(input, newline, skipEmptyLines, comments, delimitersToGuess) {
var bestDelim, bestDelta, fieldCountPrevRow, maxFieldCount;
delimitersToGuess = delimitersToGuess || [',', '\t', '|', ';', Papa.RECORD_SEP, Papa.UNIT_SEP];
for (var i = 0; i < delimitersToGuess.length; i++) {
var delim... | Parses input. Most users won't need, and shouldn't mess with, the baseIndex
and ignoreLastRow parameters. They are used by streamers (wrapper functions)
when an input comes in multiple chunks, like from a file. | guessDelimiter | javascript | mholt/PapaParse | papaparse.js | https://github.com/mholt/PapaParse/blob/master/papaparse.js | MIT |
function addError(type, code, msg, row)
{
var error = {
type: type,
code: code,
message: msg
};
if(row !== undefined) {
error.row = row;
}
_results.errors.push(error);
} | Parses input. Most users won't need, and shouldn't mess with, the baseIndex
and ignoreLastRow parameters. They are used by streamers (wrapper functions)
when an input comes in multiple chunks, like from a file. | addError | javascript | mholt/PapaParse | papaparse.js | https://github.com/mholt/PapaParse/blob/master/papaparse.js | MIT |
function Parser(config)
{
// Unpack the config object
config = config || {};
var delim = config.delimiter;
var newline = config.newline;
var comments = config.comments;
var step = config.step;
var preview = config.preview;
var fastMode = config.fastMode;
var quoteChar;
var renamedHeaders = null;
... | The core parser implements speedy and correct CSV parsing | Parser | javascript | mholt/PapaParse | papaparse.js | https://github.com/mholt/PapaParse/blob/master/papaparse.js | MIT |
function pushRow(row)
{
data.push(row);
lastCursor = cursor;
} | The core parser implements speedy and correct CSV parsing | pushRow | javascript | mholt/PapaParse | papaparse.js | https://github.com/mholt/PapaParse/blob/master/papaparse.js | MIT |
function extraSpaces(index) {
var spaceLength = 0;
if (index !== -1) {
var textBetweenClosingQuoteAndIndex = input.substring(quoteSearch + 1, index);
if (textBetweenClosingQuoteAndIndex && textBetweenClosingQuoteAndIndex.trim() === '') {
spaceLength = textBetweenClosingQuoteAndIndex.length;
... | checks if there are extra spaces after closing quote and given index without any text
if Yes, returns the number of spaces | extraSpaces | javascript | mholt/PapaParse | papaparse.js | https://github.com/mholt/PapaParse/blob/master/papaparse.js | MIT |
function finish(value)
{
if (ignoreLastRow)
return returnable();
if (typeof value === 'undefined')
value = input.substring(cursor);
row.push(value);
cursor = inputLen; // important in case parsing is paused
pushRow(row);
if (stepIsFunction)
doStep();
return returnable();
... | Appends the remaining input from cursor to the end into
row, saves the row, calls step, and returns the results. | finish | javascript | mholt/PapaParse | papaparse.js | https://github.com/mholt/PapaParse/blob/master/papaparse.js | MIT |
function saveRow(newCursor)
{
cursor = newCursor;
pushRow(row);
row = [];
nextNewline = input.indexOf(newline, cursor);
} | Appends the current row to the results. It sets the cursor
to newCursor and finds the nextNewline. The caller should
take care to execute user's step function and check for
preview and end parsing if necessary. | saveRow | javascript | mholt/PapaParse | papaparse.js | https://github.com/mholt/PapaParse/blob/master/papaparse.js | MIT |
function returnable(stopped)
{
if (config.header && !baseIndex && data.length && !headerParsed)
{
const result = data[0];
const headerCount = Object.create(null); // To track the count of each base header
const usedHeaders = new Set(result); // To track used headers and avoid duplicates
l... | Returns an object with the results, errors, and meta. | returnable | javascript | mholt/PapaParse | papaparse.js | https://github.com/mholt/PapaParse/blob/master/papaparse.js | MIT |
function doStep()
{
step(returnable());
data = [];
errors = [];
} | Executes the user's step function and resets data & errors. | doStep | javascript | mholt/PapaParse | papaparse.js | https://github.com/mholt/PapaParse/blob/master/papaparse.js | MIT |
function mainThreadReceivedMessage(e)
{
var msg = e.data;
var worker = workers[msg.workerId];
var aborted = false;
if (msg.error)
worker.userError(msg.error, msg.file);
else if (msg.results && msg.results.data)
{
var abort = function() {
aborted = true;
completeWorker(msg.workerId, { data: [... | Callback when main thread receives a message | mainThreadReceivedMessage | javascript | mholt/PapaParse | papaparse.js | https://github.com/mholt/PapaParse/blob/master/papaparse.js | MIT |
abort = function() {
aborted = true;
completeWorker(msg.workerId, { data: [], errors: [], meta: { aborted: true } });
} | Callback when main thread receives a message | abort | javascript | mholt/PapaParse | papaparse.js | https://github.com/mholt/PapaParse/blob/master/papaparse.js | MIT |
function completeWorker(workerId, results) {
var worker = workers[workerId];
if (isFunction(worker.userComplete))
worker.userComplete(results);
worker.terminate();
delete workers[workerId];
} | Callback when main thread receives a message | completeWorker | javascript | mholt/PapaParse | papaparse.js | https://github.com/mholt/PapaParse/blob/master/papaparse.js | MIT |
function notImplemented() {
throw new Error('Not implemented.');
} | Callback when main thread receives a message | notImplemented | javascript | mholt/PapaParse | papaparse.js | https://github.com/mholt/PapaParse/blob/master/papaparse.js | MIT |
function workerThreadReceivedMessage(e)
{
var msg = e.data;
if (typeof Papa.WORKER_ID === 'undefined' && msg)
Papa.WORKER_ID = msg.workerId;
if (typeof msg.input === 'string')
{
global.postMessage({
workerId: Papa.WORKER_ID,
results: Papa.parse(msg.input, msg.config),
finished: true
});
... | Callback when worker thread receives a message | workerThreadReceivedMessage | javascript | mholt/PapaParse | papaparse.js | https://github.com/mholt/PapaParse/blob/master/papaparse.js | MIT |
function copy(obj)
{
if (typeof obj !== 'object' || obj === null)
return obj;
var cpy = Array.isArray(obj) ? [] : {};
for (var key in obj)
cpy[key] = copy(obj[key]);
return cpy;
} | Makes a deep copy of an array or object (mostly) | copy | javascript | mholt/PapaParse | papaparse.js | https://github.com/mholt/PapaParse/blob/master/papaparse.js | MIT |
function bindFunction(f, self)
{
return function() { f.apply(self, arguments); };
} | Makes a deep copy of an array or object (mostly) | bindFunction | javascript | mholt/PapaParse | papaparse.js | https://github.com/mholt/PapaParse/blob/master/papaparse.js | MIT |
function isFunction(func)
{
return typeof func === 'function';
} | Makes a deep copy of an array or object (mostly) | isFunction | javascript | mholt/PapaParse | papaparse.js | https://github.com/mholt/PapaParse/blob/master/papaparse.js | MIT |
function unpackConfig()
{
if (typeof _config !== 'object')
return;
if (typeof _config.delimiter === 'string'
&& !Papa.BAD_DELIMITERS.filter(function(value) { return _config.delimiter.indexOf(value) !== -1; }).length)
{
_delimiter = _config.delimiter;
}
if (typeof _config.quote... | the columns (keys) we expect when we unparse objects | unpackConfig | javascript | mholt/PapaParse | docs/resources/js/papaparse.js | https://github.com/mholt/PapaParse/blob/master/docs/resources/js/papaparse.js | MIT |
function objectKeys(obj)
{
if (typeof obj !== 'object')
return [];
var keys = [];
for (var key in obj)
keys.push(key);
return keys;
} | Turns an object's keys into an array | objectKeys | javascript | mholt/PapaParse | docs/resources/js/papaparse.js | https://github.com/mholt/PapaParse/blob/master/docs/resources/js/papaparse.js | MIT |
function serialize(fields, data, skipEmptyLines)
{
var csv = '';
if (typeof fields === 'string')
fields = JSON.parse(fields);
if (typeof data === 'string')
data = JSON.parse(data);
var hasHeader = Array.isArray(fields) && fields.length > 0;
var dataKeyedByField = !(Array.isArray(data[0]));
... | The double for loop that iterates the data and writes out a CSV string including header row | serialize | javascript | mholt/PapaParse | docs/resources/js/papaparse.js | https://github.com/mholt/PapaParse/blob/master/docs/resources/js/papaparse.js | MIT |
function safe(str, col)
{
if (typeof str === 'undefined' || str === null)
return '';
if (str.constructor === Date)
return JSON.stringify(str).slice(1, 25);
str = str.toString().replace(quoteCharRegex, _escapedQuote);
var needsQuotes = (typeof _quotes === 'boolean' && _quotes)
|| (Array.i... | Encloses a value around quotes if needed (makes a value safe for CSV insertion) | safe | javascript | mholt/PapaParse | docs/resources/js/papaparse.js | https://github.com/mholt/PapaParse/blob/master/docs/resources/js/papaparse.js | MIT |
function hasAny(str, substrings)
{
for (var i = 0; i < substrings.length; i++)
if (str.indexOf(substrings[i]) > -1)
return true;
return false;
} | Encloses a value around quotes if needed (makes a value safe for CSV insertion) | hasAny | javascript | mholt/PapaParse | docs/resources/js/papaparse.js | https://github.com/mholt/PapaParse/blob/master/docs/resources/js/papaparse.js | MIT |
function ChunkStreamer(config)
{
this._handle = null;
this._finished = false;
this._completed = false;
this._halted = false;
this._input = null;
this._baseIndex = 0;
this._partialLine = '';
this._rowCount = 0;
this._start = 0;
this._nextChunk = null;
this.isFirstChunk = true;
this._completeResu... | ChunkStreamer is the base prototype for various streamer implementations. | ChunkStreamer | javascript | mholt/PapaParse | docs/resources/js/papaparse.js | https://github.com/mholt/PapaParse/blob/master/docs/resources/js/papaparse.js | MIT |
function replaceConfig(config)
{
// Deep-copy the config so we can edit it
var configCopy = copy(config);
configCopy.chunkSize = parseInt(configCopy.chunkSize); // parseInt VERY important so we don't concatenate strings!
if (!config.step && !config.chunk)
configCopy.chunkSize = null; // disable Range... | ChunkStreamer is the base prototype for various streamer implementations. | replaceConfig | javascript | mholt/PapaParse | docs/resources/js/papaparse.js | https://github.com/mholt/PapaParse/blob/master/docs/resources/js/papaparse.js | MIT |
function NetworkStreamer(config)
{
config = config || {};
if (!config.chunkSize)
config.chunkSize = Papa.RemoteChunkSize;
ChunkStreamer.call(this, config);
var xhr;
if (IS_WORKER)
{
this._nextChunk = function()
{
this._readChunk();
this._chunkLoaded();
};
}
else
{
this._nextC... | ChunkStreamer is the base prototype for various streamer implementations. | NetworkStreamer | javascript | mholt/PapaParse | docs/resources/js/papaparse.js | https://github.com/mholt/PapaParse/blob/master/docs/resources/js/papaparse.js | MIT |
function getFileSize(xhr)
{
var contentRange = xhr.getResponseHeader('Content-Range');
if (contentRange === null) { // no content range, then finish!
return -1;
}
return parseInt(contentRange.substr(contentRange.lastIndexOf('/') + 1));
} | ChunkStreamer is the base prototype for various streamer implementations. | getFileSize | javascript | mholt/PapaParse | docs/resources/js/papaparse.js | https://github.com/mholt/PapaParse/blob/master/docs/resources/js/papaparse.js | MIT |
function FileStreamer(config)
{
config = config || {};
if (!config.chunkSize)
config.chunkSize = Papa.LocalChunkSize;
ChunkStreamer.call(this, config);
var reader, slice;
// FileReader is better than FileReaderSync (even in worker) - see http://stackoverflow.com/q/24708649/1048862
// But Firefox is a ... | ChunkStreamer is the base prototype for various streamer implementations. | FileStreamer | javascript | mholt/PapaParse | docs/resources/js/papaparse.js | https://github.com/mholt/PapaParse/blob/master/docs/resources/js/papaparse.js | MIT |
function StringStreamer(config)
{
config = config || {};
ChunkStreamer.call(this, config);
var remaining;
this.stream = function(s)
{
remaining = s;
return this._nextChunk();
};
this._nextChunk = function()
{
if (this._finished) return;
var size = this._config.chunkSize;
var chunk = siz... | ChunkStreamer is the base prototype for various streamer implementations. | StringStreamer | javascript | mholt/PapaParse | docs/resources/js/papaparse.js | https://github.com/mholt/PapaParse/blob/master/docs/resources/js/papaparse.js | MIT |
function ReadableStreamStreamer(config)
{
config = config || {};
ChunkStreamer.call(this, config);
var queue = [];
var parseOnData = true;
var streamHasEnded = false;
this.pause = function()
{
ChunkStreamer.prototype.pause.apply(this, arguments);
this._input.pause();
};
this.resume = functi... | ChunkStreamer is the base prototype for various streamer implementations. | ReadableStreamStreamer | javascript | mholt/PapaParse | docs/resources/js/papaparse.js | https://github.com/mholt/PapaParse/blob/master/docs/resources/js/papaparse.js | MIT |
function DuplexStreamStreamer(_config) {
var Duplex = require('stream').Duplex;
var config = copy(_config);
var parseOnWrite = true;
var writeStreamHasFinished = false;
var parseCallbackQueue = [];
var stream = null;
this._onCsvData = function(results)
{
var data = results.data;
if (!stream.push(... | ChunkStreamer is the base prototype for various streamer implementations. | DuplexStreamStreamer | javascript | mholt/PapaParse | docs/resources/js/papaparse.js | https://github.com/mholt/PapaParse/blob/master/docs/resources/js/papaparse.js | MIT |
function ParserHandle(_config)
{
// One goal is to minimize the use of regular expressions...
var FLOAT = /^\s*-?(\d*\.?\d+|\d+\.?\d*)(e[-+]?\d+)?\s*$/i;
var ISO_DATE = /(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z)... | ChunkStreamer is the base prototype for various streamer implementations. | ParserHandle | javascript | mholt/PapaParse | docs/resources/js/papaparse.js | https://github.com/mholt/PapaParse/blob/master/docs/resources/js/papaparse.js | MIT |
function testEmptyLine(s) {
return _config.skipEmptyLines === 'greedy' ? s.join('').trim() === '' : s.length === 1 && s[0].length === 0;
} | Parses input. Most users won't need, and shouldn't mess with, the baseIndex
and ignoreLastRow parameters. They are used by streamers (wrapper functions)
when an input comes in multiple chunks, like from a file. | testEmptyLine | javascript | mholt/PapaParse | docs/resources/js/papaparse.js | https://github.com/mholt/PapaParse/blob/master/docs/resources/js/papaparse.js | MIT |
function processResults()
{
if (_results && _delimiterError)
{
addError('Delimiter', 'UndetectableDelimiter', 'Unable to auto-detect delimiting character; defaulted to \'' + Papa.DefaultDelimiter + '\'');
_delimiterError = false;
}
if (_config.skipEmptyLines)
{
for (var i = 0; i < _results... | Parses input. Most users won't need, and shouldn't mess with, the baseIndex
and ignoreLastRow parameters. They are used by streamers (wrapper functions)
when an input comes in multiple chunks, like from a file. | processResults | javascript | mholt/PapaParse | docs/resources/js/papaparse.js | https://github.com/mholt/PapaParse/blob/master/docs/resources/js/papaparse.js | MIT |
function needsHeaderRow()
{
return _config.header && _fields.length === 0;
} | Parses input. Most users won't need, and shouldn't mess with, the baseIndex
and ignoreLastRow parameters. They are used by streamers (wrapper functions)
when an input comes in multiple chunks, like from a file. | needsHeaderRow | javascript | mholt/PapaParse | docs/resources/js/papaparse.js | https://github.com/mholt/PapaParse/blob/master/docs/resources/js/papaparse.js | MIT |
function fillHeaderFields()
{
if (!_results)
return;
function addHeder(header)
{
if (isFunction(_config.transformHeader))
header = _config.transformHeader(header);
_fields.push(header);
}
if (Array.isArray(_results.data[0]))
{
for (var i = 0; needsHeaderRow() && i < _results.... | Parses input. Most users won't need, and shouldn't mess with, the baseIndex
and ignoreLastRow parameters. They are used by streamers (wrapper functions)
when an input comes in multiple chunks, like from a file. | fillHeaderFields | javascript | mholt/PapaParse | docs/resources/js/papaparse.js | https://github.com/mholt/PapaParse/blob/master/docs/resources/js/papaparse.js | MIT |
function addHeder(header)
{
if (isFunction(_config.transformHeader))
header = _config.transformHeader(header);
_fields.push(header);
} | Parses input. Most users won't need, and shouldn't mess with, the baseIndex
and ignoreLastRow parameters. They are used by streamers (wrapper functions)
when an input comes in multiple chunks, like from a file. | addHeder | javascript | mholt/PapaParse | docs/resources/js/papaparse.js | https://github.com/mholt/PapaParse/blob/master/docs/resources/js/papaparse.js | MIT |
function shouldApplyDynamicTyping(field) {
// Cache function values to avoid calling it for each row
if (_config.dynamicTypingFunction && _config.dynamicTyping[field] === undefined) {
_config.dynamicTyping[field] = _config.dynamicTypingFunction(field);
}
return (_config.dynamicTyping[field] || _config.d... | Parses input. Most users won't need, and shouldn't mess with, the baseIndex
and ignoreLastRow parameters. They are used by streamers (wrapper functions)
when an input comes in multiple chunks, like from a file. | shouldApplyDynamicTyping | javascript | mholt/PapaParse | docs/resources/js/papaparse.js | https://github.com/mholt/PapaParse/blob/master/docs/resources/js/papaparse.js | MIT |
function parseDynamic(field, value)
{
if (shouldApplyDynamicTyping(field))
{
if (value === 'true' || value === 'TRUE')
return true;
else if (value === 'false' || value === 'FALSE')
return false;
else if (FLOAT.test(value))
return parseFloat(value);
else if (ISO_DATE.test(value))
... | Parses input. Most users won't need, and shouldn't mess with, the baseIndex
and ignoreLastRow parameters. They are used by streamers (wrapper functions)
when an input comes in multiple chunks, like from a file. | parseDynamic | javascript | mholt/PapaParse | docs/resources/js/papaparse.js | https://github.com/mholt/PapaParse/blob/master/docs/resources/js/papaparse.js | MIT |
function applyHeaderAndDynamicTypingAndTransformation()
{
if (!_results || (!_config.header && !_config.dynamicTyping && !_config.transform))
return _results;
function processRow(rowSource, i)
{
var row = _config.header ? {} : [];
var j;
for (j = 0; j < rowSource.length; j++)
{
var... | Parses input. Most users won't need, and shouldn't mess with, the baseIndex
and ignoreLastRow parameters. They are used by streamers (wrapper functions)
when an input comes in multiple chunks, like from a file. | applyHeaderAndDynamicTypingAndTransformation | javascript | mholt/PapaParse | docs/resources/js/papaparse.js | https://github.com/mholt/PapaParse/blob/master/docs/resources/js/papaparse.js | MIT |
function processRow(rowSource, i)
{
var row = _config.header ? {} : [];
var j;
for (j = 0; j < rowSource.length; j++)
{
var field = j;
var value = rowSource[j];
if (_config.header)
field = j >= _fields.length ? '__parsed_extra' : _fields[j];
if (_config.transform)
v... | Parses input. Most users won't need, and shouldn't mess with, the baseIndex
and ignoreLastRow parameters. They are used by streamers (wrapper functions)
when an input comes in multiple chunks, like from a file. | processRow | javascript | mholt/PapaParse | docs/resources/js/papaparse.js | https://github.com/mholt/PapaParse/blob/master/docs/resources/js/papaparse.js | MIT |
function guessDelimiter(input, newline, skipEmptyLines, comments, delimitersToGuess)
{
var bestDelim, bestDelta, fieldCountPrevRow;
delimitersToGuess = delimitersToGuess || [',', '\t', '|', ';', Papa.RECORD_SEP, Papa.UNIT_SEP];
for (var i = 0; i < delimitersToGuess.length; i++)
{
var delim = delimit... | Parses input. Most users won't need, and shouldn't mess with, the baseIndex
and ignoreLastRow parameters. They are used by streamers (wrapper functions)
when an input comes in multiple chunks, like from a file. | guessDelimiter | javascript | mholt/PapaParse | docs/resources/js/papaparse.js | https://github.com/mholt/PapaParse/blob/master/docs/resources/js/papaparse.js | MIT |
function addError(type, code, msg, row)
{
_results.errors.push({
type: type,
code: code,
message: msg,
row: row
});
} | Parses input. Most users won't need, and shouldn't mess with, the baseIndex
and ignoreLastRow parameters. They are used by streamers (wrapper functions)
when an input comes in multiple chunks, like from a file. | addError | javascript | mholt/PapaParse | docs/resources/js/papaparse.js | https://github.com/mholt/PapaParse/blob/master/docs/resources/js/papaparse.js | MIT |
function Parser(config)
{
// Unpack the config object
config = config || {};
var delim = config.delimiter;
var newline = config.newline;
var comments = config.comments;
var step = config.step;
var preview = config.preview;
var fastMode = config.fastMode;
var quoteChar;
/** Allows for no quoteChar b... | The core parser implements speedy and correct CSV parsing | Parser | javascript | mholt/PapaParse | docs/resources/js/papaparse.js | https://github.com/mholt/PapaParse/blob/master/docs/resources/js/papaparse.js | MIT |
function pushRow(row)
{
data.push(row);
lastCursor = cursor;
} | Allows for no quoteChar by setting quoteChar to undefined in config | pushRow | javascript | mholt/PapaParse | docs/resources/js/papaparse.js | https://github.com/mholt/PapaParse/blob/master/docs/resources/js/papaparse.js | MIT |
function extraSpaces(index) {
var spaceLength = 0;
if (index !== -1) {
var textBetweenClosingQuoteAndIndex = input.substring(quoteSearch + 1, index);
if (textBetweenClosingQuoteAndIndex && textBetweenClosingQuoteAndIndex.trim() === '') {
spaceLength = textBetweenClosingQuoteAndIndex.length;
... | checks if there are extra spaces after closing quote and given index without any text
if Yes, returns the number of spaces | extraSpaces | javascript | mholt/PapaParse | docs/resources/js/papaparse.js | https://github.com/mholt/PapaParse/blob/master/docs/resources/js/papaparse.js | MIT |
function finish(value)
{
if (ignoreLastRow)
return returnable();
if (typeof value === 'undefined')
value = input.substr(cursor);
row.push(value);
cursor = inputLen; // important in case parsing is paused
pushRow(row);
if (stepIsFunction)
doStep();
return returnable();
} | Appends the remaining input from cursor to the end into
row, saves the row, calls step, and returns the results. | finish | javascript | mholt/PapaParse | docs/resources/js/papaparse.js | https://github.com/mholt/PapaParse/blob/master/docs/resources/js/papaparse.js | MIT |
function saveRow(newCursor)
{
cursor = newCursor;
pushRow(row);
row = [];
nextNewline = input.indexOf(newline, cursor);
} | Appends the current row to the results. It sets the cursor
to newCursor and finds the nextNewline. The caller should
take care to execute user's step function and check for
preview and end parsing if necessary. | saveRow | javascript | mholt/PapaParse | docs/resources/js/papaparse.js | https://github.com/mholt/PapaParse/blob/master/docs/resources/js/papaparse.js | MIT |
function returnable(stopped, step)
{
var isStep = step || false;
return {
data: isStep ? data[0] : data,
errors: errors,
meta: {
delimiter: delim,
linebreak: newline,
aborted: aborted,
truncated: !!stopped,
cursor: lastCursor + (baseIndex || 0)
}
};
} | Returns an object with the results, errors, and meta. | returnable | javascript | mholt/PapaParse | docs/resources/js/papaparse.js | https://github.com/mholt/PapaParse/blob/master/docs/resources/js/papaparse.js | MIT |
function doStep()
{
step(returnable(undefined, true));
data = [];
errors = [];
} | Executes the user's step function and resets data & errors. | doStep | javascript | mholt/PapaParse | docs/resources/js/papaparse.js | https://github.com/mholt/PapaParse/blob/master/docs/resources/js/papaparse.js | MIT |
function mainThreadReceivedMessage(e)
{
var msg = e.data;
var worker = workers[msg.workerId];
var aborted = false;
if (msg.error)
worker.userError(msg.error, msg.file);
else if (msg.results && msg.results.data)
{
var abort = function() {
aborted = true;
completeWorker(msg.workerId, { data: [... | Callback when main thread receives a message | mainThreadReceivedMessage | javascript | mholt/PapaParse | docs/resources/js/papaparse.js | https://github.com/mholt/PapaParse/blob/master/docs/resources/js/papaparse.js | MIT |
abort = function() {
aborted = true;
completeWorker(msg.workerId, { data: [], errors: [], meta: { aborted: true } });
} | Callback when main thread receives a message | abort | javascript | mholt/PapaParse | docs/resources/js/papaparse.js | https://github.com/mholt/PapaParse/blob/master/docs/resources/js/papaparse.js | MIT |
function completeWorker(workerId, results) {
var worker = workers[workerId];
if (isFunction(worker.userComplete))
worker.userComplete(results);
worker.terminate();
delete workers[workerId];
} | Callback when main thread receives a message | completeWorker | javascript | mholt/PapaParse | docs/resources/js/papaparse.js | https://github.com/mholt/PapaParse/blob/master/docs/resources/js/papaparse.js | MIT |
function notImplemented() {
throw new Error('Not implemented.');
} | Callback when main thread receives a message | notImplemented | javascript | mholt/PapaParse | docs/resources/js/papaparse.js | https://github.com/mholt/PapaParse/blob/master/docs/resources/js/papaparse.js | MIT |
function workerThreadReceivedMessage(e)
{
var msg = e.data;
if (typeof Papa.WORKER_ID === 'undefined' && msg)
Papa.WORKER_ID = msg.workerId;
if (typeof msg.input === 'string')
{
global.postMessage({
workerId: Papa.WORKER_ID,
results: Papa.parse(msg.input, msg.config),
finished: true
});
... | Callback when worker thread receives a message | workerThreadReceivedMessage | javascript | mholt/PapaParse | docs/resources/js/papaparse.js | https://github.com/mholt/PapaParse/blob/master/docs/resources/js/papaparse.js | MIT |
function copy(obj)
{
if (typeof obj !== 'object' || obj === null)
return obj;
var cpy = Array.isArray(obj) ? [] : {};
for (var key in obj)
cpy[key] = copy(obj[key]);
return cpy;
} | Makes a deep copy of an array or object (mostly) | copy | javascript | mholt/PapaParse | docs/resources/js/papaparse.js | https://github.com/mholt/PapaParse/blob/master/docs/resources/js/papaparse.js | MIT |
function bindFunction(f, self)
{
return function() { f.apply(self, arguments); };
} | Makes a deep copy of an array or object (mostly) | bindFunction | javascript | mholt/PapaParse | docs/resources/js/papaparse.js | https://github.com/mholt/PapaParse/blob/master/docs/resources/js/papaparse.js | MIT |
function isFunction(func)
{
return typeof func === 'function';
} | Makes a deep copy of an array or object (mostly) | isFunction | javascript | mholt/PapaParse | docs/resources/js/papaparse.js | https://github.com/mholt/PapaParse/blob/master/docs/resources/js/papaparse.js | MIT |
logError = function logError( error ) {
if ( window && window.console && window.console.error ) {
window.console.error( error );
}
} | setValue() sets the Placard triggering DOM element's display value
@param {String} the value to be displayed
@param {Boolean} If you want to explicitly suppress the application
of ellipsis, pass `true`. This would typically only be
done from internal functions (like `applyEllipsis`)
that want to avoid c... | logError | javascript | ExactTarget/fuelux | dist/js/fuelux.js | https://github.com/ExactTarget/fuelux/blob/master/dist/js/fuelux.js | BSD-3-Clause |
Radio = function Radio( element, options ) {
this.options = $.extend( {}, $.fn.radio.defaults, options );
if ( element.tagName.toLowerCase() !== 'label' ) {
logError( 'Radio must be initialized on the `label` that wraps the `input` element. See https://github.com/ExactTarget/fuelux/blob/master/reference/mark... | setValue() sets the Placard triggering DOM element's display value
@param {String} the value to be displayed
@param {Boolean} If you want to explicitly suppress the application
of ellipsis, pass `true`. This would typically only be
done from internal functions (like `applyEllipsis`)
that want to avoid c... | Radio | javascript | ExactTarget/fuelux | dist/js/fuelux.js | https://github.com/ExactTarget/fuelux/blob/master/dist/js/fuelux.js | BSD-3-Clause |
Search = function( element, options ) {
this.$element = $( element );
this.$repeater = $( element ).closest( '.repeater' );
this.options = $.extend( {}, $.fn.search.defaults, options );
if ( this.$element.attr( 'data-searchOnKeyPress' ) === 'true' ) {
this.options.searchOnKeyPress = true;
}
this... | setValue() sets the Placard triggering DOM element's display value
@param {String} the value to be displayed
@param {Boolean} If you want to explicitly suppress the application
of ellipsis, pass `true`. This would typically only be
done from internal functions (like `applyEllipsis`)
that want to avoid c... | Search | javascript | ExactTarget/fuelux | dist/js/fuelux.js | https://github.com/ExactTarget/fuelux/blob/master/dist/js/fuelux.js | BSD-3-Clause |
Selectlist = function( element, options ) {
this.$element = $( element );
this.options = $.extend( {}, $.fn.selectlist.defaults, options );
this.$button = this.$element.find( '.btn.dropdown-toggle' );
this.$hiddenField = this.$element.find( '.hidden-field' );
this.$label = this.$element.find( '.selecte... | setValue() sets the Placard triggering DOM element's display value
@param {String} the value to be displayed
@param {Boolean} If you want to explicitly suppress the application
of ellipsis, pass `true`. This would typically only be
done from internal functions (like `applyEllipsis`)
that want to avoid c... | Selectlist | javascript | ExactTarget/fuelux | dist/js/fuelux.js | https://github.com/ExactTarget/fuelux/blob/master/dist/js/fuelux.js | BSD-3-Clause |
Spinbox = function Spinbox( element, options ) {
this.$element = $( element );
this.$element.find( '.btn' ).on( 'click', function( e ) {
//keep spinbox from submitting if they forgot to say type="button" on their spinner buttons
e.preventDefault();
} );
this.options = $.extend( {}, $.fn.spinbox.defa... | setValue() sets the Placard triggering DOM element's display value
@param {String} the value to be displayed
@param {Boolean} If you want to explicitly suppress the application
of ellipsis, pass `true`. This would typically only be
done from internal functions (like `applyEllipsis`)
that want to avoid c... | Spinbox | javascript | ExactTarget/fuelux | dist/js/fuelux.js | https://github.com/ExactTarget/fuelux/blob/master/dist/js/fuelux.js | BSD-3-Clause |
_limitToStep = function _limitToStep( number, step ) {
return Math.round( number / step ) * step;
} | setValue() sets the Placard triggering DOM element's display value
@param {String} the value to be displayed
@param {Boolean} If you want to explicitly suppress the application
of ellipsis, pass `true`. This would typically only be
done from internal functions (like `applyEllipsis`)
that want to avoid c... | _limitToStep | javascript | ExactTarget/fuelux | dist/js/fuelux.js | https://github.com/ExactTarget/fuelux/blob/master/dist/js/fuelux.js | BSD-3-Clause |
_isUnitLegal = function _isUnitLegal( unit, validUnits ) {
var legalUnit = false;
var suspectUnit = unit.toLowerCase();
$.each( validUnits, function( i, validUnit ) {
validUnit = validUnit.toLowerCase();
if ( suspectUnit === validUnit ) {
legalUnit = true;
return false; //break out of the lo... | setValue() sets the Placard triggering DOM element's display value
@param {String} the value to be displayed
@param {Boolean} If you want to explicitly suppress the application
of ellipsis, pass `true`. This would typically only be
done from internal functions (like `applyEllipsis`)
that want to avoid c... | _isUnitLegal | javascript | ExactTarget/fuelux | dist/js/fuelux.js | https://github.com/ExactTarget/fuelux/blob/master/dist/js/fuelux.js | BSD-3-Clause |
_applyLimits = function _applyLimits( value ) {
// if unreadable
if ( isNaN( parseFloat( value ) ) ) {
return value;
}
// if not within range return the limit
if ( value > this.options.max ) {
if ( this.options.cycle ) {
value = this.options.min;
} else {
value = this.options.max;
... | setValue() sets the Placard triggering DOM element's display value
@param {String} the value to be displayed
@param {Boolean} If you want to explicitly suppress the application
of ellipsis, pass `true`. This would typically only be
done from internal functions (like `applyEllipsis`)
that want to avoid c... | _applyLimits | javascript | ExactTarget/fuelux | dist/js/fuelux.js | https://github.com/ExactTarget/fuelux/blob/master/dist/js/fuelux.js | BSD-3-Clause |
Tree = function Tree( element, options ) {
this.$element = $( element );
this.options = $.extend( {}, $.fn.tree.defaults, options );
this.$element.attr( 'tabindex', '0' );
if ( this.options.itemSelect ) {
this.$element.on( 'click.fu.tree', '.tree-item', $.proxy( function callSelect( ev ) {
this.s... | setValue() sets the Placard triggering DOM element's display value
@param {String} the value to be displayed
@param {Boolean} If you want to explicitly suppress the application
of ellipsis, pass `true`. This would typically only be
done from internal functions (like `applyEllipsis`)
that want to avoid c... | Tree | javascript | ExactTarget/fuelux | dist/js/fuelux.js | https://github.com/ExactTarget/fuelux/blob/master/dist/js/fuelux.js | BSD-3-Clause |
disclosedCompleted = function disclosedCompleted() {
$tree.trigger( 'disclosedFolder.fu.tree', $branch.data() );
} | setValue() sets the Placard triggering DOM element's display value
@param {String} the value to be displayed
@param {Boolean} If you want to explicitly suppress the application
of ellipsis, pass `true`. This would typically only be
done from internal functions (like `applyEllipsis`)
that want to avoid c... | disclosedCompleted | javascript | ExactTarget/fuelux | dist/js/fuelux.js | https://github.com/ExactTarget/fuelux/blob/master/dist/js/fuelux.js | BSD-3-Clause |
closedReported = function closedReported( event, closed ) {
reportedClosed.push( closed );
// jQuery deprecated hide in 3.0. Use hidden instead. Leaving hide here to support previous markup
if ( self.$element.find( ".tree-branch.tree-open:not('.hidden, .hide')" ).length === 0 ) {
self.$element.tri... | setValue() sets the Placard triggering DOM element's display value
@param {String} the value to be displayed
@param {Boolean} If you want to explicitly suppress the application
of ellipsis, pass `true`. This would typically only be
done from internal functions (like `applyEllipsis`)
that want to avoid c... | closedReported | javascript | ExactTarget/fuelux | dist/js/fuelux.js | https://github.com/ExactTarget/fuelux/blob/master/dist/js/fuelux.js | BSD-3-Clause |
openReported = function openReported( event, opened ) {
reportedOpened.push( opened );
if ( reportedOpened.length === $openableFolders.length ) {
self.$element.trigger( 'disclosedVisible.fu.tree', {
tree: self.$element,
reportedOpened: reportedOpened
} );
/*
* Unbind th... | setValue() sets the Placard triggering DOM element's display value
@param {String} the value to be displayed
@param {Boolean} If you want to explicitly suppress the application
of ellipsis, pass `true`. This would typically only be
done from internal functions (like `applyEllipsis`)
that want to avoid c... | openReported | javascript | ExactTarget/fuelux | dist/js/fuelux.js | https://github.com/ExactTarget/fuelux/blob/master/dist/js/fuelux.js | BSD-3-Clause |
fixFocusability = function fixFocusability( $tree, $branch ) {
/*
When tree initializes on page, the `<ul>` element should have tabindex=0 and all sub-elements should have
tabindex=-1. When focus leaves the tree, whatever the last focused on element was will keep the tabindex=0. The
tree itself will have a ... | setValue() sets the Placard triggering DOM element's display value
@param {String} the value to be displayed
@param {Boolean} If you want to explicitly suppress the application
of ellipsis, pass `true`. This would typically only be
done from internal functions (like `applyEllipsis`)
that want to avoid c... | fixFocusability | javascript | ExactTarget/fuelux | dist/js/fuelux.js | https://github.com/ExactTarget/fuelux/blob/master/dist/js/fuelux.js | BSD-3-Clause |
focusIn = function focusIn( $tree, $branch ) {
var $focusCandidate = $branch.find( '.tree-selected:first' );
// if no node is selected, set focus to first visible node
if ( $focusCandidate.length <= 0 ) {
$focusCandidate = $branch.find( 'li:not(".hidden"):first' );
}
setFocus( $tree, $focusCandidat... | setValue() sets the Placard triggering DOM element's display value
@param {String} the value to be displayed
@param {Boolean} If you want to explicitly suppress the application
of ellipsis, pass `true`. This would typically only be
done from internal functions (like `applyEllipsis`)
that want to avoid c... | focusIn | javascript | ExactTarget/fuelux | dist/js/fuelux.js | https://github.com/ExactTarget/fuelux/blob/master/dist/js/fuelux.js | BSD-3-Clause |
setFocus = function setFocus( $tree, $branch ) {
fixFocusability( $tree, $branch );
$tree.attr( 'aria-activedescendant', $branch.attr( 'id' ) );
$branch.focus();
$tree.trigger( 'setFocus.fu.tree', $branch );
} | setValue() sets the Placard triggering DOM element's display value
@param {String} the value to be displayed
@param {Boolean} If you want to explicitly suppress the application
of ellipsis, pass `true`. This would typically only be
done from internal functions (like `applyEllipsis`)
that want to avoid c... | setFocus | javascript | ExactTarget/fuelux | dist/js/fuelux.js | https://github.com/ExactTarget/fuelux/blob/master/dist/js/fuelux.js | BSD-3-Clause |
navigateTree = function navigateTree( $tree, e ) {
if ( e.isDefaultPrevented() || e.isPropagationStopped() ) {
return false;
}
var targetNode = e.originalEvent.target;
var $targetNode = $( targetNode );
var isOpen = $targetNode.hasClass( 'tree-open' );
var handled = false;
// because es5 lacks... | setValue() sets the Placard triggering DOM element's display value
@param {String} the value to be displayed
@param {Boolean} If you want to explicitly suppress the application
of ellipsis, pass `true`. This would typically only be
done from internal functions (like `applyEllipsis`)
that want to avoid c... | navigateTree | javascript | ExactTarget/fuelux | dist/js/fuelux.js | https://github.com/ExactTarget/fuelux/blob/master/dist/js/fuelux.js | BSD-3-Clause |
done = function done() {
$tree.trigger( 'keyboardNavigated.fu.tree', e, $targetNode );
} | setValue() sets the Placard triggering DOM element's display value
@param {String} the value to be displayed
@param {Boolean} If you want to explicitly suppress the application
of ellipsis, pass `true`. This would typically only be
done from internal functions (like `applyEllipsis`)
that want to avoid c... | done | javascript | ExactTarget/fuelux | dist/js/fuelux.js | https://github.com/ExactTarget/fuelux/blob/master/dist/js/fuelux.js | BSD-3-Clause |
ariaSelect = function ariaSelect( $element ) {
$element.attr( 'aria-selected', true );
} | setValue() sets the Placard triggering DOM element's display value
@param {String} the value to be displayed
@param {Boolean} If you want to explicitly suppress the application
of ellipsis, pass `true`. This would typically only be
done from internal functions (like `applyEllipsis`)
that want to avoid c... | ariaSelect | javascript | ExactTarget/fuelux | dist/js/fuelux.js | https://github.com/ExactTarget/fuelux/blob/master/dist/js/fuelux.js | BSD-3-Clause |
ariaDeselect = function ariaDeselect( $element ) {
$element.attr( 'aria-selected', false );
} | setValue() sets the Placard triggering DOM element's display value
@param {String} the value to be displayed
@param {Boolean} If you want to explicitly suppress the application
of ellipsis, pass `true`. This would typically only be
done from internal functions (like `applyEllipsis`)
that want to avoid c... | ariaDeselect | javascript | ExactTarget/fuelux | dist/js/fuelux.js | https://github.com/ExactTarget/fuelux/blob/master/dist/js/fuelux.js | BSD-3-Clause |
function styleNodeSelected( $element, $icon ) {
$element.addClass( 'tree-selected' );
if ( $element.data( 'type' ) === 'item' && $icon.hasClass( 'fueluxicon-bullet' ) ) {
$icon.removeClass( 'fueluxicon-bullet' ).addClass( 'glyphicon-ok' ); // make checkmark
}
} | setValue() sets the Placard triggering DOM element's display value
@param {String} the value to be displayed
@param {Boolean} If you want to explicitly suppress the application
of ellipsis, pass `true`. This would typically only be
done from internal functions (like `applyEllipsis`)
that want to avoid c... | styleNodeSelected | javascript | ExactTarget/fuelux | dist/js/fuelux.js | https://github.com/ExactTarget/fuelux/blob/master/dist/js/fuelux.js | BSD-3-Clause |
function styleNodeDeselected( $element, $icon ) {
$element.removeClass( 'tree-selected' );
if ( $element.data( 'type' ) === 'item' && $icon.hasClass( 'glyphicon-ok' ) ) {
$icon.removeClass( 'glyphicon-ok' ).addClass( 'fueluxicon-bullet' ); // make bullet
}
} | setValue() sets the Placard triggering DOM element's display value
@param {String} the value to be displayed
@param {Boolean} If you want to explicitly suppress the application
of ellipsis, pass `true`. This would typically only be
done from internal functions (like `applyEllipsis`)
that want to avoid c... | styleNodeDeselected | javascript | ExactTarget/fuelux | dist/js/fuelux.js | https://github.com/ExactTarget/fuelux/blob/master/dist/js/fuelux.js | BSD-3-Clause |
function multiSelectSyncNodes( self, clicked, selected ) {
// search for currently selected and add to selected data list if needed
$.each( selected.$elements, function findCurrentlySelected( index, element ) {
var $element = $( element );
if ( $element[ 0 ] !== clicked.$element[ 0 ] ) {
selected.da... | setValue() sets the Placard triggering DOM element's display value
@param {String} the value to be displayed
@param {Boolean} If you want to explicitly suppress the application
of ellipsis, pass `true`. This would typically only be
done from internal functions (like `applyEllipsis`)
that want to avoid c... | multiSelectSyncNodes | javascript | ExactTarget/fuelux | dist/js/fuelux.js | https://github.com/ExactTarget/fuelux/blob/master/dist/js/fuelux.js | BSD-3-Clause |
function singleSelectSyncNodes( self, clicked, selected ) {
// element is not currently selected
if ( selected.$elements[ 0 ] !== clicked.$element[ 0 ] ) {
self.deselectAll( self.$element );
styleNodeSelected( clicked.$element, clicked.$icon );
// set event data
selected.eventType = 'selected';
... | setValue() sets the Placard triggering DOM element's display value
@param {String} the value to be displayed
@param {Boolean} If you want to explicitly suppress the application
of ellipsis, pass `true`. This would typically only be
done from internal functions (like `applyEllipsis`)
that want to avoid c... | singleSelectSyncNodes | javascript | ExactTarget/fuelux | dist/js/fuelux.js | https://github.com/ExactTarget/fuelux/blob/master/dist/js/fuelux.js | BSD-3-Clause |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.