query stringlengths 9 34k | document stringlengths 8 5.39M | negatives listlengths 19 20 | metadata dict |
|---|---|---|---|
DELETE Invoice line This is done in order to present a jquery Alert modal popup | function doPermanentlyDeleteInvoiceLine(element){
//start
var record = element.id.split('@');
var heavd = record[0];
var heopd = record[1];
var fali = record[2];
heavd= heavd.replace("heavd_","");
heopd= heopd.replace("heopd_","");
fali= fali.replace("fali_","");
//Start dialog
jq('<di... | [
"function doPermanentlyDeleteInvoiceLine(element){\n\t //start\n\t var record = element.id.split('@');\n\t var heavd = record[0];\n\t var heopd = record[1];\n\t var fali = record[2];\n\t heavd= heavd.replace(\"heavd_\",\"\");\n\t heopd= heopd.replace(\"heopd_\",\"\");\n\t fali= fali.replace(\"fali_\",\"\");... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Check if option state value is included in the list of parentValueIds (if using option value ID for state) | function matchBySelectValueId(option, stateValue) {
return (
Array.isArray(option.parentValueIds) &&
option.parentValueIds.includes(stateValue)
)
} | [
"function matchBySelectValueName(option, parentOption, stateValue) {\n return (\n Array.isArray(option.parentValueIds) &&\n option.parentValueIds\n .map((id) => {\n const parentOptionValue = parentOption.values.find(\n (value) => value.id === id\n )\n return get(parentOptio... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Switches to the next protocol stage in the display set sequence | nextProtocolStage() {
log.trace('ProtocolEngine::nextProtocolStage');
if (!this.setCurrentProtocolStage(1)) {
log.trace('ProtocolEngine::nextProtocolStage failed');
}
} | [
"function nextStep() {\r\n switch (stage) {\r\n case \"Present Proposal\":\r\n stage = \"Q&A\";\r\n break;\r\n case \"Q&A\":\r\n stage = \"Conclusion\";\r\n break;\r\n case \"Conclusion\":\r\n stage = ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
When we receive candidates we need to handle them | async function handleCandidates (msg) {
var peer = peers.get(msg.from);
var pc = peer.conn;
var pid = msg.from;
await pc.addIceCandidate(msg.data);
document.getElementById('status').value = pc.signalingState
console.log('added candidate ', pc.signalingState);
} | [
"function processQueuedCandidates() {\n if (!queuedIceCandidates.length) {\n return;\n }\n\n console.log(`adding ${queuedIceCandidates.length} queued candidates to the peer connection`);\n\n let processedCandidatesCount = 0;\n while (queuedIceCandidates.length) {\n pc.addIceCandidate(queued... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Will open the comments window and assign the handle to the Comments Object. | function OpenComments(Date, Employee)
{
// var SSLLoc = (document.getElementById && !document.all) ? "javascript:''" : "/lawson/xhrnet/dot.htm";
var SSLLoc = "/lawson/xhrnet/ui/windowplain.htm?func=opener.CommentsLoaded()";
if (typeof(authUser.prodline) == "unknown")
{
authenticate("frameNm='jsreturn'|funcNm='O... | [
"function openComments(url) {\n\twindow.open(url, 'Comments', 'width=700,height=600,screenX=100,screenY=100,toolbar=0,resizable=1,scrollbars=1');\n}",
"function openComments(url) {\r\n\twindow.open(url, 'Comments', 'width=700,height=600,screenX=100,screenY=100,toolbar=0,resizable=1,scrollbars=1');\r\n}",
"funct... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function that replace toRep in str with warRep, only if toRep isen't escaped in str | function replaceIfNotEscaped(str,toRep,watRep){
for(var i=0; i<str.length; i++){
if(str[i] == toRep && str[i-1] != '\\'){
str = setCharAt(str,i,watRep);
i = i +(watRep.length-1);
}
}
return str;
} | [
"function strSugar (str, find, rep) {\n return str.replace(\n new RegExp('\\\\\\\\?(' + find + ')', 'g'),\n function (m, z) {\n return m == z ? rep(z) : z\n }\n )\n}",
"function horsify(str) {\n return str.replace(force_pattern, replacement_horse);\n}",
"function fixEscapeSequences(str) {\n re... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This function determines how much open space a bot can move in a particular direction without hitting a wall | async function distanceToWall(name, xMov, yMov, direction) {
var response;
// Get the other bot's position
if(name == "bob") {
response = await getRobotLocation("alice");
}
else {
response = await getRobotLocation("bob");
}
// Grab the X and Y of the other bot based on the currently active bot
var xV = r... | [
"updateDirection() {\n\t\tlet tolerance = this.TURN_SPEED;\n\t\tlet tempDir = this.direction;\n\t\tif (this.direction - this.goalDirection > 180) tempDir = this.direction - 360;\n\t\t// if direction is left of goalDirection by 180 or less\n\t\tif (tempDir < this.goalDirection) {\n\t\t\tthis.left = false;\n\t\t\tthi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
We'll also have a function that we can use to toggle the heat map. | function toggleHeatmap() {
heatmap.setMap(heatmap.getMap() ? null : map);
} | [
"function toggleHeatmap() \n{\n heatmap.setMap(heatmap.getMap() ? null : map);\n}",
"function toggleHeatmap() {\n heatmap.setMap(heatmap.getMap() ? null : map);\n}",
"function bixiToggleHeatmap() \n{\n bixiHeatmap.setMap(bixiHeatmap.getMap() ? null : bixiMap);\n}",
"function toggleHeatmap(locations)... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Removes the shipping method // TODO: returns ? | removeShipping() {
return null
} | [
"removeShipping() {\r\n\t\t\treturn null;\r\n\t\t}",
"clearEstimateShipping() {\r\n\t\t\treturn null;\r\n\t\t}",
"_clearRevokingShipIt() {\n this._$boxStatus.removeClass('revoking-ship-it');\n }",
"function selectShippingMethod() {\n var cart = app.getModel('Cart').get();\n var TransientAddres... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Track the provided listener. A persistent listener means it remains tracked even if the info window is closed. | trackListener(listener, persistent) {
this._listeners.push({ listener, persistent });
} | [
"trackListener(listener, persistent) {\n this._listeners.push({ listener, persistent });\n }",
"function onPreferencesSaved(listener) {\n emitter.on('preferencesSaved', listener)\n return function() {\n return emitter.off('preferencesSaved', listener)\n }\n}",
"addListener(listener) {\n addList... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets item object if it exists in a shop user's inventory | function getItemFromInventory(memberObj, itemName){
let shopUser = getShopUser(memberObj);
return shopUser.inventory.find(invItem => {
return invItem.Item === itemName;
})
} | [
"function userHasItem(user, item){\n for(var i=0;i<user.inventory.length;i++){\n if(user.inventory[i].equals(item._id)){\n return true\n }\n }\n return false;\n}",
"function getItemFromShop(itemName){\n return data.store.find(storeItem => {\n return storeItem.Item === i... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
init the page, fetch employee data and set up basic event listener | function initPage(){
const searchInput = document.getElementById("searchKeyWord");
const searchButton = document.getElementById("searchBt");
const closeButton = document.querySelector(".close");
fetchEmployee(12, "US");
document.addEventListener("keyup", switchProfileDetail);
searchInput.addEve... | [
"function init() {\n console.log(\"Initializing page...\");\n currentEmployer.name = \"IBM\";\n populateEmployerField(currentEmployer.name);\n}",
"function init() {\n console.log(\"init\");\n $(\".js-add-employees\").on(\"submit\", submitEmployeeInfo);\n $(\".js-table-body\").on(\"click\", \".js-btn-delete\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Handle error messages from the worker. | onWorkerMessageError(event) {
console.error('⚙️ Error message from InMemorySearch worker ⚙️', event);
} | [
"function error_from_worker(wid, e) {\n // TODO, actually handle the error\n console.log(\"Error from worker\", wid, e);\n}",
"function workerError(e){\n var id,worker;\n worker = e.target;\n if(worker.ready){\n if(worker.busy){\n if(worker.errorCallback !== un... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Clear the contents of the MappedDisposable. Disposables keyed to objects are not disposed of. | clear(){
if(this.disposed)
return;
this.disposables.clear();
} | [
"dispose() {\n // Already disposed?\n if (!Object.prototype.hasOwnProperty.call(this, '_map')) {\n return;\n }\n // Clear registry\n this.clear();\n // delete refs\n this._deleteReferences();\n }",
"function clearObjects() {\n setMapOnAll(null);\n}",
"clearAndClose() {\n this.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
para ejercicio 6 mostrar numeros mayores a 20 | function mayores20(input){
var numeros = input;
var mayores = [];
for(var i = 0; i < numeros.length; i++){
if( numeros[i] >= 20){
mayores.push(numeros[i]);
}
}
var resultado;
resultado = mayores;
return resultado;
} | [
"function numeros(){\n let datos = '';\n let mayor = 0;\n let suma = 0;\n let suma_txt = '';\n let producto = 1;\n let producto_txt = 1;\n let resta_adelante = 0;\n let resta_ad_txt = '';\n let resta_atras=0;\n let resta_at_txt = '';\n for (let i = 0; i < this.valores.length; i++) {... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Resizes the columns in the grid | resizeColumns(event) {
event.api.sizeColumnsToFit();
} | [
"function resize() {\r\n internal.grids.forEach(resetGrid);\r\n }",
"sizeToFit() {\n if (this.gridApi) this.gridApi.sizeColumnsToFit();\n }",
"function _resize() {\n // Remove widgets\n _cells.forEach(function (row) {\n row.forEach(function (cell) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
For rank_list inputs, label the check boxes in the order they were selected and store this value in a hidden field associated with each checkbox | function updateRank(data) {
var orderField = data.name.split('__')[0] + '_order';
var currentOrder = getCurrentOrder(orderField);
if(data.action === 'ifChecked') {
currentOrder.push(data.option);
} else {
currentOrder = currentOrder.filter(function(x) { return x != data.option });
}
$('input#' + o... | [
"function recalculate_list_order() {\n\t\t\n\t\tconsole.log('reordering');\n\t\t\n\t\tvar order = 1;\n\t\t\n\t\t$('.form-group').each(function() {\n\t\t\n\t\t\t$(this).find('input[name=listItemOrder]').val(order); order++;\n\t\t\t\n\t\t});\n\t\t\n\t}",
"function tallyCheckboxes(qnNumber){\n\t\n\t// update hidden ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Calculate percent for curAmount with rate as annual year rate and period in days noinspection JSUnusedGlobalSymbols | function calculatePercentForPeriod( amount, rate, period )
{
return Math.round( calculatePercent( amount, rate ) * period * 100 / 365 ) / 100;
} | [
"function calculatePercentForDates( amount, rate, firstDate, lastDate )\r\n{\r\n var millisInDay = 1000 * 60 * 60 * 24;\r\n var period = ( lastDate.getTime() - firstDate.getTime() ) / millisInDay;\r\n return calculatePercentForPeriod( amount, rate, period );\r\n}",
"function findRate(startValue,goal)\n{\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Matches a rule against an input that could be the full or a subset of the comment data. | function _match (rule, cmtData) {
var path = rule.subject.split('.');
var extracted = cmtData;
while (path.length > 0) {
var item = path.shift();
if (item === '') {
continue;
}
if (extracted.hasOwnProperty(item)) {
e... | [
"function _match (rule, cmtData) {\n var path = rule.subject.split('.');\n var extracted = cmtData;\n while (path.length > 0) {\n var item = path.shift();\n if (item === '') {\n continue;\n }\n if (extracted.hasOwnProperty(item)) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Middlewares Find slang in local language Task 1 | function findSlang(req, res, next) {
console.log(req.query);
try{
const text = await translate(req.query.word, req.query.lang);
// e.g. req.query.lang = 'hi' (Hindi)
// req.query.word = "Awesome" (English - auto detection)
res.send(text); // Jhakaas
}
catch(err){
... | [
"function findLang (){\n\n\t\t\t\t\t\t\t\t\t\tvar parsed = __.urlObject().searchObject;\n\n\t\t\t\t\t\t\t\t\t\t$M.lang = supportsLang(parsed.lang) || $M.defaultLang;\n\t\t\t\t\t\t\t\t}",
"function showLanguages(req, res, template, block, next) {\n\n // Check to see if we should google translate?!\n // e.g. /adm... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets the name for the download in time format | function getDownloadName() {
let date = new Date();
let year = date.getFullYear();
let month = pad(date.getMonth() + 1);
let day = pad(date.getDate());
let hour = date.getHours();
let amPm = "AM";
if (hour >= 12) {
amPm = "PM";
}
// Converts hour to 12-hour format
hour = ... | [
"static getFilename() {\n var date = new Date();\n var YYYY = `${date.getFullYear()}`.padStart(4, \"0\");\n var MM = `${date.getMonth() + 1}`.padStart(2, \"0\");\n var DD = `${date.getDate()}`.padStart(2, \"0\");\n var hh = `${date.getHours()}`.padStart(2, \"0\");\n var mm = `${date.getMinutes()}`... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Add a new widget to the tracker. | async add(widget) {
this._focusTracker.add(widget);
await this._pool.add(widget);
if (!this._focusTracker.activeWidget) {
this._pool.current = widget;
}
} | [
"add(widget) {\n if (this._tracker.has(widget)) {\n let warning = `${widget.id} already exists in the tracker.`;\n console.warn(warning);\n return Promise.reject(warning);\n }\n this._tracker.add(widget);\n this._widgets.push(widget);\n let injecte... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns the final scroll position that the instance will have once the smooth scroll animation concludes. If no scroll animation is occurring, it will return the current scroll position instead. | getFutureScrollPosition() {
if (this._smoothScrolling) {
return this._smoothScrolling.to;
}
return this._state;
} | [
"getCurrentScrollPosition() {\n return this._state;\n }",
"_getScrollPosition () {\n const { horizontal, $scrollElement } = this.options;\n return getElementScroll($scrollElement, horizontal);\n }",
"function getScroll() {\n\t\t\treturn ((getWindowYScroll() + getWindowHeight()) / getDoc... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
GENERATE FIELD CHECBOX LIST | function generateFieldCheckBoxList() {
let div_start = '<div class="form-check form-check-inline">';
let div_end = '</div>';
let html = '';
getFieldRefList().forEach(function(field) {
let input = '<input class="form-check-input" type="checkbox" value="'+field.code+'" name="fields" id="id_'+field.code+'"... | [
"function fb_generate_field_list(){\n\tvar str = \"\";\n\ttotal_length = buildform.form_fields.length;\n\tfor(var index=0;index<total_length;index++){\n\t\tif ((buildform.form_fields[index].type!=\"splitter\") && (buildform.form_fields[index].type!=\"subject\") && (buildform.form_fields[index].type!=\"row_splitter\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
deleting the policy details | async deletePolicy(policyId) {
return await axios.delete(POLICY_API_BASE_URL + "/policy/" + policyId);
} | [
"clearPolicy() {\r\n this.model.clearPolicy();\r\n }",
"clearPolicy() {\n this.model.clearPolicy();\n }",
"deleteCertificateManagementPolicy(arg) {\n return this.httpClient\n .url(`/reserved_domains/${arg.id}/certificate_management_policy`)\n .delete()\n .json(payload => ut... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Init Nuxt.js and start listening on localhost:4000 | start(done) {
const host = process.env.HOST || "localhost"
const port = process.env.PORT || 4000
config.rootDir = rootDir // project folder
config.dev = false // production build
nuxt = new Nuxt(config)
done()
nuxt.listen(port, host)
} | [
"async function start() {\n const { host, port } = nuxt.options.server\n\n await nuxt.ready()\n // Build only in dev mode\n if (config.dev) {\n const builder = new Builder(nuxt)\n await builder.build()\n }\n\n // Give nuxt middleware to express\n app.use(nuxt.render)\n\n // Listen the server\n if (pr... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Maybefantasyland/extend :: Maybe a ~> (Maybe a > b) > Maybe b . . `extend (f) (Nothing)` is equivalent to `Nothing` . `extend (f) (Just (x))` is equivalent to `Just (f (Just (x)))` . . ```javascript . > S.extend (S.reduce (S.add) (1)) (Nothing) . Nothing . . > S.extend (S.reduce (S.add) (1)) (Just (99)) . Just (100) . ... | function Nothing$prototype$extend(f) {
return this;
} | [
"function Nothing$prototype$concat(other) {\n return other;\n }",
"function extend(oldVal, newVal){\n if(oldVal && oldVal instanceof Function) return compose.call(this, oldVal, newVal);\n else return newVal || oldVal;\n }",
"function boundExtend() {\n var args, val;\n args = A... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates a supplier invoice (Transaction) and adds it to the supplier (Name) | function createSupplierInvoice(database, supplier, user) {
const currentDate = new Date();
const invoice = database.create('Transaction', {
id: generateUUID(),
serialNumber: getNextNumber(database, SUPPLIER_INVOICE_NUMBER),
entryDate: currentDate,
type: 'supplier_invoice',
status: 'new',
com... | [
"function createTransaction(companyName, companyId, invoiceNum, vendorId, total, sheetId) {\n\tdb.Transaction.create({\n\t\tcompanyName: companyName,\n\t\tcompanyId: companyId,\n\t\tinvoiceNumber: invoiceNum,\n\t\tvendorId: vendorId,\n\t\ttotal: total,\n\t\tSheetId: sheetId\n\t}).then(function(result) {\n\t\tconsol... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function for generating points to attacking player and getting health from attacked player's figure | function generatePoints(attackingFigure, attackedFigure, state) {
let wreck = 0;
let losingPlayer = null;
/** check which player's turn is, so the other one is the one losing figures */
if (CanvasManager.turn === 0) {
losingPlayer = CanvasManager.players[1];
} else if (CanvasManager.... | [
"updateAttackPoints() {\n const combatPlayerOneDashboard = this.getPlayerGridPosition(0, true);\n const combatPlayerTwoDashboard = this.getPlayerGridPosition(1, true);\n\n combatPlayerOneDashboard.querySelector(\n \"#health\"\n ).innerHTML = this.players[0].health;\n combatPlayerOneDashboard.que... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Adds a form to the Modal, each form has a unique ID Also runs a initial validation check on each of the properties | @action
addForm(model) {
const uuidVal = uuidv4();
let form = new Form(uuidVal, model);
this.forms = {...this.forms, [uuidVal]: form};
for(let propertyName in model){
this.validate(form.id, propertyName);
}
return form;
} | [
"createFormModal() {\n this.setModalHeader();\n this.setDisplayAndFocus();\n this.listenOnCloseModal();\n this.listenKeyNavigation();\n this.listenKeyClose();\n this.submitForm();\n }",
"addForm() {\n // Creates a new form based on TEMPLATE\n let template... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Called on leaving the scene, used to cleanup display objects, data and any generated textures | destroy() {
//--calls super function cleaning up this scene--//
super.destroy();
//--if you generate any textures call destroy(true) on them to destroy the base texture--//
//texture.destroy(true);
} | [
"destroy() {\n this.shutdown();\n this.scene = undefined;\n }",
"dispose() {\n scene.clear();\n scene.dispose();\n sceneAPI.fire('dispose', sceneAPI);\n unsubscribeFromEvents();\n }",
"removedFromScene() { }",
"function destroy3DScene() {\n\n\t\t\tconsole.log( 'Destroy ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
_angleToWidth Calculates the width of the circle string from the angle (degrees) and radius E: angle, radius S: width | _angleToWidth(angle, radius) {
return 2 * radius * Math.sin(angle * Math.PI / 360.0);
} | [
"_angleToWidth(angle, radius) {\n let angRadianos = angle * Math.PI / 180.0;\n return Math.sqrt(2 * radius * radius - 2 * radius * radius * Math.cos(angRadianos));\n }",
"async _angleToWidth(angle, radius) {\n let angRadianos = angle * Math.PI / 180.0;\n return Math.sqrt(2 * radius * radius -... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
get latex code for everything on screen | function showLatex(){
if(masterNode.getLatex() == '\\bigstar'){
window.alert('Create a deduction and then press this button to get the Virginia Lake LaTeX code for it.');
return false;
}
const text = toLatex(masterNode);
// if successful, show and return true
if(text){
window.prompt('Copy the LaTeX markup b... | [
"function Latex(str){\n var stra = str.split(\"$\")\n var ans = \"\"\n for(var i=0;i<stra.length;i++){\n if(Math.floor(i/2) == i/2){\n ans+=stra[i]\n }\n else{\n ans+= \"<img class='latex' src=\\\"./images/\"+stra[i]+\".png\\\">\"\n }\n }\n return(ans)\n}",
"function Eval_printlatex(p1)... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Inserts potential checkers into the potential move spots on the CheckerBoard. | findPotentialMoves(x, y) {
this.resetPotentialPieceLocations();
let moves = this.getPotentialMoveLocations(x, y, this.isPotentialJumpPieces()); // A list of potential move locations
let checker = this.getChecker(x, y);
for (let [i, j] of moves) {
this.insertChecker(new Che... | [
"storePotentialJumpMoves() {\n this.clearPotentialJumpPieces();\n let currentColor = this.isPlayer1Turn ? this.PLAYER_1 : this.PLAYER_2;\n \n for (let x = 0; x < this.board.length; x++) {\n for (let y = 0; y < this.board[x].length; y++) {\n let checker = this.ge... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
loadCart() ; / var array=listCart(); console.log(array); clearCart() | function clearCart(){
cart=[];
saveCart();
displayCart();
} | [
"function clearCart () {\n\t\tcart = [];\n}",
"function loadCart(){\n cart = JSON.parse(sessionStorage.getItem('revonicCart')); // fetching original object items using JSON parse. \n }",
"function cart_ArrayToCart()\r\n{\r\n\tlocalStorage.setItem(\"shopping_cart\", \"empty\");\r\n}",
"function loadCart(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Method called at begining of application. Loads all application modules prototypes according to manifest | load(){
for(var moduleName in this.ControllerManifest){
Log.info("Loading app module {}", moduleName);
var thisModuleManifest = this.ControllerManifest[moduleName];
var moduleFileName = thisModuleManifest.file || $.concat(".", moduleName + "Module", "js");
var ModuleObject = false;
try{
Mod... | [
"async load () {\n // First, locate all the modules that we need to load.\n const collector = new BlueprintModuleCollector (this.app.appPath);\n const modules = await collector.gather (this.app.appPath);\n\n // Topologically sort the module by reversing the array. This will ensure\n // that we load t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Called when de selecting country on the map. | DeselectCountry(country){
this.plotObject.updatePlotRemoveCountry(country);
} | [
"function didDeselectRegionOnMap() {\n console.log(\"Deselected the region\");\n\n let city_delimited = selected_city.replace(/\\s+/g, '_')\n let neighbourhood_delimited = 'all'\n\n renderHeatMap(city_delimited, neighbourhood_delimited)\n}",
"function clearSelection() {\r\n map.deselectCountry(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Applies the error coloring for fields with errors, warnings, or information | function applyErrorColors(errorDivId, errorNum, warningNum, infoNum, clientSide) {
if (errorDivId) {
var div = jq("#" + errorDivId);
var label = jq("#" + errorDivId.replace("errors_div", "label"));
var highlightLine = "";
//check to see if the option to highlight fields is on
... | [
"function addRedError(field) {\n field.addClass('backgroundred');\n}",
"function colorErrorFields() {\r\n $j(document).ready(function() {\r\n $j(\"span.error\").next().addClass('validationError'); \r\n });\r\n}",
"function highlightErrorField(id){\n\tif(FEBAJSConfig.TYPESYSTEM_ERR_HIGHLIGHT === \... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
getIgnoreKeywords_zeroPadSymbols(args) Given a list of symbols, return an array of their zeropadded values. For example: 2, 02, 002...., 09, 009, 0009. | function getIgnoreKeywords_zeroPadSymbols(args) {
var symbols = args.symbols;
var zeropaddedsymbols = [];
for(var i = 0; i < symbols.length; i++) {
var symbol = symbols[i];
zeropaddedsymbols = zeropaddedsymbols.concat(getIgnoreKeywords_zeroPadSymbol({'symbol':symbol}));
}
return zeropaddeds... | [
"function getIgnoreKeywords_zeroPadSymbol(args) {\n\t\tvar symbol = args.symbol;\n\t\t\n\t\tvar zeropaddedsymbol = [];\n\t\t\n\t\tfor(var i = 0; i <= 6; i++) {\n\t\t\tzeropaddedsymbol.push(pad(symbol, i, '0'));\n\t\t}\n\t\t\n\t\treturn zeropaddedsymbol;\n\t}",
"function getIgnoreKeywords_multiplySymbol(args) {\n\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
If they have an API Key cookie, show the explorer | function showExplorer() {
consoleDiv.find('div').load(
'/explorer/_console.html', function() {
gdn.apiExplorer.init(consoleDiv);
sizeIt();
});
} | [
"function showAPIkeyDialog(callback)\n {\n key = localStorage.getItem(\"nihonduo-api-key\");\n var containerExists = $(\"#session-element-container\").length > 0;\n var canDisplay = !apiDialogVisible && containerExists;\n\n if ( (key === null || key === \"null\") && canDisplay)\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
text string value, ismail bool value and is false by default | function valid(text, ismail) {
ismail = typeof ismail != 'undefined' ? ismail : false;
if (ismail)
return /^[-a-z0-9!#$%&'*+/=?^_`{|}~]+(\.[-a-z0-9!#$%&'*+/=?^_`{|}~]+)*@([a-z0-9]([-a-z0-9]{0,61}[a-z0-9])?\.)*(aero|arpa|asia|biz|cat|com|coop|edu|gov|info|int|jobs|mil|mobi|museum|name|net|org|pro|tel|tra... | [
"function valid(text,ismail)\n{\n ismail = typeof ismail != 'undefined' ? ismail : false;\n if(ismail)\n return /^[-a-z0-9!#$%&'*+/=?^_`{|}~]+(\\.[-a-z0-9!#$%&'*+/=?^_`{|}~]+)*@([a-z0-9]([-a-z0-9]{0,61}[a-z0-9])?\\.)*(aero|arpa|asia|biz|cat|com|coop|edu|gov|info|int|jobs|mil|mobi|museum|name|net|org|pr... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates routing instrumention for Next Router. Only supported for client side routing. Works for Next >= 10. Leverages the SingletonRouter from the `next/router` to generate pageload/navigation transactions and parameterize transaction names. | function nextRouterInstrumentation(
startTransactionCb,
startTransactionOnPageLoad = true,
startTransactionOnLocationChange = true,
) {
const { route, traceParentData, baggage, params } = extractNextDataTagInformation();
prevLocationName = route || globalObject.location.pathname;
if (startTransactionOnPage... | [
"createPagesRoutes() {\n // 1. pre-generated\n // return require('../routes');\n\n // 2. runtime\n const context = require.context('../pages', true, /\\.js$/);\n let routes = {};\n let routeStack = [routes];\n context.keys().sort().forEach((module) => {\n let routePath = module\n .r... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function for penSize change: | function penSizeChange(pensize) {
penSize = pensize;
} | [
"function decrePenSize() {\n penSize--;\n if(penSize < 1){\n penSize = 1;\n }\n drawPenSize();\n }",
"function increPenSize() {\n penSize++;\n if(penSize > 25){\n penSize = 25;\n }\n drawPenSize();\n }",
"function userIncreasePe... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get an existing LicenseConfiguration resource's state with the given name, ID, and optional extra properties used to qualify the lookup. | static get(name, id, state, opts) {
return new LicenseConfiguration(name, state, Object.assign(Object.assign({}, opts), { id: id }));
} | [
"static get(name, id, state, opts) {\n return new SecurityConfiguration(name, state, Object.assign(Object.assign({}, opts), { id: id }));\n }",
"static get(name, id, state, opts) {\n return new InfrastructureConfiguration(name, state, Object.assign(Object.assign({}, opts), { id: id }));\n }",
... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns the Unique file name using current date and time | function fn_getuniquefilename()
{
var indate,inthr,intmi,intsec;
indate = aqConvert.DateTimeToFormatStr(aqDateTime.Today(),"%b_%d_%y");
inthr = aqDateTime.GetHours(aqDateTime.Now());
intmi = aqDateTime.GetMinutes(aqDateTime.Now());
intsec = aqDateTime.GetSeconds(aqDateTime.Now());
return indate + "-" + int... | [
"function fn_getuniquefilename()\n{\n\tvar indate,inthr,intmi,intsec;\n\tindate = aqConvert.DateTimeToFormatStr(aqDateTime.Today(),\"%b_%d_%y\");\n\tinthr = aqDateTime.GetHours(aqDateTime.Now());\n\tintmi = aqDateTime.GetMinutes(aqDateTime.Now());\n\tintsec = aqDateTime.GetSeconds(aqDateTime.Now());\n\treturn indat... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
DynamicStyle user defined styles component. Recieves configurations based on user decision and alters CSS rules | function DynamicStyle({
itemSpacing,
itemRelativeWidth,
itemPadding,
itemSpacingFillColor,
cornerRadius
}) {
const rules = {};
rules.itemWrapper = {
position: "relative",
padding: `${itemSpacing / 2}px`,
width: `${itemRelativeWidth}%`,
boxShadow: `0 0 0 ${itemSpacing / 2}px ${itemSpacingF... | [
"function configureStyles(){\n scope.options['styles'] = scope.options['styles'] || {};\n\n angular.forEach(defaultStyles(), function(value, key){\n if (scope.options['styles'][key] === undefined || scope.options['styles'][key] === null) scope... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns a provider for the URN or undefined if not found. | getProviderForURN(urn) {
const type = getType(urn);
return this.getProviderForType(type);
} | [
"get provider() {\n // Handle with care - might be undefined.\n return this._obj.provider;\n }",
"function getProvider() {\n if(!_.isNull(provider)) return provider;\n\n // TODO could be worked out if we can talk to redis via the redis URL then use redis\n if(!_.isUndefined(C.AUTH_PROVID... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function called when then the add cities button is pressed | function addNewCities(){
$.aceOverWatch.field.grid.addNewRecord(objCities.grid);
} | [
"function addCity() {\r\n displayWeather();\r\n }",
"function addCity() {\n var newCity = $(\"#cityName\").val();\n cities.push(newCity);\n renderCities();\n}",
"function addNewCity() {\n // searchedCities.empty();\n let cities = $(\"<section>\").attr(\"class\", \"cities\");\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get all activities associated with a conversation id (aka get the transcript). | getTranscriptActivities(channelId, conversationId, continuationToken, startDate) {
return __awaiter(this, void 0, void 0, function* () {
if (!channelId) {
throw new Error('Missing channelId');
}
if (!conversationId) {
throw new Error('Missing c... | [
"getTranscriptActivities(channelId, conversationId, continuationToken, startDate) {\n return __awaiter(this, void 0, void 0, function* () {\n if (!channelId) {\n throw new Error('Missing channelId');\n }\n if (!conversationId) {\n throw new Error... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns the correct "compleated" icon, depending on the state of an event | getCompleatedIcon(event) {
if (event.completed === true) {
return { name: 'check-circle-o', color: 'lime' };
}
return { name: 'circle-o', color: '#0099CC' };
} | [
"__toggleIcon(state) { \n switch (state) {\n case 1:\n return 'notification:sync';\n case 2:\n return 'notification:sync-problem';\n default:\n return 'notification:sync-disabled';\n }\n }",
"get event_busy () {\n return new IconData(0xe615,{fontFamily:'MaterialIcons... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
wrapper around the package based keyword removal | function remKeywords(keywords, keys) {
var pkg = {
keywords: keywords
};
var opts = {
keys: toDelKeys
};
removeKeywords(pkg, opts);
return pkg.keywords;
} | [
"function removeKeyword(word){\r\n for (let i = 0; i < keywords.length; i++){\r\n keywords[i].name === word && keywords.splice(i, 1);\r\n }\r\n //Redo the search\r\n updateKeywords();\r\n}",
"function removeKeyword(kwGroupName, keyword) {\n var keywords = mTempKeyword[kwGroupName].keywor... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
; public static const FIELD_LIGHT:ToolbarSkin = | function FIELD_LIGHT$static_(){ToolbarSkin.FIELD_LIGHT=( new ToolbarSkin("field-light"));} | [
"function LIGHT$static_(){ToolbarSkin.LIGHT=( new ToolbarSkin(\"light\"));}",
"function DEFAULT$static_(){ToolbarSkin.DEFAULT=( new ToolbarSkin(\"default\"));}",
"function values$static_(){ToolbarSkin.values=( com.coremedia.ui.util.Enum.collectValues(ToolbarSkin));}",
"function HEADER$static_(){ToolbarSkin.HE... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
get() output: elapsed time float | get(){
// debug
// console.log("atomicGLClock::get");
return this.elapsed;
} | [
"getElapsedTime() {\n return this.timer.elapsedTime();\n }",
"function elapsed()\n{\n var parts = process.hrtime();\n return parts[0] + parts[1] / 1e9; //sec, with nsec precision\n}",
"elapsed() {\r\n var _a;\r\n if (this._startTime) {\r\n const endTime = (_a = this._stopTime)... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
The most important UI related function. This is called whenever the grocery items list changes. The idea is to keep up two lists in UI. One with items not yet picked and other with picked up items. Clicking on each row toggles the placement of the item. | function addNewUiItem(groceryItem)
{
//list rows with label and count bubble
var li = $('<li></li>').text(groceryItem.name);
li.attr("id", groceryItem.id);
//For the life of me I can't figure out why this is not rendering correctly
//in desktop Chrome. Looks like a bug in Chrome or jQuery Mobile.
var span ... | [
"function onItemPickUp() {\n invItem.style.visibility = \"hidden\";\n items[this.id] = true;\n console.log(\"I picked up the \" + this.id);\n}",
"itempoolItemChangeAction() {\n this.reorderable_widgets.forEach(widget => {\n if (widget.constructor.name === 'ItemWidget') {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Iterates through pizza elements on the page and changes their widths | function changePizzaSizes(size) {
var pizzaContainer = document.getElementsByClassName('randomPizzaContainer');
var dx = determineDx(pizzaContainer[0], size);
var newWidth = (pizzaContainer[0].offsetWidth + dx) + 'px';
for (var i = 0, l = pizzaContainer.length; i < l; i++) {
pizzaContainer[i].st... | [
"function changePizzaSizes(size) {\n var newWidth;\n switch(size) {\n case \"1\":\n newWidth = 25;\n break;\n case \"2\":\n newWidth = 33.3333;\n break;\n case \"3\":\n newWidth = 50;\n break;\n default:\n console.log(\"bug in sizeSwitcher\"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create the grid to display ToDos | function createGrid(todoArray, board, idxProject) {
const grid = document.createElement('div');
grid.setAttribute('class', 'todos-grid');
todoArray.forEach((item, idxToDo) => createPost(item, idxToDo, grid, idxProject));
board.appendChild(grid);
} | [
"static displayToDos() {\n const todos = CRUD.getTodos();\n todos.forEach(todo => UI.addToDoToList(todo));\n }",
"function renderTodos() {\n\n// Empties each of the columns which match main conten\n\n $('main .content').empty();\n\n\n// Runs a loop for each todo and appends the result of Create E... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
called if minireel needs to copy a specified splash | function getSpecifiedSplash(minireel) {
var splashToCopy = data.experience.data.collateral.splash;
function setSplashSrc(response) {
var path = '/' + response.data[0].path;
$log.info('setting splash source: ', path);
minireel... | [
"showCover() {\n\n const x = this.cameras.main.width / 2;\n const y = this.cameras.main.height / 2;\n\n let splashScreen = new Phaser.GameObjects.Image(this, 0, 0, 'start');\n splashScreen.setPosition(x, y);\n splashScreen.setOrigin(0.5);\n splashScreen.setDisplaySize(this.cameras.main.width, this... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
input: a window (expects it is the window in focus right now) output: none effect: makes the neighbours of the current window larger as the focused window becomes smaller | function resizeNeighbours(focus_window) {
var neighbours = findNeighbours(focus_window);
for(i = 0; i < neighbours.length; i++) {
neighbours[i].setFrame({
x: neighbours[i].topLeft().x,
y: neighbours[i].topLeft().y,
width: neighbours[i].size().width + 10,
height: neighbours[i].size().height
});
}
} | [
"findHoveredWindow()\n {\n let g = this.guictx;\n let hovered_window = null;\n if (g.MovingWindow && !(g.MovingWindow.Flags & WindowFlags.NoMouseInputs))\n hovered_window = g.MovingWindow;\n let padding_regular = g.Style.TouchExtraPadding;\n let padding_for_resize_fr... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns true if type is 'UPS' or 'Switch' or 'KVM' or 'Server' or 'Storage Server', false otherwise. | function validate_type(value) {
var patt = /^(?:(?:UPS)?|(?:Switch)?|(?:KVM)?|(?:Server)?|(?:Storage Server)?)$/;
return patt.test(value);
} | [
"function isTypeSelected(selected_type) {\r\n\tif (selected_type == \"Grievance\" || selected_type == \"Appeal\") {\r\n\t\treturn true;\r\n\t} else {\r\n\t\treturn false;\r\n\t}\r\n}",
"function checkType(type) {\n if(type === 'actuator' || type === 'Actuator' || type === \"actuators\" || type === \"Actuators\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
If we're doing a nonread/write command, update the status with the state of the disk, track, and head position. | updateStatus() {
if (isReadWriteCommand(this.currentCommand)) {
// Don't modify status.
return;
}
const drive = this.drives[this.currentDrive];
if (drive.floppyDisk === undefined) {
this.status |= STATUS_INDEX;
}
else {
// S... | [
"function setStatIOStatus(status)\n\t{\n\t\tstatIOStatus = status;\n\t}",
"verify() {\n const drive = this.drives[this.currentDrive];\n if (drive.floppyDisk === undefined) {\n this.status |= STATUS_NOT_FOUND;\n }\n else if (drive.physicalTrack !== this.track) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create the `RelationshipsPayload` for the relationship `modelName`, `relationshipName`, and its inverse. | _initializeRelationshipPayloads(relInfo) {
var lhsKey = relInfo.lhs_key;
var rhsKey = relInfo.rhs_key;
var existingPayloads = this._cache[lhsKey];
if (relInfo.hasInverse === true && relInfo.rhs_isPolymorphic === true) {
existingPayloads = this._cache[rhsKey];
if (existingPayloads !== undef... | [
"createReverseRelationships (arr) {\n\t\tlet rel;\n\t\t// avoid duplicates with this array\n\t\tlet added = [];\n\t\tfor (let i=0; i<arr.length; i++) {\n\t\t\t// owner relationship?\n\t\t\trel = arr[i].getOwner();\n\t\t\tif (rel && rel.getEntity() === this.name)\n\t\t\t\tadded.push(this.addRelationship(rel.getRever... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Will open a status confirmation box, user must click confirm button to continue, optional function passed on close | function statusConfirm(text, confirm, func) {
var content = '<form id = "statusConfirm">' + text + '<input type = "submit" value = "'+ confirm +'" /></form>';
openStatusMessage(content);
if(!func)
var callback = function(e) { e.preventDefault(); closeStatusMessage(); }
else
var callback = f... | [
"function closeStatus(event)\n{\n $(app.STATUS_PROMPT).css(\"display\", \"none\");\n}",
"handleClose() {\n this.showConfirm = false;\n }",
"function JQDialogConfirm(message, status, callBackYes, callBackNo) {\r\n\r\n // confirm dialog\r\n $.jqDialog.confirm(message, callBackYes, callBackNo);\r\n\r\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Walks the tree and grabs Itext items from mugs This updates the ID of each returned Itext item according to it's autoId property. IDs of items with autoId turned off will not be modified unless the ID is blank or it conflicts with another item. NOTE because this mutates itext IDs it could cause subtle side effects if a... | function getItextItemsFromMugs(form, asObject) {
var empty = asObject,
items = [],
byId = {},
props = _.object(_.map(ITEXT_PROPERTIES, function (thing) {
return [thing, thing.replace("Itext", "")];
}));
forEachItextItem(form, function (ite... | [
"function updateItemsIds(it) {\n\t\t\t\tconsole.log(it);\n\t\t\t\tit.name += ' #' + Math.round(Math.random() * 1000);\n\t\t\t\tit.id = UUID();\n\n\t\t\t\t_.each(it.items, function(v, k) {\n\t\t\t\t\tit.items[k] = updateItemsIds(v);\n\t\t\t\t});\n\t\t\t\treturn it;\n\t\t\t}",
"_updateItemIDs(items, parentID) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test Node JS net.Server API tests are done according Node.js doc : | function testCheckServerAPI() {
var srv=net.createServer(function(sock){});
Y.Assert.isObject(srv.listen, "Check listen method exists : ");
Y.Assert.isObject(srv.pause, "Check pause method exists : ");
Y.Assert.isObject(srv.close, "Check close method exists : ");
Y.Assert.isObject(srv.address, "Check... | [
"function testHttpClientOnProxyServer(test) {\n\n // TODO - Check the first available port here starting from minPort\n var minPort = 11101,\n maxPort = 11199,\n hostName = \"localhost\",\n router = {},\n proxyManager = new ProxyManag... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
saves notes to json file | function saveNotes(notesLs) {
fs.writeFile('./public/notes.json', JSON.stringify(notesLs), function(err){
if(err) { console.log(err) }
});
} | [
"function saveNotes(notes) {\n const notesJson = JSON.stringify(notes);\n fs.writeFileSync('notes.json', notesJson)\n}",
"function saveNotes(notes) {\n let notesJson = JSON.stringify(notes);\n fs.writeFileSync(filename, notesJson);\n}",
"function writeNotes(notes) {\n let noteString = JSON.string... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
split a horizontal flow into 2 horizontal flows | function SplitFlowx(e,obj)
{
myDiagram.startTransaction("Split flow");
Link = myDiagram.selection.first();
toNode = Link.toNode;
fromNode = Link.fromNode;
MoveSet = toNode.findTreeParts();
myDiagram.model.removeLinkData(Link.data);
offsetx =null;
// if (Lef... | [
"createSplits() {\n if (this.opSplit !== null) {\n this.opSplit.destroy();\n }\n if (this.ioSplit !== null) {\n this.ioSplit.destroy();\n }\n\n this.opSplit = Split([\"#opPane\", \"#ioPane\"], {\n sizes: [20, 80],\n minSize: 200\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function for searching friends to add new chat | function loadFriendsForNewChat() {
$("a.new-msg").click(initFriendsSearchForNewChat);
$("input[name='ffinder']").keyup(initFriendsSearchForNewChat);
$(".expand-list-btn button").click(function() {
getFriendsForNewChat(false, ffinderOffset);
});
} | [
"searchFriend(){\n let tempFriends = [];\n\n if( this.searchString === '' ){\n return this.forChannelCreationMyFriends;\n }\n\n for( let friend of this.forChannelCreationMyFriends ){\n if( friend.usernick.toLowerCase().includes( this.searchSt... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Apply mask ability with masking elements to the MaskedTextBox. | function applyMask() {
setElementValue.call(this, this.promptMask);
setMaskValue.call(this, this.value);
} | [
"#masking() {\n\t\tthis.#evaluateMask()\n\t\tthis.input.value = Mask.masking(this.input.value, this.mask)\n\t}",
"_enableMasking() {\n if (!this._masked) {\n this._unmaskedText = this.text();\n this._masked = true;\n this.setText(this._unmaskedText);\n }\n }",
"maskWith(element){// use giv... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
use user's age level (determined by last function), age, and position to determine what flex (stiffness) best fits their needs | function findFlex(ageLevel) {
let age = document.getElementById("age").value;
var ageInt = parseFloat(age);
var position = document.getElementById("position").value;
var flex;
if (ageLevel == "Junior" && ageInt <= 10) {
flex = 40;
} else if (ageLevel == "Junior" && ageInt > 10) {
flex = 50;
} el... | [
"function findAgeLevel() {\n let weight = document.getElementById(\"weight\").value;\n weightInt = parseFloat(weight);\n let heightFeet = document.getElementById(\"heightFeet\").value;\n let heightInches = document.getElementById(\"heightInches\").value;\n\n var heightFeetInt = parseInt(heightFeet);\n var hei... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Request to restore a customers in DB | restoreCustomer({ commit, dispatch }, data) {
return axios
.post("/customer/delete", {...data })
.then(response => {
console.log(response);
return Promise.resolve(true);
})
.catch(function(error) {
... | [
"@action\n sendRestore(backup) {\n if (!backup || !backup.state) return\n\n this.server.send(\"state.restore.request\", { state: backup.state })\n }",
"function handleRestoreRequest(req, res) {\n var domain = checkUserIpAddress(req, res);\n if (domain == null) return;\n if ((domain.id... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
The need stems from the continually changing encyclopedia contents, and is being applied to the main site navigation as well. This script can be updated with new pages in the future and the entire site will have those pages added to the main navigation. This prevents me from having to update potentially hundreds of enc... | function populateEncyclopediaContents() {
// Get the id of the page
var pageid = document.getElementById("page-id");
// The ul for the encyclopedia contents to go in
var encyclopediaContentsUL = document.getElementById("contents-ul");
// List of encyclopedia pages—can be updated later and will apply... | [
"function pubmedSourceOrganization($PubmedArticle){\n\n var $GrantList = $PubmedArticle.getElementsByTagName('GrantList')[0];\n var soMap = {}; //re-aggregate grant entries by organizations\n if($GrantList){\n var $Grants = $GrantList.getElementsByTagName('Grant');\n if($Grants){\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
___ render the progress values on the bar | function renderProgress(val, perc, message) {
bar.style.width = perc + "%";
renderMessage(message);
} | [
"function renderProgress(val, perc, message) {\r\n\t\tbar.style.width = perc + \"%\";\r\n\r\n\t\tvar display = null;\r\n\t\tif(mode == \"percentage\") {\r\n\t\t\tdisplay = perc + \"%\";\r\n\t\t} else {\r\n\t\t\tdisplay = val + \" / \" + max;\r\n\t\t}\r\n\r\n\t\tif(message) {\r\n\t\t\tdisplay += \" \" + message;\r\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Parses the username from the JWT token | function parseUser(token) {
let name;
jwt.verify(token, env.access_token_secret, (err, username) => {
if (!err) {
name = username;
}
});
return name;
} | [
"function userName(decodedToken) {\n return jwt_1.readPropertyWithWarn(decodedToken, exports.mappingUserFields.userName.keyInJwt);\n}",
"async getUsername(){\n let token = this.getToken();\n let payload = new FormData();\n payload.append(\"token\", token);\n let response = await fet... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets up the session using bodyParser and a secret | function setupSession(router) {
router.use(bodyParser.urlencoded({limit: "100mb", extended : true}));
router.use(bodyParser.json({limit: "100mb"}));
router.use(session({
secret: Constants.SESSION_SECRET,
resave: true,
saveUninitialized: true,
}));
} | [
"function setUpSessionAuth(app, io) {\n var sessionMiddleware = session({\n secret: 'nagaram',\n saveUninitialized: false,\n resave: false\n });\n\n app.use(sessionMiddleware);\n io.use(require('express-socket.io-session')(sessionMiddleware));\n app.use(bodyParser.json());\n a... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Take contents of canvas and encode them into save button so they can be downloaded. The click or keypress event handles the button triggering. | function saveCanvas() {
// Generate SVG.
var save_button = $('#save');
var save_svg = $('#canvas').innerHTML.replace('<svg', '<svg xmlns="http://www.w3.org/2000/svg"');
var data_uri = 'data:image/svg+xml;base64,' + window.btoa(save_svg);
var filename = 'bustashape-' + window.location.hash.replace('#', '') + '... | [
"function saveCanvasClicked(e) {\n e.preventDefault();\n var BB = get_blob();\n saveAs(\n new BB(\n [codeArea.value || codeArea.placeholder]\n , {type: \"text/plain;charset=\" + document.characterSet}\n )\n , \"turtleGraphic.png\"\n );\n return false;\n}",
... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Handles the bottom bar animation | function handleSettingsBarSlide(){
if(!settingsBottomBarExpanded){
var targetTop = 260;
if(IPHONE5){
targetTop = 340;
}
settingsBottomBar.animate({top:targetTop,duration:250}, function(){
settingsBottomBarExpanded = true;
settingsBottomBarIcon.animate(tmpRotateAnimation);
});
} else {
v... | [
"function onBottomBarTransitionEnd(e)\n{\n\t//at this point we have completed the transition and are now in the\n\t//drawing view\n\t\n\t//unsubscribe from the event\n\tunsubscribeFromEvent(e);\n\t\n\t//listen for when the window resizes\n\tx$(window).on(\"resize\", onWindowResize);\n\t\n\t//listen for when any of ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Middleware: Setup JWT cookie to initiate clientside session. | function setClientSession(req, res, next) {
if (!res.locals.user) {
console.error(`${req.originalUrl}: setClientSession: ERROR: Attempted to set JWT without user session info.`); // STRETCH replace with server side logging
return next();
}
jwt.sign(res.locals.user, jwt_secret.key, { expiresIn: jwt_secr... | [
"function processJWT(req, res, next) {\n try {\n const payload = AuthHandling.validateCookies(req);\n req.user = payload; // create a current user\n return next();\n } catch (err) {\n return next();\n }\n}",
"authOnClient() {\n // run cookie auth only on client side\n const token = cookie.get... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Metodos de Perfil. // Metodo que lista los perfiles de la base de datos. | function listarPerfiles(){
$http.get('/api/perfiles').success(function(response){
$scope.perfiles = response;
});
} | [
"function CargarTodosPerfiles(pOb) {\n var mResultado = \"\";\n var mResultadoParcial = \"\";\n for (var i = 0; i < pOb.bus.length; i++) { //Comienza a cargar todos los perfiles, utilizando la plantilla\n mResultadoParcial = FormatoLineaPerfil.replace(\"{2}\", kConstantes.DirImagenesAlmacen + pOb.bu... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
PUBLIC METHODS. Return all pokemons of Pokeapi.co | function findAllPokemons() {
var request = $http({
method: "GET",
url: PokethonConstants.hostRemote + "pokemon?limit=811",
});
return( request.then( handleSuccess, handleError ) );
... | [
"function getAll() {\n return pokemons;\n }",
"function getAll() {\n return $pokemons;\n }",
"static getPokemons() {\n return Pokemon.query()\n .with('category')\n .with('types');\n }",
"getPokeList() {\n return Axios.get('https://pokeapi.co/api/v2/pokemon/?offset=0&limit=964'... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
payload is pageStatus (0 ~ 2) | [types.CHANGE_PAGE](state, payload) {
if (payload >= pageStatus.player && payload <= pageStatus.bgList) {
state.pageStatus = payload;
}
} | [
"function changeStatusTotalPage(page) {\n $listStatus = [];\n\n //get list status page\n for(i in page.contents) {\n $listStatus.push(page.contents[i].status);\n }\n\n //check and set statys for page\n if ($listStatus.indexOf('Not Started') > -1) {\n\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Custom tracking for email article button | function emailArticle(txt) {
var s = s_gi(s_account);
s.linkTrackEvents = s.events = 'event19';
s.trackExternalLinks = false;
s.linkTrackVars = 'prop9,eVar9,events';
s.tl(this, 'o', txt);
} | [
"clickedPendingArticle(article) {\n\t\tconsole.log(\"clicked on a pending article\")\n\t}",
"blogPostViewed(articleInformation) {\n if (typeof window !== 'undefined') {\n window.analytics.track(\"Blog Post Viewed\", {\n article_title: articleInformation.blog_title,\n article_category: articl... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
calculates the players position, then draws all of the foreground. you have to calculate players y pos first in order to make sure the ordering of elements is correct. | function drawForeground(){
var drawnY = player.y/(roomDepth/2)*halfHeight+halfHeight*2;
var drawnX = player.x/(roomWidth/2)*
(halfWidth-playerWidth/2)*(.24*(player.y+roomDepth/2)/roomDepth+.76)+halfWidth;
var foregroundObjects = [[0,drawBear],
[player.y,function(){drawPlayer(drawnX,draw... | [
"playersCurrentPoints() {\n\t\t//Offets for the distance between elements\n\t\tlet titleXOffset = 35;\n\t\tlet titleYOffset = 70;\n\t\tlet playerRowOffset = 50;\n\t\t\n\t\tlet boxWidth = 300;\n\t\tlet boxHeight = (this.players.length + 1) * playerRowOffset + 5;\n\n\t\tpush();\n\t\tbgPanel(this.position.x + titleXO... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Determine multiplier for metric relative to seconds | function getMultipler( metric ) {
return {
"h" : 3600,
"m" : 60,
"s" : 1,
"ms" : 0.001
}[ metric ] || -1;
} | [
"getScaledTime() {\n\n let t = this.timer / TRANSITION_TIME;\n if (this.fadeIn) t = 1.0 - t;\n return t;\n }",
"get speedMultiplier() {}",
"function m(seconds) {\n return seconds * 1000;\n}",
"function secs2Weight(secs) {\n return Math.round(secs / 30) + 1;\n}",
"timeInMinutes(seco... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
LRParser Factory. The main work is done here to construct an LR parse table from the parserDescription object. Currently Suppoerted Options: `moduleBase` a directory (or array of directories) to use when looking for modules. Defaults to just the current node search path. | function CreateLRParser(parserDescription, options) {
if(typeof options === "undefined") {
options = {};
}
var parser = Object.create(LRParserPrototype);
parser.stack = [0];
parser.token_stack = [];
var newPD = {"symbols":{}, "productions":{}};
// Import the root module.
importModule(newPD, "", parserDescr... | [
"function CreateLRParserWithLexer(parserDescription, options, lexer) {\n\t// Creat the parser using the main factory.\n\tvar parser = CreateLRParser(parserDescription, options);\n\n\t// Create a lexer if needed.\n\tif(typeof lexer === \"undefined\" || !lexer) {\n\t\tlexer =\tDefaultLexer.Create(parser.getParserDesc... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
POST /markets/ create market | function createMarket(data, callback) {
$.ajax({
url: 'markets/',
type : 'POST',
contentType: "application/json;charset=utf-8",
data: JSON.stringify(data),
success: function (res, textStatus) {
callback(res, textStatus);
},
error: function (res, te... | [
"function createTrade() {\n fetch(`${apiUrl}/trade`, {\n // Adding method type\n method: \"POST\",\n // Adding headers to the request\n headers: {\n \"Content-Type\": \"application/json\",\n Accept: \"application/json\",\n },\n // Adding body or contents to send to bac... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Delete CRLF at end of sequence str CRLF DOS : "\r\n" CRLF UNIX : "\n" CRLF OS : "\r" | function deleteLastCRLF(str){
var rv=str;
var imax=rv.length;
if(rv[imax-1] == "\n")
rv = rv.slice(0,imax-1);
imax=rv.length;
if(rv[imax-1] == "\r")
rv = rv.slice(0,imax-1);
return rv;
} | [
"function removeEOL(str) {\n return str.replace('\\n', ' ');\n}",
"function fixCarriageReturn(txt) {\n var tmp = txt;\n do {\n txt = tmp;\n tmp = txt.replace(/\\r+\\n/gm, '\\n'); // \\r followed by \\n --> newline\n tmp = tmp.replace(/^.*\\r+/gm, ''); // Other \\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
see if a vertex is a member of the triangle's points | function vertex_in_triangle(v, t) {
for (var p=0; p<pointnames.length; p++) {
if (t[pointnames[p]] == v) {
return true;
}
}
} | [
"function triangleContainsPoint(v0, v1, v2, point)\r\n{\r\n // for each triangle side, make a vector out of it by subtracting vertices; \r\n // make another vector from one vertex to the point; the cross-product of these \r\n // two vectors is orthogonal to both and the signs of its components indicate \r\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Checks for duplicate company being added to myWatchlist. Prevents company from being added to DB if it is a duplicate. | companyExists(company) {
const watchlist = this.customWatchlist;
return watchlist.includes(company)
} | [
"function record_company(company) {\n\tif (known_companies[company]) return;\t\t\t\t\t\t\t\t\t\t//if i've seen it before, stop\n\n\t// -- Show the new company Notification -- //\n\tif (start_up === false) {\n\t\tconsole.log('[ui] this is a new company! ' + company);\n\t\taddshow_notification(build_notification(fals... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Divide a collection of features with mixed types into layers of a single type (Used for importing TopoJSON and GeoJSON features) | function divideFeaturesByType(shapes, properties, types) {
var typeSet = utils.uniq(types);
var layers = typeSet.map(function(geoType) {
var p = [],
s = [],
dataNulls = 0,
rec;
for (var i=0, n=shapes.length; i<n; i++) {
if (types[i] != geoType) continue;
... | [
"function flattenFeature (feature) {\n let features = []\n if (feature.geometry != null) {\n switch (window.mapcache.GeometryType.fromName(feature.geometry.type.toUpperCase())) {\n case window.mapcache.GeometryType.MULTIPOINT:\n case window.mapcache.GeometryType.MULTILINESTRING:\n case window.ma... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Adds a function to a posthandler chain. These functions are called after the user defined handler passes back control, but before the final output handler | function add_post_hook(fn, name) {
name = name || 'default';
var hooks = get_chain(this.post_hooks, name);
hooks.push(fn);
} | [
"function post(fn) {\n postFunction = fn;\n }",
"addPostRoute(route, ...handlers) {\n this.addRoute('post', route, ...handlers);\n }",
"static addHandler(handler) {\n assert(handler.call, 'Handler must be a function');\n assert(handler.length === 2 || handler.length === 3, 'Handler functio... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
return available unique state names from data files | function availableState() {
let states = [];
Object.values(tdata).forEach(value => {
let state = value.state.toUpperCase();
if(states.indexOf(state) !== -1) {
}
else {
states.push(state);
}
});
return states;
} | [
"function getAllFileNames(state,programOfThisState){if(!state.allFileNames){var sourceFiles=programOfThisState.getSourceFiles();state.allFileNames=sourceFiles===ts.emptyArray?ts.emptyArray:sourceFiles.map(function(file){return file.fileName;});}return state.allFileNames;}",
"getStateNames(retailData) {\r\n c... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Toggle viewing items in the done column | function toggleDoneColumn() {
$('.toggle-done').click(function() {
if (localStorage.doneColumn == 'false') {
localStorage.doneColumn = 'true';
} else {
localStorage.doneColumn = 'false';
}
$('.issue-list-item-done').toggle();
$('.done-bucket').toggle();
if ($(this).css('color') ==... | [
"function toggleToDo(){\n\n this.completed = this.completed ? 0 : 1;\n\n }",
"function toggleDone (key) {\n//retrieve the index of the todo entry in the collection \n const index = todoItems.findIndex((item) => item.id === Number(key));\n//toggle the check attribute value of the todo entry \n todo... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Plan: 1. initiailze an array of 0s, array index is the amount value, value is the number of combinations 2. iterate the denominations forEach coin. iterate through the values, then | function findCombinations(amount, denominations) {
let combinations = []
for (let i = 0; i <= amount; i++) {
combinations[i] = 0
}
combinations[0] = 1
denominations.forEach((coin) => {
for (let higherAmount = coin; higherAmount <= amount; higherAmount++) {
let higherAmountRemainder = higher... | [
"function computeCombinations(amount, denominations) {\n let combinations = [];\n //initialize each index in the array with 0\n for (let i = 0; i <= amount; i++) {\n combinations[i] = 0;\n }\n\n combinations[0] = 1;\n\n denominations.forEach((coin) => {\n for (var higherAmount = coin; higherAmount <= am... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Converts HSL components to an HSV color. | function hsl2hsv(h, s, l) {
s *= (l < 50 ? l : 100 - l) / 100;
var v = l + s;
return {
h: h,
s: v === 0 ? 0 : ((2 * s) / v) * 100,
v: v,
};
} | [
"static HSVToRGB() {}",
"function hsl2hsv(h, s, l) {\r\n s *= (l < 50 ? l : 100 - l) / 100;\r\n var v = l + s;\r\n return {\r\n h: h,\r\n s: v === 0 ? 0 : ((2 * s) / v) * 100,\r\n v: v\r\n };\r\n}",
"function hsv2hsl(h, s, v) {\n s /= _consts__WEBPACK_IMPORTED_MODULE_0__.MAX_... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This method is called by jTPS when a transaction is executed. | doTransaction() {
this.f(this.oldDes,this.oldAss,this.oldDue,this.oldCom,this.des,this.ass,this.due,this.com,this.whetherCreate);
} | [
"function transaction() {}",
"function after_process_create_transaction(){\n \n}",
"async commitTransaction() {\n\t \n // this.yadamuLogger.trace([`${this.constructor.name}.commitTransaction()`,this.getWorkerNumber()],``)\n\n super.commitTransaction()\n await this.executeSQL(TeradataStatementLibrar... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
BONUS Iteration 7: Time Format Turn duration of the movies from hours to minutes | function turnHoursToMinutes(movies) {
return movies.map(i =>{
const splited = i.duration.split(" ")
const hoursToMinutes = splited[0].substring(0, splited[0].length-1) * 60
const minutes = splited[1]? splited[1].substring(0, splited[1].length-3) * 1 : 0
return {
...i,
... | [
"function turnHoursToMinutes (movie){\n for (var i=0; i<movie.length;i++){\n var horas=parseInt(movie[i].duration.split(\" \")[0].toString().replace('h',''));\n var minutos=parseInt(movie[i].duration.split(\" \")[1].toString().replace('min',''));\n var tiempo=(horas*60)+minutos\n movie[i].dur... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sends a request to logout the user and handles the local storage Params: None Return: true (arbitrary for now) | function logout() {
let endpoint = "/Users/logout?access_token=" + window.localStorage.getItem("access_token");
let headers = {};
let payload = {};
sendRequest(method, endpoint, headers, payload, logoutCallback); // From CRUD.js
return true;
} | [
"logout(){\n\t\tthis.fetch(`${root}/api/auth/logout`, 'post');\n\t\t// localStorage.removeItem('id_token');\n\t\tlocalStorage.clear();\n\t}",
"logout() {\n localStorage.removeItem(\"user\");\n }",
"logout() {\n localStorage.removeItem('user');\n }",
"function _logout(){\n localStorage.r... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Find the first `preferred` item existing in `arr`. | function prefer(arr, preferred) {
for (var i = 0; i < preferred.length; i++) {
if (arr.indexOf(preferred[i]) !== -1) {
return preferred[i];
}
}
return preferred[0];
} | [
"function prefer(arr, preferred) {\n\t\t\tfor (var i = 0; i < preferred.length; i++) {\n\t\t\t\tif (arr.indexOf(preferred[i]) !== -1) {\n\t\t\t\t\treturn preferred[i];\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn preferred[0];\n\t\t}",
"function prefer(arr, preferred) {\n for (var i = 0; i < preferred.length; i++) {\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
defines a translated phrase object. | function TranslatedPhrase(string, translation){
this.content=string
this.translation=translation
//returns translation in lowercase for palindrome testing.
this.lowerCaseContent=function lowerCaseContent(){
return this.processor(this.translation)
}
} | [
"constructor(phrase) {\n this.phrase = phrase;\n }",
"constructor (phrase) {\n this.phrase = phrase;\n }",
"constructor(phrase) {\n this.phrase = phrase;\n }",
"function TranslatedPhrase(content, translation) {\n this.content = content;\n this.translation = translation;\n //overri... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create a failed step result. | static fail(message) {
return new StepResult(null, message);
} | [
"function failed(result) {\n return { kind: \"failed\", result: result };\n }",
"onTestFail(payload) {\n this.updateStepStatus(payload);\n }",
"function Failure(value) {\n return new _Result('Failure', value);\n}",
"onTestFail(test) {\n this._fails++;\n this._out.push(test.title +... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |