_id stringlengths 2 6 | title stringlengths 0 58 | partition stringclasses 3
values | text stringlengths 52 373k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q62400 | selectBestInvalidOverloadIndex | test | function selectBestInvalidOverloadIndex(candidates, argumentCount) {
var maxParamsSignatureIndex = -1;
var maxParams = -1;
for (var i = 0; i < candidates.length; i++) {
var candidate = candidates[i];
if (candidate.hasRestParameter |... | javascript | {
"resource": ""
} |
q62401 | getTokenAtPositionWorker | test | function getTokenAtPositionWorker(sourceFile, position, allowPositionInLeadingTrivia, includeItemAtEndPosition) {
var current = sourceFile;
outer: while (true) {
if (isToken(current)) {
// exit early
return current;
}
// find the child ... | javascript | {
"resource": ""
} |
q62402 | findTokenOnLeftOfPosition | test | function findTokenOnLeftOfPosition(file, position) {
// Ideally, getTokenAtPosition should return a token. However, it is currently
// broken, so we do a check to make sure the result was indeed a token.
var tokenAtPosition = getTokenAtPosition(file, position);
if (isToken(tokenAtPositio... | javascript | {
"resource": ""
} |
q62403 | getJsDocTagAtPosition | test | function getJsDocTagAtPosition(sourceFile, position) {
var node = ts.getTokenAtPosition(sourceFile, position);
if (isToken(node)) {
switch (node.kind) {
case 102 /* VarKeyword */:
case 108 /* LetKeyword */:
case 74 /* ConstKeyword */:
... | javascript | {
"resource": ""
} |
q62404 | stripQuotes | test | function stripQuotes(name) {
var length = name.length;
if (length >= 2 &&
name.charCodeAt(0) === name.charCodeAt(length - 1) &&
(name.charCodeAt(0) === 34 /* doubleQuote */ || name.charCodeAt(0) === 39 /* singleQuote */)) {
return name.substring(1, length - 1);
... | javascript | {
"resource": ""
} |
q62405 | fixTokenKind | test | function fixTokenKind(tokenInfo, container) {
if (ts.isToken(container) && tokenInfo.token.kind !== container.kind) {
tokenInfo.token.kind = container.kind;
}
return tokenInfo;
} | javascript | {
"resource": ""
} |
q62406 | isListElement | test | function isListElement(parent, node) {
switch (parent.kind) {
case 214 /* ClassDeclaration */:
case 215 /* InterfaceDeclaration */:
return ts.rangeContainsRange(parent.members, node);
case 218 /* ModuleDeclaration */:
va... | javascript | {
"resource": ""
} |
q62407 | findEnclosingNode | test | function findEnclosingNode(range, sourceFile) {
return find(sourceFile);
function find(n) {
var candidate = ts.forEachChild(n, function (c) { return ts.startEndContainsRange(c.getStart(sourceFile), c.end, range) && c; });
if (candidate) {
var r... | javascript | {
"resource": ""
} |
q62408 | prepareRangeContainsErrorFunction | test | function prepareRangeContainsErrorFunction(errors, originalRange) {
if (!errors.length) {
return rangeHasNoErrors;
}
// pick only errors that fall in range
var sorted = errors
.filter(function (d) { return ts.rangeOverlapsWithStartEnd(origi... | javascript | {
"resource": ""
} |
q62409 | isInsideComment | test | function isInsideComment(sourceFile, token, position) {
// The position has to be: 1. in the leading trivia (before token.getStart()), and 2. within a comment
return position <= token.getStart(sourceFile) &&
(isInsideCommentRange(ts.getTrailingCommentRanges(sourceFile.text, token.getFullStar... | javascript | {
"resource": ""
} |
q62410 | getSemanticDiagnostics | test | function getSemanticDiagnostics(fileName) {
synchronizeHostData();
var targetSourceFile = getValidSourceFile(fileName);
// For JavaScript files, we don't want to report the normal typescript semantic errors.
// Instead, we just report errors for using TypeScript-only cons... | javascript | {
"resource": ""
} |
q62411 | getCompletionEntryDisplayName | test | function getCompletionEntryDisplayName(name, target, performCharacterChecks) {
if (!name) {
return undefined;
}
name = ts.stripQuotes(name);
if (!name) {
return undefined;
}
// If the user entered name for the symbol... | javascript | {
"resource": ""
} |
q62412 | getScopeNode | test | function getScopeNode(initialToken, position, sourceFile) {
var scope = initialToken;
while (scope && !ts.positionBelongsToNode(scope, position, sourceFile)) {
scope = scope.parent;
}
return scope;
} | javascript | {
"resource": ""
} |
q62413 | tryGetObjectLikeCompletionSymbols | test | function tryGetObjectLikeCompletionSymbols(objectLikeContainer) {
// We're looking up possible property names from contextual/inferred/declared type.
isMemberCompletion = true;
var typeForObject;
var existingMembers;
if (objectLikeContainer... | javascript | {
"resource": ""
} |
q62414 | tryGetImportOrExportClauseCompletionSymbols | test | function tryGetImportOrExportClauseCompletionSymbols(namedImportsOrExports) {
var declarationKind = namedImportsOrExports.kind === 225 /* NamedImports */ ?
222 /* ImportDeclaration */ :
228 /* ExportDeclaration */;
var importOrExportDeclaration = t... | javascript | {
"resource": ""
} |
q62415 | tryGetObjectLikeCompletionContainer | test | function tryGetObjectLikeCompletionContainer(contextToken) {
if (contextToken) {
switch (contextToken.kind) {
case 15 /* OpenBraceToken */: // let x = { |
case 24 /* CommaToken */:
var parent_10 = contextToke... | javascript | {
"resource": ""
} |
q62416 | filterJsxAttributes | test | function filterJsxAttributes(symbols, attributes) {
var seenNames = {};
for (var _i = 0; _i < attributes.length; _i++) {
var attr = attributes[_i];
// If this is the current item we are editing right now, do not filter it out
if... | javascript | {
"resource": ""
} |
q62417 | isWriteAccess | test | function isWriteAccess(node) {
if (node.kind === 69 /* Identifier */ && ts.isDeclarationName(node)) {
return true;
}
var parent = node.parent;
if (parent) {
if (parent.kind === 180 /* PostfixUnaryExpression */ || parent.kind === 179 /* Pref... | javascript | {
"resource": ""
} |
q62418 | getSignatureHelpItems | test | function getSignatureHelpItems(fileName, position) {
synchronizeHostData();
var sourceFile = getValidSourceFile(fileName);
return ts.SignatureHelp.getSignatureHelpItems(program, sourceFile, position, cancellationToken);
} | javascript | {
"resource": ""
} |
q62419 | hasValueSideModule | test | function hasValueSideModule(symbol) {
return ts.forEach(symbol.declarations, function (declaration) {
return declaration.kind === 218 /* ModuleDeclaration */ &&
ts.getModuleInstanceState(declaration) === 1 /* Instantiated */;
})... | javascript | {
"resource": ""
} |
q62420 | classifyTokenType | test | function classifyTokenType(tokenKind, token) {
if (ts.isKeyword(tokenKind)) {
return 3 /* keyword */;
}
// Special case < and > If they appear in a generic context they are punctuation,
// not operators.
if (tokenKind =... | javascript | {
"resource": ""
} |
q62421 | getParametersFromRightHandSideOfAssignment | test | function getParametersFromRightHandSideOfAssignment(rightHandSide) {
while (rightHandSide.kind === 172 /* ParenthesizedExpression */) {
rightHandSide = rightHandSide.expression;
}
switch (rightHandSide.kind) {
case 173 /* FunctionExpression */:
... | javascript | {
"resource": ""
} |
q62422 | score | test | function score(backend, errorBasis) {
if (typeof errorBasis !== "number" && !errorBasis)
errorBasis = Date.now();
const timeSinceError = (errorBasis - backend.lastError);
const statuses = backend.statuses;
const timeWeight = (backend.lastError === 0 && 0) ||
((timeSinceError < 1000) && 1... | javascript | {
"resource": ""
} |
q62423 | origin | test | async function origin(req, init) {
const url = new URL(req.url)
const status = parseInt(url.searchParams.get('status') || '200')
if (status === 200) {
return new Response(`hello from ${req.url} on ${new Date()}`)
} else {
return new Response(`an error! Number ${status}`, { status: status })
}
} | javascript | {
"resource": ""
} |
q62424 | test | function(element, transform, touch) {
//
// use translate both as basis for the new transform:
//
var t = $drag.TRANSLATE_BOTH(element, transform, touch);
//
// Add rotation:
//
var Dx = touch.distanceX;
var t0 = touch.startTrans... | javascript | {
"resource": ""
} | |
q62425 | test | function(t) {
var absAngle = abs(t.angle);
absAngle = absAngle >= 90 ? absAngle - 90 : absAngle;
var validDistance = t.total - t.distance <= TURNAROUND_MAX;
var validAngle = absAngle <= ANGLE_THRESHOLD || absAngle >= 90 - ANGLE_THRESHOLD;
var validVelocity = t.averageVelocity >=... | javascript | {
"resource": ""
} | |
q62426 | test | function(element, eventHandlers, options) {
options = angular.extend({}, defaultOptions, options || {});
return $touch.bind(element, eventHandlers, options);
} | javascript | {
"resource": ""
} | |
q62427 | test | function(type, c, t0, tl) {
// Compute values for new TouchInfo based on coordinates and previus touches.
// - c is coords of new touch
// - t0 is first touch: useful to compute duration and distance (how far pointer
// got from first touch)
// - tl is last touch: useful... | javascript | {
"resource": ""
} | |
q62428 | test | function(event) {
// don't handle multi-touch
if (event.touches && event.touches.length > 1) {
return;
}
tl = t0 = buildTouchInfo('touchstart', getCoordinates(event));
$movementTarget.on(moveEvents, onTouchMove);
$movementTarget.on(en... | javascript | {
"resource": ""
} | |
q62429 | test | function(e) {
e = e.length ? e[0] : e;
var tr = window
.getComputedStyle(e, null)
.getPropertyValue(transformProperty);
return tr;
} | javascript | {
"resource": ""
} | |
q62430 | test | function(elem, value) {
elem = elem.length ? elem[0] : elem;
elem.style[styleProperty] = value;
} | javascript | {
"resource": ""
} | |
q62431 | test | function(e, t) {
var str = (typeof t === 'string') ? t : this.toCss(t);
setElementTransformProperty(e, str);
} | javascript | {
"resource": ""
} | |
q62432 | test | function (_path) {
if (/^((pre|post)?loader)s?/ig.test(_path)) {
return _path.replace(/^((pre|post)?loader)s?/ig, 'module.$1s')
}
if (/^(plugin)s?/g.test(_path)) {
return _path.replace(/^(plugin)s?/g, '$1s')
}
return _path
} | javascript | {
"resource": ""
} | |
q62433 | getPayload | test | function getPayload(token) {
const payloadBase64 = token
.split(".")[1]
.replace("-", "+")
.replace("_", "/");
const payloadDecoded = base64.decode(payloadBase64);
const payloadObject = JSON.parse(payloadDecoded);
if (AV.isNumber(payloadObject.exp)) {
payloadObject.exp = new Date(payloadObject.... | javascript | {
"resource": ""
} |
q62434 | setChapterActive | test | function setChapterActive($chapter, hash) {
// No chapter and no hash means first chapter
if (!$chapter && !hash) {
$chapter = $chapters.first();
}
// If hash is provided, set as active chapter
if (!!hash) {
// Multiple chapters for this file
if ($chapters.length > 1) {
... | javascript | {
"resource": ""
} |
q62435 | getChapterHash | test | function getChapterHash($chapter) {
var $link = $chapter.children('a'),
hash = $link.attr('href').split('#')[1];
if (hash) hash = '#'+hash;
return (!!hash)? hash : '';
} | javascript | {
"resource": ""
} |
q62436 | handleScrolling | test | function handleScrolling() {
// Get current page scroll
var $scroller = getScroller(),
scrollTop = $scroller.scrollTop(),
scrollHeight = $scroller.prop('scrollHeight'),
clientHeight = $scroller.prop('clientHeight'),
nbChapters = $chapters.length,
$chapte... | javascript | {
"resource": ""
} |
q62437 | insertAt | test | function insertAt(parent, selector, index, element) {
var lastIndex = parent.children(selector).length;
if (index < 0) {
index = Math.max(0, lastIndex + 1 + index);
}
parent.append(element);
if (index < lastIndex) {
parent.children(selector).eq(index).before(parent.children(selector... | javascript | {
"resource": ""
} |
q62438 | createDropdownMenu | test | function createDropdownMenu(dropdown) {
var $menu = $('<div>', {
'class': 'dropdown-menu',
'html': '<div class="dropdown-caret"><span class="caret-outer"></span><span class="caret-inner"></span></div>'
});
if (typeof dropdown == 'string') {
$menu.append(dropdown);
} else {
... | javascript | {
"resource": ""
} |
q62439 | createButton | test | function createButton(opts) {
opts = $.extend({
// Aria label for the button
label: '',
// Icon to show
icon: '',
// Inner text
text: '',
// Right or left position
position: 'left',
// Other class name to add to the button
className... | javascript | {
"resource": ""
} |
q62440 | removeButton | test | function removeButton(id) {
buttons = $.grep(buttons, function(button) {
return button.id != id;
});
updateAllButtons();
} | javascript | {
"resource": ""
} |
q62441 | removeButtons | test | function removeButtons(ids) {
buttons = $.grep(buttons, function(button) {
return ids.indexOf(button.id) == -1;
});
updateAllButtons();
} | javascript | {
"resource": ""
} |
q62442 | toggleSidebar | test | function toggleSidebar(_state, animation) {
if (gitbook.state != null && isOpen() == _state) return;
if (animation == null) animation = true;
gitbook.state.$book.toggleClass('without-animation', !animation);
gitbook.state.$book.toggleClass('with-summary', _state);
gitbook.storage.set('sidebar', is... | javascript | {
"resource": ""
} |
q62443 | filterSummary | test | function filterSummary(paths) {
var $summary = $('.book-summary');
$summary.find('li').each(function() {
var path = $(this).data('path');
var st = paths == null || paths.indexOf(path) !== -1;
$(this).toggle(st);
if (st) $(this).parents('li').show();
});
} | javascript | {
"resource": ""
} |
q62444 | init | test | function init() {
$(document).on('click', '.toggle-dropdown', toggleDropdown);
$(document).on('click', '.dropdown-menu', function(e){ e.stopPropagation(); });
$(document).on('click', closeDropdown);
} | javascript | {
"resource": ""
} |
q62445 | init | test | function init() {
// Next
bindShortcut(['right'], function(e) {
navigation.goNext();
});
// Prev
bindShortcut(['left'], function(e) {
navigation.goPrev();
});
// Toggle Summary
bindShortcut(['s'], function(e) {
sidebar.toggle();
});
} | javascript | {
"resource": ""
} |
q62446 | addDirective | test | function addDirective (type) {
return function (name, directive) {
if (typeof name === 'function') {
directive = name
}
if (typeof directive !== 'function') {
throw new TypeError('Directive must be a function')
}
name = typeof name === 'string'
? name
: directive.name
... | javascript | {
"resource": ""
} |
q62447 | Directive | test | function Directive (directive) {
Rule.call(this)
this.enabled = true
this.directive = directive
this.name = directive.$name || directive.name
} | javascript | {
"resource": ""
} |
q62448 | Toxy | test | function Toxy (opts) {
if (!(this instanceof Toxy)) return new Toxy(opts)
opts = Object.assign({}, Toxy.defaults, opts)
Proxy.call(this, opts)
this.routes = []
this._rules = midware()
this._inPoisons = midware()
this._outPoisons = midware()
setupMiddleware(this)
} | javascript | {
"resource": ""
} |
q62449 | getModifiedConfigModuleIndex | test | function getModifiedConfigModuleIndex(fileStr, snakedEnv, classedEnv) {
// TODO [sthzg] we might want to rewrite the AST-mods in this function using a walker.
const moduleFileAst = acorn.parse(fileStr, { module: true });
// if required env was already created, just return the original string
if (jp.paths(modu... | javascript | {
"resource": ""
} |
q62450 | test | function(path) {
const data = fs.readFileSync(path, 'utf8');
const ast = esprima.parse(data);
// List of css dialects we want to add postCSS for
// On regular css, we can add the loader to the end
// of the chain. If we have a preprocessor, we will add
// it before the initial loader
const... | javascript | {
"resource": ""
} | |
q62451 | Metadata | test | function Metadata (options, controlConnection) {
if (!options) {
throw new errors.ArgumentError('Options are not defined');
}
Object.defineProperty(this, 'options', { value: options, enumerable: false, writable: false});
Object.defineProperty(this, 'controlConnection', { value: controlConnection, enumerable... | javascript | {
"resource": ""
} |
q62452 | checkUdtTypes | test | function checkUdtTypes(type) {
if (type.code === types.dataTypes.udt) {
const udtName = type.info.split('.');
type.info = {
keyspace: udtName[0],
name: udtName[1]
};
if (!type.info.name) {
if (!keyspace) {
throw new TypeError('No keyspace specified for udt: ... | javascript | {
"resource": ""
} |
q62453 | PreparedQueries | test | function PreparedQueries(maxPrepared, logger) {
this.length = 0;
this._maxPrepared = maxPrepared;
this._mapByKey = {};
this._mapById = {};
this._logger = logger;
} | javascript | {
"resource": ""
} |
q62454 | DriverError | test | function DriverError (message) {
Error.call(this, message);
Error.captureStackTrace(this, this.constructor);
this.name = this.constructor.name;
this.info = 'Cassandra Driver Error';
// Explicitly set the message property as the Error.call() doesn't set the property on v8
this.message = message;
} | javascript | {
"resource": ""
} |
q62455 | NoHostAvailableError | test | function NoHostAvailableError(innerErrors, message) {
DriverError.call(this, message);
this.innerErrors = innerErrors;
this.info = 'Represents an error when a query cannot be performed because no host is available or could be reached by the driver.';
if (!message) {
this.message = 'All host(s) tried for que... | javascript | {
"resource": ""
} |
q62456 | BusyConnectionError | test | function BusyConnectionError(address, maxRequestsPerConnection, connectionLength) {
const message = util.format('All connections to host %s are busy, %d requests are in-flight on %s',
address, maxRequestsPerConnection, connectionLength === 1 ? 'a single connection': 'each connection');
DriverError.call(this, me... | javascript | {
"resource": ""
} |
q62457 | extend | test | function extend(baseOptions, userOptions) {
if (arguments.length === 1) {
userOptions = arguments[0];
baseOptions = {};
}
const options = utils.deepExtend(baseOptions, defaultOptions(), userOptions);
if (!util.isArray(options.contactPoints) || options.contactPoints.length === 0) {
throw new TypeErro... | javascript | {
"resource": ""
} |
q62458 | validatePoliciesOptions | test | function validatePoliciesOptions(policiesOptions) {
if (!policiesOptions) {
throw new TypeError('policies not defined in options');
}
if (!(policiesOptions.loadBalancing instanceof policies.loadBalancing.LoadBalancingPolicy)) {
throw new TypeError('Load balancing policy must be an instance of LoadBalancin... | javascript | {
"resource": ""
} |
q62459 | validateProtocolOptions | test | function validateProtocolOptions(protocolOptions) {
if (!protocolOptions) {
throw new TypeError('protocolOptions not defined in options');
}
const version = protocolOptions.maxVersion;
if (version && (typeof version !== 'number' || !types.protocolVersion.isSupported(version))) {
throw new TypeError(util... | javascript | {
"resource": ""
} |
q62460 | validateSocketOptions | test | function validateSocketOptions(socketOptions) {
if (!socketOptions) {
throw new TypeError('socketOptions not defined in options');
}
if (typeof socketOptions.readTimeout !== 'number') {
throw new TypeError('socketOptions.readTimeout must be a Number');
}
if (typeof socketOptions.coalescingThreshold !=... | javascript | {
"resource": ""
} |
q62461 | validateEncodingOptions | test | function validateEncodingOptions(encodingOptions) {
if (encodingOptions.map) {
const mapConstructor = encodingOptions.map;
if (typeof mapConstructor !== 'function' ||
typeof mapConstructor.prototype.forEach !== 'function' ||
typeof mapConstructor.prototype.set !== 'function') {
throw new Typ... | javascript | {
"resource": ""
} |
q62462 | setProtocolDependentDefaults | test | function setProtocolDependentDefaults(options, version) {
let coreConnectionsPerHost = coreConnectionsPerHostV3;
let maxRequestsPerConnection = maxRequestsPerConnectionV3;
if (!types.protocolVersion.uses2BytesStreamIds(version)) {
coreConnectionsPerHost = coreConnectionsPerHostV2;
maxRequestsPerConnection... | javascript | {
"resource": ""
} |
q62463 | test | function(name) {
name = name.toLowerCase();
if (name.indexOf('<') > 0) {
const listMatches = /^(list|set)<(.+)>$/.exec(name);
if (listMatches) {
return { code: this[listMatches[1]], info: this.getByName(listMatches[2])};
}
const mapMatches = /^(map)< *(.+) *, *(.+)>$/.exec(name);... | javascript | {
"resource": ""
} | |
q62464 | getDataTypeNameByCode | test | function getDataTypeNameByCode(item) {
if (!item || typeof item.code !== 'number') {
throw new errors.ArgumentError('Invalid signature type definition');
}
const typeName = _dataTypesByCode[item.code];
if (!typeName) {
throw new errors.ArgumentError(util.format('Type with code %d not found', item.code))... | javascript | {
"resource": ""
} |
q62465 | FrameHeader | test | function FrameHeader(version, flags, streamId, opcode, bodyLength) {
this.version = version;
this.flags = flags;
this.streamId = streamId;
this.opcode = opcode;
this.bodyLength = bodyLength;
} | javascript | {
"resource": ""
} |
q62466 | generateTimestamp | test | function generateTimestamp(date, microseconds) {
if (!date) {
date = new Date();
}
let longMicro = Long.ZERO;
if (typeof microseconds === 'number' && microseconds >= 0 && microseconds < 1000) {
longMicro = Long.fromInt(microseconds);
}
else {
if (_timestampTicks > 999) {
_timestampTicks = ... | javascript | {
"resource": ""
} |
q62467 | MutableLong | test | function MutableLong(b00, b16, b32, b48) {
// Use an array of uint16
this._arr = [ b00 & 0xffff, b16 & 0xffff, b32 & 0xffff, b48 & 0xffff ];
} | javascript | {
"resource": ""
} |
q62468 | Aggregate | test | function Aggregate() {
/**
* Name of the aggregate.
* @type {String}
*/
this.name = null;
/**
* Name of the keyspace where the aggregate is declared.
*/
this.keyspaceName = null;
/**
* Signature of the aggregate.
* @type {Array.<String>}
*/
this.signature = null;
/**
* List of t... | javascript | {
"resource": ""
} |
q62469 | Host | test | function Host(address, protocolVersion, options, metadata) {
events.EventEmitter.call(this);
/**
* Gets ip address and port number of the node separated by `:`.
* @type {String}
*/
this.address = address;
this.setDownAt = 0;
/**
* Gets the timestamp of the moment when the Host was marked as UP.
... | javascript | {
"resource": ""
} |
q62470 | ConstantSpeculativeExecutionPolicy | test | function ConstantSpeculativeExecutionPolicy(delay, maxSpeculativeExecutions) {
if (!(delay >= 0)) {
throw new errors.ArgumentError('delay must be a positive number or zero');
}
if (!(maxSpeculativeExecutions > 0)) {
throw new errors.ArgumentError('maxSpeculativeExecutions must be a positive number');
}
... | javascript | {
"resource": ""
} |
q62471 | MaterializedView | test | function MaterializedView(name) {
DataCollection.call(this, name);
/**
* Name of the table.
* @type {String}
*/
this.tableName = null;
/**
* View where clause.
* @type {String}
*/
this.whereClause = null;
/**
* Determines if all the table columns where are included in the view.
* @ty... | javascript | {
"resource": ""
} |
q62472 | DataCollection | test | function DataCollection(name) {
events.EventEmitter.call(this);
this.setMaxListeners(0);
//private
Object.defineProperty(this, 'loading', { value: false, enumerable: false, writable: true });
Object.defineProperty(this, 'loaded', { value: false, enumerable: false, writable: true });
/**
* Name of the obj... | javascript | {
"resource": ""
} |
q62473 | example | test | async function example() {
await client.connect();
await client.execute(`CREATE KEYSPACE IF NOT EXISTS examples
WITH replication = {'class': 'SimpleStrategy', 'replication_factor': '1' }`);
await client.execute(`USE examples`);
await client.execute(`CREATE TABLE IF NOT EXISTS tbl_sample_... | javascript | {
"resource": ""
} |
q62474 | TableMetadata | test | function TableMetadata(name) {
DataCollection.call(this, name);
/**
* Applies only to counter tables.
* When set to true, replicates writes to all affected replicas regardless of the consistency level specified by
* the client for a write request. For counter tables, this should always be set to true.
*... | javascript | {
"resource": ""
} |
q62475 | SchemaParserV1 | test | function SchemaParserV1(options, cc) {
SchemaParser.call(this, options, cc);
this.selectTable = _selectTableV1;
this.selectColumns = _selectColumnsV1;
this.selectUdt = _selectUdtV1;
this.selectAggregates = _selectAggregatesV1;
this.selectFunctions = _selectFunctionsV1;
} | javascript | {
"resource": ""
} |
q62476 | SchemaParserV2 | test | function SchemaParserV2(options, cc, udtResolver) {
SchemaParser.call(this, options, cc);
this.udtResolver = udtResolver;
this.selectTable = _selectTableV2;
this.selectColumns = _selectColumnsV2;
this.selectUdt = _selectUdtV2;
this.selectAggregates = _selectAggregatesV2;
this.selectFunctions = _selectFunc... | javascript | {
"resource": ""
} |
q62477 | SchemaParserV3 | test | function SchemaParserV3(options, cc, udtResolver) {
SchemaParserV2.call(this, options, cc, udtResolver);
this.supportsVirtual = true;
} | javascript | {
"resource": ""
} |
q62478 | getByVersion | test | function getByVersion(options, cc, udtResolver, version, currentInstance) {
let parserConstructor = SchemaParserV1;
if (version && version[0] === 3) {
parserConstructor = SchemaParserV2;
} else if (version && version[0] >= 4) {
parserConstructor = SchemaParserV3;
}
if (!currentInstance || !(currentIns... | javascript | {
"resource": ""
} |
q62479 | encodeRoutingKey | test | function encodeRoutingKey(fromUser) {
const encoder = self._getEncoder();
try {
if (fromUser) {
encoder.setRoutingKeyFromUser(params, execOptions);
} else {
encoder.setRoutingKeyFromMeta(meta, params, execOptions);
}
}
catch (err) {
return callback(err);
}
... | javascript | {
"resource": ""
} |
q62480 | getJsFiles | test | function getJsFiles(dir, fileArray) {
const files = fs.readdirSync(dir);
fileArray = fileArray || [];
files.forEach(function(file) {
if (file === 'node_modules') {
return;
}
if (fs.statSync(dir + file).isDirectory()) {
getJsFiles(dir + file + '/', fileArray);
return;
}
if (fi... | javascript | {
"resource": ""
} |
q62481 | SchemaFunction | test | function SchemaFunction() {
/**
* Name of the cql function.
* @type {String}
*/
this.name = null;
/**
* Name of the keyspace where the cql function is declared.
*/
this.keyspaceName = null;
/**
* Signature of the function.
* @type {Array.<String>}
*/
this.signature = null;
/**
*... | javascript | {
"resource": ""
} |
q62482 | copyBuffer | test | function copyBuffer(buf) {
const targetBuffer = allocBufferUnsafe(buf.length);
buf.copy(targetBuffer);
return targetBuffer;
} | javascript | {
"resource": ""
} |
q62483 | fixStack | test | function fixStack(stackTrace, error) {
if (stackTrace) {
error.stack += '\n (event loop)\n' + stackTrace.substr(stackTrace.indexOf("\n") + 1);
}
return error;
} | javascript | {
"resource": ""
} |
q62484 | log | test | function log(type, info, furtherInfo) {
if (!this.logEmitter) {
if (!this.options || !this.options.logEmitter) {
throw new Error('Log emitter not defined');
}
this.logEmitter = this.options.logEmitter;
}
this.logEmitter('log', type, this.constructor.name, info, furtherInfo || '');
} | javascript | {
"resource": ""
} |
q62485 | toLowerCaseProperties | test | function toLowerCaseProperties(obj) {
const keys = Object.keys(obj);
const result = {};
for (let i = 0; i < keys.length; i++) {
const k = keys[i];
result[k.toLowerCase()] = obj[k];
}
return result;
} | javascript | {
"resource": ""
} |
q62486 | deepExtend | test | function deepExtend(target) {
const sources = Array.prototype.slice.call(arguments, 1);
sources.forEach(function (source) {
for (const prop in source) {
if (!source.hasOwnProperty(prop)) {
continue;
}
const targetProp = target[prop];
const targetType = (typeof targetProp);
... | javascript | {
"resource": ""
} |
q62487 | arrayIterator | test | function arrayIterator (arr) {
let index = 0;
return { next : function () {
if (index >= arr.length) {
return {done: true};
}
return {value: arr[index++], done: false };
}};
} | javascript | {
"resource": ""
} |
q62488 | iteratorToArray | test | function iteratorToArray(iterator) {
const values = [];
let item = iterator.next();
while (!item.done) {
values.push(item.value);
item = iterator.next();
}
return values;
} | javascript | {
"resource": ""
} |
q62489 | binarySearch | test | function binarySearch(arr, key, compareFunc) {
let low = 0;
let high = arr.length-1;
while (low <= high) {
const mid = (low + high) >>> 1;
const midVal = arr[mid];
const cmp = compareFunc(midVal, key);
if (cmp < 0) {
low = mid + 1;
}
else if (cmp > 0) {
high = mid - 1;
}
... | javascript | {
"resource": ""
} |
q62490 | insertSorted | test | function insertSorted(arr, item, compareFunc) {
if (arr.length === 0) {
return arr.push(item);
}
let position = binarySearch(arr, item, compareFunc);
if (position < 0) {
position = ~position;
}
arr.splice(position, 0, item);
} | javascript | {
"resource": ""
} |
q62491 | validateFn | test | function validateFn(fn, name) {
if (typeof fn !== 'function') {
throw new errors.ArgumentError(util.format('%s is not a function', name || 'callback'));
}
return fn;
} | javascript | {
"resource": ""
} |
q62492 | stringRepeat | test | function stringRepeat(val, times) {
if (!times || times < 0) {
return null;
}
if (times === 1) {
return val;
}
return new Array(times + 1).join(val);
} | javascript | {
"resource": ""
} |
q62493 | promiseWrapper | test | function promiseWrapper(options, originalCallback, handler) {
if (typeof originalCallback === 'function') {
// Callback-based invocation
handler.call(this, originalCallback);
return undefined;
}
const factory = options.promiseFactory || defaultPromiseFactory;
const self = this;
return factory(func... | javascript | {
"resource": ""
} |
q62494 | WhiteListPolicy | test | function WhiteListPolicy (childPolicy, whiteList) {
if (!childPolicy) {
throw new Error("You must specify a child load balancing policy");
}
if (!util.isArray(whiteList)) {
throw new Error("You must provide the white list of host addresses");
}
this.childPolicy = childPolicy;
const map = {};
white... | javascript | {
"resource": ""
} |
q62495 | EventDebouncer | test | function EventDebouncer(delay, logger) {
this._delay = delay;
this._logger = logger;
this._queue = null;
this._timeout = null;
} | javascript | {
"resource": ""
} |
q62496 | FrameReader | test | function FrameReader(header, body, offset) {
this.header = header;
this.opcode = header.opcode;
this.offset = offset || 0;
this.buf = body;
} | javascript | {
"resource": ""
} |
q62497 | Connection | test | function Connection(endpoint, protocolVersion, options) {
events.EventEmitter.call(this);
this.setMaxListeners(0);
if (!options) {
throw new Error('options is not defined');
}
/**
* Gets the ip and port of the server endpoint.
* @type {String}
*/
this.endpoint = endpoint;
/**
* Gets the... | javascript | {
"resource": ""
} |
q62498 | getClockId | test | function getClockId(clockId) {
let buffer = clockId;
if (typeof clockId === 'string') {
buffer = utils.allocBufferFromString(clockId, 'ascii');
}
if (!(buffer instanceof Buffer)) {
//Generate
buffer = getRandomBytes(2);
}
else if (buffer.length !== 2) {
throw new Error('Clock identifier must... | javascript | {
"resource": ""
} |
q62499 | getNodeId | test | function getNodeId(nodeId) {
let buffer = nodeId;
if (typeof nodeId === 'string') {
buffer = utils.allocBufferFromString(nodeId, 'ascii');
}
if (!(buffer instanceof Buffer)) {
//Generate
buffer = getRandomBytes(6);
}
else if (buffer.length !== 6) {
throw new Error('Node identifier must have ... | javascript | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.