_id stringlengths 2 6 | title stringlengths 0 58 | partition stringclasses 3
values | text stringlengths 52 373k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q25000 | isHTMLElement | train | function isHTMLElement(o) {
var strOwnerDocument = 'ownerDocument';
var strHTMLElement = 'HTMLElement';
var wnd = o && o[strOwnerDocument] ? (o[strOwnerDocument].parentWindow || window) : window;
return (
typeof wnd[... | javascript | {
"resource": ""
} |
q25001 | getArrayDifferences | train | function getArrayDifferences(a1, a2) {
var a = [ ];
var diff = [ ];
var i;
var k;
for (i = 0; i < a1.length; i++)
a[a1[i]] = true;
for (i = 0; i < a2.length; i++) {
... | javascript | {
"resource": ""
} |
q25002 | parseToZeroOrNumber | train | function parseToZeroOrNumber(value, toFloat) {
var num = toFloat ? parseFloat(value) : parseInt(value, 10);
return isNaN(num) ? 0 : num;
} | javascript | {
"resource": ""
} |
q25003 | getTextareaInfo | train | function getTextareaInfo() {
//read needed values
var textareaCursorPosition = _targetElementNative.selectionStart;
if (textareaCursorPosition === undefined)
return;
var strLength = 'length';
var... | javascript | {
"resource": ""
} |
q25004 | generateDiv | train | function generateDiv(classesOrAttrs, content) {
return '<div ' + (classesOrAttrs ? type(classesOrAttrs) == TYPES.s ?
'class="' + classesOrAttrs + '"' :
(function() {
var key;
var attrs... | javascript | {
"resource": ""
} |
q25005 | getObjectPropVal | train | function getObjectPropVal(obj, path) {
var splits = path.split(_strDot);
var i = 0;
var val;
for(; i < splits.length; i++) {
if(!obj.hasOwnProperty(splits[i]))
return;
... | javascript | {
"resource": ""
} |
q25006 | setObjectPropVal | train | function setObjectPropVal(obj, path, val) {
var splits = path.split(_strDot);
var splitsLength = splits.length;
var i = 0;
var extendObj = { };
var extendObjRoot = extendObj;
for(; i < splitsLength; i... | javascript | {
"resource": ""
} |
q25007 | checkCacheDouble | train | function checkCacheDouble(current, cache, prop1, prop2, force) {
if (force === true)
return force;
if (prop2 === undefined && force === undefined) {
if (prop1 === true)
return prop1;
... | javascript | {
"resource": ""
} |
q25008 | checkCacheTRBL | train | function checkCacheTRBL(current, cache) {
if (cache === undefined)
return true;
else if (current.t !== cache.t ||
current.r !== cache.r ||
current.b !== cache.b ||
current.l !== cache.... | javascript | {
"resource": ""
} |
q25009 | validGh | train | function validGh (opts) {
if (!opts.ghrelease) {
return Promise.resolve(true)
}
if (!opts.ghtoken) {
return Promise.reject(new Error('Missing GitHub access token. ' +
'Have you set `AEGIR_GHTOKEN`?'))
}
return Promise.resolve()
} | javascript | {
"resource": ""
} |
q25010 | isDirty | train | function isDirty () {
return pify(git.raw.bind(git))(['status', '-s'])
.then((out) => {
if (out && out.trim().length > 0) {
throw new Error('Dirty git repo, aborting')
}
})
} | javascript | {
"resource": ""
} |
q25011 | isOcspValidationDisabled | train | function isOcspValidationDisabled(host)
{
// ocsp is disabled if insecure-connect is enabled, or if we've disabled ocsp
// for non-snowflake endpoints and the host is a non-snowflake endpoint
return GlobalConfig.isInsecureConnect() || (Parameters.getValue(
Parameters.names.JS_DRIVER_DISABLE_OCSP_FOR_NON... | javascript | {
"resource": ""
} |
q25012 | validateCertChain | train | function validateCertChain(cert, cb)
{
// walk up the certificate chain and collect all the certificates in an array
var certs = [];
while (cert && cert.issuerCertificate &&
(cert.fingerprint !== cert.issuerCertificate.fingerprint))
{
certs.push(cert);
cert = cert.issuerCertificate;
}
// create a... | javascript | {
"resource": ""
} |
q25013 | train | function(certs, index)
{
var cert = certs[index];
validateCert(cert, function(err, data)
{
completed++;
errors[index] = err;
// if we have an ocsp response, cache it
if (data)
{
getOcspResponseCache().set(cert, data);
}
// if this is the last request to ... | javascript | {
"resource": ""
} | |
q25014 | validateCert | train | function validateCert(cert, cb)
{
// if we already have an entry in the cache, use it
var ocspResponse = getOcspResponseCache().get(cert);
if (ocspResponse)
{
process.nextTick(function()
{
Logger.getInstance().trace('Returning OCSP status for certificate %s ' +
'from cache', cert.serialN... | javascript | {
"resource": ""
} |
q25015 | train | function (url, paramName, paramValue)
{
// if the specified url is valid
var urlAsObject = Url.parse(url);
if (urlAsObject)
{
// if the url already has query parameters, use '&' as the separator
// when appending the additional query parameter, otherwise use '?'
url +... | javascript | {
"resource": ""
} | |
q25016 | Logger | train | function Logger(options)
{
/**
* The array to which all log messages will be added.
*
* @type {String[]}
*/
var buffer = [];
/**
* Logs a message at a given level.
*
* @param {String} levelTag the tag associated with the level at which to log
* the message.
* @param {String} message ... | javascript | {
"resource": ""
} |
q25017 | ConnectionContext | train | function ConnectionContext(connectionConfig, httpClient, config)
{
// validate input
Errors.assertInternal(Util.isObject(connectionConfig));
Errors.assertInternal(Util.isObject(httpClient));
// if a config object was specified, verify
// that it has all the information we need
var sfServiceConfig;
if (Ut... | javascript | {
"resource": ""
} |
q25018 | SfTimestamp | train | function SfTimestamp(epochSeconds, nanoSeconds, scale, timezone, format)
{
// pick reasonable defaults for the inputs if needed
epochSeconds = Util.isNumber(epochSeconds) ? epochSeconds : 0;
nanoSeconds = Util.isNumber(nanoSeconds) ? nanoSeconds : 0;
scale = Util.isNumber(scale) ? scale : 0;
format = Util.isS... | javascript | {
"resource": ""
} |
q25019 | Core | train | function Core(options)
{
// validate input
Errors.assertInternal(Util.isObject(options));
Errors.assertInternal(
Util.exists(options.httpClient || options.httpClientClass));
Errors.assertInternal(Util.exists(options.loggerClass));
// set the logger instance
Logger.setInstance(new (options.loggerClass... | javascript | {
"resource": ""
} |
q25020 | train | function(options, serializedConnection)
{
// check for missing serializedConfig
Errors.checkArgumentExists(Util.exists(serializedConnection),
ErrorCodes.ERR_CONN_DESERIALIZE_MISSING_CONFIG);
// check for invalid serializedConfig
Errors.checkArgumentValid(Util.isString(serializedCo... | javascript | {
"resource": ""
} | |
q25021 | train | function(options)
{
var logTag = options.logLevel;
if (Util.exists(logTag))
{
// check that the specified value is a valid tag
Errors.checkArgumentValid(LoggerCore.isValidLogTag(logTag),
ErrorCodes.ERR_GLOGAL_CONFIGURE_INVALID_LOG_LEVEL);
Logger.getInstance().c... | javascript | {
"resource": ""
} | |
q25022 | Logger | train | function Logger(options)
{
var common;
var winstonLogger;
/**
* Logs a message at a given level.
*
* @param {String} levelTag the tag associated with the level at which to log
* the message.
* @param {String} message the message to log.
* @param {Number} bufferMaxLength the maximum size to wh... | javascript | {
"resource": ""
} |
q25023 | createParameters | train | function createParameters()
{
var isNonNegativeInteger = Util.number.isNonNegativeInteger.bind(Util.number);
var isPositiveInteger = Util.number.isPositiveInteger.bind(Util.number);
var isNonNegativeNumber = Util.number.isNonNegative.bind(Util.number);
return [
{
name : PARAM_TIMEOUT,
... | javascript | {
"resource": ""
} |
q25024 | train | function(options)
{
var localIncludeTimestamp;
var localBufferMaxLength;
var localMessageMaxLength;
var localLevel;
// if an options argument is specified
if (Util.exists(options))
{
// make sure it's an object
Errors.assertInternal(Util.isObject(options));... | javascript | {
"resource": ""
} | |
q25025 | Parameter | train | function Parameter(options)
{
// validate input
Errors.assertInternal(Util.isObject(options));
Errors.assertInternal(Util.isString(options.name));
Errors.assertInternal(Util.exists(options.value));
var name = options.name;
var value = options.value;
/**
* Returns the name of the parameter.
*
* ... | javascript | {
"resource": ""
} |
q25026 | createError | train | function createError(name, options)
{
// TODO: validate that name is a string and options is an object
// TODO: this code is a bit of a mess and needs to be cleaned up
// create a new error
var error = new Error();
// set its name
error.name = name;
// set the error code
var code;
error.code = cod... | javascript | {
"resource": ""
} |
q25027 | OcspResponseCache | train | function OcspResponseCache(capacity, maxAge)
{
// validate input
Errors.assertInternal(Util.number.isPositiveInteger(capacity));
Errors.assertInternal(Util.number.isPositiveInteger(maxAge));
// create a cache to store the responses
var cache = new SimpleCache({ maxSize: capacity });
/**
* Adds an entry... | javascript | {
"resource": ""
} |
q25028 | ResultStream | train | function ResultStream(options)
{
// options should be an object
Errors.assertInternal(Util.isObject(options));
var chunks = options.chunks;
var prefetchSize = options.prefetchSize;
// chunks should be an array
Errors.assertInternal(Util.isArray(chunks));
// prefetch size should be non-negative
... | javascript | {
"resource": ""
} |
q25029 | train | function(err, chunk)
{
// unsubscribe from the 'loadcomplete' event
chunk.removeListener('loadcomplete', onLoadComplete);
// if the chunk load succeeded
if (!err)
{
// move on to the next chunk
start++;
// emit an event to signal that new data is available
self.emit('data... | javascript | {
"resource": ""
} | |
q25030 | train | function()
{
// get the array of chunks whose contents need to be fetched
var buffer = chunks.slice(start, start + prefetchSize + 1);
// the first chunk in the buffer is the next chunk we want to load
var nextChunk = buffer[0];
// if we don't have anymore chunks to load, we're done
if (!next... | javascript | {
"resource": ""
} | |
q25031 | invokeStatementComplete | train | function invokeStatementComplete(statement, context)
{
// find out if the result will be streamed;
// if a value is not specified, get it from the connection
var streamResult = context.streamResult;
if (!Util.exists(streamResult))
{
streamResult = context.connectionConfig.getStreamResult();
}
// if t... | javascript | {
"resource": ""
} |
q25032 | createOnStatementRequestSuccRow | train | function createOnStatementRequestSuccRow(statement, context)
{
return function(body)
{
// if we don't already have a result
if (!context.result)
{
// build a result from the response
context.result = new Result(
{
response : body,
statement : statement,
... | javascript | {
"resource": ""
} |
q25033 | FileStatementPreExec | train | function FileStatementPreExec(
statementOptions, context, services, connectionConfig)
{
// call super
BaseStatement.apply(this, arguments);
// add the result request headers to the context
context.resultRequestHeaders = buildResultRequestHeadersFile();
/**
* Called when the statement request is succe... | javascript | {
"resource": ""
} |
q25034 | RowStatementPostExec | train | function RowStatementPostExec(
statementOptions, context, services, connectionConfig)
{
// call super
BaseStatement.apply(this, arguments);
// add the result request headers to the context
context.resultRequestHeaders = buildResultRequestHeadersRow();
/**
* Called when the statement request is succes... | javascript | {
"resource": ""
} |
q25035 | createFnStreamRows | train | function createFnStreamRows(statement, context)
{
return function(options)
{
// if some options are specified
if (Util.exists(options))
{
// check for invalid options
Errors.checkArgumentValid(Util.isObject(options),
ErrorCodes.ERR_STMT_FETCH_ROWS_INVALID_OPTIONS);
// check ... | javascript | {
"resource": ""
} |
q25036 | fetchRowsFromResult | train | function fetchRowsFromResult(options, statement, context)
{
var numInterrupts = 0;
// forward to the result to get a FetchRowsOperation object
var operation = context.result.fetchRows(options);
// subscribe to the operation's 'complete' event
operation.on('complete', function(err, continueCallback)
{
... | javascript | {
"resource": ""
} |
q25037 | sendCancelStatement | train | function sendCancelStatement(statementContext, statement, callback)
{
var url;
var json;
// use different rest endpoints based on whether the statement id is available
if (statementContext.statementId)
{
url = '/queries/' + statementContext.statementId + '/abort-request';
}
else
{
url = '/quer... | javascript | {
"resource": ""
} |
q25038 | sendRequestPreExec | train | function sendRequestPreExec(statementContext, onResultAvailable)
{
// get the request headers
var headers = statementContext.resultRequestHeaders;
// build the basic json for the request
var json =
{
disableOfflineChunks : false,
sqlText : statementContext.sqlText
};
// if binds are... | javascript | {
"resource": ""
} |
q25039 | buildBindsMap | train | function buildBindsMap(bindsArray)
{
var bindsMap = {};
var isArrayBinding = bindsArray.length >0 && Util.isArray(bindsArray[0]);
var singleArray = isArrayBinding ? bindsArray[0] : bindsArray;
for (var index = 0, length = singleArray.length; index < length; index++)
{
var value = singleArray[index];
... | javascript | {
"resource": ""
} |
q25040 | sendRequestPostExec | train | function sendRequestPostExec(statementContext, onResultAvailable)
{
// get the request headers
var headers = statementContext.resultRequestHeaders;
// use the snowflake service to issue the request
sendSfRequest(statementContext,
{
method : 'GET',
headers: headers,
url : Url.format(
{
... | javascript | {
"resource": ""
} |
q25041 | sendSfRequest | train | function sendSfRequest(statementContext, options, appendQueryParamOnRetry)
{
var sf = statementContext.services.sf;
var connectionConfig = statementContext.connectionConfig;
// clone the options
options = Util.apply({}, options);
// get the original url and callback
var urlOrig = options.url;
var callba... | javascript | {
"resource": ""
} |
q25042 | buildResultRequestCallback | train | function buildResultRequestCallback(
statementContext, headers, onResultAvailable)
{
var callback = function(err, body)
{
// if the result is not ready yet, extract the result url from the response
// and issue a GET request to try to fetch the result again
if (!err && body && (body.code === '333333... | javascript | {
"resource": ""
} |
q25043 | Chunk | train | function Chunk(options)
{
// make sure the options object contains all the necessary information
Errors.assertInternal(Util.isObject(options));
Errors.assertInternal(Util.isObject(options.statement));
Errors.assertInternal(Util.isObject(options.services));
Errors.assertInternal(Util.isNumber(options.startInde... | javascript | {
"resource": ""
} |
q25044 | train | function(err)
{
// we're done loading
self._isLoading = false;
// emit an event to notify subscribers
self.emit('loadcomplete', err, self);
// invoke the callback if one was specified
if (Util.isFunction(callback))
{
callback(err, self);
}
} | javascript | {
"resource": ""
} | |
q25045 | convertRowsetToRows | train | function convertRowsetToRows(
statement,
startIndex,
rowset,
columns,
mapColumnNameToIndices)
{
// assert that rowset and columns are arrays
Errors.assertInternal(Util.isArray(rowset));
Errors.assertInternal(Util.isArray(columns));
//////////////////////////////////////////////////////////... | javascript | {
"resource": ""
} |
q25046 | getColumnValue | train | function getColumnValue(columnIdentifier)
{
// resolve the column identifier to the correct column if possible
var column = resolveColumnIdentifierToColumn(
columns, columnIdentifier, mapColumnNameToIndices);
return column ? column.getRowValue(this) : undefined;
} | javascript | {
"resource": ""
} |
q25047 | getColumnValueAsString | train | function getColumnValueAsString(columnIdentifier)
{
// resolve the column identifier to the correct column if possible
var column = resolveColumnIdentifierToColumn(
columns, columnIdentifier, mapColumnNameToIndices);
return column ? column.getRowValueAsString(this) : undefined;
} | javascript | {
"resource": ""
} |
q25048 | resolveColumnIdentifierToColumn | train | function resolveColumnIdentifierToColumn(
columns, columnIdentifier, mapColumnNameToIndices)
{
var columnIndex;
// if the column identifier is a string, treat it as a column
// name and use it to get the index of the specified column
if (Util.isString(columnIdentifier))
{
// if a valid column name wa... | javascript | {
"resource": ""
} |
q25049 | LargeResultSetService | train | function LargeResultSetService(connectionConfig, httpClient)
{
// validate input
Errors.assertInternal(Util.isObject(connectionConfig));
Errors.assertInternal(Util.isObject(httpClient));
function isRetryableError(response, err)
{
// https://aws.amazon.com/articles/1904 (Handling Errors)
// Note: 403'... | javascript | {
"resource": ""
} |
q25050 | callback | train | function callback(err, response, body)
{
if (err)
{
// if we haven't exceeded the maximum number of retries yet and the
// server came back with a retryable error code.
if (numRetries < maxNumRetries && isRetryableError(response, err))
{
// increment the number ... | javascript | {
"resource": ""
} |
q25051 | convertRawDate | train | function convertRawDate(rawColumnValue, column, context)
{
return new SfTimestamp(
Number(rawColumnValue) * 86400, // convert to seconds
0, // no nano seconds
0, // no scale required
'UTC', // use utc as the tim... | javascript | {
"resource": ""
} |
q25052 | convertRawTime | train | function convertRawTime(rawColumnValue, column, context)
{
var columnScale = column.getScale();
// the values might be big so use BigNumber to do arithmetic
var valFracSecsBig =
new BigNumber(rawColumnValue).times(Math.pow(10, columnScale));
return convertRawTimestampHelper(
valFracSecsBig,
... | javascript | {
"resource": ""
} |
q25053 | convertRawTimestampLtz | train | function convertRawTimestampLtz(rawColumnValue, column, context)
{
var columnScale = column.getScale();
// the values might be big so use BigNumber to do arithmetic
var valFracSecsBig =
new BigNumber(rawColumnValue).times(Math.pow(10, columnScale));
// create a new snowflake date
return convertRawTime... | javascript | {
"resource": ""
} |
q25054 | convertRawTimestampTz | train | function convertRawTimestampTz(rawColumnValue, column, context)
{
var valFracSecsBig;
var valFracSecsWithTzBig;
var timezoneBig;
var timezone;
var timestampAndTZIndex;
// compute the scale factor
var columnScale = column.getScale();
var scaleFactor = Math.pow(10, columnScale);
var resultVersion = co... | javascript | {
"resource": ""
} |
q25055 | convertRawVariant | train | function convertRawVariant(rawColumnValue, column, context)
{
var ret;
// if the input is a non-empty string, convert it to a json object
if (Util.string.isNotNullOrEmpty(rawColumnValue))
{
try
{
ret = eval("(" + rawColumnValue + ")");
}
catch (parseError)
{
// TODO: log the err... | javascript | {
"resource": ""
} |
q25056 | convertRawBinary | train | function convertRawBinary(rawColumnValue, column, context)
{
// Ensure the format is valid.
var format = context.format.toUpperCase();
Errors.assertInternal(format === "HEX" || format === "BASE64");
// Decode hex string sent by GS.
var buffer = Buffer.from(rawColumnValue, "HEX");
if (format === "HEX")
{... | javascript | {
"resource": ""
} |
q25057 | extractFromRow | train | function extractFromRow(row, context, asString)
{
var map = row._arrayProcessedColumns;
var values = row.values;
// get the value
var columnIndex = this.getIndex();
var ret = values[columnIndex];
// if we want the value as a string, and the column is of type variant, and we
// haven't already process... | javascript | {
"resource": ""
} |
q25058 | Result | train | function Result(options)
{
var data;
var chunkHeaders;
var parametersMap;
var parametersArray;
var length;
var index;
var parameter;
var mapColumnNameToIndices;
var columns;
var column;
// assert that options is a valid object that contains a response, statement,
// services and connection conf... | javascript | {
"resource": ""
} |
q25059 | createSessionState | train | function createSessionState(responseData)
{
var currentRole = responseData.finalRoleName;
var currentWarehouse = responseData.finalWarehouseName;
var currentDatabaseProvider = responseData.databaseProvider;
var currentDatabase = responseData.finalDatabaseName;
var currentSchema ... | javascript | {
"resource": ""
} |
q25060 | createChunks | train | function createChunks(chunkCfgs,
rowset,
columns,
mapColumnNameToIndices,
chunkHeaders,
statementParameters,
resultVersion,
statement,
services)... | javascript | {
"resource": ""
} |
q25061 | train | function(chunk)
{
// get all the rows in the current chunk that overlap with the requested
// window
var chunkStart = chunk.getStartIndex();
var chunkEnd = chunk.getEndIndex();
var rows = chunk.getRows().slice(
Math.max(chunkStart, start) - chunkStart,
Math.min(chunkEnd, en... | javascript | {
"resource": ""
} | |
q25062 | train | function()
{
// get the start position and start time
var startIndex = rowIndex;
var startTime = Date.now();
var each = options.each;
while (rowIndex < rowsLength)
{
// invoke the each() callback on the current row
var ret = each(rows[rowIndex++]);
cont... | javascript | {
"resource": ""
} | |
q25063 | findOverlappingChunks | train | function findOverlappingChunks(chunks, windowStart, windowEnd)
{
var overlappingChunks = [];
if (chunks.length !== 0)
{
// get the index of the first chunk that overlaps with the specified window
var index = findFirstOverlappingChunk(chunks, windowStart, windowEnd);
// iterate over the chunks starti... | javascript | {
"resource": ""
} |
q25064 | findFirstOverlappingChunk | train | function findFirstOverlappingChunk(chunks, windowStartIndex, windowEndIndex)
{
var helper = function(chunks,
chunkIndexLeft,
chunkIndexRight,
windowStartIndex,
windowEndIndex)
{
var result;
var chunkIndexMiddle;
... | javascript | {
"resource": ""
} |
q25065 | train | function(state, transitionContext)
{
// this check is necessary to make sure we don't re-enter a transient state
// like Renewing when we're already in it
if (currentState !== state)
{
// if we have a current state, exit it; the null check is necessary
// because the currentState is undefi... | javascript | {
"resource": ""
} | |
q25066 | sendHttpRequest | train | function sendHttpRequest(requestOptions, httpClient)
{
return httpClient.request(
{
method : requestOptions.method,
headers : requestOptions.headers,
url : requestOptions.absoluteUrl,
gzip : requestOptions.gzip,
json : requestOptions.json,
callback : functio... | javascript | {
"resource": ""
} |
q25067 | buildLoginUrl | train | function buildLoginUrl(connectionConfig)
{
var queryParams =
[
{ name: 'warehouse', value: connectionConfig.getWarehouse() },
{ name: 'databaseName', value: connectionConfig.getDatabase() },
{ name: 'schemaName', value: connectionConfig.getSchema() },
{ name: 'roleName', value: connectionCo... | javascript | {
"resource": ""
} |
q25068 | HttpClient | train | function HttpClient(connectionConfig)
{
// save the connection config
this._connectionConfig = connectionConfig;
// check that we have a valid request module
var requestModule = this.getRequestModule();
Errors.assertInternal(
Util.isObject(requestModule) || Util.isFunction(requestModule));
} | javascript | {
"resource": ""
} |
q25069 | normalizeHeaders | train | function normalizeHeaders(headers)
{
var ret = headers;
if (Util.isObject(headers))
{
ret = {};
// shallow copy the headers object and convert some headers like 'Accept'
// and 'Content-Type' to lower case while copying; this is necessary
// because the browser-request module, which we use to ma... | javascript | {
"resource": ""
} |
q25070 | normalizeResponse | train | function normalizeResponse(response)
{
// if the response doesn't already have a getResponseHeader() method, add one
if (response && !response.getResponseHeader)
{
response.getResponseHeader = function(header)
{
return response.headers && response.headers[
Util.isString(header) ? heade... | javascript | {
"resource": ""
} |
q25071 | init | train | function init()
{
// the stream has now been initialized
initialized = true;
// if we have a result
if (context.result)
{
// if no value was specified for the start index or if the specified start
// index is negative, default to 0, otherwise truncate the fractional part
start =... | javascript | {
"resource": ""
} |
q25072 | processRowBuffer | train | function processRowBuffer()
{
// get the row to add to the read queue
var row = rowBuffer[rowIndex++];
// if we just read the last row in the row buffer, clear the row buffer and
// reset the row index so that we load the next chunk in the result stream
// when _read() is called
if (rowIndex ... | javascript | {
"resource": ""
} |
q25073 | onResultStreamData | train | function onResultStreamData(chunk)
{
// unsubscribe from the result stream's 'data' and 'close' events
resultStream.removeListener('data', onResultStreamData);
resultStream.removeListener('close', onResultStreamClose);
// get all the rows in the chunk that overlap with the requested window,
// an... | javascript | {
"resource": ""
} |
q25074 | onResultStreamClose | train | function onResultStreamClose(err, continueCallback)
{
// if the error is retryable and
// the result stream hasn't been closed too many times
if (isResultStreamErrorRetryable(err) &&
(numResultStreamInterrupts <
context.connectionConfig.getResultStreamInterrupts()))
{
numResultSt... | javascript | {
"resource": ""
} |
q25075 | train | function(err)
{
// if we have a result stream, stop listening to events on it
if (resultStream)
{
resultStream.removeListener('data', onResultStreamData);
resultStream.removeListener('close', onResultStreamClose);
}
// we're done, so time to clean up
rowBuffer = null;
rowIndex... | javascript | {
"resource": ""
} | |
q25076 | readNextRow | train | function readNextRow()
{
// if we have a row buffer, process it
if (rowBuffer)
{
processRowBuffer();
}
else
{
// subscribe to the result stream's 'data' and 'close' events
resultStream.on('data', onResultStreamData);
resultStream.on('close', onResultStreamClose);
... | javascript | {
"resource": ""
} |
q25077 | isResultStreamErrorRetryable | train | function isResultStreamErrorRetryable(error)
{
return Errors.isLargeResultSetError(error) && error.response &&
(error.response.statusCode === 403);
} | javascript | {
"resource": ""
} |
q25078 | buildMapColumnExtractFnNames | train | function buildMapColumnExtractFnNames(columns, fetchAsString)
{
var fnNameGetColumnValue = 'getColumnValue';
var fnNameGetColumnValueAsString = 'getColumnValueAsString';
var index, length, column;
var mapColumnIdToExtractFnName = {};
// if no native types need to be retrieved as strings, extract values norm... | javascript | {
"resource": ""
} |
q25079 | externalizeRow | train | function externalizeRow(row, columns, mapColumnIdToExtractFnName)
{
var externalizedRow = {};
for (var index = 0, length = columns.length; index < length; index++)
{
var column = columns[index];
var extractFnName = mapColumnIdToExtractFnName[column.getId()];
externalizedRow[column.getName()] = row[ext... | javascript | {
"resource": ""
} |
q25080 | getSelection | train | function getSelection (field) {
if (typeof field !== 'object') {
throw new TypeError('The field must be an object.')
}
return {
start: field.selectionStart,
end: field.selectionEnd
}
} | javascript | {
"resource": ""
} |
q25081 | setSelectionRange | train | function setSelectionRange (selection = false, field) {
if (!selection) return null
if (typeof selection !== 'object') {
throw new TypeError('The selection must be an object.')
}
if (typeof selection.start !== 'number') {
throw new TypeError('The selection start value must be a number.')
}
if (ty... | javascript | {
"resource": ""
} |
q25082 | createChangeEvent | train | function createChangeEvent (selected, selection, markdown, native, html) {
if (typeof selected !== 'string') {
throw new TypeError('The selected content value must be a string.')
}
if (typeof selection !== 'object') {
throw new TypeError('The selection must be an object.')
}
if (typeof selection.sta... | javascript | {
"resource": ""
} |
q25083 | updateContent | train | function updateContent (content, selection, updated) {
if (typeof content !== 'string') {
throw new TypeError('The content value must be a string.')
}
if (typeof selection !== 'object') {
throw new TypeError('The selection must be an object.')
}
if (typeof selection.start !== 'number') {
throw n... | javascript | {
"resource": ""
} |
q25084 | getSelected | train | function getSelected (content, selection) {
if (typeof content !== 'string') {
throw new TypeError('The content must be a string.')
}
if (typeof selection !== 'object') {
throw new TypeError('The selection must be an object.')
}
if (typeof selection.start !== 'number') {
throw new TypeError('The... | javascript | {
"resource": ""
} |
q25085 | BaseButton | train | function BaseButton (props) {
return (
<button
{...props}
className={props.className}
onClick={props.onClick}
name={props.name}
disabled={props.disabled}
type='button'
children={props.children}
/>
)
} | javascript | {
"resource": ""
} |
q25086 | RequestCallbackHandler | train | function RequestCallbackHandler(callback, thisp) {
var self = this;
self.callback = callback;
self.thisp = thisp || self;
} | javascript | {
"resource": ""
} |
q25087 | StreamedRequestCallbackHandler | train | function StreamedRequestCallbackHandler(callback, thisp) {
var self = this;
self.callback = callback;
self.thisp = thisp || self;
} | javascript | {
"resource": ""
} |
q25088 | allocifyPoolFn | train | function allocifyPoolFn(fn, ResultCons) {
return allocFn;
function allocFn(arg1, arg2, arg3) {
return fn(new ResultCons(), arg1, arg2, arg3);
}
} | javascript | {
"resource": ""
} |
q25089 | descStats | train | function descStats(sample) {
var S = [].concat(sample);
S.sort(function sortOrder(a, b) {
return a - b;
});
var N = S.length;
var q1 = S[Math.floor(0.25 * N)];
var q2 = S[Math.floor(0.50 * N)];
var q3 = S[Math.floor(0.70 * N)];
var iqr = q3 - q1;
var tol = 3 * iqr / 2;
va... | javascript | {
"resource": ""
} |
q25090 | Parameter | train | function Parameter (opOrPathObject, definition, definitionFullyResolved, pathToDefinition) {
// Assign local properties
this.definition = definition;
this.definitionFullyResolved = definitionFullyResolved;
this.pathToDefinition = pathToDefinition;
this.ptr = JsonRefs.pathToPtr(pathToDefinition);
if (_.has(... | javascript | {
"resource": ""
} |
q25091 | validateStructure | train | function validateStructure (apiDefinition) {
var results = helpers.validateAgainstSchema(helpers.getJSONSchemaValidator(),
swaggerSchema,
apiDefinition.definitionFullyResolved);
// Make complex JSON Schema validation errors... | javascript | {
"resource": ""
} |
q25092 | ApiDefinition | train | function ApiDefinition (definition, definitionRemotesResolved, definitionFullyResolved, references, options) {
var that = this;
debug('Creating ApiDefinition from %s',
_.isString(options.definition) ? options.definition : 'the provided OpenAPI definition');
// Assign this so other object can use it
th... | javascript | {
"resource": ""
} |
q25093 | Path | train | function Path (apiDefinition, path, definition, definitionFullyResolved, pathToDefinition) {
var basePathPrefix = apiDefinition.definitionFullyResolved.basePath || '/';
var that = this;
var sanitizedPath;
// TODO: We could/should refactor this to use the path module
// Remove trailing slash from the basePat... | javascript | {
"resource": ""
} |
q25094 | Response | train | function Response (operationObject, statusCode, definition, definitionFullyResolved, pathToDefinition) {
// Assign local properties
this.definition = definition;
this.definitionFullyResolved = definitionFullyResolved;
this.operationObject = operationObject;
this.pathToDefinition = pathToDefinition;
this.ptr... | javascript | {
"resource": ""
} |
q25095 | train | function({options}, succeed, skip) {
return each(options.if_exec).call((cmd, next) => {
this.log({
message: `Nikita \`if_exec\`: ${cmd}`,
level: 'DEBUG',
module: 'nikita/misc/conditions'
});
return this.system.execute({
cmd: cmd,
relax: true,
stderr_... | javascript | {
"resource": ""
} | |
q25096 | train | function({options}, succeed, skip) {
// Default to `options.target` if "true"
if (typeof options.if_exists === 'boolean' && options.target) {
options.if_exists = options.if_exists ? [options.target] : null;
}
return each(options.if_exists).call((if_exists, next) => {
return this.fs.exists({
... | javascript | {
"resource": ""
} | |
q25097 | train | function({options}, succeed, skip) {
// Default to `options.target` if "true"
if (typeof options.unless_exists === 'boolean' && options.target) {
options.unless_exists = options.unless_exists ? [options.target] : null;
}
return each(options.unless_exists).call((unless_exists, next) => {
retu... | javascript | {
"resource": ""
} | |
q25098 | train | function({options}, succeed, skip) {
var ssh;
// SSH connection
ssh = this.ssh(options.ssh);
return each(options.should_exist).call(function(should_exist, next) {
return fs.exists(ssh, should_exist, function(err, exists) {
if (exists) {
return next();
} else {
r... | javascript | {
"resource": ""
} | |
q25099 | train | function(content, undefinedOnly) {
var k, v;
for (k in content) {
v = content[k];
if (v && typeof v === 'object') {
content[k] = module.exports.clean(v, undefinedOnly);
continue;
}
if (typeof v === 'undefined') {
delete content[k];
}
if (!undefinedOnly... | javascript | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.