query stringlengths 9 34k | document stringlengths 8 5.39M | negatives listlengths 19 20 | metadata dict |
|---|---|---|---|
Calls drawScene2D() with the context as a parameter | drawCanvas2D(){
const canvas2d = this.refs.canvas2d;
const context2d = canvas2d.getContext('2d');
if(context2d != null && context2d != 'undefined') {
this.drawScene2D(context2d);
}
} | [
"drawScene2D(context2d) {\n context2d.clearRect(0, 0, context2d.canvas.width, context2d.canvas.height);\n this.drawAtoms2D(context2d);\n this.drawBonds2D(context2d);\n }",
"draw() {\n if (!this.ctx) return;\n this.ctx.clearRect(0, 0, this.ctx.canvas.width, this.ctx.canvas.height);\n this.onView... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Renders the create sprint button, checks to see how many stories are selected. Is not clickable if no stories are selected. | renderCreateSprint() {
if (this.state.selectedStories.length === 0) {
return (
<button
id="create-sprint"
type="button"
className="m-0 py-2 px-4 mt-1 mr-3 disabled"
data-toggle="tooltip"
data-placement="bottom"
title="Select 1 or more stories... | [
"createSprint() {\n if (this.state.selectedStories.length > 0) {\n let sprintNumber;\n if (this.props.currentUser.team.sprints.length === 0) {\n sprintNumber = 1;\n } else {\n sprintNumber =\n parseInt(\n this.props.currentUser.team.sprints[\n this.pr... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
A base class for procedural noise functions. Only used to define the class. Should never be instantiated. | function Noise() {} | [
"function SimplexNoise() {\n}",
"function ParametricNoise() \n{\n //parametrics, each parameter should be assigned the same number of elements\n this.xPeriod = [0];//mean width of noise\n this.yPeriod = [0];//mean height of noise\n \n this.amplitude = [0];//peak amplitude, where output peak to peak... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create a new Query object params kinds The Google Datastore entity types | function Query(kinds){
this.query = {
kinds: kinds,
order: [],
projection: []
};
this.setFilter = function(filter){
this.query.filter = {};
this.query.filter[filter.getFilterType()] = filter.getFilter();
};
this.addProjection = function(projection){
this.query.projection.push(project... | [
"ParseAndConstructQuery(query) {\n let limit = 50;\n // construct a query\n let gquery = this._dataStore.createQuery(this._kind);\n\n if ( query.filters ) {\n for (let i = 0; i < query.filters.length; ++i ) {\n let filter = query.filters[i];\n if ( filter && filter.prop && filter.val ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Change the locale to a new locale. The locale supplied must be in the list of supported locales defined in the runtime configuration object or no change is made. | static changeLocale(newLocale, newBundle) {
if (!newBundle) {
throw new Error('A bundle is required. Call your application bundle loader changeLocale() function instead.');
}
if (!Locale.isSupported(newLocale)) {
const logger = new Logger();
logger.warn('Inva... | [
"static changeLocale(newLocale) {\n\n try {\n // verify that locale is valid\n if (!Locale.isSupported(newLocale)) {\n const logger = new Logger();\n logger.warn('Invalid/unsupported change locale: ' + newLocale + '. Locale not changed.');\n } e... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Renders the AWS CloudFormation properties of an `AWS::KafkaConnect::Connector.KafkaClusterEncryptionInTransit` resource | function cfnConnectorKafkaClusterEncryptionInTransitPropertyToCloudFormation(properties) {
if (!cdk.canInspect(properties)) {
return properties;
}
CfnConnector_KafkaClusterEncryptionInTransitPropertyValidator(properties).assertSuccess();
return {
EncryptionType: cdk.stringToCloudFormatio... | [
"function cfnConnectorKafkaClusterPropertyToCloudFormation(properties) {\n if (!cdk.canInspect(properties)) {\n return properties;\n }\n CfnConnector_KafkaClusterPropertyValidator(properties).assertSuccess();\n return {\n ApacheKafkaCluster: cfnConnectorApacheKafkaClusterPropertyToCloudFor... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This is the function that should be used to add (or set) the relation when the node is a generalization. | setRelation(relation) {
this.relations.length = 0; // avoid the issue originated by the referece sharing
this.relations.push(relation);
} | [
"defineRelation() {\n if (this.definition.type === relation_types_1.RelationTypes.one2one\n || this.definition.type === relation_types_1.RelationTypes.one2n) {\n this.relation = {};\n }\n else {\n this.relation = [];\n }\n }",
"addRelation(relation) ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
reducer to change all post states | function posts(state = [], action) {
const {id, timestamp, body, author, category, title, commentCount, deleted, voteScore, newTitle, newBody, parentId} = action;
switch (action.type) {
case ADD_POST:
return state.concat({
author: author,
body: body,
... | [
"function posts(state = [], action) { // at beginning, the store reducer state is an empty arr to pass it's first update action\n // console.log('The post will change');\n // console.log(state, action);\n // need a switch statement to call actions specifically for this reducer since all reducers run at the... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
CSStask, copys css files | function cssTask() {
return src(files.cssPath)
//conCat put the files togheter into a file with the name main.css
.pipe(conCat('main.css'))
.pipe(cssnano())
.pipe(dest('pub/css'));
} | [
"function copyCSS() {\n log(chalk.red.bold(\"---------------COPY CSS FILES INTO DIST---------------\"));\n return src([\"src/assets/css/*\"])\n .pipe(dest(\"dist/assets/css\"))\n .pipe(browserSync.stream());\n}",
"function copycssFile() {\n fs.copyFile(\"./src/style.css\", \"./dist/style.css\", (err) => ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
[END validate_template] [START add_new_condition] | function addNewCondition(template) {
template.conditions.push({
name: 'android_en',
expression: 'device.os == \'android\' && device.country in [\'us\', \'uk\']',
tagColor: 'BLUE',
});
} | [
"function addCondition(newCondition){\n\tif (newCondition == null)\n\t\tnewCondition = policyItem.createCondition(1);\n\n\t// Add the condition in the object\n\tpolicyItem.conditions.push(newCondition);\n\t\n\t// Redraw the policy rule\n\tdrawPolicyItem();\n}",
"function qb_addCondition(box){\n qb_checkCols++;\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Process a token when it's valid by setting some internal KC properties | function setTokenIfValid(kc, token) {
if (kc.tokenTimoutHandle) {
clearTimeout(kc.tokenTimoutHandle);
kc.tokenTimoutHandle = null;
}
if (!token || typeof token !== 'object') {
throw new RangeError('token missing');
}
[
['access_token', 'token'],
['refresh_token', 'ref... | [
"function processTokenCallback(kc, token) {\n if (kc.debug) {\n console.info('[SSI.KEYCLOAK] Processing Token');\n }\n try {\n setTokenIfValid(kc, token);\n } catch (e) {\n return kc.onAuthError(e);\n }\n return kc.onAuthSuccess();\n }",
"validateToken(token) {\n retur... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Checks a user and updates their gold | async function GainGold(userID, amount) {
await CheckUserExistence(userID);
let m = null;
try {
await client.query("BEGIN");
await client.query(`UPDATE ${userDb} SET gold = gold + $1 WHERE discord_id = $2`, [amount, userID]);
await client.query(SelectUser(userID))
.then(r => {
m = `Nic... | [
"function addGold(){\n user.gold += user.villagerCount * villager.goldPerSec;\n}",
"function setGold(loot) {\n let localStat;\n localStat = JSON.parse(localStorage.getItem(\"characterStat\"));\n let arrStat = Object.values(localStat);\n\n let baseGold = arrStat[5];\n let newBaseGold = parseInt(baseGold) + p... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function to set the images as radio buttons | function setImagesAsRadio(div, question) {
div.addClass('radio-images');
var buttons = div.find('label');
$.each(buttons, function (key, value) {
$(value).find('span').css('background-image', 'url(images/question' + question + '-' + (key + 1) + '.png)');
});
} | [
"function change_radio_bo() {\n document.getElementById('img_select').imageTypes[0].checked = true;\n}",
"function radio_selected(value) {\n if (value === 1) {\n filter_selected = 1;\n imgsrc.setAttribute(\"src\", \"/content/filters/img\"+value+\".png\");\n }\n else if (value === 2) {\n filter_select... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Save the uploaded image as the new image for this business. | function saveImageAndClose() {
var activeImage = scope.activeImage;
scope.fileSaving = true;
//save image to assigned object
if(!scope.editorNoPersist) {
activeImage.$save(
// Success
function() {
scope.fileSaving = fal... | [
"saveImage() {\n saveURL(\n this.imageInfo.currentSrc,\n null,\n \"SaveImageTitle\",\n false,\n null,\n null,\n null,\n document\n );\n }",
"function imageSave () {\n var file = dataURItoBlob(viewModel.imageState.cameraImage),\n uploader = new local... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Increment the value based on given step or default step value is 1 | __increment() {
const { step, max } = this.values;
const newValue = this.currentValue + step;
if (newValue <= max || max === Infinity) {
this.value = newValue;
this.__toggleSpinnerButtonsState();
}
} | [
"increment () {\n this.value = this._clampValue(this.value + this.step)\n }",
"increment() {\n if (this.step < this.steps.length) {\n this.step++;\n }\n }",
"_increment(numSteps) {\n this.value = this._clamp((this.value || 0) + this.step * numSteps, this.min, this.max);\n }",
"advanc... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Restore the element to a closed state | function cleanElement() {
element.removeClass('_md-active');
element.attr('aria-hidden', 'true');
element[0].style.display = 'none';
announceClosed(opts);
if (!opts.$destroy && opts.restoreFocus) {... | [
"_setClosedState () {\n this.toggleElement.setAttribute('aria-expanded', 'false')\n this.targetElement.setAttribute('hidden', '')\n\n this.isOpen = false\n }",
"function restoreOriginalState()\n\t\t{\n\t\t\t// discard the stalker and all its weird inline styles\n\t\t\tme.jElement.detach(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
CitationsHelperFrame method to refresh the screen. Should only work on LIST and ADD_CITATIONS modes (citationsHelperMode variable needs to be set) | function refreshCitationsHelper() {
if( this.mode == "LIST" ) {
// need to reload page instead of just count
window.location.assign( this.baseUrl + "&sakai_action=doList" );
} else {
// need to reload just the count
if( document.getElementById( "messageDiv" ) ) {
// need to have ?panel=null in... | [
"function refresh_screen(){\n getTraitsByPerson(curr_PID);\n\n getUserName(curr_PID);\n\n //update total trait count \n //\n getSummedVotesByPerson (curr_PID);\n}",
"function refreshMode() {\n\tif (activeMode === 'reviewer') {\n\t\t//Reviewer mode\n\t\t$('section .cgen').addClass('hidden');\n\t\t$('.send-rev... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Adds or removes femtoseconds. | addFemtoseconds(value, createNew) {
return this.addFractionsOfSecond(value, createNew, '_femtosecond', '_picosecond', 'addPicoseconds');
} | [
"addAttoseconds(value, createNew) {\n return this.addFractionsOfSecond(value, createNew, '_attosecond', '_femtosecond', 'addFemtoseconds');\n }",
"function addToTime(time, addSeconds) {\n\n}",
"addZeptoseconds(value, createNew) {\n return this.addFractionsOfSecond(value, createNew, '_zeptosecon... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
checking if to put bomb is ok | canBomb() {
//check not an over bomb
if (map.grounds[this.y][this.x].bomb) {
return;
}
else if (this.attributes.attribut.actuelBomb == this.attributes.attribut.maxBombs){
return;
}
else {
this.putBomb();
}
//... | [
"canBomb() {\n\n //check not an over bomb \n if (map.grounds[this.y][this.x].bomb) {\n return;\n }\n else if (this.attributes.attribut.actuelBomb == this.attributes.attribut.maxBombs){\n return;\n }\n else {\n this.putBomb();\n }\n\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Define a function for generating and loading field background sprite | function loadFieldBackgroundSprite(fieldBackground){
//console.log('canvasBattleField.loadFieldBackgroundSprite()', fieldBackground);
// Update the parent field object with the background change
thisGame.battleField.fieldBackground = fieldBackground;
// Generate a new sprite for the fi... | [
"function LoadBackgrounds() {\n var transform2D = null;\n var artist = null;\n\n transform2D = new Transform2D(\n Vector2.Zero,\n 0,\n Vector2.One,\n Vector2.Zero,\n new Vector2(cvs.clientWidth, cvs.clientHeight)\n );\n\n artist = new SpriteArtist(\n ctx,\n 1,\n backgroundSpriteSheet,\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Takes primary caps object and merges it into a secondary caps object. (see | function mergeCaps (primary = {}, secondary = {}) {
let result = Object.assign({}, primary);
for (let [name, value] of _.toPairs(secondary)) {
// Overwriting is not allowed. Primary and secondary must have different properties (w3c rule 4.4)
if (!_.isUndefined(primary[name])) {
throw new Error(`prope... | [
"function mergeCaps() {\n var primary = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];\n var secondary = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];\n\n var result = _Object$assign({}, primary);\n\n var _iteratorNormalCompletion = true;\n var _didIteratorE... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
checks if UserInput and Current Record are matched | function isMatch(record) {
const FIELDS = ["residence", "workplace", "start_time", "end_time"];
var userInput = {
residence: residenceEntry.value,
workplace: workplaceEntry.value,
start_time: start_timeEntry.value,
end_time: end_timeEntry.value,
};
//check each field for match
for (var j = 0;... | [
"function isMatch(record) {\n var userInput = {\n residence: residenceInput.value,\n workplace: workplaceInput.value,\n start_time: start_timeInput.value,\n end_time: end_timeInput.value,\n };\n\n //check each field for match\n for (var j = 0; j < FIELDS.length; j++) {\n const tableEntry = record... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Dynamically create the layouts for the search, gallery, and modal | function createHTMLLayout(data) {
createSearch();
personData = data.results;
createGallery(data.results,'');
} | [
"function build_layout(){\n\t\tvar append_to = document.querySelector(this.options.append_to),\n\t\t\telement = document.createElement('div');\n\n\t\tUtils.add_class(element,\"app-gallery\");\n\t\telement.innerHTML = \"<div id='gallery-loader'><i class='fa fa-spin fa-spinner'></i><br>loading images</div>\"\n\t\t\n\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Metoda pro test serialni korelace. | function testSerial() {
emptyBoxes();
testCommon();
$("#serialBox").append("<h3>Seriální koeficient korelace</h3>");
$("#serialBox").append("$H_0: \\rho_k = 0$<br/>");
$("#serialBox").append("$H_1: \\rho_k \\neq 0$ <br/><br/>");
// SERIALNI KORELACE
$("#serialBox").append("<table class='tab... | [
"function Serial() {}",
"async function star_serial_communication() {\n //lee todos los puertos del sistema\n const ports = await serial_port.list()\n var i = 0;\n //imprime los puertos con dispositivos disponibles\n ports.forEach((port, i) => {\n if (port.manufacturer != undefined) {\n console.log(i... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
change the year format for API call | function transformYear(year) {
if (year < 10) {
year = "190" + year;
} else if (year > 10 && year < 100) {
year = "19" + year;
} else {
year = "20" + year[1] + year[2];
}
return year;
} | [
"set yearFormat(value) {\n this._yearFormat = value;\n this.initYearFormatter();\n }",
"function convertYear(year) {\n year += \"\";\n\n return year.length < 4 ? \"200\" + year : year;\n }",
"function transformYear(year) {\n if (year < 10) {\n year = \"190\" + year;\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function(s) creates player 1 & 2////WORKING function(s) populates the main 3 divs of the page with stats and end result of battle////WORKING | function populateBattlePageP1() {
$('#playerHp').html(`<div id="stat__name"><h1>${player1.name}</h1></div>
<div class="stat__font" id="stat__class"><span>Your Position is <strong>${player1.gameName}</strong></span></div>
<div class="stat__font" id="stat__health"><span>You Have <strong>${player1.life}</s... | [
"function createPlayers(player1, player2){\r\n var NewGame = new tennis_game(player1, player2);\r\n NewGame.playSets();\r\n NewGame.CalcWinner();\r\n \r\n}",
"function gameScreen(snapshot){\n $(\".godCont\").empty();\n $(\"body\").css(\"background-image\", \"URL('SBRPS/NepalPictures/NepalA.jpg'... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function: deleteRemote remove remote data, then clear local diff. Fires: error | function deleteRemote(path, local, remote) {
logger.info('DELETE', path, 'LOCAL -> REMOTE');
return remoteAdapter.
remove(path).
then(function() {
store.clearDiff(path);
});
} | [
"function deleteRemote(path, local, remote) {\n logger.info('DELETE', path, 'LOCAL -> REMOTE');\n wireClient.remove(\n path,\n makeErrorCatcher(path, util.curry(store.clearDiff, path, undefined))\n );\n }",
"async function deleteRemote ({\n core = 'default',\n dir,\n gitdir = join(dir, '.gi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
============================================================================================== Sprite_Battle_Cut_In This sprite is used to display cut in images in battle. ============================================================================================== | function Sprite_Battle_Cut_In() { this.initialize.apply(this, arguments); } | [
"cut() {\n this._isCut = true;\n this._copy();\n this.update();\n }",
"function performCut() {\n if (curPrevMark && (curPrevMark.e === \"i\" || curPrevMark.e === \"n\")) {\n // We're cutting *out*\n eliminateMark(\"o\", fastForwarding);\n insertMark(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Checks if a provided type can be treated as a Reference | function isReferenceType(type) {
return ['Reference', 'CodeableReference'].includes(type);
} | [
"function isReferenceType(type) {\n return (type.flags & TypeFlags.Reference) > 0;\n}",
"function isReference(schema) {\n var refd_type;\n // simple reference\n if ((refd_type = schema.options.ref)) return refd_type;\n // array of references\n if ((refd_type = schema.options.type && schema.optio... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Insert la liste des circuits dans le DOM | function buildListeCircuits() {
$('#liste-circuits li').remove();
$.each(circuits, function(id, circuit) {
var li =
'<li id="circuit' + circuit.id + '" class="circuit">' +
'<a data-transition="slide" href="map.html?circuit=' + circuit.id + '" >' +
'<h2>' + circuit.nom + '</h2>' +
'<img src="' + ... | [
"function listerCircuit(listeCircuits){\n\tconsole.log(listeCircuits);\n\tvar nbrDeCircuits = listeCircuits.length;\n\tvar cardCircuit=\"\";\n\tvar conditionLister=' WHERE idCircuit =';\n\tdocument.getElementById('listeTousCircuit').innerHTML=\"\";\n\tfor(var ligne=0; ligne<nbrDeCircuits; ++ligne)\n\t{\n\t\t$idCirc... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Generates id for new record which starts with _generated. | generateId() {
if (!this.constructor.generatedIdIndex) this.constructor.generatedIdIndex = 0;
return '_generated' + this.$name + ++this.constructor.generatedIdIndex;
} | [
"function createNewRecordId() {\n\t\treturn Math.floor((Math.random()*9999)+1);\n\t}",
"generateId() { return this._get_uid() }",
"genId() {\n return \"id\" + (Math.random()+\"\").substring(2);\n }",
"generateId() {\n return cuid();\n }",
"generateId() {\n return `INV-${this.guid(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns whether the given |nickname| is both valid and available on the server. | async isValidAvailableNickname(nickname) {
if (!/^[0-9a-z\[\]\(\)\$@\._=]{1,24}$/i.test(nickname))
return false; // invalid nickname
// Verify that there are no other players in-game with this nickname.
for (const player of server.playerManager) {
if (player.name.toLowe... | [
"function nicknameAvailable(nickname) {\n for (let i = 0; i < clients.length; i++) {\n if (clients[i].nickname.toLowerCase() === nickname.toLowerCase()) {\n return false;\n }\n }\n return true;\n }",
"function validateNicknameFields(nickname) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function to trasfor the array of users into an object to facilitate removing from the list. It assumes email addresses are unique amongst users and uses that email as the key to the newly generated object | transformArrayIntoObject(array){
var obj ={};
array.map((user, i) => {
obj[array[i].email] = array[i]
return 0
})
return obj
} | [
"function removeDuplicateAndAlreadyAttendingUsers(usernameOrEmailArray, eventid, callback)\n{\n var usernameEmailDictArray = [];\n //If we don't pass any usernames or emails in, just return empty arrays\n if (!usernameOrEmailArray || usernameOrEmailArray.length === 0){\n callback(usernameEmailDictArray);\n }... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
console.log(collapseString('apple')); //=> 'aple' console.log(collapseString('AAAaalviiiiin!!!')); //=> 'Aalvin!' console.log(collapseString('hello app academy')); //=> 'helo ap academy' | function collapseString(str) {
var result = ""
for (var i = 0; i < str.length; i += 1) {
var current_char = str[i];
var next_char = str[i + 1];
if (current_char !== next_char) {
result += current_char;
}
}
return result;
} | [
"function collapse(value) {\n\t return String(value).replace(/\\s+/g, ' ')\n\t}",
"function collapse(value) {\n return String(value).replace(/\\s+/g, ' ')\n}",
"function solution(str) { \n return str.replace(/([A-Z])/g, ' $1').trim()\n}",
"function abbreviate(string){\r\n\r\n const regex = /(\\w)+|\\W/g;... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets the listners for the "welcome" text inputs. | function setWelcomeInputListeners() {
for (let i = 0; i < welcomeInputs.length; i++) {
document
.getElementById(welcomeInputs[i] + "_text")
.addEventListener("input", function() {
updateStoreFromTextArea(welcomeInputs[i]);
if (
document.getElementById("first_name_text").valu... | [
"function set_welcome_click_listeners(){\n\t$(\"#gotoreg_login\").bind(\"click\", function () {\n\t\tgoto_reg();\n\t});\n\n\t$(\"#gotologin_reg\").bind(\"click\", function () {\n\t\tgoto_login();\n\t});\n}",
"addWelcomeListener(callback) {\n this.addListener( this.welcomeListeners, callback);\n }",
"setEven... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns an array of options. Each option has three fields: [ company(ContaplusCompany), checked(bool), label(string) ] And each company has a single year and code sorted by year (descending) | Options() {
console.debug(`ContaplusCompany::Options`)
let options = new Array()
for (let i = 0; i < this.years.length; i++) {
// Create a single-code Contaplus Company
let value = new ContaplusCompany({
name: this.name,
}).Push(this.years[i], ... | [
"async function getCompanyOptions(token, userType, userName) {\r\n const cps = await getCompanies(token, userType, userName)\r\n var companyOptions = []\r\n for (let i = 0; i < cps.length; i++) { \r\n companyOptions.push({\r\n value: cps[i],\r\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
to to the scoreboard page | function goToScore() {
fetch( '/scores', {
method:'GET',
})
.then( function( r ) {
window.location.href = r.url
});
return false;
} | [
"function viewScore() {\n window.location.href = \"score.html\";\n}",
"function displayHighscores() {\n window.location = \"highscores.html\";\n}",
"function getScore() {\n if (score > 6) {\n window.location.href = \"winindex.html\";\n } else {\n window.location.href = \"endindex.html\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
set icon of the snackbar | setIcon(i) {
this.icon = i;
} | [
"set icon(value) {\n this.setAttribute('icon', value);\n }",
"function icon(){}",
"set icon(aValue) {\n this._logger.debug(\"icon[set]\");\n this._icon = aValue;\n }",
"function setIcon(icon) {\n this.icon = icon;\n }",
"setIcon(i){this.icon=i}",
"setIcon(icon) {\r\n\t\tthis.iconURL = icon;... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Board creation function, creates a 3 by 3 board with each element named "cell" then adds an event listner for each cell to check for clicks | function createBoard(){
let boardCont = document.createElement('div');
for (i=0;i<9;i++){
let cell = document.createElement('div');
cell.classList.add('cell');
cell.id = `${i}`;
cell.addEventListener('click',function (event){
changeSymbol(event.target)
che... | [
"function createBoard(){ \r\n let index = 1;\r\n for(let r = 0; r < 3; r++){ // rows\r\n const newRow = gameBoard.insertRow(r);\r\n\r\n for(let c = 0; c < 3; c++){ // columns\r\n const newBox = newRow.insertCell(c)\r\n newBox.className = \"box\"+index; // specify class name... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Looks for a dev group with exactly the same memberIds as the passed in array of dev ids | function getDeveloperGroup(developerIds) {
//the developer group with all of the developers in it (if there is one)
var retVal = null;
//go through all of the dev groups
for(var devGroupId in allDeveloperGroups) {
if(allDeveloperGroups.hasOwnProperty(devGroupId)) {
//get an existing dev g... | [
"containsAllDevelopers(allDeveloperIds) {\n //whether the passed in dev ids match the member ids perfectly\n let retVal = false;\n\n //if there are exactly the same number of developer ids in the \n //parameter that are in the members collection, otherwise they \n //can be exactly... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
MUA_CreateOrUpdate ========= MUA_FillSelectTableSchool ============= PR20200917 | function MUA_FillSelectTableSchool() {
console.log("===== MUA_FillSelectTableSchool ===== ");
const data_rows = school_rows;
const tblBody_select = document.getElementById("id_MUA_tbody_select");
tblBody_select.innerText = null;
// --- loop through dictlist
let row_count = 0
... | [
"function MENVPR_FillTblSchool() {\n //console.log(\"===== MENVPR_FillTblSchool ===== \");\n //console.log(\" >>>>>>> mod_MENV_dict\", mod_MENV_dict)\n\n const tblBody = el_MENVPR_tblBody_school\n// --- reset tblBody available and selected\n tblBody.innerText = null;\n\n// --- loop thr... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
starts drag by transferring the id of the event target | startDrag(event) {
event.dataTransfer.setData("text", event.target.id);
} | [
"function dragStart(ev){\n // Add the target element's id to the data transfer object\n ev.dataTransfer.setData(\"text/plain\", ev.target.id);\n}",
"function dragStart(event) {\n event.dataTransfer.setData('itemId', this.id);\n }",
"startDrag(x, y) {}",
"function dragStart(eve) {\n id = eve.targe... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Class: Tale Used to provide access to passages. This is analogous to the TiddlyWiki class in the core TiddlyWiki code. Property: passages An associative array of objects in the story. The key for this array is the title of the passage. Constructor: Tale Initializes a new Tale object with the contents of the DOM element... | function Tale()
{
this.passages = {};
if (document.normalize)
document.normalize();
var store = $('storeArea').childNodes;
for (var i = 0; i < store.length; i++)
{
var el = store[i];
if (el.getAttribute && (title = el.getAttribute('tiddler')))
this.passages[title] = new Passage(title, el, i);
}... | [
"function Tale(instanceName) {\n\tif (DEBUG) { console.log(\"[Tale()]\"); }\n\n\tthis._title = \"\";\n\tthis._domId = \"\";\n\tthis.passages = {};\n\tthis.styles = [];\n\tthis.scripts = [];\n\tthis.widgets = [];\n\n\tvar nodes = document.getElementById(\"store-area\").childNodes;\n\n\tif (TWINE1) {\n\t\tcon... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Updates the pageInfo, number of pages and title of document | function updatePageInfo(){
$(".pageInfo").html(articleTitles[article]+" ("+pageNumber+" / "+parseInt(($("body").find("#article_"+article+":hidden").length)+1)+")");
if(parseInt(($("body").find("#article_"+article+":hidden").length)+1) > 2){
$(".status").stop(true, true).hide().css("width", (pageNumber/parseIn... | [
"function updateDocumentPageCount() {\r\n\t// Calculate and display the total pages that are not excluded.\r\n\tvar pageCounter = 0;\r\n\t// Loop through the pages.\r\n\tfor (i=0; i < objCase.pages.length; i++) {\r\n\t\tif (objCase.pages[i].subDocumentOrder == objPage.subDocumentOrder && objCase.pages[i].subDocumen... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets for entity to use table inheritance pattern. | function TableInheritance(options) {
return function (target) {
__1.getMetadataArgsStorage().inheritances.push({
target: target,
pattern: options && options.pattern ? options.pattern : "STI",
column: options && options.column ? typeof options.column === "string" ? { name:... | [
"set table(table) {\n \n // If a Table\n if (table.Table && table.Table.attributes) {\n \n // If this Entity already has a Table, throw an error\n if (this._table) {\n error(`This entity is already assigned a Table (${this._table.name})`)\n // Else if the Entity doesn't exist in ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
JobInformationen aus einem JobDiv auslesen | function getJobInfoFromDiv(divId, job) {
/*
job.name = $ES('h2', divId)[0].innerHTML;
job.image = $ES('h2', divId)[0].style.backgroundImage.match(/images\/jobs\/.*\.[a-z]{3}/i);
job.wages = parseInt($ES('.bar_perc', divId)[0].innerHTML);
job.experience = parseInt($ES('.bar_perc', divId)[1].innerHTML);
job.l... | [
"function getJobInfoFromDiv(divId, job) {\r\n\tjob.name = $ES('h2', divId)[0].innerHTML;\r\n\tjob.image = $ES('h2', divId)[0].style.backgroundImage.match(/images\\/jobs\\/.*\\.[a-z]{3}/i);\r\n\tjob.wages = parseInt($ES('.bar_perc', divId)[0].innerHTML);\r\n\tjob.experience = parseInt($ES('.bar_perc', divId)[1].inne... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function that check the correctness of data range | function dataRangeError(start,end){
let s=start.replace(":"," ");
let e=end.replace(":"," ");
s=Date.parse(s);
e=Date.parse(e);
if(e<s) // end date is before start date
return true;
return false;
} | [
"function validateRange(){\n\t\tvar outcome = (xmax > xmin);\n\t\tvalidate(inputXmax, outcome);\n\t\tvalidate(inputXmin, outcome);\n\t\treturn outcome;\n\t\t\n\t}",
"validateRange(value) {\n\t\tif (typeof(value) !== \"number\")\n\t\t\treturn false;\n\t\tif (this.valid === undefined || this.valid.range === undefin... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
applyTheme converts theme arrays to CSS texts and apply them to root | function applyTheme(curTheme) {
const root = document.getElementsByTagName('html')[0]
root.style.cssText = curTheme.join(';')
} | [
"function setupTheme() {\n var theme = interactive.theme;\n if (arrays.isArray(theme)) {\n // [\"a\", \"b\"] => \"lab-theme-a lab-theme-b\"\n theme = theme.map(function(el) {\n return 'lab-theme-' + el;\n }).join(' ');\n } else if (theme) {\n theme = 'lab-theme-' + theme;\n } ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates a Signature from the input "message" string and "privateKey" 64hex string. Input: 1) message: any string value 2) privateKey: privateKey of a Public Address that is in 64hex string format Output: A Signature JavaScript object that has the following two attributes: 1) r : 64Hex string of the Signature "r" attrib... | function createSignature(message, privateKey) {
let privateKeyPair = ec.keyFromPrivate(privateKey);
let signature = ec.sign(message, privateKeyPair);
// Sometimes the Hex string returned is LESS than the 64-Hex string that is expected. So, we need to pad with '0'.
let signature_r_string = signature.r.t... | [
"signMessage(message) {\n const messageBuffer = Buffer.isBuffer(message) ? message : Buffer.from(message);\n return Message(messageBuffer).sign(this.#privateKey);\n }",
"getSignature(msg) {\n console.log(\"creating signature, signing msg: \\n\" + JSON.stringify(msg))\n var privKey = localStor... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
change the text of a jQuery element with a sliding effect (velocity could be a number in ms, 'slow' or 'fast', effect1 and effect2 could be slide, fade, hide, show) | function updateTextWithEffect(jQueryElement, text, velocity, effect1, effect2, newClass)
{
if(jQueryElement.text() != text)
if(effect1 == 'fade')
jQueryElement.fadeOut(velocity, function(){
$(this).addClass(newClass);
if(effect2 == 'fade') $(this).text(text).fadeIn(velocity);
else if(effect2 == 'slide... | [
"function changeSlideText(slideToChange, slideText) {\r\n slideToChange.data.text = slideText;\r\n runUpdateTimer();\r\n}",
"function slideText(text, selector) {\n\t\tclearTimeout(mainGraphic.textSlidingTimer[selector]);\n\t\tif (mainGraphic.textSliding[selector] == true) {\n\t\t\tmainGraphic.textSlidingTim... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This one gets the jucy data from GitHub | function fetchGithubData(full_name) {
let gitHub = 'https://api.github.com/repos/' + full_name;
// actions.push();
fetch(gitHub)
.then(res => res.json())
.then(res => updateTable(res))
// Update the chart too!
.then(res => updateChart())
} | [
"function getGitHubData() {\n // \"https://api.github.com/users/Jurecki07\"\n // fetch or axios request using this url\n // populate them html with the correct data from github\n \n}",
"function getRepoData() {\n var repo = getRepoName();\n\n var repoUrl = scheme + \"//\" + hostname + \"/repos/... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
INPUT(S) Array, containing words (strings) of varying lengths Array will always be of length 3 or greater OUTPUT(S) Boolean, indicating whether EXACTLY ONE word in the input array differs in length from the rest REQUIREMENTS Implicit Vocabulary: "Word": Will the strings in the argument array contain nonalphabetic chara... | function findOddOneOut(wordArray) {
let lengths = [];
wordArray.forEach(word => {
lengths.push(word.length);
});
let hasOneDistinct = false;
let hasRestSame = false;
lengths.forEach(length => {
let numberOfInstances = lengths.filter(compareLength => compareLength === length).length;
if (numb... | [
"function isDistinctInterpretationForSame(sentence) {\n var mp = {};\n var res = sentence.every((word, index) => {\n var seens = findCloseIdenticals(mp, word);\n debuglog(\" investigating seens for \" + word.string + \" \" + JSON.stringify(seens, undefined, 2));\n for (var seen of seens) ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
An error function IN: currentChar is the offending character that can't be parsed OUT: log an error message | lexicalError(currentChar) {
log.error("[Scanner] character " + currentChar + " could not be parsed.");
} | [
"function badCharacterEndOfTransmission(context) {\n const charCode = 4;\n return {\n character({ chr, i }) {\n if (chr.charCodeAt(0) === charCode) {\n context.report({\n ruleId: badChars.get(charCode),\n message: \"Bad character - END OF ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Convert a PEMformatted RSA public key to a public key for use with this library. | function convertPublicKeyPEMToPublicKey(publicKeyPEM) {
return node_forge_1.pki.publicKeyFromPem(publicKeyPEM);
} | [
"function importPublicKey(pem) {\n // fetch the part of the PEM string between header and footer\n const pemHeader = \"-----BEGIN PUBLIC KEY-----\";\n const pemFooter = \"-----END PUBLIC KEY-----\";\n const pemContents = pem.substring(pemHeader.length, pem.length - pemFooter.length);\n // base64 deco... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Put the pedal up. Dampens sustained notes | pedalUp({ time = this.immediate() } = {}) {
if (this.loaded) {
const seconds = this.toSeconds(time);
if (this._pedal.isDown(seconds)) {
this._pedal.up(seconds);
// dampen each of the notes
this._sustainedNotes.forEach((t, note) => {
if (!this._heldNotes.has(note)) {
... | [
"sneeze() {\n if (this.isInfected) {\n this.sneezeTracker += 0.5;\n push();\n fill(50, 89, 100);\n ellipse(this.x, this.y, this.sneezeTracker);\n pop();\n text(\"ahemmm!!\", this.x + 10, this.y - 10);\n }\n //reset sneeze\n if (this.sneezeTracker >= this.sneezeBound) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Check if same PR already existed and skip if so This allows users to close an unwanted upgrade PR and not worry about seeing it raised again | async function checkForClosedPr() {
if (config.recreateClosed) {
logger.debug(`${depName}: Skipping closed PR check`);
return false;
}
logger.debug(`${depName}: Checking for closed PR`);
const prExisted = await api.checkForClosedPr(branchName, prTitle);
logger.debug(`Closed PR existed: $... | [
"function checkForClosedPr() {\n if (config.recreateClosed) {\n logger.debug(`${depName}: Skipping closed PR check`);\n return Promise.resolve();\n }\n logger.debug(`${depName}: Checking for closed PR`);\n return github.checkForClosedPr(branchName, prTitle).then((prExisted) => {\n logger.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This function resolves the retrieved model Rather than set this directly to proposalModel we do that in the guard In future we may move to using vuex store to save the model | function lookupProposal(params) {
return new Promise((resolve, reject) => {
let proposal = new Proposal({ PROPOSAL: params.prop })
proposal.fetch({
// If OK trigger next
success: function(model) {
console.log("Admin proposal model lookup OK")
reso... | [
"resolveModel() {\n\t\tif (_.isFunction(this.service.modelResolver)) {\n\t\t\tlet idParamName = this.service.$settings.idParamName || \"id\";\n\n\t\t\tlet id = this.params[idParamName];\n\n\t\t\tif (id != null) {\n\t\t\t\treturn this.service.modelResolver.call(this.service, this, id).then( (model) => {\n\t\t\t\t\tt... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
private static method stringToLongArray | function stringToLongArray(string, includeLength) {
var length = string.length;
var result = [];
for (var i = 0; i < length; i += 4) {
result[i >> 2] = string.charCodeAt(i) |
string.charCodeAt(i + 1) << 8 |
string.charCodeAt(i + 2) << 16 |... | [
"function stringToLongArray(string, includeLength) {\r\n var length = string.length;\r\n var result = [];\r\n for (var i = 0; i < length; i += 4) {\r\n result[i >> 2] = string.charCodeAt(i) |\r\n string.charCodeAt(i + 1) << 8 |\r\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Process an HTML file: Find all math elements, Loop through them, and make typeset calls for each math tag, If the MathML processes correctly, replace the math tag by the svg result. If this is the last one, do the callback with the complete page. | function processHTML(html,callback) {
var document = jsdom(html);
var math = document.getElementsByTagName("math");
var data = {math:, format:"MathML", svg:true; state:{}} | [
"async function tex2mathml(mathml) {\n const data = await fs.readFile(FILENAME);\n const dom = (new JSDOM(data, {\n url: INPUT_URL\n }));\n // console.log(dom.serialize());\n const elements = dom.window.document.querySelectorAll(\".math\");\n if (mathml.length === elements.length) {\n for (let index = 0... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
swxmoUpdate this is the function called by our script in the browser to setup sammy. =========== callBefore this function is called before the page is updated. parameters : route, from, to if callBefore is null, then all incoming data is welded directly to the page otherwise, if there's no templates named (ie. it's pur... | function swxmoUpdate (callBefore, callBack){
$(window).hashchange(function(){
var servercall = location.hash;
while (servercall.charAt(0) == '#')
servercall = servercall.substr(1);
while (servercall.charAt(0) == '/')
servercall = servercall.substr(1);
swxmoAJAJ(servercall,
function(txdata){
var ... | [
"_update() {\n //console.log('Routed (' + this.namespace + ') ' + this._previousPath + ' => ' + this.currentPath);\n var match = RouteRegistry.resolve(this.namespace, this.currentPath);\n\n if (!match) {\n console.warn('No match for path ' + this.currentPath + ' - make sure you speci... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Fired when the element tree is about to be changed. Removes the tree from the view's rendering element if possible (and present). | onWillChangeElementTree()/*: void*/ {
if (this.elementTree && this.renderElement) {
removeTreeFromElement.call(this);
}
} | [
"function removeTreeFromElement()/*: void*/ {\n this.emitSync(\"willDetachFromParent\");\n this[_renderElement].removeChild(this.elementTree);\n this[_renderElement] = null;\n this[_attached] = false;\n this.emit(\"didDetachFromParent\");\n}",
"function removeTree() {\n $('#treemap-canvaswidget'... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Method to update freeGiftOf object of state; this object is for a mapping between a product and its child free gift. key is product ID, value is object corresponding to free gift child. Since the object has flags isfreeGift and freeGiftParentId and a free gift has to be displayed with its parent product. | mapFreeGift() {
const freeGiftItems = this.props.data.filter(obj => obj.isfreeGift);
if (!freeGiftItems.length) {
return;
}
const mapGiftToParent = {};
/* eslint-disable */
freeGiftItems.map(obj => (mapGiftToParent[obj.freeGiftParentId] = obj));
/* eslint-enable */
this.setState({ ... | [
"function updateShipping(shipping, free) {\n \n // retrieve the subtotal text and strip the $ sign from it. \n let subTotal = $('#subtotal').text().split('$')[1];\n let shippingCost = 0;\n \n // call the getFrames function to retrieve the frames valu... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Invokes a callback once the tooltip's CSS transition ends | function onTransitionEnd(duration, callback) {
var tooltip = instance.popperChildren.tooltip;
/**
* Listener added as the `transitionend` handler
*/
function listener(event) {
if (event.target === tooltip) {
updateTransitionEndListener(tooltip, 'remove', listener);
... | [
"function onTransitionEnd(duration, callback) {\n // Make callback synchronous if duration is 0\n if (duration === 0) {\n return callback();\n }\n\n var tooltip = tip.popperChildren.tooltip;\n\n\n var listener = function listener(e) {\n if (e.target === tooltip) {\n toggleTransitionE... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
COUNTRY CHANGE Function changes the display of state/province textbox or dropdown based on US address or not input of paxnNum input of AddrType (MAIL or BILL) | function countryChangeMailBill(paxNum, strAddrType)
{
if (strAddrType.toUpperCase() =='BILL')
{
if (
document.getElementById('selbillcountry' + paxNum).value != 'US'
&& document.getElementById('selbillcountry' + paxNum).value != ''
)
{
doc... | [
"function countryChange(paxNum) \n{ \n if (\n (document.getElementById('selbillcountry' + paxNum) && document.getElementById('selbillstate' + paxNum)) \n || \n (document.getElementById('txtbillcountry' + paxNum) && document.getElementById('txtbillstate' + paxNum))\n )\n {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Parse location search to find parameters in keys array and returns a function closure. | function parseSearchParameters(keys) {
var parameters = {}, params;
params = location.search.substr(1).split('&').sort();
$.each(keys, function(i,k){
var values = [];
for (var i = 0; i < params.length; i++) {
if (k == params[i].substr(0, k.length)) {
values.push(params[i].spli... | [
"function prepare(tokens, lookup) {\n var lookup = lookup || {};\n\n for (var i = 0, len = tokens.length; i < len; ++i) {\n (function(value) {\n lookup[value[0]] = (typeof value[1] === 'function') ? value[1] : function() {\n return {\n value: value[0],\n type: value[... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
instance() create a singleton instance of Publisher | static instance() {
const PublisherSingletonSymbol = Symbol.for('app.pi-weather-station.csv-publisher');
return Object.getOwnPropertySymbols(global).indexOf(PublisherSingletonSymbol) >= 0 ?
global[PublisherSingletonSymbol] : (global[PublisherSingletonSymbol] = new CsvPublisher());
} | [
"constructor() {\n if(!PubsubClass.instance) {\n this.subscriptions = {};\n PubsubClass.instance = this;\n }\n return PubsubClass.instance;\n }",
"static get instance () {\n if(!this[\"singleton\"]) {\n this[\"singleton\"] = n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Set a capability value, optionally formatting it. | async setValue(cap, value) {
if (value == null) return;
if (typeof value === 'number') {
value = formatValue(value);
}
if (this.getCapabilityValue(cap) !== value) {
await this.setCapabilityValue(cap, value).catch(e => {
this.log(`Unable to set capability '${ cap }': ${ e.message }`);... | [
"function setCapability(capability, value) {\n\n properties.capabilities[capability] = !!value;\n }",
"set capsLock(value) {}",
"function camliNewSetAttributeClaim(permanode, attribute, value, opts) {\n Camli.changeAttribute(permanode, \"set-attribute\", attribute, value, opts);\n}",
"function se... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Definition for the List controller. quizMetrics and dataService are two services that are created in js/factories/QuizFact.js,js/factories/DataService.js and filterFilter to filter the data. respectively. | function ListController(DataService,filterFilter,Quizfact){
var v=this;
v.show=show;
v.dataservice=DataService;
v.Quizfact=Quizfact; // Controllers reference to the Quiz data from factory
function show(index){
//simple function to show the quiz according to the choice of user
Quizfact.getbyi... | [
"function ListController(quizMetrics, DataService){\n var vm = this;\n\n /*\n * The interface for the controller. The below code shows all the\n * variables that are available from inside the view. References to\n * named functions are used instead of inline anon functions. Thi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
POST handlers SEARCH handler for twitter request | function postSearch(req,res) {
/**************************************************
* Spam protection
**************************************************/
if (!req.session || spamProtection(req.session,req.body.checkSum)) {
res.json({error:"You shall not spam !"});
console.log("Spam detected...");
return;
}
s... | [
"function postSearch() {\n T.get(\"search/tweets\", getParams, function(err, data, response) {\n if (data.statuses.length < 1) { //if no post matches, try again\n setTimeout(postSearch, 100);\n } else if (!avoidsUndesirableContent(data.statuses[0].text)) { //if post contains political wo... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
The total size of tracks in the queue including the current track. | get totalSize() {
return this.length + (this.current ? 1 : 0);
} | [
"function getMusicTracksSize() {\n updateMusicTracksSize(); //Update the track size\n return musicTracksSize;\n\n //updateMusicTracksSize() function - Updates the size variable that keeps track of the musicTracks array\n function updateMusicTracksSize() {\n musicTracksSize = m... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Main SOAP Gateway Function: loadScope Arguments: scope usable/loadable scope; xmlinput returned SOAP query values Function: Moves values from SOAP response to scope | function loadScope (scope,xmlinput) {
xmlDoc = $.parseXML(xmlinput);
var $xml=$(xmlDoc);
$xml.find( "AddressResults" ).each(function( index ) {
var newIndex = $(this).find("AddressId"); // Index value
var newResi = $(this).find("ResidentialStatus"); // Residential flag
var new... | [
"function ProcessSOAP (scope, keyvalues) {\n // Init Values and open Gateway\n var xmlhttp = new XMLHttpRequest();\n xmlhttp.open('POST', GATEWAY, true);\n\n // Request XML string\n var sr = BuildXML(scope, keyvalues);\n scope.fedexin = sr;\n scope.$apply();\n\n xmlhttp.onrea... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Helper function to create random latitude values | function randomLat() {
return randomNumber(90, -90);
} | [
"getRandomLat() {\n let lat = (Math.random() * (45.005419 - 42.730315) + 42.730315)\n return lat;\n}",
"function getRandomLat(){\n\t// limited range to avoid deserts\n\treturn(getRandomInRange(-55,70,4));\n}",
"function calcLat() {\n return (\n //returns a random number which is either positive or neg... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
The "replaceData(offset,count,arg)" method replaces the characters starting at the specified offset with the specified string. Test for replacement in the middle of the data. Retrieve the character data from the last child of the first employee. The "replaceData(offset,count,arg)" method is then called with offset=5 an... | function hc_characterdatareplacedatabegining() {
var success;
var doc;
var elementList;
var nameNode;
var child;
var childData;
doc = load("hc_staff");
elementList = doc.getElementsByTagName("acronym");
nameNode = elementList.item(0);
child = nameNode.firstChild;
... | [
"function hc_characterdatareplacedatamiddle() {\n var success;\n if(checkInitialization(builder, \"hc_characterdatareplacedatamiddle\") != null) return;\n var doc;\n var elementList;\n var nameNode;\n var child;\n var childData;\n \n var docRef = null;\n if (typeof(this.do... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Remove an eBook from the Catalog | removeEbook(eBook) {
this.books.delete(eBook)
} | [
"function removingBook(e) {\n\t// Remove book from UI\n\tUI.deleteBook(e.target);\n\n\t// Remove book from store\n\tStore.removeBook(e.target.parentElement.previousElementSibling.textContent);\n\n\t// Show success message\n\tUI.showAlert('Book Removed', 'success');\n}",
"function deleteBook(book){\n remove... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Tests to see if the given edge is within the bounds of the given rectangle. | function _isEdgeInBounds(rect, bounds, edge) {
var adjustedRectValue = _getRelativeRectEdgeValue(edge, rect);
return adjustedRectValue > _getRelativeRectEdgeValue(edge, bounds);
} | [
"function rectContainsRect(rcOuter, rcInner) {\n var contains = false;\n if (rcInner.left >= rcOuter.left) {\n if (rcInner.right <= rcOuter.right) {\n if (rcInner.top >= rcOuter.top) {\n if (rcInner.bottom <= rcOuter.bottom) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
nlNL validation function (Burgerservicenummer (BSN) or Rechtspersonen Samenwerkingsverbanden Informatie Nummer (RSIN), persons/entities respectively) Verify TIN validity by calculating check (last) digit (variant of MOD 11) | function nlNlCheck(tin) {
return algorithms.reverseMultiplyAndSum(tin.split('').slice(0, 8).map(function(a) {
return parseInt(a, 10);
}), 9) % 11 === parseInt(tin[8], 10);
} | [
"function nlNlCheck(tin) {\n return reverseMultiplyAndSum(tin.split('').slice(0, 8).map(function (a) {\n return parseInt(a, 10);\n }), 9) % 11 === parseInt(tin[8], 10);\n}",
"function qfs_isInternationalBankAccountNumber(inputObj) {\t\n\n\t// Het is een geldige IBAN als aan de volgende voorwaarden is voldaan... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
changeConditionOperator add new trigger for restore Trigger | addNewRestoreTrigger(triggerObj,id){
/*******delete from selector list *****/
RuleAction.deleteTrigger(this.props.secName,this.props.rulePosition,this.props.condition,id);
/************add the new trigger********************************/
RuleAction.addTrigger(this.props.secName,this.props.rulePosition,this.props.co... | [
"function handleConditionOperatorChange( ev ) {\n\t\t\tvar $el = $( ev.currentTarget );\n\t\t\tvar val = $el.val();\n\t\t\tvar $row = $el.closest('div.cond-container');\n\t\t\tvar cond = getConditionIndex()[ $row.attr( 'id' ) ];\n\n\t\t\tcond.operator = val;\n\t\t\tsetUpConditionOpFields( $row, cond );\n\t\t\tconfi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates nodes for the pivot array. This is where all machines such as break, swap, partition and concatonate work on. | function createNodeForPivotArray(newNodeValue) {
nodeID = "node" + numberOfNodes.toString() + "_pivot";
node_html_main_div = '<div name="node" onclick="selectNode(\'' + nodeID + '\')" class="w-16 text-2xl py-4 my-2 mx-2 text-center bg-green-200 border-solid border-2 border-green-400" id="' + nodeID + '">';
node_html... | [
"pivot(val){\n let pivotNode = new Node(val);\n\n let currentNode = this.head;\n\n if (!currentNode){\n return;\n }\n let arr = []\n while (currentNode && currentNode.val<val){\n arr.push(currentNode.val);\n this.head = this.head.next;\n }\n if (this.length===1 && currentNode.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
A worker which calculate the crc32 of the data flowing through. | function Crc32Probe() {
GenericWorker_1.call(this, "Crc32Probe");
this.withStreamInfo("crc32", 0);
} | [
"function Crc32Probe(){GenericWorker.call(this,\"Crc32Probe\");this.withStreamInfo(\"crc32\",0)}",
"function Crc32Probe(){GenericWorker.call(this,\"Crc32Probe\");this.withStreamInfo(\"crc32\",0);}",
"function Crc32Probe(){GenericWorker_1.call(this,\"Crc32Probe\");this.withStreamInfo(\"crc32\",0);}",
"function... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates the member options in the dropdown | function createMemberRow(member) {
var listOption = $("<option>");
listOption.attr("value", member.id);
listOption.text(member.name);
return listOption;
} | [
"function renderMemberDropdown() {\r\n let member = getLocalStorage(\"member\");\r\n let group = getLocalStorage(\"group\");\r\n\r\n memberDropdown.innerHTML = \"\";\r\n for (var i = 0; i < group.length; i++) {\r\n memberDropdown.innerHTML += `<option>${group[i].name}</option>`;\r\n }\r\n f... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Correlates a enum value for profile with code value | function getProfileEnumFromCodeValue(enumValue){
if (enumValue == "PERFIL_ABOGADO"){
return 1;
}
else if (enumValue == "PERFIL_PROCURADOR"){
return 2;
}
else if (enumValue == "PERFIL_CIUDADANIA"){
return 3;
}
else if (enumValue == "PERFIL_GRADUADO"){
return 4;
}
else if (enumValue == "P... | [
"function getLastBloodDonationEnumFromCodeValue(enumValue){\r\n\tif (enumValue == \"NEVER\"){\r\n\t\treturn -1;\r\n\t}\r\n\telse if (enumValue == \"LESS_THAN_3_YEARS\"){\r\n\t\treturn 1;\r\n\t}\r\n\telse if (enumValue == \"MORE_THAN_3_YEARS\"){\r\n\t\treturn 2;\r\n\t}\r\n\telse return \"\";\r\n}",
"function mapCo... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
count number of countries owned | function countCountries() {
return this.player.countries.length;
} | [
"function getCountryCount(id){\r\n\tif(typeof internship_data.countries[id] == 'undefined'){\r\n\t\treturn 0;\r\n\t}\r\n\treturn internship_data.countries[id].length;\r\n}",
"function countCountries(dataset) {\n\n var i = 1;\n for (elem in dataset) {\n if(dataset[elem].INDEX !== -999.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Trigger undo by simulating a keypress. | function undo() {
// Triggering native shortcut no longer seems to be working, so instead
// clicking the undo button. The main downside of this is that it only
// works if the undo button is visible.
//
// todoistShortcut({key: 'z'});
withUnique(document, '[role=alert]', (alertContainer) => {
... | [
"function undo_event() {\n\t\t\t\t$(\"#p4_undo\").on('click', function(e){\n\t\t\t\t\tif (last_position != null) {\n\t\t\t\t\t\tanimate(last_position.color, last_position, last_position.axe_y, \"-\");\n\t\t\t\t\t\tlast_position.color = \"white\";\n\t\t\t\t\t\tallowed_play = true;\n\t\t\t\t\t\tlast_position = null;\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Replace this with drawServerInfo soon. The new function will include player count/server name, but will look more like Diep.io's bottomright corner text. | function drawPlayerCount() {
let players = Object.keys(Player.list).length
let plural = Object.keys(Player.list).length == 1 ? '' : 's';
drawText({
text: `${Object.keys(Player.list).length} player${plural} on this server`,
x: width - 190,
y: height - 50,
font: 'bold 30px Ubuntu'
});
} | [
"function displayInfo() {\n\tctx.fillStyle = '#FFFFFF';\n\tctx.font = '16px Times New Roman';\n\tfor (var i = 0; i < lives; i++) {\n\t\tctx.drawImage(player.ship, 800 + (i*20), 90, 15, 20);\n\t\tctx.fillText(\"Lives: \", 750, 100);\n\t}\n\tctx.fillText(\"Level: \" + level, 750, 130);\n\tctx.fillText(\"Score: \" + s... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Removes a Request html element from the DOM. | function removeRequestElement(id) {
let ElmID = "request-" + id;
let requestElm = document.getElementById(ElmID);
if (requestElm != null) {
requestElm.remove();
} else {
console.log("Element ${ElmID} does not exist");
}
} | [
"remove() {\n for (var i = 0; i < this.htmlElements.length; i++) {\n this.htmlElements[i].parent.removeChild(this.htmlElements[i]);\n }\n this.htmlElements = [];\n }",
"function ajax_remove(_uri){\n new Ajax.Request(_uri, {\n method: 'get',\n });\n}",
"function deleteElementFromDom(e... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sprite_GaugeLMBS The sprite for displaying configurable guages. | function Sprite_GaugeLMBS() {
this.initialize.apply(this, arguments);
} | [
"function Gauge(container,signal,vmin,vmax,smin,smax,units)\r\n{\r\n\tvar Gauge_id = uniqueId(\"Gauge\");\r\n\tvar Gauge_Backplate = document.createElement(\"IMG\");\r\n\tGauge_Backplate.id = Gauge_id+\"_Backplate\";\r\n\tGauge_Backplate.className = \"Part Gauge\";\r\n\tGauge_Backplate.style.position = \"absolute\"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets All Paths in SVG. | function getAllPaths() {
let pathList = [];
let pathNodes = $("svg[id='svg']").find("path");
$.each(pathNodes, (key, Node) => {
pathList.push({
name: Node.getAttribute("id"),
data: Node.getAttribute("d")
});
});
return pathList;
} | [
"getSVGPath(svg) {\r\n return Array.from(svg.getSVGDocument().childNodes[0].querySelectorAll(\"path\"));\r\n }",
"function extractSVGPaths(svgDoc) {\r\n\r\n var ret = [];\r\n // rect, polygon should've been converted to <path> by SVGO at this point\r\n if (svgDoc.getElementsByTagName('rect').le... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
send copy of dispatcher on init | function init(p_Dispatcher) {
_myDispatcher = p_Dispatcher;
return this;
} | [
"dispatcher(){ return this.dispatch.bind(this); }",
"initEventDispatcher() {\n this.dispatcher = new Util.EventDispatcher();\n }",
"function Dispatcher() {\n this.callbacks = [];\n this.isPending = [];\n this.isHandled = [];\n this.pendingPayload = null;\n this.isDispatching = false;\n thi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
count chest==========count how many items in a chest | function countChest(chest, item) {
var result = 0;
var id;
var dt;
var ct;
for (var i = 0; i < 27; i++) {
id = Level.getChestSlot(chest[0], chest[1], chest[2], i);
dt = Level.getChestSlotData(chest[0], chest[1], chest[2], i);
if (id == item[0] && dt == item[1]) {
... | [
"function countChest(chest, item) {\r\n var result = 0;\r\n for (var i = 0; i < 27; i++) {\r\n var content;\r\n content = getChest(chest, i);\r\n if (content[0] == item[0]\r\n && content[1] == item[1]) {\r\n result = result + content[2]\r\n }\r\n };\r\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
gets the first guid for user on current socket id | function getFirstGuid(guid){
for (var i = 0; i < sessions.length; i++){
var sessionMembers = sessions[i].users;
for(var j = 0; j < sessionMembers.length; j++){
if(sessionMembers[j].guid == guid){
return sessionMembers[j].originalguid;
}
}
}
} | [
"function getUserFromId(socketId) {\n\tfor (var i = 0; i < users.length; i++) {\n\t\tvar user = users[i];\n\t\tif (user.id === socketId) {\n\t\t\treturn user.name;\n\t\t}\n\t}\n\treturn \"\";\n}",
"function getOwnSocketId(id){\n return userlist.filter((u) => { return u.userId === parseInt(id); })[0].socketid;\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns true when "obj" (Object) has all the properties "kv" (Object) has, and with exactly the same values, otherwise, false | function hasPropsAndVals(obj, kv) {
if (typeof (obj) !== 'object' || typeof (kv) !== 'object') {
return (false);
}
if (Object.keys(kv).length === 0) {
return (true);
}
return (Object.keys(kv).every(function (k) {
return (obj[k] && obj[k] === kv[k]);
}));
} | [
"function vaildateKeys(obj, expectedKeys) {\r\n\r\n //console.log(Object.entries(obj));\r\n //console.log(typeof expectedKeys);\r\n \r\n for (let i=0; i < expectedKeys.length; i++) {\r\n if(!obj.hasOwnProperty(expectedKeys[i])){\r\n \r\n return false;\r\n }\r\n }\r\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Extracts details from the given HTTP error response, and returns a humanreadable description. If the response is JSONformatted, looks up the error and error_description fields sent by the Google Auth servers. Otherwise returns the entire response payload as the error detail. | function getDetailFromResponse(response) {
if (response.isJson() && response.data.error) {
var json = response.data;
var detail = json.error;
if (json.error_description) {
detail += ' (' + json.error_description + ')';
}
return detail;
}
return response.te... | [
"static messageFromMaybeHttpError(error) {\n var _a, _b, _c, _d;\n // Try to nicely form an error if the error is the result of an HTTP request, fall back to\n // just printing the error otherwise.\n return ((_a = error.response) === null || _a === void 0 ? void 0 : _a.status) ? `${(_b =... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Toggles the selected picture | function toggleSelectedPicture() {
$("#selectedPicture").toggle();
$(".glass").toggle();
} | [
"toggle() {\n this.selected = !this.selected;\n }",
"function selectImage(e) {\n const imageOuter = e.target.closest(\".C4C__image__outer\");\n imageOuter.classList.toggle(\"active\");\n}",
"function toggleSelectImage(image, event)\n {\n\n\n if ( event )\n {\n\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
return the best enenmy with highest AOE | function pickBestEnemyAOE(radius){
var enemies = hero.findEnemies();
var bestScore = 0;
var bestEnemy = null;
var score = 0;
for (var i = 0; i < enemies.length; i +=1){
var centerEnemy = enemies[i];
for (var j = 0; j < enemies.length; j +=1){
var enemy = enemies[j];
... | [
"getBest() {\n var record = 0;\n let recordDNA = null;\n // gets the top scoring DNA in the population\n for (let dna of this.pop) {\n if (dna.fitness > record) {\n record = dna.fitness;\n recordDNA = dna;\n }\n }\n // if the fitness is a perfect value then the algorithm is... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
compares chosen letters against english alphabet, determines remaining letters, which will eventually be sent to child AvailableTile via props consider moving this function to child | determineAvailableLetters(){
let alphabet_string = 'abcdefghijklmnopqrstuvwxyz'
let alphabet_array = alphabet_string.toUpperCase().split('')
let available_letters = []
if(this.props.chosen_letters.length > 0){
for(let i = 0; i < alphabet_array.length; i++){
if(!this.props.chosen_letters.i... | [
"function letterCheck() {\n unknown.forEach((x, i) => {\n if (guess.localeCompare(unknown[i], \"en\", { sensitivity: \"base\" }) == 0) {\n underscores[i] = unknown[i];\n }\n document.getElementById(\"mysteryWord\").innerHTML = underscores.join(\"\");\n });\n}",
"function checkLetter(letter) {\n /... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Assemble protocol details section for a comparison row. | function assembleProtocolDetails(leftProtocol, rightProtocol){
// Get separator character from the javascript of the generated HTML page (since it may be i18n'd).
var separator = getSeparator();
if (leftProtocol == rightProtocol || rightProtocol.length == 0) {
// Return the left sid... | [
"function generateCompareRowHTMLContents(leftProtocol, rightProtocol, leftDetails, rightDetails) {\n var HTML = \"\"; \n HTML += '<div class=\"protocol\">';\n HTML += /**/'<div class=\"protocolText\">';\n HTML += /****/assembleProtocolDetails(leftProtocol,rightProtocol);\n HTML +... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
sum all riders that board at an origin station that's on a specific line | function sumBoard (line, origin) {
var ridersCount = line.reduce(function(sum, x) {
if (x.origin == origin) {
return sum + x.riders;
}
return sum;
}, 1);
return ridersCount;
} | [
"function find_closest(){\n stations.forEach(calcDist);\n curr_line();\n}",
"function riders(stations) {\n let distance = 1;\n let rider = 0;\n for (let station of stations)\n if (rider + station > 100)\n [distance, rider] = [distance + 1, station];\n else rider += station;\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Checks whether there exists any arguments. | existAnyArguments() {
const {supportingSituation, supportingActionGoal, notSupportingSituation, notSupportingActionGoal} = this.state;
return (
(supportingSituation !== undefined && supportingSituation.length > 0) ||
(supportingActionGoal !== undefined && supportingActionGoal.len... | [
"hasArguments() {\n return Object.keys(this.arguments).length > 0;\n }",
"function hasArguments(command) {\n return !!(command.Arguments);\n}",
"hasArgument(name) {\n let args = is_int(name) ? Object.values(this.arguments) : this.arguments;\n return isset(args[name]);\n }",
"containsArgumentsUsa... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function takes category array as input and outputs single node containing category buttons as child nodes | function drawCategories(catArr) {
//create container node to attach to main element
var flexContainer = document.createElement('div');
flexContainer.className = 'home-flex-container';
//create each category button by looping through category array
catArr.forEach(function(item) {
//create button element an... | [
"function addCategoryButtons() {\n const filteredCategoriesNamesOnly = filteredCategoriesArray();\n filteredCategoriesNamesOnly.forEach(drinkObj => {\n const categoryBtnTemplateClone = categoryBtnTemplate.cloneNode(true);\n categoryBtnTemplateClone.querySelector(\"button\").textContent = drinkObj;\n docu... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Validate orders Delivery state field | function ordersDeliveryStateValid(dst_str) {
var result = true;
if (isEmpty(dst_str))
{
alert("Please enter a delivery state for the order.");
return false;
}
if (!isAlphaName(dst_str))
{
alert("Please enter valid alphabetics for state name. You entered " + dst_str);
return false;
}
return result;
} | [
"function ordersDeliveryNoValid(dn_str) {\n\tvar result = true;\n\tif (isEmpty(dn_str))\n\t{\n\t\talert(\"Please enter a delivery address number for the order.\");\n\t\treturn false;\n\t}\n\tif (!isNumericStreetNum(dn_str) || dn_str == \"/\")\n\t{\n\t\talert(\"Please enter either 'unit / street number', or 'street ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |