repo stringlengths 5 67 | path stringlengths 4 116 | func_name stringlengths 0 58 | original_string stringlengths 52 373k | language stringclasses 1
value | code stringlengths 52 373k | code_tokens list | docstring stringlengths 4 11.8k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 86 226 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
siddii/angular-timer | dist/assets/js/angular-timer-all.min.js | getCzechForm | function getCzechForm (c) {
if (c === 1) {
return 0
} else if (Math.floor(c) !== c) {
return 1
} else if (c % 10 >= 2 && c % 10 <= 4 && c % 100 < 10) {
return 2
} else {
return 3
}
} | javascript | function getCzechForm (c) {
if (c === 1) {
return 0
} else if (Math.floor(c) !== c) {
return 1
} else if (c % 10 >= 2 && c % 10 <= 4 && c % 100 < 10) {
return 2
} else {
return 3
}
} | [
"function",
"getCzechForm",
"(",
"c",
")",
"{",
"if",
"(",
"c",
"===",
"1",
")",
"{",
"return",
"0",
"}",
"else",
"if",
"(",
"Math",
".",
"floor",
"(",
"c",
")",
"!==",
"c",
")",
"{",
"return",
"1",
"}",
"else",
"if",
"(",
"c",
"%",
"10",
"... | Internal helper function for Czech language. | [
"Internal",
"helper",
"function",
"for",
"Czech",
"language",
"."
] | d58fbf8c3325f63e1fdb250ed1f1a0676c8344de | https://github.com/siddii/angular-timer/blob/d58fbf8c3325f63e1fdb250ed1f1a0676c8344de/dist/assets/js/angular-timer-all.min.js#L489-L499 | train |
siddii/angular-timer | dist/assets/js/angular-timer-all.min.js | getPolishForm | function getPolishForm (c) {
if (c === 1) {
return 0
} else if (Math.floor(c) !== c) {
return 1
} else if (c % 10 >= 2 && c % 10 <= 4 && !(c % 100 > 10 && c % 100 < 20)) {
return 2
} else {
return 3
}
} | javascript | function getPolishForm (c) {
if (c === 1) {
return 0
} else if (Math.floor(c) !== c) {
return 1
} else if (c % 10 >= 2 && c % 10 <= 4 && !(c % 100 > 10 && c % 100 < 20)) {
return 2
} else {
return 3
}
} | [
"function",
"getPolishForm",
"(",
"c",
")",
"{",
"if",
"(",
"c",
"===",
"1",
")",
"{",
"return",
"0",
"}",
"else",
"if",
"(",
"Math",
".",
"floor",
"(",
"c",
")",
"!==",
"c",
")",
"{",
"return",
"1",
"}",
"else",
"if",
"(",
"c",
"%",
"10",
... | Internal helper function for Polish language. | [
"Internal",
"helper",
"function",
"for",
"Polish",
"language",
"."
] | d58fbf8c3325f63e1fdb250ed1f1a0676c8344de | https://github.com/siddii/angular-timer/blob/d58fbf8c3325f63e1fdb250ed1f1a0676c8344de/dist/assets/js/angular-timer-all.min.js#L502-L512 | train |
siddii/angular-timer | dist/assets/js/angular-timer-all.min.js | getSlavicForm | function getSlavicForm (c) {
if (Math.floor(c) !== c) {
return 2
} else if ((c % 100 >= 5 && c % 100 <= 20) || (c % 10 >= 5 && c % 10 <= 9) || c % 10 === 0) {
return 0
} else if (c % 10 === 1) {
return 1
} else if (c > 1) {
return 2
} else {
return 0
}
} | javascript | function getSlavicForm (c) {
if (Math.floor(c) !== c) {
return 2
} else if ((c % 100 >= 5 && c % 100 <= 20) || (c % 10 >= 5 && c % 10 <= 9) || c % 10 === 0) {
return 0
} else if (c % 10 === 1) {
return 1
} else if (c > 1) {
return 2
} else {
return 0
}
} | [
"function",
"getSlavicForm",
"(",
"c",
")",
"{",
"if",
"(",
"Math",
".",
"floor",
"(",
"c",
")",
"!==",
"c",
")",
"{",
"return",
"2",
"}",
"else",
"if",
"(",
"(",
"c",
"%",
"100",
">=",
"5",
"&&",
"c",
"%",
"100",
"<=",
"20",
")",
"||",
"("... | Internal helper function for Russian and Ukranian languages. | [
"Internal",
"helper",
"function",
"for",
"Russian",
"and",
"Ukranian",
"languages",
"."
] | d58fbf8c3325f63e1fdb250ed1f1a0676c8344de | https://github.com/siddii/angular-timer/blob/d58fbf8c3325f63e1fdb250ed1f1a0676c8344de/dist/assets/js/angular-timer-all.min.js#L515-L527 | train |
siddii/angular-timer | dist/assets/js/angular-timer-all.min.js | getLithuanianForm | function getLithuanianForm (c) {
if (c === 1 || (c % 10 === 1 && c % 100 > 20)) {
return 0
} else if (Math.floor(c) !== c || (c % 10 >= 2 && c % 100 > 20) || (c % 10 >= 2 && c % 100 < 10)) {
return 1
} else {
return 2
}
} | javascript | function getLithuanianForm (c) {
if (c === 1 || (c % 10 === 1 && c % 100 > 20)) {
return 0
} else if (Math.floor(c) !== c || (c % 10 >= 2 && c % 100 > 20) || (c % 10 >= 2 && c % 100 < 10)) {
return 1
} else {
return 2
}
} | [
"function",
"getLithuanianForm",
"(",
"c",
")",
"{",
"if",
"(",
"c",
"===",
"1",
"||",
"(",
"c",
"%",
"10",
"===",
"1",
"&&",
"c",
"%",
"100",
">",
"20",
")",
")",
"{",
"return",
"0",
"}",
"else",
"if",
"(",
"Math",
".",
"floor",
"(",
"c",
... | Internal helper function for Lithuanian language. | [
"Internal",
"helper",
"function",
"for",
"Lithuanian",
"language",
"."
] | d58fbf8c3325f63e1fdb250ed1f1a0676c8344de | https://github.com/siddii/angular-timer/blob/d58fbf8c3325f63e1fdb250ed1f1a0676c8344de/dist/assets/js/angular-timer-all.min.js#L530-L538 | train |
siddii/angular-timer | bower_components/momentjs/min/moment-with-locales.js | makeDateFromString | function makeDateFromString(config) {
parseISO(config);
if (config._isValid === false) {
delete config._isValid;
moment.createFromInputFallback(config);
}
} | javascript | function makeDateFromString(config) {
parseISO(config);
if (config._isValid === false) {
delete config._isValid;
moment.createFromInputFallback(config);
}
} | [
"function",
"makeDateFromString",
"(",
"config",
")",
"{",
"parseISO",
"(",
"config",
")",
";",
"if",
"(",
"config",
".",
"_isValid",
"===",
"false",
")",
"{",
"delete",
"config",
".",
"_isValid",
";",
"moment",
".",
"createFromInputFallback",
"(",
"config",... | date from iso format or fallback | [
"date",
"from",
"iso",
"format",
"or",
"fallback"
] | d58fbf8c3325f63e1fdb250ed1f1a0676c8344de | https://github.com/siddii/angular-timer/blob/d58fbf8c3325f63e1fdb250ed1f1a0676c8344de/bower_components/momentjs/min/moment-with-locales.js#L1672-L1678 | train |
siddii/angular-timer | bower_components/momentjs/min/moment-with-locales.js | function (key) {
var newLocaleData;
if (key === undefined) {
return this._locale._abbr;
} else {
newLocaleData = moment.localeData(key);
if (newLocaleData != null) {
this._locale = newLocaleData;
}
... | javascript | function (key) {
var newLocaleData;
if (key === undefined) {
return this._locale._abbr;
} else {
newLocaleData = moment.localeData(key);
if (newLocaleData != null) {
this._locale = newLocaleData;
}
... | [
"function",
"(",
"key",
")",
"{",
"var",
"newLocaleData",
";",
"if",
"(",
"key",
"===",
"undefined",
")",
"{",
"return",
"this",
".",
"_locale",
".",
"_abbr",
";",
"}",
"else",
"{",
"newLocaleData",
"=",
"moment",
".",
"localeData",
"(",
"key",
")",
... | If passed a locale key, it will set the locale for this instance. Otherwise, it will return the locale configuration variables for this instance. | [
"If",
"passed",
"a",
"locale",
"key",
"it",
"will",
"set",
"the",
"locale",
"for",
"this",
"instance",
".",
"Otherwise",
"it",
"will",
"return",
"the",
"locale",
"configuration",
"variables",
"for",
"this",
"instance",
"."
] | d58fbf8c3325f63e1fdb250ed1f1a0676c8344de | https://github.com/siddii/angular-timer/blob/d58fbf8c3325f63e1fdb250ed1f1a0676c8344de/bower_components/momentjs/min/moment-with-locales.js#L2647-L2659 | train | |
siddii/angular-timer | bower_components/momentjs/min/moment-with-locales.js | function (number) {
var b = number,
output = '',
lookup = [
'', 'af', 'il', 'ydd', 'ydd', 'ed', 'ed', 'ed', 'fed', 'fed', 'fed', // 1af to 10fed
'eg', 'fed', 'eg', 'eg', 'fed', 'eg', 'eg', 'fed', 'eg', 'fed' // 11eg to 20fed
... | javascript | function (number) {
var b = number,
output = '',
lookup = [
'', 'af', 'il', 'ydd', 'ydd', 'ed', 'ed', 'ed', 'fed', 'fed', 'fed', // 1af to 10fed
'eg', 'fed', 'eg', 'eg', 'fed', 'eg', 'eg', 'fed', 'eg', 'fed' // 11eg to 20fed
... | [
"function",
"(",
"number",
")",
"{",
"var",
"b",
"=",
"number",
",",
"output",
"=",
"''",
",",
"lookup",
"=",
"[",
"''",
",",
"'af'",
",",
"'il'",
",",
"'ydd'",
",",
"'ydd'",
",",
"'ed'",
",",
"'ed'",
",",
"'ed'",
",",
"'fed'",
",",
"'fed'",
",... | traditional ordinal numbers above 31 are not commonly used in colloquial Welsh | [
"traditional",
"ordinal",
"numbers",
"above",
"31",
"are",
"not",
"commonly",
"used",
"in",
"colloquial",
"Welsh"
] | d58fbf8c3325f63e1fdb250ed1f1a0676c8344de | https://github.com/siddii/angular-timer/blob/d58fbf8c3325f63e1fdb250ed1f1a0676c8344de/bower_components/momentjs/min/moment-with-locales.js#L4491-L4510 | train | |
antvis/data-set | src/transform/kernel-smooth/regression.js | weight | function weight(kernel, bandwidth, x_0, x_i) {
const arg = (x_i - x_0) / bandwidth;
return kernel(arg);
} | javascript | function weight(kernel, bandwidth, x_0, x_i) {
const arg = (x_i - x_0) / bandwidth;
return kernel(arg);
} | [
"function",
"weight",
"(",
"kernel",
",",
"bandwidth",
",",
"x_0",
",",
"x_i",
")",
"{",
"const",
"arg",
"=",
"(",
"x_i",
"-",
"x_0",
")",
"/",
"bandwidth",
";",
"return",
"kernel",
"(",
"arg",
")",
";",
"}"
] | calculates weight for i-th obs | [
"calculates",
"weight",
"for",
"i",
"-",
"th",
"obs"
] | 55526ac5663b87cdc988fc579404df186603b2d9 | https://github.com/antvis/data-set/blob/55526ac5663b87cdc988fc579404df186603b2d9/src/transform/kernel-smooth/regression.js#L39-L42 | train |
antvis/data-set | demos/assets/g2.js | copy | function copy(out, a) {
out[0] = a[0];
out[1] = a[1];
out[2] = a[2];
out[3] = a[3];
out[4] = a[4];
out[5] = a[5];
out[6] = a[6];
out[7] = a[7];
out[8] = a[8];
return out;
} | javascript | function copy(out, a) {
out[0] = a[0];
out[1] = a[1];
out[2] = a[2];
out[3] = a[3];
out[4] = a[4];
out[5] = a[5];
out[6] = a[6];
out[7] = a[7];
out[8] = a[8];
return out;
} | [
"function",
"copy",
"(",
"out",
",",
"a",
")",
"{",
"out",
"[",
"0",
"]",
"=",
"a",
"[",
"0",
"]",
";",
"out",
"[",
"1",
"]",
"=",
"a",
"[",
"1",
"]",
";",
"out",
"[",
"2",
"]",
"=",
"a",
"[",
"2",
"]",
";",
"out",
"[",
"3",
"]",
"=... | Copy the values from one mat3 to another
@param {mat3} out the receiving matrix
@param {mat3} a the source matrix
@returns {mat3} out | [
"Copy",
"the",
"values",
"from",
"one",
"mat3",
"to",
"another"
] | 55526ac5663b87cdc988fc579404df186603b2d9 | https://github.com/antvis/data-set/blob/55526ac5663b87cdc988fc579404df186603b2d9/demos/assets/g2.js#L16688-L16699 | train |
antvis/data-set | demos/assets/g2.js | fromValues | function fromValues(m00, m01, m02, m10, m11, m12, m20, m21, m22) {
var out = new glMatrix.ARRAY_TYPE(9);
out[0] = m00;
out[1] = m01;
out[2] = m02;
out[3] = m10;
out[4] = m11;
out[5] = m12;
out[6] = m20;
out[7] = m21;
out[8] = m22;
return out;
} | javascript | function fromValues(m00, m01, m02, m10, m11, m12, m20, m21, m22) {
var out = new glMatrix.ARRAY_TYPE(9);
out[0] = m00;
out[1] = m01;
out[2] = m02;
out[3] = m10;
out[4] = m11;
out[5] = m12;
out[6] = m20;
out[7] = m21;
out[8] = m22;
return out;
} | [
"function",
"fromValues",
"(",
"m00",
",",
"m01",
",",
"m02",
",",
"m10",
",",
"m11",
",",
"m12",
",",
"m20",
",",
"m21",
",",
"m22",
")",
"{",
"var",
"out",
"=",
"new",
"glMatrix",
".",
"ARRAY_TYPE",
"(",
"9",
")",
";",
"out",
"[",
"0",
"]",
... | Create a new mat3 with the given values
@param {Number} m00 Component in column 0, row 0 position (index 0)
@param {Number} m01 Component in column 0, row 1 position (index 1)
@param {Number} m02 Component in column 0, row 2 position (index 2)
@param {Number} m10 Component in column 1, row 0 position (index 3)
@param ... | [
"Create",
"a",
"new",
"mat3",
"with",
"the",
"given",
"values"
] | 55526ac5663b87cdc988fc579404df186603b2d9 | https://github.com/antvis/data-set/blob/55526ac5663b87cdc988fc579404df186603b2d9/demos/assets/g2.js#L16715-L16727 | train |
antvis/data-set | demos/assets/g2.js | set | function set(out, m00, m01, m02, m10, m11, m12, m20, m21, m22) {
out[0] = m00;
out[1] = m01;
out[2] = m02;
out[3] = m10;
out[4] = m11;
out[5] = m12;
out[6] = m20;
out[7] = m21;
out[8] = m22;
return out;
} | javascript | function set(out, m00, m01, m02, m10, m11, m12, m20, m21, m22) {
out[0] = m00;
out[1] = m01;
out[2] = m02;
out[3] = m10;
out[4] = m11;
out[5] = m12;
out[6] = m20;
out[7] = m21;
out[8] = m22;
return out;
} | [
"function",
"set",
"(",
"out",
",",
"m00",
",",
"m01",
",",
"m02",
",",
"m10",
",",
"m11",
",",
"m12",
",",
"m20",
",",
"m21",
",",
"m22",
")",
"{",
"out",
"[",
"0",
"]",
"=",
"m00",
";",
"out",
"[",
"1",
"]",
"=",
"m01",
";",
"out",
"[",... | Set the components of a mat3 to the given values
@param {mat3} out the receiving matrix
@param {Number} m00 Component in column 0, row 0 position (index 0)
@param {Number} m01 Component in column 0, row 1 position (index 1)
@param {Number} m02 Component in column 0, row 2 position (index 2)
@param {Number} m10 Compone... | [
"Set",
"the",
"components",
"of",
"a",
"mat3",
"to",
"the",
"given",
"values"
] | 55526ac5663b87cdc988fc579404df186603b2d9 | https://github.com/antvis/data-set/blob/55526ac5663b87cdc988fc579404df186603b2d9/demos/assets/g2.js#L16744-L16755 | train |
antvis/data-set | demos/assets/g2.js | identity | function identity(out) {
out[0] = 1;
out[1] = 0;
out[2] = 0;
out[3] = 0;
out[4] = 1;
out[5] = 0;
out[6] = 0;
out[7] = 0;
out[8] = 1;
return out;
} | javascript | function identity(out) {
out[0] = 1;
out[1] = 0;
out[2] = 0;
out[3] = 0;
out[4] = 1;
out[5] = 0;
out[6] = 0;
out[7] = 0;
out[8] = 1;
return out;
} | [
"function",
"identity",
"(",
"out",
")",
"{",
"out",
"[",
"0",
"]",
"=",
"1",
";",
"out",
"[",
"1",
"]",
"=",
"0",
";",
"out",
"[",
"2",
"]",
"=",
"0",
";",
"out",
"[",
"3",
"]",
"=",
"0",
";",
"out",
"[",
"4",
"]",
"=",
"1",
";",
"ou... | Set a mat3 to the identity matrix
@param {mat3} out the receiving matrix
@returns {mat3} out | [
"Set",
"a",
"mat3",
"to",
"the",
"identity",
"matrix"
] | 55526ac5663b87cdc988fc579404df186603b2d9 | https://github.com/antvis/data-set/blob/55526ac5663b87cdc988fc579404df186603b2d9/demos/assets/g2.js#L16763-L16774 | train |
antvis/data-set | demos/assets/g2.js | transpose | function transpose(out, a) {
// If we are transposing ourselves we can skip a few steps but have to cache some values
if (out === a) {
var a01 = a[1],
a02 = a[2],
a12 = a[5];
out[1] = a[3];
out[2] = a[6];
out[3] = a01;
out[5] = a[7];
out[6] = a02;
out[7] = a12;
} else {... | javascript | function transpose(out, a) {
// If we are transposing ourselves we can skip a few steps but have to cache some values
if (out === a) {
var a01 = a[1],
a02 = a[2],
a12 = a[5];
out[1] = a[3];
out[2] = a[6];
out[3] = a01;
out[5] = a[7];
out[6] = a02;
out[7] = a12;
} else {... | [
"function",
"transpose",
"(",
"out",
",",
"a",
")",
"{",
"// If we are transposing ourselves we can skip a few steps but have to cache some values",
"if",
"(",
"out",
"===",
"a",
")",
"{",
"var",
"a01",
"=",
"a",
"[",
"1",
"]",
",",
"a02",
"=",
"a",
"[",
"2",
... | Transpose the values of a mat3
@param {mat3} out the receiving matrix
@param {mat3} a the source matrix
@returns {mat3} out | [
"Transpose",
"the",
"values",
"of",
"a",
"mat3"
] | 55526ac5663b87cdc988fc579404df186603b2d9 | https://github.com/antvis/data-set/blob/55526ac5663b87cdc988fc579404df186603b2d9/demos/assets/g2.js#L16783-L16808 | train |
antvis/data-set | demos/assets/g2.js | multiply | function multiply(out, a, b) {
var a00 = a[0],
a01 = a[1],
a02 = a[2];
var a10 = a[3],
a11 = a[4],
a12 = a[5];
var a20 = a[6],
a21 = a[7],
a22 = a[8];
var b00 = b[0],
b01 = b[1],
b02 = b[2];
var b10 = b[3],
b11 = b[4],
b12 = b[5];
var b20 = b[6],
... | javascript | function multiply(out, a, b) {
var a00 = a[0],
a01 = a[1],
a02 = a[2];
var a10 = a[3],
a11 = a[4],
a12 = a[5];
var a20 = a[6],
a21 = a[7],
a22 = a[8];
var b00 = b[0],
b01 = b[1],
b02 = b[2];
var b10 = b[3],
b11 = b[4],
b12 = b[5];
var b20 = b[6],
... | [
"function",
"multiply",
"(",
"out",
",",
"a",
",",
"b",
")",
"{",
"var",
"a00",
"=",
"a",
"[",
"0",
"]",
",",
"a01",
"=",
"a",
"[",
"1",
"]",
",",
"a02",
"=",
"a",
"[",
"2",
"]",
";",
"var",
"a10",
"=",
"a",
"[",
"3",
"]",
",",
"a11",
... | Multiplies two mat3's
@param {mat3} out the receiving matrix
@param {mat3} a the first operand
@param {mat3} b the second operand
@returns {mat3} out | [
"Multiplies",
"two",
"mat3",
"s"
] | 55526ac5663b87cdc988fc579404df186603b2d9 | https://github.com/antvis/data-set/blob/55526ac5663b87cdc988fc579404df186603b2d9/demos/assets/g2.js#L16910-L16943 | train |
antvis/data-set | demos/assets/g2.js | rotate | function rotate(out, a, rad) {
var a00 = a[0],
a01 = a[1],
a02 = a[2],
a10 = a[3],
a11 = a[4],
a12 = a[5],
a20 = a[6],
a21 = a[7],
a22 = a[8],
s = Math.sin(rad),
c = Math.cos(rad);
out[0] = c * a00 + s * a10;
out[1] = c * a01 + s * a11;
out[2] = c * a... | javascript | function rotate(out, a, rad) {
var a00 = a[0],
a01 = a[1],
a02 = a[2],
a10 = a[3],
a11 = a[4],
a12 = a[5],
a20 = a[6],
a21 = a[7],
a22 = a[8],
s = Math.sin(rad),
c = Math.cos(rad);
out[0] = c * a00 + s * a10;
out[1] = c * a01 + s * a11;
out[2] = c * a... | [
"function",
"rotate",
"(",
"out",
",",
"a",
",",
"rad",
")",
"{",
"var",
"a00",
"=",
"a",
"[",
"0",
"]",
",",
"a01",
"=",
"a",
"[",
"1",
"]",
",",
"a02",
"=",
"a",
"[",
"2",
"]",
",",
"a10",
"=",
"a",
"[",
"3",
"]",
",",
"a11",
"=",
"... | Rotates a mat3 by the given angle
@param {mat3} out the receiving matrix
@param {mat3} a the matrix to rotate
@param {Number} rad the angle to rotate the matrix by
@returns {mat3} out | [
"Rotates",
"a",
"mat3",
"by",
"the",
"given",
"angle"
] | 55526ac5663b87cdc988fc579404df186603b2d9 | https://github.com/antvis/data-set/blob/55526ac5663b87cdc988fc579404df186603b2d9/demos/assets/g2.js#L16988-L17013 | train |
antvis/data-set | demos/assets/g2.js | scale | function scale(out, a, v) {
var x = v[0],
y = v[1];
out[0] = x * a[0];
out[1] = x * a[1];
out[2] = x * a[2];
out[3] = y * a[3];
out[4] = y * a[4];
out[5] = y * a[5];
out[6] = a[6];
out[7] = a[7];
out[8] = a[8];
return out;
} | javascript | function scale(out, a, v) {
var x = v[0],
y = v[1];
out[0] = x * a[0];
out[1] = x * a[1];
out[2] = x * a[2];
out[3] = y * a[3];
out[4] = y * a[4];
out[5] = y * a[5];
out[6] = a[6];
out[7] = a[7];
out[8] = a[8];
return out;
} | [
"function",
"scale",
"(",
"out",
",",
"a",
",",
"v",
")",
"{",
"var",
"x",
"=",
"v",
"[",
"0",
"]",
",",
"y",
"=",
"v",
"[",
"1",
"]",
";",
"out",
"[",
"0",
"]",
"=",
"x",
"*",
"a",
"[",
"0",
"]",
";",
"out",
"[",
"1",
"]",
"=",
"x"... | Scales the mat3 by the dimensions in the given vec2
@param {mat3} out the receiving matrix
@param {mat3} a the matrix to rotate
@param {vec2} v the vec2 to scale the matrix by
@returns {mat3} out | [
"Scales",
"the",
"mat3",
"by",
"the",
"dimensions",
"in",
"the",
"given",
"vec2"
] | 55526ac5663b87cdc988fc579404df186603b2d9 | https://github.com/antvis/data-set/blob/55526ac5663b87cdc988fc579404df186603b2d9/demos/assets/g2.js#L17023-L17039 | train |
antvis/data-set | demos/assets/g2.js | fromMat2d | function fromMat2d(out, a) {
out[0] = a[0];
out[1] = a[1];
out[2] = 0;
out[3] = a[2];
out[4] = a[3];
out[5] = 0;
out[6] = a[4];
out[7] = a[5];
out[8] = 1;
return out;
} | javascript | function fromMat2d(out, a) {
out[0] = a[0];
out[1] = a[1];
out[2] = 0;
out[3] = a[2];
out[4] = a[3];
out[5] = 0;
out[6] = a[4];
out[7] = a[5];
out[8] = 1;
return out;
} | [
"function",
"fromMat2d",
"(",
"out",
",",
"a",
")",
"{",
"out",
"[",
"0",
"]",
"=",
"a",
"[",
"0",
"]",
";",
"out",
"[",
"1",
"]",
"=",
"a",
"[",
"1",
"]",
";",
"out",
"[",
"2",
"]",
"=",
"0",
";",
"out",
"[",
"3",
"]",
"=",
"a",
"[",... | Copies the values from a mat2d into a mat3
@param {mat3} out the receiving matrix
@param {mat2d} a the matrix to copy
@returns {mat3} out | [
"Copies",
"the",
"values",
"from",
"a",
"mat2d",
"into",
"a",
"mat3"
] | 55526ac5663b87cdc988fc579404df186603b2d9 | https://github.com/antvis/data-set/blob/55526ac5663b87cdc988fc579404df186603b2d9/demos/assets/g2.js#L17127-L17140 | train |
antvis/data-set | demos/assets/g2.js | projection | function projection(out, width, height) {
out[0] = 2 / width;
out[1] = 0;
out[2] = 0;
out[3] = 0;
out[4] = -2 / height;
out[5] = 0;
out[6] = -1;
out[7] = 1;
out[8] = 1;
return out;
} | javascript | function projection(out, width, height) {
out[0] = 2 / width;
out[1] = 0;
out[2] = 0;
out[3] = 0;
out[4] = -2 / height;
out[5] = 0;
out[6] = -1;
out[7] = 1;
out[8] = 1;
return out;
} | [
"function",
"projection",
"(",
"out",
",",
"width",
",",
"height",
")",
"{",
"out",
"[",
"0",
"]",
"=",
"2",
"/",
"width",
";",
"out",
"[",
"1",
"]",
"=",
"0",
";",
"out",
"[",
"2",
"]",
"=",
"0",
";",
"out",
"[",
"3",
"]",
"=",
"0",
";",... | Generates a 2D projection matrix with the given bounds
@param {mat3} out mat3 frustum matrix will be written into
@param {number} width Width of your gl context
@param {number} height Height of gl context
@returns {mat3} out | [
"Generates",
"a",
"2D",
"projection",
"matrix",
"with",
"the",
"given",
"bounds"
] | 55526ac5663b87cdc988fc579404df186603b2d9 | https://github.com/antvis/data-set/blob/55526ac5663b87cdc988fc579404df186603b2d9/demos/assets/g2.js#L17254-L17265 | train |
antvis/data-set | demos/assets/g2.js | str | function str(a) {
return 'mat3(' + a[0] + ', ' + a[1] + ', ' + a[2] + ', ' + a[3] + ', ' + a[4] + ', ' + a[5] + ', ' + a[6] + ', ' + a[7] + ', ' + a[8] + ')';
} | javascript | function str(a) {
return 'mat3(' + a[0] + ', ' + a[1] + ', ' + a[2] + ', ' + a[3] + ', ' + a[4] + ', ' + a[5] + ', ' + a[6] + ', ' + a[7] + ', ' + a[8] + ')';
} | [
"function",
"str",
"(",
"a",
")",
"{",
"return",
"'mat3('",
"+",
"a",
"[",
"0",
"]",
"+",
"', '",
"+",
"a",
"[",
"1",
"]",
"+",
"', '",
"+",
"a",
"[",
"2",
"]",
"+",
"', '",
"+",
"a",
"[",
"3",
"]",
"+",
"', '",
"+",
"a",
"[",
"4",
"]",... | Returns a string representation of a mat3
@param {mat3} a matrix to represent as a string
@returns {String} string representation of the matrix | [
"Returns",
"a",
"string",
"representation",
"of",
"a",
"mat3"
] | 55526ac5663b87cdc988fc579404df186603b2d9 | https://github.com/antvis/data-set/blob/55526ac5663b87cdc988fc579404df186603b2d9/demos/assets/g2.js#L17273-L17275 | train |
antvis/data-set | demos/assets/g2.js | add | function add(out, a, b) {
out[0] = a[0] + b[0];
out[1] = a[1] + b[1];
out[2] = a[2] + b[2];
out[3] = a[3] + b[3];
out[4] = a[4] + b[4];
out[5] = a[5] + b[5];
out[6] = a[6] + b[6];
out[7] = a[7] + b[7];
out[8] = a[8] + b[8];
return out;
} | javascript | function add(out, a, b) {
out[0] = a[0] + b[0];
out[1] = a[1] + b[1];
out[2] = a[2] + b[2];
out[3] = a[3] + b[3];
out[4] = a[4] + b[4];
out[5] = a[5] + b[5];
out[6] = a[6] + b[6];
out[7] = a[7] + b[7];
out[8] = a[8] + b[8];
return out;
} | [
"function",
"add",
"(",
"out",
",",
"a",
",",
"b",
")",
"{",
"out",
"[",
"0",
"]",
"=",
"a",
"[",
"0",
"]",
"+",
"b",
"[",
"0",
"]",
";",
"out",
"[",
"1",
"]",
"=",
"a",
"[",
"1",
"]",
"+",
"b",
"[",
"1",
"]",
";",
"out",
"[",
"2",
... | Adds two mat3's
@param {mat3} out the receiving matrix
@param {mat3} a the first operand
@param {mat3} b the second operand
@returns {mat3} out | [
"Adds",
"two",
"mat3",
"s"
] | 55526ac5663b87cdc988fc579404df186603b2d9 | https://github.com/antvis/data-set/blob/55526ac5663b87cdc988fc579404df186603b2d9/demos/assets/g2.js#L17295-L17306 | train |
antvis/data-set | demos/assets/g2.js | subtract | function subtract(out, a, b) {
out[0] = a[0] - b[0];
out[1] = a[1] - b[1];
out[2] = a[2] - b[2];
out[3] = a[3] - b[3];
out[4] = a[4] - b[4];
out[5] = a[5] - b[5];
out[6] = a[6] - b[6];
out[7] = a[7] - b[7];
out[8] = a[8] - b[8];
return out;
} | javascript | function subtract(out, a, b) {
out[0] = a[0] - b[0];
out[1] = a[1] - b[1];
out[2] = a[2] - b[2];
out[3] = a[3] - b[3];
out[4] = a[4] - b[4];
out[5] = a[5] - b[5];
out[6] = a[6] - b[6];
out[7] = a[7] - b[7];
out[8] = a[8] - b[8];
return out;
} | [
"function",
"subtract",
"(",
"out",
",",
"a",
",",
"b",
")",
"{",
"out",
"[",
"0",
"]",
"=",
"a",
"[",
"0",
"]",
"-",
"b",
"[",
"0",
"]",
";",
"out",
"[",
"1",
"]",
"=",
"a",
"[",
"1",
"]",
"-",
"b",
"[",
"1",
"]",
";",
"out",
"[",
... | Subtracts matrix b from matrix a
@param {mat3} out the receiving matrix
@param {mat3} a the first operand
@param {mat3} b the second operand
@returns {mat3} out | [
"Subtracts",
"matrix",
"b",
"from",
"matrix",
"a"
] | 55526ac5663b87cdc988fc579404df186603b2d9 | https://github.com/antvis/data-set/blob/55526ac5663b87cdc988fc579404df186603b2d9/demos/assets/g2.js#L17316-L17327 | train |
antvis/data-set | demos/assets/g2.js | multiplyScalar | function multiplyScalar(out, a, b) {
out[0] = a[0] * b;
out[1] = a[1] * b;
out[2] = a[2] * b;
out[3] = a[3] * b;
out[4] = a[4] * b;
out[5] = a[5] * b;
out[6] = a[6] * b;
out[7] = a[7] * b;
out[8] = a[8] * b;
return out;
} | javascript | function multiplyScalar(out, a, b) {
out[0] = a[0] * b;
out[1] = a[1] * b;
out[2] = a[2] * b;
out[3] = a[3] * b;
out[4] = a[4] * b;
out[5] = a[5] * b;
out[6] = a[6] * b;
out[7] = a[7] * b;
out[8] = a[8] * b;
return out;
} | [
"function",
"multiplyScalar",
"(",
"out",
",",
"a",
",",
"b",
")",
"{",
"out",
"[",
"0",
"]",
"=",
"a",
"[",
"0",
"]",
"*",
"b",
";",
"out",
"[",
"1",
"]",
"=",
"a",
"[",
"1",
"]",
"*",
"b",
";",
"out",
"[",
"2",
"]",
"=",
"a",
"[",
"... | Multiply each element of the matrix by a scalar.
@param {mat3} out the receiving matrix
@param {mat3} a the matrix to scale
@param {Number} b amount to scale the matrix's elements by
@returns {mat3} out | [
"Multiply",
"each",
"element",
"of",
"the",
"matrix",
"by",
"a",
"scalar",
"."
] | 55526ac5663b87cdc988fc579404df186603b2d9 | https://github.com/antvis/data-set/blob/55526ac5663b87cdc988fc579404df186603b2d9/demos/assets/g2.js#L17337-L17348 | train |
antvis/data-set | demos/assets/g2.js | multiplyScalarAndAdd | function multiplyScalarAndAdd(out, a, b, scale) {
out[0] = a[0] + b[0] * scale;
out[1] = a[1] + b[1] * scale;
out[2] = a[2] + b[2] * scale;
out[3] = a[3] + b[3] * scale;
out[4] = a[4] + b[4] * scale;
out[5] = a[5] + b[5] * scale;
out[6] = a[6] + b[6] * scale;
out[7] = a[7] + b[7] * scale;
out[8] = a[8... | javascript | function multiplyScalarAndAdd(out, a, b, scale) {
out[0] = a[0] + b[0] * scale;
out[1] = a[1] + b[1] * scale;
out[2] = a[2] + b[2] * scale;
out[3] = a[3] + b[3] * scale;
out[4] = a[4] + b[4] * scale;
out[5] = a[5] + b[5] * scale;
out[6] = a[6] + b[6] * scale;
out[7] = a[7] + b[7] * scale;
out[8] = a[8... | [
"function",
"multiplyScalarAndAdd",
"(",
"out",
",",
"a",
",",
"b",
",",
"scale",
")",
"{",
"out",
"[",
"0",
"]",
"=",
"a",
"[",
"0",
"]",
"+",
"b",
"[",
"0",
"]",
"*",
"scale",
";",
"out",
"[",
"1",
"]",
"=",
"a",
"[",
"1",
"]",
"+",
"b"... | Adds two mat3's after multiplying each element of the second operand by a scalar value.
@param {mat3} out the receiving vector
@param {mat3} a the first operand
@param {mat3} b the second operand
@param {Number} scale the amount to scale b's elements by before adding
@returns {mat3} out | [
"Adds",
"two",
"mat3",
"s",
"after",
"multiplying",
"each",
"element",
"of",
"the",
"second",
"operand",
"by",
"a",
"scalar",
"value",
"."
] | 55526ac5663b87cdc988fc579404df186603b2d9 | https://github.com/antvis/data-set/blob/55526ac5663b87cdc988fc579404df186603b2d9/demos/assets/g2.js#L17359-L17370 | train |
antvis/data-set | demos/assets/g2.js | equals | function equals(a, b) {
var a0 = a[0],
a1 = a[1],
a2 = a[2],
a3 = a[3],
a4 = a[4],
a5 = a[5],
a6 = a[6],
a7 = a[7],
a8 = a[8];
var b0 = b[0],
b1 = b[1],
b2 = b[2],
b3 = b[3],
b4 = b[4],
b5 = b[5],
b6 = b[6],
b7 = b[7],
b... | javascript | function equals(a, b) {
var a0 = a[0],
a1 = a[1],
a2 = a[2],
a3 = a[3],
a4 = a[4],
a5 = a[5],
a6 = a[6],
a7 = a[7],
a8 = a[8];
var b0 = b[0],
b1 = b[1],
b2 = b[2],
b3 = b[3],
b4 = b[4],
b5 = b[5],
b6 = b[6],
b7 = b[7],
b... | [
"function",
"equals",
"(",
"a",
",",
"b",
")",
"{",
"var",
"a0",
"=",
"a",
"[",
"0",
"]",
",",
"a1",
"=",
"a",
"[",
"1",
"]",
",",
"a2",
"=",
"a",
"[",
"2",
"]",
",",
"a3",
"=",
"a",
"[",
"3",
"]",
",",
"a4",
"=",
"a",
"[",
"4",
"]"... | Returns whether or not the matrices have approximately the same elements in the same position.
@param {mat3} a The first matrix.
@param {mat3} b The second matrix.
@returns {Boolean} True if the matrices are equal, false otherwise. | [
"Returns",
"whether",
"or",
"not",
"the",
"matrices",
"have",
"approximately",
"the",
"same",
"elements",
"in",
"the",
"same",
"position",
"."
] | 55526ac5663b87cdc988fc579404df186603b2d9 | https://github.com/antvis/data-set/blob/55526ac5663b87cdc988fc579404df186603b2d9/demos/assets/g2.js#L17390-L17410 | train |
antvis/data-set | demos/assets/g2.js | add | function add(out, a, b) {
out[0] = a[0] + b[0];
out[1] = a[1] + b[1];
out[2] = a[2] + b[2];
return out;
} | javascript | function add(out, a, b) {
out[0] = a[0] + b[0];
out[1] = a[1] + b[1];
out[2] = a[2] + b[2];
return out;
} | [
"function",
"add",
"(",
"out",
",",
"a",
",",
"b",
")",
"{",
"out",
"[",
"0",
"]",
"=",
"a",
"[",
"0",
"]",
"+",
"b",
"[",
"0",
"]",
";",
"out",
"[",
"1",
"]",
"=",
"a",
"[",
"1",
"]",
"+",
"b",
"[",
"1",
"]",
";",
"out",
"[",
"2",
... | Adds two vec3's
@param {vec3} out the receiving vector
@param {vec3} a the first operand
@param {vec3} b the second operand
@returns {vec3} out | [
"Adds",
"two",
"vec3",
"s"
] | 55526ac5663b87cdc988fc579404df186603b2d9 | https://github.com/antvis/data-set/blob/55526ac5663b87cdc988fc579404df186603b2d9/demos/assets/g2.js#L17591-L17596 | train |
antvis/data-set | demos/assets/g2.js | subtract | function subtract(out, a, b) {
out[0] = a[0] - b[0];
out[1] = a[1] - b[1];
out[2] = a[2] - b[2];
return out;
} | javascript | function subtract(out, a, b) {
out[0] = a[0] - b[0];
out[1] = a[1] - b[1];
out[2] = a[2] - b[2];
return out;
} | [
"function",
"subtract",
"(",
"out",
",",
"a",
",",
"b",
")",
"{",
"out",
"[",
"0",
"]",
"=",
"a",
"[",
"0",
"]",
"-",
"b",
"[",
"0",
"]",
";",
"out",
"[",
"1",
"]",
"=",
"a",
"[",
"1",
"]",
"-",
"b",
"[",
"1",
"]",
";",
"out",
"[",
... | Subtracts vector b from vector a
@param {vec3} out the receiving vector
@param {vec3} a the first operand
@param {vec3} b the second operand
@returns {vec3} out | [
"Subtracts",
"vector",
"b",
"from",
"vector",
"a"
] | 55526ac5663b87cdc988fc579404df186603b2d9 | https://github.com/antvis/data-set/blob/55526ac5663b87cdc988fc579404df186603b2d9/demos/assets/g2.js#L17606-L17611 | train |
antvis/data-set | demos/assets/g2.js | multiply | function multiply(out, a, b) {
out[0] = a[0] * b[0];
out[1] = a[1] * b[1];
out[2] = a[2] * b[2];
return out;
} | javascript | function multiply(out, a, b) {
out[0] = a[0] * b[0];
out[1] = a[1] * b[1];
out[2] = a[2] * b[2];
return out;
} | [
"function",
"multiply",
"(",
"out",
",",
"a",
",",
"b",
")",
"{",
"out",
"[",
"0",
"]",
"=",
"a",
"[",
"0",
"]",
"*",
"b",
"[",
"0",
"]",
";",
"out",
"[",
"1",
"]",
"=",
"a",
"[",
"1",
"]",
"*",
"b",
"[",
"1",
"]",
";",
"out",
"[",
... | Multiplies two vec3's
@param {vec3} out the receiving vector
@param {vec3} a the first operand
@param {vec3} b the second operand
@returns {vec3} out | [
"Multiplies",
"two",
"vec3",
"s"
] | 55526ac5663b87cdc988fc579404df186603b2d9 | https://github.com/antvis/data-set/blob/55526ac5663b87cdc988fc579404df186603b2d9/demos/assets/g2.js#L17621-L17626 | train |
antvis/data-set | demos/assets/g2.js | ceil | function ceil(out, a) {
out[0] = Math.ceil(a[0]);
out[1] = Math.ceil(a[1]);
out[2] = Math.ceil(a[2]);
return out;
} | javascript | function ceil(out, a) {
out[0] = Math.ceil(a[0]);
out[1] = Math.ceil(a[1]);
out[2] = Math.ceil(a[2]);
return out;
} | [
"function",
"ceil",
"(",
"out",
",",
"a",
")",
"{",
"out",
"[",
"0",
"]",
"=",
"Math",
".",
"ceil",
"(",
"a",
"[",
"0",
"]",
")",
";",
"out",
"[",
"1",
"]",
"=",
"Math",
".",
"ceil",
"(",
"a",
"[",
"1",
"]",
")",
";",
"out",
"[",
"2",
... | Math.ceil the components of a vec3
@param {vec3} out the receiving vector
@param {vec3} a vector to ceil
@returns {vec3} out | [
"Math",
".",
"ceil",
"the",
"components",
"of",
"a",
"vec3"
] | 55526ac5663b87cdc988fc579404df186603b2d9 | https://github.com/antvis/data-set/blob/55526ac5663b87cdc988fc579404df186603b2d9/demos/assets/g2.js#L17650-L17655 | train |
antvis/data-set | demos/assets/g2.js | floor | function floor(out, a) {
out[0] = Math.floor(a[0]);
out[1] = Math.floor(a[1]);
out[2] = Math.floor(a[2]);
return out;
} | javascript | function floor(out, a) {
out[0] = Math.floor(a[0]);
out[1] = Math.floor(a[1]);
out[2] = Math.floor(a[2]);
return out;
} | [
"function",
"floor",
"(",
"out",
",",
"a",
")",
"{",
"out",
"[",
"0",
"]",
"=",
"Math",
".",
"floor",
"(",
"a",
"[",
"0",
"]",
")",
";",
"out",
"[",
"1",
"]",
"=",
"Math",
".",
"floor",
"(",
"a",
"[",
"1",
"]",
")",
";",
"out",
"[",
"2"... | Math.floor the components of a vec3
@param {vec3} out the receiving vector
@param {vec3} a vector to floor
@returns {vec3} out | [
"Math",
".",
"floor",
"the",
"components",
"of",
"a",
"vec3"
] | 55526ac5663b87cdc988fc579404df186603b2d9 | https://github.com/antvis/data-set/blob/55526ac5663b87cdc988fc579404df186603b2d9/demos/assets/g2.js#L17664-L17669 | train |
antvis/data-set | demos/assets/g2.js | round | function round(out, a) {
out[0] = Math.round(a[0]);
out[1] = Math.round(a[1]);
out[2] = Math.round(a[2]);
return out;
} | javascript | function round(out, a) {
out[0] = Math.round(a[0]);
out[1] = Math.round(a[1]);
out[2] = Math.round(a[2]);
return out;
} | [
"function",
"round",
"(",
"out",
",",
"a",
")",
"{",
"out",
"[",
"0",
"]",
"=",
"Math",
".",
"round",
"(",
"a",
"[",
"0",
"]",
")",
";",
"out",
"[",
"1",
"]",
"=",
"Math",
".",
"round",
"(",
"a",
"[",
"1",
"]",
")",
";",
"out",
"[",
"2"... | Math.round the components of a vec3
@param {vec3} out the receiving vector
@param {vec3} a vector to round
@returns {vec3} out | [
"Math",
".",
"round",
"the",
"components",
"of",
"a",
"vec3"
] | 55526ac5663b87cdc988fc579404df186603b2d9 | https://github.com/antvis/data-set/blob/55526ac5663b87cdc988fc579404df186603b2d9/demos/assets/g2.js#L17708-L17713 | train |
antvis/data-set | demos/assets/g2.js | scale | function scale(out, a, b) {
out[0] = a[0] * b;
out[1] = a[1] * b;
out[2] = a[2] * b;
return out;
} | javascript | function scale(out, a, b) {
out[0] = a[0] * b;
out[1] = a[1] * b;
out[2] = a[2] * b;
return out;
} | [
"function",
"scale",
"(",
"out",
",",
"a",
",",
"b",
")",
"{",
"out",
"[",
"0",
"]",
"=",
"a",
"[",
"0",
"]",
"*",
"b",
";",
"out",
"[",
"1",
"]",
"=",
"a",
"[",
"1",
"]",
"*",
"b",
";",
"out",
"[",
"2",
"]",
"=",
"a",
"[",
"2",
"]"... | Scales a vec3 by a scalar number
@param {vec3} out the receiving vector
@param {vec3} a the vector to scale
@param {Number} b amount to scale the vector by
@returns {vec3} out | [
"Scales",
"a",
"vec3",
"by",
"a",
"scalar",
"number"
] | 55526ac5663b87cdc988fc579404df186603b2d9 | https://github.com/antvis/data-set/blob/55526ac5663b87cdc988fc579404df186603b2d9/demos/assets/g2.js#L17723-L17728 | train |
antvis/data-set | demos/assets/g2.js | hermite | function hermite(out, a, b, c, d, t) {
var factorTimes2 = t * t;
var factor1 = factorTimes2 * (2 * t - 3) + 1;
var factor2 = factorTimes2 * (t - 2) + t;
var factor3 = factorTimes2 * (t - 1);
var factor4 = factorTimes2 * (3 - 2 * t);
out[0] = a[0] * factor1 + b[0] * factor2 + c[0] * factor3 + d[0] * factor4... | javascript | function hermite(out, a, b, c, d, t) {
var factorTimes2 = t * t;
var factor1 = factorTimes2 * (2 * t - 3) + 1;
var factor2 = factorTimes2 * (t - 2) + t;
var factor3 = factorTimes2 * (t - 1);
var factor4 = factorTimes2 * (3 - 2 * t);
out[0] = a[0] * factor1 + b[0] * factor2 + c[0] * factor3 + d[0] * factor4... | [
"function",
"hermite",
"(",
"out",
",",
"a",
",",
"b",
",",
"c",
",",
"d",
",",
"t",
")",
"{",
"var",
"factorTimes2",
"=",
"t",
"*",
"t",
";",
"var",
"factor1",
"=",
"factorTimes2",
"*",
"(",
"2",
"*",
"t",
"-",
"3",
")",
"+",
"1",
";",
"va... | Performs a hermite interpolation with two control points
@param {vec3} out the receiving vector
@param {vec3} a the first operand
@param {vec3} b the second operand
@param {vec3} c the third operand
@param {vec3} d the fourth operand
@param {Number} t interpolation amount, in the range [0-1], between the two inputs
@r... | [
"Performs",
"a",
"hermite",
"interpolation",
"with",
"two",
"control",
"points"
] | 55526ac5663b87cdc988fc579404df186603b2d9 | https://github.com/antvis/data-set/blob/55526ac5663b87cdc988fc579404df186603b2d9/demos/assets/g2.js#L17900-L17912 | train |
antvis/data-set | demos/assets/g2.js | rotate | function rotate(out, a, b, c) {
//Translate point to the origin
var p0 = a[0] - b[0],
p1 = a[1] - b[1],
sinC = Math.sin(c),
cosC = Math.cos(c);
//perform rotation and translate to correct position
out[0] = p0 * cosC - p1 * sinC + b[0];
out[1] = p0 * sinC + p1 * cosC + b[1];
return out;
} | javascript | function rotate(out, a, b, c) {
//Translate point to the origin
var p0 = a[0] - b[0],
p1 = a[1] - b[1],
sinC = Math.sin(c),
cosC = Math.cos(c);
//perform rotation and translate to correct position
out[0] = p0 * cosC - p1 * sinC + b[0];
out[1] = p0 * sinC + p1 * cosC + b[1];
return out;
} | [
"function",
"rotate",
"(",
"out",
",",
"a",
",",
"b",
",",
"c",
")",
"{",
"//Translate point to the origin",
"var",
"p0",
"=",
"a",
"[",
"0",
"]",
"-",
"b",
"[",
"0",
"]",
",",
"p1",
"=",
"a",
"[",
"1",
"]",
"-",
"b",
"[",
"1",
"]",
",",
"s... | Rotate a 2D vector
@param {vec2} out The receiving vec2
@param {vec2} a The vec2 point to rotate
@param {vec2} b The origin of the rotation
@param {Number} c The angle of rotation
@returns {vec2} out | [
"Rotate",
"a",
"2D",
"vector"
] | 55526ac5663b87cdc988fc579404df186603b2d9 | https://github.com/antvis/data-set/blob/55526ac5663b87cdc988fc579404df186603b2d9/demos/assets/g2.js#L18794-L18806 | train |
antvis/data-set | demos/assets/g2.js | angle | function angle(a, b) {
var x1 = a[0],
y1 = a[1],
x2 = b[0],
y2 = b[1];
var len1 = x1 * x1 + y1 * y1;
if (len1 > 0) {
//TODO: evaluate use of glm_invsqrt here?
len1 = 1 / Math.sqrt(len1);
}
var len2 = x2 * x2 + y2 * y2;
if (len2 > 0) {
//TODO: evaluate use of glm_invsqrt here?... | javascript | function angle(a, b) {
var x1 = a[0],
y1 = a[1],
x2 = b[0],
y2 = b[1];
var len1 = x1 * x1 + y1 * y1;
if (len1 > 0) {
//TODO: evaluate use of glm_invsqrt here?
len1 = 1 / Math.sqrt(len1);
}
var len2 = x2 * x2 + y2 * y2;
if (len2 > 0) {
//TODO: evaluate use of glm_invsqrt here?... | [
"function",
"angle",
"(",
"a",
",",
"b",
")",
"{",
"var",
"x1",
"=",
"a",
"[",
"0",
"]",
",",
"y1",
"=",
"a",
"[",
"1",
"]",
",",
"x2",
"=",
"b",
"[",
"0",
"]",
",",
"y2",
"=",
"b",
"[",
"1",
"]",
";",
"var",
"len1",
"=",
"x1",
"*",
... | Get the angle between two 2D vectors
@param {vec2} a The first operand
@param {vec2} b The second operand
@returns {Number} The angle in radians | [
"Get",
"the",
"angle",
"between",
"two",
"2D",
"vectors"
] | 55526ac5663b87cdc988fc579404df186603b2d9 | https://github.com/antvis/data-set/blob/55526ac5663b87cdc988fc579404df186603b2d9/demos/assets/g2.js#L18814-L18841 | train |
antvis/data-set | demos/assets/g2.js | flatten | function flatten(arr) {
if (!isArray(arr)) {
return arr;
}
var result = [];
each(arr, function (item) {
if (isArray(item)) {
each(item, function (subItem) {
result.push(subItem);
});
} else {
result.push(item);
}
});
return result;
} | javascript | function flatten(arr) {
if (!isArray(arr)) {
return arr;
}
var result = [];
each(arr, function (item) {
if (isArray(item)) {
each(item, function (subItem) {
result.push(subItem);
});
} else {
result.push(item);
}
});
return result;
} | [
"function",
"flatten",
"(",
"arr",
")",
"{",
"if",
"(",
"!",
"isArray",
"(",
"arr",
")",
")",
"{",
"return",
"arr",
";",
"}",
"var",
"result",
"=",
"[",
"]",
";",
"each",
"(",
"arr",
",",
"function",
"(",
"item",
")",
"{",
"if",
"(",
"isArray",... | Flattens `array` a single level deep.
@param {Array} arr The array to flatten.
@return {Array} Returns the new flattened array.
@example
_.flatten([1, [2, [3, [4]], 5]]); // => [1, 2, [3, [4]], 5] | [
"Flattens",
"array",
"a",
"single",
"level",
"deep",
"."
] | 55526ac5663b87cdc988fc579404df186603b2d9 | https://github.com/antvis/data-set/blob/55526ac5663b87cdc988fc579404df186603b2d9/demos/assets/g2.js#L22323-L22338 | train |
antvis/data-set | demos/assets/g2.js | pick | function pick(object, keys) {
if (object === null || !isPlaineObject(object)) {
return {};
}
var result = {};
each(keys, function (key) {
if (hasOwnProperty.call(object, key)) {
result[key] = object[key];
}
});
return result;
} | javascript | function pick(object, keys) {
if (object === null || !isPlaineObject(object)) {
return {};
}
var result = {};
each(keys, function (key) {
if (hasOwnProperty.call(object, key)) {
result[key] = object[key];
}
});
return result;
} | [
"function",
"pick",
"(",
"object",
",",
"keys",
")",
"{",
"if",
"(",
"object",
"===",
"null",
"||",
"!",
"isPlaineObject",
"(",
"object",
")",
")",
"{",
"return",
"{",
"}",
";",
"}",
"var",
"result",
"=",
"{",
"}",
";",
"each",
"(",
"keys",
",",
... | Creates an object composed of the picked `object` properties.
@param {Object} object The source object.
@param {...(string|string[])} [paths] The property paths to pick.
@returns {Object} Returns the new object.
@example
var object = { 'a': 1, 'b': '2', 'c': 3 };
pick(object, ['a', 'c']); // => { 'a': 1, 'c': 3 } | [
"Creates",
"an",
"object",
"composed",
"of",
"the",
"picked",
"object",
"properties",
"."
] | 55526ac5663b87cdc988fc579404df186603b2d9 | https://github.com/antvis/data-set/blob/55526ac5663b87cdc988fc579404df186603b2d9/demos/assets/g2.js#L23319-L23330 | train |
antvis/data-set | demos/assets/g2.js | getPath | function getPath(cfg, smooth) {
var path = void 0;
var points = cfg.points;
var isInCircle = cfg.isInCircle;
var first = points[0];
if (Util.isArray(first.y)) {
path = getRangePath(points, smooth, isInCircle, cfg);
} else {
path = getSinglePath(points, smooth, isInCircle, cfg);
}
return path;
} | javascript | function getPath(cfg, smooth) {
var path = void 0;
var points = cfg.points;
var isInCircle = cfg.isInCircle;
var first = points[0];
if (Util.isArray(first.y)) {
path = getRangePath(points, smooth, isInCircle, cfg);
} else {
path = getSinglePath(points, smooth, isInCircle, cfg);
}
return path;
} | [
"function",
"getPath",
"(",
"cfg",
",",
"smooth",
")",
"{",
"var",
"path",
"=",
"void",
"0",
";",
"var",
"points",
"=",
"cfg",
".",
"points",
";",
"var",
"isInCircle",
"=",
"cfg",
".",
"isInCircle",
";",
"var",
"first",
"=",
"points",
"[",
"0",
"]"... | get line path | [
"get",
"line",
"path"
] | 55526ac5663b87cdc988fc579404df186603b2d9 | https://github.com/antvis/data-set/blob/55526ac5663b87cdc988fc579404df186603b2d9/demos/assets/g2.js#L39845-L39856 | train |
brightcove/hot-shots | lib/statsFunctions.js | hrtimer | function hrtimer() {
const start = process.hrtime();
return () => {
const durationComponents = process.hrtime(start);
const seconds = durationComponents[0];
const nanoseconds = durationComponents[1];
const duration = (seconds * 1000) + (nanoseconds / 1E6);
return duration;
};
... | javascript | function hrtimer() {
const start = process.hrtime();
return () => {
const durationComponents = process.hrtime(start);
const seconds = durationComponents[0];
const nanoseconds = durationComponents[1];
const duration = (seconds * 1000) + (nanoseconds / 1E6);
return duration;
};
... | [
"function",
"hrtimer",
"(",
")",
"{",
"const",
"start",
"=",
"process",
".",
"hrtime",
"(",
")",
";",
"return",
"(",
")",
"=>",
"{",
"const",
"durationComponents",
"=",
"process",
".",
"hrtime",
"(",
"start",
")",
";",
"const",
"seconds",
"=",
"duratio... | High-resolution timer | [
"High",
"-",
"resolution",
"timer"
] | 8042839d9f51f68d319fcb9b6e6eee5f75e77423 | https://github.com/brightcove/hot-shots/blob/8042839d9f51f68d319fcb9b6e6eee5f75e77423/lib/statsFunctions.js#L80-L90 | train |
brightcove/hot-shots | lib/helpers.js | sanitizeTags | function sanitizeTags(value, telegraf) {
const blacklist = telegraf ? /:|\|/g : /:|\||@|,/g;
// Replace reserved chars with underscores.
return String(value).replace(blacklist, '_');
} | javascript | function sanitizeTags(value, telegraf) {
const blacklist = telegraf ? /:|\|/g : /:|\||@|,/g;
// Replace reserved chars with underscores.
return String(value).replace(blacklist, '_');
} | [
"function",
"sanitizeTags",
"(",
"value",
",",
"telegraf",
")",
"{",
"const",
"blacklist",
"=",
"telegraf",
"?",
"/",
":|\\|",
"/",
"g",
":",
"/",
":|\\||@|,",
"/",
"g",
";",
"// Replace reserved chars with underscores.",
"return",
"String",
"(",
"value",
")",... | Replace any characters that can't be sent on with an underscore | [
"Replace",
"any",
"characters",
"that",
"can",
"t",
"be",
"sent",
"on",
"with",
"an",
"underscore"
] | 8042839d9f51f68d319fcb9b6e6eee5f75e77423 | https://github.com/brightcove/hot-shots/blob/8042839d9f51f68d319fcb9b6e6eee5f75e77423/lib/helpers.js#L6-L10 | train |
brightcove/hot-shots | lib/helpers.js | formatTags | function formatTags(tags, telegraf) {
if (Array.isArray(tags)) {
return tags;
} else {
return Object.keys(tags).map(key => {
return `${sanitizeTags(key, telegraf)}:${sanitizeTags(tags[key], telegraf)}`;
});
}
} | javascript | function formatTags(tags, telegraf) {
if (Array.isArray(tags)) {
return tags;
} else {
return Object.keys(tags).map(key => {
return `${sanitizeTags(key, telegraf)}:${sanitizeTags(tags[key], telegraf)}`;
});
}
} | [
"function",
"formatTags",
"(",
"tags",
",",
"telegraf",
")",
"{",
"if",
"(",
"Array",
".",
"isArray",
"(",
"tags",
")",
")",
"{",
"return",
"tags",
";",
"}",
"else",
"{",
"return",
"Object",
".",
"keys",
"(",
"tags",
")",
".",
"map",
"(",
"key",
... | Format tags properly before sending on | [
"Format",
"tags",
"properly",
"before",
"sending",
"on"
] | 8042839d9f51f68d319fcb9b6e6eee5f75e77423 | https://github.com/brightcove/hot-shots/blob/8042839d9f51f68d319fcb9b6e6eee5f75e77423/lib/helpers.js#L15-L24 | train |
brightcove/hot-shots | lib/helpers.js | formatDate | function formatDate(date) {
let timestamp;
if (date instanceof Date) {
// Datadog expects seconds.
timestamp = Math.round(date.getTime() / 1000);
} else if (date instanceof Number) {
// Make sure it is an integer, not a float.
timestamp = Math.round(date);
}
return timestamp;
} | javascript | function formatDate(date) {
let timestamp;
if (date instanceof Date) {
// Datadog expects seconds.
timestamp = Math.round(date.getTime() / 1000);
} else if (date instanceof Number) {
// Make sure it is an integer, not a float.
timestamp = Math.round(date);
}
return timestamp;
} | [
"function",
"formatDate",
"(",
"date",
")",
"{",
"let",
"timestamp",
";",
"if",
"(",
"date",
"instanceof",
"Date",
")",
"{",
"// Datadog expects seconds.",
"timestamp",
"=",
"Math",
".",
"round",
"(",
"date",
".",
"getTime",
"(",
")",
"/",
"1000",
")",
"... | Formats a date for use with DataDog | [
"Formats",
"a",
"date",
"for",
"use",
"with",
"DataDog"
] | 8042839d9f51f68d319fcb9b6e6eee5f75e77423 | https://github.com/brightcove/hot-shots/blob/8042839d9f51f68d319fcb9b6e6eee5f75e77423/lib/helpers.js#L63-L73 | train |
brightcove/hot-shots | lib/helpers.js | intToIP | function intToIP(int) {
const part1 = int & 255;
const part2 = ((int >> 8) & 255);
const part3 = ((int >> 16) & 255);
const part4 = ((int >> 24) & 255);
return `${part4}.${part3}.${part2}.${part1}`;
} | javascript | function intToIP(int) {
const part1 = int & 255;
const part2 = ((int >> 8) & 255);
const part3 = ((int >> 16) & 255);
const part4 = ((int >> 24) & 255);
return `${part4}.${part3}.${part2}.${part1}`;
} | [
"function",
"intToIP",
"(",
"int",
")",
"{",
"const",
"part1",
"=",
"int",
"&",
"255",
";",
"const",
"part2",
"=",
"(",
"(",
"int",
">>",
"8",
")",
"&",
"255",
")",
";",
"const",
"part3",
"=",
"(",
"(",
"int",
">>",
"16",
")",
"&",
"255",
")"... | Converts int to a string IP | [
"Converts",
"int",
"to",
"a",
"string",
"IP"
] | 8042839d9f51f68d319fcb9b6e6eee5f75e77423 | https://github.com/brightcove/hot-shots/blob/8042839d9f51f68d319fcb9b6e6eee5f75e77423/lib/helpers.js#L78-L85 | train |
brightcove/hot-shots | lib/helpers.js | getDefaultRoute | function getDefaultRoute() {
try {
const fileContents = fs.readFileSync('/proc/net/route', 'utf8'); // eslint-disable-line no-sync
const routes = fileContents.split('\n');
for (const routeIdx in routes) {
const fields = routes[routeIdx].trim().split('\t');
if (fields[1] === '00000000') {
... | javascript | function getDefaultRoute() {
try {
const fileContents = fs.readFileSync('/proc/net/route', 'utf8'); // eslint-disable-line no-sync
const routes = fileContents.split('\n');
for (const routeIdx in routes) {
const fields = routes[routeIdx].trim().split('\t');
if (fields[1] === '00000000') {
... | [
"function",
"getDefaultRoute",
"(",
")",
"{",
"try",
"{",
"const",
"fileContents",
"=",
"fs",
".",
"readFileSync",
"(",
"'/proc/net/route'",
",",
"'utf8'",
")",
";",
"// eslint-disable-line no-sync",
"const",
"routes",
"=",
"fileContents",
".",
"split",
"(",
"'\... | Returns the system default interface on Linux | [
"Returns",
"the",
"system",
"default",
"interface",
"on",
"Linux"
] | 8042839d9f51f68d319fcb9b6e6eee5f75e77423 | https://github.com/brightcove/hot-shots/blob/8042839d9f51f68d319fcb9b6e6eee5f75e77423/lib/helpers.js#L90-L107 | train |
brightcove/hot-shots | lib/statsd.js | onSend | function onSend(error, bytes) {
completed += 1;
if (calledback) {
return;
}
if (error) {
if (typeof callback === 'function') {
calledback = true;
callback(error);
} else if (self.errorHandler) {
calledback = true;
self.errorHandler(error);
}
... | javascript | function onSend(error, bytes) {
completed += 1;
if (calledback) {
return;
}
if (error) {
if (typeof callback === 'function') {
calledback = true;
callback(error);
} else if (self.errorHandler) {
calledback = true;
self.errorHandler(error);
}
... | [
"function",
"onSend",
"(",
"error",
",",
"bytes",
")",
"{",
"completed",
"+=",
"1",
";",
"if",
"(",
"calledback",
")",
"{",
"return",
";",
"}",
"if",
"(",
"error",
")",
"{",
"if",
"(",
"typeof",
"callback",
"===",
"'function'",
")",
"{",
"calledback"... | Gets called once for each callback, when all callbacks return we will
call back from the function
@private | [
"Gets",
"called",
"once",
"for",
"each",
"callback",
"when",
"all",
"callbacks",
"return",
"we",
"will",
"call",
"back",
"from",
"the",
"function"
] | 8042839d9f51f68d319fcb9b6e6eee5f75e77423 | https://github.com/brightcove/hot-shots/blob/8042839d9f51f68d319fcb9b6e6eee5f75e77423/lib/statsd.js#L171-L195 | train |
sarriaroman/FabricPlugin | hooks/lib/utilities.js | getBuildGradlePath | function getBuildGradlePath() {
var target = path.join("platforms", "android", "app", "build.gradle");
if (fs.existsSync(target)) {
return target;
}
return path.join("platforms", "android", "build.gradle");
} | javascript | function getBuildGradlePath() {
var target = path.join("platforms", "android", "app", "build.gradle");
if (fs.existsSync(target)) {
return target;
}
return path.join("platforms", "android", "build.gradle");
} | [
"function",
"getBuildGradlePath",
"(",
")",
"{",
"var",
"target",
"=",
"path",
".",
"join",
"(",
"\"platforms\"",
",",
"\"android\"",
",",
"\"app\"",
",",
"\"build.gradle\"",
")",
";",
"if",
"(",
"fs",
".",
"existsSync",
"(",
"target",
")",
")",
"{",
"re... | Used to get the path to the build.gradle file for the Android project.
@returns {string} The path to the build.gradle file. | [
"Used",
"to",
"get",
"the",
"path",
"to",
"the",
"build",
".",
"gradle",
"file",
"for",
"the",
"Android",
"project",
"."
] | 9363a290e071ccd262da9d718aaf5a10a284e144 | https://github.com/sarriaroman/FabricPlugin/blob/9363a290e071ccd262da9d718aaf5a10a284e144/hooks/lib/utilities.js#L14-L21 | train |
sarriaroman/FabricPlugin | hooks/lib/utilities.js | function(platform) {
var platformConfigPath = path.join("..", "..", "..", platform + ".json");
var platformConfig = require(platformConfigPath);
var pluginId = this.getPluginId();
var apiKey = platformConfig.installed_plugins[pluginId].FABRIC_API_KEY;
var apiSecret = platform... | javascript | function(platform) {
var platformConfigPath = path.join("..", "..", "..", platform + ".json");
var platformConfig = require(platformConfigPath);
var pluginId = this.getPluginId();
var apiKey = platformConfig.installed_plugins[pluginId].FABRIC_API_KEY;
var apiSecret = platform... | [
"function",
"(",
"platform",
")",
"{",
"var",
"platformConfigPath",
"=",
"path",
".",
"join",
"(",
"\"..\"",
",",
"\"..\"",
",",
"\"..\"",
",",
"platform",
"+",
"\".json\"",
")",
";",
"var",
"platformConfig",
"=",
"require",
"(",
"platformConfigPath",
")",
... | Used to get the plugin configuration for the given platform.
The plugin configuration object will have the API and secret keys
for the Fabric.io service that were specified when the plugin
was installed.
This configuration is obtained from, where "ios" is the platform name:
platforms/ios/ios.json
@param {string} pla... | [
"Used",
"to",
"get",
"the",
"plugin",
"configuration",
"for",
"the",
"given",
"platform",
"."
] | 9363a290e071ccd262da9d718aaf5a10a284e144 | https://github.com/sarriaroman/FabricPlugin/blob/9363a290e071ccd262da9d718aaf5a10a284e144/hooks/lib/utilities.js#L57-L74 | train | |
abodelot/jquery.json-viewer | json-viewer/jquery.json-viewer.js | json2html | function json2html(json, options) {
var html = '';
if (typeof json === 'string') {
// Escape tags
json = json.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>');
if (options.withLinks && isUrl(json)) {
html += '<a href="' + json + '" class="json-string" target="_blank">... | javascript | function json2html(json, options) {
var html = '';
if (typeof json === 'string') {
// Escape tags
json = json.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>');
if (options.withLinks && isUrl(json)) {
html += '<a href="' + json + '" class="json-string" target="_blank">... | [
"function",
"json2html",
"(",
"json",
",",
"options",
")",
"{",
"var",
"html",
"=",
"''",
";",
"if",
"(",
"typeof",
"json",
"===",
"'string'",
")",
"{",
"// Escape tags",
"json",
"=",
"json",
".",
"replace",
"(",
"/",
"&",
"/",
"g",
",",
"'&'",
... | Transform a json object into html representation
@return string | [
"Transform",
"a",
"json",
"object",
"into",
"html",
"representation"
] | 72ded3f50ffbed28e304ad4fc761b2f3ac562506 | https://github.com/abodelot/jquery.json-viewer/blob/72ded3f50ffbed28e304ad4fc761b2f3ac562506/json-viewer/jquery.json-viewer.js#L29-L94 | train |
FormidableLabs/builder | lib/config.js | function () {
return _.map([].concat(this.pkgs, this.devPkgs), function (pkg) {
return path.join(pkg.path, "node_modules/.bin");
});
} | javascript | function () {
return _.map([].concat(this.pkgs, this.devPkgs), function (pkg) {
return path.join(pkg.path, "node_modules/.bin");
});
} | [
"function",
"(",
")",
"{",
"return",
"_",
".",
"map",
"(",
"[",
"]",
".",
"concat",
"(",
"this",
".",
"pkgs",
",",
"this",
".",
"devPkgs",
")",
",",
"function",
"(",
"pkg",
")",
"{",
"return",
"path",
".",
"join",
"(",
"pkg",
".",
"path",
",",
... | Return `.bin` paths for archetypes in configured order.
@returns {Array} Archetype bin paths | [
"Return",
".",
"bin",
"paths",
"for",
"archetypes",
"in",
"configured",
"order",
"."
] | 7dc928ff3adf76f810f11358058cc32e27fd3d1c | https://github.com/FormidableLabs/builder/blob/7dc928ff3adf76f810f11358058cc32e27fd3d1c/lib/config.js#L307-L311 | train | |
FormidableLabs/builder | lib/config.js | function () {
var pkgs = this.pkgs;
var configNames = _.chain(pkgs)
.map(function (pkg) { return _.keys(pkg.config); })
.flatten()
.uniq()
.value();
// Take "first" config value in arrays as "winning" value.
return _.chain(configNames)
.map(function (name... | javascript | function () {
var pkgs = this.pkgs;
var configNames = _.chain(pkgs)
.map(function (pkg) { return _.keys(pkg.config); })
.flatten()
.uniq()
.value();
// Take "first" config value in arrays as "winning" value.
return _.chain(configNames)
.map(function (name... | [
"function",
"(",
")",
"{",
"var",
"pkgs",
"=",
"this",
".",
"pkgs",
";",
"var",
"configNames",
"=",
"_",
".",
"chain",
"(",
"pkgs",
")",
".",
"map",
"(",
"function",
"(",
"pkg",
")",
"{",
"return",
"_",
".",
"keys",
"(",
"pkg",
".",
"config",
"... | Return object of resolved package.json config fields.
Resolves in order of "root wins", then in reverse archetype order.
@returns {Object} environment object. | [
"Return",
"object",
"of",
"resolved",
"package",
".",
"json",
"config",
"fields",
"."
] | 7dc928ff3adf76f810f11358058cc32e27fd3d1c | https://github.com/FormidableLabs/builder/blob/7dc928ff3adf76f810f11358058cc32e27fd3d1c/lib/config.js#L335-L356 | train | |
FormidableLabs/builder | lib/args.js | function (flagKey) {
var flags = _.isUndefined(flagKey) ? FLAGS.general : FLAGS[flagKey];
return !flags ? "" : _.map(flags, function (val, key) {
return chalk.cyan("--" + key) + ": " + val.desc;
}).join("\n\n ");
} | javascript | function (flagKey) {
var flags = _.isUndefined(flagKey) ? FLAGS.general : FLAGS[flagKey];
return !flags ? "" : _.map(flags, function (val, key) {
return chalk.cyan("--" + key) + ": " + val.desc;
}).join("\n\n ");
} | [
"function",
"(",
"flagKey",
")",
"{",
"var",
"flags",
"=",
"_",
".",
"isUndefined",
"(",
"flagKey",
")",
"?",
"FLAGS",
".",
"general",
":",
"FLAGS",
"[",
"flagKey",
"]",
";",
"return",
"!",
"flags",
"?",
"\"\"",
":",
"_",
".",
"map",
"(",
"flags",
... | Retrieve help.
@param {String} flagKey Key of flags to return or `undefined` for general
@returns {String} Help string | [
"Retrieve",
"help",
"."
] | 7dc928ff3adf76f810f11358058cc32e27fd3d1c | https://github.com/FormidableLabs/builder/blob/7dc928ff3adf76f810f11358058cc32e27fd3d1c/lib/args.js#L138-L144 | train | |
eclipse/orion.client | bundles/org.eclipse.orion.client.cf/web/orion/cfui/cFClient.js | function(url, org, space) {
var targetObject = {
'Url': url
};
if (org) targetObject.Org = org;
if (space) targetObject.Space = space;
return this._xhrV1("POST", require.toUrl("cfapi/target"), targetObject);
} | javascript | function(url, org, space) {
var targetObject = {
'Url': url
};
if (org) targetObject.Org = org;
if (space) targetObject.Space = space;
return this._xhrV1("POST", require.toUrl("cfapi/target"), targetObject);
} | [
"function",
"(",
"url",
",",
"org",
",",
"space",
")",
"{",
"var",
"targetObject",
"=",
"{",
"'Url'",
":",
"url",
"}",
";",
"if",
"(",
"org",
")",
"targetObject",
".",
"Org",
"=",
"org",
";",
"if",
"(",
"space",
")",
"targetObject",
".",
"Space",
... | Target CF v2 operations | [
"Target",
"CF",
"v2",
"operations"
] | eb2583100c662b5cfc1b461a978b31d3b8555ce1 | https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.cf/web/orion/cfui/cFClient.js#L100-L108 | train | |
eclipse/orion.client | bundles/org.eclipse.orion.client.cf/web/orion/cfui/cFClient.js | function(target, name, contentLocation, manifest, packager, instrumentation) {
var pushReq = {};
if (name)
pushReq.Name = name;
if (contentLocation)
pushReq.ContentLocation = contentLocation;
if (target)
pushReq.Target = target;
if(manifest)
pushReq.Manifest = manifest;
... | javascript | function(target, name, contentLocation, manifest, packager, instrumentation) {
var pushReq = {};
if (name)
pushReq.Name = name;
if (contentLocation)
pushReq.ContentLocation = contentLocation;
if (target)
pushReq.Target = target;
if(manifest)
pushReq.Manifest = manifest;
... | [
"function",
"(",
"target",
",",
"name",
",",
"contentLocation",
",",
"manifest",
",",
"packager",
",",
"instrumentation",
")",
"{",
"var",
"pushReq",
"=",
"{",
"}",
";",
"if",
"(",
"name",
")",
"pushReq",
".",
"Name",
"=",
"name",
";",
"if",
"(",
"co... | Apps CF v2 operations | [
"Apps",
"CF",
"v2",
"operations"
] | eb2583100c662b5cfc1b461a978b31d3b8555ce1 | https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.cf/web/orion/cfui/cFClient.js#L154-L176 | train | |
eclipse/orion.client | bundles/org.eclipse.orion.client.editor/web/orion/editor/textModel.js | TextModel | function TextModel(text, lineDelimiter) {
this._lastLineIndex = -1;
this._text = [""];
this._lineOffsets = [0];
this.setText(text);
this.setLineDelimiter(lineDelimiter);
} | javascript | function TextModel(text, lineDelimiter) {
this._lastLineIndex = -1;
this._text = [""];
this._lineOffsets = [0];
this.setText(text);
this.setLineDelimiter(lineDelimiter);
} | [
"function",
"TextModel",
"(",
"text",
",",
"lineDelimiter",
")",
"{",
"this",
".",
"_lastLineIndex",
"=",
"-",
"1",
";",
"this",
".",
"_text",
"=",
"[",
"\"\"",
"]",
";",
"this",
".",
"_lineOffsets",
"=",
"[",
"0",
"]",
";",
"this",
".",
"setText",
... | Constructs a new TextModel with the given text and default line delimiter.
@param {String} [text=""] the text that the model will store
@param {String} [lineDelimiter=platform delimiter] the line delimiter used when inserting new lines to the model.
@name orion.editor.TextModel
@class The TextModel is an interface th... | [
"Constructs",
"a",
"new",
"TextModel",
"with",
"the",
"given",
"text",
"and",
"default",
"line",
"delimiter",
"."
] | eb2583100c662b5cfc1b461a978b31d3b8555ce1 | https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.editor/web/orion/editor/textModel.js#L37-L43 | train |
eclipse/orion.client | bundles/org.eclipse.orion.client.editor/web/orion/editor/textModel.js | function() {
var count = 0;
for (var i = 0; i<this._text.length; i++) {
count += this._text[i].length;
}
return count;
} | javascript | function() {
var count = 0;
for (var i = 0; i<this._text.length; i++) {
count += this._text[i].length;
}
return count;
} | [
"function",
"(",
")",
"{",
"var",
"count",
"=",
"0",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"this",
".",
"_text",
".",
"length",
";",
"i",
"++",
")",
"{",
"count",
"+=",
"this",
".",
"_text",
"[",
"i",
"]",
".",
"length",
";"... | Returns the number of characters in the model.
@returns {Number} the number of characters in the model. | [
"Returns",
"the",
"number",
"of",
"characters",
"in",
"the",
"model",
"."
] | eb2583100c662b5cfc1b461a978b31d3b8555ce1 | https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.editor/web/orion/editor/textModel.js#L231-L237 | train | |
eclipse/orion.client | releng/org.eclipse.orion.client.releng/builder/scripts/helpers.js | getBundles | function getBundles(buildObj) {
var _self = self;
var bundles = (buildObj.bundles || []);
return bundles.map(function(bundle) {
bundle = project.replaceProperties(bundle);
var dir = project.resolveFile(bundle + Packages.java.io.File.separator + "web");
if (!dir.exists() || !dir.isDirectory()) {
_self... | javascript | function getBundles(buildObj) {
var _self = self;
var bundles = (buildObj.bundles || []);
return bundles.map(function(bundle) {
bundle = project.replaceProperties(bundle);
var dir = project.resolveFile(bundle + Packages.java.io.File.separator + "web");
if (!dir.exists() || !dir.isDirectory()) {
_self... | [
"function",
"getBundles",
"(",
"buildObj",
")",
"{",
"var",
"_self",
"=",
"self",
";",
"var",
"bundles",
"=",
"(",
"buildObj",
".",
"bundles",
"||",
"[",
"]",
")",
";",
"return",
"bundles",
".",
"map",
"(",
"function",
"(",
"bundle",
")",
"{",
"bundl... | Returns bundle info from the build config.
@param {Object} buildObj The build config object
@returns { name: string, web: java.io.File }[] Array of bundle info objects. | [
"Returns",
"bundle",
"info",
"from",
"the",
"build",
"config",
"."
] | eb2583100c662b5cfc1b461a978b31d3b8555ce1 | https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/releng/org.eclipse.orion.client.releng/builder/scripts/helpers.js#L97-L112 | train |
eclipse/orion.client | bundles/org.eclipse.orion.client.editor/web/orion/editor/AsyncStyler.js | function() {
if (this.textView) {
this.textView.removeEventListener("ModelChanging", this.listener.onModelChanging);
this.textView.removeEventListener("ModelChanged", this.listener.onModelChanged);
this.textView.removeEventListener("Destroy", this.listener.onDestroy);
this.textView.removeEventListene... | javascript | function() {
if (this.textView) {
this.textView.removeEventListener("ModelChanging", this.listener.onModelChanging);
this.textView.removeEventListener("ModelChanged", this.listener.onModelChanged);
this.textView.removeEventListener("Destroy", this.listener.onDestroy);
this.textView.removeEventListene... | [
"function",
"(",
")",
"{",
"if",
"(",
"this",
".",
"textView",
")",
"{",
"this",
".",
"textView",
".",
"removeEventListener",
"(",
"\"ModelChanging\"",
",",
"this",
".",
"listener",
".",
"onModelChanging",
")",
";",
"this",
".",
"textView",
".",
"removeEve... | Deactivates this styler and removes any listeners it registered. | [
"Deactivates",
"this",
"styler",
"and",
"removes",
"any",
"listeners",
"it",
"registered",
"."
] | eb2583100c662b5cfc1b461a978b31d3b8555ce1 | https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.editor/web/orion/editor/AsyncStyler.js#L105-L126 | train | |
eclipse/orion.client | modules/orionode/lib/api.js | sendStatus | function sendStatus(code, res){
try{
if (httpCodeMapping) {
code = mapHttpStatusCode(code);
}
addStrictTransportHeaders(res);
setResponseNoCache(res);
return res.sendStatus(code);
}catch(err){
logger.error(res.req.originalUrl , err.message);
throw err;
}
} | javascript | function sendStatus(code, res){
try{
if (httpCodeMapping) {
code = mapHttpStatusCode(code);
}
addStrictTransportHeaders(res);
setResponseNoCache(res);
return res.sendStatus(code);
}catch(err){
logger.error(res.req.originalUrl , err.message);
throw err;
}
} | [
"function",
"sendStatus",
"(",
"code",
",",
"res",
")",
"{",
"try",
"{",
"if",
"(",
"httpCodeMapping",
")",
"{",
"code",
"=",
"mapHttpStatusCode",
"(",
"code",
")",
";",
"}",
"addStrictTransportHeaders",
"(",
"res",
")",
";",
"setResponseNoCache",
"(",
"re... | Helper for send a status response
@param {Number} code
@param {HttpResponse} res | [
"Helper",
"for",
"send",
"a",
"status",
"response"
] | eb2583100c662b5cfc1b461a978b31d3b8555ce1 | https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/modules/orionode/lib/api.js#L72-L84 | train |
eclipse/orion.client | modules/orionode/lib/api.js | writeResponse | function writeResponse(code, res, headers, body, needEncodeLocation, noCachedStringRes) {
try{
if (res.headerSent) {
logger.error("header Sent:", res.req.method, res.req.originalUrl);
}
if (typeof code === 'number') {
if (httpCodeMapping) {
code = mapHttpStatusCode(code);
}
res.status(code);
}
... | javascript | function writeResponse(code, res, headers, body, needEncodeLocation, noCachedStringRes) {
try{
if (res.headerSent) {
logger.error("header Sent:", res.req.method, res.req.originalUrl);
}
if (typeof code === 'number') {
if (httpCodeMapping) {
code = mapHttpStatusCode(code);
}
res.status(code);
}
... | [
"function",
"writeResponse",
"(",
"code",
",",
"res",
",",
"headers",
",",
"body",
",",
"needEncodeLocation",
",",
"noCachedStringRes",
")",
"{",
"try",
"{",
"if",
"(",
"res",
".",
"headerSent",
")",
"{",
"logger",
".",
"error",
"(",
"\"header Sent:\"",
",... | Helper for writing a JSON response.
@param {Number} code
@param {HttpResponse} res
@param {Object} [headers]
@param {Object|String} [body] If Object, response will be JSON. If string, response will be text/plain.
@param {Boolean} needEncodeLocation
@param {Boolean} noCachedStringRes,set to true in case if the response ... | [
"Helper",
"for",
"writing",
"a",
"JSON",
"response",
"."
] | eb2583100c662b5cfc1b461a978b31d3b8555ce1 | https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/modules/orionode/lib/api.js#L95-L134 | train |
eclipse/orion.client | modules/orionode/lib/api.js | writeError | function writeError(code, res, msg) {
try{
if (res.headerSent) {
logger.error("header Sent:", res.req.method, res.req.originalUrl);
}
if (httpCodeMapping) {
code = mapHttpStatusCode(code);
}
msg = msg instanceof Error ? msg.message : msg;
addStrictTransportHeaders(res);
setResponseNoCache(res);
i... | javascript | function writeError(code, res, msg) {
try{
if (res.headerSent) {
logger.error("header Sent:", res.req.method, res.req.originalUrl);
}
if (httpCodeMapping) {
code = mapHttpStatusCode(code);
}
msg = msg instanceof Error ? msg.message : msg;
addStrictTransportHeaders(res);
setResponseNoCache(res);
i... | [
"function",
"writeError",
"(",
"code",
",",
"res",
",",
"msg",
")",
"{",
"try",
"{",
"if",
"(",
"res",
".",
"headerSent",
")",
"{",
"logger",
".",
"error",
"(",
"\"header Sent:\"",
",",
"res",
".",
"req",
".",
"method",
",",
"res",
".",
"req",
".",... | Helper for writing an error JSON response.
@param {Number} code
@param {HttpResponse} res
@param {String|Error} [msg] | [
"Helper",
"for",
"writing",
"an",
"error",
"JSON",
"response",
"."
] | eb2583100c662b5cfc1b461a978b31d3b8555ce1 | https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/modules/orionode/lib/api.js#L142-L167 | train |
eclipse/orion.client | bundles/org.eclipse.orion.client.editor/web/orion/editor/annotations.js | function(annotationModel, start, end) {
var iter = annotationModel.getAnnotations(start, end);
var annotation, annotations = [];
while (iter.hasNext()) {
annotation = iter.next();
if (!this.isAnnotationTypeVisible(annotation.type)) { continue; }
annotations.push(annotation);
}
var self = this... | javascript | function(annotationModel, start, end) {
var iter = annotationModel.getAnnotations(start, end);
var annotation, annotations = [];
while (iter.hasNext()) {
annotation = iter.next();
if (!this.isAnnotationTypeVisible(annotation.type)) { continue; }
annotations.push(annotation);
}
var self = this... | [
"function",
"(",
"annotationModel",
",",
"start",
",",
"end",
")",
"{",
"var",
"iter",
"=",
"annotationModel",
".",
"getAnnotations",
"(",
"start",
",",
"end",
")",
";",
"var",
"annotation",
",",
"annotations",
"=",
"[",
"]",
";",
"while",
"(",
"iter",
... | Returns an array of annotations in the specified annotation model for the given range of text sorted by type.
@param {orion.editor.AnnotationModel} annotationModel the annotation model.
@param {Number} start the start offset of the range.
@param {Number} end the end offset of the range.
@return {orion.editor.Annotatio... | [
"Returns",
"an",
"array",
"of",
"annotations",
"in",
"the",
"specified",
"annotation",
"model",
"for",
"the",
"given",
"range",
"of",
"text",
"sorted",
"by",
"type",
"."
] | eb2583100c662b5cfc1b461a978b31d3b8555ce1 | https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.editor/web/orion/editor/annotations.js#L431-L444 | train | |
eclipse/orion.client | bundles/org.eclipse.orion.client.editor/web/orion/editor/annotations.js | function(type) {
if (this.getAnnotationTypePriority(type) === 0) return false;
return !this._visibleAnnotationTypes || this._visibleAnnotationTypes[type] === undefined || this._visibleAnnotationTypes[type] === true;
} | javascript | function(type) {
if (this.getAnnotationTypePriority(type) === 0) return false;
return !this._visibleAnnotationTypes || this._visibleAnnotationTypes[type] === undefined || this._visibleAnnotationTypes[type] === true;
} | [
"function",
"(",
"type",
")",
"{",
"if",
"(",
"this",
".",
"getAnnotationTypePriority",
"(",
"type",
")",
"===",
"0",
")",
"return",
"false",
";",
"return",
"!",
"this",
".",
"_visibleAnnotationTypes",
"||",
"this",
".",
"_visibleAnnotationTypes",
"[",
"type... | Returns whether the receiver shows annotations of the specified type.
@param {Object} type the annotation type
@returns {Boolean} whether the specified annotation type is shown
@see orion.editor.AnnotationTypeList#addAnnotationType
@see orion.editor.AnnotationTypeList#removeAnnotationType | [
"Returns",
"whether",
"the",
"receiver",
"shows",
"annotations",
"of",
"the",
"specified",
"type",
"."
] | eb2583100c662b5cfc1b461a978b31d3b8555ce1 | https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.editor/web/orion/editor/annotations.js#L454-L457 | train | |
eclipse/orion.client | bundles/org.eclipse.orion.client.editor/web/orion/editor/annotations.js | function(type, visible) {
if (typeof type === "object") {
this._visibleAnnotationTypes = type;
} else {
if (!this._visibleAnnotationTypes) this._visibleAnnotationTypes = {};
this._visibleAnnotationTypes[type] = visible;
}
} | javascript | function(type, visible) {
if (typeof type === "object") {
this._visibleAnnotationTypes = type;
} else {
if (!this._visibleAnnotationTypes) this._visibleAnnotationTypes = {};
this._visibleAnnotationTypes[type] = visible;
}
} | [
"function",
"(",
"type",
",",
"visible",
")",
"{",
"if",
"(",
"typeof",
"type",
"===",
"\"object\"",
")",
"{",
"this",
".",
"_visibleAnnotationTypes",
"=",
"type",
";",
"}",
"else",
"{",
"if",
"(",
"!",
"this",
".",
"_visibleAnnotationTypes",
")",
"this"... | Sets whether annotations of the given annotation type are visble. By default
all annotations added to the receiver are visible.
@param {Object} type
@param {Boolean} visible
@since 14.0 | [
"Sets",
"whether",
"annotations",
"of",
"the",
"given",
"annotation",
"type",
"are",
"visble",
".",
"By",
"default",
"all",
"annotations",
"added",
"to",
"the",
"receiver",
"are",
"visible",
"."
] | eb2583100c662b5cfc1b461a978b31d3b8555ce1 | https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.editor/web/orion/editor/annotations.js#L466-L473 | train | |
eclipse/orion.client | bundles/org.eclipse.orion.client.editor/web/orion/editor/annotations.js | AnnotationModel | function AnnotationModel(textModel) {
this._annotations = [];
var self = this;
this._listener = {
onChanged: function(modelChangedEvent) {
self._onChanged(modelChangedEvent);
}
};
this.setTextModel(textModel);
} | javascript | function AnnotationModel(textModel) {
this._annotations = [];
var self = this;
this._listener = {
onChanged: function(modelChangedEvent) {
self._onChanged(modelChangedEvent);
}
};
this.setTextModel(textModel);
} | [
"function",
"AnnotationModel",
"(",
"textModel",
")",
"{",
"this",
".",
"_annotations",
"=",
"[",
"]",
";",
"var",
"self",
"=",
"this",
";",
"this",
".",
"_listener",
"=",
"{",
"onChanged",
":",
"function",
"(",
"modelChangedEvent",
")",
"{",
"self",
"."... | Constructs an annotation model.
@param {orion.editor.TextModel} textModel The text model.
@class This object manages annotations for a <code>TextModel</code>.
<p>
<b>See:</b><br/>
{@link orion.editor.Annotation}<br/>
{@link orion.editor.TextModel}<br/>
</p>
@name orion.editor.AnnotationModel
@borrows orion.editor.Eve... | [
"Constructs",
"an",
"annotation",
"model",
"."
] | eb2583100c662b5cfc1b461a978b31d3b8555ce1 | https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.editor/web/orion/editor/annotations.js#L528-L537 | train |
eclipse/orion.client | bundles/org.eclipse.orion.client.editor/web/orion/editor/annotations.js | function(textModel) {
if (this._model) {
this._model.removeEventListener("Changed", this._listener.onChanged); //$NON-NLS-0$
}
this._model = textModel;
if (this._model) {
this._model.addEventListener("Changed", this._listener.onChanged); //$NON-NLS-0$
}
} | javascript | function(textModel) {
if (this._model) {
this._model.removeEventListener("Changed", this._listener.onChanged); //$NON-NLS-0$
}
this._model = textModel;
if (this._model) {
this._model.addEventListener("Changed", this._listener.onChanged); //$NON-NLS-0$
}
} | [
"function",
"(",
"textModel",
")",
"{",
"if",
"(",
"this",
".",
"_model",
")",
"{",
"this",
".",
"_model",
".",
"removeEventListener",
"(",
"\"Changed\"",
",",
"this",
".",
"_listener",
".",
"onChanged",
")",
";",
"//$NON-NLS-0$",
"}",
"this",
".",
"_mod... | Sets the text model of the annotation model. The annotation
model listens for changes in the text model to update and remove
annotations that are affected by the change.
@param {orion.editor.TextModel} textModel the text model.
@see orion.editor.AnnotationModel#getTextModel | [
"Sets",
"the",
"text",
"model",
"of",
"the",
"annotation",
"model",
".",
"The",
"annotation",
"model",
"listens",
"for",
"changes",
"in",
"the",
"text",
"model",
"to",
"update",
"and",
"remove",
"annotations",
"that",
"are",
"affected",
"by",
"the",
"change"... | eb2583100c662b5cfc1b461a978b31d3b8555ce1 | https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.editor/web/orion/editor/annotations.js#L758-L766 | train | |
eclipse/orion.client | bundles/org.eclipse.orion.client.editor/web/orion/editor/annotations.js | AnnotationStyler | function AnnotationStyler (view, annotationModel) {
this._view = view;
this._annotationModel = annotationModel;
var self = this;
this._listener = {
onDestroy: function(e) {
self._onDestroy(e);
},
onLineStyle: function(e) {
self._onLineStyle(e);
},
onChanged: function(e) {
self._onAnno... | javascript | function AnnotationStyler (view, annotationModel) {
this._view = view;
this._annotationModel = annotationModel;
var self = this;
this._listener = {
onDestroy: function(e) {
self._onDestroy(e);
},
onLineStyle: function(e) {
self._onLineStyle(e);
},
onChanged: function(e) {
self._onAnno... | [
"function",
"AnnotationStyler",
"(",
"view",
",",
"annotationModel",
")",
"{",
"this",
".",
"_view",
"=",
"view",
";",
"this",
".",
"_annotationModel",
"=",
"annotationModel",
";",
"var",
"self",
"=",
"this",
";",
"this",
".",
"_listener",
"=",
"{",
"onDes... | Constructs a new styler for annotations.
@param {orion.editor.TextView} view The styler view.
@param {orion.editor.AnnotationModel} view The styler annotation model.
@class This object represents a styler for annotation attached to a text view.
@name orion.editor.AnnotationStyler
@borrows orion.editor.AnnotationTypeL... | [
"Constructs",
"a",
"new",
"styler",
"for",
"annotations",
"."
] | eb2583100c662b5cfc1b461a978b31d3b8555ce1 | https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.editor/web/orion/editor/annotations.js#L842-L860 | train |
eclipse/orion.client | bundles/org.eclipse.orion.client.collab/web/orion/collab/collabFileAnnotation.js | function(name, color, location, displayedLocation, editing) {
this.name = name;
this.color = color;
// Remove trailing "/"
if(location.substr(-1) === '/') {
location = location.substr(0, location.length - 1);
}
this.location = location;
this.displayedLocation = displayedLocation || location;
this.edi... | javascript | function(name, color, location, displayedLocation, editing) {
this.name = name;
this.color = color;
// Remove trailing "/"
if(location.substr(-1) === '/') {
location = location.substr(0, location.length - 1);
}
this.location = location;
this.displayedLocation = displayedLocation || location;
this.edi... | [
"function",
"(",
"name",
",",
"color",
",",
"location",
",",
"displayedLocation",
",",
"editing",
")",
"{",
"this",
".",
"name",
"=",
"name",
";",
"this",
".",
"color",
"=",
"color",
";",
"// Remove trailing \"/\"",
"if",
"(",
"location",
".",
"substr",
... | A record of a collaborator annotation in the file tree
@constructor
@name {orion.collab.CollabFileAnnotation}
@implements {orion.treetable.TableTree.IAnnotation}
@param {string} name - displayed name
@param {string} color - user color
@param {string} location - file location
@param {string} displayedLocation - read f... | [
"A",
"record",
"of",
"a",
"collaborator",
"annotation",
"in",
"the",
"file",
"tree"
] | eb2583100c662b5cfc1b461a978b31d3b8555ce1 | https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.collab/web/orion/collab/collabFileAnnotation.js#L30-L40 | train | |
eclipse/orion.client | bundles/org.eclipse.orion.client.collab/web/orion/collab/collabFileAnnotation.js | function(model, callback) {
var self = this;
model.getRoot(function(root) {
// Find the existing ID reversely
var location = self.location;
while (location.length > 0) {
// Create a fake item
// NOTE: it's a hack because we don't have any efficient
// way to get the actual file no... | javascript | function(model, callback) {
var self = this;
model.getRoot(function(root) {
// Find the existing ID reversely
var location = self.location;
while (location.length > 0) {
// Create a fake item
// NOTE: it's a hack because we don't have any efficient
// way to get the actual file no... | [
"function",
"(",
"model",
",",
"callback",
")",
"{",
"var",
"self",
"=",
"this",
";",
"model",
".",
"getRoot",
"(",
"function",
"(",
"root",
")",
"{",
"// Find the existing ID reversely",
"var",
"location",
"=",
"self",
".",
"location",
";",
"while",
"(",
... | Find the deepest expanded folder item that contains the file having
this annotation.
@see IAnnotation for details.
@param {orion.explorer.ExplorerModel} model -
@param {Function} callback - | [
"Find",
"the",
"deepest",
"expanded",
"folder",
"item",
"that",
"contains",
"the",
"file",
"having",
"this",
"annotation",
"."
] | eb2583100c662b5cfc1b461a978b31d3b8555ce1 | https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.collab/web/orion/collab/collabFileAnnotation.js#L52-L82 | train | |
eclipse/orion.client | bundles/org.eclipse.orion.client.collab/web/orion/collab/collabFileAnnotation.js | function() {
var element = document.createElement('div');
element.innerHTML = mUIUtils.getNameInitial(this.name);
element.style.backgroundColor = this.color;
element.classList.add('collabAnnotation');
if (this.editing) {
element.classList.add('collabEditing');
}
return element;
} | javascript | function() {
var element = document.createElement('div');
element.innerHTML = mUIUtils.getNameInitial(this.name);
element.style.backgroundColor = this.color;
element.classList.add('collabAnnotation');
if (this.editing) {
element.classList.add('collabEditing');
}
return element;
} | [
"function",
"(",
")",
"{",
"var",
"element",
"=",
"document",
".",
"createElement",
"(",
"'div'",
")",
";",
"element",
".",
"innerHTML",
"=",
"mUIUtils",
".",
"getNameInitial",
"(",
"this",
".",
"name",
")",
";",
"element",
".",
"style",
".",
"background... | Generate a new HTML element of this annotation.
@return {Element} - the HTML element of this annotation | [
"Generate",
"a",
"new",
"HTML",
"element",
"of",
"this",
"annotation",
"."
] | eb2583100c662b5cfc1b461a978b31d3b8555ce1 | https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.collab/web/orion/collab/collabFileAnnotation.js#L99-L108 | train | |
eclipse/orion.client | bundles/org.eclipse.orion.client.core/web/orion/keyBinding.js | function(kb) {
if (!kb) { return false; }
if (this.keyCode !== kb.keyCode) { return false; }
if (this.mod1 !== kb.mod1) { return false; }
if (this.mod2 !== kb.mod2) { return false; }
if (this.mod3 !== kb.mod3) { return false; }
if (this.mod4 !== kb.mod4) { return false; }
if (this.type !== kb.type)... | javascript | function(kb) {
if (!kb) { return false; }
if (this.keyCode !== kb.keyCode) { return false; }
if (this.mod1 !== kb.mod1) { return false; }
if (this.mod2 !== kb.mod2) { return false; }
if (this.mod3 !== kb.mod3) { return false; }
if (this.mod4 !== kb.mod4) { return false; }
if (this.type !== kb.type)... | [
"function",
"(",
"kb",
")",
"{",
"if",
"(",
"!",
"kb",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"this",
".",
"keyCode",
"!==",
"kb",
".",
"keyCode",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"this",
".",
"mod1",
"!==",
"kb",
... | Returns whether this key stroke is the same as the given parameter.
@param {orion.KeyBinding} kb the key binding to compare with.
@returns {Boolean} whether or not the parameter and the receiver describe the same key binding. | [
"Returns",
"whether",
"this",
"key",
"stroke",
"is",
"the",
"same",
"as",
"the",
"given",
"parameter",
"."
] | eb2583100c662b5cfc1b461a978b31d3b8555ce1 | https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.core/web/orion/keyBinding.js#L115-L124 | train | |
eclipse/orion.client | bundles/org.eclipse.orion.client.core/web/orion/keyBinding.js | function(kb) {
if (!kb.keys) { return false; }
if (kb.keys.length !== this.keys.length) { return false; }
for (var i=0; i<kb.keys.length; i++) {
if (!kb.keys[i].equals(this.keys[i])) { return false; }
}
return true;
} | javascript | function(kb) {
if (!kb.keys) { return false; }
if (kb.keys.length !== this.keys.length) { return false; }
for (var i=0; i<kb.keys.length; i++) {
if (!kb.keys[i].equals(this.keys[i])) { return false; }
}
return true;
} | [
"function",
"(",
"kb",
")",
"{",
"if",
"(",
"!",
"kb",
".",
"keys",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"kb",
".",
"keys",
".",
"length",
"!==",
"this",
".",
"keys",
".",
"length",
")",
"{",
"return",
"false",
";",
"}",
"for",
"... | Returns whether this key sequence is the same as the given parameter.
@param {orion.KeyBinding|orion.KeySequence} kb the key binding to compare with.
@returns {Boolean} whether or not the parameter and the receiver describe the same key binding. | [
"Returns",
"whether",
"this",
"key",
"sequence",
"is",
"the",
"same",
"as",
"the",
"given",
"parameter",
"."
] | eb2583100c662b5cfc1b461a978b31d3b8555ce1 | https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.core/web/orion/keyBinding.js#L184-L191 | train | |
eclipse/orion.client | bundles/org.eclipse.orion.client.ui/web/orion/settings/settingsRegistry.js | function(category) {
var settingsMap = this.settingsMap;
var pids = typeof category === 'string' ? this.categories[category] : Object.keys(settingsMap); //$NON-NLS-0$
if (!pids) {
return [];
}
return pids.map(function(pid) {
return settingsMap[pid];
});
} | javascript | function(category) {
var settingsMap = this.settingsMap;
var pids = typeof category === 'string' ? this.categories[category] : Object.keys(settingsMap); //$NON-NLS-0$
if (!pids) {
return [];
}
return pids.map(function(pid) {
return settingsMap[pid];
});
} | [
"function",
"(",
"category",
")",
"{",
"var",
"settingsMap",
"=",
"this",
".",
"settingsMap",
";",
"var",
"pids",
"=",
"typeof",
"category",
"===",
"'string'",
"?",
"this",
".",
"categories",
"[",
"category",
"]",
":",
"Object",
".",
"keys",
"(",
"settin... | Returns settings.
@param {String} [category] If passed, returns only the settings in the given category. Otherwise, returns all settings.
@returns {orion.settings.Setting[]} | [
"Returns",
"settings",
"."
] | eb2583100c662b5cfc1b461a978b31d3b8555ce1 | https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/settings/settingsRegistry.js#L245-L254 | train | |
eclipse/orion.client | bundles/org.eclipse.orion.client.ui/web/orion/settings/settingsRegistry.js | function(category) {
var settings = this.getSettings(category);
for (var i = 0; i < settings.length; i++){
var label = settings[i].getCategoryLabel();
if (label) {
return label;
}
}
return null;
} | javascript | function(category) {
var settings = this.getSettings(category);
for (var i = 0; i < settings.length; i++){
var label = settings[i].getCategoryLabel();
if (label) {
return label;
}
}
return null;
} | [
"function",
"(",
"category",
")",
"{",
"var",
"settings",
"=",
"this",
".",
"getSettings",
"(",
"category",
")",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"settings",
".",
"length",
";",
"i",
"++",
")",
"{",
"var",
"label",
"=",
"sett... | Returns the localized label for a category.
@returns {String} The category label, or <code>null</code> if no localized label is available. | [
"Returns",
"the",
"localized",
"label",
"for",
"a",
"category",
"."
] | eb2583100c662b5cfc1b461a978b31d3b8555ce1 | https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/settings/settingsRegistry.js#L266-L275 | train | |
eclipse/orion.client | bundles/org.eclipse.orion.client.collab/web/orion/collab/otAdapters.js | function(client, socket) {
OrionSocketAdapter.call(this, client);
var self = this;
this.socket = socket;
this.authenticated = false;
// Register incoming message handler
this.socket.addEventListener('message', function(e) {
self._onMessage(JSON.parse(e.data)... | javascript | function(client, socket) {
OrionSocketAdapter.call(this, client);
var self = this;
this.socket = socket;
this.authenticated = false;
// Register incoming message handler
this.socket.addEventListener('message', function(e) {
self._onMessage(JSON.parse(e.data)... | [
"function",
"(",
"client",
",",
"socket",
")",
"{",
"OrionSocketAdapter",
".",
"call",
"(",
"this",
",",
"client",
")",
";",
"var",
"self",
"=",
"this",
";",
"this",
".",
"socket",
"=",
"socket",
";",
"this",
".",
"authenticated",
"=",
"false",
";",
... | The socket adapter for OT using CollabSocket as the communitation socket
@class
@extends orion.collab.OrionSocketAdapter
@name orion.collab.OrionCollabSocketAdapter
@param {orion.collabClient.CollabClient} client
@param {orion.collabClient.CollabSocket} socket | [
"The",
"socket",
"adapter",
"for",
"OT",
"using",
"CollabSocket",
"as",
"the",
"communitation",
"socket"
] | eb2583100c662b5cfc1b461a978b31d3b8555ce1 | https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.collab/web/orion/collab/otAdapters.js#L228-L239 | train | |
eclipse/orion.client | bundles/org.eclipse.orion.client.javascript/web/escope/escope.js | Reference | function Reference(ident, scope, flag,writeExpr, maybeImplicitGlobal, partial, init) {
/**
* Identifier syntax node.
* @member {esprima#Identifier} Reference#identifier
*/
this.identifier = ident;
/**
* Reference to the enclosing Scope.
* @member {Scope} Reference#fr... | javascript | function Reference(ident, scope, flag,writeExpr, maybeImplicitGlobal, partial, init) {
/**
* Identifier syntax node.
* @member {esprima#Identifier} Reference#identifier
*/
this.identifier = ident;
/**
* Reference to the enclosing Scope.
* @member {Scope} Reference#fr... | [
"function",
"Reference",
"(",
"ident",
",",
"scope",
",",
"flag",
",",
"writeExpr",
",",
"maybeImplicitGlobal",
",",
"partial",
",",
"init",
")",
"{",
"/**\n * Identifier syntax node.\n * @member {esprima#Identifier} Reference#identifier\n */",
"this",
".",
... | A Reference represents a single occurrence of an identifier in code.
@class Reference | [
"A",
"Reference",
"represents",
"a",
"single",
"occurrence",
"of",
"an",
"identifier",
"in",
"code",
"."
] | eb2583100c662b5cfc1b461a978b31d3b8555ce1 | https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.javascript/web/escope/escope.js#L42-L89 | train |
eclipse/orion.client | bundles/org.eclipse.orion.client.javascript/web/escope/escope.js | analyze | function analyze(tree, providedOptions) {
var scopeManager, referencer, options;
options = updateDeeply(defaultOptions(), providedOptions);
scopeManager = new ScopeManager(options);
referencer = new Referencer(options, scopeManager);
referencer.visit(tree);
if(scopeManager.__currentScope !==... | javascript | function analyze(tree, providedOptions) {
var scopeManager, referencer, options;
options = updateDeeply(defaultOptions(), providedOptions);
scopeManager = new ScopeManager(options);
referencer = new Referencer(options, scopeManager);
referencer.visit(tree);
if(scopeManager.__currentScope !==... | [
"function",
"analyze",
"(",
"tree",
",",
"providedOptions",
")",
"{",
"var",
"scopeManager",
",",
"referencer",
",",
"options",
";",
"options",
"=",
"updateDeeply",
"(",
"defaultOptions",
"(",
")",
",",
"providedOptions",
")",
";",
"scopeManager",
"=",
"new",
... | Main interface function. Takes an Esprima syntax tree and returns the
analyzed scopes.
@function analyze
@param {esprima.Tree} tree
@param {Object} providedOptions - Options that tailor the scope analysis
@param {boolean} [providedOptions.optimistic=false] - the optimistic flag
@param {boolean} [providedOptions.directi... | [
"Main",
"interface",
"function",
".",
"Takes",
"an",
"Esprima",
"syntax",
"tree",
"and",
"returns",
"the",
"analyzed",
"scopes",
"."
] | eb2583100c662b5cfc1b461a978b31d3b8555ce1 | https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.javascript/web/escope/escope.js#L2117-L2131 | train |
eclipse/orion.client | modules/orionode/lib/shared/db/sharedProjects.js | addProject | function addProject(project) {
var hub = generateUniqueHubId();
//TODO Also add name of project owner? Replace by projectJSON all over the file.
var query = sharedProject.findOne({location: project});
return query.exec()
.then(function(doc) {
return doc ? Promise.resolve(doc) : sharedProject.create({locati... | javascript | function addProject(project) {
var hub = generateUniqueHubId();
//TODO Also add name of project owner? Replace by projectJSON all over the file.
var query = sharedProject.findOne({location: project});
return query.exec()
.then(function(doc) {
return doc ? Promise.resolve(doc) : sharedProject.create({locati... | [
"function",
"addProject",
"(",
"project",
")",
"{",
"var",
"hub",
"=",
"generateUniqueHubId",
"(",
")",
";",
"//TODO Also add name of project owner? Replace by projectJSON all over the file.",
"var",
"query",
"=",
"sharedProject",
".",
"findOne",
"(",
"{",
"location",
"... | Adds the project and a new hubID to the sharedProjects db document. | [
"Adds",
"the",
"project",
"and",
"a",
"new",
"hubID",
"to",
"the",
"sharedProjects",
"db",
"document",
"."
] | eb2583100c662b5cfc1b461a978b31d3b8555ce1 | https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/modules/orionode/lib/shared/db/sharedProjects.js#L89-L97 | train |
eclipse/orion.client | modules/orionode/lib/shared/db/sharedProjects.js | removeProject | function removeProject(project) {
return sharedProject.findOne({'location': project}).exec()
.then(function(doc) {
if (doc.users.length > 0) {
return userProjectsCollection.removeProjectReferences(doc.users, project).exec();
}
})
.then(function() {
return sharedProject.remove({location: project}).e... | javascript | function removeProject(project) {
return sharedProject.findOne({'location': project}).exec()
.then(function(doc) {
if (doc.users.length > 0) {
return userProjectsCollection.removeProjectReferences(doc.users, project).exec();
}
})
.then(function() {
return sharedProject.remove({location: project}).e... | [
"function",
"removeProject",
"(",
"project",
")",
"{",
"return",
"sharedProject",
".",
"findOne",
"(",
"{",
"'location'",
":",
"project",
"}",
")",
".",
"exec",
"(",
")",
".",
"then",
"(",
"function",
"(",
"doc",
")",
"{",
"if",
"(",
"doc",
".",
"use... | Removes project from shared projects.
Also removes all references from the other table. | [
"Removes",
"project",
"from",
"shared",
"projects",
".",
"Also",
"removes",
"all",
"references",
"from",
"the",
"other",
"table",
"."
] | eb2583100c662b5cfc1b461a978b31d3b8555ce1 | https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/modules/orionode/lib/shared/db/sharedProjects.js#L103-L113 | train |
eclipse/orion.client | modules/orionode/lib/shared/db/sharedProjects.js | generateUniqueHubId | function generateUniqueHubId() {
//TODO ensure generated hub id is unique (not in db)
// do {
var length = 10;
var letters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUV0123456789';
var s = '';
for (var i=0; i<length; i++) {
s += letters.charAt(Math.floor(Math.random() * letters.length));
}
// }... | javascript | function generateUniqueHubId() {
//TODO ensure generated hub id is unique (not in db)
// do {
var length = 10;
var letters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUV0123456789';
var s = '';
for (var i=0; i<length; i++) {
s += letters.charAt(Math.floor(Math.random() * letters.length));
}
// }... | [
"function",
"generateUniqueHubId",
"(",
")",
"{",
"//TODO ensure generated hub id is unique (not in db)",
"// do {",
"var",
"length",
"=",
"10",
";",
"var",
"letters",
"=",
"'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUV0123456789'",
";",
"var",
"s",
"=",
"''",
";",
"f... | returns a unique hubID | [
"returns",
"a",
"unique",
"hubID"
] | eb2583100c662b5cfc1b461a978b31d3b8555ce1 | https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/modules/orionode/lib/shared/db/sharedProjects.js#L126-L138 | train |
eclipse/orion.client | modules/orionode/lib/shared/db/sharedProjects.js | getUsersInProject | function getUsersInProject(project) {
return sharedProject.findOne({'location': project}).exec()
.then(function(doc) {
return doc ? doc.users : undefined;
});
} | javascript | function getUsersInProject(project) {
return sharedProject.findOne({'location': project}).exec()
.then(function(doc) {
return doc ? doc.users : undefined;
});
} | [
"function",
"getUsersInProject",
"(",
"project",
")",
"{",
"return",
"sharedProject",
".",
"findOne",
"(",
"{",
"'location'",
":",
"project",
"}",
")",
".",
"exec",
"(",
")",
".",
"then",
"(",
"function",
"(",
"doc",
")",
"{",
"return",
"doc",
"?",
"do... | Returns the list of users that the project is shared with. | [
"Returns",
"the",
"list",
"of",
"users",
"that",
"the",
"project",
"is",
"shared",
"with",
"."
] | eb2583100c662b5cfc1b461a978b31d3b8555ce1 | https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/modules/orionode/lib/shared/db/sharedProjects.js#L168-L173 | train |
eclipse/orion.client | modules/orionode/lib/shared/db/sharedProjects.js | addUserToProject | function addUserToProject(user, project) {
return addProject(project)
.then(function(doc) {
if (doc.users.indexOf(user) === -1) {
return sharedProject.findOneAndUpdate({'location': project}, {$addToSet: {'users': user} }, {
safe: true,
w: 'majority'
}).exec();
}
});
// return sharedProj... | javascript | function addUserToProject(user, project) {
return addProject(project)
.then(function(doc) {
if (doc.users.indexOf(user) === -1) {
return sharedProject.findOneAndUpdate({'location': project}, {$addToSet: {'users': user} }, {
safe: true,
w: 'majority'
}).exec();
}
});
// return sharedProj... | [
"function",
"addUserToProject",
"(",
"user",
",",
"project",
")",
"{",
"return",
"addProject",
"(",
"project",
")",
".",
"then",
"(",
"function",
"(",
"doc",
")",
"{",
"if",
"(",
"doc",
".",
"users",
".",
"indexOf",
"(",
"user",
")",
"===",
"-",
"1",... | Adds user to project's user list. | [
"Adds",
"user",
"to",
"project",
"s",
"user",
"list",
"."
] | eb2583100c662b5cfc1b461a978b31d3b8555ce1 | https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/modules/orionode/lib/shared/db/sharedProjects.js#L178-L204 | train |
eclipse/orion.client | modules/orionode/lib/shared/db/sharedProjects.js | removeUserFromProject | function removeUserFromProject(user, project) {
return sharedProject.findOne({'location': project}).exec()
.then(function(doc) {
return sharedProject.findOneAndUpdate({'location': project}, {$pull: {'users': { $in: [user]}} }, {
safe: true,
w: 'majority'
}).exec();
});
} | javascript | function removeUserFromProject(user, project) {
return sharedProject.findOne({'location': project}).exec()
.then(function(doc) {
return sharedProject.findOneAndUpdate({'location': project}, {$pull: {'users': { $in: [user]}} }, {
safe: true,
w: 'majority'
}).exec();
});
} | [
"function",
"removeUserFromProject",
"(",
"user",
",",
"project",
")",
"{",
"return",
"sharedProject",
".",
"findOne",
"(",
"{",
"'location'",
":",
"project",
"}",
")",
".",
"exec",
"(",
")",
".",
"then",
"(",
"function",
"(",
"doc",
")",
"{",
"return",
... | Remove user from project's user list. | [
"Remove",
"user",
"from",
"project",
"s",
"user",
"list",
"."
] | eb2583100c662b5cfc1b461a978b31d3b8555ce1 | https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/modules/orionode/lib/shared/db/sharedProjects.js#L209-L217 | train |
eclipse/orion.client | bundles/org.eclipse.orion.client.ui/web/orion/editorView.js | EditorView | function EditorView(options) {
this._parent = options.parent;
if(typeof this._parent === "string") {
this._parent = document.getElementById(options.parent);
}
this.id = options.id || "";
this.activateContext = options.activateContext;
this.renderToolbars = options.renderToolbars;
this.serviceRe... | javascript | function EditorView(options) {
this._parent = options.parent;
if(typeof this._parent === "string") {
this._parent = document.getElementById(options.parent);
}
this.id = options.id || "";
this.activateContext = options.activateContext;
this.renderToolbars = options.renderToolbars;
this.serviceRe... | [
"function",
"EditorView",
"(",
"options",
")",
"{",
"this",
".",
"_parent",
"=",
"options",
".",
"parent",
";",
"if",
"(",
"typeof",
"this",
".",
"_parent",
"===",
"\"string\"",
")",
"{",
"this",
".",
"_parent",
"=",
"document",
".",
"getElementById",
"(... | Constructs a new EditorView object.
@class
@name orion.EditorView
@borrows orion.editor.EventTarget#addEventListener as #addEventListener
@borrows orion.editor.EventTarget#removeEventListener as #removeEventListener
@borrows orion.editor.EventTarget#dispatchEvent as #dispatchEvent | [
"Constructs",
"a",
"new",
"EditorView",
"object",
"."
] | eb2583100c662b5cfc1b461a978b31d3b8555ce1 | https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/editorView.js#L89-L137 | train |
eclipse/orion.client | bundles/org.eclipse.orion.client.javascript/web/eslint/lib/rules/no-extend-native.js | function(node) {
var lhs = node.left,
affectsProto;
if (lhs.type !== "MemberExpression" || lhs.object.type !== "MemberExpression") {
return;
}
affectsProto = lhs.object.computed ?
lhs.object.property.type === "Literal" && lhs.object.property.value === "prototype" :
lhs.object.prope... | javascript | function(node) {
var lhs = node.left,
affectsProto;
if (lhs.type !== "MemberExpression" || lhs.object.type !== "MemberExpression") {
return;
}
affectsProto = lhs.object.computed ?
lhs.object.property.type === "Literal" && lhs.object.property.value === "prototype" :
lhs.object.prope... | [
"function",
"(",
"node",
")",
"{",
"var",
"lhs",
"=",
"node",
".",
"left",
",",
"affectsProto",
";",
"if",
"(",
"lhs",
".",
"type",
"!==",
"\"MemberExpression\"",
"||",
"lhs",
".",
"object",
".",
"type",
"!==",
"\"MemberExpression\"",
")",
"{",
"return",... | handle the Array.prototype.extra style case | [
"handle",
"the",
"Array",
".",
"prototype",
".",
"extra",
"style",
"case"
] | eb2583100c662b5cfc1b461a978b31d3b8555ce1 | https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.javascript/web/eslint/lib/rules/no-extend-native.js#L36-L57 | train | |
eclipse/orion.client | bundles/org.eclipse.orion.client.javascript/web/eslint/lib/rules/no-unused-expressions.js | isValidExpression | function isValidExpression(node) {
if (allowTernary) {
// Recursive check for ternary and logical expressions
if (node.type === "ConditionalExpression") {
return isValidExpression(node.consequent) && isValidExpression(node.alternate);
}
}
if (allowShortCircuit) {
if (node.type === "Logical... | javascript | function isValidExpression(node) {
if (allowTernary) {
// Recursive check for ternary and logical expressions
if (node.type === "ConditionalExpression") {
return isValidExpression(node.consequent) && isValidExpression(node.alternate);
}
}
if (allowShortCircuit) {
if (node.type === "Logical... | [
"function",
"isValidExpression",
"(",
"node",
")",
"{",
"if",
"(",
"allowTernary",
")",
"{",
"// Recursive check for ternary and logical expressions",
"if",
"(",
"node",
".",
"type",
"===",
"\"ConditionalExpression\"",
")",
"{",
"return",
"isValidExpression",
"(",
"no... | Determines whether or not a given node is a valid expression. Recurses on short circuit eval and ternary nodes if enabled by flags.
@param {ASTNode} node - any node
@returns {boolean} whether the given node is a valid expression | [
"Determines",
"whether",
"or",
"not",
"a",
"given",
"node",
"is",
"a",
"valid",
"expression",
".",
"Recurses",
"on",
"short",
"circuit",
"eval",
"and",
"ternary",
"nodes",
"if",
"enabled",
"by",
"flags",
"."
] | eb2583100c662b5cfc1b461a978b31d3b8555ce1 | https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.javascript/web/eslint/lib/rules/no-unused-expressions.js#L66-L81 | train |
eclipse/orion.client | bundles/org.eclipse.orion.client.ui/web/gcli/gcli/ui/output_terminal.js | OutputTerminal | function OutputTerminal(options, components) {
this.element = components.element;
this.requisition = components.requisition;
this.requisition.commandOutputManager.onOutput.add(this.outputted, this);
var document = components.element.ownerDocument;
if (outputViewCss != null) {
this.style = util.importCss... | javascript | function OutputTerminal(options, components) {
this.element = components.element;
this.requisition = components.requisition;
this.requisition.commandOutputManager.onOutput.add(this.outputted, this);
var document = components.element.ownerDocument;
if (outputViewCss != null) {
this.style = util.importCss... | [
"function",
"OutputTerminal",
"(",
"options",
",",
"components",
")",
"{",
"this",
".",
"element",
"=",
"components",
".",
"element",
";",
"this",
".",
"requisition",
"=",
"components",
".",
"requisition",
";",
"this",
".",
"requisition",
".",
"commandOutputMa... | A wrapper for a set of rows|command outputs.
Register with the canon to be notified when commands have output to be
displayed.
@param options Object containing user customization properties, although
none are currently supported
@param components Object that links to other UI components. GCLI provided:
- element: Root ... | [
"A",
"wrapper",
"for",
"a",
"set",
"of",
"rows|command",
"outputs",
".",
"Register",
"with",
"the",
"canon",
"to",
"be",
"notified",
"when",
"commands",
"have",
"output",
"to",
"be",
"displayed",
"."
] | eb2583100c662b5cfc1b461a978b31d3b8555ce1 | https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/gcli/gcli/ui/output_terminal.js#L41-L54 | train |
eclipse/orion.client | bundles/org.eclipse.orion.client.ui/web/gcli/gcli/ui/output_terminal.js | OutputView | function OutputView(outputData, outputTerminal) {
this.outputData = outputData;
this.outputTerminal = outputTerminal;
this.url = util.createUrlLookup(module);
// Elements attached to this by template().
this.elems = {
rowin: null,
rowout: null,
hide: null,
show: null,
duration: null,
... | javascript | function OutputView(outputData, outputTerminal) {
this.outputData = outputData;
this.outputTerminal = outputTerminal;
this.url = util.createUrlLookup(module);
// Elements attached to this by template().
this.elems = {
rowin: null,
rowout: null,
hide: null,
show: null,
duration: null,
... | [
"function",
"OutputView",
"(",
"outputData",
",",
"outputTerminal",
")",
"{",
"this",
".",
"outputData",
"=",
"outputData",
";",
"this",
".",
"outputTerminal",
"=",
"outputTerminal",
";",
"this",
".",
"url",
"=",
"util",
".",
"createUrlLookup",
"(",
"module",
... | Adds a row to the CLI output display | [
"Adds",
"a",
"row",
"to",
"the",
"CLI",
"output",
"display"
] | eb2583100c662b5cfc1b461a978b31d3b8555ce1 | https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/gcli/gcli/ui/output_terminal.js#L96-L121 | train |
eclipse/orion.client | bundles/org.eclipse.orion.client.ui/web/orion/edit/editorContext.js | getOptions | function getOptions(serviceRegistry, serviceID) {
var options = Object.create(null);
getReferences(serviceRegistry, serviceID).forEach(function(serviceRef) {
serviceRef.getPropertyKeys().forEach(function(key) {
if (key !== "service.id" && key !== "service.names" && key !== "objectClass") //$NON-NLS-2$ //$NON... | javascript | function getOptions(serviceRegistry, serviceID) {
var options = Object.create(null);
getReferences(serviceRegistry, serviceID).forEach(function(serviceRef) {
serviceRef.getPropertyKeys().forEach(function(key) {
if (key !== "service.id" && key !== "service.names" && key !== "objectClass") //$NON-NLS-2$ //$NON... | [
"function",
"getOptions",
"(",
"serviceRegistry",
",",
"serviceID",
")",
"{",
"var",
"options",
"=",
"Object",
".",
"create",
"(",
"null",
")",
";",
"getReferences",
"(",
"serviceRegistry",
",",
"serviceID",
")",
".",
"forEach",
"(",
"function",
"(",
"servic... | Gets the editor context "options" object.
@name orion.edit.EditorContext.getOptions
@function
@param {orion.serviceregistry.ServiceRegistry} serviceRegistry The service registry to consult.
@returns {Object} | [
"Gets",
"the",
"editor",
"context",
"options",
"object",
"."
] | eb2583100c662b5cfc1b461a978b31d3b8555ce1 | https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/edit/editorContext.js#L49-L58 | train |
eclipse/orion.client | bundles/org.eclipse.orion.client.ui/web/gcli/gcli/ui/display.js | Display | function Display(options) {
var doc = options.document || document;
this.displayStyle = undefined;
if (displayCss != null) {
this.displayStyle = util.importCss(displayCss, doc, 'gcli-css-display');
}
// Configuring the document is complex because on the web side, there is an
// active desire to have n... | javascript | function Display(options) {
var doc = options.document || document;
this.displayStyle = undefined;
if (displayCss != null) {
this.displayStyle = util.importCss(displayCss, doc, 'gcli-css-display');
}
// Configuring the document is complex because on the web side, there is an
// active desire to have n... | [
"function",
"Display",
"(",
"options",
")",
"{",
"var",
"doc",
"=",
"options",
".",
"document",
"||",
"document",
";",
"this",
".",
"displayStyle",
"=",
"undefined",
";",
"if",
"(",
"displayCss",
"!=",
"null",
")",
"{",
"this",
".",
"displayStyle",
"=",
... | View is responsible for generating the web UI for GCLI.
@param options Object containing user customization properties.
See the documentation for the other components for more details.
Options supported directly include:
- document (default=document):
- environment (default={}):
- dontDecorate (default=false):
- inputE... | [
"View",
"is",
"responsible",
"for",
"generating",
"the",
"web",
"UI",
"for",
"GCLI",
"."
] | eb2583100c662b5cfc1b461a978b31d3b8555ce1 | https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/gcli/gcli/ui/display.js#L78-L160 | train |
eclipse/orion.client | bundles/org.eclipse.orion.client.ui/web/gcli/gcli/ui/display.js | find | function find(doc, element, id) {
if (!element) {
element = doc.getElementById(id);
if (!element) {
throw new Error('Missing element, id=' + id);
}
}
return element;
} | javascript | function find(doc, element, id) {
if (!element) {
element = doc.getElementById(id);
if (!element) {
throw new Error('Missing element, id=' + id);
}
}
return element;
} | [
"function",
"find",
"(",
"doc",
",",
"element",
",",
"id",
")",
"{",
"if",
"(",
"!",
"element",
")",
"{",
"element",
"=",
"doc",
".",
"getElementById",
"(",
"id",
")",
";",
"if",
"(",
"!",
"element",
")",
"{",
"throw",
"new",
"Error",
"(",
"'Miss... | Utility to help find an element by id, throwing if it wasn't found | [
"Utility",
"to",
"help",
"find",
"an",
"element",
"by",
"id",
"throwing",
"if",
"it",
"wasn",
"t",
"found"
] | eb2583100c662b5cfc1b461a978b31d3b8555ce1 | https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/gcli/gcli/ui/display.js#L204-L212 | train |
eclipse/orion.client | bundles/org.eclipse.orion.client.ui/web/gcli/gcli/ui/display.js | insert | function insert(sibling, element, id) {
var doc = sibling.ownerDocument;
if (!element) {
element = doc.getElementById('gcli-row-complete');
if (!element) {
element = util.createElement(doc, 'div');
sibling.parentNode.insertBefore(element, sibling.nextSibling);
element.gcliCreated = true;
... | javascript | function insert(sibling, element, id) {
var doc = sibling.ownerDocument;
if (!element) {
element = doc.getElementById('gcli-row-complete');
if (!element) {
element = util.createElement(doc, 'div');
sibling.parentNode.insertBefore(element, sibling.nextSibling);
element.gcliCreated = true;
... | [
"function",
"insert",
"(",
"sibling",
",",
"element",
",",
"id",
")",
"{",
"var",
"doc",
"=",
"sibling",
".",
"ownerDocument",
";",
"if",
"(",
"!",
"element",
")",
"{",
"element",
"=",
"doc",
".",
"getElementById",
"(",
"'gcli-row-complete'",
")",
";",
... | Utility to help find an element by id, creating it if it wasn't found | [
"Utility",
"to",
"help",
"find",
"an",
"element",
"by",
"id",
"creating",
"it",
"if",
"it",
"wasn",
"t",
"found"
] | eb2583100c662b5cfc1b461a978b31d3b8555ce1 | https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/gcli/gcli/ui/display.js#L217-L228 | train |
eclipse/orion.client | bundles/org.eclipse.orion.client.javascript/web/eslint/lib/code-path-analysis/code-path-analyzer.js | function(node) {
this.currentNode = node;
// Updates the code path due to node's position in its parent node.
if (node.parent) {
preprocess(this, node);
}
// Updates the code path.
// And emits onCodePathStart/onCodePathSegmentStart events.
processCodePathToEnter(this, node);
// Emits nod... | javascript | function(node) {
this.currentNode = node;
// Updates the code path due to node's position in its parent node.
if (node.parent) {
preprocess(this, node);
}
// Updates the code path.
// And emits onCodePathStart/onCodePathSegmentStart events.
processCodePathToEnter(this, node);
// Emits nod... | [
"function",
"(",
"node",
")",
"{",
"this",
".",
"currentNode",
"=",
"node",
";",
"// Updates the code path due to node's position in its parent node.",
"if",
"(",
"node",
".",
"parent",
")",
"{",
"preprocess",
"(",
"this",
",",
"node",
")",
";",
"}",
"// Updates... | Does the process to enter a given AST node.
This updates state of analysis and calls `enterNode` of the wrapped.
@param {ASTNode} node - A node which is entering.
@returns {void} | [
"Does",
"the",
"process",
"to",
"enter",
"a",
"given",
"AST",
"node",
".",
"This",
"updates",
"state",
"of",
"analysis",
"and",
"calls",
"enterNode",
"of",
"the",
"wrapped",
"."
] | eb2583100c662b5cfc1b461a978b31d3b8555ce1 | https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.javascript/web/eslint/lib/code-path-analysis/code-path-analyzer.js#L570-L586 | train | |
eclipse/orion.client | bundles/org.eclipse.orion.client.javascript/web/eslint/lib/code-path-analysis/code-path-analyzer.js | function(node) {
this.currentNode = node;// Updates the code path.
// And emits onCodePathStart/onCodePathSegmentStart events.
processCodePathToExit(this, node);
// Emits node events.
this.original.leaveNode(node);
// Emits the last onCodePathStart/onCodePathSegmentStart events.
postprocess(this,... | javascript | function(node) {
this.currentNode = node;// Updates the code path.
// And emits onCodePathStart/onCodePathSegmentStart events.
processCodePathToExit(this, node);
// Emits node events.
this.original.leaveNode(node);
// Emits the last onCodePathStart/onCodePathSegmentStart events.
postprocess(this,... | [
"function",
"(",
"node",
")",
"{",
"this",
".",
"currentNode",
"=",
"node",
";",
"// Updates the code path.",
"// And emits onCodePathStart/onCodePathSegmentStart events.",
"processCodePathToExit",
"(",
"this",
",",
"node",
")",
";",
"// Emits node events.",
"this",
".",
... | Does the process to leave a given AST node.
This updates state of analysis and calls `leaveNode` of the wrapped.
@param {ASTNode} node - A node which is leaving.
@returns {void} | [
"Does",
"the",
"process",
"to",
"leave",
"a",
"given",
"AST",
"node",
".",
"This",
"updates",
"state",
"of",
"analysis",
"and",
"calls",
"leaveNode",
"of",
"the",
"wrapped",
"."
] | eb2583100c662b5cfc1b461a978b31d3b8555ce1 | https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.javascript/web/eslint/lib/code-path-analysis/code-path-analyzer.js#L595-L607 | train | |
eclipse/orion.client | bundles/org.eclipse.orion.client.javascript/web/eslint/lib/code-path-analysis/code-path-analyzer.js | function(fromSegment, toSegment) {
if (fromSegment.reachable && toSegment.reachable) {
this.emitter.emit(
"onCodePathSegmentLoop",
fromSegment,
toSegment,
this.currentNode
);
}
} | javascript | function(fromSegment, toSegment) {
if (fromSegment.reachable && toSegment.reachable) {
this.emitter.emit(
"onCodePathSegmentLoop",
fromSegment,
toSegment,
this.currentNode
);
}
} | [
"function",
"(",
"fromSegment",
",",
"toSegment",
")",
"{",
"if",
"(",
"fromSegment",
".",
"reachable",
"&&",
"toSegment",
".",
"reachable",
")",
"{",
"this",
".",
"emitter",
".",
"emit",
"(",
"\"onCodePathSegmentLoop\"",
",",
"fromSegment",
",",
"toSegment",
... | This is called on a code path looped.
Then this raises a looped event.
@param {CodePathSegment} fromSegment - A segment of prev.
@param {CodePathSegment} toSegment - A segment of next.
@returns {void} | [
"This",
"is",
"called",
"on",
"a",
"code",
"path",
"looped",
".",
"Then",
"this",
"raises",
"a",
"looped",
"event",
"."
] | eb2583100c662b5cfc1b461a978b31d3b8555ce1 | https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.javascript/web/eslint/lib/code-path-analysis/code-path-analyzer.js#L616-L625 | train | |
eclipse/orion.client | modules/orionode/lib/user.js | isAdmin | function isAdmin(options, username) {
return (options.configParams.get("orion.auth.user.creation") || "").split(",").some(function(user) {
return user === username;
});
} | javascript | function isAdmin(options, username) {
return (options.configParams.get("orion.auth.user.creation") || "").split(",").some(function(user) {
return user === username;
});
} | [
"function",
"isAdmin",
"(",
"options",
",",
"username",
")",
"{",
"return",
"(",
"options",
".",
"configParams",
".",
"get",
"(",
"\"orion.auth.user.creation\"",
")",
"||",
"\"\"",
")",
".",
"split",
"(",
"\",\"",
")",
".",
"some",
"(",
"function",
"(",
... | Checks if the 'admin' user has been enabled in the server configuration
@param {?} options The map of server options
@see https://wiki.eclipse.org/Orion/Server_admin_guide#Allowing_users_to_create_accounts
@since 18.0 | [
"Checks",
"if",
"the",
"admin",
"user",
"has",
"been",
"enabled",
"in",
"the",
"server",
"configuration"
] | eb2583100c662b5cfc1b461a978b31d3b8555ce1 | https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/modules/orionode/lib/user.js#L59-L63 | train |
eclipse/orion.client | modules/orionode/lib/user.js | userJSON | function userJSON(user, options) {
return {
FullName: user.fullname,
UserName: user.username,
Location: api.join(options.usersRoot, user.username),
Email: user.email,
EmailConfirmed: emailConfirmed(user),
HasPassword: true,
OAuth: user.oauth || undefined,
LastLoginTimestamp: user.login_timestamp ? user... | javascript | function userJSON(user, options) {
return {
FullName: user.fullname,
UserName: user.username,
Location: api.join(options.usersRoot, user.username),
Email: user.email,
EmailConfirmed: emailConfirmed(user),
HasPassword: true,
OAuth: user.oauth || undefined,
LastLoginTimestamp: user.login_timestamp ? user... | [
"function",
"userJSON",
"(",
"user",
",",
"options",
")",
"{",
"return",
"{",
"FullName",
":",
"user",
".",
"fullname",
",",
"UserName",
":",
"user",
".",
"username",
",",
"Location",
":",
"api",
".",
"join",
"(",
"options",
".",
"usersRoot",
",",
"use... | Write out the JSON for the given user metadata
@param {{?}} user The user to write JSON for
@param {{?}} options The map of server options
@returns {?} A new JSON object for the user | [
"Write",
"out",
"the",
"JSON",
"for",
"the",
"given",
"user",
"metadata"
] | eb2583100c662b5cfc1b461a978b31d3b8555ce1 | https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/modules/orionode/lib/user.js#L71-L85 | train |
eclipse/orion.client | modules/orionode/lib/user.js | oauth | function oauth(id, username, email, req, done) {
if (req.params["0"] === "/link") {
return done(null, {
__linkUser: true,
email: email,
username: username,
id: id
});
}
fileUtil.getMetastoreSafe(req).then(function(store) {
store.getUserByOAuth(id, function(err, user) {
if (err) {
return done... | javascript | function oauth(id, username, email, req, done) {
if (req.params["0"] === "/link") {
return done(null, {
__linkUser: true,
email: email,
username: username,
id: id
});
}
fileUtil.getMetastoreSafe(req).then(function(store) {
store.getUserByOAuth(id, function(err, user) {
if (err) {
return done... | [
"function",
"oauth",
"(",
"id",
",",
"username",
",",
"email",
",",
"req",
",",
"done",
")",
"{",
"if",
"(",
"req",
".",
"params",
"[",
"\"0\"",
"]",
"===",
"\"/link\"",
")",
"{",
"return",
"done",
"(",
"null",
",",
"{",
"__linkUser",
":",
"true",
... | Do OAuth authentication
@param {string} id
@param {string} username
@param {string} email
@param {XMLHttpRequest} req
@param {fn(Error, {?})} done | [
"Do",
"OAuth",
"authentication"
] | eb2583100c662b5cfc1b461a978b31d3b8555ce1 | https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/modules/orionode/lib/user.js#L183-L210 | train |
eclipse/orion.client | modules/orionode/lib/user.js | configureGithubOAuth | function configureGithubOAuth(app, options) {
if (options.configParams.get("orion.oauth.github.client")) {
const GithubStrategy = require('passport-github2').Strategy;
passport.use(new GithubStrategy({
clientID: options.configParams.get("orion.oauth.github.client"),
clientSecret: options.configParams.get("or... | javascript | function configureGithubOAuth(app, options) {
if (options.configParams.get("orion.oauth.github.client")) {
const GithubStrategy = require('passport-github2').Strategy;
passport.use(new GithubStrategy({
clientID: options.configParams.get("orion.oauth.github.client"),
clientSecret: options.configParams.get("or... | [
"function",
"configureGithubOAuth",
"(",
"app",
",",
"options",
")",
"{",
"if",
"(",
"options",
".",
"configParams",
".",
"get",
"(",
"\"orion.oauth.github.client\"",
")",
")",
"{",
"const",
"GithubStrategy",
"=",
"require",
"(",
"'passport-github2'",
")",
".",
... | Optionally configures GitHub OAuth. Checks for the server property 'orion.oauth.github.client', and if found optionally
sets up the support.
@param {express.Router} app The backing app
@param {{?}} options The map of server options
@see https://wiki.eclipse.org/Orion/Server_admin_guide#Setting_up_GitHub_OAuth_authentic... | [
"Optionally",
"configures",
"GitHub",
"OAuth",
".",
"Checks",
"for",
"the",
"server",
"property",
"orion",
".",
"oauth",
".",
"github",
".",
"client",
"and",
"if",
"found",
"optionally",
"sets",
"up",
"the",
"support",
"."
] | eb2583100c662b5cfc1b461a978b31d3b8555ce1 | https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/modules/orionode/lib/user.js#L320-L341 | train |
eclipse/orion.client | modules/orionode/lib/user.js | checkUserAccess | function checkUserAccess(req, res, next) {
const isadmin = isAdmin(options, req.user.username);
if (!req.user || !(req.params.id === req.user.username || isadmin)) {
return api.writeResponse(403, res);
}
const contextPath = options.configParams.get("orion.context.path") || "",
listenContextPath = options.... | javascript | function checkUserAccess(req, res, next) {
const isadmin = isAdmin(options, req.user.username);
if (!req.user || !(req.params.id === req.user.username || isadmin)) {
return api.writeResponse(403, res);
}
const contextPath = options.configParams.get("orion.context.path") || "",
listenContextPath = options.... | [
"function",
"checkUserAccess",
"(",
"req",
",",
"res",
",",
"next",
")",
"{",
"const",
"isadmin",
"=",
"isAdmin",
"(",
"options",
",",
"req",
".",
"user",
".",
"username",
")",
";",
"if",
"(",
"!",
"req",
".",
"user",
"||",
"!",
"(",
"req",
".",
... | Checks is the logged in user has access to the requested resource
@param {XMLHttpRequest} req The backing request
@param {XMLHttpResponse} res The response object
@param {fn} next The next function to skip ahead | [
"Checks",
"is",
"the",
"logged",
"in",
"user",
"has",
"access",
"to",
"the",
"requested",
"resource"
] | eb2583100c662b5cfc1b461a978b31d3b8555ce1 | https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/modules/orionode/lib/user.js#L382-L394 | train |
eclipse/orion.client | bundles/org.eclipse.orion.client.ui/web/gcli/gcli/types.js | function() {
var combined = Status.VALID;
for (var i = 0; i < arguments.length; i++) {
var status = arguments[i];
if (Array.isArray(status)) {
status = Status.combine.apply(null, status);
}
if (status > combined) {
combined = status;
}
}
return combined;
} | javascript | function() {
var combined = Status.VALID;
for (var i = 0; i < arguments.length; i++) {
var status = arguments[i];
if (Array.isArray(status)) {
status = Status.combine.apply(null, status);
}
if (status > combined) {
combined = status;
}
}
return combined;
} | [
"function",
"(",
")",
"{",
"var",
"combined",
"=",
"Status",
".",
"VALID",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"arguments",
".",
"length",
";",
"i",
"++",
")",
"{",
"var",
"status",
"=",
"arguments",
"[",
"i",
"]",
";",
"if",
... | A combined status is the worser of the provided statuses. The statuses
can be provided either as a set of arguments or a single array | [
"A",
"combined",
"status",
"is",
"the",
"worser",
"of",
"the",
"provided",
"statuses",
".",
"The",
"statuses",
"can",
"be",
"provided",
"either",
"as",
"a",
"set",
"of",
"arguments",
"or",
"a",
"single",
"array"
] | eb2583100c662b5cfc1b461a978b31d3b8555ce1 | https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/gcli/gcli/types.js#L68-L80 | train | |
eclipse/orion.client | bundles/org.eclipse.orion.client.javascript/web/eslint/lib/code-path-analysis/code-path.js | function(options, callback) {
if (typeof options === "function") {
callback = options;
options = null;
}
options = options || {};
var startSegment = options.first || this.internal.initialSegment;
var lastSegment = options.last;
var item = null;
var index = 0;
var end = 0;
var segmen... | javascript | function(options, callback) {
if (typeof options === "function") {
callback = options;
options = null;
}
options = options || {};
var startSegment = options.first || this.internal.initialSegment;
var lastSegment = options.last;
var item = null;
var index = 0;
var end = 0;
var segmen... | [
"function",
"(",
"options",
",",
"callback",
")",
"{",
"if",
"(",
"typeof",
"options",
"===",
"\"function\"",
")",
"{",
"callback",
"=",
"options",
";",
"options",
"=",
"null",
";",
"}",
"options",
"=",
"options",
"||",
"{",
"}",
";",
"var",
"startSegm... | Traverses all segments in this code path.
codePath.traverseSegments(function(segment, controller) {
// do something.
});
This method enumerates segments in order from the head.
The `controller` object has two methods.
- `controller.skip()` - Skip the following segments in this branch.
- `controller.break()` - Skip ... | [
"Traverses",
"all",
"segments",
"in",
"this",
"code",
"path",
"."
] | eb2583100c662b5cfc1b461a978b31d3b8555ce1 | https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.javascript/web/eslint/lib/code-path-analysis/code-path.js#L125-L220 | train |
Subsets and Splits
SQL Console for semeru/code-text-javascript
Retrieves 20,000 non-null code samples labeled as JavaScript, providing a basic overview of the dataset.