repo
stringclasses
192 values
path
stringlengths
4
115
func_name
stringlengths
0
45
original_string
stringlengths
74
24k
language
stringclasses
1 value
code
stringlengths
74
24k
code_tokens
listlengths
23
4.2k
docstring
stringlengths
2
23.7k
docstring_tokens
listlengths
1
810
sha
stringclasses
192 values
url
stringlengths
90
200
partition
stringclasses
1 value
summary
stringlengths
6
313
input_ids
listlengths
502
502
token_type_ids
listlengths
502
502
attention_mask
listlengths
502
502
labels
listlengths
502
502
SAP/openui5
src/sap.ui.core/src/sap/ui/core/routing/Targets.js
function (sName, oTargetOptions) { var oOldTarget = this.getTarget(sName), oTarget; if (oOldTarget) { Log.error("Target with name " + sName + " already exists", this); } else { oTarget = this._createTarget(sName, oTargetOptions); this._addParentTo(oTarget); } return this; }
javascript
function (sName, oTargetOptions) { var oOldTarget = this.getTarget(sName), oTarget; if (oOldTarget) { Log.error("Target with name " + sName + " already exists", this); } else { oTarget = this._createTarget(sName, oTargetOptions); this._addParentTo(oTarget); } return this; }
[ "function", "(", "sName", ",", "oTargetOptions", ")", "{", "var", "oOldTarget", "=", "this", ".", "getTarget", "(", "sName", ")", ",", "oTarget", ";", "if", "(", "oOldTarget", ")", "{", "Log", ".", "error", "(", "\"Target with name \"", "+", "sName", "+"...
Creates a target by using the given name and options. If there's already a target with the same name exists, the existing target is kept from being overwritten and an error log will be written to the development console. @param {string} sName the name of a target @param {object} oTarget the options of a target. The option names are the same as the ones in "oOptions.targets.anyName" of {@link #constructor}. @returns {sap.ui.core.routing.Targets} Targets itself for method chaining @public
[ "Creates", "a", "target", "by", "using", "the", "given", "name", "and", "options", ".", "If", "there", "s", "already", "a", "target", "with", "the", "same", "name", "exists", "the", "existing", "target", "is", "kept", "from", "being", "overwritten", "and",...
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/routing/Targets.js#L427-L439
train
Creates a new target instance
[ 30522, 3853, 1006, 1055, 18442, 1010, 27178, 2906, 18150, 7361, 9285, 1007, 1063, 13075, 1051, 11614, 7559, 18150, 1027, 2023, 1012, 2131, 7559, 18150, 1006, 1055, 18442, 1007, 1010, 27178, 2906, 18150, 1025, 2065, 1006, 1051, 11614, 7559, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
graphql/graphiql
src/utility/fillLeafs.js
getIndentation
function getIndentation(str, index) { let indentStart = index; let indentEnd = index; while (indentStart) { const c = str.charCodeAt(indentStart - 1); // line break if (c === 10 || c === 13 || c === 0x2028 || c === 0x2029) { break; } indentStart--; // not white space if (c !== 9 && c !== 11 && c !== 12 && c !== 32 && c !== 160) { indentEnd = indentStart; } } return str.substring(indentStart, indentEnd); }
javascript
function getIndentation(str, index) { let indentStart = index; let indentEnd = index; while (indentStart) { const c = str.charCodeAt(indentStart - 1); // line break if (c === 10 || c === 13 || c === 0x2028 || c === 0x2029) { break; } indentStart--; // not white space if (c !== 9 && c !== 11 && c !== 12 && c !== 32 && c !== 160) { indentEnd = indentStart; } } return str.substring(indentStart, indentEnd); }
[ "function", "getIndentation", "(", "str", ",", "index", ")", "{", "let", "indentStart", "=", "index", ";", "let", "indentEnd", "=", "index", ";", "while", "(", "indentStart", ")", "{", "const", "c", "=", "str", ".", "charCodeAt", "(", "indentStart", "-",...
Given a string and an index, look backwards to find the string of whitespace following the next previous line break.
[ "Given", "a", "string", "and", "an", "index", "look", "backwards", "to", "find", "the", "string", "of", "whitespace", "following", "the", "next", "previous", "line", "break", "." ]
5d0f31d6059edc5f816edba3962c3b57fdabd478
https://github.com/graphql/graphiql/blob/5d0f31d6059edc5f816edba3962c3b57fdabd478/src/utility/fillLeafs.js#L161-L177
train
Get the indentation of a line
[ 30522, 3853, 2131, 22254, 19304, 1006, 2358, 2099, 1010, 5950, 1007, 1063, 2292, 27427, 11187, 7559, 2102, 1027, 5950, 1025, 2292, 27427, 15781, 4859, 1027, 5950, 1025, 2096, 1006, 27427, 11187, 7559, 2102, 1007, 1063, 9530, 3367, 1039, 102...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
adobe/brackets
src/extensions/default/CodeFolding/foldhelpers/foldgutter.js
updateFoldInfo
function updateFoldInfo(cm, from, to) { var minFoldSize = prefs.getSetting("minFoldSize") || 2; var opts = cm.state.foldGutter.options; var fade = prefs.getSetting("hideUntilMouseover"); var $gutter = $(cm.getGutterElement()); var i = from; function clear(m) { return m.clear(); } /** * @private * helper function to check if the given line is in a folded region in the editor. * @param {number} line the * @return {Object} the range that hides the specified line or undefine if the line is not hidden */ function _isCurrentlyFolded(line) { var keys = Object.keys(cm._lineFolds), i = 0, range; while (i < keys.length) { range = cm._lineFolds[keys[i]]; if (range.from.line < line && range.to.line >= line) { return range; } i++; } } /** This case is needed when unfolding a region that does not cause the viewport to change. For instance in a file with about 15 lines, if some code regions are folded and unfolded, the viewport change event isn't fired by CodeMirror. The setTimeout is a workaround to trigger the gutter update after the viewport has been drawn. */ if (i === to) { window.setTimeout(function () { var vp = cm.getViewport(); updateFoldInfo(cm, vp.from, vp.to); }, 200); } while (i < to) { var sr = _isCurrentlyFolded(i), // surrounding range for the current line if one exists range; var mark = marker("CodeMirror-foldgutter-blank"); var pos = CodeMirror.Pos(i, 0), func = opts.rangeFinder || CodeMirror.fold.auto; // don't look inside collapsed ranges if (sr) { i = sr.to.line + 1; } else { range = cm._lineFolds[i] || (func && func(cm, pos)); if (!fade || (fade && $gutter.is(":hover"))) { if (cm.isFolded(i)) { // expand fold if invalid if (range) { mark = marker(opts.indicatorFolded); } else { cm.findMarksAt(pos).filter(isFold) .forEach(clear); } } else { if (range && range.to.line - range.from.line >= minFoldSize) { mark = marker(opts.indicatorOpen); } } } cm.setGutterMarker(i, opts.gutter, mark); i++; } } }
javascript
function updateFoldInfo(cm, from, to) { var minFoldSize = prefs.getSetting("minFoldSize") || 2; var opts = cm.state.foldGutter.options; var fade = prefs.getSetting("hideUntilMouseover"); var $gutter = $(cm.getGutterElement()); var i = from; function clear(m) { return m.clear(); } /** * @private * helper function to check if the given line is in a folded region in the editor. * @param {number} line the * @return {Object} the range that hides the specified line or undefine if the line is not hidden */ function _isCurrentlyFolded(line) { var keys = Object.keys(cm._lineFolds), i = 0, range; while (i < keys.length) { range = cm._lineFolds[keys[i]]; if (range.from.line < line && range.to.line >= line) { return range; } i++; } } /** This case is needed when unfolding a region that does not cause the viewport to change. For instance in a file with about 15 lines, if some code regions are folded and unfolded, the viewport change event isn't fired by CodeMirror. The setTimeout is a workaround to trigger the gutter update after the viewport has been drawn. */ if (i === to) { window.setTimeout(function () { var vp = cm.getViewport(); updateFoldInfo(cm, vp.from, vp.to); }, 200); } while (i < to) { var sr = _isCurrentlyFolded(i), // surrounding range for the current line if one exists range; var mark = marker("CodeMirror-foldgutter-blank"); var pos = CodeMirror.Pos(i, 0), func = opts.rangeFinder || CodeMirror.fold.auto; // don't look inside collapsed ranges if (sr) { i = sr.to.line + 1; } else { range = cm._lineFolds[i] || (func && func(cm, pos)); if (!fade || (fade && $gutter.is(":hover"))) { if (cm.isFolded(i)) { // expand fold if invalid if (range) { mark = marker(opts.indicatorFolded); } else { cm.findMarksAt(pos).filter(isFold) .forEach(clear); } } else { if (range && range.to.line - range.from.line >= minFoldSize) { mark = marker(opts.indicatorOpen); } } } cm.setGutterMarker(i, opts.gutter, mark); i++; } } }
[ "function", "updateFoldInfo", "(", "cm", ",", "from", ",", "to", ")", "{", "var", "minFoldSize", "=", "prefs", ".", "getSetting", "(", "\"minFoldSize\"", ")", "||", "2", ";", "var", "opts", "=", "cm", ".", "state", ".", "foldGutter", ".", "options", ";...
Updates the gutter markers for the specified range @param {!CodeMirror} cm the CodeMirror instance for the active editor @param {!number} from the starting line for the update @param {!number} to the ending line for the update
[ "Updates", "the", "gutter", "markers", "for", "the", "specified", "range" ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/extensions/default/CodeFolding/foldhelpers/foldgutter.js#L50-L122
train
Update the fold gutter
[ 30522, 3853, 10651, 30524, 1027, 3653, 10343, 1012, 4152, 18319, 3070, 1006, 1000, 8117, 10371, 5332, 4371, 1000, 1007, 1064, 1064, 1016, 1025, 13075, 23569, 2015, 1027, 4642, 1012, 2110, 1012, 10671, 27920, 3334, 1012, 7047, 1025, 13075, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.core/src/sap/ui/model/odata/ODataUtils.js
simpleCompare
function simpleCompare(vValue1, vValue2) { if (vValue1 === vValue2) { return 0; } if (vValue1 === null || vValue2 === null || vValue1 === undefined || vValue2 === undefined) { return NaN; } return vValue1 > vValue2 ? 1 : -1; }
javascript
function simpleCompare(vValue1, vValue2) { if (vValue1 === vValue2) { return 0; } if (vValue1 === null || vValue2 === null || vValue1 === undefined || vValue2 === undefined) { return NaN; } return vValue1 > vValue2 ? 1 : -1; }
[ "function", "simpleCompare", "(", "vValue1", ",", "vValue2", ")", "{", "if", "(", "vValue1", "===", "vValue2", ")", "{", "return", "0", ";", "}", "if", "(", "vValue1", "===", "null", "||", "vValue2", "===", "null", "||", "vValue1", "===", "undefined", ...
Compares the given values using <code>===</code> and <code>></code>. @param {any} vValue1 the first value to compare @param {any} vValue2 the second value to compare @return {int} the result of the compare: <code>0</code> if the values are equal, <code>-1</code> if the first value is smaller, <code>1</code> if the first value is larger, <code>NaN</code> if they cannot be compared
[ "Compares", "the", "given", "values", "using", "<code", ">", "===", "<", "/", "code", ">", "and", "<code", ">>", "<", "/", "code", ">", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/ODataUtils.js#L551-L560
train
Simple compare function
[ 30522, 3853, 3722, 9006, 19362, 2063, 1006, 1058, 10175, 5657, 2487, 1010, 1058, 10175, 5657, 2475, 1007, 1063, 2065, 1006, 1058, 10175, 5657, 2487, 1027, 1027, 1027, 1058, 10175, 5657, 2475, 1007, 1063, 2709, 1014, 1025, 1065, 2065, 1006, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
eslint/eslint
Makefile.js
getFirstVersionOfDeletion
function getFirstVersionOfDeletion(filePath) { const deletionCommit = getCommitDeletingFile(filePath), tags = execSilent(`git tag --contains ${deletionCommit}`); return splitCommandResultToLines(tags) .map(version => semver.valid(version.trim())) .filter(version => version) .sort(semver.compare)[0]; }
javascript
function getFirstVersionOfDeletion(filePath) { const deletionCommit = getCommitDeletingFile(filePath), tags = execSilent(`git tag --contains ${deletionCommit}`); return splitCommandResultToLines(tags) .map(version => semver.valid(version.trim())) .filter(version => version) .sort(semver.compare)[0]; }
[ "function", "getFirstVersionOfDeletion", "(", "filePath", ")", "{", "const", "deletionCommit", "=", "getCommitDeletingFile", "(", "filePath", ")", ",", "tags", "=", "execSilent", "(", "`", "${", "deletionCommit", "}", "`", ")", ";", "return", "splitCommandResultTo...
Gets the first version number where a given file is no longer present. @param {string} filePath The path to the deleted file. @returns {string} The version number.
[ "Gets", "the", "first", "version", "number", "where", "a", "given", "file", "is", "no", "longer", "present", "." ]
bc0819c94aad14f7fad3cbc2338ea15658b0f272
https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/Makefile.js#L371-L379
train
Get the first version of the given file
[ 30522, 3853, 2131, 8873, 12096, 27774, 11253, 9247, 20624, 2239, 1006, 5371, 15069, 1007, 1063, 9530, 3367, 3972, 20624, 2239, 9006, 22930, 1027, 2131, 9006, 22930, 9247, 20624, 3070, 8873, 2571, 1006, 5371, 15069, 1007, 1010, 22073, 1027, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.core/src/sap/ui/model/odata/v4/lib/_Cache.js
fetchType
function fetchType(sMetaPath) { aPromises.push(that.oRequestor.fetchTypeForPath(sMetaPath).then(function (oType) { var oMessageAnnotation = that.oRequestor.getModelInterface() .fetchMetadata(sMetaPath + "/" + sMessagesAnnotation).getResult(); if (oMessageAnnotation) { oType = Object.create(oType); oType[sMessagesAnnotation] = oMessageAnnotation; } mTypeForMetaPath[sMetaPath] = oType; if (oType && oType.$Key) { oType.$Key.forEach(function (vKey) { var iIndexOfSlash, sKeyPath; if (typeof vKey !== "string") { sKeyPath = vKey[Object.keys(vKey)[0]]; iIndexOfSlash = sKeyPath.lastIndexOf("/"); if (iIndexOfSlash >= 0) { // drop the property name and fetch the type containing it fetchType(sMetaPath + "/" + sKeyPath.slice(0, iIndexOfSlash)); } } }); } })); }
javascript
function fetchType(sMetaPath) { aPromises.push(that.oRequestor.fetchTypeForPath(sMetaPath).then(function (oType) { var oMessageAnnotation = that.oRequestor.getModelInterface() .fetchMetadata(sMetaPath + "/" + sMessagesAnnotation).getResult(); if (oMessageAnnotation) { oType = Object.create(oType); oType[sMessagesAnnotation] = oMessageAnnotation; } mTypeForMetaPath[sMetaPath] = oType; if (oType && oType.$Key) { oType.$Key.forEach(function (vKey) { var iIndexOfSlash, sKeyPath; if (typeof vKey !== "string") { sKeyPath = vKey[Object.keys(vKey)[0]]; iIndexOfSlash = sKeyPath.lastIndexOf("/"); if (iIndexOfSlash >= 0) { // drop the property name and fetch the type containing it fetchType(sMetaPath + "/" + sKeyPath.slice(0, iIndexOfSlash)); } } }); } })); }
[ "function", "fetchType", "(", "sMetaPath", ")", "{", "aPromises", ".", "push", "(", "that", ".", "oRequestor", ".", "fetchTypeForPath", "(", "sMetaPath", ")", ".", "then", "(", "function", "(", "oType", ")", "{", "var", "oMessageAnnotation", "=", "that", "...
/* Adds a promise to aPromises to fetch the type for the given path, put it into mTypeForMetaPath and recursively add the key properties' types if they are complex. @param {string} sMetaPath The meta path of the resource + navigation or key path (which may lead to an entity or complex type or to <code>undefined</code>)
[ "/", "*", "Adds", "a", "promise", "to", "aPromises", "to", "fetch", "the", "type", "for", "the", "given", "path", "put", "it", "into", "mTypeForMetaPath", "and", "recursively", "add", "the", "key", "properties", "types", "if", "they", "are", "complex", "."...
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/v4/lib/_Cache.js#L549-L575
train
Fetch the type for the given meta path
[ 30522, 3853, 18584, 13874, 1006, 15488, 12928, 15069, 1007, 1063, 19804, 20936, 8583, 1012, 5245, 1006, 2008, 1012, 10848, 15500, 2953, 1012, 18584, 13874, 29278, 15069, 1006, 15488, 12928, 15069, 1007, 1012, 2059, 1006, 3853, 1006, 27178, 18...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.m/src/sap/m/SuggestionItem.js
renderItemText
function renderItemText(oRm, sText, sSearch){ var i; if (sText) { i = sText.toUpperCase().indexOf(sSearch.toUpperCase()); if (i > -1){ oRm.writeEscaped(sText.slice(0, i)); oRm.write("<b>"); oRm.writeEscaped(sText.slice(i, i + sSearch.length)); oRm.write("</b>"); sText = sText.substring(i + sSearch.length); } oRm.writeEscaped(sText); } }
javascript
function renderItemText(oRm, sText, sSearch){ var i; if (sText) { i = sText.toUpperCase().indexOf(sSearch.toUpperCase()); if (i > -1){ oRm.writeEscaped(sText.slice(0, i)); oRm.write("<b>"); oRm.writeEscaped(sText.slice(i, i + sSearch.length)); oRm.write("</b>"); sText = sText.substring(i + sSearch.length); } oRm.writeEscaped(sText); } }
[ "function", "renderItemText", "(", "oRm", ",", "sText", ",", "sSearch", ")", "{", "var", "i", ";", "if", "(", "sText", ")", "{", "i", "=", "sText", ".", "toUpperCase", "(", ")", ".", "indexOf", "(", "sSearch", ".", "toUpperCase", "(", ")", ")", ";"...
Render output text to make occurrences of the search text value bold:
[ "Render", "output", "text", "to", "make", "occurrences", "of", "the", "search", "text", "value", "bold", ":" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.m/src/sap/m/SuggestionItem.js#L51-L64
train
Renders the given text
[ 30522, 3853, 17552, 4221, 20492, 10288, 2102, 1006, 2030, 2213, 1010, 26261, 18413, 1010, 7020, 14644, 2818, 1007, 1063, 13075, 1045, 1025, 2065, 1006, 26261, 18413, 1007, 1063, 1045, 1027, 26261, 18413, 1012, 2000, 29547, 18992, 3366, 1006, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.core/src/sap/ui/core/support/techinfo/TechnicalInfo.js
function () { // create i18n model var oI18nModel = new ResourceModel({ bundleName: "sap.ui.core.messagebundle" }); this._oDialog.setModel(oI18nModel, "i18n"); this._oDialog.setModel(this._createViewModel(), "view"); // set compact/cozy style class this._oDialog.addStyleClass(this._getContentDensityClass()); }
javascript
function () { // create i18n model var oI18nModel = new ResourceModel({ bundleName: "sap.ui.core.messagebundle" }); this._oDialog.setModel(oI18nModel, "i18n"); this._oDialog.setModel(this._createViewModel(), "view"); // set compact/cozy style class this._oDialog.addStyleClass(this._getContentDensityClass()); }
[ "function", "(", ")", "{", "// create i18n model", "var", "oI18nModel", "=", "new", "ResourceModel", "(", "{", "bundleName", ":", "\"sap.ui.core.messagebundle\"", "}", ")", ";", "this", ".", "_oDialog", ".", "setModel", "(", "oI18nModel", ",", "\"i18n\"", ")", ...
Initalizes the technical information dialog @private
[ "Initalizes", "the", "technical", "information", "dialog" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/support/techinfo/TechnicalInfo.js#L574-L584
train
Creates the i18n model and sets the view model
[ 30522, 3853, 1006, 1007, 1063, 1013, 1013, 3443, 1045, 15136, 2078, 2944, 13075, 1051, 2072, 15136, 2078, 5302, 9247, 1027, 2047, 7692, 5302, 9247, 1006, 1063, 14012, 18442, 1024, 1000, 20066, 1012, 21318, 1012, 4563, 1012, 4471, 27265, 257...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
thomaspark/bootswatch
docs/3/bower_components/html5shiv/dist/html5shiv-printshiv.js
createDocumentFragment
function createDocumentFragment(ownerDocument, data){ if (!ownerDocument) { ownerDocument = document; } if(supportsUnknownElements){ return ownerDocument.createDocumentFragment(); } data = data || getExpandoData(ownerDocument); var clone = data.frag.cloneNode(), i = 0, elems = getElements(), l = elems.length; for(;i<l;i++){ clone.createElement(elems[i]); } return clone; }
javascript
function createDocumentFragment(ownerDocument, data){ if (!ownerDocument) { ownerDocument = document; } if(supportsUnknownElements){ return ownerDocument.createDocumentFragment(); } data = data || getExpandoData(ownerDocument); var clone = data.frag.cloneNode(), i = 0, elems = getElements(), l = elems.length; for(;i<l;i++){ clone.createElement(elems[i]); } return clone; }
[ "function", "createDocumentFragment", "(", "ownerDocument", ",", "data", ")", "{", "if", "(", "!", "ownerDocument", ")", "{", "ownerDocument", "=", "document", ";", "}", "if", "(", "supportsUnknownElements", ")", "{", "return", "ownerDocument", ".", "createDocum...
returns a shived DocumentFragment for the given document @memberOf html5 @param {Document} ownerDocument The context document. @returns {Object} The shived DocumentFragment.
[ "returns", "a", "shived", "DocumentFragment", "for", "the", "given", "document" ]
a913e4992dad8f7bf38df2e1d3f4cc6bfe5f26dd
https://github.com/thomaspark/bootswatch/blob/a913e4992dad8f7bf38df2e1d3f4cc6bfe5f26dd/docs/3/bower_components/html5shiv/dist/html5shiv-printshiv.js#L163-L179
train
Creates a document fragment
[ 30522, 3853, 2580, 10085, 27417, 24475, 29181, 3672, 1006, 3954, 3527, 24894, 4765, 1010, 2951, 1007, 1063, 2065, 1006, 999, 3954, 3527, 24894, 4765, 1007, 1063, 3954, 3527, 24894, 4765, 1027, 6254, 1025, 1065, 2065, 1006, 6753, 16814, 1977...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
openlayers/openlayers
src/ol/pointer/MouseSource.js
mouseup
function mouseup(inEvent) { if (!this.isEventSimulatedFromTouch_(inEvent)) { const p = this.pointerMap[POINTER_ID.toString()]; if (p && p.button === inEvent.button) { const e = prepareEvent(inEvent, this.dispatcher); this.dispatcher.up(e, inEvent); this.cleanupMouse(); } } }
javascript
function mouseup(inEvent) { if (!this.isEventSimulatedFromTouch_(inEvent)) { const p = this.pointerMap[POINTER_ID.toString()]; if (p && p.button === inEvent.button) { const e = prepareEvent(inEvent, this.dispatcher); this.dispatcher.up(e, inEvent); this.cleanupMouse(); } } }
[ "function", "mouseup", "(", "inEvent", ")", "{", "if", "(", "!", "this", ".", "isEventSimulatedFromTouch_", "(", "inEvent", ")", ")", "{", "const", "p", "=", "this", ".", "pointerMap", "[", "POINTER_ID", ".", "toString", "(", ")", "]", ";", "if", "(", ...
Handler for `mouseup`. @this {MouseSource} @param {MouseEvent} inEvent The in event.
[ "Handler", "for", "mouseup", "." ]
f366eaea522388fb575b11010e69d309164baca7
https://github.com/openlayers/openlayers/blob/f366eaea522388fb575b11010e69d309164baca7/src/ol/pointer/MouseSource.js#L95-L105
train
mouseup event handler
[ 30522, 3853, 8000, 6279, 1006, 1999, 18697, 3372, 1007, 1063, 2065, 1006, 999, 2023, 1012, 2003, 18697, 7666, 5714, 8898, 19699, 5358, 24826, 2818, 1035, 1006, 1999, 18697, 3372, 1007, 1007, 1063, 9530, 3367, 1052, 1027, 2023, 1012, 20884, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
eslint/eslint
Makefile.js
hasIdInTitle
function hasIdInTitle(id) { const docText = cat(docFilename); const idOldAtEndOfTitleRegExp = new RegExp(`^# (.*?) \\(${id}\\)`, "u"); // original format const idNewAtBeginningOfTitleRegExp = new RegExp(`^# ${id}: `, "u"); // new format is same as rules index /* * 1. Added support for new format. * 2. Will remove support for old format after all docs files have new format. * 3. Will remove this check when the main heading is automatically generated from rule metadata. */ return idNewAtBeginningOfTitleRegExp.test(docText) || idOldAtEndOfTitleRegExp.test(docText); }
javascript
function hasIdInTitle(id) { const docText = cat(docFilename); const idOldAtEndOfTitleRegExp = new RegExp(`^# (.*?) \\(${id}\\)`, "u"); // original format const idNewAtBeginningOfTitleRegExp = new RegExp(`^# ${id}: `, "u"); // new format is same as rules index /* * 1. Added support for new format. * 2. Will remove support for old format after all docs files have new format. * 3. Will remove this check when the main heading is automatically generated from rule metadata. */ return idNewAtBeginningOfTitleRegExp.test(docText) || idOldAtEndOfTitleRegExp.test(docText); }
[ "function", "hasIdInTitle", "(", "id", ")", "{", "const", "docText", "=", "cat", "(", "docFilename", ")", ";", "const", "idOldAtEndOfTitleRegExp", "=", "new", "RegExp", "(", "`", "\\\\", "${", "id", "}", "\\\\", "`", ",", "\"u\"", ")", ";", "// original ...
Check if id is present in title @param {string} id id to check for @returns {boolean} true if present @private
[ "Check", "if", "id", "is", "present", "in", "title" ]
bc0819c94aad14f7fad3cbc2338ea15658b0f272
https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/Makefile.js#L817-L828
train
Check if the doc has the given id in the title
[ 30522, 3853, 2038, 28173, 16778, 9286, 1006, 8909, 1007, 1063, 9530, 3367, 9986, 18209, 1027, 4937, 1006, 9986, 8873, 20844, 4168, 1007, 1025, 9530, 3367, 10282, 13701, 15482, 6199, 4183, 3917, 24746, 2595, 2361, 1027, 2047, 19723, 10288, 2...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
jgraph/mxgraph
javascript/mxClient.js
mxGraphHierarchyNode
function mxGraphHierarchyNode(cell) { mxGraphAbstractHierarchyCell.apply(this, arguments); this.cell = cell; this.id = mxObjectIdentity.get(cell); this.connectsAsTarget = []; this.connectsAsSource = []; }
javascript
function mxGraphHierarchyNode(cell) { mxGraphAbstractHierarchyCell.apply(this, arguments); this.cell = cell; this.id = mxObjectIdentity.get(cell); this.connectsAsTarget = []; this.connectsAsSource = []; }
[ "function", "mxGraphHierarchyNode", "(", "cell", ")", "{", "mxGraphAbstractHierarchyCell", ".", "apply", "(", "this", ",", "arguments", ")", ";", "this", ".", "cell", "=", "cell", ";", "this", ".", "id", "=", "mxObjectIdentity", ".", "get", "(", "cell", ")...
Copyright (c) 2006-2015, JGraph Ltd Copyright (c) 2006-2015, Gaudenz Alder Class: mxGraphHierarchyNode An abstraction of a hierarchical edge for the hierarchy layout Constructor: mxGraphHierarchyNode Constructs an internal node to represent the specified real graph cell Arguments: cell - the real graph cell this node represents
[ "Copyright", "(", "c", ")", "2006", "-", "2015", "JGraph", "Ltd", "Copyright", "(", "c", ")", "2006", "-", "2015", "Gaudenz", "Alder", "Class", ":", "mxGraphHierarchyNode" ]
33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44
https://github.com/jgraph/mxgraph/blob/33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44/javascript/mxClient.js#L32959-L32966
train
A node in the hierarchy of a cell.
[ 30522, 3853, 25630, 14413, 4048, 6906, 29389, 3630, 3207, 1006, 3526, 1007, 1063, 25630, 14413, 7875, 20528, 6593, 4048, 6906, 29389, 29109, 2140, 1012, 6611, 1006, 2023, 1010, 9918, 1007, 1025, 2023, 1012, 3526, 1027, 3526, 1025, 2023, 101...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
jgraph/mxgraph
javascript/mxClient.js
function() { var doc = null; if (document.implementation && document.implementation.createDocument) { doc = document.implementation.createDocument('', '', null); } else if (window.ActiveXObject) { doc = new ActiveXObject('Microsoft.XMLDOM'); } return doc; }
javascript
function() { var doc = null; if (document.implementation && document.implementation.createDocument) { doc = document.implementation.createDocument('', '', null); } else if (window.ActiveXObject) { doc = new ActiveXObject('Microsoft.XMLDOM'); } return doc; }
[ "function", "(", ")", "{", "var", "doc", "=", "null", ";", "if", "(", "document", ".", "implementation", "&&", "document", ".", "implementation", ".", "createDocument", ")", "{", "doc", "=", "document", ".", "implementation", ".", "createDocument", "(", "'...
Function: createXmlDocument Returns a new, empty XML document.
[ "Function", ":", "createXmlDocument" ]
33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44
https://github.com/jgraph/mxgraph/blob/33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44/javascript/mxClient.js#L2713-L2727
train
Returns a document object
[ 30522, 3853, 1006, 1007, 1063, 13075, 9986, 1027, 19701, 1025, 2065, 1006, 6254, 1012, 7375, 1004, 1004, 6254, 1012, 7375, 1012, 2580, 10085, 27417, 2102, 1007, 1063, 9986, 1027, 6254, 1012, 7375, 1012, 2580, 10085, 27417, 2102, 1006, 1005,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SeleniumHQ/selenium
third_party/js/mozmill/shared-modules/tabview.js
tabView_closeGroup
function tabView_closeGroup(aSpec) { var spec = aSpec || {}; var group = spec.group; if (!group) { throw new Error(arguments.callee.name + ": Group not specified."); } var button = this.getElement({ type: "group_closeButton", value: group }); this._controller.click(button); this.waitForGroupClosed({group: group}); }
javascript
function tabView_closeGroup(aSpec) { var spec = aSpec || {}; var group = spec.group; if (!group) { throw new Error(arguments.callee.name + ": Group not specified."); } var button = this.getElement({ type: "group_closeButton", value: group }); this._controller.click(button); this.waitForGroupClosed({group: group}); }
[ "function", "tabView_closeGroup", "(", "aSpec", ")", "{", "var", "spec", "=", "aSpec", "||", "{", "}", ";", "var", "group", "=", "spec", ".", "group", ";", "if", "(", "!", "group", ")", "{", "throw", "new", "Error", "(", "arguments", ".", "callee", ...
Close the specified tab group @param {object} aSpec Information on which group to operate on Elements: group - Group
[ "Close", "the", "specified", "tab", "group" ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/js/mozmill/shared-modules/tabview.js#L211-L226
train
Close a group
[ 30522, 3853, 21628, 8584, 1035, 2485, 17058, 1006, 2004, 5051, 2278, 1007, 1063, 13075, 28699, 1027, 2004, 5051, 2278, 1064, 1064, 1063, 1065, 1025, 13075, 2177, 1027, 28699, 1012, 2177, 1025, 2065, 1006, 999, 2177, 1007, 1063, 5466, 2047, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
chartjs/Chart.js
src/controllers/controller.bar.js
computeFlexCategoryTraits
function computeFlexCategoryTraits(index, ruler, options) { var pixels = ruler.pixels; var curr = pixels[index]; var prev = index > 0 ? pixels[index - 1] : null; var next = index < pixels.length - 1 ? pixels[index + 1] : null; var percent = options.categoryPercentage; var start, size; if (prev === null) { // first data: its size is double based on the next point or, // if it's also the last data, we use the scale size. prev = curr - (next === null ? ruler.end - ruler.start : next - curr); } if (next === null) { // last data: its size is also double based on the previous point. next = curr + curr - prev; } start = curr - (curr - Math.min(prev, next)) / 2 * percent; size = Math.abs(next - prev) / 2 * percent; return { chunk: size / ruler.stackCount, ratio: options.barPercentage, start: start }; }
javascript
function computeFlexCategoryTraits(index, ruler, options) { var pixels = ruler.pixels; var curr = pixels[index]; var prev = index > 0 ? pixels[index - 1] : null; var next = index < pixels.length - 1 ? pixels[index + 1] : null; var percent = options.categoryPercentage; var start, size; if (prev === null) { // first data: its size is double based on the next point or, // if it's also the last data, we use the scale size. prev = curr - (next === null ? ruler.end - ruler.start : next - curr); } if (next === null) { // last data: its size is also double based on the previous point. next = curr + curr - prev; } start = curr - (curr - Math.min(prev, next)) / 2 * percent; size = Math.abs(next - prev) / 2 * percent; return { chunk: size / ruler.stackCount, ratio: options.barPercentage, start: start }; }
[ "function", "computeFlexCategoryTraits", "(", "index", ",", "ruler", ",", "options", ")", "{", "var", "pixels", "=", "ruler", ".", "pixels", ";", "var", "curr", "=", "pixels", "[", "index", "]", ";", "var", "prev", "=", "index", ">", "0", "?", "pixels"...
Computes an "optimal" category that globally arranges bars side by side (no gap when percentage options are 1), based on the previous and following categories. This mode generates bars with different widths when data are not evenly spaced. @private
[ "Computes", "an", "optimal", "category", "that", "globally", "arranges", "bars", "side", "by", "side", "(", "no", "gap", "when", "percentage", "options", "are", "1", ")", "based", "on", "the", "previous", "and", "following", "categories", ".", "This", "mode"...
f093c36574d290330ed623e60fbd070421c730d5
https://github.com/chartjs/Chart.js/blob/f093c36574d290330ed623e60fbd070421c730d5/src/controllers/controller.bar.js#L90-L117
train
Compute the data for a given index of a ruler.
[ 30522, 3853, 24134, 21031, 2595, 16280, 20255, 22123, 14995, 3215, 1006, 5950, 1010, 7786, 1010, 7047, 1007, 1063, 13075, 27725, 1027, 7786, 1012, 27725, 1025, 13075, 12731, 12171, 1027, 27725, 1031, 5950, 1033, 1025, 13075, 3653, 2615, 1027,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.ux3/src/sap/ui/ux3/ToolPopup.js
function () { var $This = this.$(); var iValue = 0; var sMaxHeight = this.getMaxHeight(); var iMaxHeight = sMaxHeight ? parseInt(sMaxHeight) : 0; /* * Fix the width (if necessary) */ var sMaxWidth = this.getMaxWidth(); if (sMaxWidth) { var iMaxWidth = parseInt(sMaxWidth); var sBorderLeft = $This.css("border-left-width"); var iBorderLeft = parseInt(sBorderLeft); var sBorderRight = $This.css("border-right-width"); var iBorderRight = parseInt(sBorderRight); var sPaddingLeft = $This.css("padding-left"); var iPaddingLeft = parseInt(sPaddingLeft); var sPaddingRight = $This.css("padding-right"); var iPaddingRight = parseInt(sPaddingRight); iMaxWidth -= iBorderLeft + iPaddingLeft + iPaddingRight + iBorderRight; $This.css("max-width", iMaxWidth + "px"); } else { $This.css("max-width", ""); } /* * Fix the height */ // get all paddings var sPaddingTop = $This.css("padding-top"); var iPaddingTop = parseInt(sPaddingTop); var sPaddingBottom = $This.css("padding-bottom"); var iPaddingBottom = parseInt(sPaddingBottom); // get all border widths var sBorderTop = $This.css("border-top-width"); var iBorderTop = parseInt(sBorderTop); var sBorderBottom = $This.css("border-bottom-width"); var iBorderBottom = parseInt(sBorderBottom); var iPaddings = iPaddingTop + iPaddingBottom + iBorderTop + iBorderBottom; // determine the corresponding scrollTop to calculate the proper bottom end of the ToolPopup var iScrollTop = jQuery(document).scrollTop(); // jQuery Plugin "rect" var oThisRect = $This.rect(); var iBottomEnd = oThisRect.top - iScrollTop + $This.outerHeight(true); // only use this mechanism when there is NO maxHeight set var iWinHeight = jQuery(window).height(); var bTooHigh = (iBottomEnd > iWinHeight) && (iMaxHeight === 0); var iYOffset = 0; // check if an offset forces the ToolPopup out of the window // and below the opener if (bTooHigh) { var $Opener = jQuery(document.getElementById(this.getOpener())); // jQuery Plugin "rect" var oOpenerRect = $Opener.rect(); var iOpenerBottom = oOpenerRect.top - iScrollTop + $Opener.outerHeight(true); // if bottom of the ToolPopup is below the opener and there is a possible offset var aOffset = this.oPopup._getPositionOffset(); if (iBottomEnd > iOpenerBottom && aOffset.length > 0) { // check if the offset is responsible for pushing the ToolPopup below the opener // and therefore out of the window iYOffset = Math.abs(parseInt(aOffset[1])); // this check inverts the variable to prevent any resize of the ToolPopup since it // is pushed out of the window because of the offset if ((iBottomEnd - iYOffset) < iWinHeight) { bTooHigh = false; var sMessage = "Offset of " + iYOffset + " pushes ToolPopup out of the window"; Log.warning(sMessage, "", "sap.ui.ux3.ToolPopup"); } } iMaxHeight = iMaxHeight ? iMaxHeight : iWinHeight - oThisRect.top; } $This.toggleClass("sapUiUx3TPLargeContent", bTooHigh); if (iMaxHeight || bTooHigh) { $This.css("max-height", iMaxHeight + "px"); var $Title = this.$("title"); var $TitleSep = this.$("title-separator"); var $Buttons = this.$("buttons"); var $ButtonsSep = this.$("buttons-separator"); // Calculate the correct start value. Either simply take the set maxHeight // or calculate the value between Popup.top and window end (incl. padding and offset) iValue = iMaxHeight > 0 ? iMaxHeight : iWinHeight - oThisRect.top - iPaddingBottom - iYOffset; // subtract all paddings and border-widths iValue -= iPaddings; // subtracting all corresponding values from top to down iValue -= $Title.outerHeight(true); iValue -= $TitleSep.outerHeight(true); // including margin // height of content needn't to be subtracted iValue -= $ButtonsSep.outerHeight(true); // including margin iValue -= $Buttons.length > 0 ? $Buttons.outerHeight(true) : 0; // if the height has to be corrected iValue = parseInt(iValue); var $Content = this.$("content"); $Content.css("max-height", iValue + "px"); $Content.toggleClass("sapUiUx3TPLargeContent", true); } fnSetArrow(this); }
javascript
function () { var $This = this.$(); var iValue = 0; var sMaxHeight = this.getMaxHeight(); var iMaxHeight = sMaxHeight ? parseInt(sMaxHeight) : 0; /* * Fix the width (if necessary) */ var sMaxWidth = this.getMaxWidth(); if (sMaxWidth) { var iMaxWidth = parseInt(sMaxWidth); var sBorderLeft = $This.css("border-left-width"); var iBorderLeft = parseInt(sBorderLeft); var sBorderRight = $This.css("border-right-width"); var iBorderRight = parseInt(sBorderRight); var sPaddingLeft = $This.css("padding-left"); var iPaddingLeft = parseInt(sPaddingLeft); var sPaddingRight = $This.css("padding-right"); var iPaddingRight = parseInt(sPaddingRight); iMaxWidth -= iBorderLeft + iPaddingLeft + iPaddingRight + iBorderRight; $This.css("max-width", iMaxWidth + "px"); } else { $This.css("max-width", ""); } /* * Fix the height */ // get all paddings var sPaddingTop = $This.css("padding-top"); var iPaddingTop = parseInt(sPaddingTop); var sPaddingBottom = $This.css("padding-bottom"); var iPaddingBottom = parseInt(sPaddingBottom); // get all border widths var sBorderTop = $This.css("border-top-width"); var iBorderTop = parseInt(sBorderTop); var sBorderBottom = $This.css("border-bottom-width"); var iBorderBottom = parseInt(sBorderBottom); var iPaddings = iPaddingTop + iPaddingBottom + iBorderTop + iBorderBottom; // determine the corresponding scrollTop to calculate the proper bottom end of the ToolPopup var iScrollTop = jQuery(document).scrollTop(); // jQuery Plugin "rect" var oThisRect = $This.rect(); var iBottomEnd = oThisRect.top - iScrollTop + $This.outerHeight(true); // only use this mechanism when there is NO maxHeight set var iWinHeight = jQuery(window).height(); var bTooHigh = (iBottomEnd > iWinHeight) && (iMaxHeight === 0); var iYOffset = 0; // check if an offset forces the ToolPopup out of the window // and below the opener if (bTooHigh) { var $Opener = jQuery(document.getElementById(this.getOpener())); // jQuery Plugin "rect" var oOpenerRect = $Opener.rect(); var iOpenerBottom = oOpenerRect.top - iScrollTop + $Opener.outerHeight(true); // if bottom of the ToolPopup is below the opener and there is a possible offset var aOffset = this.oPopup._getPositionOffset(); if (iBottomEnd > iOpenerBottom && aOffset.length > 0) { // check if the offset is responsible for pushing the ToolPopup below the opener // and therefore out of the window iYOffset = Math.abs(parseInt(aOffset[1])); // this check inverts the variable to prevent any resize of the ToolPopup since it // is pushed out of the window because of the offset if ((iBottomEnd - iYOffset) < iWinHeight) { bTooHigh = false; var sMessage = "Offset of " + iYOffset + " pushes ToolPopup out of the window"; Log.warning(sMessage, "", "sap.ui.ux3.ToolPopup"); } } iMaxHeight = iMaxHeight ? iMaxHeight : iWinHeight - oThisRect.top; } $This.toggleClass("sapUiUx3TPLargeContent", bTooHigh); if (iMaxHeight || bTooHigh) { $This.css("max-height", iMaxHeight + "px"); var $Title = this.$("title"); var $TitleSep = this.$("title-separator"); var $Buttons = this.$("buttons"); var $ButtonsSep = this.$("buttons-separator"); // Calculate the correct start value. Either simply take the set maxHeight // or calculate the value between Popup.top and window end (incl. padding and offset) iValue = iMaxHeight > 0 ? iMaxHeight : iWinHeight - oThisRect.top - iPaddingBottom - iYOffset; // subtract all paddings and border-widths iValue -= iPaddings; // subtracting all corresponding values from top to down iValue -= $Title.outerHeight(true); iValue -= $TitleSep.outerHeight(true); // including margin // height of content needn't to be subtracted iValue -= $ButtonsSep.outerHeight(true); // including margin iValue -= $Buttons.length > 0 ? $Buttons.outerHeight(true) : 0; // if the height has to be corrected iValue = parseInt(iValue); var $Content = this.$("content"); $Content.css("max-height", iValue + "px"); $Content.toggleClass("sapUiUx3TPLargeContent", true); } fnSetArrow(this); }
[ "function", "(", ")", "{", "var", "$This", "=", "this", ".", "$", "(", ")", ";", "var", "iValue", "=", "0", ";", "var", "sMaxHeight", "=", "this", ".", "getMaxHeight", "(", ")", ";", "var", "iMaxHeight", "=", "sMaxHeight", "?", "parseInt", "(", "sM...
This function fixes the height of the ToolPopup if the content is too large. So the height will be set to the possible maximum and a scrollbar is provided. Additionally the width of the ToolPopup is fixed as well since the scrollbar reduces the possible space for the content. @private
[ "This", "function", "fixes", "the", "height", "of", "the", "ToolPopup", "if", "the", "content", "is", "too", "large", ".", "So", "the", "height", "will", "be", "set", "to", "the", "possible", "maximum", "and", "a", "scrollbar", "is", "provided", ".", "Ad...
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.ux3/src/sap/ui/ux3/ToolPopup.js#L438-L560
train
Calculates the height of the ToolPopup
[ 30522, 3853, 1006, 1007, 1063, 13075, 1002, 2023, 1027, 2023, 1012, 1002, 1006, 1007, 1025, 13075, 4921, 2389, 5657, 1027, 1014, 1025, 13075, 15488, 8528, 26036, 13900, 1027, 2023, 1012, 2131, 17848, 26036, 13900, 1006, 1007, 1025, 13075, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
BlackrockDigital/startbootstrap-sb-admin-2
vendor/chart.js/Chart.js
getRelativePosition
function getRelativePosition(e, chart) { if (e.native) { return { x: e.x, y: e.y }; } return helpers$1.getRelativePosition(e, chart); }
javascript
function getRelativePosition(e, chart) { if (e.native) { return { x: e.x, y: e.y }; } return helpers$1.getRelativePosition(e, chart); }
[ "function", "getRelativePosition", "(", "e", ",", "chart", ")", "{", "if", "(", "e", ".", "native", ")", "{", "return", "{", "x", ":", "e", ".", "x", ",", "y", ":", "e", ".", "y", "}", ";", "}", "return", "helpers$1", ".", "getRelativePosition", ...
Helper function to get relative position for an event @param {Event|IEvent} event - The event to get the position for @param {Chart} chart - The chart @returns {object} the event position
[ "Helper", "function", "to", "get", "relative", "position", "for", "an", "event" ]
ddfaceb4a8e65a41f163e2fdc4eab49384b810a1
https://github.com/BlackrockDigital/startbootstrap-sb-admin-2/blob/ddfaceb4a8e65a41f163e2fdc4eab49384b810a1/vendor/chart.js/Chart.js#L5835-L5844
train
Get relative position of an element
[ 30522, 3853, 2131, 16570, 8082, 26994, 1006, 1041, 1010, 3673, 1007, 1063, 2065, 1006, 1041, 1012, 3128, 1007, 1063, 2709, 1063, 1060, 1024, 1041, 1012, 1060, 1010, 1061, 1024, 1041, 1012, 1061, 1065, 1025, 1065, 2709, 2393, 2545, 1002, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
elastic/elasticsearch-js
api/api/search.js
buildSearch
function buildSearch (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [search](http://www.elastic.co/guide/en/elasticsearch/reference/master/search-search.html) request * * @param {list} index - A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices * @param {list} type - A comma-separated list of document types to search; leave empty to perform the operation on all types * @param {string} analyzer - The analyzer to use for the query string * @param {boolean} analyze_wildcard - Specify whether wildcard and prefix queries should be analyzed (default: false) * @param {boolean} ccs_minimize_roundtrips - Indicates whether network round-trips should be minimized as part of cross-cluster search requests execution * @param {enum} default_operator - The default operator for query string query (AND or OR) * @param {string} df - The field to use as default where no field prefix is given in the query string * @param {boolean} explain - Specify whether to return detailed information about score computation as part of a hit * @param {list} stored_fields - A comma-separated list of stored fields to return as part of a hit * @param {list} docvalue_fields - A comma-separated list of fields to return as the docvalue representation of a field for each hit * @param {number} from - Starting offset (default: 0) * @param {boolean} ignore_unavailable - Whether specified concrete indices should be ignored when unavailable (missing or closed) * @param {boolean} ignore_throttled - Whether specified concrete, expanded or aliased indices should be ignored when throttled * @param {boolean} allow_no_indices - Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) * @param {enum} expand_wildcards - Whether to expand wildcard expression to concrete indices that are open, closed or both. * @param {boolean} lenient - Specify whether format-based query failures (such as providing text to a numeric field) should be ignored * @param {string} preference - Specify the node or shard the operation should be performed on (default: random) * @param {string} q - Query in the Lucene query string syntax * @param {list} routing - A comma-separated list of specific routing values * @param {time} scroll - Specify how long a consistent view of the index should be maintained for scrolled search * @param {enum} search_type - Search operation type * @param {number} size - Number of hits to return (default: 10) * @param {list} sort - A comma-separated list of <field>:<direction> pairs * @param {list} _source - True or false to return the _source field or not, or a list of fields to return * @param {list} _source_excludes - A list of fields to exclude from the returned _source field * @param {list} _source_includes - A list of fields to extract and return from the _source field * @param {number} terminate_after - The maximum number of documents to collect for each shard, upon reaching which the query execution will terminate early. * @param {list} stats - Specific 'tag' of the request for logging and statistical purposes * @param {string} suggest_field - Specify which field to use for suggestions * @param {enum} suggest_mode - Specify suggest mode * @param {number} suggest_size - How many suggestions to return in response * @param {string} suggest_text - The source text for which the suggestions should be returned * @param {time} timeout - Explicit operation timeout * @param {boolean} track_scores - Whether to calculate and return scores even if they are not used for sorting * @param {boolean} track_total_hits - Indicate if the number of documents that match the query should be tracked * @param {boolean} allow_partial_search_results - Indicate if an error should be returned if there is a partial search failure or timeout * @param {boolean} typed_keys - Specify whether aggregation and suggester names should be prefixed by their respective types in the response * @param {boolean} version - Specify whether to return document version as part of a hit * @param {boolean} seq_no_primary_term - Specify whether to return sequence number and primary term of the last modification of each hit * @param {boolean} request_cache - Specify if request cache should be used for this request or not, defaults to index level setting * @param {number} batched_reduce_size - The number of shard results that should be reduced at once on the coordinating node. This value should be used as a protection mechanism to reduce the memory overhead per search request if the potential number of shards in the request can be large. * @param {number} max_concurrent_shard_requests - The number of concurrent shard requests per node this search executes concurrently. This value should be used to limit the impact of the search on the cluster in order to limit the number of concurrent shard requests * @param {number} pre_filter_shard_size - A threshold that enforces a pre-filter roundtrip to prefilter search shards based on query rewriting if the number of shards the search request expands to exceeds the threshold. This filter roundtrip can limit the number of shards significantly if for instance a shard can not match any documents based on it's rewrite method ie. if date filters are mandatory to match but the shard bounds and the query are disjoint. * @param {boolean} rest_total_hits_as_int - Indicates whether hits.total should be rendered as an integer or an object in the rest search response * @param {object} body - The search definition using the Query DSL */ const acceptedQuerystring = [ 'analyzer', 'analyze_wildcard', 'ccs_minimize_roundtrips', 'default_operator', 'df', 'explain', 'stored_fields', 'docvalue_fields', 'from', 'ignore_unavailable', 'ignore_throttled', 'allow_no_indices', 'expand_wildcards', 'lenient', 'preference', 'q', 'routing', 'scroll', 'search_type', 'size', 'sort', '_source', '_source_excludes', '_source_includes', 'terminate_after', 'stats', 'suggest_field', 'suggest_mode', 'suggest_size', 'suggest_text', 'timeout', 'track_scores', 'track_total_hits', 'allow_partial_search_results', 'typed_keys', 'version', 'seq_no_primary_term', 'request_cache', 'batched_reduce_size', 'max_concurrent_shard_requests', 'pre_filter_shard_size', 'rest_total_hits_as_int', 'pretty', 'human', 'error_trace', 'source', 'filter_path' ] const snakeCase = { analyzeWildcard: 'analyze_wildcard', ccsMinimizeRoundtrips: 'ccs_minimize_roundtrips', defaultOperator: 'default_operator', storedFields: 'stored_fields', docvalueFields: 'docvalue_fields', ignoreUnavailable: 'ignore_unavailable', ignoreThrottled: 'ignore_throttled', allowNoIndices: 'allow_no_indices', expandWildcards: 'expand_wildcards', searchType: 'search_type', _sourceExcludes: '_source_excludes', _sourceIncludes: '_source_includes', terminateAfter: 'terminate_after', suggestField: 'suggest_field', suggestMode: 'suggest_mode', suggestSize: 'suggest_size', suggestText: 'suggest_text', trackScores: 'track_scores', trackTotalHits: 'track_total_hits', allowPartialSearchResults: 'allow_partial_search_results', typedKeys: 'typed_keys', seqNoPrimaryTerm: 'seq_no_primary_term', requestCache: 'request_cache', batchedReduceSize: 'batched_reduce_size', maxConcurrentShardRequests: 'max_concurrent_shard_requests', preFilterShardSize: 'pre_filter_shard_size', restTotalHitsAsInt: 'rest_total_hits_as_int', errorTrace: 'error_trace', filterPath: 'filter_path' } return function search (params, options, callback) { options = options || {} if (typeof options === 'function') { callback = options options = {} } if (typeof params === 'function' || params == null) { callback = params params = {} options = {} } // check required url components if (params['type'] != null && (params['index'] == null)) { const err = new ConfigurationError('Missing required parameter of the url: index') return handleError(err, callback) } // validate headers object if (options.headers != null && typeof options.headers !== 'object') { const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`) return handleError(err, callback) } var warnings = [] var { method, body, index, type, ...querystring } = params querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = body == null ? 'GET' : 'POST' } var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } var path = '' if ((index) != null && (type) != null) { path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_search' } else if ((index) != null) { path = '/' + encodeURIComponent(index) + '/' + '_search' } else { path = '/' + '_search' } // build request object const request = { method, path, body: body || '', querystring } options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) } }
javascript
function buildSearch (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [search](http://www.elastic.co/guide/en/elasticsearch/reference/master/search-search.html) request * * @param {list} index - A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices * @param {list} type - A comma-separated list of document types to search; leave empty to perform the operation on all types * @param {string} analyzer - The analyzer to use for the query string * @param {boolean} analyze_wildcard - Specify whether wildcard and prefix queries should be analyzed (default: false) * @param {boolean} ccs_minimize_roundtrips - Indicates whether network round-trips should be minimized as part of cross-cluster search requests execution * @param {enum} default_operator - The default operator for query string query (AND or OR) * @param {string} df - The field to use as default where no field prefix is given in the query string * @param {boolean} explain - Specify whether to return detailed information about score computation as part of a hit * @param {list} stored_fields - A comma-separated list of stored fields to return as part of a hit * @param {list} docvalue_fields - A comma-separated list of fields to return as the docvalue representation of a field for each hit * @param {number} from - Starting offset (default: 0) * @param {boolean} ignore_unavailable - Whether specified concrete indices should be ignored when unavailable (missing or closed) * @param {boolean} ignore_throttled - Whether specified concrete, expanded or aliased indices should be ignored when throttled * @param {boolean} allow_no_indices - Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) * @param {enum} expand_wildcards - Whether to expand wildcard expression to concrete indices that are open, closed or both. * @param {boolean} lenient - Specify whether format-based query failures (such as providing text to a numeric field) should be ignored * @param {string} preference - Specify the node or shard the operation should be performed on (default: random) * @param {string} q - Query in the Lucene query string syntax * @param {list} routing - A comma-separated list of specific routing values * @param {time} scroll - Specify how long a consistent view of the index should be maintained for scrolled search * @param {enum} search_type - Search operation type * @param {number} size - Number of hits to return (default: 10) * @param {list} sort - A comma-separated list of <field>:<direction> pairs * @param {list} _source - True or false to return the _source field or not, or a list of fields to return * @param {list} _source_excludes - A list of fields to exclude from the returned _source field * @param {list} _source_includes - A list of fields to extract and return from the _source field * @param {number} terminate_after - The maximum number of documents to collect for each shard, upon reaching which the query execution will terminate early. * @param {list} stats - Specific 'tag' of the request for logging and statistical purposes * @param {string} suggest_field - Specify which field to use for suggestions * @param {enum} suggest_mode - Specify suggest mode * @param {number} suggest_size - How many suggestions to return in response * @param {string} suggest_text - The source text for which the suggestions should be returned * @param {time} timeout - Explicit operation timeout * @param {boolean} track_scores - Whether to calculate and return scores even if they are not used for sorting * @param {boolean} track_total_hits - Indicate if the number of documents that match the query should be tracked * @param {boolean} allow_partial_search_results - Indicate if an error should be returned if there is a partial search failure or timeout * @param {boolean} typed_keys - Specify whether aggregation and suggester names should be prefixed by their respective types in the response * @param {boolean} version - Specify whether to return document version as part of a hit * @param {boolean} seq_no_primary_term - Specify whether to return sequence number and primary term of the last modification of each hit * @param {boolean} request_cache - Specify if request cache should be used for this request or not, defaults to index level setting * @param {number} batched_reduce_size - The number of shard results that should be reduced at once on the coordinating node. This value should be used as a protection mechanism to reduce the memory overhead per search request if the potential number of shards in the request can be large. * @param {number} max_concurrent_shard_requests - The number of concurrent shard requests per node this search executes concurrently. This value should be used to limit the impact of the search on the cluster in order to limit the number of concurrent shard requests * @param {number} pre_filter_shard_size - A threshold that enforces a pre-filter roundtrip to prefilter search shards based on query rewriting if the number of shards the search request expands to exceeds the threshold. This filter roundtrip can limit the number of shards significantly if for instance a shard can not match any documents based on it's rewrite method ie. if date filters are mandatory to match but the shard bounds and the query are disjoint. * @param {boolean} rest_total_hits_as_int - Indicates whether hits.total should be rendered as an integer or an object in the rest search response * @param {object} body - The search definition using the Query DSL */ const acceptedQuerystring = [ 'analyzer', 'analyze_wildcard', 'ccs_minimize_roundtrips', 'default_operator', 'df', 'explain', 'stored_fields', 'docvalue_fields', 'from', 'ignore_unavailable', 'ignore_throttled', 'allow_no_indices', 'expand_wildcards', 'lenient', 'preference', 'q', 'routing', 'scroll', 'search_type', 'size', 'sort', '_source', '_source_excludes', '_source_includes', 'terminate_after', 'stats', 'suggest_field', 'suggest_mode', 'suggest_size', 'suggest_text', 'timeout', 'track_scores', 'track_total_hits', 'allow_partial_search_results', 'typed_keys', 'version', 'seq_no_primary_term', 'request_cache', 'batched_reduce_size', 'max_concurrent_shard_requests', 'pre_filter_shard_size', 'rest_total_hits_as_int', 'pretty', 'human', 'error_trace', 'source', 'filter_path' ] const snakeCase = { analyzeWildcard: 'analyze_wildcard', ccsMinimizeRoundtrips: 'ccs_minimize_roundtrips', defaultOperator: 'default_operator', storedFields: 'stored_fields', docvalueFields: 'docvalue_fields', ignoreUnavailable: 'ignore_unavailable', ignoreThrottled: 'ignore_throttled', allowNoIndices: 'allow_no_indices', expandWildcards: 'expand_wildcards', searchType: 'search_type', _sourceExcludes: '_source_excludes', _sourceIncludes: '_source_includes', terminateAfter: 'terminate_after', suggestField: 'suggest_field', suggestMode: 'suggest_mode', suggestSize: 'suggest_size', suggestText: 'suggest_text', trackScores: 'track_scores', trackTotalHits: 'track_total_hits', allowPartialSearchResults: 'allow_partial_search_results', typedKeys: 'typed_keys', seqNoPrimaryTerm: 'seq_no_primary_term', requestCache: 'request_cache', batchedReduceSize: 'batched_reduce_size', maxConcurrentShardRequests: 'max_concurrent_shard_requests', preFilterShardSize: 'pre_filter_shard_size', restTotalHitsAsInt: 'rest_total_hits_as_int', errorTrace: 'error_trace', filterPath: 'filter_path' } return function search (params, options, callback) { options = options || {} if (typeof options === 'function') { callback = options options = {} } if (typeof params === 'function' || params == null) { callback = params params = {} options = {} } // check required url components if (params['type'] != null && (params['index'] == null)) { const err = new ConfigurationError('Missing required parameter of the url: index') return handleError(err, callback) } // validate headers object if (options.headers != null && typeof options.headers !== 'object') { const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`) return handleError(err, callback) } var warnings = [] var { method, body, index, type, ...querystring } = params querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = body == null ? 'GET' : 'POST' } var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } var path = '' if ((index) != null && (type) != null) { path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_search' } else if ((index) != null) { path = '/' + encodeURIComponent(index) + '/' + '_search' } else { path = '/' + '_search' } // build request object const request = { method, path, body: body || '', querystring } options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) } }
[ "function", "buildSearch", "(", "opts", ")", "{", "// eslint-disable-next-line no-unused-vars", "const", "{", "makeRequest", ",", "ConfigurationError", ",", "handleError", ",", "snakeCaseKeys", "}", "=", "opts", "/**\n * Perform a [search](http://www.elastic.co/guide/en/elast...
/* eslint camelcase: 0 /* eslint no-unused-vars: 0
[ "/", "*", "eslint", "camelcase", ":", "0", "/", "*", "eslint", "no", "-", "unused", "-", "vars", ":", "0" ]
4fc4699a4d4474d7887bc7757e0269218a859294
https://github.com/elastic/elasticsearch-js/blob/4fc4699a4d4474d7887bc7757e0269218a859294/api/api/search.js#L25-L218
train
Build a search function
[ 30522, 3853, 16473, 14644, 2818, 1006, 23569, 2015, 1007, 1063, 1013, 1013, 9686, 4115, 2102, 1011, 4487, 19150, 1011, 2279, 1011, 2240, 2053, 1011, 15171, 1011, 13075, 2015, 9530, 3367, 1063, 9338, 2063, 15500, 1010, 9563, 2121, 29165, 101...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
adobe/brackets
src/search/FileFilters.js
setActiveFilter
function setActiveFilter(filter, index) { var filterSets = PreferencesManager.get("fileFilters") || []; if (filter) { if (index === -1) { // Add a new filter set index = filterSets.length; filterSets.push(filter); } else if (index > -1 && index < filterSets.length) { // Update an existing filter set only if the filter set has some changes if (!_.isEqual(filterSets[index], filter)) { filterSets[index] = filter; } } else { // Should not have been called with an invalid index to the available filter sets. console.log("setActiveFilter is called with an invalid index: " + index); return; } PreferencesManager.set("fileFilters", filterSets); PreferencesManager.setViewState("activeFileFilter", index); } else { // Explicitly set to -1 to remove the active file filter PreferencesManager.setViewState("activeFileFilter", -1); } FindUtils.notifyFileFiltersChanged(); }
javascript
function setActiveFilter(filter, index) { var filterSets = PreferencesManager.get("fileFilters") || []; if (filter) { if (index === -1) { // Add a new filter set index = filterSets.length; filterSets.push(filter); } else if (index > -1 && index < filterSets.length) { // Update an existing filter set only if the filter set has some changes if (!_.isEqual(filterSets[index], filter)) { filterSets[index] = filter; } } else { // Should not have been called with an invalid index to the available filter sets. console.log("setActiveFilter is called with an invalid index: " + index); return; } PreferencesManager.set("fileFilters", filterSets); PreferencesManager.setViewState("activeFileFilter", index); } else { // Explicitly set to -1 to remove the active file filter PreferencesManager.setViewState("activeFileFilter", -1); } FindUtils.notifyFileFiltersChanged(); }
[ "function", "setActiveFilter", "(", "filter", ",", "index", ")", "{", "var", "filterSets", "=", "PreferencesManager", ".", "get", "(", "\"fileFilters\"", ")", "||", "[", "]", ";", "if", "(", "filter", ")", "{", "if", "(", "index", "===", "-", "1", ")",...
Sets and save the index of the active filter. Automatically set when editFilter() is completed. If no filter is passed in, then clear the last active filter index by setting it to -1. @param {{name: string, patterns: Array.<string>}=} filter @param {number=} index The index of the filter set in the list of saved filter sets or -1 if it is a new one
[ "Sets", "and", "save", "the", "index", "of", "the", "active", "filter", ".", "Automatically", "set", "when", "editFilter", "()", "is", "completed", ".", "If", "no", "filter", "is", "passed", "in", "then", "clear", "the", "last", "active", "filter", "index"...
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/search/FileFilters.js#L175-L201
train
Set the active filter
[ 30522, 3853, 2275, 19620, 8873, 21928, 1006, 11307, 1010, 5950, 1007, 1063, 13075, 17736, 8454, 1027, 18394, 24805, 4590, 1012, 2131, 1006, 1000, 5371, 8873, 21928, 2015, 1000, 1007, 1064, 1064, 1031, 1033, 1025, 2065, 1006, 11307, 1007, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
ecomfe/zrender
src/core/env.js
detect
function detect(ua) { var os = {}; var browser = {}; // var webkit = ua.match(/Web[kK]it[\/]{0,1}([\d.]+)/); // var android = ua.match(/(Android);?[\s\/]+([\d.]+)?/); // var ipad = ua.match(/(iPad).*OS\s([\d_]+)/); // var ipod = ua.match(/(iPod)(.*OS\s([\d_]+))?/); // var iphone = !ipad && ua.match(/(iPhone\sOS)\s([\d_]+)/); // var webos = ua.match(/(webOS|hpwOS)[\s\/]([\d.]+)/); // var touchpad = webos && ua.match(/TouchPad/); // var kindle = ua.match(/Kindle\/([\d.]+)/); // var silk = ua.match(/Silk\/([\d._]+)/); // var blackberry = ua.match(/(BlackBerry).*Version\/([\d.]+)/); // var bb10 = ua.match(/(BB10).*Version\/([\d.]+)/); // var rimtabletos = ua.match(/(RIM\sTablet\sOS)\s([\d.]+)/); // var playbook = ua.match(/PlayBook/); // var chrome = ua.match(/Chrome\/([\d.]+)/) || ua.match(/CriOS\/([\d.]+)/); var firefox = ua.match(/Firefox\/([\d.]+)/); // var safari = webkit && ua.match(/Mobile\//) && !chrome; // var webview = ua.match(/(iPhone|iPod|iPad).*AppleWebKit(?!.*Safari)/) && !chrome; var ie = ua.match(/MSIE\s([\d.]+)/) // IE 11 Trident/7.0; rv:11.0 || ua.match(/Trident\/.+?rv:(([\d.]+))/); var edge = ua.match(/Edge\/([\d.]+)/); // IE 12 and 12+ var weChat = (/micromessenger/i).test(ua); // Todo: clean this up with a better OS/browser seperation: // - discern (more) between multiple browsers on android // - decide if kindle fire in silk mode is android or not // - Firefox on Android doesn't specify the Android version // - possibly devide in os, device and browser hashes // if (browser.webkit = !!webkit) browser.version = webkit[1]; // if (android) os.android = true, os.version = android[2]; // if (iphone && !ipod) os.ios = os.iphone = true, os.version = iphone[2].replace(/_/g, '.'); // if (ipad) os.ios = os.ipad = true, os.version = ipad[2].replace(/_/g, '.'); // if (ipod) os.ios = os.ipod = true, os.version = ipod[3] ? ipod[3].replace(/_/g, '.') : null; // if (webos) os.webos = true, os.version = webos[2]; // if (touchpad) os.touchpad = true; // if (blackberry) os.blackberry = true, os.version = blackberry[2]; // if (bb10) os.bb10 = true, os.version = bb10[2]; // if (rimtabletos) os.rimtabletos = true, os.version = rimtabletos[2]; // if (playbook) browser.playbook = true; // if (kindle) os.kindle = true, os.version = kindle[1]; // if (silk) browser.silk = true, browser.version = silk[1]; // if (!silk && os.android && ua.match(/Kindle Fire/)) browser.silk = true; // if (chrome) browser.chrome = true, browser.version = chrome[1]; if (firefox) { browser.firefox = true; browser.version = firefox[1]; } // if (safari && (ua.match(/Safari/) || !!os.ios)) browser.safari = true; // if (webview) browser.webview = true; if (ie) { browser.ie = true; browser.version = ie[1]; } if (edge) { browser.edge = true; browser.version = edge[1]; } // It is difficult to detect WeChat in Win Phone precisely, because ua can // not be set on win phone. So we do not consider Win Phone. if (weChat) { browser.weChat = true; } // os.tablet = !!(ipad || playbook || (android && !ua.match(/Mobile/)) || // (firefox && ua.match(/Tablet/)) || (ie && !ua.match(/Phone/) && ua.match(/Touch/))); // os.phone = !!(!os.tablet && !os.ipod && (android || iphone || webos || // (chrome && ua.match(/Android/)) || (chrome && ua.match(/CriOS\/([\d.]+)/)) || // (firefox && ua.match(/Mobile/)) || (ie && ua.match(/Touch/)))); return { browser: browser, os: os, node: false, // 原生canvas支持,改极端点了 // canvasSupported : !(browser.ie && parseFloat(browser.version) < 9) canvasSupported: !!document.createElement('canvas').getContext, svgSupported: typeof SVGRect !== 'undefined', // works on most browsers // IE10/11 does not support touch event, and MS Edge supports them but not by // default, so we dont check navigator.maxTouchPoints for them here. touchEventsSupported: 'ontouchstart' in window && !browser.ie && !browser.edge, // <http://caniuse.com/#search=pointer%20event>. pointerEventsSupported: 'onpointerdown' in window // Firefox supports pointer but not by default, only MS browsers are reliable on pointer // events currently. So we dont use that on other browsers unless tested sufficiently. // Although IE 10 supports pointer event, it use old style and is different from the // standard. So we exclude that. (IE 10 is hardly used on touch device) && (browser.edge || (browser.ie && browser.version >= 11)), // passiveSupported: detectPassiveSupport() domSupported: typeof document !== 'undefined' }; }
javascript
function detect(ua) { var os = {}; var browser = {}; // var webkit = ua.match(/Web[kK]it[\/]{0,1}([\d.]+)/); // var android = ua.match(/(Android);?[\s\/]+([\d.]+)?/); // var ipad = ua.match(/(iPad).*OS\s([\d_]+)/); // var ipod = ua.match(/(iPod)(.*OS\s([\d_]+))?/); // var iphone = !ipad && ua.match(/(iPhone\sOS)\s([\d_]+)/); // var webos = ua.match(/(webOS|hpwOS)[\s\/]([\d.]+)/); // var touchpad = webos && ua.match(/TouchPad/); // var kindle = ua.match(/Kindle\/([\d.]+)/); // var silk = ua.match(/Silk\/([\d._]+)/); // var blackberry = ua.match(/(BlackBerry).*Version\/([\d.]+)/); // var bb10 = ua.match(/(BB10).*Version\/([\d.]+)/); // var rimtabletos = ua.match(/(RIM\sTablet\sOS)\s([\d.]+)/); // var playbook = ua.match(/PlayBook/); // var chrome = ua.match(/Chrome\/([\d.]+)/) || ua.match(/CriOS\/([\d.]+)/); var firefox = ua.match(/Firefox\/([\d.]+)/); // var safari = webkit && ua.match(/Mobile\//) && !chrome; // var webview = ua.match(/(iPhone|iPod|iPad).*AppleWebKit(?!.*Safari)/) && !chrome; var ie = ua.match(/MSIE\s([\d.]+)/) // IE 11 Trident/7.0; rv:11.0 || ua.match(/Trident\/.+?rv:(([\d.]+))/); var edge = ua.match(/Edge\/([\d.]+)/); // IE 12 and 12+ var weChat = (/micromessenger/i).test(ua); // Todo: clean this up with a better OS/browser seperation: // - discern (more) between multiple browsers on android // - decide if kindle fire in silk mode is android or not // - Firefox on Android doesn't specify the Android version // - possibly devide in os, device and browser hashes // if (browser.webkit = !!webkit) browser.version = webkit[1]; // if (android) os.android = true, os.version = android[2]; // if (iphone && !ipod) os.ios = os.iphone = true, os.version = iphone[2].replace(/_/g, '.'); // if (ipad) os.ios = os.ipad = true, os.version = ipad[2].replace(/_/g, '.'); // if (ipod) os.ios = os.ipod = true, os.version = ipod[3] ? ipod[3].replace(/_/g, '.') : null; // if (webos) os.webos = true, os.version = webos[2]; // if (touchpad) os.touchpad = true; // if (blackberry) os.blackberry = true, os.version = blackberry[2]; // if (bb10) os.bb10 = true, os.version = bb10[2]; // if (rimtabletos) os.rimtabletos = true, os.version = rimtabletos[2]; // if (playbook) browser.playbook = true; // if (kindle) os.kindle = true, os.version = kindle[1]; // if (silk) browser.silk = true, browser.version = silk[1]; // if (!silk && os.android && ua.match(/Kindle Fire/)) browser.silk = true; // if (chrome) browser.chrome = true, browser.version = chrome[1]; if (firefox) { browser.firefox = true; browser.version = firefox[1]; } // if (safari && (ua.match(/Safari/) || !!os.ios)) browser.safari = true; // if (webview) browser.webview = true; if (ie) { browser.ie = true; browser.version = ie[1]; } if (edge) { browser.edge = true; browser.version = edge[1]; } // It is difficult to detect WeChat in Win Phone precisely, because ua can // not be set on win phone. So we do not consider Win Phone. if (weChat) { browser.weChat = true; } // os.tablet = !!(ipad || playbook || (android && !ua.match(/Mobile/)) || // (firefox && ua.match(/Tablet/)) || (ie && !ua.match(/Phone/) && ua.match(/Touch/))); // os.phone = !!(!os.tablet && !os.ipod && (android || iphone || webos || // (chrome && ua.match(/Android/)) || (chrome && ua.match(/CriOS\/([\d.]+)/)) || // (firefox && ua.match(/Mobile/)) || (ie && ua.match(/Touch/)))); return { browser: browser, os: os, node: false, // 原生canvas支持,改极端点了 // canvasSupported : !(browser.ie && parseFloat(browser.version) < 9) canvasSupported: !!document.createElement('canvas').getContext, svgSupported: typeof SVGRect !== 'undefined', // works on most browsers // IE10/11 does not support touch event, and MS Edge supports them but not by // default, so we dont check navigator.maxTouchPoints for them here. touchEventsSupported: 'ontouchstart' in window && !browser.ie && !browser.edge, // <http://caniuse.com/#search=pointer%20event>. pointerEventsSupported: 'onpointerdown' in window // Firefox supports pointer but not by default, only MS browsers are reliable on pointer // events currently. So we dont use that on other browsers unless tested sufficiently. // Although IE 10 supports pointer event, it use old style and is different from the // standard. So we exclude that. (IE 10 is hardly used on touch device) && (browser.edge || (browser.ie && browser.version >= 11)), // passiveSupported: detectPassiveSupport() domSupported: typeof document !== 'undefined' }; }
[ "function", "detect", "(", "ua", ")", "{", "var", "os", "=", "{", "}", ";", "var", "browser", "=", "{", "}", ";", "// var webkit = ua.match(/Web[kK]it[\\/]{0,1}([\\d.]+)/);", "// var android = ua.match(/(Android);?[\\s\\/]+([\\d.]+)?/);", "// var ipad = ua.match(/(iPad).*OS\\...
Zepto.js (c) 2010-2013 Thomas Fuchs Zepto.js may be freely distributed under the MIT license.
[ "Zepto", ".", "js", "(", "c", ")", "2010", "-", "2013", "Thomas", "Fuchs", "Zepto", ".", "js", "may", "be", "freely", "distributed", "under", "the", "MIT", "license", "." ]
30321b57cba3149c30eacb0c1e18276f0f001b9f
https://github.com/ecomfe/zrender/blob/30321b57cba3149c30eacb0c1e18276f0f001b9f/src/core/env.js#L58-L158
train
Detects the OS and browser from the user agent.
[ 30522, 3853, 11487, 1006, 25423, 1007, 1063, 13075, 9808, 1027, 1063, 1065, 1025, 13075, 16602, 1027, 1063, 1065, 1025, 1013, 1013, 13075, 4773, 23615, 1027, 25423, 1012, 2674, 1006, 1013, 4773, 1031, 1047, 2243, 1033, 2009, 1031, 1032, 101...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
adobe/brackets
src/JSUtils/Preferences.js
settingsToRegExp
function settingsToRegExp(settings, baseRegExp, defaultRegExp) { var regExpString = ""; if (settings instanceof Array && settings.length > 0) { // Append base settings to user settings. The base // settings are builtin and cannot be overridden. if (baseRegExp) { settings.push("/" + baseRegExp.source + "/"); } // convert each string, with optional wildcards to an equivalent // string in a regular expression. settings.forEach(function (value, index) { if (typeof value === "string") { var isRegExp = value[0] === '/' && value[value.length - 1] === '/'; if (isRegExp) { value = value.substring(1, value.length - 1); } else { value = StringUtils.regexEscape(value); // convert user input wildcard, "*" or "?", to a regular // expression. We can just replace the escaped "*" or "?" // since we know it is a wildcard. value = value.replace("\\?", ".?"); value = value.replace("\\*", ".*"); // Add "^" and "$" to prevent matching in the middle of strings. value = "^" + value + "$"; } if (index > 0) { regExpString += "|"; } regExpString = regExpString.concat(value); } }); } if (!regExpString) { var defaultParts = []; if (baseRegExp) { defaultParts.push(baseRegExp.source); } if (defaultRegExp) { defaultParts.push(defaultRegExp.source); } if (defaultParts.length > 0) { regExpString = defaultParts.join("|"); } else { return null; } } return new RegExp(regExpString); }
javascript
function settingsToRegExp(settings, baseRegExp, defaultRegExp) { var regExpString = ""; if (settings instanceof Array && settings.length > 0) { // Append base settings to user settings. The base // settings are builtin and cannot be overridden. if (baseRegExp) { settings.push("/" + baseRegExp.source + "/"); } // convert each string, with optional wildcards to an equivalent // string in a regular expression. settings.forEach(function (value, index) { if (typeof value === "string") { var isRegExp = value[0] === '/' && value[value.length - 1] === '/'; if (isRegExp) { value = value.substring(1, value.length - 1); } else { value = StringUtils.regexEscape(value); // convert user input wildcard, "*" or "?", to a regular // expression. We can just replace the escaped "*" or "?" // since we know it is a wildcard. value = value.replace("\\?", ".?"); value = value.replace("\\*", ".*"); // Add "^" and "$" to prevent matching in the middle of strings. value = "^" + value + "$"; } if (index > 0) { regExpString += "|"; } regExpString = regExpString.concat(value); } }); } if (!regExpString) { var defaultParts = []; if (baseRegExp) { defaultParts.push(baseRegExp.source); } if (defaultRegExp) { defaultParts.push(defaultRegExp.source); } if (defaultParts.length > 0) { regExpString = defaultParts.join("|"); } else { return null; } } return new RegExp(regExpString); }
[ "function", "settingsToRegExp", "(", "settings", ",", "baseRegExp", ",", "defaultRegExp", ")", "{", "var", "regExpString", "=", "\"\"", ";", "if", "(", "settings", "instanceof", "Array", "&&", "settings", ".", "length", ">", "0", ")", "{", "// Append base sett...
Convert an array of strings with optional wildcards, to an equivalent regular expression. @param {Array.<string|RegExp>} settings from the file (note: this may be mutated by this function) @param {?RegExp} baseRegExp - base regular expression that is always used @param {?RegExp} defaultRegExp - additional regular expression that is only used if the user has not configured settings @return {RegExp} Regular expression that captures the array of string with optional wildcards.
[ "Convert", "an", "array", "of", "strings", "with", "optional", "wildcards", "to", "an", "equivalent", "regular", "expression", "." ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/JSUtils/Preferences.js#L80-L138
train
Converts the given settings array to a regular expression.
[ 30522, 3853, 10906, 19277, 3351, 2595, 2361, 1006, 10906, 1010, 2918, 2890, 3351, 2595, 2361, 1010, 12398, 2890, 3351, 2595, 2361, 1007, 1063, 30524, 10906, 2024, 2328, 2378, 1998, 3685, 2022, 2058, 14615, 4181, 1012, 2065, 1006, 2918, 2890...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
dequelabs/axe-core
lib/commons/text/form-control-value.js
ariaComboboxValue
function ariaComboboxValue(virtualNode, context) { const { actualNode } = virtualNode; const role = aria.getRole(actualNode, { noImplicit: true }); let listbox; // For combobox, find the first owned listbox: if (!role === 'combobox') { return ''; } listbox = aria .getOwnedVirtual(virtualNode) .filter(elm => aria.getRole(elm) === 'listbox')[0]; return listbox ? text.formControlValueMethods.ariaListboxValue(listbox, context) : ''; }
javascript
function ariaComboboxValue(virtualNode, context) { const { actualNode } = virtualNode; const role = aria.getRole(actualNode, { noImplicit: true }); let listbox; // For combobox, find the first owned listbox: if (!role === 'combobox') { return ''; } listbox = aria .getOwnedVirtual(virtualNode) .filter(elm => aria.getRole(elm) === 'listbox')[0]; return listbox ? text.formControlValueMethods.ariaListboxValue(listbox, context) : ''; }
[ "function", "ariaComboboxValue", "(", "virtualNode", ",", "context", ")", "{", "const", "{", "actualNode", "}", "=", "virtualNode", ";", "const", "role", "=", "aria", ".", "getRole", "(", "actualNode", ",", "{", "noImplicit", ":", "true", "}", ")", ";", ...
Calculate value of an element with role=combobox or role=listbox @param {VirtualNode} element The VirtualNode instance whose value we want @param {Object} context The VirtualNode instance whose value we want @property {Element} startNode First node in accessible name computation @property {String[]} unsupported List of roles where value computation is unsupported @property {Bool} debug Enable logging for formControlValue @return {string} The calculated value
[ "Calculate", "value", "of", "an", "element", "with", "role", "=", "combobox", "or", "role", "=", "listbox" ]
727323c07980e2291575f545444d389fb942906f
https://github.com/dequelabs/axe-core/blob/727323c07980e2291575f545444d389fb942906f/lib/commons/text/form-control-value.js#L170-L186
train
Get the value of the given virtual node
[ 30522, 3853, 9342, 18274, 16429, 11636, 10175, 5657, 1006, 7484, 3630, 3207, 1010, 6123, 1007, 1063, 9530, 3367, 1063, 5025, 3630, 3207, 1065, 1027, 7484, 3630, 3207, 1025, 9530, 3367, 2535, 1027, 9342, 1012, 2131, 13153, 2063, 1006, 5025, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
jgraph/mxgraph
javascript/mxClient.js
mxCellState
function mxCellState(view, cell, style) { this.view = view; this.cell = cell; this.style = (style != null) ? style : {}; this.origin = new mxPoint(); this.absoluteOffset = new mxPoint(); }
javascript
function mxCellState(view, cell, style) { this.view = view; this.cell = cell; this.style = (style != null) ? style : {}; this.origin = new mxPoint(); this.absoluteOffset = new mxPoint(); }
[ "function", "mxCellState", "(", "view", ",", "cell", ",", "style", ")", "{", "this", ".", "view", "=", "view", ";", "this", ".", "cell", "=", "cell", ";", "this", ".", "style", "=", "(", "style", "!=", "null", ")", "?", "style", ":", "{", "}", ...
Copyright (c) 2006-2015, JGraph Ltd Copyright (c) 2006-2015, Gaudenz Alder Class: mxCellState Represents the current state of a cell in a given <mxGraphView>. For edges, the edge label position is stored in <absoluteOffset>. The size for oversize labels can be retrieved using the boundingBox property of the <text> field as shown below. (code) var bbox = (state.text != null) ? state.text.boundingBox : null; (end) Constructor: mxCellState Constructs a new object that represents the current state of the given cell in the specified view. Parameters: view - <mxGraphView> that contains the state. cell - <mxCell> that this state represents. style - Array of key, value pairs that constitute the style.
[ "Copyright", "(", "c", ")", "2006", "-", "2015", "JGraph", "Ltd", "Copyright", "(", "c", ")", "2006", "-", "2015", "Gaudenz", "Alder", "Class", ":", "mxCellState" ]
33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44
https://github.com/jgraph/mxgraph/blob/33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44/javascript/mxClient.js#L45803-L45811
train
A state object that can be used to change the position of the cell
[ 30522, 3853, 25630, 29109, 4877, 12259, 1006, 3193, 1010, 3526, 1010, 2806, 1007, 1063, 2023, 1012, 3193, 1027, 3193, 1025, 2023, 1012, 3526, 1027, 3526, 1025, 2023, 1012, 2806, 1027, 1006, 2806, 999, 1027, 19701, 1007, 1029, 2806, 1024, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SeleniumHQ/selenium
javascript/selenium-core/scripts/htmlutils.js
XPathOptimizationCache
function XPathOptimizationCache(newMaxSize) { // private var cache = new BoundedCache(newMaxSize); // public /** * Returns the optimized item by document markup and XPath, or null if * it is not found in the cache. Never calls put() on the underlying cache. */ this.get = function(html, xpath) { var byHtml = cache.get(html); return byHtml ? byHtml[xpath] : null; }; /** * Returns the optimization item by document markup and XPath. Returns an * empty map object that has been added to the cache if the item did not * exist previously. Never returns null. */ this.getOrCreate = function(html, xpath) { var byHtml = cache.get(html); if (byHtml == null) { var result = {}; var optimizations = {}; optimizations[xpath] = result; cache.put(html, optimizations); return result; } var item = byHtml[xpath]; if (item == null) { var result = {}; byHtml[xpath] = result; return result; } return item; }; }
javascript
function XPathOptimizationCache(newMaxSize) { // private var cache = new BoundedCache(newMaxSize); // public /** * Returns the optimized item by document markup and XPath, or null if * it is not found in the cache. Never calls put() on the underlying cache. */ this.get = function(html, xpath) { var byHtml = cache.get(html); return byHtml ? byHtml[xpath] : null; }; /** * Returns the optimization item by document markup and XPath. Returns an * empty map object that has been added to the cache if the item did not * exist previously. Never returns null. */ this.getOrCreate = function(html, xpath) { var byHtml = cache.get(html); if (byHtml == null) { var result = {}; var optimizations = {}; optimizations[xpath] = result; cache.put(html, optimizations); return result; } var item = byHtml[xpath]; if (item == null) { var result = {}; byHtml[xpath] = result; return result; } return item; }; }
[ "function", "XPathOptimizationCache", "(", "newMaxSize", ")", "{", "// private", "var", "cache", "=", "new", "BoundedCache", "(", "newMaxSize", ")", ";", "// public", "/**\n * Returns the optimized item by document markup and XPath, or null if\n * it is not found in the cac...
/////////////////////////////////////////////////////////////////////////////
[ "/////////////////////////////////////////////////////////////////////////////" ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/javascript/selenium-core/scripts/htmlutils.js#L1562-L1605
train
XPathOptimizationCache - A cache that is used to optimize the given xpath.
[ 30522, 3853, 26726, 8988, 7361, 3775, 4328, 9276, 3540, 5403, 1006, 2047, 17848, 5332, 4371, 1007, 1063, 1013, 1013, 2797, 13075, 17053, 1027, 2047, 10351, 3540, 5403, 1006, 2047, 17848, 5332, 4371, 1007, 1025, 1013, 1013, 2270, 1013, 1008,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
adobe/brackets
src/utils/UpdateNotification.js
_stripOldVersionInfo
function _stripOldVersionInfo(versionInfo, buildNumber) { // Do a simple linear search. Since we are going in reverse-chronological order, we // should get through the search quickly. var lastIndex = 0; var len = versionInfo.length; var versionEntry; var validBuildEntries; while (lastIndex < len) { versionEntry = versionInfo[lastIndex]; if (versionEntry.buildNumber <= buildNumber) { break; } lastIndex++; } if (lastIndex > 0) { // Filter recent update entries based on applicability to current platform validBuildEntries = versionInfo.slice(0, lastIndex).filter(_checkBuildApplicability); } return validBuildEntries; }
javascript
function _stripOldVersionInfo(versionInfo, buildNumber) { // Do a simple linear search. Since we are going in reverse-chronological order, we // should get through the search quickly. var lastIndex = 0; var len = versionInfo.length; var versionEntry; var validBuildEntries; while (lastIndex < len) { versionEntry = versionInfo[lastIndex]; if (versionEntry.buildNumber <= buildNumber) { break; } lastIndex++; } if (lastIndex > 0) { // Filter recent update entries based on applicability to current platform validBuildEntries = versionInfo.slice(0, lastIndex).filter(_checkBuildApplicability); } return validBuildEntries; }
[ "function", "_stripOldVersionInfo", "(", "versionInfo", ",", "buildNumber", ")", "{", "// Do a simple linear search. Since we are going in reverse-chronological order, we", "// should get through the search quickly.", "var", "lastIndex", "=", "0", ";", "var", "len", "=", "version...
Return a new array of version information that is newer than "buildNumber". Returns null if there is no new version information.
[ "Return", "a", "new", "array", "of", "version", "information", "that", "is", "newer", "than", "buildNumber", ".", "Returns", "null", "if", "there", "is", "no", "new", "version", "information", "." ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/utils/UpdateNotification.js#L275-L297
train
Strip old version info
[ 30522, 3853, 1035, 6167, 11614, 27774, 2378, 14876, 1006, 2544, 2378, 14876, 1010, 3857, 19172, 5677, 1007, 1063, 1013, 1013, 2079, 1037, 3722, 7399, 3945, 1012, 2144, 2057, 2024, 2183, 1999, 7901, 1011, 23472, 2344, 1010, 2057, 1013, 1013,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SheetJS/js-xlsx
bits/62_fxls.js
parse_PtgAttrChoose
function parse_PtgAttrChoose(blob, length, opts)/*:Array<number>*/ { blob.l +=2; var offset = blob.read_shift(opts && opts.biff == 2 ? 1 : 2); var o/*:Array<number>*/ = []; /* offset is 1 less than the number of elements */ for(var i = 0; i <= offset; ++i) o.push(blob.read_shift(opts && opts.biff == 2 ? 1 : 2)); return o; }
javascript
function parse_PtgAttrChoose(blob, length, opts)/*:Array<number>*/ { blob.l +=2; var offset = blob.read_shift(opts && opts.biff == 2 ? 1 : 2); var o/*:Array<number>*/ = []; /* offset is 1 less than the number of elements */ for(var i = 0; i <= offset; ++i) o.push(blob.read_shift(opts && opts.biff == 2 ? 1 : 2)); return o; }
[ "function", "parse_PtgAttrChoose", "(", "blob", ",", "length", ",", "opts", ")", "/*:Array<number>*/", "{", "blob", ".", "l", "+=", "2", ";", "var", "offset", "=", "blob", ".", "read_shift", "(", "opts", "&&", "opts", ".", "biff", "==", "2", "?", "1", ...
/* [MS-XLS] 2.5.198.34 ; [MS-XLSB] 2.5.97.25
[ "/", "*", "[", "MS", "-", "XLS", "]", "2", ".", "5", ".", "198", ".", "34", ";", "[", "MS", "-", "XLSB", "]", "2", ".", "5", ".", "97", ".", "25" ]
9a6d8a1d3d80c78dad5201fb389316f935279cdc
https://github.com/SheetJS/js-xlsx/blob/9a6d8a1d3d80c78dad5201fb389316f935279cdc/bits/62_fxls.js#L142-L149
train
Parse an attribute choose
[ 30522, 3853, 11968, 3366, 1035, 13866, 20697, 16344, 9905, 9232, 1006, 1038, 4135, 2497, 1010, 3091, 1010, 23569, 2015, 1007, 1013, 1008, 1024, 9140, 1026, 2193, 1028, 1008, 1013, 1063, 1038, 4135, 2497, 1012, 1048, 1009, 1027, 1016, 1025, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
angular/material
src/core/services/interimElement/interimElement.js
factory
function factory($$interimElement, $injector) { var defaultMethods; var defaultOptions; var interimElementService = $$interimElement(); /* * publicService is what the developer will be using. * It has methods hide(), cancel(), show(), build(), and any other * presets which were set during the config phase. */ var publicService = { hide: interimElementService.hide, cancel: interimElementService.cancel, show: showInterimElement, // Special internal method to destroy an interim element without animations // used when navigation changes causes a $scope.$destroy() action destroy : destroyInterimElement }; defaultMethods = providerConfig.methods || []; // This must be invoked after the publicService is initialized defaultOptions = invokeFactory(providerConfig.optionsFactory, {}); // Copy over the simple custom methods angular.forEach(customMethods, function(fn, name) { publicService[name] = fn; }); angular.forEach(providerConfig.presets, function(definition, name) { var presetDefaults = invokeFactory(definition.optionsFactory, {}); var presetMethods = (definition.methods || []).concat(defaultMethods); // Every interimElement built with a preset has a field called `$type`, // which matches the name of the preset. // Eg in preset 'confirm', options.$type === 'confirm' angular.extend(presetDefaults, { $type: name }); // This creates a preset class which has setter methods for every // method given in the `.addPreset()` function, as well as every // method given in the `.setDefaults()` function. // // @example // .setDefaults({ // methods: ['hasBackdrop', 'clickOutsideToClose', 'escapeToClose', 'targetEvent'], // options: dialogDefaultOptions // }) // .addPreset('alert', { // methods: ['title', 'ok'], // options: alertDialogOptions // }) // // Set values will be passed to the options when interimElement.show() is called. function Preset(opts) { this._options = angular.extend({}, presetDefaults, opts); } angular.forEach(presetMethods, function(name) { Preset.prototype[name] = function(value) { this._options[name] = value; return this; }; }); // Create shortcut method for one-linear methods if (definition.argOption) { var methodName = 'show' + name.charAt(0).toUpperCase() + name.slice(1); publicService[methodName] = function(arg) { var config = publicService[name](arg); return publicService.show(config); }; } // eg $mdDialog.alert() will return a new alert preset publicService[name] = function(arg) { // If argOption is supplied, eg `argOption: 'content'`, then we assume // if the argument is not an options object then it is the `argOption` option. // // @example `$mdToast.simple('hello')` // sets options.content to hello // // because argOption === 'content' if (arguments.length && definition.argOption && !angular.isObject(arg) && !angular.isArray(arg)) { return (new Preset())[definition.argOption](arg); } else { return new Preset(arg); } }; }); return publicService; /** * */ function showInterimElement(opts) { // opts is either a preset which stores its options on an _options field, // or just an object made up of options opts = opts || { }; if (opts._options) opts = opts._options; return interimElementService.show( angular.extend({}, defaultOptions, opts) ); } /** * Special method to hide and destroy an interimElement WITHOUT * any 'leave` or hide animations ( an immediate force hide/remove ) * * NOTE: This calls the onRemove() subclass method for each component... * which must have code to respond to `options.$destroy == true` */ function destroyInterimElement(opts) { return interimElementService.destroy(opts); } /** * Helper to call $injector.invoke with a local of the factory name for * this provider. * If an $mdDialog is providing options for a dialog and tries to inject * $mdDialog, a circular dependency error will happen. * We get around that by manually injecting $mdDialog as a local. */ function invokeFactory(factory, defaultVal) { var locals = {}; locals[interimFactoryName] = publicService; return $injector.invoke(factory || function() { return defaultVal; }, {}, locals); } }
javascript
function factory($$interimElement, $injector) { var defaultMethods; var defaultOptions; var interimElementService = $$interimElement(); /* * publicService is what the developer will be using. * It has methods hide(), cancel(), show(), build(), and any other * presets which were set during the config phase. */ var publicService = { hide: interimElementService.hide, cancel: interimElementService.cancel, show: showInterimElement, // Special internal method to destroy an interim element without animations // used when navigation changes causes a $scope.$destroy() action destroy : destroyInterimElement }; defaultMethods = providerConfig.methods || []; // This must be invoked after the publicService is initialized defaultOptions = invokeFactory(providerConfig.optionsFactory, {}); // Copy over the simple custom methods angular.forEach(customMethods, function(fn, name) { publicService[name] = fn; }); angular.forEach(providerConfig.presets, function(definition, name) { var presetDefaults = invokeFactory(definition.optionsFactory, {}); var presetMethods = (definition.methods || []).concat(defaultMethods); // Every interimElement built with a preset has a field called `$type`, // which matches the name of the preset. // Eg in preset 'confirm', options.$type === 'confirm' angular.extend(presetDefaults, { $type: name }); // This creates a preset class which has setter methods for every // method given in the `.addPreset()` function, as well as every // method given in the `.setDefaults()` function. // // @example // .setDefaults({ // methods: ['hasBackdrop', 'clickOutsideToClose', 'escapeToClose', 'targetEvent'], // options: dialogDefaultOptions // }) // .addPreset('alert', { // methods: ['title', 'ok'], // options: alertDialogOptions // }) // // Set values will be passed to the options when interimElement.show() is called. function Preset(opts) { this._options = angular.extend({}, presetDefaults, opts); } angular.forEach(presetMethods, function(name) { Preset.prototype[name] = function(value) { this._options[name] = value; return this; }; }); // Create shortcut method for one-linear methods if (definition.argOption) { var methodName = 'show' + name.charAt(0).toUpperCase() + name.slice(1); publicService[methodName] = function(arg) { var config = publicService[name](arg); return publicService.show(config); }; } // eg $mdDialog.alert() will return a new alert preset publicService[name] = function(arg) { // If argOption is supplied, eg `argOption: 'content'`, then we assume // if the argument is not an options object then it is the `argOption` option. // // @example `$mdToast.simple('hello')` // sets options.content to hello // // because argOption === 'content' if (arguments.length && definition.argOption && !angular.isObject(arg) && !angular.isArray(arg)) { return (new Preset())[definition.argOption](arg); } else { return new Preset(arg); } }; }); return publicService; /** * */ function showInterimElement(opts) { // opts is either a preset which stores its options on an _options field, // or just an object made up of options opts = opts || { }; if (opts._options) opts = opts._options; return interimElementService.show( angular.extend({}, defaultOptions, opts) ); } /** * Special method to hide and destroy an interimElement WITHOUT * any 'leave` or hide animations ( an immediate force hide/remove ) * * NOTE: This calls the onRemove() subclass method for each component... * which must have code to respond to `options.$destroy == true` */ function destroyInterimElement(opts) { return interimElementService.destroy(opts); } /** * Helper to call $injector.invoke with a local of the factory name for * this provider. * If an $mdDialog is providing options for a dialog and tries to inject * $mdDialog, a circular dependency error will happen. * We get around that by manually injecting $mdDialog as a local. */ function invokeFactory(factory, defaultVal) { var locals = {}; locals[interimFactoryName] = publicService; return $injector.invoke(factory || function() { return defaultVal; }, {}, locals); } }
[ "function", "factory", "(", "$$interimElement", ",", "$injector", ")", "{", "var", "defaultMethods", ";", "var", "defaultOptions", ";", "var", "interimElementService", "=", "$$interimElement", "(", ")", ";", "/*\n * publicService is what the developer will be using.\n...
Create a factory that has the given methods & defaults implementing interimElement /* @ngInject
[ "Create", "a", "factory", "that", "has", "the", "given", "methods", "&", "defaults", "implementing", "interimElement", "/", "*" ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/core/services/interimElement/interimElement.js#L110-L242
train
Creates a new instance of the public service
[ 30522, 3853, 4713, 1006, 1002, 1002, 9455, 12260, 3672, 1010, 1002, 1999, 20614, 2953, 1007, 1063, 13075, 12398, 11368, 6806, 5104, 1025, 13075, 12398, 7361, 9285, 1025, 13075, 9455, 12260, 8163, 2121, 7903, 2063, 1027, 1002, 1002, 9455, 12...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
eslint/eslint
lib/config/config-initializer.js
configureRules
function configureRules(answers, config) { const BAR_TOTAL = 20, BAR_SOURCE_CODE_TOTAL = 4, newConfig = Object.assign({}, config), disabledConfigs = {}; let sourceCodes, registry; // Set up a progress bar, as this process can take a long time const bar = new ProgressBar("Determining Config: :percent [:bar] :elapseds elapsed, eta :etas ", { width: 30, total: BAR_TOTAL }); bar.tick(0); // Shows the progress bar // Get the SourceCode of all chosen files const patterns = answers.patterns.split(/[\s]+/u); try { sourceCodes = getSourceCodeOfFiles(patterns, { baseConfig: newConfig, useEslintrc: false }, total => { bar.tick((BAR_SOURCE_CODE_TOTAL / total)); }); } catch (e) { log.info("\n"); throw e; } const fileQty = Object.keys(sourceCodes).length; if (fileQty === 0) { log.info("\n"); throw new Error("Automatic Configuration failed. No files were able to be parsed."); } // Create a registry of rule configs registry = new autoconfig.Registry(); registry.populateFromCoreRules(); // Lint all files with each rule config in the registry registry = registry.lintSourceCode(sourceCodes, newConfig, total => { bar.tick((BAR_TOTAL - BAR_SOURCE_CODE_TOTAL) / total); // Subtract out ticks used at beginning }); debug(`\nRegistry: ${util.inspect(registry.rules, { depth: null })}`); // Create a list of recommended rules, because we don't want to disable them const recRules = Object.keys(recConfig.rules).filter(ruleId => ConfigOps.isErrorSeverity(recConfig.rules[ruleId])); // Find and disable rules which had no error-free configuration const failingRegistry = registry.getFailingRulesRegistry(); Object.keys(failingRegistry.rules).forEach(ruleId => { // If the rule is recommended, set it to error, otherwise disable it disabledConfigs[ruleId] = (recRules.indexOf(ruleId) !== -1) ? 2 : 0; }); // Now that we know which rules to disable, strip out configs with errors registry = registry.stripFailingConfigs(); /* * If there is only one config that results in no errors for a rule, we should use it. * createConfig will only add rules that have one configuration in the registry. */ const singleConfigs = registry.createConfig().rules; /* * The "sweet spot" for number of options in a config seems to be two (severity plus one option). * Very often, a third option (usually an object) is available to address * edge cases, exceptions, or unique situations. We will prefer to use a config with * specificity of two. */ const specTwoConfigs = registry.filterBySpecificity(2).createConfig().rules; // Maybe a specific combination using all three options works const specThreeConfigs = registry.filterBySpecificity(3).createConfig().rules; // If all else fails, try to use the default (severity only) const defaultConfigs = registry.filterBySpecificity(1).createConfig().rules; // Combine configs in reverse priority order (later take precedence) newConfig.rules = Object.assign({}, disabledConfigs, defaultConfigs, specThreeConfigs, specTwoConfigs, singleConfigs); // Make sure progress bar has finished (floating point rounding) bar.update(BAR_TOTAL); // Log out some stats to let the user know what happened const finalRuleIds = Object.keys(newConfig.rules); const totalRules = finalRuleIds.length; const enabledRules = finalRuleIds.filter(ruleId => (newConfig.rules[ruleId] !== 0)).length; const resultMessage = [ `\nEnabled ${enabledRules} out of ${totalRules}`, `rules based on ${fileQty}`, `file${(fileQty === 1) ? "." : "s."}` ].join(" "); log.info(resultMessage); ConfigOps.normalizeToStrings(newConfig); return newConfig; }
javascript
function configureRules(answers, config) { const BAR_TOTAL = 20, BAR_SOURCE_CODE_TOTAL = 4, newConfig = Object.assign({}, config), disabledConfigs = {}; let sourceCodes, registry; // Set up a progress bar, as this process can take a long time const bar = new ProgressBar("Determining Config: :percent [:bar] :elapseds elapsed, eta :etas ", { width: 30, total: BAR_TOTAL }); bar.tick(0); // Shows the progress bar // Get the SourceCode of all chosen files const patterns = answers.patterns.split(/[\s]+/u); try { sourceCodes = getSourceCodeOfFiles(patterns, { baseConfig: newConfig, useEslintrc: false }, total => { bar.tick((BAR_SOURCE_CODE_TOTAL / total)); }); } catch (e) { log.info("\n"); throw e; } const fileQty = Object.keys(sourceCodes).length; if (fileQty === 0) { log.info("\n"); throw new Error("Automatic Configuration failed. No files were able to be parsed."); } // Create a registry of rule configs registry = new autoconfig.Registry(); registry.populateFromCoreRules(); // Lint all files with each rule config in the registry registry = registry.lintSourceCode(sourceCodes, newConfig, total => { bar.tick((BAR_TOTAL - BAR_SOURCE_CODE_TOTAL) / total); // Subtract out ticks used at beginning }); debug(`\nRegistry: ${util.inspect(registry.rules, { depth: null })}`); // Create a list of recommended rules, because we don't want to disable them const recRules = Object.keys(recConfig.rules).filter(ruleId => ConfigOps.isErrorSeverity(recConfig.rules[ruleId])); // Find and disable rules which had no error-free configuration const failingRegistry = registry.getFailingRulesRegistry(); Object.keys(failingRegistry.rules).forEach(ruleId => { // If the rule is recommended, set it to error, otherwise disable it disabledConfigs[ruleId] = (recRules.indexOf(ruleId) !== -1) ? 2 : 0; }); // Now that we know which rules to disable, strip out configs with errors registry = registry.stripFailingConfigs(); /* * If there is only one config that results in no errors for a rule, we should use it. * createConfig will only add rules that have one configuration in the registry. */ const singleConfigs = registry.createConfig().rules; /* * The "sweet spot" for number of options in a config seems to be two (severity plus one option). * Very often, a third option (usually an object) is available to address * edge cases, exceptions, or unique situations. We will prefer to use a config with * specificity of two. */ const specTwoConfigs = registry.filterBySpecificity(2).createConfig().rules; // Maybe a specific combination using all three options works const specThreeConfigs = registry.filterBySpecificity(3).createConfig().rules; // If all else fails, try to use the default (severity only) const defaultConfigs = registry.filterBySpecificity(1).createConfig().rules; // Combine configs in reverse priority order (later take precedence) newConfig.rules = Object.assign({}, disabledConfigs, defaultConfigs, specThreeConfigs, specTwoConfigs, singleConfigs); // Make sure progress bar has finished (floating point rounding) bar.update(BAR_TOTAL); // Log out some stats to let the user know what happened const finalRuleIds = Object.keys(newConfig.rules); const totalRules = finalRuleIds.length; const enabledRules = finalRuleIds.filter(ruleId => (newConfig.rules[ruleId] !== 0)).length; const resultMessage = [ `\nEnabled ${enabledRules} out of ${totalRules}`, `rules based on ${fileQty}`, `file${(fileQty === 1) ? "." : "s."}` ].join(" "); log.info(resultMessage); ConfigOps.normalizeToStrings(newConfig); return newConfig; }
[ "function", "configureRules", "(", "answers", ",", "config", ")", "{", "const", "BAR_TOTAL", "=", "20", ",", "BAR_SOURCE_CODE_TOTAL", "=", "4", ",", "newConfig", "=", "Object", ".", "assign", "(", "{", "}", ",", "config", ")", ",", "disabledConfigs", "=", ...
Set the `rules` of a config by examining a user's source code Note: This clones the config object and returns a new config to avoid mutating the original config parameter. @param {Object} answers answers received from inquirer @param {Object} config config object @returns {Object} config object with configured rules
[ "Set", "the", "rules", "of", "a", "config", "by", "examining", "a", "user", "s", "source", "code" ]
bc0819c94aad14f7fad3cbc2338ea15658b0f272
https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/config/config-initializer.js#L139-L238
train
Configure the rules of the given file
[ 30522, 3853, 9530, 8873, 27390, 2121, 16308, 1006, 6998, 1010, 9530, 8873, 2290, 1007, 1063, 9530, 3367, 3347, 1035, 2561, 1027, 2322, 1010, 3347, 1035, 3120, 1035, 3642, 1035, 2561, 1027, 1018, 1010, 2047, 8663, 8873, 2290, 1027, 4874, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
jgraph/mxgraph
javascript/mxClient.js
function(x1, y1, x2, y2, px, py) { return Math.abs((y2 - y1) * px - (x2 - x1) * py + x2 * y1 - y2 * x1) / Math.sqrt((y2 - y1) * (y2 - y1) + (x2 - x1) * (x2 - x1)); }
javascript
function(x1, y1, x2, y2, px, py) { return Math.abs((y2 - y1) * px - (x2 - x1) * py + x2 * y1 - y2 * x1) / Math.sqrt((y2 - y1) * (y2 - y1) + (x2 - x1) * (x2 - x1)); }
[ "function", "(", "x1", ",", "y1", ",", "x2", ",", "y2", ",", "px", ",", "py", ")", "{", "return", "Math", ".", "abs", "(", "(", "y2", "-", "y1", ")", "*", "px", "-", "(", "x2", "-", "x1", ")", "*", "py", "+", "x2", "*", "y1", "-", "y2",...
Function: ptLineDist Returns the distance between a line defined by two points and a point. To get the distance between a point and a segment (with a specific length) use <mxUtils.ptSeqDistSq>. Parameters: x1 - X-coordinate of point 1 of the line. y1 - Y-coordinate of point 1 of the line. x2 - X-coordinate of point 1 of the line. y2 - Y-coordinate of point 1 of the line. px - X-coordinate of the point. py - Y-coordinate of the point.
[ "Function", ":", "ptLineDist" ]
33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44
https://github.com/jgraph/mxgraph/blob/33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44/javascript/mxClient.js#L5110-L5114
train
Calculate the distance between two points
[ 30522, 3853, 1006, 1060, 2487, 1010, 1061, 2487, 1010, 1060, 2475, 1010, 1061, 2475, 1010, 1052, 2595, 1010, 1052, 2100, 1007, 1063, 2709, 8785, 1012, 14689, 1006, 1006, 1061, 2475, 1011, 1061, 2487, 1007, 1008, 1052, 2595, 1011, 1006, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
adobe/brackets
src/JSUtils/node/TernNodeDomain.js
getTernProperties
function getTernProperties(fileInfo, offset, type) { var request = buildRequest(fileInfo, "properties", offset), i; //_log("tern properties: request " + request.type + dir + " " + file); try { ternServer.request(request, function (error, data) { var properties = []; if (error) { _log("Error returned from Tern 'properties' request: " + error); } else { //_log("tern properties: completions = " + data.completions.length); properties = data.completions.map(function (completion) { return {value: completion, type: completion.type, guess: true}; }); } // Post a message back to the main thread with the completions self.postMessage({type: type, file: _getNormalizedFilename(fileInfo.name), offset: offset, properties: properties }); }); } catch (e) { _reportError(e, fileInfo.name); } }
javascript
function getTernProperties(fileInfo, offset, type) { var request = buildRequest(fileInfo, "properties", offset), i; //_log("tern properties: request " + request.type + dir + " " + file); try { ternServer.request(request, function (error, data) { var properties = []; if (error) { _log("Error returned from Tern 'properties' request: " + error); } else { //_log("tern properties: completions = " + data.completions.length); properties = data.completions.map(function (completion) { return {value: completion, type: completion.type, guess: true}; }); } // Post a message back to the main thread with the completions self.postMessage({type: type, file: _getNormalizedFilename(fileInfo.name), offset: offset, properties: properties }); }); } catch (e) { _reportError(e, fileInfo.name); } }
[ "function", "getTernProperties", "(", "fileInfo", ",", "offset", ",", "type", ")", "{", "var", "request", "=", "buildRequest", "(", "fileInfo", ",", "\"properties\"", ",", "offset", ")", ",", "i", ";", "//_log(\"tern properties: request \" + request.type + dir + \" \"...
Get all the known properties for guessing. @param {{type: string, name: string, offsetLines: number, text: string}} fileInfo - type of update, name of file, and the text of the update. For "full" updates, the whole text of the file is present. For "part" updates, the changed portion of the text. For "empty" updates, the file has not been modified and the text is empty. @param {{line: number, ch: number}} offset - the offset into the file where we want completions for @param {string} type - the type of the message to reply with.
[ "Get", "all", "the", "known", "properties", "for", "guessing", "." ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/JSUtils/node/TernNodeDomain.js#L416-L442
train
Get Tern properties
[ 30522, 3853, 2131, 16451, 21572, 4842, 7368, 1006, 5371, 2378, 14876, 1010, 16396, 1010, 2828, 1007, 1063, 13075, 5227, 1027, 3857, 2890, 15500, 1006, 5371, 2378, 14876, 1010, 1000, 5144, 1000, 1010, 16396, 1007, 1010, 1045, 1025, 1013, 101...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
adobe/brackets
src/LiveDevelopment/Agents/HighlightAgent.js
_onRemoteHighlight
function _onRemoteHighlight(event, res) { var node; if (res.value === "1") { node = DOMAgent.nodeWithId(res.nodeId); } exports.trigger("highlight", node); }
javascript
function _onRemoteHighlight(event, res) { var node; if (res.value === "1") { node = DOMAgent.nodeWithId(res.nodeId); } exports.trigger("highlight", node); }
[ "function", "_onRemoteHighlight", "(", "event", ",", "res", ")", "{", "var", "node", ";", "if", "(", "res", ".", "value", "===", "\"1\"", ")", "{", "node", "=", "DOMAgent", ".", "nodeWithId", "(", "res", ".", "nodeId", ")", ";", "}", "exports", ".", ...
active highlight Remote Event: Highlight
[ "active", "highlight", "Remote", "Event", ":", "Highlight" ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/LiveDevelopment/Agents/HighlightAgent.js#L43-L49
train
Called when a remote highlight is received
[ 30522, 3853, 1035, 2006, 28578, 12184, 4048, 5603, 7138, 1006, 2724, 1010, 24501, 1007, 1063, 13075, 13045, 1025, 2065, 1006, 24501, 1012, 3643, 1027, 1027, 1027, 1000, 1015, 1000, 1007, 1063, 13045, 1027, 14383, 4270, 3372, 1012, 13045, 24...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
jquery/jquery
build/release.js
function( callback ) { Release.exec( "grunt", "Grunt command failed" ); Release.exec( "grunt custom:-ajax,-effects --filename=jquery.slim.js && " + "grunt remove_map_comment --filename=jquery.slim.js", "Grunt custom failed" ); cdn.makeReleaseCopies( Release ); Release._setSrcVersion(); callback( files ); }
javascript
function( callback ) { Release.exec( "grunt", "Grunt command failed" ); Release.exec( "grunt custom:-ajax,-effects --filename=jquery.slim.js && " + "grunt remove_map_comment --filename=jquery.slim.js", "Grunt custom failed" ); cdn.makeReleaseCopies( Release ); Release._setSrcVersion(); callback( files ); }
[ "function", "(", "callback", ")", "{", "Release", ".", "exec", "(", "\"grunt\"", ",", "\"Grunt command failed\"", ")", ";", "Release", ".", "exec", "(", "\"grunt custom:-ajax,-effects --filename=jquery.slim.js && \"", "+", "\"grunt remove_map_comment --filename=jquery.slim.js...
Generates any release artifacts that should be included in the release. The callback must be invoked with an array of files that should be committed before creating the tag. @param {Function} callback
[ "Generates", "any", "release", "artifacts", "that", "should", "be", "included", "in", "the", "release", ".", "The", "callback", "must", "be", "invoked", "with", "an", "array", "of", "files", "that", "should", "be", "committed", "before", "creating", "the", "...
ccbd6b93424cbdbf86f07a86c2e55cbab497d7a3
https://github.com/jquery/jquery/blob/ccbd6b93424cbdbf86f07a86c2e55cbab497d7a3/build/release.js#L49-L59
train
This function is called when the release is not installed
[ 30522, 3853, 1006, 2655, 5963, 1007, 1063, 2713, 1012, 4654, 8586, 1006, 1000, 20696, 1000, 1010, 1000, 20696, 3094, 3478, 1000, 1007, 1025, 2713, 1012, 4654, 8586, 1006, 1000, 20696, 7661, 1024, 1011, 18176, 1010, 1011, 3896, 1011, 1011, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
firebase/firebase-js-sdk
packages/auth/demo/public/script.js
onUpdateProfile
function onUpdateProfile() { var displayName = $('#display-name').val(); var photoURL = $('#photo-url').val(); activeUser().updateProfile({ 'displayName': displayName, 'photoURL': photoURL }).then(function() { refreshUserData(); alertSuccess('Profile updated!'); }, onAuthError); }
javascript
function onUpdateProfile() { var displayName = $('#display-name').val(); var photoURL = $('#photo-url').val(); activeUser().updateProfile({ 'displayName': displayName, 'photoURL': photoURL }).then(function() { refreshUserData(); alertSuccess('Profile updated!'); }, onAuthError); }
[ "function", "onUpdateProfile", "(", ")", "{", "var", "displayName", "=", "$", "(", "'#display-name'", ")", ".", "val", "(", ")", ";", "var", "photoURL", "=", "$", "(", "'#photo-url'", ")", ".", "val", "(", ")", ";", "activeUser", "(", ")", ".", "upda...
Changes the user's password.
[ "Changes", "the", "user", "s", "password", "." ]
491598a499813dacc23724de5e237ec220cc560e
https://github.com/firebase/firebase-js-sdk/blob/491598a499813dacc23724de5e237ec220cc560e/packages/auth/demo/public/script.js#L625-L635
train
Update profile
[ 30522, 3853, 2006, 6279, 13701, 21572, 8873, 2571, 1006, 1007, 1063, 13075, 4653, 18442, 1027, 1002, 1006, 1005, 1001, 4653, 1011, 2171, 1005, 1007, 1012, 11748, 1006, 1007, 1025, 13075, 6302, 3126, 2140, 1027, 1002, 1006, 1005, 1001, 6302,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
jaywcjlove/linux-command
build/build.js
readMarkdownPaths
function readMarkdownPaths(filepath) { return new Promise((resolve, reject) => { try { let pathAll = []; const files = FS.readdirSync(filepath); for (let i = 0; i < files.length; i++) { if (/\.md$/.test(files[i])) { pathAll.push(path.join(filepath, files[i])); } } resolve(pathAll); } catch (err) { reject(err); } }); }
javascript
function readMarkdownPaths(filepath) { return new Promise((resolve, reject) => { try { let pathAll = []; const files = FS.readdirSync(filepath); for (let i = 0; i < files.length; i++) { if (/\.md$/.test(files[i])) { pathAll.push(path.join(filepath, files[i])); } } resolve(pathAll); } catch (err) { reject(err); } }); }
[ "function", "readMarkdownPaths", "(", "filepath", ")", "{", "return", "new", "Promise", "(", "(", "resolve", ",", "reject", ")", "=>", "{", "try", "{", "let", "pathAll", "=", "[", "]", ";", "const", "files", "=", "FS", ".", "readdirSync", "(", "filepat...
返回 MD 所有路径的 Array @param {String} filepath
[ "返回", "MD", "所有路径的", "Array" ]
7d6c8c6b3468a0dd5311ee68934c9b8db64469f7
https://github.com/jaywcjlove/linux-command/blob/7d6c8c6b3468a0dd5311ee68934c9b8db64469f7/build/build.js#L294-L309
train
Read markdown files
[ 30522, 3853, 3191, 10665, 7698, 15069, 2015, 1006, 5371, 15069, 1007, 1063, 2709, 2047, 4872, 1006, 1006, 10663, 1010, 15454, 1007, 1027, 1028, 1063, 3046, 1063, 2292, 4130, 8095, 1027, 1031, 1033, 1025, 9530, 3367, 6764, 1027, 1042, 2015, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.core/src/sap/ui/model/odata/_AnnotationHelperExpression.js
function (oInterface, oPathValue) { var oCondition = Expression.parameter(oInterface, oPathValue, 0, "Edm.Boolean"), oThen = Expression.parameter(oInterface, oPathValue, 1), oElse = Expression.parameter(oInterface, oPathValue, 2), sType = oThen.type, bWithType = oPathValue.withType; if (oThen.type === "edm:Null") { sType = oElse.type; } else if (oElse.type !== "edm:Null" && oThen.type !== oElse.type) { Basics.error(oPathValue, "Expected same type for second and third parameter, types are '" + oThen.type + "' and '" + oElse.type + "'"); } return { result : "expression", type : sType, value : Basics.resultToString(Expression.wrapExpression(oCondition), true, false) + "?" + Basics.resultToString(Expression.wrapExpression(oThen), true, bWithType) + ":" + Basics.resultToString(Expression.wrapExpression(oElse), true, bWithType) }; }
javascript
function (oInterface, oPathValue) { var oCondition = Expression.parameter(oInterface, oPathValue, 0, "Edm.Boolean"), oThen = Expression.parameter(oInterface, oPathValue, 1), oElse = Expression.parameter(oInterface, oPathValue, 2), sType = oThen.type, bWithType = oPathValue.withType; if (oThen.type === "edm:Null") { sType = oElse.type; } else if (oElse.type !== "edm:Null" && oThen.type !== oElse.type) { Basics.error(oPathValue, "Expected same type for second and third parameter, types are '" + oThen.type + "' and '" + oElse.type + "'"); } return { result : "expression", type : sType, value : Basics.resultToString(Expression.wrapExpression(oCondition), true, false) + "?" + Basics.resultToString(Expression.wrapExpression(oThen), true, bWithType) + ":" + Basics.resultToString(Expression.wrapExpression(oElse), true, bWithType) }; }
[ "function", "(", "oInterface", ",", "oPathValue", ")", "{", "var", "oCondition", "=", "Expression", ".", "parameter", "(", "oInterface", ",", "oPathValue", ",", "0", ",", "\"Edm.Boolean\"", ")", ",", "oThen", "=", "Expression", ".", "parameter", "(", "oInter...
Handling of "14.5.6 Expression edm:If". @param {sap.ui.core.util.XMLPreprocessor.IContext|sap.ui.model.Context} oInterface the callback interface related to the current formatter call @param {object} oPathValue path and value information pointing to the parameters array (see Expression object). The first parameter element is the conditional expression and must evaluate to an Edm.Boolean. The second and third child elements are the expressions, which are evaluated conditionally. @returns {object} the result object
[ "Handling", "of", "14", ".", "5", ".", "6", "Expression", "edm", ":", "If", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/_AnnotationHelperExpression.js#L236-L257
train
Returns an object with the type and value of the parameter
[ 30522, 3853, 1006, 1051, 18447, 2121, 12172, 1010, 6728, 8988, 10175, 5657, 1007, 1063, 13075, 1051, 8663, 20562, 1027, 3670, 1012, 16381, 1006, 1051, 18447, 2121, 12172, 1010, 6728, 8988, 10175, 5657, 1010, 1014, 1010, 1000, 3968, 2213, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SeleniumHQ/selenium
third_party/js/mozmill/shared-modules/utils.js
getEntity
function getEntity(urls, entityId) { // Add xhtml11.dtd to prevent missing entity errors with XHTML files urls.push("resource:///res/dtd/xhtml11.dtd"); // Build a string of external entities var extEntities = ""; for (i = 0; i < urls.length; i++) { extEntities += '<!ENTITY % dtd' + i + ' SYSTEM "' + urls[i] + '">%dtd' + i + ';'; } var parser = Cc["@mozilla.org/xmlextras/domparser;1"] .createInstance(Ci.nsIDOMParser); var header = '<?xml version="1.0"?><!DOCTYPE elem [' + extEntities + ']>'; var elem = '<elem id="elementID">&' + entityId + ';</elem>'; var doc = parser.parseFromString(header + elem, 'text/xml'); var elemNode = doc.querySelector('elem[id="elementID"]'); if (elemNode == null) throw new Error(arguments.callee.name + ": Unknown entity - " + entityId); return elemNode.textContent; }
javascript
function getEntity(urls, entityId) { // Add xhtml11.dtd to prevent missing entity errors with XHTML files urls.push("resource:///res/dtd/xhtml11.dtd"); // Build a string of external entities var extEntities = ""; for (i = 0; i < urls.length; i++) { extEntities += '<!ENTITY % dtd' + i + ' SYSTEM "' + urls[i] + '">%dtd' + i + ';'; } var parser = Cc["@mozilla.org/xmlextras/domparser;1"] .createInstance(Ci.nsIDOMParser); var header = '<?xml version="1.0"?><!DOCTYPE elem [' + extEntities + ']>'; var elem = '<elem id="elementID">&' + entityId + ';</elem>'; var doc = parser.parseFromString(header + elem, 'text/xml'); var elemNode = doc.querySelector('elem[id="elementID"]'); if (elemNode == null) throw new Error(arguments.callee.name + ": Unknown entity - " + entityId); return elemNode.textContent; }
[ "function", "getEntity", "(", "urls", ",", "entityId", ")", "{", "// Add xhtml11.dtd to prevent missing entity errors with XHTML files", "urls", ".", "push", "(", "\"resource:///res/dtd/xhtml11.dtd\"", ")", ";", "// Build a string of external entities", "var", "extEntities", "=...
Returns the value of an individual entity in a DTD file. @param [string] urls Array of DTD urls. @param {string} entityId The ID of the entity to get the value of. @return The value of the requested entity @type string
[ "Returns", "the", "value", "of", "an", "individual", "entity", "in", "a", "DTD", "file", "." ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/js/mozmill/shared-modules/utils.js#L313-L335
train
Get the content of an entity
[ 30522, 3853, 2131, 4765, 3012, 1006, 24471, 4877, 1010, 9178, 3593, 1007, 1063, 1013, 1013, 5587, 1060, 11039, 19968, 14526, 1012, 26718, 2094, 2000, 4652, 4394, 9178, 10697, 2007, 1060, 11039, 19968, 6764, 24471, 4877, 1012, 5245, 1006, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
GeekyAnts/vue-native-core
dist/vue.runtime.common.js
createElement$1
function createElement$1 (tagName, vnode) { var elm = document.createElement(tagName); if (tagName !== 'select') { return elm } // false or null will remove the attribute but undefined will not if (vnode.data && vnode.data.attrs && vnode.data.attrs.multiple !== undefined) { elm.setAttribute('multiple', 'multiple'); } return elm }
javascript
function createElement$1 (tagName, vnode) { var elm = document.createElement(tagName); if (tagName !== 'select') { return elm } // false or null will remove the attribute but undefined will not if (vnode.data && vnode.data.attrs && vnode.data.attrs.multiple !== undefined) { elm.setAttribute('multiple', 'multiple'); } return elm }
[ "function", "createElement$1", "(", "tagName", ",", "vnode", ")", "{", "var", "elm", "=", "document", ".", "createElement", "(", "tagName", ")", ";", "if", "(", "tagName", "!==", "'select'", ")", "{", "return", "elm", "}", "// false or null will remove the att...
/*
[ "/", "*" ]
a7b4c9e35fe3f01d7576086f41e5e9ec6975b72e
https://github.com/GeekyAnts/vue-native-core/blob/a7b4c9e35fe3f01d7576086f41e5e9ec6975b72e/dist/vue.runtime.common.js#L4160-L4170
train
create element
[ 30522, 3853, 3443, 12260, 3672, 1002, 1015, 1006, 6415, 18442, 1010, 1058, 3630, 3207, 1007, 1063, 13075, 17709, 1027, 6254, 1012, 3443, 12260, 3672, 1006, 6415, 18442, 1007, 1025, 2065, 1006, 6415, 18442, 999, 1027, 1027, 1005, 7276, 1005,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
dequelabs/axe-core
lib/core/utils/respondable.js
createResponder
function createResponder(source, topic, uuid) { return function(message, keepalive, callback) { post(source, topic, message, uuid, keepalive, callback); }; }
javascript
function createResponder(source, topic, uuid) { return function(message, keepalive, callback) { post(source, topic, message, uuid, keepalive, callback); }; }
[ "function", "createResponder", "(", "source", ",", "topic", ",", "uuid", ")", "{", "return", "function", "(", "message", ",", "keepalive", ",", "callback", ")", "{", "post", "(", "source", ",", "topic", ",", "message", ",", "uuid", ",", "keepalive", ",",...
Helper closure to create a function that may be used to respond to a message @private @param {Window} source The window from which the message originated @param {String} topic The topic of the message @param {String} uuid The "unique" ID of the original message @return {Function} A function that may be invoked to respond to the message
[ "Helper", "closure", "to", "create", "a", "function", "that", "may", "be", "used", "to", "respond", "to", "a", "message" ]
727323c07980e2291575f545444d389fb942906f
https://github.com/dequelabs/axe-core/blob/727323c07980e2291575f545444d389fb942906f/lib/core/utils/respondable.js#L138-L142
train
Creates a function that will send a message to the topic
[ 30522, 3853, 3443, 6072, 26029, 4063, 1006, 3120, 1010, 8476, 1010, 1057, 21272, 1007, 1063, 2709, 3853, 1006, 4471, 1010, 2562, 11475, 3726, 1010, 2655, 5963, 1007, 1063, 2695, 1006, 3120, 1010, 8476, 1010, 4471, 1010, 1057, 21272, 1010, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
webtorrent/webtorrent
lib/server.js
encodeRFC5987
function encodeRFC5987 (str) { return encodeURIComponent(str) // Note that although RFC3986 reserves "!", RFC5987 does not, // so we do not need to escape it .replace(/['()]/g, escape) // i.e., %27 %28 %29 .replace(/\*/g, '%2A') // The following are not required for percent-encoding per RFC5987, // so we can allow for a little better readability over the wire: |`^ .replace(/%(?:7C|60|5E)/g, unescape) }
javascript
function encodeRFC5987 (str) { return encodeURIComponent(str) // Note that although RFC3986 reserves "!", RFC5987 does not, // so we do not need to escape it .replace(/['()]/g, escape) // i.e., %27 %28 %29 .replace(/\*/g, '%2A') // The following are not required for percent-encoding per RFC5987, // so we can allow for a little better readability over the wire: |`^ .replace(/%(?:7C|60|5E)/g, unescape) }
[ "function", "encodeRFC5987", "(", "str", ")", "{", "return", "encodeURIComponent", "(", "str", ")", "// Note that although RFC3986 reserves \"!\", RFC5987 does not,", "// so we do not need to escape it", ".", "replace", "(", "/", "['()]", "/", "g", ",", "escape", ")", "...
From https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/encodeURIComponent
[ "From", "https", ":", "//", "developer", ".", "mozilla", ".", "org", "/", "en", "/", "docs", "/", "Web", "/", "JavaScript", "/", "Reference", "/", "Global_Objects", "/", "encodeURIComponent" ]
f8923a66a8b1178a412b067bc913e267025b3d57
https://github.com/webtorrent/webtorrent/blob/f8923a66a8b1178a412b067bc913e267025b3d57/lib/server.js#L225-L234
train
Encode a string as RFC5987
[ 30522, 3853, 4372, 16044, 12881, 2278, 28154, 2620, 2581, 1006, 2358, 2099, 1007, 1063, 2709, 4372, 16044, 9496, 9006, 29513, 3372, 1006, 2358, 2099, 1007, 1013, 1013, 3602, 2008, 2348, 14645, 23499, 20842, 8269, 1000, 999, 1000, 1010, 1464...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
adobe/brackets
src/utils/TokenUtils.js
_manageCache
function _manageCache(cm, line) { if (!cache || !cache.tokens || cache.line !== line || cache.cm !== cm) { // Cache is no longer matching -> Update var tokens = cm.getLineTokens(line, false); // Add empty beginning-of-line token for backwards compatibility tokens.unshift(cm.getTokenAt({line: line, ch: 0}, false)); cache = { cm: cm, line: line, timeStamp: Date.now(), tokens: tokens }; cm.off("changes", _clearCache); cm.on("changes", _clearCache); } return cache.tokens; }
javascript
function _manageCache(cm, line) { if (!cache || !cache.tokens || cache.line !== line || cache.cm !== cm) { // Cache is no longer matching -> Update var tokens = cm.getLineTokens(line, false); // Add empty beginning-of-line token for backwards compatibility tokens.unshift(cm.getTokenAt({line: line, ch: 0}, false)); cache = { cm: cm, line: line, timeStamp: Date.now(), tokens: tokens }; cm.off("changes", _clearCache); cm.on("changes", _clearCache); } return cache.tokens; }
[ "function", "_manageCache", "(", "cm", ",", "line", ")", "{", "if", "(", "!", "cache", "||", "!", "cache", ".", "tokens", "||", "cache", ".", "line", "!==", "line", "||", "cache", ".", "cm", "!==", "cm", ")", "{", "// Cache is no longer matching -> Updat...
/* Caches the tokens for the given editor/line if needed @param {!CodeMirror} cm @param {!number} line @return {Array.<Object>} (Cached) array of tokens
[ "/", "*", "Caches", "the", "tokens", "for", "the", "given", "editor", "/", "line", "if", "needed" ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/utils/TokenUtils.js#L51-L67
train
manage cache
[ 30522, 3853, 1035, 6133, 3540, 5403, 1006, 4642, 1010, 2240, 1007, 1063, 2065, 1006, 999, 17053, 1064, 1064, 999, 17053, 1012, 19204, 2015, 1064, 1064, 17053, 1012, 2240, 999, 1027, 1027, 2240, 1064, 1064, 17053, 1012, 4642, 999, 1027, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
facebook/relay
packages/relay-runtime/store/RelayConcreteVariables.js
getFragmentVariables
function getFragmentVariables( fragment: ReaderFragment, rootVariables: Variables, argumentVariables: Variables, ): Variables { let variables; fragment.argumentDefinitions.forEach(definition => { if (argumentVariables.hasOwnProperty(definition.name)) { return; } variables = variables || {...argumentVariables}; switch (definition.kind) { case 'LocalArgument': variables[definition.name] = definition.defaultValue; break; case 'RootArgument': if (!rootVariables.hasOwnProperty(definition.name)) { /* * Global variables passed as values of @arguments are not required to * be declared unless they are used by the callee fragment or a * descendant. In this case, the root variable may not be defined when * resolving the callee's variables. The value is explicitly set to * undefined to conform to the check in * RelayStoreUtils.getStableVariableValue() that variable keys are all * present. */ variables[definition.name] = undefined; break; } variables[definition.name] = rootVariables[definition.name]; break; default: (definition: empty); invariant( false, 'RelayConcreteVariables: Unexpected node kind `%s` in fragment `%s`.', definition.kind, fragment.name, ); }
javascript
function getFragmentVariables( fragment: ReaderFragment, rootVariables: Variables, argumentVariables: Variables, ): Variables { let variables; fragment.argumentDefinitions.forEach(definition => { if (argumentVariables.hasOwnProperty(definition.name)) { return; } variables = variables || {...argumentVariables}; switch (definition.kind) { case 'LocalArgument': variables[definition.name] = definition.defaultValue; break; case 'RootArgument': if (!rootVariables.hasOwnProperty(definition.name)) { /* * Global variables passed as values of @arguments are not required to * be declared unless they are used by the callee fragment or a * descendant. In this case, the root variable may not be defined when * resolving the callee's variables. The value is explicitly set to * undefined to conform to the check in * RelayStoreUtils.getStableVariableValue() that variable keys are all * present. */ variables[definition.name] = undefined; break; } variables[definition.name] = rootVariables[definition.name]; break; default: (definition: empty); invariant( false, 'RelayConcreteVariables: Unexpected node kind `%s` in fragment `%s`.', definition.kind, fragment.name, ); }
[ "function", "getFragmentVariables", "(", "fragment", ":", "ReaderFragment", ",", "rootVariables", ":", "Variables", ",", "argumentVariables", ":", "Variables", ",", ")", ":", "Variables", "{", "let", "variables", ";", "fragment", ".", "argumentDefinitions", ".", "...
Determines the variables that are in scope for a fragment given the variables in scope at the root query as well as any arguments applied at the fragment spread via `@arguments`. Note that this is analagous to determining function arguments given a function call.
[ "Determines", "the", "variables", "that", "are", "in", "scope", "for", "a", "fragment", "given", "the", "variables", "in", "scope", "at", "the", "root", "query", "as", "well", "as", "any", "arguments", "applied", "at", "the", "fragment", "spread", "via", "...
7fb9be5182b9650637d7b92ead9a42713ac30aa4
https://github.com/facebook/relay/blob/7fb9be5182b9650637d7b92ead9a42713ac30aa4/packages/relay-runtime/store/RelayConcreteVariables.js#L26-L65
train
Get the variables of a ReaderFragment
[ 30522, 3853, 2131, 27843, 21693, 4765, 10755, 19210, 2015, 1006, 15778, 1024, 8068, 27843, 21693, 4765, 1010, 7117, 10755, 19210, 2015, 1024, 10857, 1010, 6685, 10755, 19210, 2015, 1024, 10857, 1010, 1007, 1024, 10857, 1063, 2292, 10857, 1025...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.support/src/sap/ui/support/supportRules/ExecutionScope.js
function (type) { var log = jQuery.sap.log.getLogEntries(), loggedObjects = [], elemIds; // Add logEntries that have support info object, // and that have the same type as the type provided log.forEach(function (logEntry) { if (!logEntry.supportInfo) { return; } if (!elemIds){ elemIds = elements.map(function (element) { return element.getId(); }); } var hasElemId = !!logEntry.supportInfo.elementId, typeMatch = logEntry.supportInfo.type === type || type === undefined, scopeMatch = !hasElemId || jQuery.inArray(logEntry.supportInfo.elementId, elemIds) > -1; /** * Give the developer the ability to pass filtering function */ if (typeof type === "function" && type(logEntry) && scopeMatch) { loggedObjects.push(logEntry); return; } if (typeMatch && scopeMatch) { loggedObjects.push(logEntry); } }); return loggedObjects; }
javascript
function (type) { var log = jQuery.sap.log.getLogEntries(), loggedObjects = [], elemIds; // Add logEntries that have support info object, // and that have the same type as the type provided log.forEach(function (logEntry) { if (!logEntry.supportInfo) { return; } if (!elemIds){ elemIds = elements.map(function (element) { return element.getId(); }); } var hasElemId = !!logEntry.supportInfo.elementId, typeMatch = logEntry.supportInfo.type === type || type === undefined, scopeMatch = !hasElemId || jQuery.inArray(logEntry.supportInfo.elementId, elemIds) > -1; /** * Give the developer the ability to pass filtering function */ if (typeof type === "function" && type(logEntry) && scopeMatch) { loggedObjects.push(logEntry); return; } if (typeMatch && scopeMatch) { loggedObjects.push(logEntry); } }); return loggedObjects; }
[ "function", "(", "type", ")", "{", "var", "log", "=", "jQuery", ".", "sap", ".", "log", ".", "getLogEntries", "(", ")", ",", "loggedObjects", "=", "[", "]", ",", "elemIds", ";", "// Add logEntries that have support info object,", "// and that have the same type as...
Gets the logged objects by object type @public @function @param {any} type Type of logged objects @returns {Array} Array of logged objects @alias sap.ui.support.ExecutionScope.getLoggedObjects
[ "Gets", "the", "logged", "objects", "by", "object", "type" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.support/src/sap/ui/support/supportRules/ExecutionScope.js#L298-L336
train
Returns an array of logged objects that match the type provided
[ 30522, 3853, 1006, 2828, 1007, 1063, 13075, 8833, 1027, 1046, 4226, 2854, 1012, 20066, 1012, 8833, 1012, 2131, 21197, 4765, 5134, 1006, 1007, 1010, 26618, 16429, 20614, 2015, 1027, 1031, 1033, 1010, 3449, 23238, 5104, 1025, 1013, 1013, 5587...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
adobe/brackets
src/language/JSUtils.js
_getFunctionsForFile
function _getFunctionsForFile(fileInfo) { var result = new $.Deferred(); _shouldGetFromCache(fileInfo) .done(function (useCache) { if (useCache) { // Return cached data. doc property is undefined since we hit the cache. // _getOffsets() will fetch the Document if necessary. result.resolve({/*doc: undefined,*/fileInfo: fileInfo, functions: fileInfo.JSUtils.functions}); } else { _readFile(fileInfo, result); } }).fail(function (err) { result.reject(err); }); return result.promise(); }
javascript
function _getFunctionsForFile(fileInfo) { var result = new $.Deferred(); _shouldGetFromCache(fileInfo) .done(function (useCache) { if (useCache) { // Return cached data. doc property is undefined since we hit the cache. // _getOffsets() will fetch the Document if necessary. result.resolve({/*doc: undefined,*/fileInfo: fileInfo, functions: fileInfo.JSUtils.functions}); } else { _readFile(fileInfo, result); } }).fail(function (err) { result.reject(err); }); return result.promise(); }
[ "function", "_getFunctionsForFile", "(", "fileInfo", ")", "{", "var", "result", "=", "new", "$", ".", "Deferred", "(", ")", ";", "_shouldGetFromCache", "(", "fileInfo", ")", ".", "done", "(", "function", "(", "useCache", ")", "{", "if", "(", "useCache", ...
Resolves with a record containing the Document or FileInfo and an Array of all function names with offsets for the specified file. Results may be cached. @param {FileInfo} fileInfo @return {$.Promise} A promise resolved with a document info object that contains a map of all function names from the document and each function's start offset.
[ "Resolves", "with", "a", "record", "containing", "the", "Document", "or", "FileInfo", "and", "an", "Array", "of", "all", "function", "names", "with", "offsets", "for", "the", "specified", "file", ".", "Results", "may", "be", "cached", "." ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/language/JSUtils.js#L389-L406
train
Get the functions for a file
[ 30522, 3853, 1035, 2131, 11263, 27989, 22747, 16347, 9463, 1006, 5371, 2378, 14876, 1007, 1063, 13075, 2765, 1027, 2047, 1002, 1012, 13366, 28849, 2094, 1006, 1007, 1025, 1035, 2323, 18150, 19699, 5358, 3540, 5403, 1006, 5371, 2378, 14876, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
eslint/eslint
lib/rules/no-redeclare.js
findVariablesInScope
function findVariablesInScope(scope) { for (const variable of scope.variables) { const [ declaration, ...extraDeclarations ] = iterateDeclarations(variable); if (extraDeclarations.length === 0) { continue; } /* * If the type of a declaration is different from the type of * the first declaration, it shows the location of the first * declaration. */ const detailMessageId = declaration.type === "builtin" ? "redeclaredAsBuiltin" : "redeclaredBySyntax"; const data = { id: variable.name }; // Report extra declarations. for (const { type, node, loc } of extraDeclarations) { const messageId = type === declaration.type ? "redeclared" : detailMessageId; context.report({ node, loc, messageId, data }); } } }
javascript
function findVariablesInScope(scope) { for (const variable of scope.variables) { const [ declaration, ...extraDeclarations ] = iterateDeclarations(variable); if (extraDeclarations.length === 0) { continue; } /* * If the type of a declaration is different from the type of * the first declaration, it shows the location of the first * declaration. */ const detailMessageId = declaration.type === "builtin" ? "redeclaredAsBuiltin" : "redeclaredBySyntax"; const data = { id: variable.name }; // Report extra declarations. for (const { type, node, loc } of extraDeclarations) { const messageId = type === declaration.type ? "redeclared" : detailMessageId; context.report({ node, loc, messageId, data }); } } }
[ "function", "findVariablesInScope", "(", "scope", ")", "{", "for", "(", "const", "variable", "of", "scope", ".", "variables", ")", "{", "const", "[", "declaration", ",", "...", "extraDeclarations", "]", "=", "iterateDeclarations", "(", "variable", ")", ";", ...
Find variables in a given scope and flag redeclared ones. @param {Scope} scope - An eslint-scope scope object. @returns {void} @private
[ "Find", "variables", "in", "a", "given", "scope", "and", "flag", "redeclared", "ones", "." ]
bc0819c94aad14f7fad3cbc2338ea15658b0f272
https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/no-redeclare.js#L93-L123
train
Find variables in a given scope.
[ 30522, 3853, 2424, 10755, 19210, 11493, 26127, 1006, 9531, 1007, 1063, 2005, 1006, 9530, 3367, 8023, 1997, 9531, 1012, 10857, 1007, 1063, 9530, 3367, 1031, 8170, 1010, 1012, 1012, 1012, 4469, 3207, 20464, 25879, 8496, 1033, 1027, 2009, 1684...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
nhn/tui.editor
src/js/extensions/colorSyntax.js
initUI
function initUI(editor, preset) { const name = 'colorSyntax'; const className = 'tui-color'; const i18n = editor.i18n; const toolbar = editor.getUI().getToolbar(); const {usageStatistics} = editor.options; editor.eventManager.addEventType('colorButtonClicked'); toolbar.insertItem(3, { type: 'button', options: { name, className, event: 'colorButtonClicked', tooltip: i18n.get('Text color') } }); const colorSyntaxButtonIndex = toolbar.indexOfItem(name); const {$el: $button} = toolbar.getItem(colorSyntaxButtonIndex); const $colorPickerContainer = $('<div />'); const $buttonBar = $(`<button type="button" class="te-apply-button">${i18n.get('OK')}</button>`); const cpOptions = { container: $colorPickerContainer[0], usageStatistics }; if (preset) { cpOptions.preset = preset; } const colorPicker = ColorPicker.create(cpOptions); let selectedColor = colorPicker.getColor(); $colorPickerContainer.append($buttonBar); const popup = editor.getUI().createPopup({ header: false, title: false, content: $colorPickerContainer, className: 'tui-popup-color', $target: editor.getUI().getToolbar().$el, css: { 'width': 'auto', 'position': 'absolute' } }); editor.eventManager.listen('focus', () => { popup.hide(); }); editor.eventManager.listen('colorButtonClicked', () => { if (popup.isShow()) { popup.hide(); return; } const { offsetTop, offsetLeft } = $button.get(0); popup.$el.css({ top: offsetTop + $button.outerHeight(), left: offsetLeft }); colorPicker.slider.toggle(true); editor.eventManager.emit('closeAllPopup'); popup.show(); }); editor.eventManager.listen('closeAllPopup', () => { popup.hide(); }); editor.eventManager.listen('removeEditor', () => { colorPicker.off('selectColor'); popup.$el.find('.te-apply-button').off('click'); popup.remove(); }); colorPicker.on('selectColor', e => { selectedColor = e.color; if (e.origin === 'palette') { editor.exec('color', selectedColor); popup.hide(); } }); popup.$el.find('.te-apply-button').on('click', () => { editor.exec('color', selectedColor); }); }
javascript
function initUI(editor, preset) { const name = 'colorSyntax'; const className = 'tui-color'; const i18n = editor.i18n; const toolbar = editor.getUI().getToolbar(); const {usageStatistics} = editor.options; editor.eventManager.addEventType('colorButtonClicked'); toolbar.insertItem(3, { type: 'button', options: { name, className, event: 'colorButtonClicked', tooltip: i18n.get('Text color') } }); const colorSyntaxButtonIndex = toolbar.indexOfItem(name); const {$el: $button} = toolbar.getItem(colorSyntaxButtonIndex); const $colorPickerContainer = $('<div />'); const $buttonBar = $(`<button type="button" class="te-apply-button">${i18n.get('OK')}</button>`); const cpOptions = { container: $colorPickerContainer[0], usageStatistics }; if (preset) { cpOptions.preset = preset; } const colorPicker = ColorPicker.create(cpOptions); let selectedColor = colorPicker.getColor(); $colorPickerContainer.append($buttonBar); const popup = editor.getUI().createPopup({ header: false, title: false, content: $colorPickerContainer, className: 'tui-popup-color', $target: editor.getUI().getToolbar().$el, css: { 'width': 'auto', 'position': 'absolute' } }); editor.eventManager.listen('focus', () => { popup.hide(); }); editor.eventManager.listen('colorButtonClicked', () => { if (popup.isShow()) { popup.hide(); return; } const { offsetTop, offsetLeft } = $button.get(0); popup.$el.css({ top: offsetTop + $button.outerHeight(), left: offsetLeft }); colorPicker.slider.toggle(true); editor.eventManager.emit('closeAllPopup'); popup.show(); }); editor.eventManager.listen('closeAllPopup', () => { popup.hide(); }); editor.eventManager.listen('removeEditor', () => { colorPicker.off('selectColor'); popup.$el.find('.te-apply-button').off('click'); popup.remove(); }); colorPicker.on('selectColor', e => { selectedColor = e.color; if (e.origin === 'palette') { editor.exec('color', selectedColor); popup.hide(); } }); popup.$el.find('.te-apply-button').on('click', () => { editor.exec('color', selectedColor); }); }
[ "function", "initUI", "(", "editor", ",", "preset", ")", "{", "const", "name", "=", "'colorSyntax'", ";", "const", "className", "=", "'tui-color'", ";", "const", "i18n", "=", "editor", ".", "i18n", ";", "const", "toolbar", "=", "editor", ".", "getUI", "(...
Initialize UI @param {object} editor - Editor instance @param {Array.<string>} preset - Preset for color palette @ignore
[ "Initialize", "UI" ]
e75ab08c2a7ab07d1143e318f7cde135c5e3002e
https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/extensions/colorSyntax.js#L145-L244
train
Initialize the UI
[ 30522, 3853, 1999, 4183, 10179, 1006, 3559, 1010, 3653, 13462, 1007, 1063, 9530, 3367, 2171, 1027, 1005, 6087, 6038, 2696, 2595, 1005, 1025, 9530, 3367, 2465, 18442, 1027, 1005, 10722, 2072, 1011, 3609, 1005, 1025, 9530, 3367, 1045, 15136, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
GeekyAnts/vue-native-core
packages/weex-vue-framework/index.js
genModuleGetter
function genModuleGetter (instanceId) { var instance = instances[instanceId]; return function (name) { var nativeModule = modules[name] || []; var output = {}; var loop = function ( methodName ) { output[methodName] = function () { var args = [], len = arguments.length; while ( len-- ) args[ len ] = arguments[ len ]; var finalArgs = args.map(function (value) { return normalize(value, instance) }); renderer.sendTasks(instanceId + '', [{ module: name, method: methodName, args: finalArgs }], -1); }; }; for (var methodName in nativeModule) loop( methodName ); return output } }
javascript
function genModuleGetter (instanceId) { var instance = instances[instanceId]; return function (name) { var nativeModule = modules[name] || []; var output = {}; var loop = function ( methodName ) { output[methodName] = function () { var args = [], len = arguments.length; while ( len-- ) args[ len ] = arguments[ len ]; var finalArgs = args.map(function (value) { return normalize(value, instance) }); renderer.sendTasks(instanceId + '', [{ module: name, method: methodName, args: finalArgs }], -1); }; }; for (var methodName in nativeModule) loop( methodName ); return output } }
[ "function", "genModuleGetter", "(", "instanceId", ")", "{", "var", "instance", "=", "instances", "[", "instanceId", "]", ";", "return", "function", "(", "name", ")", "{", "var", "nativeModule", "=", "modules", "[", "name", "]", "||", "[", "]", ";", "var"...
Generate native module getter. Each native module has several methods to call. And all the behaviors is instance-related. So this getter will return a set of methods which additionally send current instance id to native when called. Also the args will be normalized into "safe" value. For example function arg will be converted into a callback id. @param {string} instanceId @return {function}
[ "Generate", "native", "module", "getter", ".", "Each", "native", "module", "has", "several", "methods", "to", "call", ".", "And", "all", "the", "behaviors", "is", "instance", "-", "related", ".", "So", "this", "getter", "will", "return", "a", "set", "of", ...
a7b4c9e35fe3f01d7576086f41e5e9ec6975b72e
https://github.com/GeekyAnts/vue-native-core/blob/a7b4c9e35fe3f01d7576086f41e5e9ec6975b72e/packages/weex-vue-framework/index.js#L323-L343
train
Generate a getter function for a module
[ 30522, 3853, 8991, 5302, 8566, 23115, 7585, 2099, 1006, 6013, 3593, 1007, 1063, 13075, 6013, 1027, 12107, 1031, 6013, 3593, 1033, 1025, 2709, 3853, 1006, 2171, 1007, 1063, 13075, 3128, 5302, 8566, 2571, 1027, 14184, 1031, 2171, 1033, 1064, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
eslint/eslint
lib/rules/max-params.js
checkFunction
function checkFunction(node) { if (node.params.length > numParams) { context.report({ loc: astUtils.getFunctionHeadLoc(node, sourceCode), node, messageId: "exceed", data: { name: lodash.upperFirst(astUtils.getFunctionNameWithKind(node)), count: node.params.length, max: numParams } }); } }
javascript
function checkFunction(node) { if (node.params.length > numParams) { context.report({ loc: astUtils.getFunctionHeadLoc(node, sourceCode), node, messageId: "exceed", data: { name: lodash.upperFirst(astUtils.getFunctionNameWithKind(node)), count: node.params.length, max: numParams } }); } }
[ "function", "checkFunction", "(", "node", ")", "{", "if", "(", "node", ".", "params", ".", "length", ">", "numParams", ")", "{", "context", ".", "report", "(", "{", "loc", ":", "astUtils", ".", "getFunctionHeadLoc", "(", "node", ",", "sourceCode", ")", ...
Checks a function to see if it has too many parameters. @param {ASTNode} node The node to check. @returns {void} @private
[ "Checks", "a", "function", "to", "see", "if", "it", "has", "too", "many", "parameters", "." ]
bc0819c94aad14f7fad3cbc2338ea15658b0f272
https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/max-params.js#L81-L94
train
Check if the number of parameters of a function is too large
[ 30522, 3853, 4638, 11263, 27989, 1006, 13045, 1007, 30524, 5244, 1007, 1063, 6123, 1012, 3189, 1006, 1063, 8840, 2278, 1024, 2004, 8525, 3775, 4877, 1012, 2131, 11263, 27989, 4974, 4135, 2278, 1006, 13045, 1010, 3120, 16044, 1007, 1010, 130...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
necolas/react-native-web
packages/react-native-web/src/vendor/react-native/PanResponder/index.js
function (gestureState, touchHistory) { gestureState.numberActiveTouches = touchHistory.numberActiveTouches; gestureState.moveX = currentCentroidXOfTouchesChangedAfter(touchHistory, gestureState._accountsForMovesUpTo); gestureState.moveY = currentCentroidYOfTouchesChangedAfter(touchHistory, gestureState._accountsForMovesUpTo); const movedAfter = gestureState._accountsForMovesUpTo; const prevX = previousCentroidXOfTouchesChangedAfter(touchHistory, movedAfter); const x = currentCentroidXOfTouchesChangedAfter(touchHistory, movedAfter); const prevY = previousCentroidYOfTouchesChangedAfter(touchHistory, movedAfter); const y = currentCentroidYOfTouchesChangedAfter(touchHistory, movedAfter); const nextDX = gestureState.dx + (x - prevX); const nextDY = gestureState.dy + (y - prevY); // TODO: This must be filtered intelligently. const dt = touchHistory.mostRecentTimeStamp - gestureState._accountsForMovesUpTo; gestureState.vx = (nextDX - gestureState.dx) / dt; gestureState.vy = (nextDY - gestureState.dy) / dt; gestureState.dx = nextDX; gestureState.dy = nextDY; gestureState._accountsForMovesUpTo = touchHistory.mostRecentTimeStamp; }
javascript
function (gestureState, touchHistory) { gestureState.numberActiveTouches = touchHistory.numberActiveTouches; gestureState.moveX = currentCentroidXOfTouchesChangedAfter(touchHistory, gestureState._accountsForMovesUpTo); gestureState.moveY = currentCentroidYOfTouchesChangedAfter(touchHistory, gestureState._accountsForMovesUpTo); const movedAfter = gestureState._accountsForMovesUpTo; const prevX = previousCentroidXOfTouchesChangedAfter(touchHistory, movedAfter); const x = currentCentroidXOfTouchesChangedAfter(touchHistory, movedAfter); const prevY = previousCentroidYOfTouchesChangedAfter(touchHistory, movedAfter); const y = currentCentroidYOfTouchesChangedAfter(touchHistory, movedAfter); const nextDX = gestureState.dx + (x - prevX); const nextDY = gestureState.dy + (y - prevY); // TODO: This must be filtered intelligently. const dt = touchHistory.mostRecentTimeStamp - gestureState._accountsForMovesUpTo; gestureState.vx = (nextDX - gestureState.dx) / dt; gestureState.vy = (nextDY - gestureState.dy) / dt; gestureState.dx = nextDX; gestureState.dy = nextDY; gestureState._accountsForMovesUpTo = touchHistory.mostRecentTimeStamp; }
[ "function", "(", "gestureState", ",", "touchHistory", ")", "{", "gestureState", ".", "numberActiveTouches", "=", "touchHistory", ".", "numberActiveTouches", ";", "gestureState", ".", "moveX", "=", "currentCentroidXOfTouchesChangedAfter", "(", "touchHistory", ",", "gestu...
This is nuanced and is necessary. It is incorrect to continuously take all active *and* recently moved touches, find the centroid, and track how that result changes over time. Instead, we must take all recently moved touches, and calculate how the centroid has changed just for those recently moved touches, and append that change to an accumulator. This is to (at least) handle the case where the user is moving three fingers, and then one of the fingers stops but the other two continue. This is very different than taking all of the recently moved touches and storing their centroid as `dx/dy`. For correctness, we must *accumulate changes* in the centroid of recently moved touches. There is also some nuance with how we handle multiple moved touches in a single event. With the way `ReactNativeEventEmitter` dispatches touches as individual events, multiple touches generate two 'move' events, each of them triggering `onResponderMove`. But with the way `PanResponder` works, all of the gesture inference is performed on the first dispatch, since it looks at all of the touches (even the ones for which there hasn't been a native dispatch yet). Therefore, `PanResponder` does not call `onResponderMove` passed the first dispatch. This diverges from the typical responder callback pattern (without using `PanResponder`), but avoids more dispatches than necessary.
[ "This", "is", "nuanced", "and", "is", "necessary", ".", "It", "is", "incorrect", "to", "continuously", "take", "all", "active", "*", "and", "*", "recently", "moved", "touches", "find", "the", "centroid", "and", "track", "how", "that", "result", "changes", ...
801937748b2f3c96284bee1881164ac0c62a9c6d
https://github.com/necolas/react-native-web/blob/801937748b2f3c96284bee1881164ac0c62a9c6d/packages/react-native-web/src/vendor/react-native/PanResponder/index.js#L219-L239
train
Update the gesture state based on the current touch history
[ 30522, 3853, 1006, 18327, 12259, 1010, 3543, 24158, 7062, 1007, 1063, 18327, 12259, 1012, 2193, 19620, 24826, 8376, 1027, 3543, 24158, 7062, 1012, 2193, 19620, 24826, 8376, 1025, 18327, 12259, 1012, 2693, 2595, 1027, 2783, 13013, 22943, 2595,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
ksky521/nodeppt
packages/nodeppt-parser/lib/markdown/regexp/index.js
Plugin
function Plugin(regexp, replacer, id) { // return value should be a callable function // with strictly defined options passed by markdown-it var self = function(md, options) { self.options = options; self.init(md); }; // initialize plugin object self.__proto__ = Plugin.prototype; // clone regexp with all the flags var flags = (regexp.global ? 'g' : '') + (regexp.multiline ? 'm' : '') + (regexp.ignoreCase ? 'i' : ''); self.regexp = RegExp('^' + regexp.source, flags); // copy init options self.replacer = replacer; // this plugin can be inserted multiple times, // so we're generating unique name for it self.id = id ? id : 'regexp-' + counter; counter++; return self; }
javascript
function Plugin(regexp, replacer, id) { // return value should be a callable function // with strictly defined options passed by markdown-it var self = function(md, options) { self.options = options; self.init(md); }; // initialize plugin object self.__proto__ = Plugin.prototype; // clone regexp with all the flags var flags = (regexp.global ? 'g' : '') + (regexp.multiline ? 'm' : '') + (regexp.ignoreCase ? 'i' : ''); self.regexp = RegExp('^' + regexp.source, flags); // copy init options self.replacer = replacer; // this plugin can be inserted multiple times, // so we're generating unique name for it self.id = id ? id : 'regexp-' + counter; counter++; return self; }
[ "function", "Plugin", "(", "regexp", ",", "replacer", ",", "id", ")", "{", "// return value should be a callable function", "// with strictly defined options passed by markdown-it", "var", "self", "=", "function", "(", "md", ",", "options", ")", "{", "self", ".", "opt...
Constructor function
[ "Constructor", "function" ]
ca77e29ef818c08b0522b31e3925b073cf159b9c
https://github.com/ksky521/nodeppt/blob/ca77e29ef818c08b0522b31e3925b073cf159b9c/packages/nodeppt-parser/lib/markdown/regexp/index.js#L29-L54
train
The plugin that will be used to replace the regexp with the new options
[ 30522, 3853, 13354, 2378, 1006, 19723, 10288, 2361, 1010, 5672, 2099, 1010, 8909, 1007, 1063, 1013, 1013, 2709, 3643, 2323, 2022, 1037, 2655, 3085, 3853, 1013, 1013, 2007, 9975, 4225, 7047, 2979, 2011, 2928, 7698, 1011, 2009, 13075, 2969, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
grpc/grpc-node
packages/grpc-native-core/src/client_interceptors.js
function(metadata, current_listener) { // If there is a next call in the chain, run it. Otherwise do nothing. if (self.next_call) { // Wire together any listener provided with the next listener var listener = _getInterceptingListener(current_listener, next_listener); self.next_call.start(metadata, listener); } }
javascript
function(metadata, current_listener) { // If there is a next call in the chain, run it. Otherwise do nothing. if (self.next_call) { // Wire together any listener provided with the next listener var listener = _getInterceptingListener(current_listener, next_listener); self.next_call.start(metadata, listener); } }
[ "function", "(", "metadata", ",", "current_listener", ")", "{", "// If there is a next call in the chain, run it. Otherwise do nothing.", "if", "(", "self", ".", "next_call", ")", "{", "// Wire together any listener provided with the next listener", "var", "listener", "=", "_ge...
Build the next method in the interceptor chain
[ "Build", "the", "next", "method", "in", "the", "interceptor", "chain" ]
b36b285f4cdb334bbd48f74c12c13bec69961488
https://github.com/grpc/grpc-node/blob/b36b285f4cdb334bbd48f74c12c13bec69961488/packages/grpc-native-core/src/client_interceptors.js#L448-L455
train
Starts the next call in the chain
[ 30522, 3853, 1006, 27425, 1010, 2783, 1035, 19373, 1007, 1063, 1013, 1013, 2065, 2045, 2003, 1037, 2279, 2655, 1999, 1996, 4677, 1010, 2448, 2009, 1012, 4728, 2079, 2498, 1012, 2065, 1006, 2969, 1012, 2279, 1035, 2655, 1007, 1063, 1013, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
dequelabs/axe-core
lib/checks/label/label-content-name-mismatch.js
curateString
function curateString(str) { const noUnicodeStr = text.removeUnicode(str, { emoji: true, nonBmp: true, punctuations: true }); return text.sanitize(noUnicodeStr); }
javascript
function curateString(str) { const noUnicodeStr = text.removeUnicode(str, { emoji: true, nonBmp: true, punctuations: true }); return text.sanitize(noUnicodeStr); }
[ "function", "curateString", "(", "str", ")", "{", "const", "noUnicodeStr", "=", "text", ".", "removeUnicode", "(", "str", ",", "{", "emoji", ":", "true", ",", "nonBmp", ":", "true", ",", "punctuations", ":", "true", "}", ")", ";", "return", "text", "."...
Curate given text, by removing emoji's, punctuations, unicode and trim whitespace. @param {String} str given text to curate @returns {String}
[ "Curate", "given", "text", "by", "removing", "emoji", "s", "punctuations", "unicode", "and", "trim", "whitespace", "." ]
727323c07980e2291575f545444d389fb942906f
https://github.com/dequelabs/axe-core/blob/727323c07980e2291575f545444d389fb942906f/lib/checks/label/label-content-name-mismatch.js#L42-L49
train
Curates a string.
[ 30522, 3853, 27530, 3367, 4892, 1006, 2358, 2099, 1007, 1063, 9530, 3367, 15156, 11261, 6155, 16344, 1027, 3793, 1012, 6366, 19496, 16044, 1006, 2358, 2099, 1010, 1063, 7861, 29147, 2072, 1024, 2995, 1010, 2512, 25526, 2361, 1024, 2995, 101...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.core/src/sap/ui/core/LocaleData.js
function(sStyle, sNumber, sPlural) { var sFormat; var oFormats; switch (sStyle) { case "long": oFormats = this._get("decimalFormat-long"); break; default: //short oFormats = this._get("decimalFormat-short"); break; } if (oFormats) { var sName = sNumber + "-" + sPlural; sFormat = oFormats[sName]; if (!sFormat) { sName = sNumber + "-other"; sFormat = oFormats[sName]; } } return sFormat; }
javascript
function(sStyle, sNumber, sPlural) { var sFormat; var oFormats; switch (sStyle) { case "long": oFormats = this._get("decimalFormat-long"); break; default: //short oFormats = this._get("decimalFormat-short"); break; } if (oFormats) { var sName = sNumber + "-" + sPlural; sFormat = oFormats[sName]; if (!sFormat) { sName = sNumber + "-other"; sFormat = oFormats[sName]; } } return sFormat; }
[ "function", "(", "sStyle", ",", "sNumber", ",", "sPlural", ")", "{", "var", "sFormat", ";", "var", "oFormats", ";", "switch", "(", "sStyle", ")", "{", "case", "\"long\"", ":", "oFormats", "=", "this", ".", "_get", "(", "\"decimalFormat-long\"", ")", ";",...
Returns the short decimal formats (like 1K, 1M....). @param {string} sStyle short or long @param {string} sNumber 1000, 10000 ... @param {string} sPlural one or other (if not exists other is used) @returns {string} decimal format @public @since 1.25.0
[ "Returns", "the", "short", "decimal", "formats", "(", "like", "1K", "1M", "....", ")", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/LocaleData.js#L1319-L1345
train
Returns the format for the given number and plural.
[ 30522, 3853, 1006, 7020, 27983, 1010, 1055, 19172, 5677, 1010, 11867, 7630, 7941, 1007, 1063, 13075, 16420, 2953, 18900, 1025, 13075, 1997, 2953, 18900, 2015, 1025, 6942, 1006, 7020, 27983, 1007, 1063, 2553, 1000, 2146, 1000, 1024, 1997, 29...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
eslint/eslint
lib/util/naming.js
normalizePackageName
function normalizePackageName(name, prefix) { let normalizedName = name; /** * On Windows, name can come in with Windows slashes instead of Unix slashes. * Normalize to Unix first to avoid errors later on. * https://github.com/eslint/eslint/issues/5644 */ if (normalizedName.indexOf("\\") > -1) { normalizedName = pathUtils.convertPathToPosix(normalizedName); } if (normalizedName.charAt(0) === "@") { /** * it's a scoped package * package name is the prefix, or just a username */ const scopedPackageShortcutRegex = new RegExp(`^(@[^/]+)(?:/(?:${prefix})?)?$`, "u"), scopedPackageNameRegex = new RegExp(`^${prefix}(-|$)`, "u"); if (scopedPackageShortcutRegex.test(normalizedName)) { normalizedName = normalizedName.replace(scopedPackageShortcutRegex, `$1/${prefix}`); } else if (!scopedPackageNameRegex.test(normalizedName.split("/")[1])) { /** * for scoped packages, insert the prefix after the first / unless * the path is already @scope/eslint or @scope/eslint-xxx-yyy */ normalizedName = normalizedName.replace(/^@([^/]+)\/(.*)$/u, `@$1/${prefix}-$2`); } } else if (normalizedName.indexOf(`${prefix}-`) !== 0) { normalizedName = `${prefix}-${normalizedName}`; } return normalizedName; }
javascript
function normalizePackageName(name, prefix) { let normalizedName = name; /** * On Windows, name can come in with Windows slashes instead of Unix slashes. * Normalize to Unix first to avoid errors later on. * https://github.com/eslint/eslint/issues/5644 */ if (normalizedName.indexOf("\\") > -1) { normalizedName = pathUtils.convertPathToPosix(normalizedName); } if (normalizedName.charAt(0) === "@") { /** * it's a scoped package * package name is the prefix, or just a username */ const scopedPackageShortcutRegex = new RegExp(`^(@[^/]+)(?:/(?:${prefix})?)?$`, "u"), scopedPackageNameRegex = new RegExp(`^${prefix}(-|$)`, "u"); if (scopedPackageShortcutRegex.test(normalizedName)) { normalizedName = normalizedName.replace(scopedPackageShortcutRegex, `$1/${prefix}`); } else if (!scopedPackageNameRegex.test(normalizedName.split("/")[1])) { /** * for scoped packages, insert the prefix after the first / unless * the path is already @scope/eslint or @scope/eslint-xxx-yyy */ normalizedName = normalizedName.replace(/^@([^/]+)\/(.*)$/u, `@$1/${prefix}-$2`); } } else if (normalizedName.indexOf(`${prefix}-`) !== 0) { normalizedName = `${prefix}-${normalizedName}`; } return normalizedName; }
[ "function", "normalizePackageName", "(", "name", ",", "prefix", ")", "{", "let", "normalizedName", "=", "name", ";", "/**\n * On Windows, name can come in with Windows slashes instead of Unix slashes.\n * Normalize to Unix first to avoid errors later on.\n * https://github.com/...
Brings package name to correct format based on prefix @param {string} name The name of the package. @param {string} prefix Can be either "eslint-plugin", "eslint-config" or "eslint-formatter" @returns {string} Normalized name of the package @private
[ "Brings", "package", "name", "to", "correct", "format", "based", "on", "prefix" ]
bc0819c94aad14f7fad3cbc2338ea15658b0f272
https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/util/naming.js#L25-L61
train
Normalize a package name
[ 30522, 3853, 3671, 4697, 23947, 4270, 18442, 1006, 2171, 1010, 17576, 1007, 1063, 2292, 3671, 3550, 18442, 1027, 2171, 1025, 1013, 1008, 1008, 1008, 2006, 3645, 1010, 2171, 2064, 2272, 1999, 2007, 3645, 18296, 2229, 2612, 1997, 19998, 18296...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
angular/material
src/core/services/layout/layout.js
registerLayoutAPI
function registerLayoutAPI(module){ var PREFIX_REGEXP = /^((?:x|data)[:\-_])/i; var SPECIAL_CHARS_REGEXP = /([:\-_]+(.))/g; // NOTE: these are also defined in constants::MEDIA_PRIORITY and constants::MEDIA var BREAKPOINTS = ["", "xs", "gt-xs", "sm", "gt-sm", "md", "gt-md", "lg", "gt-lg", "xl", "print"]; var API_WITH_VALUES = ["layout", "flex", "flex-order", "flex-offset", "layout-align"]; var API_NO_VALUES = ["show", "hide", "layout-padding", "layout-margin"]; // Build directive registration functions for the standard Layout API... for all breakpoints. angular.forEach(BREAKPOINTS, function(mqb) { // Attribute directives with expected, observable value(s) angular.forEach(API_WITH_VALUES, function(name){ var fullName = mqb ? name + "-" + mqb : name; module.directive(directiveNormalize(fullName), attributeWithObserve(fullName)); }); // Attribute directives with no expected value(s) angular.forEach(API_NO_VALUES, function(name){ var fullName = mqb ? name + "-" + mqb : name; module.directive(directiveNormalize(fullName), attributeWithoutValue(fullName)); }); }); // Register other, special directive functions for the Layout features: module .provider('$$mdLayout' , function() { // Publish internal service for Layouts return { $get : angular.noop, validateAttributeValue : validateAttributeValue, validateAttributeUsage : validateAttributeUsage, /** * Easy way to disable/enable the Layout API. * When disabled, this stops all attribute-to-classname generations */ disableLayouts : function(isDisabled) { config.enabled = (isDisabled !== true); } }; }) .directive('mdLayoutCss' , disableLayoutDirective) .directive('ngCloak' , buildCloakInterceptor('ng-cloak')) .directive('layoutWrap' , attributeWithoutValue('layout-wrap')) .directive('layoutNowrap' , attributeWithoutValue('layout-nowrap')) .directive('layoutNoWrap' , attributeWithoutValue('layout-no-wrap')) .directive('layoutFill' , attributeWithoutValue('layout-fill')) // !! Deprecated attributes: use the `-lt` (aka less-than) notations .directive('layoutLtMd' , warnAttrNotSupported('layout-lt-md', true)) .directive('layoutLtLg' , warnAttrNotSupported('layout-lt-lg', true)) .directive('flexLtMd' , warnAttrNotSupported('flex-lt-md', true)) .directive('flexLtLg' , warnAttrNotSupported('flex-lt-lg', true)) .directive('layoutAlignLtMd', warnAttrNotSupported('layout-align-lt-md')) .directive('layoutAlignLtLg', warnAttrNotSupported('layout-align-lt-lg')) .directive('flexOrderLtMd' , warnAttrNotSupported('flex-order-lt-md')) .directive('flexOrderLtLg' , warnAttrNotSupported('flex-order-lt-lg')) .directive('offsetLtMd' , warnAttrNotSupported('flex-offset-lt-md')) .directive('offsetLtLg' , warnAttrNotSupported('flex-offset-lt-lg')) .directive('hideLtMd' , warnAttrNotSupported('hide-lt-md')) .directive('hideLtLg' , warnAttrNotSupported('hide-lt-lg')) .directive('showLtMd' , warnAttrNotSupported('show-lt-md')) .directive('showLtLg' , warnAttrNotSupported('show-lt-lg')) // Determine if .config(detectDisabledLayouts); /** * Converts snake_case to camelCase. * Also there is special case for Moz prefix starting with upper case letter. * @param name Name to normalize */ function directiveNormalize(name) { return name .replace(PREFIX_REGEXP, '') .replace(SPECIAL_CHARS_REGEXP, function(_, separator, letter, offset) { return offset ? letter.toUpperCase() : letter; }); } }
javascript
function registerLayoutAPI(module){ var PREFIX_REGEXP = /^((?:x|data)[:\-_])/i; var SPECIAL_CHARS_REGEXP = /([:\-_]+(.))/g; // NOTE: these are also defined in constants::MEDIA_PRIORITY and constants::MEDIA var BREAKPOINTS = ["", "xs", "gt-xs", "sm", "gt-sm", "md", "gt-md", "lg", "gt-lg", "xl", "print"]; var API_WITH_VALUES = ["layout", "flex", "flex-order", "flex-offset", "layout-align"]; var API_NO_VALUES = ["show", "hide", "layout-padding", "layout-margin"]; // Build directive registration functions for the standard Layout API... for all breakpoints. angular.forEach(BREAKPOINTS, function(mqb) { // Attribute directives with expected, observable value(s) angular.forEach(API_WITH_VALUES, function(name){ var fullName = mqb ? name + "-" + mqb : name; module.directive(directiveNormalize(fullName), attributeWithObserve(fullName)); }); // Attribute directives with no expected value(s) angular.forEach(API_NO_VALUES, function(name){ var fullName = mqb ? name + "-" + mqb : name; module.directive(directiveNormalize(fullName), attributeWithoutValue(fullName)); }); }); // Register other, special directive functions for the Layout features: module .provider('$$mdLayout' , function() { // Publish internal service for Layouts return { $get : angular.noop, validateAttributeValue : validateAttributeValue, validateAttributeUsage : validateAttributeUsage, /** * Easy way to disable/enable the Layout API. * When disabled, this stops all attribute-to-classname generations */ disableLayouts : function(isDisabled) { config.enabled = (isDisabled !== true); } }; }) .directive('mdLayoutCss' , disableLayoutDirective) .directive('ngCloak' , buildCloakInterceptor('ng-cloak')) .directive('layoutWrap' , attributeWithoutValue('layout-wrap')) .directive('layoutNowrap' , attributeWithoutValue('layout-nowrap')) .directive('layoutNoWrap' , attributeWithoutValue('layout-no-wrap')) .directive('layoutFill' , attributeWithoutValue('layout-fill')) // !! Deprecated attributes: use the `-lt` (aka less-than) notations .directive('layoutLtMd' , warnAttrNotSupported('layout-lt-md', true)) .directive('layoutLtLg' , warnAttrNotSupported('layout-lt-lg', true)) .directive('flexLtMd' , warnAttrNotSupported('flex-lt-md', true)) .directive('flexLtLg' , warnAttrNotSupported('flex-lt-lg', true)) .directive('layoutAlignLtMd', warnAttrNotSupported('layout-align-lt-md')) .directive('layoutAlignLtLg', warnAttrNotSupported('layout-align-lt-lg')) .directive('flexOrderLtMd' , warnAttrNotSupported('flex-order-lt-md')) .directive('flexOrderLtLg' , warnAttrNotSupported('flex-order-lt-lg')) .directive('offsetLtMd' , warnAttrNotSupported('flex-offset-lt-md')) .directive('offsetLtLg' , warnAttrNotSupported('flex-offset-lt-lg')) .directive('hideLtMd' , warnAttrNotSupported('hide-lt-md')) .directive('hideLtLg' , warnAttrNotSupported('hide-lt-lg')) .directive('showLtMd' , warnAttrNotSupported('show-lt-md')) .directive('showLtLg' , warnAttrNotSupported('show-lt-lg')) // Determine if .config(detectDisabledLayouts); /** * Converts snake_case to camelCase. * Also there is special case for Moz prefix starting with upper case letter. * @param name Name to normalize */ function directiveNormalize(name) { return name .replace(PREFIX_REGEXP, '') .replace(SPECIAL_CHARS_REGEXP, function(_, separator, letter, offset) { return offset ? letter.toUpperCase() : letter; }); } }
[ "function", "registerLayoutAPI", "(", "module", ")", "{", "var", "PREFIX_REGEXP", "=", "/", "^((?:x|data)[:\\-_])", "/", "i", ";", "var", "SPECIAL_CHARS_REGEXP", "=", "/", "([:\\-_]+(.))", "/", "g", ";", "// NOTE: these are also defined in constants::MEDIA_PRIORITY and co...
registerLayoutAPI() The original AngularJS Material Layout solution used attribute selectors and CSS. ```html <div layout="column"> My Content </div> ``` ```css [layout] { box-sizing: border-box; display:flex; } [layout=column] { flex-direction : column } ``` Use of attribute selectors creates significant performance impacts in some browsers... mainly IE. This module registers directives that allow the same layout attributes to be interpreted and converted to class selectors. The directive will add equivalent classes to each element that contains a Layout directive. ```html <div layout="column" class="layout layout-column"> My Content </div> ``` ```css .layout { box-sizing: border-box; display:flex; } .layout-column { flex-direction : column } ```
[ "registerLayoutAPI", "()" ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/core/services/layout/layout.js#L75-L164
train
Register Layout API
[ 30522, 3853, 4236, 8485, 5833, 9331, 2072, 1006, 11336, 1007, 1063, 13075, 17576, 1035, 19723, 10288, 2361, 1027, 1013, 1034, 1006, 1006, 1029, 1024, 1060, 1064, 2951, 1007, 1031, 1024, 1032, 1011, 1035, 1033, 1007, 1013, 1045, 1025, 13075,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
GitbookIO/gitbook
lib/plugins/listBlocks.js
listBlocks
function listBlocks(plugins) { return plugins .reverse() .reduce(function(result, plugin) { var blocks = plugin.getBlocks(); return result.merge(blocks); }, Immutable.Map()); }
javascript
function listBlocks(plugins) { return plugins .reverse() .reduce(function(result, plugin) { var blocks = plugin.getBlocks(); return result.merge(blocks); }, Immutable.Map()); }
[ "function", "listBlocks", "(", "plugins", ")", "{", "return", "plugins", ".", "reverse", "(", ")", ".", "reduce", "(", "function", "(", "result", ",", "plugin", ")", "{", "var", "blocks", "=", "plugin", ".", "getBlocks", "(", ")", ";", "return", "resul...
List blocks from a list of plugins @param {OrderedMap<String:Plugin>} @return {Map<String:TemplateBlock>}
[ "List", "blocks", "from", "a", "list", "of", "plugins" ]
6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4
https://github.com/GitbookIO/gitbook/blob/6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4/lib/plugins/listBlocks.js#L9-L16
train
List all blocks in the plugin
[ 30522, 3853, 2862, 23467, 2015, 1006, 13354, 7076, 1007, 1063, 2709, 13354, 7076, 1012, 7901, 1006, 1007, 1012, 5547, 1006, 3853, 1006, 2765, 1010, 13354, 2378, 1007, 1063, 13075, 5991, 1027, 13354, 2378, 1012, 2131, 23467, 2015, 1006, 1007...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
angular/angular
tools/gulp-tasks/cldr/extract.js
getDayPeriodRules
function getDayPeriodRules(localeData) { const dayPeriodRules = localeData.get(`supplemental/dayPeriodRuleSet/${localeData.attributes.language}`); const rules = {}; if (dayPeriodRules) { Object.keys(dayPeriodRules).forEach(key => { if (dayPeriodRules[key]._at) { rules[key] = dayPeriodRules[key]._at; } else { rules[key] = [dayPeriodRules[key]._from, dayPeriodRules[key]._before]; } }); } return rules; }
javascript
function getDayPeriodRules(localeData) { const dayPeriodRules = localeData.get(`supplemental/dayPeriodRuleSet/${localeData.attributes.language}`); const rules = {}; if (dayPeriodRules) { Object.keys(dayPeriodRules).forEach(key => { if (dayPeriodRules[key]._at) { rules[key] = dayPeriodRules[key]._at; } else { rules[key] = [dayPeriodRules[key]._from, dayPeriodRules[key]._before]; } }); } return rules; }
[ "function", "getDayPeriodRules", "(", "localeData", ")", "{", "const", "dayPeriodRules", "=", "localeData", ".", "get", "(", "`", "${", "localeData", ".", "attributes", ".", "language", "}", "`", ")", ";", "const", "rules", "=", "{", "}", ";", "if", "(",...
Returns day period rules for a locale @returns string[]
[ "Returns", "day", "period", "rules", "for", "a", "locale" ]
c016e2c4ecf7529f08fae4ca0f5c8b0170c6b51c
https://github.com/angular/angular/blob/c016e2c4ecf7529f08fae4ca0f5c8b0170c6b51c/tools/gulp-tasks/cldr/extract.js#L374-L388
train
Get day period rules
[ 30522, 3853, 2131, 10259, 4842, 3695, 13626, 16308, 1006, 2334, 11960, 2696, 1007, 1063, 9530, 3367, 2154, 4842, 3695, 13626, 16308, 1027, 2334, 11960, 2696, 1012, 2131, 1006, 1036, 27024, 1013, 2154, 4842, 3695, 13626, 16308, 3388, 1013, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.documentation/src/sap/ui/documentation/sdk/controller/util/IndexWorker.js
fetchIndex
function fetchIndex() { return new Promise(function(resolve, reject) { var oIndex = oIndexCache["index"], oSerializedIndex; if (oIndex) { resolve(oIndex); return; } var req = new XMLHttpRequest(), onload = function (oEvent) { oSerializedIndex = oEvent.target.response || oEvent.target.responseText; if (typeof oSerializedIndex !== 'object') { // fallback in case the browser does not support automatic JSON parsing oSerializedIndex = JSON.parse(oSerializedIndex); } oSerializedIndex = decompressIndex(oSerializedIndex); overrideLunrTokenizer(); oIndex = lunr.Index.load(oSerializedIndex.lunr); oIndexCache["index"] = oIndex; oIndexCache["docs"] = oSerializedIndex.docs; resolve(oIndex); }; if (!bIsMsieBrowser) { // IE does not support 'json' responseType // (and will throw an error if we attempt to set it nevertheless) req.responseType = 'json'; } req.addEventListener("load", onload, false); req.open("get", URL.SEARCH_INDEX); req.send(); }); }
javascript
function fetchIndex() { return new Promise(function(resolve, reject) { var oIndex = oIndexCache["index"], oSerializedIndex; if (oIndex) { resolve(oIndex); return; } var req = new XMLHttpRequest(), onload = function (oEvent) { oSerializedIndex = oEvent.target.response || oEvent.target.responseText; if (typeof oSerializedIndex !== 'object') { // fallback in case the browser does not support automatic JSON parsing oSerializedIndex = JSON.parse(oSerializedIndex); } oSerializedIndex = decompressIndex(oSerializedIndex); overrideLunrTokenizer(); oIndex = lunr.Index.load(oSerializedIndex.lunr); oIndexCache["index"] = oIndex; oIndexCache["docs"] = oSerializedIndex.docs; resolve(oIndex); }; if (!bIsMsieBrowser) { // IE does not support 'json' responseType // (and will throw an error if we attempt to set it nevertheless) req.responseType = 'json'; } req.addEventListener("load", onload, false); req.open("get", URL.SEARCH_INDEX); req.send(); }); }
[ "function", "fetchIndex", "(", ")", "{", "return", "new", "Promise", "(", "function", "(", "resolve", ",", "reject", ")", "{", "var", "oIndex", "=", "oIndexCache", "[", "\"index\"", "]", ",", "oSerializedIndex", ";", "if", "(", "oIndex", ")", "{", "resol...
Obtains the index via network request or from cache @returns {Promise<any>}
[ "Obtains", "the", "index", "via", "network", "request", "or", "from", "cache" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.documentation/src/sap/ui/documentation/sdk/controller/util/IndexWorker.js#L106-L149
train
Fetch the index from the server
[ 30522, 3853, 18584, 22254, 10288, 1006, 1007, 1063, 2709, 2047, 4872, 1006, 3853, 1006, 10663, 1010, 15454, 1007, 1063, 13075, 1051, 22254, 10288, 1027, 1051, 22254, 10288, 3540, 5403, 1031, 1000, 5950, 1000, 1033, 1010, 9808, 11610, 28931, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
angular/material
src/components/sticky/sticky.js
add
function add(element, stickyClone) { stickyClone.addClass('md-sticky-clone'); var item = { element: element, clone: stickyClone }; self.items.push(item); $mdUtil.nextTick(function() { contentEl.prepend(item.clone); }); debouncedRefreshElements(); return function remove() { self.items.forEach(function(item, index) { if (item.element[0] === element[0]) { self.items.splice(index, 1); item.clone.remove(); } }); debouncedRefreshElements(); }; }
javascript
function add(element, stickyClone) { stickyClone.addClass('md-sticky-clone'); var item = { element: element, clone: stickyClone }; self.items.push(item); $mdUtil.nextTick(function() { contentEl.prepend(item.clone); }); debouncedRefreshElements(); return function remove() { self.items.forEach(function(item, index) { if (item.element[0] === element[0]) { self.items.splice(index, 1); item.clone.remove(); } }); debouncedRefreshElements(); }; }
[ "function", "add", "(", "element", ",", "stickyClone", ")", "{", "stickyClone", ".", "addClass", "(", "'md-sticky-clone'", ")", ";", "var", "item", "=", "{", "element", ":", "element", ",", "clone", ":", "stickyClone", "}", ";", "self", ".", "items", "."...
************* Public ************* Add an element and its sticky clone to this content's sticky collection
[ "*************", "Public", "*************", "Add", "an", "element", "and", "its", "sticky", "clone", "to", "this", "content", "s", "sticky", "collection" ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/sticky/sticky.js#L133-L157
train
Adds a sticky clone to the content element
[ 30522, 3853, 5587, 1006, 5783, 1010, 15875, 20464, 5643, 1007, 1063, 15875, 20464, 5643, 1012, 5587, 26266, 1006, 1005, 9108, 1011, 15875, 1011, 17598, 1005, 1007, 1025, 13075, 8875, 1027, 1063, 5783, 1024, 5783, 1010, 17598, 1024, 15875, 2...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
nhn/tui.editor
src/js/extensions/mark/mark.js
markExtension
function markExtension(editor) { const ml = new MarkerList(); const mm = new MarkerManager(ml); let wmh, mmh, vmh; editor.eventManager.addEventType('markerUpdated'); if (editor.isViewer()) { vmh = new ViewerMarkerHelper(editor.preview); } else { wmh = new WysiwygMarkerHelper(editor.getSquire()); mmh = new MarkdownMarkerHelper(editor.getCodeMirror()); } /** * getHelper * Get helper for current situation * @returns {object} helper */ function getHelper() { let helper; if (editor.isViewer()) { helper = vmh; } else if (editor.isWysiwygMode()) { helper = wmh; } else { helper = mmh; } return helper; } /** * Update mark when resizing */ function updateMarkWhenResizing() { const helper = getHelper(); ml.getAll().forEach(marker => { helper.updateMarkerWithExtraInfo(marker); }); editor.eventManager.emit('markerUpdated', ml.getAll()); } // We need to update marker after window have been resized $(window).on('resize', updateMarkWhenResizing); editor.on('removeEditor', () => { $(window).off('resize', updateMarkWhenResizing); }); // Reset marker content after set value editor.on('setMarkdownAfter', () => { const helper = getHelper(); mm.resetContent(helper.getTextContent()); }); /** * setValueWithMarkers * Set value with markers * @param {string} value markdown content * @param {object} markerDataCollection marker data that obtain with exportMarkers method * @returns {Array.<object>} markers */ editor.setValueWithMarkers = (value, markerDataCollection) => { let helper; ml.resetMarkers(); markerDataCollection.forEach(markerData => { ml.addMarker(markerData.start, markerData.end, markerData.id); }); editor.setValue(value); mm.resetContent(value.replace(FIND_CRLF_RX, '')); if (editor.isViewer() || editor.isWysiwygMode()) { helper = getHelper(); mm.updateMarkersByContent(helper.getTextContent()); } else { helper = mmh; } ml.getAll().forEach(marker => { helper.updateMarkerWithExtraInfo(marker); }); editor.eventManager.emit('markerUpdated', ml.getAll()); return ml.getAll(); }; /** * getMarker * Get markers that have given id * @param {string} id id of marker * @returns {object} */ editor.getMarker = id => ml.getMarker(id); /** * getMarkersAll * Get all markers * @returns {Array.<object>} */ editor.getMarkersAll = () => ml.getAll(); /** * removeMarker * Remove marker with given id * @param {string} id of marker that should be removed * @returns {marker} removed marker */ editor.removeMarker = id => ml.removeMarker(id); /** * getMarkersData * Get marker data to export so you can restore markers next time * @returns {object} markers data */ editor.exportMarkers = () => { let markersData; if (editor.isMarkdownMode()) { markersData = ml.getMarkersData(); } else if (editor.isViewer() || editor.isWysiwygMode()) { mm.updateMarkersByContent(editor.getValue().replace(FIND_CRLF_RX, '')); markersData = ml.getMarkersData(); mm.updateMarkersByContent(getHelper().getTextContent()); } return markersData; }; /** * selectMarker * Make selection with marker that have given id * @param {string} id id of marker */ editor.selectMarker = id => { const helper = getHelper(); const marker = editor.getMarker(id); if (marker) { helper.selectOffsetRange(marker.start, marker.end); } }; /** * addMarker * Add Marker with given id * if you pass just id then it uses current selection for marker * or you can pass start and end offset for marker * @param {number|string} start start offset or id * @param {number} end end offset * @param {string} id id of marker * @returns {object} marker that have made */ editor.addMarker = (start, end, id) => { let marker; const helper = getHelper(); if (!id) { id = start; marker = helper.getMarkerInfoOfCurrentSelection(); } else { marker = { start, end }; marker = helper.updateMarkerWithExtraInfo(marker); } if (marker) { marker.id = id; marker = ml.addMarker(marker); ml.sortBy('end'); editor.eventManager.emit('markerUpdated', [marker]); } return marker; }; /** * clearSelect * Clear selection */ editor.clearSelect = () => { getHelper().clearSelect(); }; if (!editor.isViewer()) { editor.on('changeMode', () => { editor._updateMarkers(); }); editor.on('change', util.debounce(() => { editor._updateMarkers(); }, MARKER_UPDATE_DELAY)); /** * _updateMarkers * Update markers with current text content */ editor._updateMarkers = () => { const helper = getHelper(); if (!ml.getAll().length) { return; } mm.updateMarkersByContent(helper.getTextContent()); ml.getAll().forEach(marker => { helper.updateMarkerWithExtraInfo(marker); }); editor.eventManager.emit('markerUpdated', ml.getAll()); }; } }
javascript
function markExtension(editor) { const ml = new MarkerList(); const mm = new MarkerManager(ml); let wmh, mmh, vmh; editor.eventManager.addEventType('markerUpdated'); if (editor.isViewer()) { vmh = new ViewerMarkerHelper(editor.preview); } else { wmh = new WysiwygMarkerHelper(editor.getSquire()); mmh = new MarkdownMarkerHelper(editor.getCodeMirror()); } /** * getHelper * Get helper for current situation * @returns {object} helper */ function getHelper() { let helper; if (editor.isViewer()) { helper = vmh; } else if (editor.isWysiwygMode()) { helper = wmh; } else { helper = mmh; } return helper; } /** * Update mark when resizing */ function updateMarkWhenResizing() { const helper = getHelper(); ml.getAll().forEach(marker => { helper.updateMarkerWithExtraInfo(marker); }); editor.eventManager.emit('markerUpdated', ml.getAll()); } // We need to update marker after window have been resized $(window).on('resize', updateMarkWhenResizing); editor.on('removeEditor', () => { $(window).off('resize', updateMarkWhenResizing); }); // Reset marker content after set value editor.on('setMarkdownAfter', () => { const helper = getHelper(); mm.resetContent(helper.getTextContent()); }); /** * setValueWithMarkers * Set value with markers * @param {string} value markdown content * @param {object} markerDataCollection marker data that obtain with exportMarkers method * @returns {Array.<object>} markers */ editor.setValueWithMarkers = (value, markerDataCollection) => { let helper; ml.resetMarkers(); markerDataCollection.forEach(markerData => { ml.addMarker(markerData.start, markerData.end, markerData.id); }); editor.setValue(value); mm.resetContent(value.replace(FIND_CRLF_RX, '')); if (editor.isViewer() || editor.isWysiwygMode()) { helper = getHelper(); mm.updateMarkersByContent(helper.getTextContent()); } else { helper = mmh; } ml.getAll().forEach(marker => { helper.updateMarkerWithExtraInfo(marker); }); editor.eventManager.emit('markerUpdated', ml.getAll()); return ml.getAll(); }; /** * getMarker * Get markers that have given id * @param {string} id id of marker * @returns {object} */ editor.getMarker = id => ml.getMarker(id); /** * getMarkersAll * Get all markers * @returns {Array.<object>} */ editor.getMarkersAll = () => ml.getAll(); /** * removeMarker * Remove marker with given id * @param {string} id of marker that should be removed * @returns {marker} removed marker */ editor.removeMarker = id => ml.removeMarker(id); /** * getMarkersData * Get marker data to export so you can restore markers next time * @returns {object} markers data */ editor.exportMarkers = () => { let markersData; if (editor.isMarkdownMode()) { markersData = ml.getMarkersData(); } else if (editor.isViewer() || editor.isWysiwygMode()) { mm.updateMarkersByContent(editor.getValue().replace(FIND_CRLF_RX, '')); markersData = ml.getMarkersData(); mm.updateMarkersByContent(getHelper().getTextContent()); } return markersData; }; /** * selectMarker * Make selection with marker that have given id * @param {string} id id of marker */ editor.selectMarker = id => { const helper = getHelper(); const marker = editor.getMarker(id); if (marker) { helper.selectOffsetRange(marker.start, marker.end); } }; /** * addMarker * Add Marker with given id * if you pass just id then it uses current selection for marker * or you can pass start and end offset for marker * @param {number|string} start start offset or id * @param {number} end end offset * @param {string} id id of marker * @returns {object} marker that have made */ editor.addMarker = (start, end, id) => { let marker; const helper = getHelper(); if (!id) { id = start; marker = helper.getMarkerInfoOfCurrentSelection(); } else { marker = { start, end }; marker = helper.updateMarkerWithExtraInfo(marker); } if (marker) { marker.id = id; marker = ml.addMarker(marker); ml.sortBy('end'); editor.eventManager.emit('markerUpdated', [marker]); } return marker; }; /** * clearSelect * Clear selection */ editor.clearSelect = () => { getHelper().clearSelect(); }; if (!editor.isViewer()) { editor.on('changeMode', () => { editor._updateMarkers(); }); editor.on('change', util.debounce(() => { editor._updateMarkers(); }, MARKER_UPDATE_DELAY)); /** * _updateMarkers * Update markers with current text content */ editor._updateMarkers = () => { const helper = getHelper(); if (!ml.getAll().length) { return; } mm.updateMarkersByContent(helper.getTextContent()); ml.getAll().forEach(marker => { helper.updateMarkerWithExtraInfo(marker); }); editor.eventManager.emit('markerUpdated', ml.getAll()); }; } }
[ "function", "markExtension", "(", "editor", ")", "{", "const", "ml", "=", "new", "MarkerList", "(", ")", ";", "const", "mm", "=", "new", "MarkerManager", "(", "ml", ")", ";", "let", "wmh", ",", "mmh", ",", "vmh", ";", "editor", ".", "eventManager", "...
mark extension @param {Editor} editor - editor instance @ignore
[ "mark", "extension" ]
e75ab08c2a7ab07d1143e318f7cde135c5e3002e
https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/extensions/mark/mark.js#L23-L247
train
Mark extension for current situation
[ 30522, 3853, 2928, 10288, 29048, 1006, 3559, 1007, 1063, 9530, 3367, 19875, 1027, 2047, 12115, 9863, 1006, 1007, 1025, 9530, 3367, 3461, 1027, 2047, 12115, 24805, 4590, 1006, 19875, 1007, 1025, 2292, 1059, 2213, 2232, 1010, 3461, 2232, 1010...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
transloadit/uppy
packages/@uppy/core/src/Plugin.js
debounce
function debounce (fn) { let calling = null let latestArgs = null return (...args) => { latestArgs = args if (!calling) { calling = Promise.resolve().then(() => { calling = null // At this point `args` may be different from the most // recent state, if multiple calls happened since this task // was queued. So we use the `latestArgs`, which definitely // is the most recent call. return fn(...latestArgs) }) } return calling } }
javascript
function debounce (fn) { let calling = null let latestArgs = null return (...args) => { latestArgs = args if (!calling) { calling = Promise.resolve().then(() => { calling = null // At this point `args` may be different from the most // recent state, if multiple calls happened since this task // was queued. So we use the `latestArgs`, which definitely // is the most recent call. return fn(...latestArgs) }) } return calling } }
[ "function", "debounce", "(", "fn", ")", "{", "let", "calling", "=", "null", "let", "latestArgs", "=", "null", "return", "(", "...", "args", ")", "=>", "{", "latestArgs", "=", "args", "if", "(", "!", "calling", ")", "{", "calling", "=", "Promise", "."...
Defer a frequent call to the microtask queue.
[ "Defer", "a", "frequent", "call", "to", "the", "microtask", "queue", "." ]
7ae18bf992d544a64da998f033258ec09a3de275
https://github.com/transloadit/uppy/blob/7ae18bf992d544a64da998f033258ec09a3de275/packages/@uppy/core/src/Plugin.js#L7-L24
train
Debounce a function to call the task with the latest arguments
[ 30522, 3853, 2139, 5092, 17457, 1006, 1042, 2078, 1007, 1063, 2292, 4214, 1027, 19701, 2292, 6745, 2906, 5620, 1027, 19701, 2709, 1006, 1012, 1012, 1012, 12098, 5620, 1007, 1027, 1028, 1063, 6745, 2906, 5620, 1027, 12098, 5620, 2065, 1006, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
eslint/eslint
lib/rules/callback-return.js
isCallback
function isCallback(node) { return containsOnlyIdentifiers(node.callee) && callbacks.indexOf(sourceCode.getText(node.callee)) > -1; }
javascript
function isCallback(node) { return containsOnlyIdentifiers(node.callee) && callbacks.indexOf(sourceCode.getText(node.callee)) > -1; }
[ "function", "isCallback", "(", "node", ")", "{", "return", "containsOnlyIdentifiers", "(", "node", ".", "callee", ")", "&&", "callbacks", ".", "indexOf", "(", "sourceCode", ".", "getText", "(", "node", ".", "callee", ")", ")", ">", "-", "1", ";", "}" ]
Check to see if a CallExpression is in our callback list. @param {ASTNode} node The node to check against our callback names list. @returns {boolean} Whether or not this function matches our callback name.
[ "Check", "to", "see", "if", "a", "CallExpression", "is", "in", "our", "callback", "list", "." ]
bc0819c94aad14f7fad3cbc2338ea15658b0f272
https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/callback-return.js#L84-L86
train
Checks whether a node is a callback.
[ 30522, 3853, 2003, 9289, 20850, 8684, 1006, 13045, 1007, 1063, 2709, 3397, 2239, 2135, 5178, 16778, 8873, 2545, 1006, 13045, 1012, 2655, 4402, 1007, 1004, 1004, 2655, 12221, 1012, 5950, 11253, 1006, 3120, 16044, 1012, 2131, 18209, 1006, 130...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
angular/material
release.js
checkoutVersionBranch
function checkoutVersionBranch () { exec(`git branch -q -D release/${newVersion}`); exec(`git checkout -q -b release/${newVersion}`); abortCmds.push('git checkout master'); abortCmds.push(`git branch -D release/${newVersion}`); }
javascript
function checkoutVersionBranch () { exec(`git branch -q -D release/${newVersion}`); exec(`git checkout -q -b release/${newVersion}`); abortCmds.push('git checkout master'); abortCmds.push(`git branch -D release/${newVersion}`); }
[ "function", "checkoutVersionBranch", "(", ")", "{", "exec", "(", "`", "${", "newVersion", "}", "`", ")", ";", "exec", "(", "`", "${", "newVersion", "}", "`", ")", ";", "abortCmds", ".", "push", "(", "'git checkout master'", ")", ";", "abortCmds", ".", ...
creates the version branch and adds abort steps
[ "creates", "the", "version", "branch", "and", "adds", "abort", "steps" ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/release.js#L77-L82
train
Checkout the version branch
[ 30522, 3853, 4638, 5833, 27774, 10024, 12680, 1006, 1007, 1063, 4654, 8586, 1006, 1036, 21025, 2102, 3589, 1011, 1053, 1011, 1040, 2713, 1013, 1002, 1063, 2047, 27774, 1065, 1036, 1007, 1025, 4654, 8586, 1006, 1036, 21025, 2102, 4638, 5833,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/incubator-echarts
src/util/graphic.js
applyDefaultTextStyle
function applyDefaultTextStyle(textStyle) { var opt = textStyle.insideRollbackOpt; // Only `insideRollbackOpt` created (in `setTextStyleCommon`), // applyDefaultTextStyle works. if (!opt || textStyle.textFill != null) { return; } var useInsideStyle = opt.useInsideStyle; var textPosition = textStyle.insideRawTextPosition; var insideRollback; var autoColor = opt.autoColor; if (useInsideStyle !== false && (useInsideStyle === true || (opt.isRectText && textPosition // textPosition can be [10, 30] && typeof textPosition === 'string' && textPosition.indexOf('inside') >= 0 ) ) ) { insideRollback = { textFill: null, textStroke: textStyle.textStroke, textStrokeWidth: textStyle.textStrokeWidth }; textStyle.textFill = '#fff'; // Consider text with #fff overflow its container. if (textStyle.textStroke == null) { textStyle.textStroke = autoColor; textStyle.textStrokeWidth == null && (textStyle.textStrokeWidth = 2); } } else if (autoColor != null) { insideRollback = {textFill: null}; textStyle.textFill = autoColor; } // Always set `insideRollback`, for clearing previous. if (insideRollback) { textStyle.insideRollback = insideRollback; } }
javascript
function applyDefaultTextStyle(textStyle) { var opt = textStyle.insideRollbackOpt; // Only `insideRollbackOpt` created (in `setTextStyleCommon`), // applyDefaultTextStyle works. if (!opt || textStyle.textFill != null) { return; } var useInsideStyle = opt.useInsideStyle; var textPosition = textStyle.insideRawTextPosition; var insideRollback; var autoColor = opt.autoColor; if (useInsideStyle !== false && (useInsideStyle === true || (opt.isRectText && textPosition // textPosition can be [10, 30] && typeof textPosition === 'string' && textPosition.indexOf('inside') >= 0 ) ) ) { insideRollback = { textFill: null, textStroke: textStyle.textStroke, textStrokeWidth: textStyle.textStrokeWidth }; textStyle.textFill = '#fff'; // Consider text with #fff overflow its container. if (textStyle.textStroke == null) { textStyle.textStroke = autoColor; textStyle.textStrokeWidth == null && (textStyle.textStrokeWidth = 2); } } else if (autoColor != null) { insideRollback = {textFill: null}; textStyle.textFill = autoColor; } // Always set `insideRollback`, for clearing previous. if (insideRollback) { textStyle.insideRollback = insideRollback; } }
[ "function", "applyDefaultTextStyle", "(", "textStyle", ")", "{", "var", "opt", "=", "textStyle", ".", "insideRollbackOpt", ";", "// Only `insideRollbackOpt` created (in `setTextStyleCommon`),", "// applyDefaultTextStyle works.", "if", "(", "!", "opt", "||", "textStyle", "."...
Give some default value to the input `textStyle` object, based on the current settings in this `textStyle` object. The Scenario: when text position is `inside` and `textFill` is not specified, we show text border by default for better view. But it should be considered that text position might be changed when hovering or being emphasis, where the `insideRollback` is used to restore the style. Usage (& NOTICE): When a style object (eithor plain object or instance of `zrender/src/graphic/Style`) is about to be modified on its text related properties, `rollbackDefaultTextStyle` should be called before the modification and `applyDefaultTextStyle` should be called after that. (For the case that all of the text related properties is reset, like `setTextStyleCommon` does, `rollbackDefaultTextStyle` is not needed to be called).
[ "Give", "some", "default", "value", "to", "the", "input", "textStyle", "object", "based", "on", "the", "current", "settings", "in", "this", "textStyle", "object", "." ]
4d0ea095dc3929cb6de40c45748826e7999c7aa8
https://github.com/apache/incubator-echarts/blob/4d0ea095dc3929cb6de40c45748826e7999c7aa8/src/util/graphic.js#L922-L967
train
Apply default text style
[ 30522, 3853, 6611, 3207, 7011, 11314, 18209, 21756, 2571, 1006, 6981, 27983, 1007, 1063, 13075, 23569, 1027, 6981, 27983, 1012, 25297, 14511, 5963, 7361, 2102, 1025, 1013, 1013, 2069, 1036, 25297, 14511, 5963, 7361, 2102, 1036, 2580, 1006, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SeleniumHQ/selenium
javascript/selenium-core/scripts/htmlutils.js
function( event ) { event.type = event.data; jQuery.event.handle.apply( this, arguments ); }
javascript
function( event ) { event.type = event.data; jQuery.event.handle.apply( this, arguments ); }
[ "function", "(", "event", ")", "{", "event", ".", "type", "=", "event", ".", "data", ";", "jQuery", ".", "event", ".", "handle", ".", "apply", "(", "this", ",", "arguments", ")", ";", "}" ]
Checks if an event happened on an element within another element Used in jQuery.event.special.mouseenter and mouseleave handlers
[ "Checks", "if", "an", "event", "happened", "on", "an", "element", "within", "another", "element", "Used", "in", "jQuery", ".", "event", ".", "special", ".", "mouseenter", "and", "mouseleave", "handlers" ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/javascript/selenium-core/scripts/htmlutils.js#L4726-L4729
train
Handle the event from the page
[ 30522, 3853, 1006, 2724, 1007, 1063, 2724, 1012, 2828, 1027, 2724, 1012, 2951, 1025, 1046, 4226, 2854, 1012, 2724, 1012, 5047, 1012, 6611, 1006, 2023, 1010, 9918, 1007, 1025, 1065, 102, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
adobe/brackets
src/extensions/default/AutoUpdate/StateHandler.js
_write
function _write(filePath, json) { var result = $.Deferred(), _file = FileSystem.getFileForPath(filePath); if (_file) { var content = JSON.stringify(json); FileUtils.writeText(_file, content, true) .done(function () { result.resolve(); }) .fail(function (err) { result.reject(); }); } else { result.reject(); } return result.promise(); }
javascript
function _write(filePath, json) { var result = $.Deferred(), _file = FileSystem.getFileForPath(filePath); if (_file) { var content = JSON.stringify(json); FileUtils.writeText(_file, content, true) .done(function () { result.resolve(); }) .fail(function (err) { result.reject(); }); } else { result.reject(); } return result.promise(); }
[ "function", "_write", "(", "filePath", ",", "json", ")", "{", "var", "result", "=", "$", ".", "Deferred", "(", ")", ",", "_file", "=", "FileSystem", ".", "getFileForPath", "(", "filePath", ")", ";", "if", "(", "_file", ")", "{", "var", "content", "="...
Performs the write of JSON object to a file. @param {string} filepath - path to JSON file @param {object} json - JSON object to write @returns {$.Deferred} - a jquery deferred promise, that is resolved with the write success or failure
[ "Performs", "the", "write", "of", "JSON", "object", "to", "a", "file", "." ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/extensions/default/AutoUpdate/StateHandler.js#L169-L189
train
write json to file
[ 30522, 3853, 1035, 4339, 1006, 5371, 15069, 1010, 1046, 3385, 1007, 1063, 13075, 2765, 1027, 1002, 1012, 13366, 28849, 2094, 1006, 1007, 1010, 1035, 5371, 1027, 6764, 27268, 6633, 1012, 2131, 8873, 2571, 29278, 15069, 1006, 5371, 15069, 100...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
mdn/browser-compat-data
scripts/render.js
writeTableHead
function writeTableHead(browserPlatformType) { let browserNameKeys = Object.keys(browsers[browserPlatformType]); let output = ''; if (browserPlatformType === 'webextensions') { output = '<table class="webext-summary-compat-table"><thead><tr><th style="width: 40%"></th>' let browserColumnWidth = 60/browserNameKeys.length; for (let browserNameKey of browserNameKeys) { output += `<th style="width:${browserColumnWidth}%">${browsers[browserPlatformType][browserNameKey]}</th>`; } output += "<tr></thead>"; } else { output = `<div id="compat-${browserPlatformType}"><table class="compat-table"><thead><tr>`; output += '<th>Feature</th>'; for (let browserNameKey of browserNameKeys) { output += `<th>${browsers[browserPlatformType][browserNameKey]}</th>`; } output += '</tr></thead>'; } return output; }
javascript
function writeTableHead(browserPlatformType) { let browserNameKeys = Object.keys(browsers[browserPlatformType]); let output = ''; if (browserPlatformType === 'webextensions') { output = '<table class="webext-summary-compat-table"><thead><tr><th style="width: 40%"></th>' let browserColumnWidth = 60/browserNameKeys.length; for (let browserNameKey of browserNameKeys) { output += `<th style="width:${browserColumnWidth}%">${browsers[browserPlatformType][browserNameKey]}</th>`; } output += "<tr></thead>"; } else { output = `<div id="compat-${browserPlatformType}"><table class="compat-table"><thead><tr>`; output += '<th>Feature</th>'; for (let browserNameKey of browserNameKeys) { output += `<th>${browsers[browserPlatformType][browserNameKey]}</th>`; } output += '</tr></thead>'; } return output; }
[ "function", "writeTableHead", "(", "browserPlatformType", ")", "{", "let", "browserNameKeys", "=", "Object", ".", "keys", "(", "browsers", "[", "browserPlatformType", "]", ")", ";", "let", "output", "=", "''", ";", "if", "(", "browserPlatformType", "===", "'we...
/* Write the table header. `browserPlatformType` is either "mobile", "desktop" or "webextensions"
[ "/", "*", "Write", "the", "table", "header", "." ]
6ca59b232e8fe080f441c7cb625d2bfd1a6fbe2b
https://github.com/mdn/browser-compat-data/blob/6ca59b232e8fe080f441c7cb625d2bfd1a6fbe2b/scripts/render.js#L55-L74
train
Write table head
[ 30522, 3853, 4339, 10880, 4974, 1006, 16602, 24759, 4017, 14192, 13874, 1007, 1063, 2292, 16602, 18442, 14839, 2015, 1027, 4874, 1012, 6309, 1006, 16602, 2015, 1031, 16602, 24759, 4017, 14192, 13874, 1033, 1007, 1025, 2292, 6434, 1027, 1005, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.core/src/sap/ui/base/BindingParser.js
resolveEvents
function resolveEvents(oEvents) { if ( oEvents != null && typeof oEvents === 'object' ) { for ( var sName in oEvents ) { resolveRef(oEvents, sName); } } }
javascript
function resolveEvents(oEvents) { if ( oEvents != null && typeof oEvents === 'object' ) { for ( var sName in oEvents ) { resolveRef(oEvents, sName); } } }
[ "function", "resolveEvents", "(", "oEvents", ")", "{", "if", "(", "oEvents", "!=", "null", "&&", "typeof", "oEvents", "===", "'object'", ")", "{", "for", "(", "var", "sName", "in", "oEvents", ")", "{", "resolveRef", "(", "oEvents", ",", "sName", ")", "...
/* Resolves a map of event listeners, keyed by the event name. Each listener can be the name of a single function that will be resolved in the given context (oEnv).
[ "/", "*", "Resolves", "a", "map", "of", "event", "listeners", "keyed", "by", "the", "event", "name", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/base/BindingParser.js#L232-L238
train
Resolves the given events object.
[ 30522, 3853, 10663, 18697, 7666, 1006, 1051, 18697, 7666, 1007, 1063, 2065, 1006, 1051, 18697, 7666, 999, 1027, 19701, 1004, 1004, 2828, 11253, 1051, 18697, 7666, 1027, 1027, 1027, 1005, 4874, 1005, 1007, 1063, 2005, 1006, 13075, 1055, 1844...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
eslint/eslint
lib/code-path-analysis/code-path-analyzer.js
isForkingByTrueOrFalse
function isForkingByTrueOrFalse(node) { const parent = node.parent; switch (parent.type) { case "ConditionalExpression": case "IfStatement": case "WhileStatement": case "DoWhileStatement": case "ForStatement": return parent.test === node; case "LogicalExpression": return isHandledLogicalOperator(parent.operator); default: return false; } }
javascript
function isForkingByTrueOrFalse(node) { const parent = node.parent; switch (parent.type) { case "ConditionalExpression": case "IfStatement": case "WhileStatement": case "DoWhileStatement": case "ForStatement": return parent.test === node; case "LogicalExpression": return isHandledLogicalOperator(parent.operator); default: return false; } }
[ "function", "isForkingByTrueOrFalse", "(", "node", ")", "{", "const", "parent", "=", "node", ".", "parent", ";", "switch", "(", "parent", ".", "type", ")", "{", "case", "\"ConditionalExpression\"", ":", "case", "\"IfStatement\"", ":", "case", "\"WhileStatement\"...
Checks whether or not a given logical expression node goes different path between the `true` case and the `false` case. @param {ASTNode} node - A node to check. @returns {boolean} `true` if the node is a test of a choice statement.
[ "Checks", "whether", "or", "not", "a", "given", "logical", "expression", "node", "goes", "different", "path", "between", "the", "true", "case", "and", "the", "false", "case", "." ]
bc0819c94aad14f7fad3cbc2338ea15658b0f272
https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/code-path-analysis/code-path-analyzer.js#L51-L68
train
Check if a node is aorking by true or false
[ 30522, 3853, 2003, 29278, 6834, 3762, 16344, 5657, 16347, 9777, 2063, 1006, 13045, 1007, 1063, 9530, 3367, 6687, 1027, 13045, 1012, 6687, 1025, 6942, 1006, 6687, 1012, 2828, 1007, 1063, 2553, 1000, 18462, 10288, 20110, 3258, 1000, 1024, 255...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.core/src/sap/ui/model/odata/v4/lib/_V2Requestor.js
visitNode
function visitNode(oNode) { if (oNode) { if (oNode.id === "VALUE" && oNode.ambiguous) { error(oNode, "ambiguous type for the literal"); } visitNode(oNode.left); visitNode(oNode.right); if (oNode.parameters) { if (oNode.value === "contains") { oNode.value = "substringof"; oNode.parameters.push(oNode.parameters.shift()); // swap the parameters } oNode.parameters.forEach(visitNode); } if (oNode.left && oNode.right) { if (oNode.left.id === "VALUE") { if (oNode.right.id === "VALUE") { error(oNode, "saw literals on both sides of '" + oNode.id + "'"); } convertLiteral(oNode.left, oNode.right); } else if (oNode.right.id === "VALUE") { convertLiteral(oNode.right, oNode.left); } } } }
javascript
function visitNode(oNode) { if (oNode) { if (oNode.id === "VALUE" && oNode.ambiguous) { error(oNode, "ambiguous type for the literal"); } visitNode(oNode.left); visitNode(oNode.right); if (oNode.parameters) { if (oNode.value === "contains") { oNode.value = "substringof"; oNode.parameters.push(oNode.parameters.shift()); // swap the parameters } oNode.parameters.forEach(visitNode); } if (oNode.left && oNode.right) { if (oNode.left.id === "VALUE") { if (oNode.right.id === "VALUE") { error(oNode, "saw literals on both sides of '" + oNode.id + "'"); } convertLiteral(oNode.left, oNode.right); } else if (oNode.right.id === "VALUE") { convertLiteral(oNode.right, oNode.left); } } } }
[ "function", "visitNode", "(", "oNode", ")", "{", "if", "(", "oNode", ")", "{", "if", "(", "oNode", ".", "id", "===", "\"VALUE\"", "&&", "oNode", ".", "ambiguous", ")", "{", "error", "(", "oNode", ",", "\"ambiguous type for the literal\"", ")", ";", "}", ...
/* Visits a node in the syntax recursively. @param {object} oNode A node
[ "/", "*", "Visits", "a", "node", "in", "the", "syntax", "recursively", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/v4/lib/_V2Requestor.js#L254-L279
train
Visit a node
[ 30522, 3853, 3942, 3630, 3207, 1006, 21058, 3207, 1007, 1063, 2065, 1006, 21058, 3207, 1007, 1063, 2065, 1006, 21058, 3207, 1012, 8909, 1027, 1027, 1027, 1000, 3643, 1000, 1004, 1004, 21058, 3207, 1012, 20080, 1007, 1063, 7561, 1006, 21058,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
eslint/eslint
lib/rules/padding-line-between-statements.js
getPaddingType
function getPaddingType(prevNode, nextNode) { for (let i = configureList.length - 1; i >= 0; --i) { const configure = configureList[i]; const matched = match(prevNode, configure.prev) && match(nextNode, configure.next); if (matched) { return PaddingTypes[configure.blankLine]; } } return PaddingTypes.any; }
javascript
function getPaddingType(prevNode, nextNode) { for (let i = configureList.length - 1; i >= 0; --i) { const configure = configureList[i]; const matched = match(prevNode, configure.prev) && match(nextNode, configure.next); if (matched) { return PaddingTypes[configure.blankLine]; } } return PaddingTypes.any; }
[ "function", "getPaddingType", "(", "prevNode", ",", "nextNode", ")", "{", "for", "(", "let", "i", "=", "configureList", ".", "length", "-", "1", ";", "i", ">=", "0", ";", "--", "i", ")", "{", "const", "configure", "=", "configureList", "[", "i", "]",...
Finds the last matched configure from configureList. @param {ASTNode} prevNode The previous statement to match. @param {ASTNode} nextNode The current statement to match. @returns {Object} The tester of the last matched configure. @private
[ "Finds", "the", "last", "matched", "configure", "from", "configureList", "." ]
bc0819c94aad14f7fad3cbc2338ea15658b0f272
https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/padding-line-between-statements.js#L540-L552
train
Get padding type
[ 30522, 3853, 2131, 15455, 4667, 13874, 1006, 3653, 16022, 10244, 1010, 2279, 3630, 3207, 1007, 1063, 2005, 1006, 2292, 1045, 1027, 9530, 8873, 27390, 29282, 2102, 1012, 3091, 1011, 1015, 1025, 1045, 1028, 1027, 1014, 1025, 1011, 1011, 1045,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
TryGhost/Ghost
core/server/models/post.js
formatsToJSON
function formatsToJSON(attrs, options) { var defaultFormats = ['html'], formatsToKeep = options.formats || defaultFormats; // Iterate over all known formats, and if they are not in the keep list, remove them _.each(Post.allowedFormats, function (format) { if (formatsToKeep.indexOf(format) === -1) { delete attrs[format]; } }); return attrs; }
javascript
function formatsToJSON(attrs, options) { var defaultFormats = ['html'], formatsToKeep = options.formats || defaultFormats; // Iterate over all known formats, and if they are not in the keep list, remove them _.each(Post.allowedFormats, function (format) { if (formatsToKeep.indexOf(format) === -1) { delete attrs[format]; } }); return attrs; }
[ "function", "formatsToJSON", "(", "attrs", ",", "options", ")", "{", "var", "defaultFormats", "=", "[", "'html'", "]", ",", "formatsToKeep", "=", "options", ".", "formats", "||", "defaultFormats", ";", "// Iterate over all known formats, and if they are not in the keep ...
If the `formats` option is not used, we return `html` be default. Otherwise we return what is requested e.g. `?formats=mobiledoc,plaintext`
[ "If", "the", "formats", "option", "is", "not", "used", "we", "return", "html", "be", "default", ".", "Otherwise", "we", "return", "what", "is", "requested", "e", ".", "g", ".", "?formats", "=", "mobiledoc", "plaintext" ]
bb7bb55cf3e60af99ebbc56099928827b58461bc
https://github.com/TryGhost/Ghost/blob/bb7bb55cf3e60af99ebbc56099928827b58461bc/core/server/models/post.js#L552-L564
train
Convert the formats to JSON
[ 30522, 3853, 11630, 3406, 22578, 2239, 1006, 2012, 16344, 2015, 1010, 7047, 1007, 1063, 13075, 12398, 14192, 11149, 1027, 1031, 1005, 16129, 1005, 1033, 1010, 11630, 18715, 4402, 2361, 1027, 7047, 1012, 11630, 1064, 1064, 12398, 14192, 11149,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
adobe/brackets
src/view/MainViewManager.js
setActivePaneId
function setActivePaneId(newPaneId) { if (!_isSpecialPaneId(newPaneId) && newPaneId !== _activePaneId) { var oldPaneId = _activePaneId, oldPane = _getPane(ACTIVE_PANE), newPane = _getPane(newPaneId); if (!newPane) { throw new Error("invalid pane id: " + newPaneId); } _activePaneId = newPaneId; exports.trigger("activePaneChange", newPaneId, oldPaneId); exports.trigger("currentFileChange", _getPane(ACTIVE_PANE).getCurrentlyViewedFile(), newPaneId, oldPane.getCurrentlyViewedFile(), oldPaneId); _makePaneMostRecent(_activePaneId); focusActivePane(); } }
javascript
function setActivePaneId(newPaneId) { if (!_isSpecialPaneId(newPaneId) && newPaneId !== _activePaneId) { var oldPaneId = _activePaneId, oldPane = _getPane(ACTIVE_PANE), newPane = _getPane(newPaneId); if (!newPane) { throw new Error("invalid pane id: " + newPaneId); } _activePaneId = newPaneId; exports.trigger("activePaneChange", newPaneId, oldPaneId); exports.trigger("currentFileChange", _getPane(ACTIVE_PANE).getCurrentlyViewedFile(), newPaneId, oldPane.getCurrentlyViewedFile(), oldPaneId); _makePaneMostRecent(_activePaneId); focusActivePane(); } }
[ "function", "setActivePaneId", "(", "newPaneId", ")", "{", "if", "(", "!", "_isSpecialPaneId", "(", "newPaneId", ")", "&&", "newPaneId", "!==", "_activePaneId", ")", "{", "var", "oldPaneId", "=", "_activePaneId", ",", "oldPane", "=", "_getPane", "(", "ACTIVE_P...
Switch active pane to the specified pane id (or ACTIVE_PANE/ALL_PANES, in which case this call does nothing). @param {!string} paneId - the id of the pane to activate
[ "Switch", "active", "pane", "to", "the", "specified", "pane", "id", "(", "or", "ACTIVE_PANE", "/", "ALL_PANES", "in", "which", "case", "this", "call", "does", "nothing", ")", "." ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/view/MainViewManager.js#L382-L403
train
setActivePaneId - Set active pane id
[ 30522, 3853, 2275, 19620, 9739, 7416, 2094, 1006, 2047, 9739, 7416, 2094, 1007, 1063, 2065, 1006, 999, 1035, 26354, 5051, 13247, 9739, 7416, 2094, 1006, 2047, 9739, 7416, 2094, 1007, 1004, 1004, 2047, 9739, 7416, 2094, 999, 1027, 1027, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.table/src/sap/ui/table/TablePointerExtension.js
function(oTable, bForward) { if (oTable._mTimeouts.horizontalReorderScrollTimerId) { window.clearTimeout(oTable._mTimeouts.horizontalReorderScrollTimerId); oTable._mTimeouts.horizontalReorderScrollTimerId = null; } if (oTable._bReorderScroll) { var iStep = bForward ? 30 : -30; if (oTable._bRtlMode) { iStep = (-1) * iStep; } oTable._mTimeouts.horizontalReorderScrollTimerId = setTimeout(ReorderHelper.doScroll.bind(oTable, oTable, bForward), 60); var $Scr = oTable.$("sapUiTableColHdrScr"); var ScrollLeft = oTable._bRtlMode ? "scrollLeftRTL" : "scrollLeft"; $Scr[ScrollLeft]($Scr[ScrollLeft]() + iStep); } }
javascript
function(oTable, bForward) { if (oTable._mTimeouts.horizontalReorderScrollTimerId) { window.clearTimeout(oTable._mTimeouts.horizontalReorderScrollTimerId); oTable._mTimeouts.horizontalReorderScrollTimerId = null; } if (oTable._bReorderScroll) { var iStep = bForward ? 30 : -30; if (oTable._bRtlMode) { iStep = (-1) * iStep; } oTable._mTimeouts.horizontalReorderScrollTimerId = setTimeout(ReorderHelper.doScroll.bind(oTable, oTable, bForward), 60); var $Scr = oTable.$("sapUiTableColHdrScr"); var ScrollLeft = oTable._bRtlMode ? "scrollLeftRTL" : "scrollLeft"; $Scr[ScrollLeft]($Scr[ScrollLeft]() + iStep); } }
[ "function", "(", "oTable", ",", "bForward", ")", "{", "if", "(", "oTable", ".", "_mTimeouts", ".", "horizontalReorderScrollTimerId", ")", "{", "window", ".", "clearTimeout", "(", "oTable", ".", "_mTimeouts", ".", "horizontalReorderScrollTimerId", ")", ";", "oTab...
/* Starts or continues stepwise horizontal scrolling until oTable._bReorderScroll is false.
[ "/", "*", "Starts", "or", "continues", "stepwise", "horizontal", "scrolling", "until", "oTable", ".", "_bReorderScroll", "is", "false", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TablePointerExtension.js#L645-L660
train
Sets the scrolling behavior of the table.
[ 30522, 3853, 1006, 27178, 3085, 1010, 28939, 2953, 7652, 1007, 1063, 2065, 1006, 27178, 3085, 1012, 1035, 11047, 14428, 12166, 1012, 9876, 2890, 8551, 2545, 26775, 14511, 7292, 14615, 1007, 1063, 3332, 1012, 3154, 7292, 5833, 1006, 27178, 3...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
dcloudio/mui
examples/login/libs/easymob-webim-sdk/strophe-custom-2.0.0.js
function (elem) { var result = null; try { result = this.handler(elem); } catch (e) { if (e.sourceURL) { Strophe.fatal("error: " + this.handler + " " + e.sourceURL + ":" + e.line + " - " + e.name + ": " + e.message); } else if (e.fileName) { if (typeof(console) != "undefined") { console.trace(); console.error(this.handler, " - error - ", e, e.message); } Strophe.fatal("error: " + this.handler + " " + e.fileName + ":" + e.lineNumber + " - " + e.name + ": " + e.message); } else { Strophe.fatal("error: " + e.message + "\n" + e.stack); } throw e; } return result; }
javascript
function (elem) { var result = null; try { result = this.handler(elem); } catch (e) { if (e.sourceURL) { Strophe.fatal("error: " + this.handler + " " + e.sourceURL + ":" + e.line + " - " + e.name + ": " + e.message); } else if (e.fileName) { if (typeof(console) != "undefined") { console.trace(); console.error(this.handler, " - error - ", e, e.message); } Strophe.fatal("error: " + this.handler + " " + e.fileName + ":" + e.lineNumber + " - " + e.name + ": " + e.message); } else { Strophe.fatal("error: " + e.message + "\n" + e.stack); } throw e; } return result; }
[ "function", "(", "elem", ")", "{", "var", "result", "=", "null", ";", "try", "{", "result", "=", "this", ".", "handler", "(", "elem", ")", ";", "}", "catch", "(", "e", ")", "{", "if", "(", "e", ".", "sourceURL", ")", "{", "Strophe", ".", "fatal...
PrivateFunction: run Run the callback on a matching stanza. Parameters: (XMLElement) elem - The DOM element that triggered the Strophe.Handler. Returns: A boolean indicating if the handler should remain active.
[ "PrivateFunction", ":", "run", "Run", "the", "callback", "on", "a", "matching", "stanza", "." ]
ff74c90a1671a552f3604b1288bf38a4126312d0
https://github.com/dcloudio/mui/blob/ff74c90a1671a552f3604b1288bf38a4126312d0/examples/login/libs/easymob-webim-sdk/strophe-custom-2.0.0.js#L1885-L1911
train
Returns the next page of the page
[ 30522, 3853, 1006, 3449, 6633, 1007, 1063, 13075, 2765, 1027, 19701, 1025, 3046, 1063, 2765, 1027, 2023, 1012, 28213, 1006, 3449, 6633, 1007, 1025, 1065, 4608, 1006, 1041, 1007, 1063, 2065, 1006, 1041, 1012, 3120, 3126, 2140, 1007, 1063, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.fl/src/sap/ui/fl/Utils.js
function (oControl) { var oComponent = null; var sComponentId = null; // determine UI5 component out of given control if (oControl) { sComponentId = Utils._getComponentIdForControl(oControl); if (sComponentId) { oComponent = Utils._getComponent(sComponentId); } } return oComponent; }
javascript
function (oControl) { var oComponent = null; var sComponentId = null; // determine UI5 component out of given control if (oControl) { sComponentId = Utils._getComponentIdForControl(oControl); if (sComponentId) { oComponent = Utils._getComponent(sComponentId); } } return oComponent; }
[ "function", "(", "oControl", ")", "{", "var", "oComponent", "=", "null", ";", "var", "sComponentId", "=", "null", ";", "// determine UI5 component out of given control", "if", "(", "oControl", ")", "{", "sComponentId", "=", "Utils", ".", "_getComponentIdForControl",...
Returns the Component that belongs to given control. If the control has no component, it walks up the control tree in order to find a control having one. @param {sap.ui.base.ManagedObject} oControl - Managed object instance @returns {sap.ui.core.Component|null} found component @private
[ "Returns", "the", "Component", "that", "belongs", "to", "given", "control", ".", "If", "the", "control", "has", "no", "component", "it", "walks", "up", "the", "control", "tree", "in", "order", "to", "find", "a", "control", "having", "one", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.fl/src/sap/ui/fl/Utils.js#L558-L571
train
Returns the UI5 component of the given control
[ 30522, 3853, 1006, 1051, 8663, 13181, 2140, 1007, 1063, 13075, 1051, 9006, 29513, 3372, 1027, 19701, 1025, 13075, 8040, 25377, 5643, 16778, 2094, 1027, 19701, 1025, 1013, 1013, 5646, 21318, 2629, 6922, 2041, 1997, 2445, 2491, 2065, 1006, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
babel/babel
packages/babel-standalone/src/transformScriptTags.js
load
function load(url, successCallback, errorCallback) { const xhr = new XMLHttpRequest(); // async, however scripts will be executed in the order they are in the // DOM to mirror normal script loading. xhr.open("GET", url, true); if ("overrideMimeType" in xhr) { xhr.overrideMimeType("text/plain"); } xhr.onreadystatechange = function() { if (xhr.readyState === 4) { if (xhr.status === 0 || xhr.status === 200) { successCallback(xhr.responseText); } else { errorCallback(); throw new Error("Could not load " + url); } } }; return xhr.send(null); }
javascript
function load(url, successCallback, errorCallback) { const xhr = new XMLHttpRequest(); // async, however scripts will be executed in the order they are in the // DOM to mirror normal script loading. xhr.open("GET", url, true); if ("overrideMimeType" in xhr) { xhr.overrideMimeType("text/plain"); } xhr.onreadystatechange = function() { if (xhr.readyState === 4) { if (xhr.status === 0 || xhr.status === 200) { successCallback(xhr.responseText); } else { errorCallback(); throw new Error("Could not load " + url); } } }; return xhr.send(null); }
[ "function", "load", "(", "url", ",", "successCallback", ",", "errorCallback", ")", "{", "const", "xhr", "=", "new", "XMLHttpRequest", "(", ")", ";", "// async, however scripts will be executed in the order they are in the", "// DOM to mirror normal script loading.", "xhr", ...
Load script from the provided url and pass the content to the callback.
[ "Load", "script", "from", "the", "provided", "url", "and", "pass", "the", "content", "to", "the", "callback", "." ]
1969e6b6aa7d90be3fbb3aca98ea96849656a55a
https://github.com/babel/babel/blob/1969e6b6aa7d90be3fbb3aca98ea96849656a55a/packages/babel-standalone/src/transformScriptTags.js#L64-L84
train
Load a file
[ 30522, 3853, 7170, 1006, 24471, 2140, 1010, 3112, 9289, 20850, 8684, 1010, 7561, 9289, 20850, 8684, 1007, 1063, 9530, 3367, 1060, 8093, 1027, 2047, 20950, 11039, 25856, 2890, 15500, 1006, 1007, 1025, 1013, 1013, 2004, 6038, 2278, 1010, 2174...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
adobe/brackets
src/editor/EditorCommandHandlers.js
deleteCurrentLines
function deleteCurrentLines(editor) { editor = editor || EditorManager.getFocusedEditor(); if (!editor) { return; } // Walk the selections, calculating the deletion edits we need to do as we go; // document.doMultipleEdits() will take care of adjusting the edit locations when // it actually performs the edits. var doc = editor.document, from, to, lineSelections = editor.convertToLineSelections(editor.getSelections()), edits = []; _.each(lineSelections, function (lineSel, index) { var sel = lineSel.selectionForEdit; from = sel.start; to = sel.end; // this is already at the beginning of the line after the last selected line if (to.line === editor.getLastVisibleLine() + 1) { // Instead of deleting the newline after the last line, delete the newline // before the beginning of the line--unless this is the entire visible content // of the editor, in which case just delete the line content. if (from.line > editor.getFirstVisibleLine()) { from.line -= 1; from.ch = doc.getLine(from.line).length; } to.line -= 1; to.ch = doc.getLine(to.line).length; } // We don't need to track the original selections, since they'll get collapsed as // part of the various deletions that occur. edits.push({edit: {text: "", start: from, end: to}}); }); doc.doMultipleEdits(edits); }
javascript
function deleteCurrentLines(editor) { editor = editor || EditorManager.getFocusedEditor(); if (!editor) { return; } // Walk the selections, calculating the deletion edits we need to do as we go; // document.doMultipleEdits() will take care of adjusting the edit locations when // it actually performs the edits. var doc = editor.document, from, to, lineSelections = editor.convertToLineSelections(editor.getSelections()), edits = []; _.each(lineSelections, function (lineSel, index) { var sel = lineSel.selectionForEdit; from = sel.start; to = sel.end; // this is already at the beginning of the line after the last selected line if (to.line === editor.getLastVisibleLine() + 1) { // Instead of deleting the newline after the last line, delete the newline // before the beginning of the line--unless this is the entire visible content // of the editor, in which case just delete the line content. if (from.line > editor.getFirstVisibleLine()) { from.line -= 1; from.ch = doc.getLine(from.line).length; } to.line -= 1; to.ch = doc.getLine(to.line).length; } // We don't need to track the original selections, since they'll get collapsed as // part of the various deletions that occur. edits.push({edit: {text: "", start: from, end: to}}); }); doc.doMultipleEdits(edits); }
[ "function", "deleteCurrentLines", "(", "editor", ")", "{", "editor", "=", "editor", "||", "EditorManager", ".", "getFocusedEditor", "(", ")", ";", "if", "(", "!", "editor", ")", "{", "return", ";", "}", "// Walk the selections, calculating the deletion edits we need...
Deletes the current line if there is no selection or the lines for the selection (removing the end of line too)
[ "Deletes", "the", "current", "line", "if", "there", "is", "no", "selection", "or", "the", "lines", "for", "the", "selection", "(", "removing", "the", "end", "of", "line", "too", ")" ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/editor/EditorCommandHandlers.js#L781-L818
train
Delete the current lines
[ 30522, 3853, 3972, 12870, 10841, 14343, 3372, 12735, 1006, 3559, 1007, 1063, 3559, 1027, 3559, 1064, 1064, 3559, 24805, 4590, 1012, 2131, 14876, 7874, 19082, 15660, 1006, 1007, 1025, 2065, 1006, 999, 3559, 1007, 1063, 2709, 1025, 1065, 1013...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
adobe/brackets
src/document/DocumentManager.js
getWorkingSet
function getWorkingSet() { DeprecationWarning.deprecationWarning("Use MainViewManager.getWorkingSet() instead of DocumentManager.getWorkingSet()", true); return MainViewManager.getWorkingSet(MainViewManager.ALL_PANES) .filter(function (file) { // Legacy didn't allow for files with custom viewers return !MainViewFactory.findSuitableFactoryForPath(file.fullPath); }); }
javascript
function getWorkingSet() { DeprecationWarning.deprecationWarning("Use MainViewManager.getWorkingSet() instead of DocumentManager.getWorkingSet()", true); return MainViewManager.getWorkingSet(MainViewManager.ALL_PANES) .filter(function (file) { // Legacy didn't allow for files with custom viewers return !MainViewFactory.findSuitableFactoryForPath(file.fullPath); }); }
[ "function", "getWorkingSet", "(", ")", "{", "DeprecationWarning", ".", "deprecationWarning", "(", "\"Use MainViewManager.getWorkingSet() instead of DocumentManager.getWorkingSet()\"", ",", "true", ")", ";", "return", "MainViewManager", ".", "getWorkingSet", "(", "MainViewManage...
Returns a list of items in the working set in UI list order. May be 0-length, but never null. @deprecated Use MainViewManager.getWorkingSet() instead @return {Array.<File>}
[ "Returns", "a", "list", "of", "items", "in", "the", "working", "set", "in", "UI", "list", "order", ".", "May", "be", "0", "-", "length", "but", "never", "null", "." ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/document/DocumentManager.js#L156-L163
train
Get a list of working set files
[ 30522, 3853, 2131, 21398, 13462, 1006, 1007, 1063, 2139, 28139, 10719, 9028, 5582, 1012, 2139, 28139, 10719, 9028, 5582, 1006, 1000, 2224, 2364, 8584, 24805, 4590, 1012, 2131, 21398, 13462, 1006, 1007, 2612, 1997, 6254, 24805, 4590, 1012, 2...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
cytoscape/cytoscape.js
dist/cytoscape.esm.js
style$$1
function style$$1(name, value) { var cy = this.cy(); if (!cy.styleEnabled()) { return this; } var updateTransitions = false; var style$$1 = cy.style(); if (plainObject(name)) { // then extend the bypass var props = name; style$$1.applyBypass(this, props, updateTransitions); this.emitAndNotify('style'); // let the renderer know we've updated style } else if (string(name)) { if (value === undefined) { // then get the property from the style var ele = this[0]; if (ele) { return style$$1.getStylePropertyValue(ele, name); } else { // empty collection => can't get any value return; } } else { // then set the bypass with the property value style$$1.applyBypass(this, name, value, updateTransitions); this.emitAndNotify('style'); // let the renderer know we've updated style } } else if (name === undefined) { var _ele = this[0]; if (_ele) { return style$$1.getRawStyle(_ele); } else { // empty collection => can't get any value return; } } return this; // chaining }
javascript
function style$$1(name, value) { var cy = this.cy(); if (!cy.styleEnabled()) { return this; } var updateTransitions = false; var style$$1 = cy.style(); if (plainObject(name)) { // then extend the bypass var props = name; style$$1.applyBypass(this, props, updateTransitions); this.emitAndNotify('style'); // let the renderer know we've updated style } else if (string(name)) { if (value === undefined) { // then get the property from the style var ele = this[0]; if (ele) { return style$$1.getStylePropertyValue(ele, name); } else { // empty collection => can't get any value return; } } else { // then set the bypass with the property value style$$1.applyBypass(this, name, value, updateTransitions); this.emitAndNotify('style'); // let the renderer know we've updated style } } else if (name === undefined) { var _ele = this[0]; if (_ele) { return style$$1.getRawStyle(_ele); } else { // empty collection => can't get any value return; } } return this; // chaining }
[ "function", "style$$1", "(", "name", ",", "value", ")", "{", "var", "cy", "=", "this", ".", "cy", "(", ")", ";", "if", "(", "!", "cy", ".", "styleEnabled", "(", ")", ")", "{", "return", "this", ";", "}", "var", "updateTransitions", "=", "false", ...
read the calculated css style of the element or override the style (via a bypass)
[ "read", "the", "calculated", "css", "style", "of", "the", "element", "or", "override", "the", "style", "(", "via", "a", "bypass", ")" ]
ad2051b65e2243cfd953d8b24a8bf95bfa8559e5
https://github.com/cytoscape/cytoscape.js/blob/ad2051b65e2243cfd953d8b24a8bf95bfa8559e5/dist/cytoscape.esm.js#L10963-L11006
train
style the element
[ 30522, 3853, 2806, 1002, 1002, 1015, 1006, 2171, 1010, 3643, 1007, 1063, 13075, 22330, 1027, 2023, 1012, 22330, 1006, 1007, 1025, 2065, 1006, 999, 22330, 1012, 2806, 8189, 23242, 1006, 1007, 1007, 1063, 2709, 2023, 1025, 1065, 13075, 10651,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
keplergl/kepler.gl
src/deckgl-layers/3d-building-layer/3d-building-utils.js
classifyRings
function classifyRings(rings) { const len = rings.length; if (len <= 1) return [rings]; const polygons = []; let polygon; let ccw; for (let i = 0; i < len; i++) { const area = signedArea(rings[i]); if (area === 0) { continue; } if (ccw === undefined) { ccw = area < 0; } if (ccw === area < 0) { if (polygon) { polygons.push(polygon); } polygon = [rings[i]]; } else { polygon.push(rings[i]); } } if (polygon) { polygons.push(polygon); } return polygons; }
javascript
function classifyRings(rings) { const len = rings.length; if (len <= 1) return [rings]; const polygons = []; let polygon; let ccw; for (let i = 0; i < len; i++) { const area = signedArea(rings[i]); if (area === 0) { continue; } if (ccw === undefined) { ccw = area < 0; } if (ccw === area < 0) { if (polygon) { polygons.push(polygon); } polygon = [rings[i]]; } else { polygon.push(rings[i]); } } if (polygon) { polygons.push(polygon); } return polygons; }
[ "function", "classifyRings", "(", "rings", ")", "{", "const", "len", "=", "rings", ".", "length", ";", "if", "(", "len", "<=", "1", ")", "return", "[", "rings", "]", ";", "const", "polygons", "=", "[", "]", ";", "let", "polygon", ";", "let", "ccw",...
classifies an array of rings into polygons with outer rings and holes
[ "classifies", "an", "array", "of", "rings", "into", "polygons", "with", "outer", "rings", "and", "holes" ]
779238435707cc54335c2d00001e4b9334b314aa
https://github.com/keplergl/kepler.gl/blob/779238435707cc54335c2d00001e4b9334b314aa/src/deckgl-layers/3d-building-layer/3d-building-utils.js#L148-L181
train
Classifies a list of rings
[ 30522, 3853, 26268, 4892, 2015, 1006, 7635, 1007, 1063, 9530, 3367, 18798, 1027, 7635, 1012, 3091, 1025, 2065, 1006, 18798, 1026, 1027, 1015, 1007, 2709, 1031, 7635, 1033, 1025, 9530, 3367, 26572, 7446, 2015, 1027, 1031, 1033, 1025, 2292, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
jgraph/mxgraph
javascript/mxClient.js
function(style, key, value) { var isValue = value != null && (typeof(value.length) == 'undefined' || value.length > 0); if (style == null || style.length == 0) { if (isValue) { style = key + '=' + value + ';'; } } else { if (style.substring(0, key.length + 1) == key + '=') { var next = style.indexOf(';'); if (isValue) { style = key + '=' + value + ((next < 0) ? ';' : style.substring(next)); } else { style = (next < 0 || next == style.length - 1) ? '' : style.substring(next + 1); } } else { var index = style.indexOf(';' + key + '='); if (index < 0) { if (isValue) { var sep = (style.charAt(style.length - 1) == ';') ? '' : ';'; style = style + sep + key + '=' + value + ';'; } } else { var next = style.indexOf(';', index + 1); if (isValue) { style = style.substring(0, index + 1) + key + '=' + value + ((next < 0) ? ';' : style.substring(next)); } else { style = style.substring(0, index) + ((next < 0) ? ';' : style.substring(next)); } } } } return style; }
javascript
function(style, key, value) { var isValue = value != null && (typeof(value.length) == 'undefined' || value.length > 0); if (style == null || style.length == 0) { if (isValue) { style = key + '=' + value + ';'; } } else { if (style.substring(0, key.length + 1) == key + '=') { var next = style.indexOf(';'); if (isValue) { style = key + '=' + value + ((next < 0) ? ';' : style.substring(next)); } else { style = (next < 0 || next == style.length - 1) ? '' : style.substring(next + 1); } } else { var index = style.indexOf(';' + key + '='); if (index < 0) { if (isValue) { var sep = (style.charAt(style.length - 1) == ';') ? '' : ';'; style = style + sep + key + '=' + value + ';'; } } else { var next = style.indexOf(';', index + 1); if (isValue) { style = style.substring(0, index + 1) + key + '=' + value + ((next < 0) ? ';' : style.substring(next)); } else { style = style.substring(0, index) + ((next < 0) ? ';' : style.substring(next)); } } } } return style; }
[ "function", "(", "style", ",", "key", ",", "value", ")", "{", "var", "isValue", "=", "value", "!=", "null", "&&", "(", "typeof", "(", "value", ".", "length", ")", "==", "'undefined'", "||", "value", ".", "length", ">", "0", ")", ";", "if", "(", "...
Function: setStyle Adds or removes the given key, value pair to the style and returns the new style. If value is null or zero length then the key is removed from the style. This is for cell styles, not for CSS styles. Parameters: style - String of the form [(stylename|key=value);]. key - Key of the style to be changed. value - New value for the given key.
[ "Function", ":", "setStyle" ]
33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44
https://github.com/jgraph/mxgraph/blob/33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44/javascript/mxClient.js#L5511-L5566
train
Returns the style string
[ 30522, 3853, 1006, 2806, 1010, 3145, 1010, 3643, 1007, 1063, 13075, 2003, 10175, 5657, 1027, 3643, 999, 1027, 19701, 1004, 1004, 1006, 2828, 11253, 1006, 3643, 1012, 3091, 1007, 1027, 1027, 1005, 6151, 28344, 1005, 1064, 1064, 3643, 1012, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
jhipster/generator-jhipster
generators/aws-containers/aws-client.js
sanitizeBucketName
function sanitizeBucketName(bucketName) { return _(bucketName) .split('.') .filter(e => e) .map(_.toLower) .map(e => _.replace(e, '_', '-')) .join('.'); }
javascript
function sanitizeBucketName(bucketName) { return _(bucketName) .split('.') .filter(e => e) .map(_.toLower) .map(e => _.replace(e, '_', '-')) .join('.'); }
[ "function", "sanitizeBucketName", "(", "bucketName", ")", "{", "return", "_", "(", "bucketName", ")", ".", "split", "(", "'.'", ")", ".", "filter", "(", "e", "=>", "e", ")", ".", "map", "(", "_", ".", "toLower", ")", ".", "map", "(", "e", "=>", "...
Sanitize the bucketName following the rule found here: http://docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudtrail-s3-bucket-naming-requirements.html @param bucketName @returns {string}
[ "Sanitize", "the", "bucketName", "following", "the", "rule", "found", "here", ":", "http", ":", "//", "docs", ".", "aws", ".", "amazon", ".", "com", "/", "awscloudtrail", "/", "latest", "/", "userguide", "/", "cloudtrail", "-", "s3", "-", "bucket", "-", ...
f76fa8de0818ce6bda6c7b1455942e2a9b0ae3ff
https://github.com/jhipster/generator-jhipster/blob/f76fa8de0818ce6bda6c7b1455942e2a9b0ae3ff/generators/aws-containers/aws-client.js#L361-L368
train
Sanitize bucket name
[ 30522, 3853, 2624, 25090, 4371, 24204, 3388, 18442, 1006, 13610, 18442, 1007, 1063, 2709, 1035, 1006, 13610, 18442, 1007, 1012, 3975, 1006, 1005, 1012, 1005, 1007, 1012, 11307, 1006, 1041, 1027, 1028, 1041, 1007, 1012, 4949, 1006, 1035, 101...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
adobe/brackets
src/command/KeyBindingManager.js
formatKeyDescriptor
function formatKeyDescriptor(descriptor) { var displayStr; if (brackets.platform === "mac") { displayStr = descriptor.replace(/-(?!$)/g, ""); // remove dashes displayStr = displayStr.replace("Ctrl", "\u2303"); // Ctrl > control symbol displayStr = displayStr.replace("Cmd", "\u2318"); // Cmd > command symbol displayStr = displayStr.replace("Shift", "\u21E7"); // Shift > shift symbol displayStr = displayStr.replace("Alt", "\u2325"); // Alt > option symbol } else { displayStr = descriptor.replace("Ctrl", Strings.KEYBOARD_CTRL); displayStr = displayStr.replace("Shift", Strings.KEYBOARD_SHIFT); displayStr = displayStr.replace(/-(?!$)/g, "+"); } displayStr = displayStr.replace("Space", Strings.KEYBOARD_SPACE); displayStr = displayStr.replace("PageUp", Strings.KEYBOARD_PAGE_UP); displayStr = displayStr.replace("PageDown", Strings.KEYBOARD_PAGE_DOWN); displayStr = displayStr.replace("Home", Strings.KEYBOARD_HOME); displayStr = displayStr.replace("End", Strings.KEYBOARD_END); displayStr = displayStr.replace("Ins", Strings.KEYBOARD_INSERT); displayStr = displayStr.replace("Del", Strings.KEYBOARD_DELETE); return displayStr; }
javascript
function formatKeyDescriptor(descriptor) { var displayStr; if (brackets.platform === "mac") { displayStr = descriptor.replace(/-(?!$)/g, ""); // remove dashes displayStr = displayStr.replace("Ctrl", "\u2303"); // Ctrl > control symbol displayStr = displayStr.replace("Cmd", "\u2318"); // Cmd > command symbol displayStr = displayStr.replace("Shift", "\u21E7"); // Shift > shift symbol displayStr = displayStr.replace("Alt", "\u2325"); // Alt > option symbol } else { displayStr = descriptor.replace("Ctrl", Strings.KEYBOARD_CTRL); displayStr = displayStr.replace("Shift", Strings.KEYBOARD_SHIFT); displayStr = displayStr.replace(/-(?!$)/g, "+"); } displayStr = displayStr.replace("Space", Strings.KEYBOARD_SPACE); displayStr = displayStr.replace("PageUp", Strings.KEYBOARD_PAGE_UP); displayStr = displayStr.replace("PageDown", Strings.KEYBOARD_PAGE_DOWN); displayStr = displayStr.replace("Home", Strings.KEYBOARD_HOME); displayStr = displayStr.replace("End", Strings.KEYBOARD_END); displayStr = displayStr.replace("Ins", Strings.KEYBOARD_INSERT); displayStr = displayStr.replace("Del", Strings.KEYBOARD_DELETE); return displayStr; }
[ "function", "formatKeyDescriptor", "(", "descriptor", ")", "{", "var", "displayStr", ";", "if", "(", "brackets", ".", "platform", "===", "\"mac\"", ")", "{", "displayStr", "=", "descriptor", ".", "replace", "(", "/", "-(?!$)", "/", "g", ",", "\"\"", ")", ...
Convert normalized key representation to display appropriate for platform. @param {!string} descriptor Normalized key descriptor. @return {!string} Display/Operating system appropriate string
[ "Convert", "normalized", "key", "representation", "to", "display", "appropriate", "for", "platform", "." ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/command/KeyBindingManager.js#L527-L553
train
Format key descriptor
[ 30522, 3853, 4289, 14839, 6155, 23235, 2953, 1006, 4078, 23235, 2953, 1007, 1063, 13075, 8834, 16344, 1025, 2065, 1006, 19719, 1012, 4132, 1027, 1027, 1027, 1000, 6097, 1000, 1007, 1063, 8834, 16344, 1027, 4078, 23235, 2953, 1012, 5672, 100...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
LLK/scratch-blocks
blocks_vertical/control.js
function() { this.jsonInit({ "type": "control_if_else", "message0": Blockly.Msg.CONTROL_IF, "message1": "%1", "message2": Blockly.Msg.CONTROL_ELSE, "message3": "%1", "args0": [ { "type": "input_value", "name": "CONDITION", "check": "Boolean" } ], "args1": [ { "type": "input_statement", "name": "SUBSTACK" } ], "args3": [ { "type": "input_statement", "name": "SUBSTACK2" } ], "category": Blockly.Categories.control, "extensions": ["colours_control", "shape_statement"] }); }
javascript
function() { this.jsonInit({ "type": "control_if_else", "message0": Blockly.Msg.CONTROL_IF, "message1": "%1", "message2": Blockly.Msg.CONTROL_ELSE, "message3": "%1", "args0": [ { "type": "input_value", "name": "CONDITION", "check": "Boolean" } ], "args1": [ { "type": "input_statement", "name": "SUBSTACK" } ], "args3": [ { "type": "input_statement", "name": "SUBSTACK2" } ], "category": Blockly.Categories.control, "extensions": ["colours_control", "shape_statement"] }); }
[ "function", "(", ")", "{", "this", ".", "jsonInit", "(", "{", "\"type\"", ":", "\"control_if_else\"", ",", "\"message0\"", ":", "Blockly", ".", "Msg", ".", "CONTROL_IF", ",", "\"message1\"", ":", "\"%1\"", ",", "\"message2\"", ":", "Blockly", ".", "Msg", "...
Block for if-else. @this Blockly.Block
[ "Block", "for", "if", "-", "else", "." ]
455b2a854435c0a67da1da92320ddc3ec3e2b799
https://github.com/LLK/scratch-blocks/blob/455b2a854435c0a67da1da92320ddc3ec3e2b799/blocks_vertical/control.js#L140-L169
train
Block for .
[ 30522, 3853, 1006, 1007, 1063, 2023, 1012, 1046, 3385, 5498, 2102, 1006, 1063, 1000, 2828, 1000, 1024, 1000, 2491, 1035, 2065, 1035, 2842, 1000, 1010, 1000, 4471, 2692, 1000, 1024, 3796, 2135, 1012, 5796, 2290, 1012, 2491, 1035, 2065, 101...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
eslint/eslint
lib/rules/comma-spacing.js
validateCommaItemSpacing
function validateCommaItemSpacing(tokens, reportItem) { if (tokens.left && astUtils.isTokenOnSameLine(tokens.left, tokens.comma) && (options.before !== sourceCode.isSpaceBetweenTokens(tokens.left, tokens.comma)) ) { report(reportItem, "before", tokens.left); } if (tokens.right && astUtils.isClosingParenToken(tokens.right)) { return; } if (tokens.right && !options.after && tokens.right.type === "Line") { return; } if (tokens.right && astUtils.isTokenOnSameLine(tokens.comma, tokens.right) && (options.after !== sourceCode.isSpaceBetweenTokens(tokens.comma, tokens.right)) ) { report(reportItem, "after", tokens.right); } }
javascript
function validateCommaItemSpacing(tokens, reportItem) { if (tokens.left && astUtils.isTokenOnSameLine(tokens.left, tokens.comma) && (options.before !== sourceCode.isSpaceBetweenTokens(tokens.left, tokens.comma)) ) { report(reportItem, "before", tokens.left); } if (tokens.right && astUtils.isClosingParenToken(tokens.right)) { return; } if (tokens.right && !options.after && tokens.right.type === "Line") { return; } if (tokens.right && astUtils.isTokenOnSameLine(tokens.comma, tokens.right) && (options.after !== sourceCode.isSpaceBetweenTokens(tokens.comma, tokens.right)) ) { report(reportItem, "after", tokens.right); } }
[ "function", "validateCommaItemSpacing", "(", "tokens", ",", "reportItem", ")", "{", "if", "(", "tokens", ".", "left", "&&", "astUtils", ".", "isTokenOnSameLine", "(", "tokens", ".", "left", ",", "tokens", ".", "comma", ")", "&&", "(", "options", ".", "befo...
Validates the spacing around a comma token. @param {Object} tokens - The tokens to be validated. @param {Token} tokens.comma The token representing the comma. @param {Token} [tokens.left] The last token before the comma. @param {Token} [tokens.right] The first token after the comma. @param {Token|ASTNode} reportItem The item to use when reporting an error. @returns {void} @private
[ "Validates", "the", "spacing", "around", "a", "comma", "token", "." ]
bc0819c94aad14f7fad3cbc2338ea15658b0f272
https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/comma-spacing.js#L116-L136
train
Validate comma item spacing
[ 30522, 3853, 9398, 3686, 9006, 2863, 4221, 5244, 19498, 2075, 1006, 19204, 2015, 1010, 3189, 4221, 2213, 1007, 1063, 2065, 1006, 19204, 2015, 1012, 2187, 1004, 1004, 2004, 8525, 3775, 4877, 1012, 21541, 11045, 8540, 21559, 18809, 2063, 1006...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
vuejs/vue-cli
packages/@vue/cli-ui/apollo-server/connectors/projects.js
autoOpenLastProject
async function autoOpenLastProject () { const context = getContext() const id = context.db.get('config.lastOpenProject').value() if (id) { try { await open(id, context) } catch (e) { log(`Project can't be auto-opened`, id) } } }
javascript
async function autoOpenLastProject () { const context = getContext() const id = context.db.get('config.lastOpenProject').value() if (id) { try { await open(id, context) } catch (e) { log(`Project can't be auto-opened`, id) } } }
[ "async", "function", "autoOpenLastProject", "(", ")", "{", "const", "context", "=", "getContext", "(", ")", "const", "id", "=", "context", ".", "db", ".", "get", "(", "'config.lastOpenProject'", ")", ".", "value", "(", ")", "if", "(", "id", ")", "{", "...
Open last project
[ "Open", "last", "project" ]
206803cbefefdfbc7d8ed12440b0b751688b77b2
https://github.com/vuejs/vue-cli/blob/206803cbefefdfbc7d8ed12440b0b751688b77b2/packages/@vue/cli-ui/apollo-server/connectors/projects.js#L457-L467
train
Auto - opens the last project in the database
[ 30522, 2004, 6038, 2278, 3853, 8285, 26915, 8523, 25856, 3217, 20614, 1006, 1007, 1063, 9530, 3367, 6123, 1027, 2131, 8663, 18209, 1006, 1007, 9530, 3367, 8909, 1027, 6123, 1012, 16962, 1012, 2131, 1006, 1005, 9530, 8873, 2290, 1012, 2197, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
moment/luxon
src/datetime.js
fixOffset
function fixOffset(localTS, o, tz) { // Our UTC time is just a guess because our offset is just a guess let utcGuess = localTS - o * 60 * 1000; // Test whether the zone matches the offset for this ts const o2 = tz.offset(utcGuess); // If so, offset didn't change and we're done if (o === o2) { return [utcGuess, o]; } // If not, change the ts by the difference in the offset utcGuess -= (o2 - o) * 60 * 1000; // If that gives us the local time we want, we're done const o3 = tz.offset(utcGuess); if (o2 === o3) { return [utcGuess, o2]; } // If it's different, we're in a hole time. The offset has changed, but the we don't adjust the time return [localTS - Math.min(o2, o3) * 60 * 1000, Math.max(o2, o3)]; }
javascript
function fixOffset(localTS, o, tz) { // Our UTC time is just a guess because our offset is just a guess let utcGuess = localTS - o * 60 * 1000; // Test whether the zone matches the offset for this ts const o2 = tz.offset(utcGuess); // If so, offset didn't change and we're done if (o === o2) { return [utcGuess, o]; } // If not, change the ts by the difference in the offset utcGuess -= (o2 - o) * 60 * 1000; // If that gives us the local time we want, we're done const o3 = tz.offset(utcGuess); if (o2 === o3) { return [utcGuess, o2]; } // If it's different, we're in a hole time. The offset has changed, but the we don't adjust the time return [localTS - Math.min(o2, o3) * 60 * 1000, Math.max(o2, o3)]; }
[ "function", "fixOffset", "(", "localTS", ",", "o", ",", "tz", ")", "{", "// Our UTC time is just a guess because our offset is just a guess", "let", "utcGuess", "=", "localTS", "-", "o", "*", "60", "*", "1000", ";", "// Test whether the zone matches the offset for this ts...
find the right offset a given local time. The o input is our guess, which determines which offset we'll pick in ambiguous cases (e.g. there are two 3 AMs b/c Fallback DST)
[ "find", "the", "right", "offset", "a", "given", "local", "time", ".", "The", "o", "input", "is", "our", "guess", "which", "determines", "which", "offset", "we", "ll", "pick", "in", "ambiguous", "cases", "(", "e", ".", "g", ".", "there", "are", "two", ...
236f2badea297ee73421aa39a83e06177c1be6d0
https://github.com/moment/luxon/blob/236f2badea297ee73421aa39a83e06177c1be6d0/src/datetime.js#L75-L98
train
Fix the offset for the local time
[ 30522, 3853, 8081, 27475, 3388, 1006, 2334, 3215, 1010, 1051, 1010, 1056, 2480, 1007, 1063, 1013, 1013, 2256, 11396, 2051, 2003, 2074, 1037, 3984, 2138, 2256, 16396, 2003, 2074, 1037, 3984, 2292, 11396, 22967, 2015, 1027, 2334, 3215, 1011, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.core/src/sap/ui/model/odata/_AnnotationHelperBasics.js
function (oInterface, oRawValue) { var oAssociationEnd, sPath, sContextPath, iIndexOfAt, oModel = oInterface.getModel(), aParts, oResult = { associationSetEnd : undefined, navigationAfterMultiple : false, isMultiple : false, navigationProperties : [], resolvedPath : undefined }, sSegment, oType; Measurement.average(sPerformanceFollowPath, "", aPerformanceCategories); sPath = Basics.getPath(oRawValue); sContextPath = sPath !== undefined && Basics.getStartingPoint(oInterface, sPath); if (!sContextPath) { Measurement.end(sPerformanceFollowPath); return undefined; } aParts = sPath.split("/"); while (sPath && aParts.length && sContextPath) { sSegment = aParts[0]; iIndexOfAt = sSegment.indexOf("@"); if (iIndexOfAt === 0) { // term cast sContextPath += "/" + sSegment.slice(1); aParts.shift(); continue; // } else if (iIndexOfAt > 0) { // annotation of a navigation property // sSegment = sSegment.slice(0, iIndexOfAt); } oType = oModel.getObject(sContextPath); oAssociationEnd = oModel.getODataAssociationEnd(oType, sSegment); if (oAssociationEnd) { // navigation property oResult.associationSetEnd = oModel.getODataAssociationSetEnd(oType, sSegment); oResult.navigationProperties.push(sSegment); if (oResult.isMultiple) { oResult.navigationAfterMultiple = true; } oResult.isMultiple = oAssociationEnd.multiplicity === "*"; sContextPath = oModel.getODataEntityType(oAssociationEnd.type, true); aParts.shift(); continue; } // structural properties or some unsupported case sContextPath = oModel.getODataProperty(oType, aParts, true); } oResult.resolvedPath = sContextPath; Measurement.end(sPerformanceFollowPath); return oResult; }
javascript
function (oInterface, oRawValue) { var oAssociationEnd, sPath, sContextPath, iIndexOfAt, oModel = oInterface.getModel(), aParts, oResult = { associationSetEnd : undefined, navigationAfterMultiple : false, isMultiple : false, navigationProperties : [], resolvedPath : undefined }, sSegment, oType; Measurement.average(sPerformanceFollowPath, "", aPerformanceCategories); sPath = Basics.getPath(oRawValue); sContextPath = sPath !== undefined && Basics.getStartingPoint(oInterface, sPath); if (!sContextPath) { Measurement.end(sPerformanceFollowPath); return undefined; } aParts = sPath.split("/"); while (sPath && aParts.length && sContextPath) { sSegment = aParts[0]; iIndexOfAt = sSegment.indexOf("@"); if (iIndexOfAt === 0) { // term cast sContextPath += "/" + sSegment.slice(1); aParts.shift(); continue; // } else if (iIndexOfAt > 0) { // annotation of a navigation property // sSegment = sSegment.slice(0, iIndexOfAt); } oType = oModel.getObject(sContextPath); oAssociationEnd = oModel.getODataAssociationEnd(oType, sSegment); if (oAssociationEnd) { // navigation property oResult.associationSetEnd = oModel.getODataAssociationSetEnd(oType, sSegment); oResult.navigationProperties.push(sSegment); if (oResult.isMultiple) { oResult.navigationAfterMultiple = true; } oResult.isMultiple = oAssociationEnd.multiplicity === "*"; sContextPath = oModel.getODataEntityType(oAssociationEnd.type, true); aParts.shift(); continue; } // structural properties or some unsupported case sContextPath = oModel.getODataProperty(oType, aParts, true); } oResult.resolvedPath = sContextPath; Measurement.end(sPerformanceFollowPath); return oResult; }
[ "function", "(", "oInterface", ",", "oRawValue", ")", "{", "var", "oAssociationEnd", ",", "sPath", ",", "sContextPath", ",", "iIndexOfAt", ",", "oModel", "=", "oInterface", ".", "getModel", "(", ")", ",", "aParts", ",", "oResult", "=", "{", "associationSetEn...
Follows the dynamic "14.5.12 Expression edm:Path" (or variant thereof) contained within the given raw value, starting the absolute path identified by the given interface, and returns the resulting absolute path as well as some other aspects about the path. @param {sap.ui.core.util.XMLPreprocessor.IContext|sap.ui.model.Context} oInterface the callback interface related to the current formatter call; the path must be within a complex or entity type! @param {object} oRawValue the raw value from the meta model, e.g. <code>{AnnotationPath : "ToSupplier/@com.sap.vocabularies.Communication.v1.Address"}</code> or <code> {AnnotationPath : "@com.sap.vocabularies.UI.v1.FieldGroup#Dimensions"}</code>; embedded within an entity set or entity type @returns {object} - {object} [associationSetEnd=undefined] association set end corresponding to the last navigation property - {boolean} [navigationAfterMultiple=false] if the navigation path has an association end with multiplicity "*" which is not the last one - {boolean} [isMultiple=false] whether the navigation path ends with an association end with multiplicity "*" - {string[]} [navigationProperties=[]] all navigation property names - {string} [resolvedPath=undefined] the resulting absolute path @see sap.ui.model.odata.AnnotationHelper.getNavigationPath @see sap.ui.model.odata.AnnotationHelper.gotoEntitySet @see sap.ui.model.odata.AnnotationHelper.isMultiple @see sap.ui.model.odata.AnnotationHelper.resolvePath
[ "Follows", "the", "dynamic", "14", ".", "5", ".", "12", "Expression", "edm", ":", "Path", "(", "or", "variant", "thereof", ")", "contained", "within", "the", "given", "raw", "value", "starting", "the", "absolute", "path", "identified", "by", "the", "given"...
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/_AnnotationHelperBasics.js#L159-L220
train
Returns the value of the property
[ 30522, 3853, 1006, 1051, 18447, 2121, 12172, 1010, 2030, 10376, 10175, 5657, 1007, 1063, 13075, 1051, 30524, 15069, 1010, 2462, 13629, 2595, 11253, 4017, 1010, 18168, 10244, 2140, 1027, 1051, 18447, 2121, 12172, 1012, 2131, 5302, 9247, 1006, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
dcloudio/mui
examples/login/libs/easymob-webim-sdk/strophe-custom-2.0.0.js
function(message) { if (message.data.indexOf("<open ") === 0 || message.data.indexOf("<?xml") === 0) { // Strip the XML Declaration, if there is one var data = message.data.replace(/^(<\?.*?\?>\s*)*/, ""); if (data === '') return; var streamStart = new DOMParser().parseFromString(data, "text/xml").documentElement; this._conn.xmlInput(streamStart); this._conn.rawInput(message.data); //_handleStreamSteart will check for XML errors and disconnect on error if (this._handleStreamStart(streamStart)) { //_connect_cb will check for stream:error and disconnect on error this._connect_cb(streamStart); } } else if (message.data.indexOf("<close ") === 0) { //'<close xmlns="urn:ietf:params:xml:ns:xmpp-framing />') { this._conn.rawInput(message.data); this._conn.xmlInput(message); var see_uri = message.getAttribute("see-other-uri"); if (see_uri) { this._conn._changeConnectStatus(Strophe.Status.REDIRECT, "Received see-other-uri, resetting connection"); this._conn.reset(); this._conn.service = see_uri; this._connect(); } else { this._conn._changeConnectStatus(Strophe.Status.CONNFAIL, "Received closing stream"); this._conn._doDisconnect(); } } else { var string = this._streamWrap(message.data); var elem = new DOMParser().parseFromString(string, "text/xml").documentElement; this.socket.onmessage = this._onMessage.bind(this); this._conn._connect_cb(elem, null, message.data); } }
javascript
function(message) { if (message.data.indexOf("<open ") === 0 || message.data.indexOf("<?xml") === 0) { // Strip the XML Declaration, if there is one var data = message.data.replace(/^(<\?.*?\?>\s*)*/, ""); if (data === '') return; var streamStart = new DOMParser().parseFromString(data, "text/xml").documentElement; this._conn.xmlInput(streamStart); this._conn.rawInput(message.data); //_handleStreamSteart will check for XML errors and disconnect on error if (this._handleStreamStart(streamStart)) { //_connect_cb will check for stream:error and disconnect on error this._connect_cb(streamStart); } } else if (message.data.indexOf("<close ") === 0) { //'<close xmlns="urn:ietf:params:xml:ns:xmpp-framing />') { this._conn.rawInput(message.data); this._conn.xmlInput(message); var see_uri = message.getAttribute("see-other-uri"); if (see_uri) { this._conn._changeConnectStatus(Strophe.Status.REDIRECT, "Received see-other-uri, resetting connection"); this._conn.reset(); this._conn.service = see_uri; this._connect(); } else { this._conn._changeConnectStatus(Strophe.Status.CONNFAIL, "Received closing stream"); this._conn._doDisconnect(); } } else { var string = this._streamWrap(message.data); var elem = new DOMParser().parseFromString(string, "text/xml").documentElement; this.socket.onmessage = this._onMessage.bind(this); this._conn._connect_cb(elem, null, message.data); } }
[ "function", "(", "message", ")", "{", "if", "(", "message", ".", "data", ".", "indexOf", "(", "\"<open \"", ")", "===", "0", "||", "message", ".", "data", ".", "indexOf", "(", "\"<?xml\"", ")", "===", "0", ")", "{", "// Strip the XML Declaration, if there ...
PrivateFunction: _connect_cb_wrapper _Private_ function that handles the first connection messages. On receiving an opening stream tag this callback replaces itself with the real message handler. On receiving a stream error the connection is terminated.
[ "PrivateFunction", ":", "_connect_cb_wrapper", "_Private_", "function", "that", "handles", "the", "first", "connection", "messages", "." ]
ff74c90a1671a552f3604b1288bf38a4126312d0
https://github.com/dcloudio/mui/blob/ff74c90a1671a552f3604b1288bf38a4126312d0/examples/login/libs/easymob-webim-sdk/strophe-custom-2.0.0.js#L4930-L4964
train
Handle message from the device
[ 30522, 3853, 1006, 4471, 1007, 1063, 2065, 1006, 4471, 1012, 2951, 1012, 5950, 11253, 1006, 1000, 1026, 2330, 1000, 1007, 1027, 1027, 1027, 1014, 1064, 1064, 4471, 1012, 2951, 1012, 5950, 11253, 1006, 1000, 1026, 1029, 20950, 1000, 1007, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.core/src/sap/ui/thirdparty/RequestRecorder.js
function() { _private.oLog.info(sModuleName + " - Stop"); var mHarContent = null; if (_private.isRecordStarted()) { mHarContent = _private.getHarContent(true); } // do this for a full cleanup _private.init(); return mHarContent; }
javascript
function() { _private.oLog.info(sModuleName + " - Stop"); var mHarContent = null; if (_private.isRecordStarted()) { mHarContent = _private.getHarContent(true); } // do this for a full cleanup _private.init(); return mHarContent; }
[ "function", "(", ")", "{", "_private", ".", "oLog", ".", "info", "(", "sModuleName", "+", "\" - Stop\"", ")", ";", "var", "mHarContent", "=", "null", ";", "if", "(", "_private", ".", "isRecordStarted", "(", ")", ")", "{", "mHarContent", "=", "_private", ...
Stops the recording or the player. If downloading is not disabled, the har file is downloaded automatically. @returns {Object|null} In record mode the har file is returned as json, otherwise null is returned.
[ "Stops", "the", "recording", "or", "the", "player", ".", "If", "downloading", "is", "not", "disabled", "the", "har", "file", "is", "downloaded", "automatically", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/thirdparty/RequestRecorder.js#L736-L747
train
Stop the record
[ 30522, 3853, 1006, 1007, 1063, 1035, 2797, 1012, 19330, 8649, 1012, 18558, 1006, 15488, 7716, 9307, 18442, 1009, 1000, 1011, 2644, 1000, 1007, 1025, 13075, 1049, 8167, 8663, 6528, 2102, 1027, 19701, 1025, 2065, 1006, 1035, 2797, 1012, 2003,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
eslint/eslint
lib/rules/no-constant-condition.js
reportIfConstant
function reportIfConstant(node) { if (node.test && isConstant(node.test, true)) { context.report({ node: node.test, messageId: "unexpected" }); } }
javascript
function reportIfConstant(node) { if (node.test && isConstant(node.test, true)) { context.report({ node: node.test, messageId: "unexpected" }); } }
[ "function", "reportIfConstant", "(", "node", ")", "{", "if", "(", "node", ".", "test", "&&", "isConstant", "(", "node", ".", "test", ",", "true", ")", ")", "{", "context", ".", "report", "(", "{", "node", ":", "node", ".", "test", ",", "messageId", ...
Reports when the given node contains a constant condition. @param {ASTNode} node The AST node to check. @returns {void} @private
[ "Reports", "when", "the", "given", "node", "contains", "a", "constant", "condition", "." ]
bc0819c94aad14f7fad3cbc2338ea15658b0f272
https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/no-constant-condition.js#L179-L183
train
Reports if node is constant
[ 30522, 3853, 3189, 10128, 8663, 12693, 2102, 1006, 13045, 1007, 1063, 2065, 1006, 13045, 1012, 3231, 1004, 1004, 2003, 8663, 12693, 2102, 1006, 13045, 1012, 3231, 1010, 2995, 1007, 1007, 1063, 6123, 1012, 3189, 1006, 1063, 13045, 1024, 1304...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.core/src/sap/ui/thirdparty/jszip.js
function(name) { // Check the name ends with a / if (name.slice(-1) != "/") { name += "/"; // IE doesn't like substr(-1) } // Does this folder already exist? if (!this.files[name]) { fileAdd.call(this, name, null, { dir: true }); } return this.files[name]; }
javascript
function(name) { // Check the name ends with a / if (name.slice(-1) != "/") { name += "/"; // IE doesn't like substr(-1) } // Does this folder already exist? if (!this.files[name]) { fileAdd.call(this, name, null, { dir: true }); } return this.files[name]; }
[ "function", "(", "name", ")", "{", "// Check the name ends with a /", "if", "(", "name", ".", "slice", "(", "-", "1", ")", "!=", "\"/\"", ")", "{", "name", "+=", "\"/\"", ";", "// IE doesn't like substr(-1)", "}", "// Does this folder already exist?", "if", "(",...
Add a (sub) folder in the current folder. @private @param {string} name the folder's name @return {Object} the new folder.
[ "Add", "a", "(", "sub", ")", "folder", "in", "the", "current", "folder", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/thirdparty/jszip.js#L626-L639
train
Get the file for a specific resource
[ 30522, 3853, 1006, 2171, 1007, 1063, 1013, 1013, 4638, 1996, 2171, 4515, 2007, 1037, 1013, 30524, 1027, 1000, 1013, 1000, 1025, 1013, 1013, 29464, 2987, 1005, 1056, 2066, 4942, 3367, 2099, 1006, 1011, 1015, 1007, 1065, 1013, 1013, 2515, 2...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.commons/src/sap/ui/commons/Tree.js
restoreSelectedChildren
function restoreSelectedChildren(oNode, aExpandingParents, oFirstCollapsedParent) { var bIsExpanded = oNode.getExpanded(), bNodeReferredInParents = false, bIncludeInExpandingParents = bIsExpanded && !!oNode.getSelectedForNodes().length, oFirstCollapsedParentNode = (oFirstCollapsedParent || bIsExpanded) ? oFirstCollapsedParent : oNode, i; //check if any of the expanded parents, that have references, refers the current node //if so - remove the reference for (i = 0; i < aExpandingParents.length; i++) { if (aExpandingParents[i].getSelectedForNodes().indexOf(oNode.getId()) !== -1) { bNodeReferredInParents = true; aExpandingParents[i].removeAssociation("selectedForNodes", oNode, true); } } //if the node is referred somewhere in its parents and it has a collapsed parent //add a reference to the node in the first collapsed parent (if it is not already there) if (oFirstCollapsedParentNode && bNodeReferredInParents && oFirstCollapsedParentNode !== oNode) { if (oFirstCollapsedParentNode.getSelectedForNodes().indexOf(oNode.getId()) === -1) { oFirstCollapsedParentNode.addAssociation("selectedForNodes", oNode, true); } oFirstCollapsedParentNode.$().addClass('sapUiTreeNodeSelectedParent'); } //include the node in the expanding parents only if it has references to selected child nodes if (bIncludeInExpandingParents) { aExpandingParents.push(oNode); } var aNodes = oNode._getNodes(); for (i = 0; i < aNodes.length; i++) { restoreSelectedChildren(aNodes[i], aExpandingParents, oFirstCollapsedParentNode); } //exclude the node from the expanding parents if (bIncludeInExpandingParents) { aExpandingParents.pop(oNode); } }
javascript
function restoreSelectedChildren(oNode, aExpandingParents, oFirstCollapsedParent) { var bIsExpanded = oNode.getExpanded(), bNodeReferredInParents = false, bIncludeInExpandingParents = bIsExpanded && !!oNode.getSelectedForNodes().length, oFirstCollapsedParentNode = (oFirstCollapsedParent || bIsExpanded) ? oFirstCollapsedParent : oNode, i; //check if any of the expanded parents, that have references, refers the current node //if so - remove the reference for (i = 0; i < aExpandingParents.length; i++) { if (aExpandingParents[i].getSelectedForNodes().indexOf(oNode.getId()) !== -1) { bNodeReferredInParents = true; aExpandingParents[i].removeAssociation("selectedForNodes", oNode, true); } } //if the node is referred somewhere in its parents and it has a collapsed parent //add a reference to the node in the first collapsed parent (if it is not already there) if (oFirstCollapsedParentNode && bNodeReferredInParents && oFirstCollapsedParentNode !== oNode) { if (oFirstCollapsedParentNode.getSelectedForNodes().indexOf(oNode.getId()) === -1) { oFirstCollapsedParentNode.addAssociation("selectedForNodes", oNode, true); } oFirstCollapsedParentNode.$().addClass('sapUiTreeNodeSelectedParent'); } //include the node in the expanding parents only if it has references to selected child nodes if (bIncludeInExpandingParents) { aExpandingParents.push(oNode); } var aNodes = oNode._getNodes(); for (i = 0; i < aNodes.length; i++) { restoreSelectedChildren(aNodes[i], aExpandingParents, oFirstCollapsedParentNode); } //exclude the node from the expanding parents if (bIncludeInExpandingParents) { aExpandingParents.pop(oNode); } }
[ "function", "restoreSelectedChildren", "(", "oNode", ",", "aExpandingParents", ",", "oFirstCollapsedParent", ")", "{", "var", "bIsExpanded", "=", "oNode", ".", "getExpanded", "(", ")", ",", "bNodeReferredInParents", "=", "false", ",", "bIncludeInExpandingParents", "="...
Removes the references inside the expanded node of its selected children, because they are no longer needed. @param {sap.ui.commons.TreeNode} oNode The current node to look at @param {object} aExpandingParents Array of parents of the current node that have selectedForNodes references @param {sap.ui.commons.TreeNode} oFirstCollapsedParent The topmost collapsed parent node of the current node
[ "Removes", "the", "references", "inside", "the", "expanded", "node", "of", "its", "selected", "children", "because", "they", "are", "no", "longer", "needed", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.commons/src/sap/ui/commons/Tree.js#L518-L557
train
Restores the selected children of the given node
[ 30522, 3853, 9239, 11246, 22471, 2098, 19339, 7389, 1006, 21058, 3207, 1010, 29347, 2595, 9739, 4667, 19362, 11187, 1010, 1997, 18894, 13535, 14511, 9331, 6924, 19362, 4765, 1007, 1063, 13075, 20377, 10288, 9739, 5732, 1027, 21058, 3207, 1012...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
wuchangming/spy-debugger
buildin_modules/weinre/web/interfaces/interfaces.js
getJavaType
function getJavaType(type) { var result if (-1 == NativeTypes.indexOf(type.name)) { result = "<a href='javascript:showInterface(\"" + type.name + "\"); void(0);'>" + type.name + "</a>" } else { result = IDL2Java[type.name] if (!result) { result = "?" + type.name + "?" console.log("Unable to translate IDL type to Java: " + type.name) } } for (var i=0; i<type.rank; i++) { result += "[]" } return "<span class='type'>" + result + "</span>" }
javascript
function getJavaType(type) { var result if (-1 == NativeTypes.indexOf(type.name)) { result = "<a href='javascript:showInterface(\"" + type.name + "\"); void(0);'>" + type.name + "</a>" } else { result = IDL2Java[type.name] if (!result) { result = "?" + type.name + "?" console.log("Unable to translate IDL type to Java: " + type.name) } } for (var i=0; i<type.rank; i++) { result += "[]" } return "<span class='type'>" + result + "</span>" }
[ "function", "getJavaType", "(", "type", ")", "{", "var", "result", "if", "(", "-", "1", "==", "NativeTypes", ".", "indexOf", "(", "type", ".", "name", ")", ")", "{", "result", "=", "\"<a href='javascript:showInterface(\\\"\"", "+", "type", ".", "name", "+"...
-----------------------------------------------------------------------------
[ "-----------------------------------------------------------------------------" ]
55c1dda0dff0c44920673711656ddfd7ff03c307
https://github.com/wuchangming/spy-debugger/blob/55c1dda0dff0c44920673711656ddfd7ff03c307/buildin_modules/weinre/web/interfaces/interfaces.js#L237-L257
train
Get Java type
[ 30522, 3853, 2131, 3900, 22879, 18863, 1006, 2828, 1007, 1063, 13075, 2765, 2065, 1006, 1011, 1015, 1027, 1027, 3128, 13874, 2015, 1012, 5950, 11253, 1006, 2828, 1012, 2171, 1007, 1007, 1063, 2765, 1027, 1000, 1026, 1037, 17850, 12879, 1027...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
LLK/scratch-blocks
blocks_vertical/data.js
function(options) { var fieldName = 'VARIABLE'; if (this.isCollapsed()) { return; } var currentVarName = this.getField(fieldName).text_; if (!this.isInFlyout) { var variablesList = this.workspace.getVariablesOfType(''); variablesList.sort(function(a, b) { return Blockly.scratchBlocksUtils.compareStrings(a.name, b.name); }); for (var i = 0; i < variablesList.length; i++) { var varName = variablesList[i].name; if (varName == currentVarName) continue; var option = {enabled: true}; option.text = varName; option.callback = Blockly.Constants.Data.VARIABLE_OPTION_CALLBACK_FACTORY(this, variablesList[i].getId(), fieldName); options.push(option); } } else { var renameOption = { text: Blockly.Msg.RENAME_VARIABLE, enabled: true, callback: Blockly.Constants.Data.RENAME_OPTION_CALLBACK_FACTORY(this, fieldName) }; var deleteOption = { text: Blockly.Msg.DELETE_VARIABLE.replace('%1', currentVarName), enabled: true, callback: Blockly.Constants.Data.DELETE_OPTION_CALLBACK_FACTORY(this, fieldName) }; options.push(renameOption); options.push(deleteOption); } }
javascript
function(options) { var fieldName = 'VARIABLE'; if (this.isCollapsed()) { return; } var currentVarName = this.getField(fieldName).text_; if (!this.isInFlyout) { var variablesList = this.workspace.getVariablesOfType(''); variablesList.sort(function(a, b) { return Blockly.scratchBlocksUtils.compareStrings(a.name, b.name); }); for (var i = 0; i < variablesList.length; i++) { var varName = variablesList[i].name; if (varName == currentVarName) continue; var option = {enabled: true}; option.text = varName; option.callback = Blockly.Constants.Data.VARIABLE_OPTION_CALLBACK_FACTORY(this, variablesList[i].getId(), fieldName); options.push(option); } } else { var renameOption = { text: Blockly.Msg.RENAME_VARIABLE, enabled: true, callback: Blockly.Constants.Data.RENAME_OPTION_CALLBACK_FACTORY(this, fieldName) }; var deleteOption = { text: Blockly.Msg.DELETE_VARIABLE.replace('%1', currentVarName), enabled: true, callback: Blockly.Constants.Data.DELETE_OPTION_CALLBACK_FACTORY(this, fieldName) }; options.push(renameOption); options.push(deleteOption); } }
[ "function", "(", "options", ")", "{", "var", "fieldName", "=", "'VARIABLE'", ";", "if", "(", "this", ".", "isCollapsed", "(", ")", ")", "{", "return", ";", "}", "var", "currentVarName", "=", "this", ".", "getField", "(", "fieldName", ")", ".", "text_",...
Add context menu option to change the selected variable. @param {!Array} options List of menu options to add to. @this Blockly.Block
[ "Add", "context", "menu", "option", "to", "change", "the", "selected", "variable", "." ]
455b2a854435c0a67da1da92320ddc3ec3e2b799
https://github.com/LLK/scratch-blocks/blob/455b2a854435c0a67da1da92320ddc3ec3e2b799/blocks_vertical/data.js#L516-L554
train
Add variable option to options array.
[ 30522, 3853, 1006, 7047, 1007, 1063, 13075, 2492, 18442, 1027, 1005, 8023, 1005, 1025, 2065, 1006, 2023, 1012, 2003, 26895, 9331, 6924, 1006, 1007, 1007, 1063, 2709, 1025, 1065, 13075, 2783, 10755, 18442, 1027, 2023, 1012, 2131, 3790, 1006,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
angular/material
src/components/autocomplete/js/autocompleteController.js
handleQuery
function handleQuery () { var searchText = $scope.searchText || ''; var term = searchText.toLowerCase(); // If caching is enabled and the current searchText is stored in the cache if (!$scope.noCache && cache[term]) { // The results should be handled as same as a normal un-cached request does. handleResults(cache[term]); } else { fetchResults(searchText); } ctrl.hidden = shouldHide(); }
javascript
function handleQuery () { var searchText = $scope.searchText || ''; var term = searchText.toLowerCase(); // If caching is enabled and the current searchText is stored in the cache if (!$scope.noCache && cache[term]) { // The results should be handled as same as a normal un-cached request does. handleResults(cache[term]); } else { fetchResults(searchText); } ctrl.hidden = shouldHide(); }
[ "function", "handleQuery", "(", ")", "{", "var", "searchText", "=", "$scope", ".", "searchText", "||", "''", ";", "var", "term", "=", "searchText", ".", "toLowerCase", "(", ")", ";", "// If caching is enabled and the current searchText is stored in the cache", "if", ...
Starts the query to gather the results for the current searchText. Attempts to return cached results first, then forwards the process to `fetchResults` if necessary.
[ "Starts", "the", "query", "to", "gather", "the", "results", "for", "the", "current", "searchText", ".", "Attempts", "to", "return", "cached", "results", "first", "then", "forwards", "the", "process", "to", "fetchResults", "if", "necessary", "." ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/autocomplete/js/autocompleteController.js#L1023-L1036
train
Handle a query
[ 30522, 3853, 5047, 4226, 2854, 1006, 1007, 1063, 13075, 3945, 18209, 1027, 1002, 9531, 1012, 3945, 18209, 1064, 1064, 1005, 1005, 1025, 13075, 2744, 1027, 3945, 18209, 1012, 2000, 27663, 18992, 3366, 1006, 1007, 1025, 1013, 1013, 2065, 6187...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
ColorlibHQ/AdminLTE
bower_components/select2/src/js/select2/i18n/uk.js
ending
function ending (count, one, couple, more) { if (count % 100 > 10 && count % 100 < 15) { return more; } if (count % 10 === 1) { return one; } if (count % 10 > 1 && count % 10 < 5) { return couple; } return more; }
javascript
function ending (count, one, couple, more) { if (count % 100 > 10 && count % 100 < 15) { return more; } if (count % 10 === 1) { return one; } if (count % 10 > 1 && count % 10 < 5) { return couple; } return more; }
[ "function", "ending", "(", "count", ",", "one", ",", "couple", ",", "more", ")", "{", "if", "(", "count", "%", "100", ">", "10", "&&", "count", "%", "100", "<", "15", ")", "{", "return", "more", ";", "}", "if", "(", "count", "%", "10", "===", ...
Ukranian
[ "Ukranian" ]
19113c3cbc19a7afe0cfd3158d647064d2d30661
https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/bower_components/select2/src/js/select2/i18n/uk.js#L3-L14
train
returns the last element of the array
[ 30522, 3853, 4566, 1006, 4175, 1010, 2028, 1010, 3232, 1010, 2062, 1007, 1063, 2065, 1006, 4175, 1003, 2531, 1028, 2184, 1004, 1004, 4175, 1003, 2531, 1026, 2321, 1007, 1063, 2709, 2062, 1025, 1065, 2065, 1006, 4175, 1003, 2184, 1027, 102...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
nhn/tui.editor
src/js/extensions/chart/chart.js
_parseCode2DataAndOptions
function _parseCode2DataAndOptions(dataCode, optionCode) { const data = parseDSV2ChartData(dataCode); const options = parseCode2ChartOption(optionCode); return { data, options }; }
javascript
function _parseCode2DataAndOptions(dataCode, optionCode) { const data = parseDSV2ChartData(dataCode); const options = parseCode2ChartOption(optionCode); return { data, options }; }
[ "function", "_parseCode2DataAndOptions", "(", "dataCode", ",", "optionCode", ")", "{", "const", "data", "=", "parseDSV2ChartData", "(", "dataCode", ")", ";", "const", "options", "=", "parseCode2ChartOption", "(", "optionCode", ")", ";", "return", "{", "data", ",...
parse codes to chart data & options Object @param {string} dataCode - code block containing chart data @param {string} optionCode - code block containing chart options @returns {Object} - tui.chart data & options @see https://nhn.github.io/tui.chart/latest/tui.chart.html @ignore
[ "parse", "codes", "to", "chart", "data", "&", "options", "Object" ]
e75ab08c2a7ab07d1143e318f7cde135c5e3002e
https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/extensions/chart/chart.js#L102-L110
train
Parse data and options from chart code
[ 30522, 3853, 1035, 11968, 3366, 16044, 2475, 2850, 2696, 28574, 16790, 2015, 1006, 2951, 16044, 1010, 5724, 16044, 1007, 1063, 9530, 3367, 2951, 1027, 11968, 6924, 2015, 2615, 2475, 7507, 5339, 2850, 2696, 1006, 2951, 16044, 1007, 1025, 953...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
angular/material
src/components/menu/js/menuServiceProvider.js
onShow
function onShow(scope, element, opts) { sanitizeAndConfigure(opts); if (opts.menuContentEl[0]) { // Inherit the theme from the target element. $mdTheming.inherit(opts.menuContentEl, opts.target); } else { $log.warn( '$mdMenu: Menu elements should always contain a `md-menu-content` element,' + 'otherwise interactivity features will not work properly.', element ); } // Register various listeners to move menu on resize/orientation change opts.cleanupResizing = startRepositioningOnResize(); opts.hideBackdrop = showBackdrop(scope, element, opts); // Return the promise for when our menu is done animating in return showMenu() .then(function(response) { opts.alreadyOpen = true; opts.cleanupInteraction = activateInteraction(); opts.cleanupBackdrop = setupBackdrop(); // Since the menu finished its animation, mark the menu as clickable. element.addClass('md-clickable'); return response; }); /** * Place the menu into the DOM and call positioning related functions */ function showMenu() { opts.parent.append(element); element[0].style.display = ''; return $q(function(resolve) { var position = calculateMenuPosition(element, opts); element.removeClass('md-leave'); // Animate the menu scaling, and opacity [from its position origin (default == top-left)] // to normal scale. $animateCss(element, { addClass: 'md-active', from: animator.toCss(position), to: animator.toCss({transform: ''}) }) .start() .then(resolve); }); } /** * Check for valid opts and set some sane defaults */ function sanitizeAndConfigure() { if (!opts.target) { throw Error( '$mdMenu.show() expected a target to animate from in options.target' ); } angular.extend(opts, { alreadyOpen: false, isRemoved: false, target: angular.element(opts.target), // make sure it's not a naked DOM node parent: angular.element(opts.parent), menuContentEl: angular.element(element[0].querySelector('md-menu-content')) }); } /** * Configure various resize listeners for screen changes */ function startRepositioningOnResize() { var repositionMenu = (function(target, options) { return $$rAF.throttle(function() { if (opts.isRemoved) return; var position = calculateMenuPosition(target, options); target.css(animator.toCss(position)); }); })(element, opts); $window.addEventListener('resize', repositionMenu); $window.addEventListener('orientationchange', repositionMenu); return function stopRepositioningOnResize() { // Disable resizing handlers $window.removeEventListener('resize', repositionMenu); $window.removeEventListener('orientationchange', repositionMenu); }; } /** * Sets up the backdrop and listens for click elements. * Once the backdrop will be clicked, the menu will automatically close. * @returns {!Function} Function to remove the backdrop. */ function setupBackdrop() { if (!opts.backdrop) return angular.noop; opts.backdrop.on('click', onBackdropClick); return function() { opts.backdrop.off('click', onBackdropClick); }; } /** * Function to be called whenever the backdrop is clicked. * @param {!MouseEvent} event */ function onBackdropClick(event) { event.preventDefault(); event.stopPropagation(); scope.$apply(function() { opts.mdMenuCtrl.close(true, { closeAll: true }); }); } /** * Activate interaction on the menu. Resolves the focus target and closes the menu on * escape or option click. * @returns {!Function} Function to deactivate the interaction listeners. */ function activateInteraction() { if (!opts.menuContentEl[0]) return angular.noop; // Wire up keyboard listeners. // - Close on escape, // - focus next item on down arrow, // - focus prev item on up opts.menuContentEl.on('keydown', onMenuKeyDown); opts.menuContentEl[0].addEventListener('click', captureClickListener, true); // kick off initial focus in the menu on the first enabled element var focusTarget = opts.menuContentEl[0] .querySelector(prefixer.buildSelector(['md-menu-focus-target', 'md-autofocus'])); if (!focusTarget) { var childrenLen = opts.menuContentEl[0].children.length; for (var childIndex = 0; childIndex < childrenLen; childIndex++) { var child = opts.menuContentEl[0].children[childIndex]; focusTarget = child.querySelector('.md-button:not([disabled])'); if (focusTarget) { break; } if (child.firstElementChild && !child.firstElementChild.disabled) { focusTarget = child.firstElementChild; break; } } } focusTarget && focusTarget.focus(); return function cleanupInteraction() { opts.menuContentEl.off('keydown', onMenuKeyDown); opts.menuContentEl[0].removeEventListener('click', captureClickListener, true); }; // ************************************ // internal functions // ************************************ function onMenuKeyDown(ev) { var handled; switch (ev.keyCode) { case $mdConstant.KEY_CODE.ESCAPE: opts.mdMenuCtrl.close(false, { closeAll: true }); handled = true; break; case $mdConstant.KEY_CODE.TAB: opts.mdMenuCtrl.close(false, { closeAll: true }); // Don't prevent default or stop propagation on this event as we want tab // to move the focus to the next focusable element on the page. handled = false; break; case $mdConstant.KEY_CODE.UP_ARROW: if (!focusMenuItem(ev, opts.menuContentEl, opts, -1) && !opts.nestLevel) { opts.mdMenuCtrl.triggerContainerProxy(ev); } handled = true; break; case $mdConstant.KEY_CODE.DOWN_ARROW: if (!focusMenuItem(ev, opts.menuContentEl, opts, 1) && !opts.nestLevel) { opts.mdMenuCtrl.triggerContainerProxy(ev); } handled = true; break; case $mdConstant.KEY_CODE.LEFT_ARROW: if (opts.nestLevel) { opts.mdMenuCtrl.close(); } else { opts.mdMenuCtrl.triggerContainerProxy(ev); } handled = true; break; case $mdConstant.KEY_CODE.RIGHT_ARROW: var parentMenu = $mdUtil.getClosest(ev.target, 'MD-MENU'); if (parentMenu && parentMenu != opts.parent[0]) { ev.target.click(); } else { opts.mdMenuCtrl.triggerContainerProxy(ev); } handled = true; break; } if (handled) { ev.preventDefault(); ev.stopImmediatePropagation(); } } function onBackdropClick(e) { e.preventDefault(); e.stopPropagation(); scope.$apply(function() { opts.mdMenuCtrl.close(true, { closeAll: true }); }); } // Close menu on menu item click, if said menu-item is not disabled function captureClickListener(e) { var target = e.target; // Traverse up the event until we get to the menuContentEl to see if // there is an ng-click and that the ng-click is not disabled do { if (target == opts.menuContentEl[0]) return; if ((hasAnyAttribute(target, ['ng-click', 'ng-href', 'ui-sref']) || target.nodeName == 'BUTTON' || target.nodeName == 'MD-BUTTON') && !hasAnyAttribute(target, ['md-prevent-menu-close'])) { var closestMenu = $mdUtil.getClosest(target, 'MD-MENU'); if (!target.hasAttribute('disabled') && (!closestMenu || closestMenu == opts.parent[0])) { close(); } break; } } while (target = target.parentNode); function close() { scope.$apply(function() { opts.mdMenuCtrl.close(true, { closeAll: true }); }); } function hasAnyAttribute(target, attrs) { if (!target) return false; for (var i = 0, attr; attr = attrs[i]; ++i) { if (prefixer.hasAttribute(target, attr)) { return true; } } return false; } } } }
javascript
function onShow(scope, element, opts) { sanitizeAndConfigure(opts); if (opts.menuContentEl[0]) { // Inherit the theme from the target element. $mdTheming.inherit(opts.menuContentEl, opts.target); } else { $log.warn( '$mdMenu: Menu elements should always contain a `md-menu-content` element,' + 'otherwise interactivity features will not work properly.', element ); } // Register various listeners to move menu on resize/orientation change opts.cleanupResizing = startRepositioningOnResize(); opts.hideBackdrop = showBackdrop(scope, element, opts); // Return the promise for when our menu is done animating in return showMenu() .then(function(response) { opts.alreadyOpen = true; opts.cleanupInteraction = activateInteraction(); opts.cleanupBackdrop = setupBackdrop(); // Since the menu finished its animation, mark the menu as clickable. element.addClass('md-clickable'); return response; }); /** * Place the menu into the DOM and call positioning related functions */ function showMenu() { opts.parent.append(element); element[0].style.display = ''; return $q(function(resolve) { var position = calculateMenuPosition(element, opts); element.removeClass('md-leave'); // Animate the menu scaling, and opacity [from its position origin (default == top-left)] // to normal scale. $animateCss(element, { addClass: 'md-active', from: animator.toCss(position), to: animator.toCss({transform: ''}) }) .start() .then(resolve); }); } /** * Check for valid opts and set some sane defaults */ function sanitizeAndConfigure() { if (!opts.target) { throw Error( '$mdMenu.show() expected a target to animate from in options.target' ); } angular.extend(opts, { alreadyOpen: false, isRemoved: false, target: angular.element(opts.target), // make sure it's not a naked DOM node parent: angular.element(opts.parent), menuContentEl: angular.element(element[0].querySelector('md-menu-content')) }); } /** * Configure various resize listeners for screen changes */ function startRepositioningOnResize() { var repositionMenu = (function(target, options) { return $$rAF.throttle(function() { if (opts.isRemoved) return; var position = calculateMenuPosition(target, options); target.css(animator.toCss(position)); }); })(element, opts); $window.addEventListener('resize', repositionMenu); $window.addEventListener('orientationchange', repositionMenu); return function stopRepositioningOnResize() { // Disable resizing handlers $window.removeEventListener('resize', repositionMenu); $window.removeEventListener('orientationchange', repositionMenu); }; } /** * Sets up the backdrop and listens for click elements. * Once the backdrop will be clicked, the menu will automatically close. * @returns {!Function} Function to remove the backdrop. */ function setupBackdrop() { if (!opts.backdrop) return angular.noop; opts.backdrop.on('click', onBackdropClick); return function() { opts.backdrop.off('click', onBackdropClick); }; } /** * Function to be called whenever the backdrop is clicked. * @param {!MouseEvent} event */ function onBackdropClick(event) { event.preventDefault(); event.stopPropagation(); scope.$apply(function() { opts.mdMenuCtrl.close(true, { closeAll: true }); }); } /** * Activate interaction on the menu. Resolves the focus target and closes the menu on * escape or option click. * @returns {!Function} Function to deactivate the interaction listeners. */ function activateInteraction() { if (!opts.menuContentEl[0]) return angular.noop; // Wire up keyboard listeners. // - Close on escape, // - focus next item on down arrow, // - focus prev item on up opts.menuContentEl.on('keydown', onMenuKeyDown); opts.menuContentEl[0].addEventListener('click', captureClickListener, true); // kick off initial focus in the menu on the first enabled element var focusTarget = opts.menuContentEl[0] .querySelector(prefixer.buildSelector(['md-menu-focus-target', 'md-autofocus'])); if (!focusTarget) { var childrenLen = opts.menuContentEl[0].children.length; for (var childIndex = 0; childIndex < childrenLen; childIndex++) { var child = opts.menuContentEl[0].children[childIndex]; focusTarget = child.querySelector('.md-button:not([disabled])'); if (focusTarget) { break; } if (child.firstElementChild && !child.firstElementChild.disabled) { focusTarget = child.firstElementChild; break; } } } focusTarget && focusTarget.focus(); return function cleanupInteraction() { opts.menuContentEl.off('keydown', onMenuKeyDown); opts.menuContentEl[0].removeEventListener('click', captureClickListener, true); }; // ************************************ // internal functions // ************************************ function onMenuKeyDown(ev) { var handled; switch (ev.keyCode) { case $mdConstant.KEY_CODE.ESCAPE: opts.mdMenuCtrl.close(false, { closeAll: true }); handled = true; break; case $mdConstant.KEY_CODE.TAB: opts.mdMenuCtrl.close(false, { closeAll: true }); // Don't prevent default or stop propagation on this event as we want tab // to move the focus to the next focusable element on the page. handled = false; break; case $mdConstant.KEY_CODE.UP_ARROW: if (!focusMenuItem(ev, opts.menuContentEl, opts, -1) && !opts.nestLevel) { opts.mdMenuCtrl.triggerContainerProxy(ev); } handled = true; break; case $mdConstant.KEY_CODE.DOWN_ARROW: if (!focusMenuItem(ev, opts.menuContentEl, opts, 1) && !opts.nestLevel) { opts.mdMenuCtrl.triggerContainerProxy(ev); } handled = true; break; case $mdConstant.KEY_CODE.LEFT_ARROW: if (opts.nestLevel) { opts.mdMenuCtrl.close(); } else { opts.mdMenuCtrl.triggerContainerProxy(ev); } handled = true; break; case $mdConstant.KEY_CODE.RIGHT_ARROW: var parentMenu = $mdUtil.getClosest(ev.target, 'MD-MENU'); if (parentMenu && parentMenu != opts.parent[0]) { ev.target.click(); } else { opts.mdMenuCtrl.triggerContainerProxy(ev); } handled = true; break; } if (handled) { ev.preventDefault(); ev.stopImmediatePropagation(); } } function onBackdropClick(e) { e.preventDefault(); e.stopPropagation(); scope.$apply(function() { opts.mdMenuCtrl.close(true, { closeAll: true }); }); } // Close menu on menu item click, if said menu-item is not disabled function captureClickListener(e) { var target = e.target; // Traverse up the event until we get to the menuContentEl to see if // there is an ng-click and that the ng-click is not disabled do { if (target == opts.menuContentEl[0]) return; if ((hasAnyAttribute(target, ['ng-click', 'ng-href', 'ui-sref']) || target.nodeName == 'BUTTON' || target.nodeName == 'MD-BUTTON') && !hasAnyAttribute(target, ['md-prevent-menu-close'])) { var closestMenu = $mdUtil.getClosest(target, 'MD-MENU'); if (!target.hasAttribute('disabled') && (!closestMenu || closestMenu == opts.parent[0])) { close(); } break; } } while (target = target.parentNode); function close() { scope.$apply(function() { opts.mdMenuCtrl.close(true, { closeAll: true }); }); } function hasAnyAttribute(target, attrs) { if (!target) return false; for (var i = 0, attr; attr = attrs[i]; ++i) { if (prefixer.hasAttribute(target, attr)) { return true; } } return false; } } } }
[ "function", "onShow", "(", "scope", ",", "element", ",", "opts", ")", "{", "sanitizeAndConfigure", "(", "opts", ")", ";", "if", "(", "opts", ".", "menuContentEl", "[", "0", "]", ")", "{", "// Inherit the theme from the target element.", "$mdTheming", ".", "inh...
Inserts and configures the staged Menu element into the DOM, positioning it, and wiring up various interaction events
[ "Inserts", "and", "configures", "the", "staged", "Menu", "element", "into", "the", "DOM", "positioning", "it", "and", "wiring", "up", "various", "interaction", "events" ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/menu/js/menuServiceProvider.js#L115-L382
train
Show the menu
[ 30522, 3853, 2006, 22231, 2860, 1006, 9531, 1010, 5783, 1010, 23569, 2015, 1007, 1063, 2624, 25090, 4371, 5685, 8663, 8873, 27390, 2063, 1006, 23569, 2015, 1007, 1025, 2065, 1006, 23569, 2015, 1012, 12183, 8663, 6528, 9834, 1031, 1014, 1033...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.core/src/sap/ui/core/support/RuleEngineOpaExtension.js
function () { var ruleDeferred = jQueryDOM.Deferred(), history = RuleAnalyzer.getFormattedAnalysisHistory(), analysisHistory = RuleAnalyzer.getAnalysisHistory(), totalIssues = analysisHistory.reduce(function (total, analysis) { return total + analysis.issues.length; }, 0), result = totalIssues === 0, message = "Support Assistant Analysis History", actual = message; if (result) { message += " - no issues found"; } else if (fnShouldSkipRulesIssues()) { result = true; message += ' - issues are found. To see them remove the "sap-skip-rules-issues=true" URI parameter'; } ruleDeferred.resolve({ result: result, message: message, actual: actual, expected: history }); return ruleDeferred.promise(); }
javascript
function () { var ruleDeferred = jQueryDOM.Deferred(), history = RuleAnalyzer.getFormattedAnalysisHistory(), analysisHistory = RuleAnalyzer.getAnalysisHistory(), totalIssues = analysisHistory.reduce(function (total, analysis) { return total + analysis.issues.length; }, 0), result = totalIssues === 0, message = "Support Assistant Analysis History", actual = message; if (result) { message += " - no issues found"; } else if (fnShouldSkipRulesIssues()) { result = true; message += ' - issues are found. To see them remove the "sap-skip-rules-issues=true" URI parameter'; } ruleDeferred.resolve({ result: result, message: message, actual: actual, expected: history }); return ruleDeferred.promise(); }
[ "function", "(", ")", "{", "var", "ruleDeferred", "=", "jQueryDOM", ".", "Deferred", "(", ")", ",", "history", "=", "RuleAnalyzer", ".", "getFormattedAnalysisHistory", "(", ")", ",", "analysisHistory", "=", "RuleAnalyzer", ".", "getAnalysisHistory", "(", ")", ...
If there are issues found the assertion result will be false and a report with all the issues will be generated in the message of the test. If no issues were found the assertion result will be true and no report will be generated. If "sap-skip-rules-issues=true" is set as an URI parameter, assertion result will be always positive. @function @name sap.ui.core.support.RuleEngineOpaAssertions#getFinalReport @public @returns {Promise} Promise.
[ "If", "there", "are", "issues", "found", "the", "assertion", "result", "will", "be", "false", "and", "a", "report", "with", "all", "the", "issues", "will", "be", "generated", "in", "the", "message", "of", "the", "test", ".", "If", "no", "issues", "were",...
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/support/RuleEngineOpaExtension.js#L170-L196
train
Returns a promise that resolves to true if there are issues
[ 30522, 3853, 1006, 1007, 1063, 13075, 5451, 27235, 20529, 1027, 1046, 4226, 2854, 9527, 1012, 13366, 28849, 2094, 1006, 1007, 1010, 2381, 1027, 3627, 27953, 2100, 6290, 1012, 2131, 14192, 19321, 11960, 12032, 20960, 24158, 7062, 1006, 1007, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...