repo
stringclasses
195 values
path
stringlengths
4
99
func_name
stringlengths
0
41
original_string
stringlengths
72
56.1k
language
stringclasses
1 value
code
stringlengths
72
56.1k
code_tokens
listlengths
25
8.12k
docstring
stringlengths
2
12.5k
docstring_tokens
listlengths
1
449
sha
stringclasses
197 values
url
stringlengths
88
186
partition
stringclasses
1 value
summary
stringlengths
8
338
input_ids
listlengths
502
502
token_type_ids
listlengths
502
502
attention_mask
listlengths
502
502
labels
listlengths
502
502
firebase/firebaseui-web
gulpfile.js
repeatTaskForAllLocales
function repeatTaskForAllLocales(taskName, dependencies, operation) { return ALL_LOCALES.map((locale) => { // Convert build-js-$ to build-js-fr, for example. const replaceTokens = (name) => name.replace(/\$/g, locale); const localeTaskName = replaceTokens(taskName); const localeDependencies = dependencies.map(replaceTokens); gulp.task(localeTaskName, gulp.series( gulp.parallel.apply(null, localeDependencies), () => operation(locale) )); return localeTaskName; }); }
javascript
function repeatTaskForAllLocales(taskName, dependencies, operation) { return ALL_LOCALES.map((locale) => { // Convert build-js-$ to build-js-fr, for example. const replaceTokens = (name) => name.replace(/\$/g, locale); const localeTaskName = replaceTokens(taskName); const localeDependencies = dependencies.map(replaceTokens); gulp.task(localeTaskName, gulp.series( gulp.parallel.apply(null, localeDependencies), () => operation(locale) )); return localeTaskName; }); }
[ "function", "repeatTaskForAllLocales", "(", "taskName", ",", "dependencies", ",", "operation", ")", "{", "return", "ALL_LOCALES", ".", "map", "(", "(", "locale", ")", "=>", "{", "// Convert build-js-$ to build-js-fr, for example.", "const", "replaceTokens", "=", "(", ...
Repeats a gulp task for all locales. @param {string} taskName The gulp task name to generate. Any $ tokens will be replaced with the language code (e.g. build-$ becomes build-fr, build-es, etc.). @param {!Array<string>} dependencies The gulp tasks that each operation depends on. Any $ tokens will be replaced with the language code. @param {function()} operation The function to execute. @return {!Array<string>} The list of generated task names.
[ "Repeats", "a", "gulp", "task", "for", "all", "locales", "." ]
c10aa51e38aeb38dc63baa22b48cd6690c2be087
https://github.com/firebase/firebaseui-web/blob/c10aa51e38aeb38dc63baa22b48cd6690c2be087/gulpfile.js#L167-L179
train
This function is called by the build - js - fr task to run a task for each locale
[ 30522, 3853, 9377, 10230, 2243, 29278, 8095, 4135, 9289, 2229, 1006, 4708, 18442, 1010, 12530, 15266, 1010, 3169, 1007, 1063, 2709, 2035, 1035, 2334, 2229, 1012, 4949, 1006, 1006, 2334, 2063, 1007, 1027, 1028, 1063, 1013, 1013, 10463, 3857,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/TableGrouping.js
function(oTable, vRowIndex, bExpand) { var aIndices = []; var oBinding = oTable ? oTable.getBinding("rows") : null; if (!oTable || !oBinding || !oBinding.expand || vRowIndex == null) { return null; } if (typeof vRowIndex === "number") { aIndices = [vRowIndex]; } else if (Array.isArray(vRowIndex)) { if (bExpand == null && vRowIndex.length > 1) { // Toggling the expanded state of multiple rows seems to be an absurd task. Therefore we assume this is unintentional and // prevent the execution. return null; } aIndices = vRowIndex; } // The cached binding length cannot be used here. In the synchronous execution after re-binding the rows, the cached binding length is // invalid. The table will validate it in its next update cycle, which happens asynchronously. // As of now, this is the required behavior for some features, but leads to failure here. Therefore, the length is requested from the // binding directly. var iTotalRowCount = oTable._getTotalRowCount(true); var aValidSortedIndices = aIndices.filter(function(iIndex) { // Only indices of existing, expandable/collapsible nodes must be considered. Otherwise there might be no change event on the final // expand/collapse. var bIsExpanded = oBinding.isExpanded(iIndex); var bIsLeaf = true; // If the node state cannot be determined, we assume it is a leaf. if (oBinding.nodeHasChildren) { if (oBinding.getNodeByIndex) { bIsLeaf = !oBinding.nodeHasChildren(oBinding.getNodeByIndex(iIndex)); } else { // The sap.ui.model.TreeBindingCompatibilityAdapter has no #getNodeByIndex function and #nodeHasChildren always returns true. bIsLeaf = false; } } return iIndex >= 0 && iIndex < iTotalRowCount && !bIsLeaf && bExpand !== bIsExpanded; }).sort(); if (aValidSortedIndices.length === 0) { return null; } // Operations need to be performed from the highest index to the lowest. This ensures correct results with OData bindings. The indices // are sorted ascending, so the array is iterated backwards. // Expand/Collapse all nodes except the first, and suppress the change event. for (var i = aValidSortedIndices.length - 1; i > 0; i--) { if (bExpand) { oBinding.expand(aValidSortedIndices[i], true); } else { oBinding.collapse(aValidSortedIndices[i], true); } } // Expand/Collapse the first node without suppressing the change event. if (bExpand === true) { oBinding.expand(aValidSortedIndices[0], false); } else if (bExpand === false) { oBinding.collapse(aValidSortedIndices[0], false); } else { oBinding.toggleIndex(aValidSortedIndices[0]); } return oBinding.isExpanded(aValidSortedIndices[0]); }
javascript
function(oTable, vRowIndex, bExpand) { var aIndices = []; var oBinding = oTable ? oTable.getBinding("rows") : null; if (!oTable || !oBinding || !oBinding.expand || vRowIndex == null) { return null; } if (typeof vRowIndex === "number") { aIndices = [vRowIndex]; } else if (Array.isArray(vRowIndex)) { if (bExpand == null && vRowIndex.length > 1) { // Toggling the expanded state of multiple rows seems to be an absurd task. Therefore we assume this is unintentional and // prevent the execution. return null; } aIndices = vRowIndex; } // The cached binding length cannot be used here. In the synchronous execution after re-binding the rows, the cached binding length is // invalid. The table will validate it in its next update cycle, which happens asynchronously. // As of now, this is the required behavior for some features, but leads to failure here. Therefore, the length is requested from the // binding directly. var iTotalRowCount = oTable._getTotalRowCount(true); var aValidSortedIndices = aIndices.filter(function(iIndex) { // Only indices of existing, expandable/collapsible nodes must be considered. Otherwise there might be no change event on the final // expand/collapse. var bIsExpanded = oBinding.isExpanded(iIndex); var bIsLeaf = true; // If the node state cannot be determined, we assume it is a leaf. if (oBinding.nodeHasChildren) { if (oBinding.getNodeByIndex) { bIsLeaf = !oBinding.nodeHasChildren(oBinding.getNodeByIndex(iIndex)); } else { // The sap.ui.model.TreeBindingCompatibilityAdapter has no #getNodeByIndex function and #nodeHasChildren always returns true. bIsLeaf = false; } } return iIndex >= 0 && iIndex < iTotalRowCount && !bIsLeaf && bExpand !== bIsExpanded; }).sort(); if (aValidSortedIndices.length === 0) { return null; } // Operations need to be performed from the highest index to the lowest. This ensures correct results with OData bindings. The indices // are sorted ascending, so the array is iterated backwards. // Expand/Collapse all nodes except the first, and suppress the change event. for (var i = aValidSortedIndices.length - 1; i > 0; i--) { if (bExpand) { oBinding.expand(aValidSortedIndices[i], true); } else { oBinding.collapse(aValidSortedIndices[i], true); } } // Expand/Collapse the first node without suppressing the change event. if (bExpand === true) { oBinding.expand(aValidSortedIndices[0], false); } else if (bExpand === false) { oBinding.collapse(aValidSortedIndices[0], false); } else { oBinding.toggleIndex(aValidSortedIndices[0]); } return oBinding.isExpanded(aValidSortedIndices[0]); }
[ "function", "(", "oTable", ",", "vRowIndex", ",", "bExpand", ")", "{", "var", "aIndices", "=", "[", "]", ";", "var", "oBinding", "=", "oTable", "?", "oTable", ".", "getBinding", "(", "\"rows\"", ")", ":", "null", ";", "if", "(", "!", "oTable", "||", ...
Toggles or sets the expanded state of a single or multiple rows. Toggling only works for a single row. @param {sap.ui.table.Table} oTable Instance of the table. @param {int | int[]} vRowIndex A single index, or an array of indices of the rows to expand or collapse. @param {boolean} [bExpand] If defined, instead of toggling the desired state is set. @returns {boolean | null} The new expanded state in case an action was performed, otherwise <code>null</code>.
[ "Toggles", "or", "sets", "the", "expanded", "state", "of", "a", "single", "or", "multiple", "rows", ".", "Toggling", "only", "works", "for", "a", "single", "row", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TableGrouping.js#L113-L184
train
Returns the binding length of the given row.
[ 30522, 3853, 1006, 27178, 3085, 1010, 27830, 5004, 22254, 10288, 1010, 2022, 2595, 9739, 2094, 1007, 1063, 13075, 7110, 24598, 2015, 1027, 1031, 1033, 1025, 13075, 27885, 22254, 2075, 1027, 27178, 3085, 1029, 27178, 3085, 1012, 2131, 8428, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/init.js
initBook
function initBook(rootFolder) { var extension = '.md'; return fs.mkdirp(rootFolder) // Parse the summary and readme .then(function() { var fs = createNodeFS(rootFolder); var book = Book.createForFS(fs); return Parse.parseReadme(book) // Setup default readme if doesn't found one .fail(function() { var readmeFile = File.createWithFilepath('README' + extension); var readme = Readme.create(readmeFile); return book.setReadme(readme); }); }) .then(Parse.parseSummary) .then(function(book) { var logger = book.getLogger(); var summary = book.getSummary(); var summaryFile = summary.getFile(); var summaryFilename = summaryFile.getPath() || ('SUMMARY' + extension); var articles = summary.getArticlesAsList(); // Write pages return Promise.forEach(articles, function(article) { var articlePath = article.getPath(); var filePath = articlePath? path.join(rootFolder, articlePath) : null; if (!filePath) { return; } return fs.assertFile(filePath, function() { return fs.ensureFile(filePath) .then(function() { logger.info.ln('create', article.getPath()); return fs.writeFile(filePath, '# ' + article.getTitle() + '\n\n'); }); }); }) // Write summary .then(function() { var filePath = path.join(rootFolder, summaryFilename); return fs.ensureFile(filePath) .then(function() { logger.info.ln('create ' + path.basename(filePath)); return fs.writeFile(filePath, summary.toText(extension)); }); }) // Log end .then(function() { logger.info.ln('initialization is finished'); }); }); }
javascript
function initBook(rootFolder) { var extension = '.md'; return fs.mkdirp(rootFolder) // Parse the summary and readme .then(function() { var fs = createNodeFS(rootFolder); var book = Book.createForFS(fs); return Parse.parseReadme(book) // Setup default readme if doesn't found one .fail(function() { var readmeFile = File.createWithFilepath('README' + extension); var readme = Readme.create(readmeFile); return book.setReadme(readme); }); }) .then(Parse.parseSummary) .then(function(book) { var logger = book.getLogger(); var summary = book.getSummary(); var summaryFile = summary.getFile(); var summaryFilename = summaryFile.getPath() || ('SUMMARY' + extension); var articles = summary.getArticlesAsList(); // Write pages return Promise.forEach(articles, function(article) { var articlePath = article.getPath(); var filePath = articlePath? path.join(rootFolder, articlePath) : null; if (!filePath) { return; } return fs.assertFile(filePath, function() { return fs.ensureFile(filePath) .then(function() { logger.info.ln('create', article.getPath()); return fs.writeFile(filePath, '# ' + article.getTitle() + '\n\n'); }); }); }) // Write summary .then(function() { var filePath = path.join(rootFolder, summaryFilename); return fs.ensureFile(filePath) .then(function() { logger.info.ln('create ' + path.basename(filePath)); return fs.writeFile(filePath, summary.toText(extension)); }); }) // Log end .then(function() { logger.info.ln('initialization is finished'); }); }); }
[ "function", "initBook", "(", "rootFolder", ")", "{", "var", "extension", "=", "'.md'", ";", "return", "fs", ".", "mkdirp", "(", "rootFolder", ")", "// Parse the summary and readme", ".", "then", "(", "function", "(", ")", "{", "var", "fs", "=", "createNodeFS...
Initialize folder structure for a book Read SUMMARY to created the right chapter @param {Book} @param {String} @return {Promise}
[ "Initialize", "folder", "structure", "for", "a", "book", "Read", "SUMMARY", "to", "created", "the", "right", "chapter" ]
6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4
https://github.com/GitbookIO/gitbook/blob/6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4/lib/init.js#L19-L81
train
Initialize the book
[ 30522, 3853, 1999, 4183, 8654, 1006, 7117, 10371, 2121, 1007, 1063, 13075, 5331, 1027, 1005, 1012, 9108, 1005, 1025, 2709, 1042, 2015, 1012, 12395, 4305, 14536, 1006, 7117, 10371, 2121, 1007, 1013, 1013, 11968, 3366, 1996, 12654, 1998, 3191...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/preferences/PreferencesBase.js
function (id) { var scope = this._scopes[id], shadowIndex; if (!scope) { return; } this.removeFromScopeOrder(id); shadowIndex = _.findIndex(this._defaults._shadowScopeOrder, function (entry) { return entry.id === id; }); this._defaults._shadowScopeOrder.splice(shadowIndex, 1); delete this._scopes[id]; }
javascript
function (id) { var scope = this._scopes[id], shadowIndex; if (!scope) { return; } this.removeFromScopeOrder(id); shadowIndex = _.findIndex(this._defaults._shadowScopeOrder, function (entry) { return entry.id === id; }); this._defaults._shadowScopeOrder.splice(shadowIndex, 1); delete this._scopes[id]; }
[ "function", "(", "id", ")", "{", "var", "scope", "=", "this", ".", "_scopes", "[", "id", "]", ",", "shadowIndex", ";", "if", "(", "!", "scope", ")", "{", "return", ";", "}", "this", ".", "removeFromScopeOrder", "(", "id", ")", ";", "shadowIndex", "...
Removes a Scope from this PreferencesSystem. Returns without doing anything if the Scope does not exist. Notifies listeners of preferences that may have changed. @param {string} id Name of the Scope to remove
[ "Removes", "a", "Scope", "from", "this", "PreferencesSystem", ".", "Returns", "without", "doing", "anything", "if", "the", "Scope", "does", "not", "exist", ".", "Notifies", "listeners", "of", "preferences", "that", "may", "have", "changed", "." ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/preferences/PreferencesBase.js#L1618-L1631
train
Remove scope from scope order
[ 30522, 3853, 1006, 8909, 1007, 1063, 13075, 9531, 1027, 2023, 1012, 1035, 9531, 2015, 1031, 8909, 1033, 1010, 5192, 22254, 10288, 1025, 2065, 1006, 999, 9531, 1007, 1063, 2709, 1025, 1065, 2023, 1012, 6366, 19699, 22225, 16186, 8551, 2121, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/RemoteAgent.js
call
function call(method, varargs) { var argsArray = [_objectId, "_LD." + method]; if (arguments.length > 1) { argsArray = argsArray.concat(Array.prototype.slice.call(arguments, 1)); } return _call.apply(null, argsArray); }
javascript
function call(method, varargs) { var argsArray = [_objectId, "_LD." + method]; if (arguments.length > 1) { argsArray = argsArray.concat(Array.prototype.slice.call(arguments, 1)); } return _call.apply(null, argsArray); }
[ "function", "call", "(", "method", ",", "varargs", ")", "{", "var", "argsArray", "=", "[", "_objectId", ",", "\"_LD.\"", "+", "method", "]", ";", "if", "(", "arguments", ".", "length", ">", "1", ")", "{", "argsArray", "=", "argsArray", ".", "concat", ...
Call a remote function The parameters are passed on to the remote functions. Nodes are resolved and sent as objectIds. @param {string} function name
[ "Call", "a", "remote", "function", "The", "parameters", "are", "passed", "on", "to", "the", "remote", "functions", ".", "Nodes", "are", "resolved", "and", "sent", "as", "objectIds", "." ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/LiveDevelopment/Agents/RemoteAgent.js#L98-L106
train
Call a method on the object
[ 30522, 3853, 2655, 1006, 4118, 1010, 13075, 2906, 5620, 1007, 1063, 13075, 12098, 5620, 2906, 9447, 1027, 1031, 1035, 4874, 3593, 1010, 1000, 1035, 25510, 1012, 1000, 1009, 4118, 1033, 1025, 2065, 1006, 9918, 1012, 3091, 1028, 1015, 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...
GeekyAnts/vue-native-core
packages/weex-template-compiler/build.js
model
function model ( el, dir, _warn ) { if (el.tag === 'input' || el.tag === 'textarea') { genDefaultModel(el, dir.value, dir.modifiers); } else { genComponentModel(el, dir.value, dir.modifiers); } }
javascript
function model ( el, dir, _warn ) { if (el.tag === 'input' || el.tag === 'textarea') { genDefaultModel(el, dir.value, dir.modifiers); } else { genComponentModel(el, dir.value, dir.modifiers); } }
[ "function", "model", "(", "el", ",", "dir", ",", "_warn", ")", "{", "if", "(", "el", ".", "tag", "===", "'input'", "||", "el", ".", "tag", "===", "'textarea'", ")", "{", "genDefaultModel", "(", "el", ",", "dir", ".", "value", ",", "dir", ".", "mo...
/*
[ "/", "*" ]
a7b4c9e35fe3f01d7576086f41e5e9ec6975b72e
https://github.com/GeekyAnts/vue-native-core/blob/a7b4c9e35fe3f01d7576086f41e5e9ec6975b72e/packages/weex-template-compiler/build.js#L2792-L2802
train
Generates the model for a node
[ 30522, 3853, 2944, 1006, 3449, 1010, 16101, 1010, 1035, 11582, 1007, 30524, 1025, 1065, 2842, 1063, 8991, 9006, 29513, 3372, 5302, 9247, 1006, 3449, 1010, 16101, 1012, 3643, 1010, 16101, 1012, 16913, 28295, 1007, 1025, 1065, 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...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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/looks.js
function() { this.jsonInit({ "message0": Blockly.Msg.LOOKS_CHANGEEFFECTBY, "args0": [ { "type": "field_dropdown", "name": "EFFECT", "options": [ [Blockly.Msg.LOOKS_EFFECT_COLOR, 'COLOR'], [Blockly.Msg.LOOKS_EFFECT_FISHEYE, 'FISHEYE'], [Blockly.Msg.LOOKS_EFFECT_WHIRL, 'WHIRL'], [Blockly.Msg.LOOKS_EFFECT_PIXELATE, 'PIXELATE'], [Blockly.Msg.LOOKS_EFFECT_MOSAIC, 'MOSAIC'], [Blockly.Msg.LOOKS_EFFECT_BRIGHTNESS, 'BRIGHTNESS'], [Blockly.Msg.LOOKS_EFFECT_GHOST, 'GHOST'] ] }, { "type": "input_value", "name": "CHANGE" } ], "category": Blockly.Categories.looks, "extensions": ["colours_looks", "shape_statement"] }); }
javascript
function() { this.jsonInit({ "message0": Blockly.Msg.LOOKS_CHANGEEFFECTBY, "args0": [ { "type": "field_dropdown", "name": "EFFECT", "options": [ [Blockly.Msg.LOOKS_EFFECT_COLOR, 'COLOR'], [Blockly.Msg.LOOKS_EFFECT_FISHEYE, 'FISHEYE'], [Blockly.Msg.LOOKS_EFFECT_WHIRL, 'WHIRL'], [Blockly.Msg.LOOKS_EFFECT_PIXELATE, 'PIXELATE'], [Blockly.Msg.LOOKS_EFFECT_MOSAIC, 'MOSAIC'], [Blockly.Msg.LOOKS_EFFECT_BRIGHTNESS, 'BRIGHTNESS'], [Blockly.Msg.LOOKS_EFFECT_GHOST, 'GHOST'] ] }, { "type": "input_value", "name": "CHANGE" } ], "category": Blockly.Categories.looks, "extensions": ["colours_looks", "shape_statement"] }); }
[ "function", "(", ")", "{", "this", ".", "jsonInit", "(", "{", "\"message0\"", ":", "Blockly", ".", "Msg", ".", "LOOKS_CHANGEEFFECTBY", ",", "\"args0\"", ":", "[", "{", "\"type\"", ":", "\"field_dropdown\"", ",", "\"name\"", ":", "\"EFFECT\"", ",", "\"options...
Block to change graphic effect. @this Blockly.Block
[ "Block", "to", "change", "graphic", "effect", "." ]
455b2a854435c0a67da1da92320ddc3ec3e2b799
https://github.com/LLK/scratch-blocks/blob/455b2a854435c0a67da1da92320ddc3ec3e2b799/blocks_vertical/looks.js#L168-L193
train
Block for changing the effect of a section.
[ 30522, 3853, 1006, 1007, 1063, 2023, 1012, 1046, 3385, 5498, 2102, 1006, 1063, 1000, 4471, 2692, 1000, 1024, 3796, 2135, 1012, 5796, 2290, 1012, 3504, 1035, 2689, 12879, 25969, 3762, 1010, 1000, 12098, 5620, 2692, 1000, 1024, 1031, 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...
marcuswestin/store.js
src/store-engine.js
function(key, optionalDefaultValue) { var data = this.storage.read(this._namespacePrefix + key) return this._deserialize(data, optionalDefaultValue) }
javascript
function(key, optionalDefaultValue) { var data = this.storage.read(this._namespacePrefix + key) return this._deserialize(data, optionalDefaultValue) }
[ "function", "(", "key", ",", "optionalDefaultValue", ")", "{", "var", "data", "=", "this", ".", "storage", ".", "read", "(", "this", ".", "_namespacePrefix", "+", "key", ")", "return", "this", ".", "_deserialize", "(", "data", ",", "optionalDefaultValue", ...
get returns the value of the given key. If that value is undefined, it returns optionalDefaultValue instead.
[ "get", "returns", "the", "value", "of", "the", "given", "key", ".", "If", "that", "value", "is", "undefined", "it", "returns", "optionalDefaultValue", "instead", "." ]
b8e22fea8738fc19da4d9e7dbf1cda6e5185c481
https://github.com/marcuswestin/store.js/blob/b8e22fea8738fc19da4d9e7dbf1cda6e5185c481/src/store-engine.js#L21-L24
train
Get the value of a key in the cache
[ 30522, 3853, 1006, 3145, 1010, 11887, 3207, 7011, 11314, 10175, 5657, 1007, 1063, 13075, 2951, 1027, 2023, 1012, 5527, 1012, 3191, 1006, 2023, 1012, 1035, 3415, 15327, 28139, 8873, 2595, 1009, 3145, 1007, 2709, 2023, 1012, 1035, 4078, 11610...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/JavaScriptRefactoring/ExtractToFunction.js
analyzeCode
function analyzeCode(text, scopes, srcScope, destScope, start, end) { var identifiers = {}, inThisScope = {}, thisPointerUsed = false, returnStatementUsed = false, variableDeclarations = {}, changedValues = {}, dependentValues = {}, ast = RefactoringUtils.getAST(text), doc = session.editor.document, restScopeStr; ASTWalker.full(ast, function(node) { var value, name; switch (node.type) { case "AssignmentExpression": value = node.left; break; case "VariableDeclarator": inThisScope[node.id.name] = true; value = node.init && node.id; var variableDeclarationNode = RefactoringUtils.findSurroundASTNode(ast, node, ["VariableDeclaration"]); variableDeclarations[node.id.name] = variableDeclarationNode.kind; break; case "ThisExpression": thisPointerUsed = true; break; case "UpdateExpression": value = node.argument; break; case "Identifier": identifiers[node.name] = true; break; case "ReturnStatement": returnStatementUsed = true; break; } if (value){ if (value.type === "MemberExpression") { name = value.object.name; } else { name = value.name; } changedValues[name] = true; } }); if (srcScope.originNode) { restScopeStr = doc.getText().substr(end, srcScope.originNode.end - end); } else { restScopeStr = doc.getText().substr(end); } ASTWalker.simple(RefactoringUtils.getAST(restScopeStr), { Identifier: function(node) { var name = node.name; dependentValues[name] = true; }, Expression: function(node) { if (node.type === "MemberExpression") { var name = node.object.name; dependentValues[name] = true; } } }); var passProps = scopes.slice(srcScope.id, destScope.id).reduce(function(props, scope) { return _.union(props, _.keys(scope.props)); }, []); var retProps = scopes.slice(srcScope.id, destScope.id + 1).reduce(function(props, scope) { return _.union(props, _.keys(scope.props)); }, []); return { passParams: _.intersection(_.difference(_.keys(identifiers), _.keys(inThisScope)), passProps), retParams: _.intersection( _.keys(changedValues), _.keys(dependentValues), retProps), thisPointerUsed: thisPointerUsed, returnStatementUsed: returnStatementUsed, variableDeclarations: variableDeclarations }; }
javascript
function analyzeCode(text, scopes, srcScope, destScope, start, end) { var identifiers = {}, inThisScope = {}, thisPointerUsed = false, returnStatementUsed = false, variableDeclarations = {}, changedValues = {}, dependentValues = {}, ast = RefactoringUtils.getAST(text), doc = session.editor.document, restScopeStr; ASTWalker.full(ast, function(node) { var value, name; switch (node.type) { case "AssignmentExpression": value = node.left; break; case "VariableDeclarator": inThisScope[node.id.name] = true; value = node.init && node.id; var variableDeclarationNode = RefactoringUtils.findSurroundASTNode(ast, node, ["VariableDeclaration"]); variableDeclarations[node.id.name] = variableDeclarationNode.kind; break; case "ThisExpression": thisPointerUsed = true; break; case "UpdateExpression": value = node.argument; break; case "Identifier": identifiers[node.name] = true; break; case "ReturnStatement": returnStatementUsed = true; break; } if (value){ if (value.type === "MemberExpression") { name = value.object.name; } else { name = value.name; } changedValues[name] = true; } }); if (srcScope.originNode) { restScopeStr = doc.getText().substr(end, srcScope.originNode.end - end); } else { restScopeStr = doc.getText().substr(end); } ASTWalker.simple(RefactoringUtils.getAST(restScopeStr), { Identifier: function(node) { var name = node.name; dependentValues[name] = true; }, Expression: function(node) { if (node.type === "MemberExpression") { var name = node.object.name; dependentValues[name] = true; } } }); var passProps = scopes.slice(srcScope.id, destScope.id).reduce(function(props, scope) { return _.union(props, _.keys(scope.props)); }, []); var retProps = scopes.slice(srcScope.id, destScope.id + 1).reduce(function(props, scope) { return _.union(props, _.keys(scope.props)); }, []); return { passParams: _.intersection(_.difference(_.keys(identifiers), _.keys(inThisScope)), passProps), retParams: _.intersection( _.keys(changedValues), _.keys(dependentValues), retProps), thisPointerUsed: thisPointerUsed, returnStatementUsed: returnStatementUsed, variableDeclarations: variableDeclarations }; }
[ "function", "analyzeCode", "(", "text", ",", "scopes", ",", "srcScope", ",", "destScope", ",", "start", ",", "end", ")", "{", "var", "identifiers", "=", "{", "}", ",", "inThisScope", "=", "{", "}", ",", "thisPointerUsed", "=", "false", ",", "returnStatem...
Analyzes the code and finds values required for extract to function @param {!string} text - text to be extracted @param {!Array.<Scope>} - scopes @param {!Scope} srcScope - source scope of the extraction @param {!Scope} destScope - destination scope of the extraction @param {!number} start - the start offset @param {!number} end - the end offset @return {!{ passParams: Array.<string>, retParams: Array.<string>, thisPointerUsed: boolean, varaibleDeclarations: {} // variable-name: kind }}
[ "Analyzes", "the", "code", "and", "finds", "values", "required", "for", "extract", "to", "function" ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/extensions/default/JavaScriptRefactoring/ExtractToFunction.js#L55-L136
train
Analyzes the given text.
[ 30522, 3853, 17908, 16044, 1006, 3793, 1010, 9531, 2015, 1010, 5034, 6169, 16186, 1010, 4078, 3215, 16186, 1010, 2707, 1010, 2203, 1007, 1063, 13075, 8909, 4765, 28295, 1027, 1063, 1065, 1010, 20014, 24158, 26127, 1027, 1063, 1065, 1010, 20...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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...
moleculerjs/moleculer
bin/moleculer-runner.js
loadServices
function loadServices() { const fileMask = flags.mask || "**/*.service.js"; const serviceDir = process.env.SERVICEDIR || ""; const svcDir = path.isAbsolute(serviceDir) ? serviceDir : path.resolve(process.cwd(), serviceDir); let patterns = servicePaths; if (process.env.SERVICES || process.env.SERVICEDIR) { if (isDirectory(svcDir) && !process.env.SERVICES) { // Load all services from directory (from subfolders too) broker.loadServices(svcDir, fileMask); } else if (process.env.SERVICES) { // Load services from env list patterns = Array.isArray(process.env.SERVICES) ? process.env.SERVICES : process.env.SERVICES.split(","); } } if (patterns.length > 0) { let serviceFiles = []; patterns.map(s => s.trim()).forEach(p => { const skipping = p[0] == "!"; if (skipping) p = p.slice(1); if (p.startsWith("npm:")) { // Load NPM module loadNpmModule(p.slice(4)); } else { let files; const svcPath = path.isAbsolute(p) ? p : path.resolve(svcDir, p); // Check is it a directory? if (isDirectory(svcPath)) { files = glob(svcPath + "/" + fileMask, { absolute: true }); if (files.length == 0) return broker.logger.warn(chalk.yellow.bold(`There is no service files in directory: '${svcPath}'`)); } else if (isServiceFile(svcPath)) { files = [svcPath.replace(/\\/g, "/")]; } else if (isServiceFile(svcPath + ".service.js")) { files = [svcPath.replace(/\\/g, "/") + ".service.js"]; } else { // Load with glob files = glob(p, { cwd: svcDir, absolute: true }); if (files.length == 0) broker.logger.warn(chalk.yellow.bold(`There is no matched file for pattern: '${p}'`)); } if (files && files.length > 0) { if (skipping) serviceFiles = serviceFiles.filter(f => files.indexOf(f) === -1); else serviceFiles.push(...files); } } }); _.uniq(serviceFiles).forEach(f => broker.loadService(f)); } }
javascript
function loadServices() { const fileMask = flags.mask || "**/*.service.js"; const serviceDir = process.env.SERVICEDIR || ""; const svcDir = path.isAbsolute(serviceDir) ? serviceDir : path.resolve(process.cwd(), serviceDir); let patterns = servicePaths; if (process.env.SERVICES || process.env.SERVICEDIR) { if (isDirectory(svcDir) && !process.env.SERVICES) { // Load all services from directory (from subfolders too) broker.loadServices(svcDir, fileMask); } else if (process.env.SERVICES) { // Load services from env list patterns = Array.isArray(process.env.SERVICES) ? process.env.SERVICES : process.env.SERVICES.split(","); } } if (patterns.length > 0) { let serviceFiles = []; patterns.map(s => s.trim()).forEach(p => { const skipping = p[0] == "!"; if (skipping) p = p.slice(1); if (p.startsWith("npm:")) { // Load NPM module loadNpmModule(p.slice(4)); } else { let files; const svcPath = path.isAbsolute(p) ? p : path.resolve(svcDir, p); // Check is it a directory? if (isDirectory(svcPath)) { files = glob(svcPath + "/" + fileMask, { absolute: true }); if (files.length == 0) return broker.logger.warn(chalk.yellow.bold(`There is no service files in directory: '${svcPath}'`)); } else if (isServiceFile(svcPath)) { files = [svcPath.replace(/\\/g, "/")]; } else if (isServiceFile(svcPath + ".service.js")) { files = [svcPath.replace(/\\/g, "/") + ".service.js"]; } else { // Load with glob files = glob(p, { cwd: svcDir, absolute: true }); if (files.length == 0) broker.logger.warn(chalk.yellow.bold(`There is no matched file for pattern: '${p}'`)); } if (files && files.length > 0) { if (skipping) serviceFiles = serviceFiles.filter(f => files.indexOf(f) === -1); else serviceFiles.push(...files); } } }); _.uniq(serviceFiles).forEach(f => broker.loadService(f)); } }
[ "function", "loadServices", "(", ")", "{", "const", "fileMask", "=", "flags", ".", "mask", "||", "\"**/*.service.js\"", ";", "const", "serviceDir", "=", "process", ".", "env", ".", "SERVICEDIR", "||", "\"\"", ";", "const", "svcDir", "=", "path", ".", "isAb...
Load services from files or directories 1. If find `SERVICEDIR` env var and not find `SERVICES` env var, load all services from the `SERVICEDIR` directory 2. If find `SERVICEDIR` env var and `SERVICES` env var, load the specified services from the `SERVICEDIR` directory 3. If not find `SERVICEDIR` env var but find `SERVICES` env var, load the specified services from the current directory 4. check the CLI arguments. If it find filename(s), load it/them 5. If find directory(ies), load it/them Please note: you can use shorthand names for `SERVICES` env var. E.g. SERVICES=posts,users It will be load the `posts.service.js` and `users.service.js` files
[ "Load", "services", "from", "files", "or", "directories" ]
f95aadc2d61b0d0e3c643a43c3ed28bca6425cde
https://github.com/moleculerjs/moleculer/blob/f95aadc2d61b0d0e3c643a43c3ed28bca6425cde/bin/moleculer-runner.js#L292-L354
train
Load all services from the service directory
[ 30522, 3853, 15665, 2121, 7903, 2229, 1006, 1007, 1063, 9530, 3367, 5371, 9335, 2243, 1027, 9245, 1012, 7308, 1064, 1064, 1000, 1008, 1008, 1013, 1008, 1012, 2326, 1012, 1046, 2015, 1000, 1025, 9530, 3367, 22858, 4313, 1027, 2832, 1012, 4...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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...
benweet/stackedit
src/services/timeSvc.js
isYearSeparator
function isYearSeparator() { if (yearSeparator !== null) { return yearSeparator; } if (!('Intl' in window)) { return true; } const options = { day: 'numeric', month: 'short', year: 'numeric' }; const formatter = new window.Intl.DateTimeFormat(undefined, options); const output = formatter.format(new Date(0)); yearSeparator = !!output.match(/\d,/); return yearSeparator; }
javascript
function isYearSeparator() { if (yearSeparator !== null) { return yearSeparator; } if (!('Intl' in window)) { return true; } const options = { day: 'numeric', month: 'short', year: 'numeric' }; const formatter = new window.Intl.DateTimeFormat(undefined, options); const output = formatter.format(new Date(0)); yearSeparator = !!output.match(/\d,/); return yearSeparator; }
[ "function", "isYearSeparator", "(", ")", "{", "if", "(", "yearSeparator", "!==", "null", ")", "{", "return", "yearSeparator", ";", "}", "if", "(", "!", "(", "'Intl'", "in", "window", ")", ")", "{", "return", "true", ";", "}", "const", "options", "=", ...
Private: Determine if the year should be separated from the month and day with a comma. For example, `9 Jun 2014` in en-GB and `Jun 9, 2014` in en-US. Returns true if the date needs a separator.
[ "Private", ":", "Determine", "if", "the", "year", "should", "be", "separated", "from", "the", "month", "and", "day", "with", "a", "comma", ".", "For", "example", "9", "Jun", "2014", "in", "en", "-", "GB", "and", "Jun", "9", "2014", "in", "en", "-", ...
91f8cf3c10b75df65b69f9181cee8151d65a788d
https://github.com/benweet/stackedit/blob/91f8cf3c10b75df65b69f9181cee8151d65a788d/src/services/timeSvc.js#L97-L112
train
Check if the year separator is present in the current date
[ 30522, 3853, 2003, 29100, 3366, 28689, 4263, 1006, 1007, 1063, 2065, 1006, 2086, 13699, 25879, 2953, 999, 1027, 1027, 19701, 1007, 1063, 2709, 2086, 13699, 25879, 2953, 1025, 1065, 2065, 1006, 999, 1006, 1005, 20014, 2140, 1005, 1999, 3332,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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(key, params, defaultValue) { var value = mxResources.resources[key]; // Applies the default value if no resource was found if (value == null) { value = defaultValue; } // Replaces the placeholders with the values in the array if (value != null && params != null) { value = mxResources.replacePlaceholders(value, params); } return value; }
javascript
function(key, params, defaultValue) { var value = mxResources.resources[key]; // Applies the default value if no resource was found if (value == null) { value = defaultValue; } // Replaces the placeholders with the values in the array if (value != null && params != null) { value = mxResources.replacePlaceholders(value, params); } return value; }
[ "function", "(", "key", ",", "params", ",", "defaultValue", ")", "{", "var", "value", "=", "mxResources", ".", "resources", "[", "key", "]", ";", "// Applies the default value if no resource was found", "if", "(", "value", "==", "null", ")", "{", "value", "=",...
Function: get Returns the value for the specified resource key. Example: To read the value for 'welomeMessage', use the following: (code) var result = mxResources.get('welcomeMessage') || ''; (end) This would require an entry of the following form in one of the English language resource files: (code) welcomeMessage=Welcome to mxGraph! (end) The part behind the || is the string value to be used if the given resource is not available. Parameters: key - String that represents the key of the resource to be returned. params - Array of the values for the placeholders of the form {1}...{n} to be replaced with in the resulting string. defaultValue - Optional string that specifies the default return value.
[ "Function", ":", "get" ]
33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44
https://github.com/jgraph/mxgraph/blob/33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44/javascript/mxClient.js#L1605-L1622
train
Returns the value of the specified resource
[ 30522, 3853, 1006, 3145, 1010, 11498, 5244, 1010, 12398, 10175, 5657, 1007, 1063, 13075, 3643, 1027, 25630, 6072, 8162, 9623, 1012, 4219, 1031, 3145, 1033, 1025, 1013, 1013, 12033, 1996, 12398, 3643, 2065, 2053, 7692, 2001, 2179, 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/space-infix-ops.js
getFirstNonSpacedToken
function getFirstNonSpacedToken(left, right, op) { const operator = sourceCode.getFirstTokenBetween(left, right, token => token.value === op); const prev = sourceCode.getTokenBefore(operator); const next = sourceCode.getTokenAfter(operator); if (!sourceCode.isSpaceBetweenTokens(prev, operator) || !sourceCode.isSpaceBetweenTokens(operator, next)) { return operator; } return null; }
javascript
function getFirstNonSpacedToken(left, right, op) { const operator = sourceCode.getFirstTokenBetween(left, right, token => token.value === op); const prev = sourceCode.getTokenBefore(operator); const next = sourceCode.getTokenAfter(operator); if (!sourceCode.isSpaceBetweenTokens(prev, operator) || !sourceCode.isSpaceBetweenTokens(operator, next)) { return operator; } return null; }
[ "function", "getFirstNonSpacedToken", "(", "left", ",", "right", ",", "op", ")", "{", "const", "operator", "=", "sourceCode", ".", "getFirstTokenBetween", "(", "left", ",", "right", ",", "token", "=>", "token", ".", "value", "===", "op", ")", ";", "const",...
Returns the first token which violates the rule @param {ASTNode} left - The left node of the main node @param {ASTNode} right - The right node of the main node @param {string} op - The operator of the main node @returns {Object} The violator token or null @private
[ "Returns", "the", "first", "token", "which", "violates", "the", "rule" ]
bc0819c94aad14f7fad3cbc2338ea15658b0f272
https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/space-infix-ops.js#L50-L60
train
Get the first non - spaced token between left and right
[ 30522, 3853, 2131, 8873, 12096, 8540, 23058, 11927, 11045, 2078, 1006, 2187, 1010, 2157, 1010, 6728, 1007, 1063, 9530, 3367, 6872, 1027, 3120, 16044, 1012, 2131, 8873, 12096, 18715, 2368, 20915, 28394, 2078, 1006, 2187, 1010, 2157, 1010, 19...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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
mxRubberband
function mxRubberband(graph) { if (graph != null) { this.graph = graph; this.graph.addMouseListener(this); // Handles force rubberband event this.forceRubberbandHandler = mxUtils.bind(this, function(sender, evt) { var evtName = evt.getProperty('eventName'); var me = evt.getProperty('event'); if (evtName == mxEvent.MOUSE_DOWN && this.isForceRubberbandEvent(me)) { var offset = mxUtils.getOffset(this.graph.container); var origin = mxUtils.getScrollOrigin(this.graph.container); origin.x -= offset.x; origin.y -= offset.y; this.start(me.getX() + origin.x, me.getY() + origin.y); me.consume(false); } }); this.graph.addListener(mxEvent.FIRE_MOUSE_EVENT, this.forceRubberbandHandler); // Repaints the marquee after autoscroll this.panHandler = mxUtils.bind(this, function() { this.repaint(); }); this.graph.addListener(mxEvent.PAN, this.panHandler); // Does not show menu if any touch gestures take place after the trigger this.gestureHandler = mxUtils.bind(this, function(sender, eo) { if (this.first != null) { this.reset(); } }); this.graph.addListener(mxEvent.GESTURE, this.gestureHandler); // Automatic deallocation of memory if (mxClient.IS_IE) { mxEvent.addListener(window, 'unload', mxUtils.bind(this, function() { this.destroy(); }) ); } } }
javascript
function mxRubberband(graph) { if (graph != null) { this.graph = graph; this.graph.addMouseListener(this); // Handles force rubberband event this.forceRubberbandHandler = mxUtils.bind(this, function(sender, evt) { var evtName = evt.getProperty('eventName'); var me = evt.getProperty('event'); if (evtName == mxEvent.MOUSE_DOWN && this.isForceRubberbandEvent(me)) { var offset = mxUtils.getOffset(this.graph.container); var origin = mxUtils.getScrollOrigin(this.graph.container); origin.x -= offset.x; origin.y -= offset.y; this.start(me.getX() + origin.x, me.getY() + origin.y); me.consume(false); } }); this.graph.addListener(mxEvent.FIRE_MOUSE_EVENT, this.forceRubberbandHandler); // Repaints the marquee after autoscroll this.panHandler = mxUtils.bind(this, function() { this.repaint(); }); this.graph.addListener(mxEvent.PAN, this.panHandler); // Does not show menu if any touch gestures take place after the trigger this.gestureHandler = mxUtils.bind(this, function(sender, eo) { if (this.first != null) { this.reset(); } }); this.graph.addListener(mxEvent.GESTURE, this.gestureHandler); // Automatic deallocation of memory if (mxClient.IS_IE) { mxEvent.addListener(window, 'unload', mxUtils.bind(this, function() { this.destroy(); }) ); } } }
[ "function", "mxRubberband", "(", "graph", ")", "{", "if", "(", "graph", "!=", "null", ")", "{", "this", ".", "graph", "=", "graph", ";", "this", ".", "graph", ".", "addMouseListener", "(", "this", ")", ";", "// Handles force rubberband event", "this", ".",...
Copyright (c) 2006-2016, JGraph Ltd Copyright (c) 2006-2016, Gaudenz Alder Class: mxRubberband Event handler that selects rectangular regions. This is not built-into <mxGraph>. To enable rubberband selection in a graph, use the following code. Example: (code) var rubberband = new mxRubberband(graph); (end) Constructor: mxRubberband Constructs an event handler that selects rectangular regions in the graph using rubberband selection.
[ "Copyright", "(", "c", ")", "2006", "-", "2016", "JGraph", "Ltd", "Copyright", "(", "c", ")", "2006", "-", "2016", "Gaudenz", "Alder", "Class", ":", "mxRubberband" ]
33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44
https://github.com/jgraph/mxgraph/blob/33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44/javascript/mxClient.js#L74786-L74842
train
The rubberband event handler
[ 30522, 3853, 25630, 6820, 29325, 12733, 1006, 10629, 1007, 1063, 2065, 1006, 10629, 999, 1027, 19701, 1007, 1063, 2023, 1012, 10629, 1027, 10629, 1025, 2023, 1012, 10629, 1012, 5587, 27711, 29282, 6528, 2121, 1006, 2023, 1007, 1025, 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...
aframevr/aframe
src/components/raycaster.js
function (length) { var data = this.data; var el = this.el; var endVec3; // Switch each time vector so line update triggered and to avoid unnecessary vector clone. endVec3 = this.lineData.end === this.lineEndVec3 ? this.otherLineEndVec3 : this.lineEndVec3; // Treat Infinity as 1000m for the line. if (length === undefined) { length = data.far === Infinity ? 1000 : data.far; } // Update the length of the line if given. `unitLineEndVec3` is the direction // given by data.direction, then we apply a scalar to give it a length. this.lineData.start = data.origin; this.lineData.end = endVec3.copy(this.unitLineEndVec3).multiplyScalar(length); el.setAttribute('line', this.lineData); }
javascript
function (length) { var data = this.data; var el = this.el; var endVec3; // Switch each time vector so line update triggered and to avoid unnecessary vector clone. endVec3 = this.lineData.end === this.lineEndVec3 ? this.otherLineEndVec3 : this.lineEndVec3; // Treat Infinity as 1000m for the line. if (length === undefined) { length = data.far === Infinity ? 1000 : data.far; } // Update the length of the line if given. `unitLineEndVec3` is the direction // given by data.direction, then we apply a scalar to give it a length. this.lineData.start = data.origin; this.lineData.end = endVec3.copy(this.unitLineEndVec3).multiplyScalar(length); el.setAttribute('line', this.lineData); }
[ "function", "(", "length", ")", "{", "var", "data", "=", "this", ".", "data", ";", "var", "el", "=", "this", ".", "el", ";", "var", "endVec3", ";", "// Switch each time vector so line update triggered and to avoid unnecessary vector clone.", "endVec3", "=", "this", ...
Create or update line to give raycaster visual representation. Customize the line through through line component. We draw the line in the raycaster component to customize the line to the raycaster's origin, direction, and far. Unlike the raycaster, we create the line as a child of the object. The line will be affected by the transforms of the objects, so we don't have to calculate transforms like we do with the raycaster. @param {number} length - Length of line. Pass in to shorten the line to the intersection point. If not provided, length will default to the max length, `raycaster.far`.
[ "Create", "or", "update", "line", "to", "give", "raycaster", "visual", "representation", ".", "Customize", "the", "line", "through", "through", "line", "component", ".", "We", "draw", "the", "line", "in", "the", "raycaster", "component", "to", "customize", "th...
24acc78a7299a4cdfe3ef617f4d40ddf6275c992
https://github.com/aframevr/aframe/blob/24acc78a7299a4cdfe3ef617f4d40ddf6275c992/src/components/raycaster.js#L362-L382
train
Update the line
[ 30522, 3853, 1006, 3091, 1007, 1063, 13075, 2951, 1027, 2023, 1012, 2951, 1025, 13075, 3449, 1027, 2023, 1012, 3449, 1025, 13075, 2203, 3726, 2278, 2509, 1025, 1013, 1013, 6942, 2169, 30524, 2023, 1012, 2240, 10497, 3726, 2278, 2509, 1029, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/EditAgent.js
_findChangedCharacters
function _findChangedCharacters(oldValue, value) { if (oldValue === value) { return undefined; } var length = oldValue.length; var index = 0; // find the first character that changed var i; for (i = 0; i < length; i++) { if (value[i] !== oldValue[i]) { break; } } index += i; value = value.substr(i); length -= i; // find the last character that changed for (i = 0; i < length; i++) { if (value[value.length - 1 - i] !== oldValue[oldValue.length - 1 - i]) { break; } } length -= i; value = value.substr(0, value.length - i); return { from: index, to: index + length, text: value }; }
javascript
function _findChangedCharacters(oldValue, value) { if (oldValue === value) { return undefined; } var length = oldValue.length; var index = 0; // find the first character that changed var i; for (i = 0; i < length; i++) { if (value[i] !== oldValue[i]) { break; } } index += i; value = value.substr(i); length -= i; // find the last character that changed for (i = 0; i < length; i++) { if (value[value.length - 1 - i] !== oldValue[oldValue.length - 1 - i]) { break; } } length -= i; value = value.substr(0, value.length - i); return { from: index, to: index + length, text: value }; }
[ "function", "_findChangedCharacters", "(", "oldValue", ",", "value", ")", "{", "if", "(", "oldValue", "===", "value", ")", "{", "return", "undefined", ";", "}", "var", "length", "=", "oldValue", ".", "length", ";", "var", "index", "=", "0", ";", "// find...
Find changed characters @param {string} old value @param {string} changed value @return {from, to, text}
[ "Find", "changed", "characters" ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/LiveDevelopment/Agents/EditAgent.js#L45-L73
train
Find changed characters in the value
[ 30522, 3853, 1035, 2424, 22305, 2098, 7507, 22648, 7747, 1006, 2214, 10175, 5657, 1010, 3643, 1007, 1063, 2065, 1006, 2214, 10175, 5657, 1027, 1027, 1027, 3643, 1007, 1063, 2709, 6151, 28344, 1025, 1065, 13075, 3091, 1027, 2214, 10175, 5657...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/SyncPromise.js
reject
function reject(vReason) { vResult = vReason; iState = -1; if (!bCaught && SyncPromise.listener) { SyncPromise.listener(that, false); } if (fnReject) { fnReject(vReason); fnReject = fnResolve = null; // be nice to the garbage collector } }
javascript
function reject(vReason) { vResult = vReason; iState = -1; if (!bCaught && SyncPromise.listener) { SyncPromise.listener(that, false); } if (fnReject) { fnReject(vReason); fnReject = fnResolve = null; // be nice to the garbage collector } }
[ "function", "reject", "(", "vReason", ")", "{", "vResult", "=", "vReason", ";", "iState", "=", "-", "1", ";", "if", "(", "!", "bCaught", "&&", "SyncPromise", ".", "listener", ")", "{", "SyncPromise", ".", "listener", "(", "that", ",", "false", ")", "...
/* @param {any} [vReason] The reason for rejection
[ "/", "*" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/base/SyncPromise.js#L104-L116
train
rejects the promise
[ 30522, 3853, 15454, 1006, 27830, 5243, 3385, 1007, 1063, 27830, 2229, 11314, 1027, 27830, 5243, 3385, 1025, 21541, 3686, 1027, 1011, 1015, 1025, 2065, 1006, 999, 4647, 4887, 13900, 1004, 1004, 26351, 21572, 28732, 1012, 19373, 1007, 1063, 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...
radare/radare2
shlr/www/graph/js-graph-it.js
ConnectorEndsInspector
function ConnectorEndsInspector() { this.inspect = function(connector) { var children = connector.htmlElement.childNodes; var i; for(i = 0; i < children.length; i++) { if(hasClass(children[i], "connector-end")) { var newElement = new ConnectorEnd(children[i], connector, END); newElement.repaint(); connector.moveListeners.push(newElement); } else if(hasClass(children[i], "connector-start")) { var newElement = new ConnectorEnd(children[i], connector, START); newElement.repaint(); connector.moveListeners.push(newElement); } } } }
javascript
function ConnectorEndsInspector() { this.inspect = function(connector) { var children = connector.htmlElement.childNodes; var i; for(i = 0; i < children.length; i++) { if(hasClass(children[i], "connector-end")) { var newElement = new ConnectorEnd(children[i], connector, END); newElement.repaint(); connector.moveListeners.push(newElement); } else if(hasClass(children[i], "connector-start")) { var newElement = new ConnectorEnd(children[i], connector, START); newElement.repaint(); connector.moveListeners.push(newElement); } } } }
[ "function", "ConnectorEndsInspector", "(", ")", "{", "this", ".", "inspect", "=", "function", "(", "connector", ")", "{", "var", "children", "=", "connector", ".", "htmlElement", ".", "childNodes", ";", "var", "i", ";", "for", "(", "i", "=", "0", ";", ...
/* Inspector classes
[ "/", "*", "Inspector", "classes" ]
bf5e3028810a0ec7c267c6fe4bfad639b4819e35
https://github.com/radare/radare2/blob/bf5e3028810a0ec7c267c6fe4bfad639b4819e35/shlr/www/graph/js-graph-it.js#L1073-L1095
train
Inspector for the end of a connector
[ 30522, 3853, 19400, 10497, 11493, 13102, 22471, 2953, 1006, 1007, 1063, 2023, 1012, 22459, 1027, 3853, 1006, 19400, 1007, 1063, 13075, 2336, 1027, 19400, 1012, 16129, 12260, 3672, 1012, 2775, 3630, 6155, 1025, 13075, 1045, 1025, 2005, 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...
TryGhost/Ghost
core/server/services/url/utils.js
makeAbsoluteUrls
function makeAbsoluteUrls(html, siteUrl, itemUrl, options = {assetsOnly: false}) { html = html || ''; const htmlContent = cheerio.load(html, {decodeEntities: false}); const staticImageUrlPrefixRegex = new RegExp(STATIC_IMAGE_URL_PREFIX); // convert relative resource urls to absolute ['href', 'src'].forEach(function forEach(attributeName) { htmlContent('[' + attributeName + ']').each(function each(ix, el) { el = htmlContent(el); let attributeValue = el.attr(attributeName); // if URL is absolute move on to the next element try { const parsed = url.parse(attributeValue); if (parsed.protocol) { return; } // Do not convert protocol relative URLs if (attributeValue.lastIndexOf('//', 0) === 0) { return; } } catch (e) { return; } // CASE: don't convert internal links if (attributeValue[0] === '#') { return; } if (options.assetsOnly && !attributeValue.match(staticImageUrlPrefixRegex)) { return; } // compose an absolute URL // if the relative URL begins with a '/' use the blog URL (including sub-directory) // as the base URL, otherwise use the post's URL. const baseUrl = attributeValue[0] === '/' ? siteUrl : itemUrl; attributeValue = urlJoin(baseUrl, attributeValue); el.attr(attributeName, attributeValue); }); }); return htmlContent; }
javascript
function makeAbsoluteUrls(html, siteUrl, itemUrl, options = {assetsOnly: false}) { html = html || ''; const htmlContent = cheerio.load(html, {decodeEntities: false}); const staticImageUrlPrefixRegex = new RegExp(STATIC_IMAGE_URL_PREFIX); // convert relative resource urls to absolute ['href', 'src'].forEach(function forEach(attributeName) { htmlContent('[' + attributeName + ']').each(function each(ix, el) { el = htmlContent(el); let attributeValue = el.attr(attributeName); // if URL is absolute move on to the next element try { const parsed = url.parse(attributeValue); if (parsed.protocol) { return; } // Do not convert protocol relative URLs if (attributeValue.lastIndexOf('//', 0) === 0) { return; } } catch (e) { return; } // CASE: don't convert internal links if (attributeValue[0] === '#') { return; } if (options.assetsOnly && !attributeValue.match(staticImageUrlPrefixRegex)) { return; } // compose an absolute URL // if the relative URL begins with a '/' use the blog URL (including sub-directory) // as the base URL, otherwise use the post's URL. const baseUrl = attributeValue[0] === '/' ? siteUrl : itemUrl; attributeValue = urlJoin(baseUrl, attributeValue); el.attr(attributeName, attributeValue); }); }); return htmlContent; }
[ "function", "makeAbsoluteUrls", "(", "html", ",", "siteUrl", ",", "itemUrl", ",", "options", "=", "{", "assetsOnly", ":", "false", "}", ")", "{", "html", "=", "html", "||", "''", ";", "const", "htmlContent", "=", "cheerio", ".", "load", "(", "html", ",...
Make absolute URLs @param {string} html @param {string} siteUrl (blog URL) @param {string} itemUrl (URL of current context) @returns {object} htmlContent @description Takes html, blog url and item url and converts relative url into absolute urls. Returns an object. The html string can be accessed by calling `html()` on the variable that takes the result of this function
[ "Make", "absolute", "URLs" ]
bb7bb55cf3e60af99ebbc56099928827b58461bc
https://github.com/TryGhost/Ghost/blob/bb7bb55cf3e60af99ebbc56099928827b58461bc/core/server/services/url/utils.js#L395-L442
train
Converts relative URLs to absolute URLs
[ 30522, 3853, 2191, 7875, 19454, 10421, 3126, 4877, 1006, 16129, 1010, 2609, 3126, 2140, 1010, 8875, 3126, 2140, 1010, 7047, 1027, 1063, 7045, 2239, 2135, 1024, 6270, 1065, 1007, 1063, 16129, 1027, 16129, 1064, 1064, 1005, 1005, 1025, 9530, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/main.js
enableCheckForUpdateEntry
function enableCheckForUpdateEntry(enable) { var cfuCommand = CommandManager.get(Commands.HELP_CHECK_FOR_UPDATE); cfuCommand.setEnabled(enable); UpdateNotification.enableUpdateNotificationIcon(enable); }
javascript
function enableCheckForUpdateEntry(enable) { var cfuCommand = CommandManager.get(Commands.HELP_CHECK_FOR_UPDATE); cfuCommand.setEnabled(enable); UpdateNotification.enableUpdateNotificationIcon(enable); }
[ "function", "enableCheckForUpdateEntry", "(", "enable", ")", "{", "var", "cfuCommand", "=", "CommandManager", ".", "get", "(", "Commands", ".", "HELP_CHECK_FOR_UPDATE", ")", ";", "cfuCommand", ".", "setEnabled", "(", "enable", ")", ";", "UpdateNotification", ".", ...
Enables/disables the state of "Check For Updates" menu entry under Help Menu
[ "Enables", "/", "disables", "the", "state", "of", "Check", "For", "Updates", "menu", "entry", "under", "Help", "Menu" ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/extensions/default/AutoUpdate/main.js#L592-L596
train
Enable the check for update entry
[ 30522, 3853, 9585, 5403, 3600, 29278, 6279, 13701, 4765, 2854, 1006, 9585, 1007, 1063, 13075, 12935, 14194, 5358, 2386, 2094, 1027, 3094, 24805, 4590, 1012, 2131, 1006, 10954, 1012, 2393, 1035, 4638, 1035, 2005, 1035, 10651, 1007, 1025, 129...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/GrowingEnablement.js
function(sChangeReason) { var mChangeReason = ChangeReason; return sChangeReason == mChangeReason.Sort || sChangeReason == mChangeReason.Filter || sChangeReason == mChangeReason.Context; }
javascript
function(sChangeReason) { var mChangeReason = ChangeReason; return sChangeReason == mChangeReason.Sort || sChangeReason == mChangeReason.Filter || sChangeReason == mChangeReason.Context; }
[ "function", "(", "sChangeReason", ")", "{", "var", "mChangeReason", "=", "ChangeReason", ";", "return", "sChangeReason", "==", "mChangeReason", ".", "Sort", "||", "sChangeReason", "==", "mChangeReason", ".", "Filter", "||", "sChangeReason", "==", "mChangeReason", ...
determines growing reset with binding change reason according to UX sort/filter/context should reset the growing
[ "determines", "growing", "reset", "with", "binding", "change", "reason", "according", "to", "UX", "sort", "/", "filter", "/", "context", "should", "reset", "the", "growing" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.m/src/sap/m/GrowingEnablement.js#L138-L144
train
Returns true if the given change reason is a valid change reason.
[ 30522, 3853, 1006, 8040, 18003, 7869, 3022, 2239, 1007, 1063, 13075, 11338, 18003, 7869, 3022, 2239, 1027, 2689, 16416, 3385, 1025, 2709, 8040, 18003, 7869, 3022, 2239, 1027, 1027, 11338, 18003, 7869, 3022, 2239, 1012, 4066, 1064, 1064, 804...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 () { var oModel = this._oDialog.getModel("view"), oTreeData = oModel.getProperty("/DebugModules")[0], sDisplayCount; oModel.setProperty("/CustomDebugMode", this._treeHelper.toDebugInfo(oTreeData)); oModel.setProperty("/DebugModuleSelectionCount", this._treeHelper.getSelectionCount(oTreeData)); sDisplayCount = oModel.getProperty("/DebugModuleSelectionCount").toString(); oModel.setProperty("/DebugModulesTitle", this._getText("TechInfo.DebugModulesConfigPopup.SelectionCounter", sDisplayCount)); }
javascript
function () { var oModel = this._oDialog.getModel("view"), oTreeData = oModel.getProperty("/DebugModules")[0], sDisplayCount; oModel.setProperty("/CustomDebugMode", this._treeHelper.toDebugInfo(oTreeData)); oModel.setProperty("/DebugModuleSelectionCount", this._treeHelper.getSelectionCount(oTreeData)); sDisplayCount = oModel.getProperty("/DebugModuleSelectionCount").toString(); oModel.setProperty("/DebugModulesTitle", this._getText("TechInfo.DebugModulesConfigPopup.SelectionCounter", sDisplayCount)); }
[ "function", "(", ")", "{", "var", "oModel", "=", "this", ".", "_oDialog", ".", "getModel", "(", "\"view\"", ")", ",", "oTreeData", "=", "oModel", ".", "getProperty", "(", "\"/DebugModules\"", ")", "[", "0", "]", ",", "sDisplayCount", ";", "oModel", ".", ...
Updates the debug mode input field and the number of selected debug modules @private
[ "Updates", "the", "debug", "mode", "input", "field", "and", "the", "number", "of", "selected", "debug", "modules" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/support/techinfo/TechnicalInfo.js#L921-L929
train
Sets the debug mode to debug mode
[ 30522, 3853, 1006, 1007, 1063, 13075, 18168, 10244, 2140, 1027, 2023, 1012, 1035, 21045, 23067, 2290, 1012, 2131, 5302, 9247, 1006, 1000, 3193, 1000, 1007, 1010, 27178, 30524, 1007, 1031, 1014, 1033, 1010, 17371, 2483, 13068, 3597, 16671, 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/analytics/odata4analytics.js
function() { if (this._aMeasureNames) { return this._aMeasureNames; } this._aMeasureNames = []; for ( var sName in this._oMeasureSet) { this._aMeasureNames.push(this._oMeasureSet[sName].getName()); } return this._aMeasureNames; }
javascript
function() { if (this._aMeasureNames) { return this._aMeasureNames; } this._aMeasureNames = []; for ( var sName in this._oMeasureSet) { this._aMeasureNames.push(this._oMeasureSet[sName].getName()); } return this._aMeasureNames; }
[ "function", "(", ")", "{", "if", "(", "this", ".", "_aMeasureNames", ")", "{", "return", "this", ".", "_aMeasureNames", ";", "}", "this", ".", "_aMeasureNames", "=", "[", "]", ";", "for", "(", "var", "sName", "in", "this", ".", "_oMeasureSet", ")", "...
Get the names of all measures included in the query result @returns {string[]} List of all measure names @public @function @name sap.ui.model.analytics.odata4analytics.QueryResult#getAllMeasureNames
[ "Get", "the", "names", "of", "all", "measures", "included", "in", "the", "query", "result" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/analytics/odata4analytics.js#L1047-L1059
train
Returns an array of all measure names
[ 30522, 3853, 1006, 1007, 1063, 2065, 1006, 2023, 1012, 1035, 2572, 5243, 28632, 18442, 2015, 1007, 1063, 2709, 2023, 1012, 1035, 2572, 5243, 28632, 18442, 2015, 1025, 1065, 2023, 1012, 1035, 2572, 5243, 28632, 18442, 2015, 1027, 1031, 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
lib/jsdoc/ui5/template/publish.js
asPlainSummary
function asPlainSummary(sText) { return sText ? summarize(sText).replace(/<.*?>/g, '').replace(/\{\@link\s*(.*?)\}/g, '$1').replace(/"/g,"&quot;") : ''; }
javascript
function asPlainSummary(sText) { return sText ? summarize(sText).replace(/<.*?>/g, '').replace(/\{\@link\s*(.*?)\}/g, '$1').replace(/"/g,"&quot;") : ''; }
[ "function", "asPlainSummary", "(", "sText", ")", "{", "return", "sText", "?", "summarize", "(", "sText", ")", ".", "replace", "(", "/", "<.*?>", "/", "g", ",", "''", ")", ".", "replace", "(", "/", "\\{\\@link\\s*(.*?)\\}", "/", "g", ",", "'$1'", ")", ...
Reduces the given text to a summary and removes all tags links etc. and escapes double quotes. The result therefore should be suitable as content for an HTML tag attribute (e.g. title). @param {string} sText Text to extract a summary from @returns {string} summarized, plain attribute
[ "Reduces", "the", "given", "text", "to", "a", "summary", "and", "removes", "all", "tags", "links", "etc", ".", "and", "escapes", "double", "quotes", ".", "The", "result", "therefore", "should", "be", "suitable", "as", "content", "for", "an", "HTML", "tag",...
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/lib/jsdoc/ui5/template/publish.js#L2106-L2108
train
Converts a string of text to plain summary
[ 30522, 3853, 2004, 24759, 28247, 2819, 7849, 2100, 1006, 26261, 18413, 1007, 1063, 2709, 26261, 18413, 1029, 7680, 7849, 4697, 1006, 26261, 18413, 1007, 1012, 5672, 1006, 1013, 1026, 1012, 1008, 1029, 1028, 1013, 1043, 1010, 1005, 1005, 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...
GeekyAnts/vue-native-core
src/platforms/web/runtime/directives/show.js
locateNode
function locateNode (vnode: VNode): VNodeWithData { return vnode.componentInstance && (!vnode.data || !vnode.data.transition) ? locateNode(vnode.componentInstance._vnode) : vnode }
javascript
function locateNode (vnode: VNode): VNodeWithData { return vnode.componentInstance && (!vnode.data || !vnode.data.transition) ? locateNode(vnode.componentInstance._vnode) : vnode }
[ "function", "locateNode", "(", "vnode", ":", "VNode", ")", ":", "VNodeWithData", "{", "return", "vnode", ".", "componentInstance", "&&", "(", "!", "vnode", ".", "data", "||", "!", "vnode", ".", "data", ".", "transition", ")", "?", "locateNode", "(", "vno...
recursively search for possible transition defined inside the component root
[ "recursively", "search", "for", "possible", "transition", "defined", "inside", "the", "component", "root" ]
a7b4c9e35fe3f01d7576086f41e5e9ec6975b72e
https://github.com/GeekyAnts/vue-native-core/blob/a7b4c9e35fe3f01d7576086f41e5e9ec6975b72e/src/platforms/web/runtime/directives/show.js#L7-L11
train
Locates a node in the hierarchy.
[ 30522, 3853, 12453, 3630, 3207, 1006, 1058, 3630, 3207, 1024, 1058, 3630, 3207, 1007, 1024, 1058, 3630, 3207, 24415, 2850, 2696, 1063, 2709, 1058, 3630, 3207, 1012, 6922, 7076, 26897, 1004, 1004, 1006, 999, 1058, 3630, 3207, 1012, 2951, 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/v4/lib/_Helper.js
function (mQueryOptions, sOrderby, sFilter) { var mResult; function set(sProperty, sValue) { if (sValue && (!mQueryOptions || mQueryOptions[sProperty] !== sValue)) { if (!mResult) { mResult = mQueryOptions ? _Helper.clone(mQueryOptions) : {}; } mResult[sProperty] = sValue; } } set("$orderby", sOrderby); set("$filter", sFilter); return mResult || mQueryOptions; }
javascript
function (mQueryOptions, sOrderby, sFilter) { var mResult; function set(sProperty, sValue) { if (sValue && (!mQueryOptions || mQueryOptions[sProperty] !== sValue)) { if (!mResult) { mResult = mQueryOptions ? _Helper.clone(mQueryOptions) : {}; } mResult[sProperty] = sValue; } } set("$orderby", sOrderby); set("$filter", sFilter); return mResult || mQueryOptions; }
[ "function", "(", "mQueryOptions", ",", "sOrderby", ",", "sFilter", ")", "{", "var", "mResult", ";", "function", "set", "(", "sProperty", ",", "sValue", ")", "{", "if", "(", "sValue", "&&", "(", "!", "mQueryOptions", "||", "mQueryOptions", "[", "sProperty",...
Merges the given values for "$orderby" and "$filter" into the given map of query options. Ensures that the original map is left unchanged, but creates a copy only if necessary. @param {object} [mQueryOptions] The map of query options @param {string} [sOrderby] The new value for the query option "$orderby" @param {string} [sFilter] The new value for the query option "$filter" @returns {object} The merged map of query options
[ "Merges", "the", "given", "values", "for", "$orderby", "and", "$filter", "into", "the", "given", "map", "of", "query", "options", ".", "Ensures", "that", "the", "original", "map", "is", "left", "unchanged", "but", "creates", "a", "copy", "only", "if", "nec...
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/v4/lib/_Helper.js#L861-L876
train
Sets the given query options to the given values.
[ 30522, 3853, 1006, 1049, 4226, 2854, 7361, 9285, 1010, 2061, 26764, 3762, 1010, 16420, 4014, 3334, 1007, 1063, 13075, 2720, 2229, 11314, 1025, 3853, 2275, 1006, 11867, 18981, 15010, 1010, 17917, 2389, 5657, 1007, 1063, 2065, 1006, 17917, 23...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/analytics/odata4analytics.js
function(oSelectedPropertyNames) { if (this._aSortCondition.length == 0) { return ""; } var sOrderByOptionString = ""; for (var i = -1, oCondition; (oCondition = this._aSortCondition[++i]) !== undefined;) { if (!oSelectedPropertyNames[oCondition.property.name]) { continue; // sorting of aggregated entities is meaningful only if the sorted property is also selected } sOrderByOptionString += (sOrderByOptionString == "" ? "" : ",") + oCondition.property.name + " " + oCondition.order; } return sOrderByOptionString; }
javascript
function(oSelectedPropertyNames) { if (this._aSortCondition.length == 0) { return ""; } var sOrderByOptionString = ""; for (var i = -1, oCondition; (oCondition = this._aSortCondition[++i]) !== undefined;) { if (!oSelectedPropertyNames[oCondition.property.name]) { continue; // sorting of aggregated entities is meaningful only if the sorted property is also selected } sOrderByOptionString += (sOrderByOptionString == "" ? "" : ",") + oCondition.property.name + " " + oCondition.order; } return sOrderByOptionString; }
[ "function", "(", "oSelectedPropertyNames", ")", "{", "if", "(", "this", ".", "_aSortCondition", ".", "length", "==", "0", ")", "{", "return", "\"\"", ";", "}", "var", "sOrderByOptionString", "=", "\"\"", ";", "for", "(", "var", "i", "=", "-", "1", ",",...
Get the value for the OData system query option $orderby corresponding to this expression. @param {object} oSelectedPropertyNames Object with properties requested for $select @returns {string} The $orderby value for the sort expressions @public @function @name sap.ui.model.analytics.odata4analytics.SortExpression#getURIOrderByOptionValue
[ "Get", "the", "value", "for", "the", "OData", "system", "query", "option", "$orderby", "corresponding", "to", "this", "expression", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/analytics/odata4analytics.js#L3781-L3795
train
Returns the order by option for the given property list
[ 30522, 3853, 1006, 9808, 12260, 10985, 21572, 4842, 25680, 14074, 2015, 1007, 1063, 2065, 1006, 2023, 1012, 1035, 2004, 11589, 8663, 20562, 1012, 3091, 1027, 1027, 1014, 1007, 1063, 2709, 1000, 1000, 1025, 1065, 13075, 2061, 26764, 3762, 73...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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...
goldfire/howler.js
examples/player/player.js
function(index) { var self = this; // Stop the current track. if (self.playlist[self.index].howl) { self.playlist[self.index].howl.stop(); } // Reset progress. progress.style.width = '0%'; // Play the new track. self.play(index); }
javascript
function(index) { var self = this; // Stop the current track. if (self.playlist[self.index].howl) { self.playlist[self.index].howl.stop(); } // Reset progress. progress.style.width = '0%'; // Play the new track. self.play(index); }
[ "function", "(", "index", ")", "{", "var", "self", "=", "this", ";", "// Stop the current track.", "if", "(", "self", ".", "playlist", "[", "self", ".", "index", "]", ".", "howl", ")", "{", "self", ".", "playlist", "[", "self", ".", "index", "]", "."...
Skip to a specific track based on its playlist index. @param {Number} index Index in the playlist.
[ "Skip", "to", "a", "specific", "track", "based", "on", "its", "playlist", "index", "." ]
030db918dd8ce640afd57e172418472497e8f113
https://github.com/goldfire/howler.js/blob/030db918dd8ce640afd57e172418472497e8f113/examples/player/player.js#L166-L179
train
Play the new track at the given index
[ 30522, 3853, 1006, 5950, 1007, 1063, 13075, 2969, 1027, 2023, 1025, 1013, 1013, 2644, 1996, 2783, 2650, 1012, 2065, 1006, 2969, 1012, 2377, 9863, 1031, 2969, 1012, 5950, 1033, 1012, 22912, 1007, 1063, 2969, 1012, 2377, 9863, 1031, 2969, 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...
badges/shields
services/suggest.js
setRoutes
function setRoutes(allowedOrigin, githubApiProvider, server) { server.ajax.on('suggest/v1', (data, end, ask) => { // The typical dev and production setups are cross-origin. However, in // Heroku deploys and some self-hosted deploys these requests may come from // the same host. Chrome does not send an Origin header on same-origin // requests, but Firefox does. // // It would be better to solve this problem using some well-tested // middleware. const origin = ask.req.headers.origin if (origin) { let host try { host = new URL(origin).hostname } catch (e) { ask.res.setHeader('Access-Control-Allow-Origin', 'null') end({ err: 'Disallowed' }) return } if (host !== ask.req.headers.host) { if (allowedOrigin.includes(origin)) { ask.res.setHeader('Access-Control-Allow-Origin', origin) } else { ask.res.setHeader('Access-Control-Allow-Origin', 'null') end({ err: 'Disallowed' }) return } } } let url try { url = new URL(data.url) } catch (e) { end({ err: `${e}` }) return } findSuggestions(githubApiProvider, url) // This interacts with callback code and can't use async/await. // eslint-disable-next-line promise/prefer-await-to-then .then(suggestions => { end({ suggestions }) }) .catch(err => { end({ suggestions: [], err }) }) }) }
javascript
function setRoutes(allowedOrigin, githubApiProvider, server) { server.ajax.on('suggest/v1', (data, end, ask) => { // The typical dev and production setups are cross-origin. However, in // Heroku deploys and some self-hosted deploys these requests may come from // the same host. Chrome does not send an Origin header on same-origin // requests, but Firefox does. // // It would be better to solve this problem using some well-tested // middleware. const origin = ask.req.headers.origin if (origin) { let host try { host = new URL(origin).hostname } catch (e) { ask.res.setHeader('Access-Control-Allow-Origin', 'null') end({ err: 'Disallowed' }) return } if (host !== ask.req.headers.host) { if (allowedOrigin.includes(origin)) { ask.res.setHeader('Access-Control-Allow-Origin', origin) } else { ask.res.setHeader('Access-Control-Allow-Origin', 'null') end({ err: 'Disallowed' }) return } } } let url try { url = new URL(data.url) } catch (e) { end({ err: `${e}` }) return } findSuggestions(githubApiProvider, url) // This interacts with callback code and can't use async/await. // eslint-disable-next-line promise/prefer-await-to-then .then(suggestions => { end({ suggestions }) }) .catch(err => { end({ suggestions: [], err }) }) }) }
[ "function", "setRoutes", "(", "allowedOrigin", ",", "githubApiProvider", ",", "server", ")", "{", "server", ".", "ajax", ".", "on", "(", "'suggest/v1'", ",", "(", "data", ",", "end", ",", "ask", ")", "=>", "{", "// The typical dev and production setups are cross...
data: {url}, JSON-serializable object. end: function(json), with json of the form: - suggestions: list of objects of the form: - title: string - link: target as a string URL - example: object - pattern: string - namedParams: object - queryParams: object (optional) - link: target as a string URL - preview: object (optional) - style: string
[ "data", ":", "{", "url", "}", "JSON", "-", "serializable", "object", ".", "end", ":", "function", "(", "json", ")", "with", "json", "of", "the", "form", ":", "-", "suggestions", ":", "list", "of", "objects", "of", "the", "form", ":", "-", "title", ...
283601423f3d1a19aae83bf62032d40683948636
https://github.com/badges/shields/blob/283601423f3d1a19aae83bf62032d40683948636/services/suggest.js#L134-L183
train
Sets the HTTP routes for the given server.
[ 30522, 3853, 2275, 22494, 4570, 1006, 3039, 10050, 11528, 1010, 21025, 2705, 19761, 8197, 21572, 17258, 2121, 1010, 8241, 1007, 1063, 8241, 1012, 18176, 1012, 2006, 1006, 1005, 6592, 1013, 1058, 2487, 1005, 1010, 1006, 2951, 1010, 2203, 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...
lynckia/licode
extras/basic_example/public/script.js
startRecording
function startRecording() { if (room !== undefined) { if (!recording) { room.startRecording(localStream, (id) => { recording = true; recordingId = id; }); } else { room.stopRecording(recordingId); recording = false; } } }
javascript
function startRecording() { if (room !== undefined) { if (!recording) { room.startRecording(localStream, (id) => { recording = true; recordingId = id; }); } else { room.stopRecording(recordingId); recording = false; } } }
[ "function", "startRecording", "(", ")", "{", "if", "(", "room", "!==", "undefined", ")", "{", "if", "(", "!", "recording", ")", "{", "room", ".", "startRecording", "(", "localStream", ",", "(", "id", ")", "=>", "{", "recording", "=", "true", ";", "re...
eslint-disable-next-line no-unused-vars
[ "eslint", "-", "disable", "-", "next", "-", "line", "no", "-", "unused", "-", "vars" ]
ce1f09ae30054f677fc25f2011b0e5072fa6f71f
https://github.com/lynckia/licode/blob/ce1f09ae30054f677fc25f2011b0e5072fa6f71f/extras/basic_example/public/script.js#L28-L40
train
Start recording the local stream
[ 30522, 3853, 2707, 2890, 27108, 4667, 1006, 1007, 1063, 2065, 1006, 2282, 999, 1027, 1027, 6151, 28344, 1007, 1063, 2065, 1006, 999, 3405, 1007, 1063, 2282, 1012, 2707, 2890, 27108, 4667, 1006, 10575, 25379, 1010, 1006, 8909, 1007, 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...
eslint/eslint
lib/util/node-event-generator.js
countIdentifiers
function countIdentifiers(parsedSelector) { switch (parsedSelector.type) { case "child": case "descendant": case "sibling": case "adjacent": return countIdentifiers(parsedSelector.left) + countIdentifiers(parsedSelector.right); case "compound": case "not": case "matches": return parsedSelector.selectors.reduce((sum, childSelector) => sum + countIdentifiers(childSelector), 0); case "identifier": return 1; default: return 0; } }
javascript
function countIdentifiers(parsedSelector) { switch (parsedSelector.type) { case "child": case "descendant": case "sibling": case "adjacent": return countIdentifiers(parsedSelector.left) + countIdentifiers(parsedSelector.right); case "compound": case "not": case "matches": return parsedSelector.selectors.reduce((sum, childSelector) => sum + countIdentifiers(childSelector), 0); case "identifier": return 1; default: return 0; } }
[ "function", "countIdentifiers", "(", "parsedSelector", ")", "{", "switch", "(", "parsedSelector", ".", "type", ")", "{", "case", "\"child\"", ":", "case", "\"descendant\"", ":", "case", "\"sibling\"", ":", "case", "\"adjacent\"", ":", "return", "countIdentifiers",...
Counts the number of identifier queries in this selector @param {Object} parsedSelector An object (from esquery) describing the selector's matching behavior @returns {number} The number of identifier queries
[ "Counts", "the", "number", "of", "identifier", "queries", "in", "this", "selector" ]
bc0819c94aad14f7fad3cbc2338ea15658b0f272
https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/util/node-event-generator.js#L115-L134
train
Count identifiers in a selector
[ 30522, 3853, 4175, 5178, 16778, 8873, 2545, 1006, 11968, 6924, 11246, 22471, 2953, 1007, 1063, 6942, 1006, 11968, 6924, 11246, 22471, 2953, 1012, 2828, 1007, 1063, 2553, 1000, 2775, 1000, 1024, 2553, 1000, 12608, 1000, 1024, 2553, 1000, 229...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/extensibility/node/package-validator.js
validate
function validate(path, options, callback) { options = options || {}; fs.exists(path, function (doesExist) { if (!doesExist) { callback(null, { errors: [[Errors.NOT_FOUND_ERR, path]] }); return; } temp.mkdir("bracketsPackage_", function _tempDirCreated(err, extractDir) { if (err) { callback(err, null); return; } extractAndValidateFiles(path, extractDir, options, callback); }); }); }
javascript
function validate(path, options, callback) { options = options || {}; fs.exists(path, function (doesExist) { if (!doesExist) { callback(null, { errors: [[Errors.NOT_FOUND_ERR, path]] }); return; } temp.mkdir("bracketsPackage_", function _tempDirCreated(err, extractDir) { if (err) { callback(err, null); return; } extractAndValidateFiles(path, extractDir, options, callback); }); }); }
[ "function", "validate", "(", "path", ",", "options", ",", "callback", ")", "{", "options", "=", "options", "||", "{", "}", ";", "fs", ".", "exists", "(", "path", ",", "function", "(", "doesExist", ")", "{", "if", "(", "!", "doesExist", ")", "{", "c...
Implements the "validate" command in the "extensions" domain. Validates the zipped package at path. The "err" parameter of the callback is only set if there was an unexpected error. Otherwise, errors are reported in the result. The result object has an "errors" property. It is an array of arrays of strings. Each array in the array is a set of parameters that can be passed to StringUtils.format for internationalization. The array will be empty if there are no errors. The result will have a "metadata" property if the metadata was read successfully from package.json in the zip file. @param {string} path Absolute path to the package zip file @param {{requirePackageJSON: ?boolean, disallowedWords: ?Array.<string>, proxy: ?<string>}} options for validation @param {function} callback (err, result)
[ "Implements", "the", "validate", "command", "in", "the", "extensions", "domain", ".", "Validates", "the", "zipped", "package", "at", "path", "." ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/extensibility/node/package-validator.js#L348-L365
train
Validate the given path
[ 30522, 3853, 9398, 3686, 1006, 4130, 1010, 7047, 1010, 2655, 5963, 1007, 1063, 7047, 1027, 7047, 1064, 1064, 1063, 1065, 1025, 1042, 2015, 1012, 6526, 1006, 4130, 1010, 3853, 1006, 2515, 10288, 30524, 1025, 2709, 1025, 1065, 8915, 8737, 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...
apache/incubator-echarts
src/model/Global.js
function (subType) { var series = this._componentsMap.get('series'); return filter(series, function (oneSeries) { return oneSeries.subType === subType; }); }
javascript
function (subType) { var series = this._componentsMap.get('series'); return filter(series, function (oneSeries) { return oneSeries.subType === subType; }); }
[ "function", "(", "subType", ")", "{", "var", "series", "=", "this", ".", "_componentsMap", ".", "get", "(", "'series'", ")", ";", "return", "filter", "(", "series", ",", "function", "(", "oneSeries", ")", "{", "return", "oneSeries", ".", "subType", "==="...
Get series list before filtered by type. FIXME: rename to getRawSeriesByType? @param {string} subType @return {Array.<module:echarts/model/Series>}
[ "Get", "series", "list", "before", "filtered", "by", "type", ".", "FIXME", ":", "rename", "to", "getRawSeriesByType?" ]
4d0ea095dc3929cb6de40c45748826e7999c7aa8
https://github.com/apache/incubator-echarts/blob/4d0ea095dc3929cb6de40c45748826e7999c7aa8/src/model/Global.js#L499-L504
train
Returns a list of all the calendar series of the specified type
[ 30522, 3853, 1006, 4942, 13874, 1007, 1063, 13075, 2186, 1027, 2023, 1012, 1035, 6177, 2863, 2361, 1012, 2131, 1006, 1005, 2186, 1005, 1007, 1025, 2709, 11307, 1006, 2186, 1010, 3853, 1006, 3924, 28077, 1007, 1063, 2709, 3924, 28077, 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...
keplergl/kepler.gl
src/reducers/vis-state-updaters.js
computeSplitMapLayers
function computeSplitMapLayers(layers) { const mapLayers = layers.reduce( (newLayers, currentLayer) => ({ ...newLayers, [currentLayer.id]: generateLayerMetaForSplitViews(currentLayer) }), {} ); return [ { layers: mapLayers }, { layers: mapLayers } ]; }
javascript
function computeSplitMapLayers(layers) { const mapLayers = layers.reduce( (newLayers, currentLayer) => ({ ...newLayers, [currentLayer.id]: generateLayerMetaForSplitViews(currentLayer) }), {} ); return [ { layers: mapLayers }, { layers: mapLayers } ]; }
[ "function", "computeSplitMapLayers", "(", "layers", ")", "{", "const", "mapLayers", "=", "layers", ".", "reduce", "(", "(", "newLayers", ",", "currentLayer", ")", "=>", "(", "{", "...", "newLayers", ",", "[", "currentLayer", ".", "id", "]", ":", "generateL...
This method will compute the default maps custom list based on the current layers status @param {Array<Object>} layers @returns {Array<Object>} split map settings
[ "This", "method", "will", "compute", "the", "default", "maps", "custom", "list", "based", "on", "the", "current", "layers", "status" ]
779238435707cc54335c2d00001e4b9334b314aa
https://github.com/keplergl/kepler.gl/blob/779238435707cc54335c2d00001e4b9334b314aa/src/reducers/vis-state-updaters.js#L1094-L1110
train
Compute split map layers
[ 30522, 3853, 24134, 13102, 15909, 2863, 13068, 2545, 1006, 9014, 1007, 1063, 9530, 3367, 4949, 24314, 2015, 1027, 9014, 1012, 5547, 1006, 1006, 2047, 24314, 2015, 1010, 2783, 24314, 1007, 1027, 1028, 1006, 1063, 1012, 1012, 1012, 2047, 2431...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/vue-server-renderer/build.js
remove
function remove (arr, item) { if (arr.length) { var index = arr.indexOf(item); if (index > -1) { return arr.splice(index, 1) } } }
javascript
function remove (arr, item) { if (arr.length) { var index = arr.indexOf(item); if (index > -1) { return arr.splice(index, 1) } } }
[ "function", "remove", "(", "arr", ",", "item", ")", "{", "if", "(", "arr", ".", "length", ")", "{", "var", "index", "=", "arr", ".", "indexOf", "(", "item", ")", ";", "if", "(", "index", ">", "-", "1", ")", "{", "return", "arr", ".", "splice", ...
Remove an item from an array
[ "Remove", "an", "item", "from", "an", "array" ]
a7b4c9e35fe3f01d7576086f41e5e9ec6975b72e
https://github.com/GeekyAnts/vue-native-core/blob/a7b4c9e35fe3f01d7576086f41e5e9ec6975b72e/packages/vue-server-renderer/build.js#L84-L91
train
Remove an item from an array
[ 30522, 3853, 6366, 1006, 12098, 2099, 1010, 8875, 1007, 1063, 2065, 1006, 12098, 2099, 1012, 3091, 1007, 1063, 13075, 5950, 1027, 12098, 2099, 1012, 5950, 11253, 1006, 8875, 1007, 1025, 2065, 1006, 5950, 1028, 1011, 1015, 1007, 1063, 2709, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/implicit-arrow-linebreak.js
validateExpression
function validateExpression(node) { if (node.body.type === "BlockStatement") { return; } const arrowToken = sourceCode.getTokenBefore(node.body, isNotOpeningParenToken); const firstTokenOfBody = sourceCode.getTokenAfter(arrowToken); if (arrowToken.loc.end.line === firstTokenOfBody.loc.start.line && option === "below") { context.report({ node: firstTokenOfBody, messageId: "expected", fix: fixer => fixer.insertTextBefore(firstTokenOfBody, "\n") }); } else if (arrowToken.loc.end.line !== firstTokenOfBody.loc.start.line && option === "beside") { context.report({ node: firstTokenOfBody, messageId: "unexpected", fix(fixer) { if (sourceCode.getFirstTokenBetween(arrowToken, firstTokenOfBody, { includeComments: true, filter: isCommentToken })) { return null; } return fixer.replaceTextRange([arrowToken.range[1], firstTokenOfBody.range[0]], " "); } }); } }
javascript
function validateExpression(node) { if (node.body.type === "BlockStatement") { return; } const arrowToken = sourceCode.getTokenBefore(node.body, isNotOpeningParenToken); const firstTokenOfBody = sourceCode.getTokenAfter(arrowToken); if (arrowToken.loc.end.line === firstTokenOfBody.loc.start.line && option === "below") { context.report({ node: firstTokenOfBody, messageId: "expected", fix: fixer => fixer.insertTextBefore(firstTokenOfBody, "\n") }); } else if (arrowToken.loc.end.line !== firstTokenOfBody.loc.start.line && option === "beside") { context.report({ node: firstTokenOfBody, messageId: "unexpected", fix(fixer) { if (sourceCode.getFirstTokenBetween(arrowToken, firstTokenOfBody, { includeComments: true, filter: isCommentToken })) { return null; } return fixer.replaceTextRange([arrowToken.range[1], firstTokenOfBody.range[0]], " "); } }); } }
[ "function", "validateExpression", "(", "node", ")", "{", "if", "(", "node", ".", "body", ".", "type", "===", "\"BlockStatement\"", ")", "{", "return", ";", "}", "const", "arrowToken", "=", "sourceCode", ".", "getTokenBefore", "(", "node", ".", "body", ",",...
Validates the location of an arrow function body @param {ASTNode} node The arrow function body @returns {void}
[ "Validates", "the", "location", "of", "an", "arrow", "function", "body" ]
bc0819c94aad14f7fad3cbc2338ea15658b0f272
https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/implicit-arrow-linebreak.js#L45-L72
train
Validate an Expression node
[ 30522, 3853, 9398, 3686, 10288, 20110, 3258, 1006, 13045, 1007, 1063, 2065, 1006, 13045, 1012, 2303, 1012, 2828, 1027, 1027, 1027, 1000, 5991, 12259, 3672, 1000, 1007, 1063, 2709, 1025, 1065, 9530, 3367, 8612, 18715, 2368, 1027, 3120, 16044...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/coord/polar/Polar.js
function (coord) { var radius = coord[0]; var radian = coord[1] / 180 * Math.PI; var x = Math.cos(radian) * radius + this.cx; // Inverse the y var y = -Math.sin(radian) * radius + this.cy; return [x, y]; }
javascript
function (coord) { var radius = coord[0]; var radian = coord[1] / 180 * Math.PI; var x = Math.cos(radian) * radius + this.cx; // Inverse the y var y = -Math.sin(radian) * radius + this.cy; return [x, y]; }
[ "function", "(", "coord", ")", "{", "var", "radius", "=", "coord", "[", "0", "]", ";", "var", "radian", "=", "coord", "[", "1", "]", "/", "180", "*", "Math", ".", "PI", ";", "var", "x", "=", "Math", ".", "cos", "(", "radian", ")", "*", "radiu...
Convert a (radius, angle) coord to (x, y) point @param {Array.<number>} coord @return {Array.<number>}
[ "Convert", "a", "(", "radius", "angle", ")", "coord", "to", "(", "x", "y", ")", "point" ]
4d0ea095dc3929cb6de40c45748826e7999c7aa8
https://github.com/apache/incubator-echarts/blob/4d0ea095dc3929cb6de40c45748826e7999c7aa8/src/coord/polar/Polar.js#L249-L257
train
Get the x y coordinates of the image
[ 30522, 3853, 1006, 2522, 8551, 1007, 1063, 13075, 12177, 1027, 2522, 8551, 1031, 1014, 1033, 1025, 13075, 10958, 11692, 1027, 2522, 8551, 1031, 1015, 1033, 1013, 8380, 1008, 8785, 1012, 14255, 1025, 13075, 1060, 1027, 8785, 1012, 2522, 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...
Dogfalo/materialize
extras/noUiSlider/nouislider.js
setHandle
function setHandle ( handleNumber, to, lookBackward, lookForward ) { to = checkHandlePosition(scope_Locations, handleNumber, to, lookBackward, lookForward); if ( to === false ) { return false; } updateHandlePosition(handleNumber, to); return true; }
javascript
function setHandle ( handleNumber, to, lookBackward, lookForward ) { to = checkHandlePosition(scope_Locations, handleNumber, to, lookBackward, lookForward); if ( to === false ) { return false; } updateHandlePosition(handleNumber, to); return true; }
[ "function", "setHandle", "(", "handleNumber", ",", "to", ",", "lookBackward", ",", "lookForward", ")", "{", "to", "=", "checkHandlePosition", "(", "scope_Locations", ",", "handleNumber", ",", "to", ",", "lookBackward", ",", "lookForward", ")", ";", "if", "(", ...
Test suggested values and apply margin, step.
[ "Test", "suggested", "values", "and", "apply", "margin", "step", "." ]
1122efadad8f1433d404696f7613e3cc13fb83a4
https://github.com/Dogfalo/materialize/blob/1122efadad8f1433d404696f7613e3cc13fb83a4/extras/noUiSlider/nouislider.js#L1818-L1829
train
setHandle - Set handle
[ 30522, 3853, 6662, 5685, 2571, 1006, 5047, 19172, 5677, 1010, 2000, 1010, 2298, 5963, 7652, 1010, 2298, 29278, 7652, 1007, 1063, 2000, 1027, 4638, 11774, 2571, 26994, 1006, 9531, 1035, 5269, 1010, 5047, 19172, 5677, 1010, 2000, 1010, 2298, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/coord/polar/AngleAxis.js
function () { var axis = this; var labelModel = axis.getLabelModel(); var ordinalScale = axis.scale; var ordinalExtent = ordinalScale.getExtent(); // Providing this method is for optimization: // avoid generating a long array by `getTicks` // in large category data case. var tickCount = ordinalScale.count(); if (ordinalExtent[1] - ordinalExtent[0] < 1) { return 0; } var tickValue = ordinalExtent[0]; var unitSpan = axis.dataToCoord(tickValue + 1) - axis.dataToCoord(tickValue); var unitH = Math.abs(unitSpan); // Not precise, just use height as text width // and each distance from axis line yet. var rect = textContain.getBoundingRect( tickValue, labelModel.getFont(), 'center', 'top' ); var maxH = Math.max(rect.height, 7); var dh = maxH / unitH; // 0/0 is NaN, 1/0 is Infinity. isNaN(dh) && (dh = Infinity); var interval = Math.max(0, Math.floor(dh)); var cache = inner(axis.model); var lastAutoInterval = cache.lastAutoInterval; var lastTickCount = cache.lastTickCount; // Use cache to keep interval stable while moving zoom window, // otherwise the calculated interval might jitter when the zoom // window size is close to the interval-changing size. if (lastAutoInterval != null && lastTickCount != null && Math.abs(lastAutoInterval - interval) <= 1 && Math.abs(lastTickCount - tickCount) <= 1 // Always choose the bigger one, otherwise the critical // point is not the same when zooming in or zooming out. && lastAutoInterval > interval ) { interval = lastAutoInterval; } // Only update cache if cache not used, otherwise the // changing of interval is too insensitive. else { cache.lastTickCount = tickCount; cache.lastAutoInterval = interval; } return interval; }
javascript
function () { var axis = this; var labelModel = axis.getLabelModel(); var ordinalScale = axis.scale; var ordinalExtent = ordinalScale.getExtent(); // Providing this method is for optimization: // avoid generating a long array by `getTicks` // in large category data case. var tickCount = ordinalScale.count(); if (ordinalExtent[1] - ordinalExtent[0] < 1) { return 0; } var tickValue = ordinalExtent[0]; var unitSpan = axis.dataToCoord(tickValue + 1) - axis.dataToCoord(tickValue); var unitH = Math.abs(unitSpan); // Not precise, just use height as text width // and each distance from axis line yet. var rect = textContain.getBoundingRect( tickValue, labelModel.getFont(), 'center', 'top' ); var maxH = Math.max(rect.height, 7); var dh = maxH / unitH; // 0/0 is NaN, 1/0 is Infinity. isNaN(dh) && (dh = Infinity); var interval = Math.max(0, Math.floor(dh)); var cache = inner(axis.model); var lastAutoInterval = cache.lastAutoInterval; var lastTickCount = cache.lastTickCount; // Use cache to keep interval stable while moving zoom window, // otherwise the calculated interval might jitter when the zoom // window size is close to the interval-changing size. if (lastAutoInterval != null && lastTickCount != null && Math.abs(lastAutoInterval - interval) <= 1 && Math.abs(lastTickCount - tickCount) <= 1 // Always choose the bigger one, otherwise the critical // point is not the same when zooming in or zooming out. && lastAutoInterval > interval ) { interval = lastAutoInterval; } // Only update cache if cache not used, otherwise the // changing of interval is too insensitive. else { cache.lastTickCount = tickCount; cache.lastAutoInterval = interval; } return interval; }
[ "function", "(", ")", "{", "var", "axis", "=", "this", ";", "var", "labelModel", "=", "axis", ".", "getLabelModel", "(", ")", ";", "var", "ordinalScale", "=", "axis", ".", "scale", ";", "var", "ordinalExtent", "=", "ordinalScale", ".", "getExtent", "(", ...
Only be called in category axis. Angle axis uses text height to decide interval @override @return {number} Auto interval for cateogry axis tick and label
[ "Only", "be", "called", "in", "category", "axis", ".", "Angle", "axis", "uses", "text", "height", "to", "decide", "interval" ]
4d0ea095dc3929cb6de40c45748826e7999c7aa8
https://github.com/apache/incubator-echarts/blob/4d0ea095dc3929cb6de40c45748826e7999c7aa8/src/coord/polar/AngleAxis.js#L66-L122
train
Returns the interval of the tick.
[ 30522, 3853, 1006, 1007, 1063, 13075, 8123, 1027, 2023, 1025, 13075, 3830, 5302, 9247, 1027, 8123, 1012, 2131, 20470, 2884, 5302, 9247, 1006, 1007, 1025, 13075, 2030, 18979, 4877, 9289, 2063, 1027, 8123, 1012, 4094, 1025, 13075, 2030, 18979...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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(oXhr) { var aTemp = oXhr.getAllResponseHeaders().split("\r\n"); var aHeadersObjects = []; for (var i = 0; i < aTemp.length; i++) { if (aTemp[i]) { var aHeaderValues = aTemp[i].split(":"); aHeadersObjects.push({ name: aHeaderValues[0].trim(), value: aHeaderValues[1].trim() }); } } return aHeadersObjects; }
javascript
function(oXhr) { var aTemp = oXhr.getAllResponseHeaders().split("\r\n"); var aHeadersObjects = []; for (var i = 0; i < aTemp.length; i++) { if (aTemp[i]) { var aHeaderValues = aTemp[i].split(":"); aHeadersObjects.push({ name: aHeaderValues[0].trim(), value: aHeaderValues[1].trim() }); } } return aHeadersObjects; }
[ "function", "(", "oXhr", ")", "{", "var", "aTemp", "=", "oXhr", ".", "getAllResponseHeaders", "(", ")", ".", "split", "(", "\"\\r\\n\"", ")", ";", "var", "aHeadersObjects", "=", "[", "]", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "aTemp...
Transforms the headers from an XMLHttpRequest to the expected har file format. The origin format is a string which will be transformed to an object with name and value properties. E.g. { name: "headername", value: "headervalue" } @param {Object} oXhr The XMLHttpRequest with response headers (needs to be sent). @returns {Array} The result array with the headers as objects.
[ "Transforms", "the", "headers", "from", "an", "XMLHttpRequest", "to", "the", "expected", "har", "file", "format", ".", "The", "origin", "format", "is", "a", "string", "which", "will", "be", "transformed", "to", "an", "object", "with", "name", "and", "value",...
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/thirdparty/RequestRecorder.js#L260-L273
train
Get all response headers
[ 30522, 3853, 1006, 23060, 8093, 1007, 1063, 13075, 8823, 8737, 1027, 23060, 8093, 1012, 2131, 8095, 6072, 26029, 3366, 4974, 2545, 1006, 1007, 1012, 3975, 1006, 1000, 1032, 1054, 1032, 1050, 1000, 1007, 1025, 13075, 3805, 2545, 16429, 20614...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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
getNumberSettings
function getNumberSettings(localeData) { const decimalFormat = localeData.main('numbers/decimalFormats-numberSystem-latn/standard'); const percentFormat = localeData.main('numbers/percentFormats-numberSystem-latn/standard'); const scientificFormat = localeData.main('numbers/scientificFormats-numberSystem-latn/standard'); const currencyFormat = localeData.main('numbers/currencyFormats-numberSystem-latn/standard'); const symbols = localeData.main('numbers/symbols-numberSystem-latn'); const symbolValues = [ symbols.decimal, symbols.group, symbols.list, symbols.percentSign, symbols.plusSign, symbols.minusSign, symbols.exponential, symbols.superscriptingExponent, symbols.perMille, symbols.infinity, symbols.nan, symbols.timeSeparator, ]; if (symbols.currencyDecimal || symbols.currencyGroup) { symbolValues.push(symbols.currencyDecimal); } if (symbols.currencyGroup) { symbolValues.push(symbols.currencyGroup); } return [ symbolValues, [decimalFormat, percentFormat, currencyFormat, scientificFormat] ]; }
javascript
function getNumberSettings(localeData) { const decimalFormat = localeData.main('numbers/decimalFormats-numberSystem-latn/standard'); const percentFormat = localeData.main('numbers/percentFormats-numberSystem-latn/standard'); const scientificFormat = localeData.main('numbers/scientificFormats-numberSystem-latn/standard'); const currencyFormat = localeData.main('numbers/currencyFormats-numberSystem-latn/standard'); const symbols = localeData.main('numbers/symbols-numberSystem-latn'); const symbolValues = [ symbols.decimal, symbols.group, symbols.list, symbols.percentSign, symbols.plusSign, symbols.minusSign, symbols.exponential, symbols.superscriptingExponent, symbols.perMille, symbols.infinity, symbols.nan, symbols.timeSeparator, ]; if (symbols.currencyDecimal || symbols.currencyGroup) { symbolValues.push(symbols.currencyDecimal); } if (symbols.currencyGroup) { symbolValues.push(symbols.currencyGroup); } return [ symbolValues, [decimalFormat, percentFormat, currencyFormat, scientificFormat] ]; }
[ "function", "getNumberSettings", "(", "localeData", ")", "{", "const", "decimalFormat", "=", "localeData", ".", "main", "(", "'numbers/decimalFormats-numberSystem-latn/standard'", ")", ";", "const", "percentFormat", "=", "localeData", ".", "main", "(", "'numbers/percent...
Returns the number symbols and formats for a locale @returns [ symbols, formats ] symbols: [ decimal, group, list, percentSign, plusSign, minusSign, exponential, superscriptingExponent, perMille, infinity, nan, timeSeparator, currencyDecimal?, currencyGroup? ] formats: [ currency, decimal, percent, scientific ]
[ "Returns", "the", "number", "symbols", "and", "formats", "for", "a", "locale" ]
c016e2c4ecf7529f08fae4ca0f5c8b0170c6b51c
https://github.com/angular/angular/blob/c016e2c4ecf7529f08fae4ca0f5c8b0170c6b51c/tools/gulp-tasks/cldr/extract.js#L426-L459
train
Get number settings
[ 30522, 3853, 2131, 19172, 17198, 18319, 3070, 2015, 1006, 2334, 11960, 2696, 1007, 1063, 9530, 3367, 26066, 14192, 4017, 1027, 2334, 11960, 2696, 1012, 2364, 1006, 1005, 3616, 1013, 26066, 14192, 11149, 1011, 3616, 27268, 6633, 1011, 2474, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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...
ccxt/ccxt
examples/js/cli.js
main
async function main () { const requirements = exchangeId && methodName if (!requirements) { printUsage () } else { let args = params .map (s => s.match (/^[0-9]{4}[-]?[0-9]{2}[-]?[0-9]{2}[T\s]?[0-9]{2}[:]?[0-9]{2}[:]?[0-9]{2}/g) ? exchange.parse8601 (s) : s) .map (s => (() => { try { return eval ('(() => (' + s + ')) ()') } catch (e) { return s } }) ()) const www = Array.isArray (exchange.urls.www) ? exchange.urls.www[0] : exchange.urls.www if (cloudscrape) exchange.headers = await scrapeCloudflareHttpHeaderCookie (www) if (cfscrape) exchange.headers = cfscrapeCookies (www) if (cors) { exchange.proxy = 'https://cors-anywhere.herokuapp.com/'; exchange.origin = exchange.uuid () } no_load_markets = no_send ? true : no_load_markets if (debug) { exchange.verbose = verbose } if (!no_load_markets) { await exchange.loadMarkets () } exchange.verbose = verbose if (no_send) { exchange.verbose = no_send exchange.fetch = function fetch (url, method = 'GET', headers = undefined, body = undefined) { log.dim.noLocate ('-------------------------------------------') log.dim.noLocate (exchange.iso8601 (exchange.milliseconds ())) log.green.unlimited ({ url, method, headers, body, }) process.exit () } } if (typeof exchange[methodName] === 'function') { log (exchange.id + '.' + methodName, '(' + args.join (', ') + ')') while (true) { try { const result = await exchange[methodName] (... args) printHumanReadable (exchange, result) } catch (e) { if (e instanceof ExchangeError) { log.red (e.constructor.name, e.message) } else if (e instanceof NetworkError) { log.yellow (e.constructor.name, e.message) } log.dim ('---------------------------------------------------') // rethrow for call-stack // other errors throw e } if (!poll) break; } } else if (exchange[methodName] === undefined) { log.red (exchange.id + '.' + methodName + ': no such property') } else { printHumanReadable (exchange, exchange[methodName]) } } }
javascript
async function main () { const requirements = exchangeId && methodName if (!requirements) { printUsage () } else { let args = params .map (s => s.match (/^[0-9]{4}[-]?[0-9]{2}[-]?[0-9]{2}[T\s]?[0-9]{2}[:]?[0-9]{2}[:]?[0-9]{2}/g) ? exchange.parse8601 (s) : s) .map (s => (() => { try { return eval ('(() => (' + s + ')) ()') } catch (e) { return s } }) ()) const www = Array.isArray (exchange.urls.www) ? exchange.urls.www[0] : exchange.urls.www if (cloudscrape) exchange.headers = await scrapeCloudflareHttpHeaderCookie (www) if (cfscrape) exchange.headers = cfscrapeCookies (www) if (cors) { exchange.proxy = 'https://cors-anywhere.herokuapp.com/'; exchange.origin = exchange.uuid () } no_load_markets = no_send ? true : no_load_markets if (debug) { exchange.verbose = verbose } if (!no_load_markets) { await exchange.loadMarkets () } exchange.verbose = verbose if (no_send) { exchange.verbose = no_send exchange.fetch = function fetch (url, method = 'GET', headers = undefined, body = undefined) { log.dim.noLocate ('-------------------------------------------') log.dim.noLocate (exchange.iso8601 (exchange.milliseconds ())) log.green.unlimited ({ url, method, headers, body, }) process.exit () } } if (typeof exchange[methodName] === 'function') { log (exchange.id + '.' + methodName, '(' + args.join (', ') + ')') while (true) { try { const result = await exchange[methodName] (... args) printHumanReadable (exchange, result) } catch (e) { if (e instanceof ExchangeError) { log.red (e.constructor.name, e.message) } else if (e instanceof NetworkError) { log.yellow (e.constructor.name, e.message) } log.dim ('---------------------------------------------------') // rethrow for call-stack // other errors throw e } if (!poll) break; } } else if (exchange[methodName] === undefined) { log.red (exchange.id + '.' + methodName + ': no such property') } else { printHumanReadable (exchange, exchange[methodName]) } } }
[ "async", "function", "main", "(", ")", "{", "const", "requirements", "=", "exchangeId", "&&", "methodName", "if", "(", "!", "requirements", ")", "{", "printUsage", "(", ")", "}", "else", "{", "let", "args", "=", "params", ".", "map", "(", "s", "=>", ...
-----------------------------------------------------------------------------
[ "-----------------------------------------------------------------------------" ]
8168069b9180a465532905e225586215e115a565
https://github.com/ccxt/ccxt/blob/8168069b9180a465532905e225586215e115a565/examples/js/cli.js#L210-L307
train
Main entry point
[ 30522, 2004, 6038, 2278, 3853, 2364, 1006, 1007, 1063, 9530, 3367, 5918, 1027, 3863, 3593, 1004, 1004, 4118, 30524, 1014, 1011, 1023, 1033, 1063, 1016, 1065, 1031, 1011, 1033, 1029, 1031, 1014, 1011, 1023, 1033, 1063, 1016, 1065, 1031, 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...
lovell/sharp
lib/input.js
_createInputDescriptor
function _createInputDescriptor (input, inputOptions, containerOptions) { const inputDescriptor = { failOnError: true }; if (is.string(input)) { // filesystem inputDescriptor.file = input; } else if (is.buffer(input)) { // Buffer inputDescriptor.buffer = input; } else if (is.plainObject(input) && !is.defined(inputOptions)) { // Plain Object descriptor, e.g. create inputOptions = input; if (is.plainObject(inputOptions.raw)) { // Raw Stream inputDescriptor.buffer = []; } } else if (!is.defined(input) && is.object(containerOptions) && containerOptions.allowStream) { // Stream inputDescriptor.buffer = []; } else { throw new Error('Unsupported input ' + typeof input); } if (is.object(inputOptions)) { // Fail on error if (is.defined(inputOptions.failOnError)) { if (is.bool(inputOptions.failOnError)) { inputDescriptor.failOnError = inputOptions.failOnError; } else { throw new Error('Invalid failOnError (boolean) ' + inputOptions.failOnError); } } // Density if (is.defined(inputOptions.density)) { if (is.inRange(inputOptions.density, 1, 2400)) { inputDescriptor.density = inputOptions.density; } else { throw new Error('Invalid density (1 to 2400) ' + inputOptions.density); } } // Raw pixel input if (is.defined(inputOptions.raw)) { if ( is.object(inputOptions.raw) && is.integer(inputOptions.raw.width) && inputOptions.raw.width > 0 && is.integer(inputOptions.raw.height) && inputOptions.raw.height > 0 && is.integer(inputOptions.raw.channels) && is.inRange(inputOptions.raw.channels, 1, 4) ) { inputDescriptor.rawWidth = inputOptions.raw.width; inputDescriptor.rawHeight = inputOptions.raw.height; inputDescriptor.rawChannels = inputOptions.raw.channels; } else { throw new Error('Expected width, height and channels for raw pixel input'); } } // Multi-page input (GIF, TIFF, PDF) if (is.defined(inputOptions.pages)) { if (is.integer(inputOptions.pages) && is.inRange(inputOptions.pages, -1, 100000)) { inputDescriptor.pages = inputOptions.pages; } } if (is.defined(inputOptions.page)) { if (is.integer(inputOptions.page) && is.inRange(inputOptions.page, 0, 100000)) { inputDescriptor.page = inputOptions.page; } } // Create new image if (is.defined(inputOptions.create)) { if ( is.object(inputOptions.create) && is.integer(inputOptions.create.width) && inputOptions.create.width > 0 && is.integer(inputOptions.create.height) && inputOptions.create.height > 0 && is.integer(inputOptions.create.channels) && is.inRange(inputOptions.create.channels, 3, 4) && is.defined(inputOptions.create.background) ) { inputDescriptor.createWidth = inputOptions.create.width; inputDescriptor.createHeight = inputOptions.create.height; inputDescriptor.createChannels = inputOptions.create.channels; const background = color(inputOptions.create.background); inputDescriptor.createBackground = [ background.red(), background.green(), background.blue(), Math.round(background.alpha() * 255) ]; delete inputDescriptor.buffer; } else { throw new Error('Expected width, height, channels and background to create a new input image'); } } } else if (is.defined(inputOptions)) { throw new Error('Invalid input options ' + inputOptions); } return inputDescriptor; }
javascript
function _createInputDescriptor (input, inputOptions, containerOptions) { const inputDescriptor = { failOnError: true }; if (is.string(input)) { // filesystem inputDescriptor.file = input; } else if (is.buffer(input)) { // Buffer inputDescriptor.buffer = input; } else if (is.plainObject(input) && !is.defined(inputOptions)) { // Plain Object descriptor, e.g. create inputOptions = input; if (is.plainObject(inputOptions.raw)) { // Raw Stream inputDescriptor.buffer = []; } } else if (!is.defined(input) && is.object(containerOptions) && containerOptions.allowStream) { // Stream inputDescriptor.buffer = []; } else { throw new Error('Unsupported input ' + typeof input); } if (is.object(inputOptions)) { // Fail on error if (is.defined(inputOptions.failOnError)) { if (is.bool(inputOptions.failOnError)) { inputDescriptor.failOnError = inputOptions.failOnError; } else { throw new Error('Invalid failOnError (boolean) ' + inputOptions.failOnError); } } // Density if (is.defined(inputOptions.density)) { if (is.inRange(inputOptions.density, 1, 2400)) { inputDescriptor.density = inputOptions.density; } else { throw new Error('Invalid density (1 to 2400) ' + inputOptions.density); } } // Raw pixel input if (is.defined(inputOptions.raw)) { if ( is.object(inputOptions.raw) && is.integer(inputOptions.raw.width) && inputOptions.raw.width > 0 && is.integer(inputOptions.raw.height) && inputOptions.raw.height > 0 && is.integer(inputOptions.raw.channels) && is.inRange(inputOptions.raw.channels, 1, 4) ) { inputDescriptor.rawWidth = inputOptions.raw.width; inputDescriptor.rawHeight = inputOptions.raw.height; inputDescriptor.rawChannels = inputOptions.raw.channels; } else { throw new Error('Expected width, height and channels for raw pixel input'); } } // Multi-page input (GIF, TIFF, PDF) if (is.defined(inputOptions.pages)) { if (is.integer(inputOptions.pages) && is.inRange(inputOptions.pages, -1, 100000)) { inputDescriptor.pages = inputOptions.pages; } } if (is.defined(inputOptions.page)) { if (is.integer(inputOptions.page) && is.inRange(inputOptions.page, 0, 100000)) { inputDescriptor.page = inputOptions.page; } } // Create new image if (is.defined(inputOptions.create)) { if ( is.object(inputOptions.create) && is.integer(inputOptions.create.width) && inputOptions.create.width > 0 && is.integer(inputOptions.create.height) && inputOptions.create.height > 0 && is.integer(inputOptions.create.channels) && is.inRange(inputOptions.create.channels, 3, 4) && is.defined(inputOptions.create.background) ) { inputDescriptor.createWidth = inputOptions.create.width; inputDescriptor.createHeight = inputOptions.create.height; inputDescriptor.createChannels = inputOptions.create.channels; const background = color(inputOptions.create.background); inputDescriptor.createBackground = [ background.red(), background.green(), background.blue(), Math.round(background.alpha() * 255) ]; delete inputDescriptor.buffer; } else { throw new Error('Expected width, height, channels and background to create a new input image'); } } } else if (is.defined(inputOptions)) { throw new Error('Invalid input options ' + inputOptions); } return inputDescriptor; }
[ "function", "_createInputDescriptor", "(", "input", ",", "inputOptions", ",", "containerOptions", ")", "{", "const", "inputDescriptor", "=", "{", "failOnError", ":", "true", "}", ";", "if", "(", "is", ".", "string", "(", "input", ")", ")", "{", "// filesyste...
Create Object containing input and input-related options. @private
[ "Create", "Object", "containing", "input", "and", "input", "-", "related", "options", "." ]
05d76eeadfe54713606a615185b2da047923406b
https://github.com/lovell/sharp/blob/05d76eeadfe54713606a615185b2da047923406b/lib/input.js#L11-L103
train
Create a input descriptor based on the input
[ 30522, 3853, 1035, 3443, 2378, 18780, 6155, 23235, 2953, 1006, 7953, 1010, 7953, 7361, 9285, 1010, 11661, 7361, 9285, 1007, 1063, 9530, 3367, 7953, 6155, 23235, 2953, 1027, 1063, 8246, 5643, 18933, 2099, 1024, 2995, 1065, 1025, 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...
SAP/openui5
src/sap.ui.core/src/sap/ui/core/util/MockServer.js
function(sEntitySetName, sKeys) { sKeys = decodeURIComponent(sKeys); var oFoundEntry; var oEntitySet = that._mEntitySets[sEntitySetName]; var aKeys = oEntitySet.keys; // split keys var aRequestedKeys = sKeys.split(','); // check number of keys to be equal to the entity keys and validates keys type for quotations if (aRequestedKeys.length !== aKeys.length) { that._logAndThrowMockServerCustomError(400, that._oErrorMessages.INVALID_KEY_PREDICATE_QUANTITY); } that._isRequestedKeysValid(oEntitySet, aRequestedKeys); if (aRequestedKeys.length === 1 && !aRequestedKeys[0].split('=')[1]) { aRequestedKeys = [aKeys[0] + "=" + aRequestedKeys[0]]; } jQuery.each(that._oMockdata[sEntitySetName], function(iIndex, oEntry) { // check each key for existence and value for (var i = 0; i < aRequestedKeys.length; i++) { var aKeyVal = aRequestedKeys[i].split('='); var sKey = that._trim(aKeyVal[0]); //key doesn't match, continue to next entry if (!aKeys || aKeys.indexOf(sKey) === -1) { return true; // = continue } var sNewValue = that._trim(aKeyVal[1]); var sOrigiValue = oEntry[sKey]; switch (oEntitySet.keysType[sKey]) { case "Edm.String": sNewValue = sNewValue.replace(/^\'|\'$/g, ''); break; case "Edm.Time": case "Edm.DateTime": sOrigiValue = that._getDateTime(sOrigiValue); break; case "Edm.Int16": case "Edm.Int32": //case "Edm.Int64": In ODataModel this type is represented as a string. (https://openui5.hana.ondemand.com/docs/api/symbols/sap.ui.model.odata.type.Int64.html) case "Edm.Decimal": case "Edm.Byte": case "Edm.Double": case "Edm.Single": case "Edm.SByte": if (!that._isValidNumber(sNewValue)) { //TODO check better handling return false; // = break } sNewValue = parseFloat(sNewValue); break; case "Edm.Guid": sNewValue = sNewValue.replace(/^guid\'|\'$/g, ''); break; case "Edm.Boolean": if (["true", "false"].indexOf(sNewValue) === -1) { that._logAndThrowMockServerCustomError(400, that._oErrorMessages.INVALID_KEY_TYPE, sKey); } sNewValue = sNewValue === "true"; break; case "Edm.Binary": case "Edm.DateTimeOffset": default: sNewValue = sNewValue; } //value doesn't match, continue to next entry if (sOrigiValue !== sNewValue) { return true; // = continue } } oFoundEntry = { index: iIndex, entry: oEntry }; return false; // = break }); return oFoundEntry; }
javascript
function(sEntitySetName, sKeys) { sKeys = decodeURIComponent(sKeys); var oFoundEntry; var oEntitySet = that._mEntitySets[sEntitySetName]; var aKeys = oEntitySet.keys; // split keys var aRequestedKeys = sKeys.split(','); // check number of keys to be equal to the entity keys and validates keys type for quotations if (aRequestedKeys.length !== aKeys.length) { that._logAndThrowMockServerCustomError(400, that._oErrorMessages.INVALID_KEY_PREDICATE_QUANTITY); } that._isRequestedKeysValid(oEntitySet, aRequestedKeys); if (aRequestedKeys.length === 1 && !aRequestedKeys[0].split('=')[1]) { aRequestedKeys = [aKeys[0] + "=" + aRequestedKeys[0]]; } jQuery.each(that._oMockdata[sEntitySetName], function(iIndex, oEntry) { // check each key for existence and value for (var i = 0; i < aRequestedKeys.length; i++) { var aKeyVal = aRequestedKeys[i].split('='); var sKey = that._trim(aKeyVal[0]); //key doesn't match, continue to next entry if (!aKeys || aKeys.indexOf(sKey) === -1) { return true; // = continue } var sNewValue = that._trim(aKeyVal[1]); var sOrigiValue = oEntry[sKey]; switch (oEntitySet.keysType[sKey]) { case "Edm.String": sNewValue = sNewValue.replace(/^\'|\'$/g, ''); break; case "Edm.Time": case "Edm.DateTime": sOrigiValue = that._getDateTime(sOrigiValue); break; case "Edm.Int16": case "Edm.Int32": //case "Edm.Int64": In ODataModel this type is represented as a string. (https://openui5.hana.ondemand.com/docs/api/symbols/sap.ui.model.odata.type.Int64.html) case "Edm.Decimal": case "Edm.Byte": case "Edm.Double": case "Edm.Single": case "Edm.SByte": if (!that._isValidNumber(sNewValue)) { //TODO check better handling return false; // = break } sNewValue = parseFloat(sNewValue); break; case "Edm.Guid": sNewValue = sNewValue.replace(/^guid\'|\'$/g, ''); break; case "Edm.Boolean": if (["true", "false"].indexOf(sNewValue) === -1) { that._logAndThrowMockServerCustomError(400, that._oErrorMessages.INVALID_KEY_TYPE, sKey); } sNewValue = sNewValue === "true"; break; case "Edm.Binary": case "Edm.DateTimeOffset": default: sNewValue = sNewValue; } //value doesn't match, continue to next entry if (sOrigiValue !== sNewValue) { return true; // = continue } } oFoundEntry = { index: iIndex, entry: oEntry }; return false; // = break }); return oFoundEntry; }
[ "function", "(", "sEntitySetName", ",", "sKeys", ")", "{", "sKeys", "=", "decodeURIComponent", "(", "sKeys", ")", ";", "var", "oFoundEntry", ";", "var", "oEntitySet", "=", "that", ".", "_mEntitySets", "[", "sEntitySetName", "]", ";", "var", "aKeys", "=", "...
helper to find the entity set entry for a given entity set name and the keys of the entry
[ "helper", "to", "find", "the", "entity", "set", "entry", "for", "a", "given", "entity", "set", "name", "and", "the", "keys", "of", "the", "entry" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/util/MockServer.js#L1985-L2063
train
Checks if the given keys are valid and if so checks the keys type of the entry are valid.
[ 30522, 3853, 1006, 2741, 3012, 13462, 18442, 1010, 15315, 3240, 2015, 1007, 1063, 15315, 3240, 2015, 1027, 21933, 3207, 9496, 9006, 29513, 3372, 1006, 15315, 3240, 2015, 1007, 1025, 13075, 1997, 28819, 4765, 2854, 1025, 13075, 1051, 4765, 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...
ecomfe/zrender
build/babel-plugin-transform-modules-commonjs-ec.js
nameAnonymousExports
function nameAnonymousExports(programPath) { // Name anonymous exported locals. programPath.get('body').forEach(child => { if (!child.isExportDefaultDeclaration()) { return; } // export default foo; const declaration = child.get('declaration'); if (declaration.isFunctionDeclaration()) { if (!declaration.node.id) { declaration.node.id = declaration.scope.generateUidIdentifier('default'); } } else if (declaration.isClassDeclaration()) { if (!declaration.node.id) { declaration.node.id = declaration.scope.generateUidIdentifier('default'); } } else { const id = declaration.scope.generateUidIdentifier('default'); const namedDecl = babelTypes.exportNamedDeclaration(null, [ babelTypes.exportSpecifier(babelTypes.identifier(id.name), babelTypes.identifier('default')), ]); namedDecl._blockHoist = child.node._blockHoist; const varDecl = babelTypes.variableDeclaration('var', [ babelTypes.variableDeclarator(id, declaration.node), ]); varDecl._blockHoist = child.node._blockHoist; child.replaceWithMultiple([namedDecl, varDecl]); } }); }
javascript
function nameAnonymousExports(programPath) { // Name anonymous exported locals. programPath.get('body').forEach(child => { if (!child.isExportDefaultDeclaration()) { return; } // export default foo; const declaration = child.get('declaration'); if (declaration.isFunctionDeclaration()) { if (!declaration.node.id) { declaration.node.id = declaration.scope.generateUidIdentifier('default'); } } else if (declaration.isClassDeclaration()) { if (!declaration.node.id) { declaration.node.id = declaration.scope.generateUidIdentifier('default'); } } else { const id = declaration.scope.generateUidIdentifier('default'); const namedDecl = babelTypes.exportNamedDeclaration(null, [ babelTypes.exportSpecifier(babelTypes.identifier(id.name), babelTypes.identifier('default')), ]); namedDecl._blockHoist = child.node._blockHoist; const varDecl = babelTypes.variableDeclaration('var', [ babelTypes.variableDeclarator(id, declaration.node), ]); varDecl._blockHoist = child.node._blockHoist; child.replaceWithMultiple([namedDecl, varDecl]); } }); }
[ "function", "nameAnonymousExports", "(", "programPath", ")", "{", "// Name anonymous exported locals.", "programPath", ".", "get", "(", "'body'", ")", ".", "forEach", "(", "child", "=>", "{", "if", "(", "!", "child", ".", "isExportDefaultDeclaration", "(", ")", ...
Ensure that all exported values have local binding names.
[ "Ensure", "that", "all", "exported", "values", "have", "local", "binding", "names", "." ]
30321b57cba3149c30eacb0c1e18276f0f001b9f
https://github.com/ecomfe/zrender/blob/30321b57cba3149c30eacb0c1e18276f0f001b9f/build/babel-plugin-transform-modules-commonjs-ec.js#L368-L402
train
Name anonymous exported locals.
[ 30522, 3853, 2171, 6761, 4890, 27711, 10288, 25378, 1006, 2565, 15069, 1007, 1063, 1013, 1013, 2171, 10812, 15612, 10575, 1012, 2565, 15069, 1012, 2131, 1006, 1005, 2303, 1005, 1007, 1012, 18921, 6776, 1006, 2775, 1027, 1028, 1063, 2065, 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...
GitbookIO/gitbook
lib/utils/location.js
isAnchor
function isAnchor(href) { try { var parsed = url.parse(href); return !!(!parsed.protocol && !parsed.path && parsed.hash); } catch(err) { return false; } }
javascript
function isAnchor(href) { try { var parsed = url.parse(href); return !!(!parsed.protocol && !parsed.path && parsed.hash); } catch(err) { return false; } }
[ "function", "isAnchor", "(", "href", ")", "{", "try", "{", "var", "parsed", "=", "url", ".", "parse", "(", "href", ")", ";", "return", "!", "!", "(", "!", "parsed", ".", "protocol", "&&", "!", "parsed", ".", "path", "&&", "parsed", ".", "hash", "...
Return true if the link is an achor
[ "Return", "true", "if", "the", "link", "is", "an", "achor" ]
6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4
https://github.com/GitbookIO/gitbook/blob/6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4/lib/utils/location.js#L28-L35
train
Check if the href is an anchor
[ 30522, 3853, 18061, 12680, 2953, 1006, 17850, 12879, 1007, 1063, 3046, 1063, 13075, 11968, 6924, 1027, 24471, 2140, 1012, 11968, 3366, 1006, 17850, 12879, 1007, 1025, 2709, 999, 999, 1006, 999, 11968, 6924, 1012, 8778, 1004, 1004, 999, 1196...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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...
netlify/netlify-cms
packages/netlify-cms-widget-markdown/src/serializers/remarkSlate.js
createBlock
function createBlock(type, nodes, props = {}) { if (!isArray(nodes)) { props = nodes; nodes = undefined; } const node = { object: 'block', type, ...props }; return addNodes(node, nodes); }
javascript
function createBlock(type, nodes, props = {}) { if (!isArray(nodes)) { props = nodes; nodes = undefined; } const node = { object: 'block', type, ...props }; return addNodes(node, nodes); }
[ "function", "createBlock", "(", "type", ",", "nodes", ",", "props", "=", "{", "}", ")", "{", "if", "(", "!", "isArray", "(", "nodes", ")", ")", "{", "props", "=", "nodes", ";", "nodes", "=", "undefined", ";", "}", "const", "node", "=", "{", "obje...
Create a Slate Inline node.
[ "Create", "a", "Slate", "Inline", "node", "." ]
2488556590cbfdcefa626f2f2de01e7a160cf6ee
https://github.com/netlify/netlify-cms/blob/2488556590cbfdcefa626f2f2de01e7a160cf6ee/packages/netlify-cms-widget-markdown/src/serializers/remarkSlate.js#L68-L76
train
Create a block node
[ 30522, 3853, 3443, 23467, 1006, 2828, 1010, 14164, 1010, 24387, 1027, 1063, 1065, 1007, 1063, 2065, 1006, 999, 18061, 11335, 2100, 1006, 14164, 1007, 1007, 1063, 24387, 1027, 14164, 1025, 14164, 1027, 6151, 28344, 1025, 1065, 9530, 3367, 13...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/Manifest.js
getObject
function getObject(oObject, sPath) { // if the incoming sPath is a path we do a nested lookup in the // manifest object and return the concrete value, e.g. "/sap.ui5/extends" if (oObject && sPath && typeof sPath === "string" && sPath[0] === "/") { var aPaths = sPath.substring(1).split("/"), sPathSegment; for (var i = 0, l = aPaths.length; i < l; i++) { sPathSegment = aPaths[i]; // Prevent access to native properties oObject = oObject.hasOwnProperty(sPathSegment) ? oObject[sPathSegment] : undefined; // Only continue with lookup if the value is an object. // Accessing properties of other types is not allowed! if (oObject === null || typeof oObject !== "object") { // Clear the value in case this is not the last segment in the path. // Otherwise e.g. "/foo/bar/baz" would return the value of "/foo/bar" // in case it is not an object. if (i + 1 < l && oObject !== undefined) { oObject = undefined; } break; } } return oObject; } // if no path starting with slash is specified we access and // return the value directly from the manifest return oObject && oObject[sPath]; }
javascript
function getObject(oObject, sPath) { // if the incoming sPath is a path we do a nested lookup in the // manifest object and return the concrete value, e.g. "/sap.ui5/extends" if (oObject && sPath && typeof sPath === "string" && sPath[0] === "/") { var aPaths = sPath.substring(1).split("/"), sPathSegment; for (var i = 0, l = aPaths.length; i < l; i++) { sPathSegment = aPaths[i]; // Prevent access to native properties oObject = oObject.hasOwnProperty(sPathSegment) ? oObject[sPathSegment] : undefined; // Only continue with lookup if the value is an object. // Accessing properties of other types is not allowed! if (oObject === null || typeof oObject !== "object") { // Clear the value in case this is not the last segment in the path. // Otherwise e.g. "/foo/bar/baz" would return the value of "/foo/bar" // in case it is not an object. if (i + 1 < l && oObject !== undefined) { oObject = undefined; } break; } } return oObject; } // if no path starting with slash is specified we access and // return the value directly from the manifest return oObject && oObject[sPath]; }
[ "function", "getObject", "(", "oObject", ",", "sPath", ")", "{", "// if the incoming sPath is a path we do a nested lookup in the", "// manifest object and return the concrete value, e.g. \"/sap.ui5/extends\"", "if", "(", "oObject", "&&", "sPath", "&&", "typeof", "sPath", "===", ...
Utility function to access a child member by a given path @param {object} oObject Object @param {string} sPath Path starting with a slash (/) @return {any} value of a member specified by its path; if the path doesn't start with a slash it returns the value for the given path of the object
[ "Utility", "function", "to", "access", "a", "child", "member", "by", "a", "given", "path" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/Manifest.js#L84-L116
train
Get the concrete value of the given path in the manifest object.
[ 30522, 3853, 2131, 16429, 20614, 1006, 1051, 16429, 20614, 1010, 14690, 2232, 1007, 1063, 1013, 1013, 2065, 1996, 14932, 14690, 2232, 2003, 1037, 4130, 2057, 2079, 1037, 9089, 2098, 2298, 6279, 1999, 1996, 1013, 1013, 19676, 4874, 1998, 270...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/_vendor/popper.js/dist/popper.js
includeScroll
function includeScroll(rect, element, subtract = false) { const scrollTop = getScroll(element, 'top'); const scrollLeft = getScroll(element, 'left'); const modifier = subtract ? -1 : 1; rect.top += scrollTop * modifier; rect.bottom += scrollTop * modifier; rect.left += scrollLeft * modifier; rect.right += scrollLeft * modifier; return rect; }
javascript
function includeScroll(rect, element, subtract = false) { const scrollTop = getScroll(element, 'top'); const scrollLeft = getScroll(element, 'left'); const modifier = subtract ? -1 : 1; rect.top += scrollTop * modifier; rect.bottom += scrollTop * modifier; rect.left += scrollLeft * modifier; rect.right += scrollLeft * modifier; return rect; }
[ "function", "includeScroll", "(", "rect", ",", "element", ",", "subtract", "=", "false", ")", "{", "const", "scrollTop", "=", "getScroll", "(", "element", ",", "'top'", ")", ";", "const", "scrollLeft", "=", "getScroll", "(", "element", ",", "'left'", ")", ...
/* Sum or subtract the element scroll values (left and top) from a given rect object @method @memberof Popper.Utils @param {Object} rect - Rect object you want to change @param {HTMLElement} element - The element from the function reads the scroll values @param {Boolean} subtract - set to true if you want to subtract the scroll values @return {Object} rect - The modifier rect object
[ "/", "*", "Sum", "or", "subtract", "the", "element", "scroll", "values", "(", "left", "and", "top", ")", "from", "a", "given", "rect", "object" ]
a913e4992dad8f7bf38df2e1d3f4cc6bfe5f26dd
https://github.com/thomaspark/bootswatch/blob/a913e4992dad8f7bf38df2e1d3f4cc6bfe5f26dd/docs/_vendor/popper.js/dist/popper.js#L301-L310
train
Adds scroll position to rect
[ 30522, 3853, 2950, 26775, 14511, 1006, 28667, 2102, 1010, 5783, 1010, 4942, 6494, 6593, 1027, 6270, 1007, 1063, 9530, 3367, 17186, 14399, 1027, 4152, 26775, 14511, 1006, 5783, 1010, 1005, 2327, 1005, 1007, 1025, 9530, 3367, 17186, 2571, 619...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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() { var offset = this.reader.lastIndexOfSignature(sig.CENTRAL_DIRECTORY_END); if (offset === -1) { throw new Error("Corrupted zip : can't find end of central directory"); } this.reader.setIndex(offset); this.checkSignature(sig.CENTRAL_DIRECTORY_END); this.readBlockEndOfCentral(); /* extract from the zip spec : 4) If one of the fields in the end of central directory record is too small to hold required data, the field should be set to -1 (0xFFFF or 0xFFFFFFFF) and the ZIP64 format record should be created. 5) The end of central directory record and the Zip64 end of central directory locator record must reside on the same disk when splitting or spanning an archive. */ if (this.diskNumber === utils.MAX_VALUE_16BITS || this.diskWithCentralDirStart === utils.MAX_VALUE_16BITS || this.centralDirRecordsOnThisDisk === utils.MAX_VALUE_16BITS || this.centralDirRecords === utils.MAX_VALUE_16BITS || this.centralDirSize === utils.MAX_VALUE_32BITS || this.centralDirOffset === utils.MAX_VALUE_32BITS) { this.zip64 = true; /* Warning : the zip64 extension is supported, but ONLY if the 64bits integer read from the zip file can fit into a 32bits integer. This cannot be solved : Javascript represents all numbers as 64-bit double precision IEEE 754 floating point numbers. So, we have 53bits for integers and bitwise operations treat everything as 32bits. see https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Operators/Bitwise_Operators and http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-262.pdf section 8.5 */ // should look for a zip64 EOCD locator offset = this.reader.lastIndexOfSignature(sig.ZIP64_CENTRAL_DIRECTORY_LOCATOR); if (offset === -1) { throw new Error("Corrupted zip : can't find the ZIP64 end of central directory locator"); } this.reader.setIndex(offset); this.checkSignature(sig.ZIP64_CENTRAL_DIRECTORY_LOCATOR); this.readBlockZip64EndOfCentralLocator(); // now the zip64 EOCD record this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir); this.checkSignature(sig.ZIP64_CENTRAL_DIRECTORY_END); this.readBlockZip64EndOfCentral(); } }
javascript
function() { var offset = this.reader.lastIndexOfSignature(sig.CENTRAL_DIRECTORY_END); if (offset === -1) { throw new Error("Corrupted zip : can't find end of central directory"); } this.reader.setIndex(offset); this.checkSignature(sig.CENTRAL_DIRECTORY_END); this.readBlockEndOfCentral(); /* extract from the zip spec : 4) If one of the fields in the end of central directory record is too small to hold required data, the field should be set to -1 (0xFFFF or 0xFFFFFFFF) and the ZIP64 format record should be created. 5) The end of central directory record and the Zip64 end of central directory locator record must reside on the same disk when splitting or spanning an archive. */ if (this.diskNumber === utils.MAX_VALUE_16BITS || this.diskWithCentralDirStart === utils.MAX_VALUE_16BITS || this.centralDirRecordsOnThisDisk === utils.MAX_VALUE_16BITS || this.centralDirRecords === utils.MAX_VALUE_16BITS || this.centralDirSize === utils.MAX_VALUE_32BITS || this.centralDirOffset === utils.MAX_VALUE_32BITS) { this.zip64 = true; /* Warning : the zip64 extension is supported, but ONLY if the 64bits integer read from the zip file can fit into a 32bits integer. This cannot be solved : Javascript represents all numbers as 64-bit double precision IEEE 754 floating point numbers. So, we have 53bits for integers and bitwise operations treat everything as 32bits. see https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Operators/Bitwise_Operators and http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-262.pdf section 8.5 */ // should look for a zip64 EOCD locator offset = this.reader.lastIndexOfSignature(sig.ZIP64_CENTRAL_DIRECTORY_LOCATOR); if (offset === -1) { throw new Error("Corrupted zip : can't find the ZIP64 end of central directory locator"); } this.reader.setIndex(offset); this.checkSignature(sig.ZIP64_CENTRAL_DIRECTORY_LOCATOR); this.readBlockZip64EndOfCentralLocator(); // now the zip64 EOCD record this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir); this.checkSignature(sig.ZIP64_CENTRAL_DIRECTORY_END); this.readBlockZip64EndOfCentral(); } }
[ "function", "(", ")", "{", "var", "offset", "=", "this", ".", "reader", ".", "lastIndexOfSignature", "(", "sig", ".", "CENTRAL_DIRECTORY_END", ")", ";", "if", "(", "offset", "===", "-", "1", ")", "{", "throw", "new", "Error", "(", "\"Corrupted zip : can't ...
Read the end of central directory.
[ "Read", "the", "end", "of", "central", "directory", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/thirdparty/jszip.js#L1809-L1855
train
Extract the end of central directory
[ 30522, 3853, 1006, 1007, 1063, 13075, 16396, 1027, 2023, 1012, 8068, 1012, 2197, 22254, 10288, 11253, 5332, 16989, 11244, 1006, 9033, 2290, 1012, 2430, 1035, 14176, 1035, 2203, 1007, 1025, 2065, 1006, 16396, 1027, 1027, 1027, 1011, 1015, 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.core/src/sap/ui/model/Sorter.js
function(oContext) { var oGroup = this.fnGroup(oContext); if (typeof oGroup === "string" || typeof oGroup === "number" || typeof oGroup === "boolean" || oGroup == null) { oGroup = { key: oGroup }; } return oGroup; }
javascript
function(oContext) { var oGroup = this.fnGroup(oContext); if (typeof oGroup === "string" || typeof oGroup === "number" || typeof oGroup === "boolean" || oGroup == null) { oGroup = { key: oGroup }; } return oGroup; }
[ "function", "(", "oContext", ")", "{", "var", "oGroup", "=", "this", ".", "fnGroup", "(", "oContext", ")", ";", "if", "(", "typeof", "oGroup", "===", "\"string\"", "||", "typeof", "oGroup", "===", "\"number\"", "||", "typeof", "oGroup", "===", "\"boolean\"...
Returns a group object, at least containing a key property for group detection. May contain additional properties as provided by a custom group function. @param {sap.ui.model.Context} oContext the binding context @return {object} An object containing a key property and optional custom properties @public
[ "Returns", "a", "group", "object", "at", "least", "containing", "a", "key", "property", "for", "group", "detection", ".", "May", "contain", "additional", "properties", "as", "provided", "by", "a", "custom", "group", "function", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/Sorter.js#L82-L90
train
Returns the group object for the given context
[ 30522, 3853, 1006, 1051, 8663, 18209, 1007, 1063, 13075, 13958, 22107, 1027, 2023, 1012, 1042, 3070, 22107, 1006, 1051, 8663, 18209, 1007, 1025, 2065, 1006, 2828, 11253, 13958, 22107, 1027, 1027, 1027, 1000, 5164, 1000, 1064, 1064, 2828, 11...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/icon/js/iconService.js
getIcon
function getIcon(id) { id = id || ''; // If the "id" provided is not a string, the only other valid value is a $sce trust wrapper // over a URL string. If the value is not trusted, this will intentionally throw an error // because the user is attempted to use an unsafe URL, potentially opening themselves up // to an XSS attack. if (!angular.isString(id)) { id = $sce.getTrustedUrl(id); } // If already loaded and cached, use a clone of the cached icon. // Otherwise either load by URL, or lookup in the registry and then load by URL, and cache. if (iconCache[id]) { return $q.when(transformClone(iconCache[id])); } if (urlRegex.test(id) || dataUrlRegex.test(id)) { return loadByURL(id).then(cacheIcon(id)); } if (id.indexOf(':') === -1) { id = '$default:' + id; } var load = config[id] ? loadByID : loadFromIconSet; return load(id) .then(cacheIcon(id)); }
javascript
function getIcon(id) { id = id || ''; // If the "id" provided is not a string, the only other valid value is a $sce trust wrapper // over a URL string. If the value is not trusted, this will intentionally throw an error // because the user is attempted to use an unsafe URL, potentially opening themselves up // to an XSS attack. if (!angular.isString(id)) { id = $sce.getTrustedUrl(id); } // If already loaded and cached, use a clone of the cached icon. // Otherwise either load by URL, or lookup in the registry and then load by URL, and cache. if (iconCache[id]) { return $q.when(transformClone(iconCache[id])); } if (urlRegex.test(id) || dataUrlRegex.test(id)) { return loadByURL(id).then(cacheIcon(id)); } if (id.indexOf(':') === -1) { id = '$default:' + id; } var load = config[id] ? loadByID : loadFromIconSet; return load(id) .then(cacheIcon(id)); }
[ "function", "getIcon", "(", "id", ")", "{", "id", "=", "id", "||", "''", ";", "// If the \"id\" provided is not a string, the only other valid value is a $sce trust wrapper", "// over a URL string. If the value is not trusted, this will intentionally throw an error", "// because the user...
Actual $mdIcon service is essentially a lookup function @param {*} id $sce trust wrapper over a URL string, URL, icon registry id, or icon set id @returns {angular.$q.Promise}
[ "Actual", "$mdIcon", "service", "is", "essentially", "a", "lookup", "function" ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/icon/js/iconService.js#L423-L452
train
Returns the icon for the given id.
[ 30522, 3853, 2131, 28524, 1006, 8909, 1007, 1063, 8909, 1027, 8909, 1064, 1064, 1005, 1005, 1025, 1013, 1013, 2065, 1996, 1000, 8909, 1000, 3024, 2003, 2025, 1037, 5164, 1010, 1996, 2069, 2060, 9398, 3643, 2003, 1037, 1002, 8040, 2063, 34...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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...
didi/cube-ui
example/modules/image.js
getOrientation
function getOrientation(buffer){ var view = new DataView(buffer); if (view.getUint16(0, false) != 0xFFD8) return -2; var length = view.byteLength, offset = 2; while (offset < length) { var marker = view.getUint16(offset, false); offset += 2; if (marker == 0xFFE1) { if (view.getUint32(offset += 2, false) != 0x45786966) return -1; var little = view.getUint16(offset += 6, false) == 0x4949; offset += view.getUint32(offset + 4, little); var tags = view.getUint16(offset, little); offset += 2; for (var i = 0; i < tags; i++) if (view.getUint16(offset + (i * 12), little) == 0x0112) return view.getUint16(offset + (i * 12) + 8, little); } else if ((marker & 0xFF00) != 0xFF00) break; else offset += view.getUint16(offset, false); } return -1; }
javascript
function getOrientation(buffer){ var view = new DataView(buffer); if (view.getUint16(0, false) != 0xFFD8) return -2; var length = view.byteLength, offset = 2; while (offset < length) { var marker = view.getUint16(offset, false); offset += 2; if (marker == 0xFFE1) { if (view.getUint32(offset += 2, false) != 0x45786966) return -1; var little = view.getUint16(offset += 6, false) == 0x4949; offset += view.getUint32(offset + 4, little); var tags = view.getUint16(offset, little); offset += 2; for (var i = 0; i < tags; i++) if (view.getUint16(offset + (i * 12), little) == 0x0112) return view.getUint16(offset + (i * 12) + 8, little); } else if ((marker & 0xFF00) != 0xFF00) break; else offset += view.getUint16(offset, false); } return -1; }
[ "function", "getOrientation", "(", "buffer", ")", "{", "var", "view", "=", "new", "DataView", "(", "buffer", ")", ";", "if", "(", "view", ".", "getUint16", "(", "0", ",", "false", ")", "!=", "0xFFD8", ")", "return", "-", "2", ";", "var", "length", ...
获取图片的orientation ref to http://stackoverflow.com/questions/7584794/accessing-jpeg-exif-rotation-data-in-javascript-on-the-client-side
[ "获取图片的orientation", "ref", "to", "http", ":", "//", "stackoverflow", ".", "com", "/", "questions", "/", "7584794", "/", "accessing", "-", "jpeg", "-", "exif", "-", "rotation", "-", "data", "-", "in", "-", "javascript", "-", "on", "-", "the", "-", "clie...
29096d1fe600c699237db8039255f74126730157
https://github.com/didi/cube-ui/blob/29096d1fe600c699237db8039255f74126730157/example/modules/image.js#L78-L99
train
Get the orientation of the logarithmic algorithm
[ 30522, 3853, 2131, 10050, 19304, 1006, 17698, 1007, 1063, 13075, 3193, 1027, 2047, 2951, 8584, 1006, 17698, 1007, 1025, 2065, 1006, 3193, 1012, 2131, 20023, 2102, 16048, 1006, 1014, 1010, 6270, 1007, 999, 1027, 1014, 2595, 4246, 2094, 2620,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/InlineTimingFunctionEditor/BezierCurveEditor.js
CubicBezier
function CubicBezier(coordinates) { if (typeof coordinates === "string") { this.coordinates = coordinates.split(","); } else { this.coordinates = coordinates; } if (!this.coordinates) { throw "No offsets were defined"; } this.coordinates = this.coordinates.map(function (n) { return +n; }); var i; for (i = 3; i >= 0; i--) { var xy = this.coordinates[i]; if (isNaN(xy) || (((i % 2) === 0) && (xy < 0 || xy > 1))) { throw "Wrong coordinate at " + i + "(" + xy + ")"; } } }
javascript
function CubicBezier(coordinates) { if (typeof coordinates === "string") { this.coordinates = coordinates.split(","); } else { this.coordinates = coordinates; } if (!this.coordinates) { throw "No offsets were defined"; } this.coordinates = this.coordinates.map(function (n) { return +n; }); var i; for (i = 3; i >= 0; i--) { var xy = this.coordinates[i]; if (isNaN(xy) || (((i % 2) === 0) && (xy < 0 || xy > 1))) { throw "Wrong coordinate at " + i + "(" + xy + ")"; } } }
[ "function", "CubicBezier", "(", "coordinates", ")", "{", "if", "(", "typeof", "coordinates", "===", "\"string\"", ")", "{", "this", ".", "coordinates", "=", "coordinates", ".", "split", "(", "\",\"", ")", ";", "}", "else", "{", "this", ".", "coordinates", ...
CubicBezier object constructor @param {string|Array.number[4]} coordinates Four parameters passes to cubic-bezier() either in string or array format.
[ "CubicBezier", "object", "constructor" ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/extensions/default/InlineTimingFunctionEditor/BezierCurveEditor.js#L50-L70
train
CubicBezier constructor.
[ 30522, 3853, 11919, 4783, 21548, 1006, 12093, 1007, 1063, 2065, 1006, 2828, 11253, 12093, 1027, 1027, 1027, 1000, 5164, 1000, 1007, 1063, 2023, 1012, 12093, 1027, 12093, 1012, 3975, 1006, 1000, 1010, 1000, 1007, 1025, 1065, 2842, 1063, 2023...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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-await-in-loop.js
validate
function validate(awaitNode) { if (awaitNode.type === "ForOfStatement" && !awaitNode.await) { return; } let node = awaitNode; let parent = node.parent; while (parent && !isBoundary(parent)) { if (isLooped(node, parent)) { context.report({ node: awaitNode, messageId: "unexpectedAwait" }); return; } node = parent; parent = parent.parent; } }
javascript
function validate(awaitNode) { if (awaitNode.type === "ForOfStatement" && !awaitNode.await) { return; } let node = awaitNode; let parent = node.parent; while (parent && !isBoundary(parent)) { if (isLooped(node, parent)) { context.report({ node: awaitNode, messageId: "unexpectedAwait" }); return; } node = parent; parent = parent.parent; } }
[ "function", "validate", "(", "awaitNode", ")", "{", "if", "(", "awaitNode", ".", "type", "===", "\"ForOfStatement\"", "&&", "!", "awaitNode", ".", "await", ")", "{", "return", ";", "}", "let", "node", "=", "awaitNode", ";", "let", "parent", "=", "node", ...
Validate an await expression. @param {ASTNode} awaitNode An AwaitExpression or ForOfStatement node to validate. @returns {void}
[ "Validate", "an", "await", "expression", "." ]
bc0819c94aad14f7fad3cbc2338ea15658b0f272
https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/no-await-in-loop.js#L80-L99
train
Validate await node
[ 30522, 3853, 9398, 3686, 1006, 26751, 3630, 3207, 1007, 1063, 2065, 1006, 26751, 3630, 3207, 1012, 2828, 1027, 1027, 1027, 1000, 2005, 11253, 9153, 18532, 4765, 1000, 1004, 1004, 999, 26751, 3630, 3207, 1012, 26751, 1007, 1063, 2709, 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.core/src/sap/ui/thirdparty/qunit.js
function( count ) { var globalStartAlreadyCalled = globalStartCalled; if ( !config.current ) { globalStartCalled = true; if ( runStarted ) { throw new Error( "Called start() outside of a test context while already started" ); } else if ( globalStartAlreadyCalled || count > 1 ) { throw new Error( "Called start() outside of a test context too many times" ); } else if ( config.autostart ) { throw new Error( "Called start() outside of a test context when " + "QUnit.config.autostart was true" ); } else if ( !config.pageLoaded ) { // The page isn't completely loaded yet, so bail out and let `QUnit.load` handle it config.autostart = true; return; } } else { // If a test is running, adjust its semaphore config.current.semaphore -= count || 1; // Don't start until equal number of stop-calls if ( config.current.semaphore > 0 ) { return; } // throw an Error if start is called more often than stop if ( config.current.semaphore < 0 ) { config.current.semaphore = 0; QUnit.pushFailure( "Called start() while already started (test's semaphore was 0 already)", sourceFromStacktrace( 2 ) ); return; } } resumeProcessing(); }
javascript
function( count ) { var globalStartAlreadyCalled = globalStartCalled; if ( !config.current ) { globalStartCalled = true; if ( runStarted ) { throw new Error( "Called start() outside of a test context while already started" ); } else if ( globalStartAlreadyCalled || count > 1 ) { throw new Error( "Called start() outside of a test context too many times" ); } else if ( config.autostart ) { throw new Error( "Called start() outside of a test context when " + "QUnit.config.autostart was true" ); } else if ( !config.pageLoaded ) { // The page isn't completely loaded yet, so bail out and let `QUnit.load` handle it config.autostart = true; return; } } else { // If a test is running, adjust its semaphore config.current.semaphore -= count || 1; // Don't start until equal number of stop-calls if ( config.current.semaphore > 0 ) { return; } // throw an Error if start is called more often than stop if ( config.current.semaphore < 0 ) { config.current.semaphore = 0; QUnit.pushFailure( "Called start() while already started (test's semaphore was 0 already)", sourceFromStacktrace( 2 ) ); return; } } resumeProcessing(); }
[ "function", "(", "count", ")", "{", "var", "globalStartAlreadyCalled", "=", "globalStartCalled", ";", "if", "(", "!", "config", ".", "current", ")", "{", "globalStartCalled", "=", "true", ";", "if", "(", "runStarted", ")", "{", "throw", "new", "Error", "("...
DEPRECATED: The functionality of QUnit.start() will be altered in QUnit 2.0. In QUnit 2.0, invoking it will ONLY affect the `QUnit.config.autostart` blocking behavior.
[ "DEPRECATED", ":", "The", "functionality", "of", "QUnit", ".", "start", "()", "will", "be", "altered", "in", "QUnit", "2", ".", "0", ".", "In", "QUnit", "2", ".", "0", "invoking", "it", "will", "ONLY", "affect", "the", "QUnit", ".", "config", ".", "a...
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/thirdparty/qunit.js#L291-L333
train
Starts a test at the specified count of times.
[ 30522, 3853, 1006, 4175, 1007, 1063, 13075, 3795, 14117, 9080, 16416, 5149, 9289, 3709, 1027, 3795, 14117, 13535, 24164, 2094, 1025, 2065, 1006, 999, 9530, 8873, 2290, 1012, 2783, 1007, 1063, 3795, 14117, 13535, 24164, 2094, 1027, 2995, 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...
eslint/eslint
lib/rules/semi-spacing.js
isBeforeClosingParen
function isBeforeClosingParen(token) { const nextToken = sourceCode.getTokenAfter(token); return (nextToken && astUtils.isClosingBraceToken(nextToken) || astUtils.isClosingParenToken(nextToken)); }
javascript
function isBeforeClosingParen(token) { const nextToken = sourceCode.getTokenAfter(token); return (nextToken && astUtils.isClosingBraceToken(nextToken) || astUtils.isClosingParenToken(nextToken)); }
[ "function", "isBeforeClosingParen", "(", "token", ")", "{", "const", "nextToken", "=", "sourceCode", ".", "getTokenAfter", "(", "token", ")", ";", "return", "(", "nextToken", "&&", "astUtils", ".", "isClosingBraceToken", "(", "nextToken", ")", "||", "astUtils", ...
Checks if the next token of a given token is a closing parenthesis. @param {Token} token The token to check. @returns {boolean} Whether or not the next token of a given token is a closing parenthesis.
[ "Checks", "if", "the", "next", "token", "of", "a", "given", "token", "is", "a", "closing", "parenthesis", "." ]
bc0819c94aad14f7fad3cbc2338ea15658b0f272
https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/semi-spacing.js#L106-L110
train
Check if the given token is the first token of a closing parenthesis
[ 30522, 3853, 2003, 4783, 29278, 8586, 10483, 2075, 19362, 2368, 1006, 19204, 1007, 1063, 9530, 3367, 2279, 18715, 2368, 1027, 3120, 16044, 1012, 2131, 18715, 8189, 6199, 2121, 1006, 19204, 1007, 1025, 2709, 1006, 2279, 18715, 2368, 1004, 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...
badges/shields
services/luarocks/luarocks-version-helpers.js
parseVersion
function parseVersion(versionString) { versionString = versionString.toLowerCase().replace('-', '.') const versionList = [] versionString.split('.').forEach(versionPart => { const parsedPart = /(\d*)([a-z]*)(\d*)/.exec(versionPart) if (parsedPart[1]) { versionList.push(parseInt(parsedPart[1])) } if (parsedPart[2]) { let weight // calculate weight as a negative number // 'rc' > 'pre' > 'beta' > 'alpha' > any other value switch (parsedPart[2]) { case 'alpha': case 'beta': case 'pre': case 'rc': weight = (parsedPart[2].charCodeAt(0) - 128) * 100 break default: weight = -10000 } // add positive number, i.e. 'beta5' > 'beta2' weight += parseInt(parsedPart[3]) || 0 versionList.push(weight) } }) return versionList }
javascript
function parseVersion(versionString) { versionString = versionString.toLowerCase().replace('-', '.') const versionList = [] versionString.split('.').forEach(versionPart => { const parsedPart = /(\d*)([a-z]*)(\d*)/.exec(versionPart) if (parsedPart[1]) { versionList.push(parseInt(parsedPart[1])) } if (parsedPart[2]) { let weight // calculate weight as a negative number // 'rc' > 'pre' > 'beta' > 'alpha' > any other value switch (parsedPart[2]) { case 'alpha': case 'beta': case 'pre': case 'rc': weight = (parsedPart[2].charCodeAt(0) - 128) * 100 break default: weight = -10000 } // add positive number, i.e. 'beta5' > 'beta2' weight += parseInt(parsedPart[3]) || 0 versionList.push(weight) } }) return versionList }
[ "function", "parseVersion", "(", "versionString", ")", "{", "versionString", "=", "versionString", ".", "toLowerCase", "(", ")", ".", "replace", "(", "'-'", ",", "'.'", ")", "const", "versionList", "=", "[", "]", "versionString", ".", "split", "(", "'.'", ...
Parse a dotted version string to an array of numbers 'rc', 'pre', 'beta', 'alpha' are converted to negative numbers
[ "Parse", "a", "dotted", "version", "string", "to", "an", "array", "of", "numbers", "rc", "pre", "beta", "alpha", "are", "converted", "to", "negative", "numbers" ]
283601423f3d1a19aae83bf62032d40683948636
https://github.com/badges/shields/blob/283601423f3d1a19aae83bf62032d40683948636/services/luarocks/luarocks-version-helpers.js#L31-L59
train
Parse a version string into an array of integers
[ 30522, 3853, 11968, 3366, 27774, 1006, 4617, 18886, 3070, 1007, 1063, 4617, 18886, 3070, 1027, 4617, 18886, 3070, 1012, 2000, 27663, 18992, 3366, 1006, 1007, 1012, 5672, 1006, 1005, 1011, 1005, 1010, 1005, 1012, 1005, 1007, 9530, 3367, 2544...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/content/content.js
mdContentDirective
function mdContentDirective($mdTheming) { return { restrict: 'E', controller: ['$scope', '$element', ContentController], link: function(scope, element) { element.addClass('_md'); // private md component indicator for styling $mdTheming(element); scope.$broadcast('$mdContentLoaded', element); iosScrollFix(element[0]); } }; function ContentController($scope, $element) { this.$scope = $scope; this.$element = $element; } }
javascript
function mdContentDirective($mdTheming) { return { restrict: 'E', controller: ['$scope', '$element', ContentController], link: function(scope, element) { element.addClass('_md'); // private md component indicator for styling $mdTheming(element); scope.$broadcast('$mdContentLoaded', element); iosScrollFix(element[0]); } }; function ContentController($scope, $element) { this.$scope = $scope; this.$element = $element; } }
[ "function", "mdContentDirective", "(", "$mdTheming", ")", "{", "return", "{", "restrict", ":", "'E'", ",", "controller", ":", "[", "'$scope'", ",", "'$element'", ",", "ContentController", "]", ",", "link", ":", "function", "(", "scope", ",", "element", ")", ...
@ngdoc directive @name mdContent @module material.components.content @restrict E @description The `<md-content>` directive is a container element useful for scrollable content. It achieves this by setting the CSS `overflow` property to `auto` so that content can properly scroll. In general, `<md-content>` components are not designed to be nested inside one another. If possible, it is better to make them siblings. This often results in a better user experience as having nested scrollbars may confuse the user. ## Troubleshooting In some cases, you may wish to apply the `md-no-momentum` class to ensure that Safari's momentum scrolling is disabled. Momentum scrolling can cause flickering issues while scrolling SVG icons and some other components. Additionally, we now also offer the `md-no-flicker` class which can be applied to any element and uses a Webkit-specific filter of `blur(0px)` that forces GPU rendering of all elements inside (which eliminates the flicker on iOS devices). _<b>Note:</b> Forcing an element to render on the GPU can have unintended side-effects, especially related to the z-index of elements. Please use with caution and only on the elements needed._ @usage Add the `[layout-padding]` attribute to make the content padded. <hljs lang="html"> <md-content layout-padding> Lorem ipsum dolor sit amet, ne quod novum mei. </md-content> </hljs>
[ "@ngdoc", "directive", "@name", "mdContent", "@module", "material", ".", "components", ".", "content" ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/content/content.js#L53-L71
train
The content directive
[ 30522, 3853, 9108, 8663, 6528, 2102, 4305, 2890, 15277, 1006, 1002, 9108, 10760, 6562, 1007, 1063, 2709, 1063, 21573, 1024, 1005, 1041, 1005, 1010, 11486, 1024, 1031, 1005, 1002, 9531, 1005, 1010, 1005, 1002, 5783, 1005, 1010, 4180, 8663, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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...
aframevr/aframe
src/core/propertyTypes.js
isValidDefaultValue
function isValidDefaultValue (type, defaultVal) { if (type === 'audio' && typeof defaultVal !== 'string') { return false; } if (type === 'array' && !Array.isArray(defaultVal)) { return false; } if (type === 'asset' && typeof defaultVal !== 'string') { return false; } if (type === 'boolean' && typeof defaultVal !== 'boolean') { return false; } if (type === 'color' && typeof defaultVal !== 'string') { return false; } if (type === 'int' && typeof defaultVal !== 'number') { return false; } if (type === 'number' && typeof defaultVal !== 'number') { return false; } if (type === 'map' && typeof defaultVal !== 'string') { return false; } if (type === 'model' && typeof defaultVal !== 'string') { return false; } if (type === 'selector' && typeof defaultVal !== 'string' && defaultVal !== null) { return false; } if (type === 'selectorAll' && typeof defaultVal !== 'string' && defaultVal !== null) { return false; } if (type === 'src' && typeof defaultVal !== 'string') { return false; } if (type === 'string' && typeof defaultVal !== 'string') { return false; } if (type === 'time' && typeof defaultVal !== 'number') { return false; } if (type === 'vec2') { return isValidDefaultCoordinate(defaultVal, 2); } if (type === 'vec3') { return isValidDefaultCoordinate(defaultVal, 3); } if (type === 'vec4') { return isValidDefaultCoordinate(defaultVal, 4); } return true; }
javascript
function isValidDefaultValue (type, defaultVal) { if (type === 'audio' && typeof defaultVal !== 'string') { return false; } if (type === 'array' && !Array.isArray(defaultVal)) { return false; } if (type === 'asset' && typeof defaultVal !== 'string') { return false; } if (type === 'boolean' && typeof defaultVal !== 'boolean') { return false; } if (type === 'color' && typeof defaultVal !== 'string') { return false; } if (type === 'int' && typeof defaultVal !== 'number') { return false; } if (type === 'number' && typeof defaultVal !== 'number') { return false; } if (type === 'map' && typeof defaultVal !== 'string') { return false; } if (type === 'model' && typeof defaultVal !== 'string') { return false; } if (type === 'selector' && typeof defaultVal !== 'string' && defaultVal !== null) { return false; } if (type === 'selectorAll' && typeof defaultVal !== 'string' && defaultVal !== null) { return false; } if (type === 'src' && typeof defaultVal !== 'string') { return false; } if (type === 'string' && typeof defaultVal !== 'string') { return false; } if (type === 'time' && typeof defaultVal !== 'number') { return false; } if (type === 'vec2') { return isValidDefaultCoordinate(defaultVal, 2); } if (type === 'vec3') { return isValidDefaultCoordinate(defaultVal, 3); } if (type === 'vec4') { return isValidDefaultCoordinate(defaultVal, 4); } return true; }
[ "function", "isValidDefaultValue", "(", "type", ",", "defaultVal", ")", "{", "if", "(", "type", "===", "'audio'", "&&", "typeof", "defaultVal", "!==", "'string'", ")", "{", "return", "false", ";", "}", "if", "(", "type", "===", "'array'", "&&", "!", "Arr...
Validate the default values in a schema to match their type. @param {string} type - Property type name. @param defaultVal - Property type default value. @returns {boolean} Whether default value is accurate given the type.
[ "Validate", "the", "default", "values", "in", "a", "schema", "to", "match", "their", "type", "." ]
24acc78a7299a4cdfe3ef617f4d40ddf6275c992
https://github.com/aframevr/aframe/blob/24acc78a7299a4cdfe3ef617f4d40ddf6275c992/src/core/propertyTypes.js#L173-L194
train
Check if the default value is valid
[ 30522, 3853, 2003, 10175, 3593, 3207, 7011, 11314, 10175, 5657, 1006, 2828, 1010, 12398, 10175, 1007, 1063, 2065, 1006, 2828, 1027, 1027, 1027, 1005, 5746, 1005, 1004, 1004, 2828, 11253, 12398, 10175, 999, 1027, 1027, 1005, 5164, 1005, 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/core/Renderer.js
createExtendedRenderer
function createExtendedRenderer(sName, oRendererInfo) { assert(this != null, 'BaseRenderer must be a non-null object'); assert(typeof sName === 'string' && sName, 'Renderer.extend must be called with a non-empty name for the new renderer'); assert(oRendererInfo == null || (isPlainObject(oRendererInfo) && Object.keys(oRendererInfo).every(function(key) { return oRendererInfo[key] !== undefined; })), 'oRendererInfo can be omitted or must be a plain object without any undefined property values'); var oChildRenderer = Object.create(this); // subclasses should expose the modern signature variant only oChildRenderer.extend = createExtendedRenderer; jQuery.extend(oChildRenderer, oRendererInfo); // expose the renderer globally ObjectPath.set(sName, oChildRenderer); return oChildRenderer; }
javascript
function createExtendedRenderer(sName, oRendererInfo) { assert(this != null, 'BaseRenderer must be a non-null object'); assert(typeof sName === 'string' && sName, 'Renderer.extend must be called with a non-empty name for the new renderer'); assert(oRendererInfo == null || (isPlainObject(oRendererInfo) && Object.keys(oRendererInfo).every(function(key) { return oRendererInfo[key] !== undefined; })), 'oRendererInfo can be omitted or must be a plain object without any undefined property values'); var oChildRenderer = Object.create(this); // subclasses should expose the modern signature variant only oChildRenderer.extend = createExtendedRenderer; jQuery.extend(oChildRenderer, oRendererInfo); // expose the renderer globally ObjectPath.set(sName, oChildRenderer); return oChildRenderer; }
[ "function", "createExtendedRenderer", "(", "sName", ",", "oRendererInfo", ")", "{", "assert", "(", "this", "!=", "null", ",", "'BaseRenderer must be a non-null object'", ")", ";", "assert", "(", "typeof", "sName", "===", "'string'", "&&", "sName", ",", "'Renderer....
Helper to create a new renderer by extending an existing one. @this {sap.ui.core.Renderer} The base renderer to extend @param {string} sName Global name of the new renderer @param {object} oRendererInfo Methods and static properties of the new renderer @returns {object} New static renderer class @private
[ "Helper", "to", "create", "a", "new", "renderer", "by", "extending", "an", "existing", "one", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/Renderer.js#L38-L56
train
Creates an extended renderer instance.
[ 30522, 3853, 3443, 10288, 6528, 5732, 7389, 4063, 2121, 1006, 1055, 18442, 1010, 10848, 11563, 23282, 14876, 1007, 1063, 20865, 1006, 2023, 999, 1027, 19701, 1010, 1005, 2918, 7389, 4063, 2121, 2442, 2022, 1037, 2512, 1011, 19701, 4874, 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...
jgraph/mxgraph
javascript/mxClient.js
mxVertexHandler
function mxVertexHandler(state) { if (state != null) { this.state = state; this.init(); // Handles escape keystrokes this.escapeHandler = mxUtils.bind(this, function(sender, evt) { if (this.livePreview && this.index != null) { // Redraws the live preview this.state.view.graph.cellRenderer.redraw(this.state, true); // Redraws connected edges this.state.view.invalidate(this.state.cell); this.state.invalid = false; this.state.view.validate(); } this.reset(); }); this.state.view.graph.addListener(mxEvent.ESCAPE, this.escapeHandler); } }
javascript
function mxVertexHandler(state) { if (state != null) { this.state = state; this.init(); // Handles escape keystrokes this.escapeHandler = mxUtils.bind(this, function(sender, evt) { if (this.livePreview && this.index != null) { // Redraws the live preview this.state.view.graph.cellRenderer.redraw(this.state, true); // Redraws connected edges this.state.view.invalidate(this.state.cell); this.state.invalid = false; this.state.view.validate(); } this.reset(); }); this.state.view.graph.addListener(mxEvent.ESCAPE, this.escapeHandler); } }
[ "function", "mxVertexHandler", "(", "state", ")", "{", "if", "(", "state", "!=", "null", ")", "{", "this", ".", "state", "=", "state", ";", "this", ".", "init", "(", ")", ";", "// Handles escape keystrokes", "this", ".", "escapeHandler", "=", "mxUtils", ...
Copyright (c) 2006-2015, JGraph Ltd Copyright (c) 2006-2015, Gaudenz Alder Class: mxVertexHandler Event handler for resizing cells. This handler is automatically created in <mxGraph.createHandler>. Constructor: mxVertexHandler Constructs an event handler that allows to resize vertices and groups. Parameters: state - <mxCellState> of the cell to be resized.
[ "Copyright", "(", "c", ")", "2006", "-", "2015", "JGraph", "Ltd", "Copyright", "(", "c", ")", "2006", "-", "2015", "Gaudenz", "Alder", "Class", ":", "mxVertexHandler" ]
33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44
https://github.com/jgraph/mxgraph/blob/33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44/javascript/mxClient.js#L75564-L75590
train
This is the main entry point for the vertex handler
[ 30522, 3853, 25630, 16874, 10288, 11774, 3917, 1006, 2110, 1007, 1063, 2065, 1006, 2110, 999, 1027, 19701, 1007, 1063, 2023, 1012, 2110, 1027, 2110, 1025, 2023, 1012, 1999, 4183, 1006, 1007, 1025, 1013, 1013, 16024, 4019, 6309, 13181, 9681,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/ExtensionUtils.js
parseLessCode
function parseLessCode(code, url) { var result = new $.Deferred(), options; if (url) { var dir = url.slice(0, url.lastIndexOf("/") + 1); options = { filename: url, rootpath: dir }; if (isAbsolutePathOrUrl(url)) { options.currentFileInfo = { currentDirectory: dir, entryPath: dir, filename: url, rootFilename: url, rootpath: dir }; } } less.render(code, options, function onParse(err, tree) { if (err) { result.reject(err); } else { result.resolve(tree.css); } }); return result.promise(); }
javascript
function parseLessCode(code, url) { var result = new $.Deferred(), options; if (url) { var dir = url.slice(0, url.lastIndexOf("/") + 1); options = { filename: url, rootpath: dir }; if (isAbsolutePathOrUrl(url)) { options.currentFileInfo = { currentDirectory: dir, entryPath: dir, filename: url, rootFilename: url, rootpath: dir }; } } less.render(code, options, function onParse(err, tree) { if (err) { result.reject(err); } else { result.resolve(tree.css); } }); return result.promise(); }
[ "function", "parseLessCode", "(", "code", ",", "url", ")", "{", "var", "result", "=", "new", "$", ".", "Deferred", "(", ")", ",", "options", ";", "if", "(", "url", ")", "{", "var", "dir", "=", "url", ".", "slice", "(", "0", ",", "url", ".", "la...
Parses LESS code and returns a promise that resolves with plain CSS code. Pass the {@link url} argument to resolve relative URLs contained in the code. Make sure URLs in the code are wrapped in quotes, like so: background-image: url("image.png"); @param {!string} code LESS code to parse @param {?string} url URL to the file containing the code @return {!$.Promise} A promise object that is resolved with CSS code if the LESS code can be parsed
[ "Parses", "LESS", "code", "and", "returns", "a", "promise", "that", "resolves", "with", "plain", "CSS", "code", "." ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/utils/ExtensionUtils.js#L96-L128
train
Parse less code
[ 30522, 3853, 11968, 11246, 7971, 16044, 1006, 3642, 1010, 24471, 2140, 1007, 1063, 13075, 2765, 1027, 2047, 1002, 1012, 13366, 28849, 2094, 1006, 1007, 1010, 7047, 1025, 2065, 1006, 24471, 2140, 1007, 1063, 13075, 16101, 1027, 24471, 2140, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/DocumentCommandHandlers.js
doClose
function doClose(file) { if (!promptOnly) { MainViewManager._close(paneId, file); HealthLogger.fileClosed(file); } }
javascript
function doClose(file) { if (!promptOnly) { MainViewManager._close(paneId, file); HealthLogger.fileClosed(file); } }
[ "function", "doClose", "(", "file", ")", "{", "if", "(", "!", "promptOnly", ")", "{", "MainViewManager", ".", "_close", "(", "paneId", ",", "file", ")", ";", "HealthLogger", ".", "fileClosed", "(", "file", ")", ";", "}", "}" ]
utility function for handleFileClose: closes document & removes from workingset
[ "utility", "function", "for", "handleFileClose", ":", "closes", "document", "&", "removes", "from", "workingset" ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/document/DocumentCommandHandlers.js#L1197-L1202
train
Close the file
[ 30522, 3853, 9986, 10483, 2063, 1006, 5371, 1007, 1063, 2065, 1006, 999, 25732, 2239, 2135, 1007, 1063, 2364, 8584, 24805, 4590, 1012, 1035, 2485, 1006, 6090, 7416, 2094, 1010, 5371, 1007, 1025, 2740, 21197, 4590, 1012, 5371, 20464, 24768, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/gesture/gesture.js
attachToDocument
function attachToDocument($mdGesture, $$MdGestureHandler) { if (disableAllGestures) { return; } // Polyfill document.contains for IE11. // TODO: move to util document.contains || (document.contains = function (node) { return document.body.contains(node); }); if (!isInitialized && $mdGesture.isHijackingClicks) { /* * If hijack clicks is true, we preventDefault any click that wasn't * sent by AngularJS Material. This is because on older Android & iOS, a false, or 'ghost', * click event will be sent ~400ms after a touchend event happens. * The only way to know if this click is real is to prevent any normal * click events, and add a flag to events sent by material so we know not to prevent those. * * Two exceptions to click events that should be prevented are: * - click events sent by the keyboard (eg form submit) * - events that originate from an Ionic app */ document.addEventListener('click' , clickHijacker , true); document.addEventListener('mouseup' , mouseInputHijacker, true); document.addEventListener('mousedown', mouseInputHijacker, true); document.addEventListener('focus' , mouseInputHijacker, true); isInitialized = true; } function mouseInputHijacker(ev) { var isKeyClick = !ev.clientX && !ev.clientY; if ( !isKeyClick && !ev.$material && !ev.isIonicTap && !isInputEventFromLabelClick(ev) && (ev.type !== 'mousedown' || (!canFocus(ev.target) && !canFocus(document.activeElement))) ) { ev.preventDefault(); ev.stopPropagation(); } } function clickHijacker(ev) { var isKeyClick = ev.clientX === 0 && ev.clientY === 0; var isSubmitEvent = ev.target && ev.target.type === 'submit'; if (!isKeyClick && !ev.$material && !ev.isIonicTap && !isInputEventFromLabelClick(ev) && !isSubmitEvent) { ev.preventDefault(); ev.stopPropagation(); lastLabelClickPos = null; } else { lastLabelClickPos = null; if (ev.target.tagName.toLowerCase() == 'label') { lastLabelClickPos = {x: ev.x, y: ev.y}; } } } // Listen to all events to cover all platforms. var START_EVENTS = 'mousedown touchstart pointerdown'; var MOVE_EVENTS = 'mousemove touchmove pointermove'; var END_EVENTS = 'mouseup mouseleave touchend touchcancel pointerup pointercancel'; angular.element(document) .on(START_EVENTS, gestureStart) .on(MOVE_EVENTS, gestureMove) .on(END_EVENTS, gestureEnd) // For testing .on('$$mdGestureReset', function gestureClearCache () { lastPointer = pointer = null; }); /* * When a DOM event happens, run all registered gesture handlers' lifecycle * methods which match the DOM event. * Eg when a 'touchstart' event happens, runHandlers('start') will call and * run `handler.cancel()` and `handler.start()` on all registered handlers. */ function runHandlers(handlerEvent, event) { var handler; for (var name in HANDLERS) { handler = HANDLERS[name]; if (handler instanceof $$MdGestureHandler) { if (handlerEvent === 'start') { // Run cancel to reset any handlers' state handler.cancel(); } handler[handlerEvent](event, pointer); } } } /* * gestureStart vets if a start event is legitimate (and not part of a 'ghost click' from iOS/Android) * If it is legitimate, we initiate the pointer state and mark the current pointer's type * For example, for a touchstart event, mark the current pointer as a 'touch' pointer, so mouse events * won't effect it. */ function gestureStart(ev) { // If we're already touched down, abort if (pointer) return; var now = +Date.now(); // iOS & old android bug: after a touch event, a click event is sent 350 ms later. // If <400ms have passed, don't allow an event of a different type than the previous event if (lastPointer && !typesMatch(ev, lastPointer) && (now - lastPointer.endTime < 1500)) { return; } pointer = makeStartPointer(ev); runHandlers('start', ev); } /* * If a move event happens of the right type, update the pointer and run all the move handlers. * "of the right type": if a mousemove happens but our pointer started with a touch event, do nothing. */ function gestureMove(ev) { if (!pointer || !typesMatch(ev, pointer)) return; updatePointerState(ev, pointer); runHandlers('move', ev); } /* * If an end event happens of the right type, update the pointer, run endHandlers, and save the pointer as 'lastPointer' */ function gestureEnd(ev) { if (!pointer || !typesMatch(ev, pointer)) return; updatePointerState(ev, pointer); pointer.endTime = +Date.now(); if (ev.type !== 'pointercancel') { runHandlers('end', ev); } lastPointer = pointer; pointer = null; } }
javascript
function attachToDocument($mdGesture, $$MdGestureHandler) { if (disableAllGestures) { return; } // Polyfill document.contains for IE11. // TODO: move to util document.contains || (document.contains = function (node) { return document.body.contains(node); }); if (!isInitialized && $mdGesture.isHijackingClicks) { /* * If hijack clicks is true, we preventDefault any click that wasn't * sent by AngularJS Material. This is because on older Android & iOS, a false, or 'ghost', * click event will be sent ~400ms after a touchend event happens. * The only way to know if this click is real is to prevent any normal * click events, and add a flag to events sent by material so we know not to prevent those. * * Two exceptions to click events that should be prevented are: * - click events sent by the keyboard (eg form submit) * - events that originate from an Ionic app */ document.addEventListener('click' , clickHijacker , true); document.addEventListener('mouseup' , mouseInputHijacker, true); document.addEventListener('mousedown', mouseInputHijacker, true); document.addEventListener('focus' , mouseInputHijacker, true); isInitialized = true; } function mouseInputHijacker(ev) { var isKeyClick = !ev.clientX && !ev.clientY; if ( !isKeyClick && !ev.$material && !ev.isIonicTap && !isInputEventFromLabelClick(ev) && (ev.type !== 'mousedown' || (!canFocus(ev.target) && !canFocus(document.activeElement))) ) { ev.preventDefault(); ev.stopPropagation(); } } function clickHijacker(ev) { var isKeyClick = ev.clientX === 0 && ev.clientY === 0; var isSubmitEvent = ev.target && ev.target.type === 'submit'; if (!isKeyClick && !ev.$material && !ev.isIonicTap && !isInputEventFromLabelClick(ev) && !isSubmitEvent) { ev.preventDefault(); ev.stopPropagation(); lastLabelClickPos = null; } else { lastLabelClickPos = null; if (ev.target.tagName.toLowerCase() == 'label') { lastLabelClickPos = {x: ev.x, y: ev.y}; } } } // Listen to all events to cover all platforms. var START_EVENTS = 'mousedown touchstart pointerdown'; var MOVE_EVENTS = 'mousemove touchmove pointermove'; var END_EVENTS = 'mouseup mouseleave touchend touchcancel pointerup pointercancel'; angular.element(document) .on(START_EVENTS, gestureStart) .on(MOVE_EVENTS, gestureMove) .on(END_EVENTS, gestureEnd) // For testing .on('$$mdGestureReset', function gestureClearCache () { lastPointer = pointer = null; }); /* * When a DOM event happens, run all registered gesture handlers' lifecycle * methods which match the DOM event. * Eg when a 'touchstart' event happens, runHandlers('start') will call and * run `handler.cancel()` and `handler.start()` on all registered handlers. */ function runHandlers(handlerEvent, event) { var handler; for (var name in HANDLERS) { handler = HANDLERS[name]; if (handler instanceof $$MdGestureHandler) { if (handlerEvent === 'start') { // Run cancel to reset any handlers' state handler.cancel(); } handler[handlerEvent](event, pointer); } } } /* * gestureStart vets if a start event is legitimate (and not part of a 'ghost click' from iOS/Android) * If it is legitimate, we initiate the pointer state and mark the current pointer's type * For example, for a touchstart event, mark the current pointer as a 'touch' pointer, so mouse events * won't effect it. */ function gestureStart(ev) { // If we're already touched down, abort if (pointer) return; var now = +Date.now(); // iOS & old android bug: after a touch event, a click event is sent 350 ms later. // If <400ms have passed, don't allow an event of a different type than the previous event if (lastPointer && !typesMatch(ev, lastPointer) && (now - lastPointer.endTime < 1500)) { return; } pointer = makeStartPointer(ev); runHandlers('start', ev); } /* * If a move event happens of the right type, update the pointer and run all the move handlers. * "of the right type": if a mousemove happens but our pointer started with a touch event, do nothing. */ function gestureMove(ev) { if (!pointer || !typesMatch(ev, pointer)) return; updatePointerState(ev, pointer); runHandlers('move', ev); } /* * If an end event happens of the right type, update the pointer, run endHandlers, and save the pointer as 'lastPointer' */ function gestureEnd(ev) { if (!pointer || !typesMatch(ev, pointer)) return; updatePointerState(ev, pointer); pointer.endTime = +Date.now(); if (ev.type !== 'pointercancel') { runHandlers('end', ev); } lastPointer = pointer; pointer = null; } }
[ "function", "attachToDocument", "(", "$mdGesture", ",", "$$MdGestureHandler", ")", "{", "if", "(", "disableAllGestures", ")", "{", "return", ";", "}", "// Polyfill document.contains for IE11.", "// TODO: move to util", "document", ".", "contains", "||", "(", "document",...
Attach Gestures: hook document and check shouldHijack clicks @ngInject
[ "Attach", "Gestures", ":", "hook", "document", "and", "check", "shouldHijack", "clicks" ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/core/services/gesture/gesture.js#L546-L695
train
Adds event listeners to the document
[ 30522, 3853, 22476, 3406, 3527, 24894, 4765, 1006, 1002, 9108, 8449, 11244, 1010, 1002, 1002, 9108, 8449, 11244, 11774, 3917, 1007, 1063, 2065, 1006, 4487, 19150, 8095, 8449, 22662, 1007, 1063, 2709, 1025, 1065, 1013, 1013, 26572, 8873, 336...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/operators.js
function() { this.jsonInit({ "message0": Blockly.Msg.OPERATORS_MATHOP, "args0": [ { "type": "field_dropdown", "name": "OPERATOR", "options": [ [Blockly.Msg.OPERATORS_MATHOP_ABS, 'abs'], [Blockly.Msg.OPERATORS_MATHOP_FLOOR, 'floor'], [Blockly.Msg.OPERATORS_MATHOP_CEILING, 'ceiling'], [Blockly.Msg.OPERATORS_MATHOP_SQRT, 'sqrt'], [Blockly.Msg.OPERATORS_MATHOP_SIN, 'sin'], [Blockly.Msg.OPERATORS_MATHOP_COS, 'cos'], [Blockly.Msg.OPERATORS_MATHOP_TAN, 'tan'], [Blockly.Msg.OPERATORS_MATHOP_ASIN, 'asin'], [Blockly.Msg.OPERATORS_MATHOP_ACOS, 'acos'], [Blockly.Msg.OPERATORS_MATHOP_ATAN, 'atan'], [Blockly.Msg.OPERATORS_MATHOP_LN, 'ln'], [Blockly.Msg.OPERATORS_MATHOP_LOG, 'log'], [Blockly.Msg.OPERATORS_MATHOP_EEXP, 'e ^'], [Blockly.Msg.OPERATORS_MATHOP_10EXP, '10 ^'] ] }, { "type": "input_value", "name": "NUM" } ], "category": Blockly.Categories.operators, "extensions": ["colours_operators", "output_number"] }); }
javascript
function() { this.jsonInit({ "message0": Blockly.Msg.OPERATORS_MATHOP, "args0": [ { "type": "field_dropdown", "name": "OPERATOR", "options": [ [Blockly.Msg.OPERATORS_MATHOP_ABS, 'abs'], [Blockly.Msg.OPERATORS_MATHOP_FLOOR, 'floor'], [Blockly.Msg.OPERATORS_MATHOP_CEILING, 'ceiling'], [Blockly.Msg.OPERATORS_MATHOP_SQRT, 'sqrt'], [Blockly.Msg.OPERATORS_MATHOP_SIN, 'sin'], [Blockly.Msg.OPERATORS_MATHOP_COS, 'cos'], [Blockly.Msg.OPERATORS_MATHOP_TAN, 'tan'], [Blockly.Msg.OPERATORS_MATHOP_ASIN, 'asin'], [Blockly.Msg.OPERATORS_MATHOP_ACOS, 'acos'], [Blockly.Msg.OPERATORS_MATHOP_ATAN, 'atan'], [Blockly.Msg.OPERATORS_MATHOP_LN, 'ln'], [Blockly.Msg.OPERATORS_MATHOP_LOG, 'log'], [Blockly.Msg.OPERATORS_MATHOP_EEXP, 'e ^'], [Blockly.Msg.OPERATORS_MATHOP_10EXP, '10 ^'] ] }, { "type": "input_value", "name": "NUM" } ], "category": Blockly.Categories.operators, "extensions": ["colours_operators", "output_number"] }); }
[ "function", "(", ")", "{", "this", ".", "jsonInit", "(", "{", "\"message0\"", ":", "Blockly", ".", "Msg", ".", "OPERATORS_MATHOP", ",", "\"args0\"", ":", "[", "{", "\"type\"", ":", "\"field_dropdown\"", ",", "\"name\"", ":", "\"OPERATOR\"", ",", "\"options\"...
Block for "advanced" math ops on a number. @this Blockly.Block
[ "Block", "for", "advanced", "math", "ops", "on", "a", "number", "." ]
455b2a854435c0a67da1da92320ddc3ec3e2b799
https://github.com/LLK/scratch-blocks/blob/455b2a854435c0a67da1da92320ddc3ec3e2b799/blocks_vertical/operators.js#L437-L469
train
Block for the operator dropdown.
[ 30522, 3853, 1006, 1007, 1063, 2023, 1012, 1046, 3385, 5498, 2102, 1006, 1063, 1000, 4471, 2692, 1000, 1024, 3796, 2135, 1012, 5796, 2290, 1012, 9224, 1035, 8785, 7361, 1010, 1000, 12098, 5620, 2692, 1000, 1024, 1031, 1063, 1000, 2828, 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...
scrumpy/tiptap
packages/tiptap-extensions/src/plugins/Suggestions.js
triggerCharacter
function triggerCharacter({ char = '@', allowSpaces = false, startOfLine = false, }) { return $position => { // Matching expressions used for later const escapedChar = `\\${char}` const suffix = new RegExp(`\\s${escapedChar}$`) const prefix = startOfLine ? '^' : '' const regexp = allowSpaces ? new RegExp(`${prefix}${escapedChar}.*?(?=\\s${escapedChar}|$)`, 'gm') : new RegExp(`${prefix}(?:^)?${escapedChar}[^\\s${escapedChar}]*`, 'gm') // Lookup the boundaries of the current node const textFrom = $position.before() const textTo = $position.end() const text = $position.doc.textBetween(textFrom, textTo, '\0', '\0') let match = regexp.exec(text) let position while (match !== null) { // JavaScript doesn't have lookbehinds; this hacks a check that first character is " " // or the line beginning const matchPrefix = match.input.slice(Math.max(0, match.index - 1), match.index) if (/^[\s\0]?$/.test(matchPrefix)) { // The absolute position of the match in the document const from = match.index + $position.start() let to = from + match[0].length // Edge case handling; if spaces are allowed and we're directly in between // two triggers if (allowSpaces && suffix.test(text.slice(to - 1, to + 1))) { match[0] += ' ' to += 1 } // If the $position is located within the matched substring, return that range if (from < $position.pos && to >= $position.pos) { position = { range: { from, to, }, query: match[0].slice(char.length), text: match[0], } } } match = regexp.exec(text) } return position } }
javascript
function triggerCharacter({ char = '@', allowSpaces = false, startOfLine = false, }) { return $position => { // Matching expressions used for later const escapedChar = `\\${char}` const suffix = new RegExp(`\\s${escapedChar}$`) const prefix = startOfLine ? '^' : '' const regexp = allowSpaces ? new RegExp(`${prefix}${escapedChar}.*?(?=\\s${escapedChar}|$)`, 'gm') : new RegExp(`${prefix}(?:^)?${escapedChar}[^\\s${escapedChar}]*`, 'gm') // Lookup the boundaries of the current node const textFrom = $position.before() const textTo = $position.end() const text = $position.doc.textBetween(textFrom, textTo, '\0', '\0') let match = regexp.exec(text) let position while (match !== null) { // JavaScript doesn't have lookbehinds; this hacks a check that first character is " " // or the line beginning const matchPrefix = match.input.slice(Math.max(0, match.index - 1), match.index) if (/^[\s\0]?$/.test(matchPrefix)) { // The absolute position of the match in the document const from = match.index + $position.start() let to = from + match[0].length // Edge case handling; if spaces are allowed and we're directly in between // two triggers if (allowSpaces && suffix.test(text.slice(to - 1, to + 1))) { match[0] += ' ' to += 1 } // If the $position is located within the matched substring, return that range if (from < $position.pos && to >= $position.pos) { position = { range: { from, to, }, query: match[0].slice(char.length), text: match[0], } } } match = regexp.exec(text) } return position } }
[ "function", "triggerCharacter", "(", "{", "char", "=", "'@'", ",", "allowSpaces", "=", "false", ",", "startOfLine", "=", "false", ",", "}", ")", "{", "return", "$position", "=>", "{", "// Matching expressions used for later", "const", "escapedChar", "=", "`", ...
Create a matcher that matches when a specific character is typed. Useful for @mentions and #tags.
[ "Create", "a", "matcher", "that", "matches", "when", "a", "specific", "character", "is", "typed", ".", "Useful", "for" ]
f02461cc791f9efa0d87b6e811d27b7078eb9b86
https://github.com/scrumpy/tiptap/blob/f02461cc791f9efa0d87b6e811d27b7078eb9b86/packages/tiptap-extensions/src/plugins/Suggestions.js#L6-L63
train
Trigger a character in the document
[ 30522, 30524, 1063, 25869, 1027, 1005, 1030, 1005, 1010, 4473, 15327, 2015, 1027, 6270, 1010, 2707, 11253, 4179, 1027, 6270, 1010, 1065, 1007, 1063, 2709, 1002, 2597, 1027, 1028, 1063, 1013, 1013, 9844, 11423, 2109, 2005, 2101, 9530, 3367, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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
checkForBlock
function checkForBlock(node) { const scope = context.getScope(); /* * In ES5, some node type such as `BlockStatement` doesn't have that scope. * `scope.block` is a different node in such a case. */ if (scope.block === node) { findVariablesInScope(scope); } }
javascript
function checkForBlock(node) { const scope = context.getScope(); /* * In ES5, some node type such as `BlockStatement` doesn't have that scope. * `scope.block` is a different node in such a case. */ if (scope.block === node) { findVariablesInScope(scope); } }
[ "function", "checkForBlock", "(", "node", ")", "{", "const", "scope", "=", "context", ".", "getScope", "(", ")", ";", "/*\n * In ES5, some node type such as `BlockStatement` doesn't have that scope.\n * `scope.block` is a different node in such a case.\n ...
Find variables in the current scope. @param {ASTNode} node The node of the current scope. @returns {void} @private
[ "Find", "variables", "in", "the", "current", "scope", "." ]
bc0819c94aad14f7fad3cbc2338ea15658b0f272
https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/no-redeclare.js#L131-L141
train
Check if node is a block
[ 30522, 3853, 4638, 29278, 23467, 1006, 13045, 1007, 1063, 9530, 3367, 9531, 1027, 6123, 1012, 4152, 16186, 1006, 1007, 1025, 1013, 1008, 1008, 1999, 9686, 2629, 1010, 2070, 13045, 2828, 2107, 2004, 1036, 5991, 12259, 3672, 1036, 2987, 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...
jgraph/mxgraph
javascript/mxClient.js
function(obj, variable) { var codec = new mxObjectCodec(obj, ['model', 'previous'], ['cell']); /** * Function: afterDecode * * Restores the state by assigning the previous value. */ codec.afterDecode = function(dec, node, obj) { // Allows forward references in sessions. This is a workaround // for the sequence of edits in mxGraph.moveCells and cellsAdded. if (mxUtils.isNode(obj.cell)) { obj.cell = dec.decodeCell(obj.cell, false); } obj.previous = obj[variable]; return obj; }; return codec; }
javascript
function(obj, variable) { var codec = new mxObjectCodec(obj, ['model', 'previous'], ['cell']); /** * Function: afterDecode * * Restores the state by assigning the previous value. */ codec.afterDecode = function(dec, node, obj) { // Allows forward references in sessions. This is a workaround // for the sequence of edits in mxGraph.moveCells and cellsAdded. if (mxUtils.isNode(obj.cell)) { obj.cell = dec.decodeCell(obj.cell, false); } obj.previous = obj[variable]; return obj; }; return codec; }
[ "function", "(", "obj", ",", "variable", ")", "{", "var", "codec", "=", "new", "mxObjectCodec", "(", "obj", ",", "[", "'model'", ",", "'previous'", "]", ",", "[", "'cell'", "]", ")", ";", "/**\n\t * Function: afterDecode\n\t *\n\t * Restores the state by assigning...
Copyright (c) 2006-2015, JGraph Ltd Copyright (c) 2006-2015, Gaudenz Alder Class: mxGenericChangeCodec Codec for <mxValueChange>s, <mxStyleChange>s, <mxGeometryChange>s, <mxCollapseChange>s and <mxVisibleChange>s. This class is created and registered dynamically at load time and used implicitely via <mxCodec> and the <mxCodecRegistry>. Transient Fields: - model - previous Reference Fields: - cell Constructor: mxGenericChangeCodec Factory function that creates a <mxObjectCodec> for the specified change and fieldname. Parameters: obj - An instance of the change object. variable - The fieldname for the change data.
[ "Copyright", "(", "c", ")", "2006", "-", "2015", "JGraph", "Ltd", "Copyright", "(", "c", ")", "2006", "-", "2015", "Gaudenz", "Alder", "Class", ":", "mxGenericChangeCodec" ]
33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44
https://github.com/jgraph/mxgraph/blob/33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44/javascript/mxClient.js#L88400-L88424
train
A function that can be used to decode a cell
[ 30522, 3853, 1006, 27885, 3501, 1010, 8023, 1007, 1063, 13075, 3642, 2278, 1027, 2047, 25630, 16429, 20614, 16044, 2278, 1006, 27885, 3501, 1010, 1031, 1005, 2944, 1005, 1010, 1005, 3025, 1005, 1033, 1010, 1031, 1005, 3526, 1005, 1033, 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/core/hyphenation/Hyphenation.js
onLanguageInitialized
function onLanguageInitialized(sLanguage, resolve, hyphenateMethod) { oHyphenateMethods[sLanguage] = hyphenateMethod; oHyphenationInstance.bIsInitialized = true; if (aLanguagesQueue.length > 0) { aLanguagesQueue.forEach(function (oElement) { initializeLanguage(oElement.sLanguage, oElement.oConfig, oElement.resolve); }); aLanguagesQueue = []; } oHyphenationInstance.bLoading = false; resolve( getLanguageFromPattern(sLanguage) ); }
javascript
function onLanguageInitialized(sLanguage, resolve, hyphenateMethod) { oHyphenateMethods[sLanguage] = hyphenateMethod; oHyphenationInstance.bIsInitialized = true; if (aLanguagesQueue.length > 0) { aLanguagesQueue.forEach(function (oElement) { initializeLanguage(oElement.sLanguage, oElement.oConfig, oElement.resolve); }); aLanguagesQueue = []; } oHyphenationInstance.bLoading = false; resolve( getLanguageFromPattern(sLanguage) ); }
[ "function", "onLanguageInitialized", "(", "sLanguage", ",", "resolve", ",", "hyphenateMethod", ")", "{", "oHyphenateMethods", "[", "sLanguage", "]", "=", "hyphenateMethod", ";", "oHyphenationInstance", ".", "bIsInitialized", "=", "true", ";", "if", "(", "aLanguagesQ...
A callback for when language initialization is ready. @param {string} sLanguage What language was initialized @param {function} resolve Callback to resolve the promise created on initialize @param {string} hyphenateMethod Is it asm or wasm @private
[ "A", "callback", "for", "when", "language", "initialization", "is", "ready", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/hyphenation/Hyphenation.js#L169-L182
train
This function is called when the language is initialized. It will call the initializeLanguage function of all languages in the queue.
[ 30522, 3853, 2006, 25023, 6692, 3351, 5498, 20925, 3550, 1006, 21435, 6692, 3351, 1010, 10663, 1010, 1044, 22571, 10222, 3686, 11368, 6806, 2094, 1007, 1063, 2821, 22571, 10222, 3686, 11368, 6806, 5104, 1031, 21435, 6692, 3351, 1033, 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...
adobe/brackets
src/view/MainViewManager.js
_loadViewState
function _loadViewState(e) { // file root is appended for each project var panes, promises = [], context = { location : { scope: "user", layer: "project" } }, state = PreferencesManager.getViewState(PREFS_NAME, context); function convertViewState() { var context = { location : { scope: "user", layer: "project" } }, files = PreferencesManager.getViewState(OLD_PREFS_NAME, context); if (!files) { // nothing to convert return; } var result = { orientation: null, activePaneId: FIRST_PANE, panes: { "first-pane": [] } }; // Add all files to the workingset without verifying that // they still exist on disk (for faster project switching) files.forEach(function (value) { result.panes[FIRST_PANE].push(value); }); return result; } if (!state) { // not converted yet state = convertViewState(); } // reset _mergePanes(); _mruList = []; ViewStateManager.reset(); if (state) { panes = Object.keys(state.panes); _orientation = (panes.length > 1) ? state.orientation : null; _.forEach(state.panes, function (paneState, paneId) { _createPaneIfNecessary(paneId); promises.push(_panes[paneId].loadState(paneState)); }); AsyncUtils.waitForAll(promises).then(function (opensList) { // this will set the default layout of 50/50 or 100 // based on the number of panes _initialLayout(); // More than 1 pane, then make it resizable // and layout the panes from serialized state if (panes.length > 1) { _makeFirstPaneResizable(); // If the split state was serialized correctly // then setup the splits according to was serialized // Avoid a zero and negative split percentages if ($.isNumeric(state.splitPercentage) && state.splitPercentage > 0) { var prop; if (_orientation === VERTICAL) { prop = "width"; } else { prop = "height"; } _panes[FIRST_PANE].$el.css(prop, state.splitPercentage * 100 + "%"); _updateLayout(); } } if (_orientation) { _$el.addClass("split-" + _orientation.toLowerCase()); exports.trigger("paneLayoutChange", _orientation); } _.forEach(_panes, function (pane) { var fileList = pane.getViewList(); fileList.forEach(function (file) { if (_findFileInMRUList(pane.id, file) !== -1) { console.log(file.fullPath + " duplicated in mru list"); } _mruList.push(_makeMRUListEntry(file, pane.id)); }); exports.trigger("workingSetAddList", fileList, pane.id); }); promises = []; opensList.forEach(function (openData) { if (openData) { promises.push(CommandManager.execute(Commands.FILE_OPEN, openData)); } }); // finally set the active pane AsyncUtils.waitForAll(promises).then(function () { setActivePaneId(state.activePaneId); }); }); } }
javascript
function _loadViewState(e) { // file root is appended for each project var panes, promises = [], context = { location : { scope: "user", layer: "project" } }, state = PreferencesManager.getViewState(PREFS_NAME, context); function convertViewState() { var context = { location : { scope: "user", layer: "project" } }, files = PreferencesManager.getViewState(OLD_PREFS_NAME, context); if (!files) { // nothing to convert return; } var result = { orientation: null, activePaneId: FIRST_PANE, panes: { "first-pane": [] } }; // Add all files to the workingset without verifying that // they still exist on disk (for faster project switching) files.forEach(function (value) { result.panes[FIRST_PANE].push(value); }); return result; } if (!state) { // not converted yet state = convertViewState(); } // reset _mergePanes(); _mruList = []; ViewStateManager.reset(); if (state) { panes = Object.keys(state.panes); _orientation = (panes.length > 1) ? state.orientation : null; _.forEach(state.panes, function (paneState, paneId) { _createPaneIfNecessary(paneId); promises.push(_panes[paneId].loadState(paneState)); }); AsyncUtils.waitForAll(promises).then(function (opensList) { // this will set the default layout of 50/50 or 100 // based on the number of panes _initialLayout(); // More than 1 pane, then make it resizable // and layout the panes from serialized state if (panes.length > 1) { _makeFirstPaneResizable(); // If the split state was serialized correctly // then setup the splits according to was serialized // Avoid a zero and negative split percentages if ($.isNumeric(state.splitPercentage) && state.splitPercentage > 0) { var prop; if (_orientation === VERTICAL) { prop = "width"; } else { prop = "height"; } _panes[FIRST_PANE].$el.css(prop, state.splitPercentage * 100 + "%"); _updateLayout(); } } if (_orientation) { _$el.addClass("split-" + _orientation.toLowerCase()); exports.trigger("paneLayoutChange", _orientation); } _.forEach(_panes, function (pane) { var fileList = pane.getViewList(); fileList.forEach(function (file) { if (_findFileInMRUList(pane.id, file) !== -1) { console.log(file.fullPath + " duplicated in mru list"); } _mruList.push(_makeMRUListEntry(file, pane.id)); }); exports.trigger("workingSetAddList", fileList, pane.id); }); promises = []; opensList.forEach(function (openData) { if (openData) { promises.push(CommandManager.execute(Commands.FILE_OPEN, openData)); } }); // finally set the active pane AsyncUtils.waitForAll(promises).then(function () { setActivePaneId(state.activePaneId); }); }); } }
[ "function", "_loadViewState", "(", "e", ")", "{", "// file root is appended for each project", "var", "panes", ",", "promises", "=", "[", "]", ",", "context", "=", "{", "location", ":", "{", "scope", ":", "\"user\"", ",", "layer", ":", "\"project\"", "}", "}...
Loads the workingset state @private
[ "Loads", "the", "workingset", "state" ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/view/MainViewManager.js#L1448-L1561
train
Load the view state
[ 30522, 3853, 1035, 7170, 8584, 9153, 2618, 1006, 1041, 1007, 1063, 1013, 1013, 5371, 7117, 2003, 10439, 21945, 2005, 2169, 2622, 13075, 6090, 2229, 1010, 10659, 1027, 1031, 1033, 1010, 6123, 1027, 1063, 3295, 1024, 1063, 9531, 1024, 1000, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/preferences/PreferencesBase.js
function (id, scope, promise, addBefore) { var shadowScopeOrder = this._defaults._shadowScopeOrder, shadowEntry, index, isPending = false, self = this; scope.on(PREFERENCE_CHANGE + ".prefsys", function (e, data) { self._triggerChange(data); }.bind(this)); index = _.findIndex(shadowScopeOrder, function (entry) { return entry.id === id; }); if (index > -1) { shadowEntry = shadowScopeOrder[index]; } else { /* new scope is being added. */ shadowEntry = { id: id, promise: promise, scope: scope }; if (!addBefore) { shadowScopeOrder.unshift(shadowEntry); } else { index = _.findIndex(shadowScopeOrder, function (entry) { return entry.id === addBefore; }); if (index > -1) { shadowScopeOrder.splice(index, 0, shadowEntry); } else { var queue = this._pendingScopes[addBefore]; if (!queue) { queue = []; this._pendingScopes[addBefore] = queue; } queue.unshift(shadowEntry); isPending = true; } } } if (!isPending) { promise .then(function () { this._scopes[id] = scope; this._tryAddToScopeOrder(shadowEntry); }.bind(this)) .fail(function (err) { // clean up all what's been done up to this point _.pull(shadowScopeOrder, shadowEntry); }.bind(this)); if (this._pendingScopes[id]) { var pending = this._pendingScopes[id]; delete this._pendingScopes[id]; pending.forEach(function (entry) { this._addToScopeOrder(entry.id, entry.scope, entry.promise, id); }.bind(this)); } } }
javascript
function (id, scope, promise, addBefore) { var shadowScopeOrder = this._defaults._shadowScopeOrder, shadowEntry, index, isPending = false, self = this; scope.on(PREFERENCE_CHANGE + ".prefsys", function (e, data) { self._triggerChange(data); }.bind(this)); index = _.findIndex(shadowScopeOrder, function (entry) { return entry.id === id; }); if (index > -1) { shadowEntry = shadowScopeOrder[index]; } else { /* new scope is being added. */ shadowEntry = { id: id, promise: promise, scope: scope }; if (!addBefore) { shadowScopeOrder.unshift(shadowEntry); } else { index = _.findIndex(shadowScopeOrder, function (entry) { return entry.id === addBefore; }); if (index > -1) { shadowScopeOrder.splice(index, 0, shadowEntry); } else { var queue = this._pendingScopes[addBefore]; if (!queue) { queue = []; this._pendingScopes[addBefore] = queue; } queue.unshift(shadowEntry); isPending = true; } } } if (!isPending) { promise .then(function () { this._scopes[id] = scope; this._tryAddToScopeOrder(shadowEntry); }.bind(this)) .fail(function (err) { // clean up all what's been done up to this point _.pull(shadowScopeOrder, shadowEntry); }.bind(this)); if (this._pendingScopes[id]) { var pending = this._pendingScopes[id]; delete this._pendingScopes[id]; pending.forEach(function (entry) { this._addToScopeOrder(entry.id, entry.scope, entry.promise, id); }.bind(this)); } } }
[ "function", "(", "id", ",", "scope", ",", "promise", ",", "addBefore", ")", "{", "var", "shadowScopeOrder", "=", "this", ".", "_defaults", ".", "_shadowScopeOrder", ",", "shadowEntry", ",", "index", ",", "isPending", "=", "false", ",", "self", "=", "this",...
@private Schedules the new Scope to be added the scope order in the specified location once the promise is resolved. Context's _shadowScopeOrder is used to keep track of the order in which the scope should appear. If the scope which should precede this scope fails to load, then _shadowScopeOrder will be searched for the next appropriate context (the first one which is pending or loaded that is before the failed scope). There's always the lowest-priority "default" scope which is loaded and added, it guarantees that a successfully loaded scope will always be added. Adding a Scope "before" another Scope means that the new Scope's preferences will take priority over the "before" Scope's preferences. @param {string} id Name of the new Scope @param {Scope} scope The scope object to add @param {$.Promise} promise Scope's load promise @param {?string} addBefore Name of the Scope before which this new one is added
[ "@private" ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/preferences/PreferencesBase.js#L1445-L1507
train
Add a scope to the scope order
[ 30522, 3853, 1006, 8909, 1010, 9531, 1010, 4872, 1010, 5587, 4783, 29278, 2063, 1007, 1063, 13075, 6281, 16186, 8551, 2121, 1027, 2023, 1012, 1035, 12398, 2015, 1012, 1035, 6281, 16186, 8551, 2121, 1010, 5192, 4765, 2854, 1010, 5950, 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...
angular/material
src/core/services/layout/layout.js
directiveNormalize
function directiveNormalize(name) { return name .replace(PREFIX_REGEXP, '') .replace(SPECIAL_CHARS_REGEXP, function(_, separator, letter, offset) { return offset ? letter.toUpperCase() : letter; }); }
javascript
function directiveNormalize(name) { return name .replace(PREFIX_REGEXP, '') .replace(SPECIAL_CHARS_REGEXP, function(_, separator, letter, offset) { return offset ? letter.toUpperCase() : letter; }); }
[ "function", "directiveNormalize", "(", "name", ")", "{", "return", "name", ".", "replace", "(", "PREFIX_REGEXP", ",", "''", ")", ".", "replace", "(", "SPECIAL_CHARS_REGEXP", ",", "function", "(", "_", ",", "separator", ",", "letter", ",", "offset", ")", "{...
Converts snake_case to camelCase. Also there is special case for Moz prefix starting with upper case letter. @param name Name to normalize
[ "Converts", "snake_case", "to", "camelCase", ".", "Also", "there", "is", "special", "case", "for", "Moz", "prefix", "starting", "with", "upper", "case", "letter", "." ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/core/services/layout/layout.js#L156-L162
train
Normalize a directive name
[ 30522, 3853, 16449, 12131, 9067, 4697, 1006, 2171, 1007, 1063, 2709, 2171, 1012, 5672, 1006, 17576, 1035, 19723, 10288, 2361, 1010, 1005, 1005, 1007, 1012, 5672, 1006, 2569, 1035, 25869, 2015, 1035, 19723, 10288, 2361, 1010, 3853, 1006, 103...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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...
goldfire/howler.js
dist/howler.js
function() { var self = this; var parent = self._parent; // Reset all of the parameters of this sound. self._muted = parent._muted; self._loop = parent._loop; self._volume = parent._volume; self._rate = parent._rate; self._seek = 0; self._rateSeek = 0; self._paused = true; self._ended = true; self._sprite = '__default'; // Generate a new ID so that it isn't confused with the previous sound. self._id = ++Howler._counter; return self; }
javascript
function() { var self = this; var parent = self._parent; // Reset all of the parameters of this sound. self._muted = parent._muted; self._loop = parent._loop; self._volume = parent._volume; self._rate = parent._rate; self._seek = 0; self._rateSeek = 0; self._paused = true; self._ended = true; self._sprite = '__default'; // Generate a new ID so that it isn't confused with the previous sound. self._id = ++Howler._counter; return self; }
[ "function", "(", ")", "{", "var", "self", "=", "this", ";", "var", "parent", "=", "self", ".", "_parent", ";", "// Reset all of the parameters of this sound.", "self", ".", "_muted", "=", "parent", ".", "_muted", ";", "self", ".", "_loop", "=", "parent", "...
Reset the parameters of this sound to the original state (for recycle). @return {Sound}
[ "Reset", "the", "parameters", "of", "this", "sound", "to", "the", "original", "state", "(", "for", "recycle", ")", "." ]
030db918dd8ce640afd57e172418472497e8f113
https://github.com/goldfire/howler.js/blob/030db918dd8ce640afd57e172418472497e8f113/dist/howler.js#L2233-L2252
train
Returns a new sound object.
[ 30522, 3853, 1006, 1007, 1063, 13075, 2969, 1027, 2023, 1025, 13075, 6687, 1027, 2969, 1012, 1035, 6687, 1025, 1013, 1013, 25141, 2035, 1997, 1996, 11709, 1997, 2023, 2614, 30524, 1035, 3872, 1025, 2969, 1012, 1035, 3446, 1027, 6687, 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...
SAP/openui5
src/sap.ui.documentation/src/sap/ui/documentation/sdk/controller/BaseController.js
function(event) { var sPreviousHash = History.getInstance().getPreviousHash(); if (sPreviousHash !== undefined) { // The history contains a previous entry if (sPreviousHash.indexOf("search/") === 0) { this.getRouter().navTo("search", {searchParam: sPreviousHash.split("/")[1]}, false); } else { history.go(-1); } } else { var sCurrentHash = window.location.hash; if (sCurrentHash.indexOf("#/topic/") == 0) { this.getRouter().navTo("topic", {}, true); } else if (sCurrentHash.indexOf("#/api/") == 0) { this.getRouter().navTo("api", {}, true); } } }
javascript
function(event) { var sPreviousHash = History.getInstance().getPreviousHash(); if (sPreviousHash !== undefined) { // The history contains a previous entry if (sPreviousHash.indexOf("search/") === 0) { this.getRouter().navTo("search", {searchParam: sPreviousHash.split("/")[1]}, false); } else { history.go(-1); } } else { var sCurrentHash = window.location.hash; if (sCurrentHash.indexOf("#/topic/") == 0) { this.getRouter().navTo("topic", {}, true); } else if (sCurrentHash.indexOf("#/api/") == 0) { this.getRouter().navTo("api", {}, true); } } }
[ "function", "(", "event", ")", "{", "var", "sPreviousHash", "=", "History", ".", "getInstance", "(", ")", ".", "getPreviousHash", "(", ")", ";", "if", "(", "sPreviousHash", "!==", "undefined", ")", "{", "// The history contains a previous entry", "if", "(", "s...
Event handler for navigating back. It checks if there is a history entry. If yes, history.go(-1) will happen. If not, it will replace the current entry of the browser history with the master route. @public
[ "Event", "handler", "for", "navigating", "back", ".", "It", "checks", "if", "there", "is", "a", "history", "entry", ".", "If", "yes", "history", ".", "go", "(", "-", "1", ")", "will", "happen", ".", "If", "not", "it", "will", "replace", "the", "curre...
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.documentation/src/sap/ui/documentation/sdk/controller/BaseController.js#L90-L109
train
This function is called when the history is being displayed
[ 30522, 3853, 1006, 2724, 1007, 1063, 13075, 11867, 2890, 24918, 14949, 2232, 1027, 2381, 1012, 2131, 7076, 26897, 1006, 1007, 1012, 2131, 28139, 24918, 14949, 2232, 1006, 1007, 1025, 2065, 1006, 11867, 2890, 24918, 14949, 2232, 999, 1027, 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(element) { if (element.style != null) { element.style.cursor = ''; } var children = element.childNodes; if (children != null) { var childCount = children.length; for (var i = 0; i < childCount; i += 1) { mxUtils.removeCursors(children[i]); } } }
javascript
function(element) { if (element.style != null) { element.style.cursor = ''; } var children = element.childNodes; if (children != null) { var childCount = children.length; for (var i = 0; i < childCount; i += 1) { mxUtils.removeCursors(children[i]); } } }
[ "function", "(", "element", ")", "{", "if", "(", "element", ".", "style", "!=", "null", ")", "{", "element", ".", "style", ".", "cursor", "=", "''", ";", "}", "var", "children", "=", "element", ".", "childNodes", ";", "if", "(", "children", "!=", "...
Function: removeCursors Removes the cursors from the style of the given DOM node and its descendants. Parameters: element - DOM node to remove the cursor style from.
[ "Function", ":", "removeCursors" ]
33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44
https://github.com/jgraph/mxgraph/blob/33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44/javascript/mxClient.js#L2191-L2209
train
Removes the cursor from the element
[ 30522, 3853, 1006, 5783, 1007, 1063, 2065, 1006, 5783, 1012, 2806, 999, 1027, 19701, 1007, 1063, 5783, 1012, 2806, 1012, 12731, 25301, 2099, 1027, 1005, 1005, 1025, 1065, 13075, 2336, 1027, 5783, 1012, 2775, 3630, 6155, 1025, 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...
ColorlibHQ/AdminLTE
plugins/bootstrap-slider/bootstrap-slider.js
addOptionMethod
function addOptionMethod( PluginClass ) { // don't overwrite original option method if ( PluginClass.prototype.option ) { return; } // option setter PluginClass.prototype.option = function( opts ) { // bail out if not an object if ( !$.isPlainObject( opts ) ){ return; } this.options = $.extend( true, this.options, opts ); }; }
javascript
function addOptionMethod( PluginClass ) { // don't overwrite original option method if ( PluginClass.prototype.option ) { return; } // option setter PluginClass.prototype.option = function( opts ) { // bail out if not an object if ( !$.isPlainObject( opts ) ){ return; } this.options = $.extend( true, this.options, opts ); }; }
[ "function", "addOptionMethod", "(", "PluginClass", ")", "{", "// don't overwrite original option method", "if", "(", "PluginClass", ".", "prototype", ".", "option", ")", "{", "return", ";", "}", "// option setter", "PluginClass", ".", "prototype", ".", "option", "="...
-------------------------- addOptionMethod -------------------------- // adds option method -> $().plugin('option', {...}) @param {Function} PluginClass - constructor class
[ "--------------------------", "addOptionMethod", "--------------------------", "//", "adds", "option", "method", "-", ">", "$", "()", ".", "plugin", "(", "option", "{", "...", "}", ")" ]
19113c3cbc19a7afe0cfd3158d647064d2d30661
https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/plugins/bootstrap-slider/bootstrap-slider.js#L81-L95
train
add option method
[ 30522, 3853, 5587, 7361, 3508, 11368, 6806, 2094, 1006, 13354, 2378, 26266, 1007, 1063, 1013, 1013, 2123, 1005, 1056, 2058, 26373, 2434, 5724, 4118, 2065, 1006, 13354, 2378, 26266, 1012, 8773, 1012, 5724, 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...
jgraph/mxgraph
javascript/mxClient.js
function(align, valign) { var dx = 0; var dy = 0; // Horizontal alignment if (align == mxConstants.ALIGN_CENTER) { dx = -0.5; } else if (align == mxConstants.ALIGN_RIGHT) { dx = -1; } // Vertical alignment if (valign == mxConstants.ALIGN_MIDDLE) { dy = -0.5; } else if (valign == mxConstants.ALIGN_BOTTOM) { dy = -1; } return new mxPoint(dx, dy); }
javascript
function(align, valign) { var dx = 0; var dy = 0; // Horizontal alignment if (align == mxConstants.ALIGN_CENTER) { dx = -0.5; } else if (align == mxConstants.ALIGN_RIGHT) { dx = -1; } // Vertical alignment if (valign == mxConstants.ALIGN_MIDDLE) { dy = -0.5; } else if (valign == mxConstants.ALIGN_BOTTOM) { dy = -1; } return new mxPoint(dx, dy); }
[ "function", "(", "align", ",", "valign", ")", "{", "var", "dx", "=", "0", ";", "var", "dy", "=", "0", ";", "// Horizontal alignment", "if", "(", "align", "==", "mxConstants", ".", "ALIGN_CENTER", ")", "{", "dx", "=", "-", "0.5", ";", "}", "else", "...
Function: getAlignmentAsPoint Returns an <mxPoint> that represents the horizontal and vertical alignment for numeric computations. X is -0.5 for center, -1 for right and 0 for left alignment. Y is -0.5 for middle, -1 for bottom and 0 for top alignment. Default values for missing arguments is top, left.
[ "Function", ":", "getAlignmentAsPoint" ]
33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44
https://github.com/jgraph/mxgraph/blob/33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44/javascript/mxClient.js#L5705-L5731
train
Returns the point of the given alignment and the given vertical alignment
[ 30522, 3853, 1006, 25705, 1010, 11748, 23773, 1007, 1063, 13075, 1040, 2595, 1027, 1014, 1025, 13075, 1040, 2100, 1027, 1014, 1025, 1013, 1013, 9876, 12139, 2065, 1006, 25705, 1027, 1027, 25630, 8663, 12693, 3215, 1012, 25705, 1035, 2415, 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...
airbnb/enzyme
packages/enzyme/src/ShallowWrapper.js
validateOptions
function validateOptions(options) { const { lifecycleExperimental, disableLifecycleMethods, enableComponentDidUpdateOnSetState, supportPrevContextArgumentOfComponentDidUpdate, lifecycles, } = options; if (typeof lifecycleExperimental !== 'undefined' && typeof lifecycleExperimental !== 'boolean') { throw new Error('lifecycleExperimental must be either true or false if provided'); } if (typeof disableLifecycleMethods !== 'undefined' && typeof disableLifecycleMethods !== 'boolean') { throw new Error('disableLifecycleMethods must be either true or false if provided'); } if ( lifecycleExperimental != null && disableLifecycleMethods != null && lifecycleExperimental === disableLifecycleMethods ) { throw new Error('lifecycleExperimental and disableLifecycleMethods cannot be set to the same value'); } if ( typeof enableComponentDidUpdateOnSetState !== 'undefined' && lifecycles.componentDidUpdate && lifecycles.componentDidUpdate.onSetState !== enableComponentDidUpdateOnSetState ) { throw new TypeError('the legacy enableComponentDidUpdateOnSetState option should be matched by `lifecycles: { componentDidUpdate: { onSetState: true } }`, for compatibility'); } if ( typeof supportPrevContextArgumentOfComponentDidUpdate !== 'undefined' && lifecycles.componentDidUpdate && lifecycles.componentDidUpdate.prevContext !== supportPrevContextArgumentOfComponentDidUpdate ) { throw new TypeError('the legacy supportPrevContextArgumentOfComponentDidUpdate option should be matched by `lifecycles: { componentDidUpdate: { prevContext: true } }`, for compatibility'); } }
javascript
function validateOptions(options) { const { lifecycleExperimental, disableLifecycleMethods, enableComponentDidUpdateOnSetState, supportPrevContextArgumentOfComponentDidUpdate, lifecycles, } = options; if (typeof lifecycleExperimental !== 'undefined' && typeof lifecycleExperimental !== 'boolean') { throw new Error('lifecycleExperimental must be either true or false if provided'); } if (typeof disableLifecycleMethods !== 'undefined' && typeof disableLifecycleMethods !== 'boolean') { throw new Error('disableLifecycleMethods must be either true or false if provided'); } if ( lifecycleExperimental != null && disableLifecycleMethods != null && lifecycleExperimental === disableLifecycleMethods ) { throw new Error('lifecycleExperimental and disableLifecycleMethods cannot be set to the same value'); } if ( typeof enableComponentDidUpdateOnSetState !== 'undefined' && lifecycles.componentDidUpdate && lifecycles.componentDidUpdate.onSetState !== enableComponentDidUpdateOnSetState ) { throw new TypeError('the legacy enableComponentDidUpdateOnSetState option should be matched by `lifecycles: { componentDidUpdate: { onSetState: true } }`, for compatibility'); } if ( typeof supportPrevContextArgumentOfComponentDidUpdate !== 'undefined' && lifecycles.componentDidUpdate && lifecycles.componentDidUpdate.prevContext !== supportPrevContextArgumentOfComponentDidUpdate ) { throw new TypeError('the legacy supportPrevContextArgumentOfComponentDidUpdate option should be matched by `lifecycles: { componentDidUpdate: { prevContext: true } }`, for compatibility'); } }
[ "function", "validateOptions", "(", "options", ")", "{", "const", "{", "lifecycleExperimental", ",", "disableLifecycleMethods", ",", "enableComponentDidUpdateOnSetState", ",", "supportPrevContextArgumentOfComponentDidUpdate", ",", "lifecycles", ",", "}", "=", "options", ";"...
Ensure options passed to ShallowWrapper are valid. Throws otherwise. @param {Object} options
[ "Ensure", "options", "passed", "to", "ShallowWrapper", "are", "valid", ".", "Throws", "otherwise", "." ]
cd430eae95eba151f17e970ee77c18f09476de0e
https://github.com/airbnb/enzyme/blob/cd430eae95eba151f17e970ee77c18f09476de0e/packages/enzyme/src/ShallowWrapper.js#L79-L118
train
Validate the provided options
[ 30522, 3853, 9398, 3686, 7361, 9285, 1006, 7047, 1007, 1063, 9530, 3367, 1063, 2166, 23490, 10288, 4842, 14428, 15758, 1010, 4487, 19150, 15509, 23490, 11368, 6806, 5104, 1010, 9585, 9006, 29513, 3372, 4305, 8566, 17299, 3686, 5644, 8454, 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...
GitbookIO/gitbook
lib/api/decodeGlobal.js
decodeGlobal
function decodeGlobal(output, result) { var book = output.getBook(); var config = book.getConfig(); // Update config config = decodeConfig(config, result.config); book = book.set('config', config); return output.set('book', book); }
javascript
function decodeGlobal(output, result) { var book = output.getBook(); var config = book.getConfig(); // Update config config = decodeConfig(config, result.config); book = book.set('config', config); return output.set('book', book); }
[ "function", "decodeGlobal", "(", "output", ",", "result", ")", "{", "var", "book", "=", "output", ".", "getBook", "(", ")", ";", "var", "config", "=", "book", ".", "getConfig", "(", ")", ";", "// Update config", "config", "=", "decodeConfig", "(", "confi...
Decode changes from a JS API to a output object. Only the configuration can be edited by plugin's hooks @param {Output} output @param {Object} result: result from API @return {Output}
[ "Decode", "changes", "from", "a", "JS", "API", "to", "a", "output", "object", ".", "Only", "the", "configuration", "can", "be", "edited", "by", "plugin", "s", "hooks" ]
6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4
https://github.com/GitbookIO/gitbook/blob/6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4/lib/api/decodeGlobal.js#L11-L20
train
Decode global data
[ 30522, 3853, 21933, 3207, 23296, 16429, 2389, 1006, 6434, 1010, 2765, 1007, 1063, 13075, 2338, 1027, 6434, 1012, 2131, 8654, 1006, 1007, 1025, 13075, 9530, 8873, 2290, 1027, 2338, 1012, 2131, 8663, 8873, 2290, 1006, 1007, 1025, 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...
aws/aws-sdk-js
lib/dynamodb/converter.js
convertInput
function convertInput(data, options) { options = options || {}; var type = typeOf(data); if (type === 'Object') { return formatMap(data, options); } else if (type === 'Array') { return formatList(data, options); } else if (type === 'Set') { return formatSet(data, options); } else if (type === 'String') { if (data.length === 0 && options.convertEmptyValues) { return convertInput(null); } return { S: data }; } else if (type === 'Number' || type === 'NumberValue') { return { N: data.toString() }; } else if (type === 'Binary') { if (data.length === 0 && options.convertEmptyValues) { return convertInput(null); } return { B: data }; } else if (type === 'Boolean') { return { BOOL: data }; } else if (type === 'null') { return { NULL: true }; } else if (type !== 'undefined' && type !== 'Function') { // this value has a custom constructor return formatMap(data, options); } }
javascript
function convertInput(data, options) { options = options || {}; var type = typeOf(data); if (type === 'Object') { return formatMap(data, options); } else if (type === 'Array') { return formatList(data, options); } else if (type === 'Set') { return formatSet(data, options); } else if (type === 'String') { if (data.length === 0 && options.convertEmptyValues) { return convertInput(null); } return { S: data }; } else if (type === 'Number' || type === 'NumberValue') { return { N: data.toString() }; } else if (type === 'Binary') { if (data.length === 0 && options.convertEmptyValues) { return convertInput(null); } return { B: data }; } else if (type === 'Boolean') { return { BOOL: data }; } else if (type === 'null') { return { NULL: true }; } else if (type !== 'undefined' && type !== 'Function') { // this value has a custom constructor return formatMap(data, options); } }
[ "function", "convertInput", "(", "data", ",", "options", ")", "{", "options", "=", "options", "||", "{", "}", ";", "var", "type", "=", "typeOf", "(", "data", ")", ";", "if", "(", "type", "===", "'Object'", ")", "{", "return", "formatMap", "(", "data"...
Convert a JavaScript value to its equivalent DynamoDB AttributeValue type @param data [any] The data to convert to a DynamoDB AttributeValue @param options [map] @option options convertEmptyValues [Boolean] Whether to automatically convert empty strings, blobs, and sets to `null` @option options wrapNumbers [Boolean] Whether to return numbers as a NumberValue object instead of converting them to native JavaScript numbers. This allows for the safe round-trip transport of numbers of arbitrary size. @return [map] An object in the Amazon DynamoDB AttributeValue format @see AWS.DynamoDB.Converter.marshall AWS.DynamoDB.Converter.marshall to convert entire records (rather than individual attributes)
[ "Convert", "a", "JavaScript", "value", "to", "its", "equivalent", "DynamoDB", "AttributeValue", "type" ]
c23e5f0edd150f8885267e5f7c8a564f8e6e8562
https://github.com/aws/aws-sdk-js/blob/c23e5f0edd150f8885267e5f7c8a564f8e6e8562/lib/dynamodb/converter.js#L27-L56
train
Converts an input to a format object
[ 30522, 3853, 10463, 2378, 18780, 1006, 2951, 1010, 7047, 1007, 1063, 7047, 1027, 7047, 1064, 1064, 1063, 1065, 1025, 13075, 2828, 1027, 2828, 11253, 1006, 2951, 1007, 1025, 2065, 1006, 2828, 1027, 1027, 1027, 1005, 4874, 1005, 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...
adobe/brackets
src/features/ParameterHintsManager.js
dismissHint
function dismissHint(editor) { if (hintState.visible) { $hintContainer.hide(); $hintContent.empty(); hintState = {}; if (editor) { editor.off("cursorActivity.ParameterHinting", handleCursorActivity); sessionEditor = null; } else if (sessionEditor) { sessionEditor.off("cursorActivity.ParameterHinting", handleCursorActivity); sessionEditor = null; } } }
javascript
function dismissHint(editor) { if (hintState.visible) { $hintContainer.hide(); $hintContent.empty(); hintState = {}; if (editor) { editor.off("cursorActivity.ParameterHinting", handleCursorActivity); sessionEditor = null; } else if (sessionEditor) { sessionEditor.off("cursorActivity.ParameterHinting", handleCursorActivity); sessionEditor = null; } } }
[ "function", "dismissHint", "(", "editor", ")", "{", "if", "(", "hintState", ".", "visible", ")", "{", "$hintContainer", ".", "hide", "(", ")", ";", "$hintContent", ".", "empty", "(", ")", ";", "hintState", "=", "{", "}", ";", "if", "(", "editor", ")"...
Dismiss the function hint.
[ "Dismiss", "the", "function", "hint", "." ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/features/ParameterHintsManager.js#L230-L244
train
Dismisses the hint
[ 30522, 3853, 19776, 10606, 2102, 1006, 3559, 1007, 1063, 2065, 1006, 20385, 12259, 1012, 5710, 1007, 1063, 1002, 9374, 8663, 18249, 2121, 1012, 5342, 1006, 1007, 1025, 1002, 9374, 8663, 6528, 2102, 1012, 4064, 1006, 1007, 1025, 30524, 1000,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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...
aframevr/aframe
src/components/animation.js
getPropertyType
function getPropertyType (el, property) { var component; var componentName; var split; var propertyName; split = property.split('.'); componentName = split[0]; propertyName = split[1]; component = el.components[componentName] || components[componentName]; // Primitives. if (!component) { return null; } // Dynamic schema. We only care about vectors anyways. if (propertyName && !component.schema[propertyName]) { return null; } // Multi-prop. if (propertyName) { return component.schema[propertyName].type; } // Single-prop. return component.schema.type; }
javascript
function getPropertyType (el, property) { var component; var componentName; var split; var propertyName; split = property.split('.'); componentName = split[0]; propertyName = split[1]; component = el.components[componentName] || components[componentName]; // Primitives. if (!component) { return null; } // Dynamic schema. We only care about vectors anyways. if (propertyName && !component.schema[propertyName]) { return null; } // Multi-prop. if (propertyName) { return component.schema[propertyName].type; } // Single-prop. return component.schema.type; }
[ "function", "getPropertyType", "(", "el", ",", "property", ")", "{", "var", "component", ";", "var", "componentName", ";", "var", "split", ";", "var", "propertyName", ";", "split", "=", "property", ".", "split", "(", "'.'", ")", ";", "componentName", "=", ...
Given property name, check schema to see what type we are animating. We just care whether the property is a vector.
[ "Given", "property", "name", "check", "schema", "to", "see", "what", "type", "we", "are", "animating", ".", "We", "just", "care", "whether", "the", "property", "is", "a", "vector", "." ]
24acc78a7299a4cdfe3ef617f4d40ddf6275c992
https://github.com/aframevr/aframe/blob/24acc78a7299a4cdfe3ef617f4d40ddf6275c992/src/components/animation.js#L515-L537
train
Get the type of a property in an element.
[ 30522, 3853, 2131, 21572, 4842, 3723, 13874, 1006, 3449, 1010, 3200, 1007, 1063, 13075, 6922, 1025, 13075, 6922, 18442, 1025, 13075, 3975, 1025, 13075, 3200, 18442, 1025, 3975, 1027, 3200, 1012, 3975, 1006, 1005, 1012, 1005, 1007, 1025, 692...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/utils.js
replaceContent
function replaceContent(args, generator) { args.path = args.path || process.cwd(); const fullPath = path.join(args.path, args.file); const re = args.regex ? new RegExp(args.pattern, 'g') : args.pattern; let body = generator.fs.read(fullPath); body = body.replace(re, args.content); generator.fs.write(fullPath, body); }
javascript
function replaceContent(args, generator) { args.path = args.path || process.cwd(); const fullPath = path.join(args.path, args.file); const re = args.regex ? new RegExp(args.pattern, 'g') : args.pattern; let body = generator.fs.read(fullPath); body = body.replace(re, args.content); generator.fs.write(fullPath, body); }
[ "function", "replaceContent", "(", "args", ",", "generator", ")", "{", "args", ".", "path", "=", "args", ".", "path", "||", "process", ".", "cwd", "(", ")", ";", "const", "fullPath", "=", "path", ".", "join", "(", "args", ".", "path", ",", "args", ...
Replace content @param {object} args argument object @param {object} generator reference to the generator
[ "Replace", "content" ]
f76fa8de0818ce6bda6c7b1455942e2a9b0ae3ff
https://github.com/jhipster/generator-jhipster/blob/f76fa8de0818ce6bda6c7b1455942e2a9b0ae3ff/generators/utils.js#L71-L80
train
Replace content with the content
[ 30522, 3853, 5672, 8663, 6528, 2102, 1006, 12098, 5620, 1010, 13103, 1007, 1063, 12098, 5620, 1012, 4130, 1027, 12098, 5620, 1012, 4130, 1064, 1064, 2832, 1012, 19296, 2094, 1006, 1007, 1025, 9530, 3367, 2440, 15069, 1027, 4130, 1012, 3693,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/util/reflection/BaseTreeModifier.js
function(vControl, sPropertyName, vBindingOrValue) { var bIsBindingObject = vBindingOrValue && (vBindingOrValue.path || vBindingOrValue.parts); var bIsBindingString = vBindingOrValue && typeof vBindingOrValue === "string" && vBindingOrValue.substring(0, 1) === "{" && vBindingOrValue.slice(-1) === "}"; var sOperation = bIsBindingObject || bIsBindingString ? "setPropertyBinding" : "setProperty"; this[sOperation](vControl, sPropertyName, vBindingOrValue); }
javascript
function(vControl, sPropertyName, vBindingOrValue) { var bIsBindingObject = vBindingOrValue && (vBindingOrValue.path || vBindingOrValue.parts); var bIsBindingString = vBindingOrValue && typeof vBindingOrValue === "string" && vBindingOrValue.substring(0, 1) === "{" && vBindingOrValue.slice(-1) === "}"; var sOperation = bIsBindingObject || bIsBindingString ? "setPropertyBinding" : "setProperty"; this[sOperation](vControl, sPropertyName, vBindingOrValue); }
[ "function", "(", "vControl", ",", "sPropertyName", ",", "vBindingOrValue", ")", "{", "var", "bIsBindingObject", "=", "vBindingOrValue", "&&", "(", "vBindingOrValue", ".", "path", "||", "vBindingOrValue", ".", "parts", ")", ";", "var", "bIsBindingString", "=", "v...
Calls {@link sap.ui.core.util.reflection.BaseTreeModifier#setPropertyBinding} if the passed value is a binding info object or binding string, otherwise calls {@link sap.ui.core.util.reflection.BaseTreeModifier#setProperty}. @param {sap.ui.base.ManagedObject|Element} vControl - Control representation @param {string} sPropertyName - Property name @param {any} vBindingOrValue - Property binding or property value @public
[ "Calls", "{", "@link", "sap", ".", "ui", ".", "core", ".", "util", ".", "reflection", ".", "BaseTreeModifier#setPropertyBinding", "}", "if", "the", "passed", "value", "is", "a", "binding", "info", "object", "or", "binding", "string", "otherwise", "calls", "{...
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/util/reflection/BaseTreeModifier.js#L363-L369
train
Sets the value of a property
[ 30522, 3853, 1006, 18315, 12162, 13153, 1010, 11867, 18981, 15010, 18442, 1010, 1058, 8428, 4667, 2953, 10175, 5657, 1007, 1063, 13075, 20377, 8428, 4667, 16429, 20614, 1027, 1058, 8428, 4667, 2953, 10175, 5657, 1004, 1004, 1006, 1058, 8428, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/75_xlml.js
write_props_xlml
function write_props_xlml(wb/*:Workbook*/, opts)/*:string*/ { var o/*:Array<string>*/ = []; /* DocumentProperties */ if(wb.Props) o.push(xlml_write_docprops(wb.Props, opts)); /* CustomDocumentProperties */ if(wb.Custprops) o.push(xlml_write_custprops(wb.Props, wb.Custprops, opts)); return o.join(""); }
javascript
function write_props_xlml(wb/*:Workbook*/, opts)/*:string*/ { var o/*:Array<string>*/ = []; /* DocumentProperties */ if(wb.Props) o.push(xlml_write_docprops(wb.Props, opts)); /* CustomDocumentProperties */ if(wb.Custprops) o.push(xlml_write_custprops(wb.Props, wb.Custprops, opts)); return o.join(""); }
[ "function", "write_props_xlml", "(", "wb", "/*:Workbook*/", ",", "opts", ")", "/*:string*/", "{", "var", "o", "/*:Array<string>*/", "=", "[", "]", ";", "/* DocumentProperties */", "if", "(", "wb", ".", "Props", ")", "o", ".", "push", "(", "xlml_write_docprops"...
/* TODO
[ "/", "*", "TODO" ]
9a6d8a1d3d80c78dad5201fb389316f935279cdc
https://github.com/SheetJS/js-xlsx/blob/9a6d8a1d3d80c78dad5201fb389316f935279cdc/bits/75_xlml.js#L851-L858
train
Write DocumentProperties and CustomDocumentProperties to xlml
[ 30522, 3853, 4339, 1035, 24387, 1035, 28712, 19968, 1006, 25610, 1013, 1008, 1024, 2147, 8654, 1008, 1013, 1010, 23569, 2015, 1007, 1013, 1008, 1024, 5164, 1008, 1013, 1063, 13075, 1051, 1013, 1008, 1024, 9140, 1026, 5164, 1028, 1008, 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/utils/StringMatch.js
_prefixMatchResult
function _prefixMatchResult(str, query) { var result = new SearchResult(str); result.matchGoodness = -Number.MAX_VALUE; if (str.substr(0, query.length) !== query) { // Penalize for not matching case result.matchGoodness *= 0.5; } if (DEBUG_SCORES) { result.scoreDebug = { beginning: -result.matchGoodness }; } result.stringRanges = [{ text: str.substr(0, query.length), matched: true, includesLastSegment: true }]; if (str.length > query.length) { result.stringRanges.push({ text: str.substring(query.length), matched: false, includesLastSegment: true }); } return result; }
javascript
function _prefixMatchResult(str, query) { var result = new SearchResult(str); result.matchGoodness = -Number.MAX_VALUE; if (str.substr(0, query.length) !== query) { // Penalize for not matching case result.matchGoodness *= 0.5; } if (DEBUG_SCORES) { result.scoreDebug = { beginning: -result.matchGoodness }; } result.stringRanges = [{ text: str.substr(0, query.length), matched: true, includesLastSegment: true }]; if (str.length > query.length) { result.stringRanges.push({ text: str.substring(query.length), matched: false, includesLastSegment: true }); } return result; }
[ "function", "_prefixMatchResult", "(", "str", ",", "query", ")", "{", "var", "result", "=", "new", "SearchResult", "(", "str", ")", ";", "result", ".", "matchGoodness", "=", "-", "Number", ".", "MAX_VALUE", ";", "if", "(", "str", ".", "substr", "(", "0...
/* If we short circuit normal matching to produce a prefix match, this function will generate the appropriate SearchResult. This function assumes that the prefix match check has already been performed. @param {string} str The string with the prefix match for the query @param {string} query The query that matched the beginning of str @return {{ranges:Array.<{text:string, matched:boolean, includesLastSegment:boolean}>, matchGoodness:int, scoreDebug: Object}} ranges has a matching range for beginning of str and a non-matching range for the end of the str the score is -Number.MAX_VALUE in all cases
[ "/", "*", "If", "we", "short", "circuit", "normal", "matching", "to", "produce", "a", "prefix", "match", "this", "function", "will", "generate", "the", "appropriate", "SearchResult", ".", "This", "function", "assumes", "that", "the", "prefix", "match", "check"...
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/utils/StringMatch.js#L709-L738
train
Prefix match result with query
[ 30522, 3853, 1035, 17576, 18900, 2818, 6072, 11314, 1006, 2358, 2099, 1010, 23032, 1007, 1063, 13075, 2765, 1027, 2047, 3945, 6072, 11314, 1006, 2358, 2099, 1007, 1025, 2765, 1012, 2674, 24146, 2791, 1027, 1011, 2193, 1012, 4098, 1035, 3643...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/templating/render.js
renderTemplate
function renderTemplate(engine, filePath, content, context) { context = context || {}; // Mutable objects to contains all blocks requiring post-processing var blocks = {}; // Create nunjucks environment var env = engine.toNunjucks(blocks); // Replace shortcuts from plugin's blocks content = replaceShortcuts(engine.getBlocks(), filePath, content); return timing.measure( 'template.render', Promise.nfcall( env.renderString.bind(env), content, context, { path: filePath } ) .then(function(content) { return TemplateOutput.create(content, blocks); }) ); }
javascript
function renderTemplate(engine, filePath, content, context) { context = context || {}; // Mutable objects to contains all blocks requiring post-processing var blocks = {}; // Create nunjucks environment var env = engine.toNunjucks(blocks); // Replace shortcuts from plugin's blocks content = replaceShortcuts(engine.getBlocks(), filePath, content); return timing.measure( 'template.render', Promise.nfcall( env.renderString.bind(env), content, context, { path: filePath } ) .then(function(content) { return TemplateOutput.create(content, blocks); }) ); }
[ "function", "renderTemplate", "(", "engine", ",", "filePath", ",", "content", ",", "context", ")", "{", "context", "=", "context", "||", "{", "}", ";", "// Mutable objects to contains all blocks requiring post-processing", "var", "blocks", "=", "{", "}", ";", "// ...
Render a template @param {TemplateEngine} engine @param {String} filePath: absolute path for the loader @param {String} content @param {Object} context (optional) @return {Promise<TemplateOutput>}
[ "Render", "a", "template" ]
6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4
https://github.com/GitbookIO/gitbook/blob/6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4/lib/templating/render.js#L15-L42
train
Render a template
[ 30522, 3853, 17552, 18532, 15725, 1006, 3194, 1010, 5371, 15069, 1010, 4180, 1010, 6123, 1007, 1063, 6123, 1027, 6123, 1064, 1064, 1063, 1065, 1025, 1013, 1013, 14163, 10880, 5200, 2000, 3397, 2035, 5991, 9034, 2695, 1011, 6364, 13075, 5991...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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...
expressjs/express
examples/auth/index.js
authenticate
function authenticate(name, pass, fn) { if (!module.parent) console.log('authenticating %s:%s', name, pass); var user = users[name]; // query the db for the given username if (!user) return fn(new Error('cannot find user')); // apply the same algorithm to the POSTed password, applying // the hash against the pass / salt, if there is a match we // found the user hash({ password: pass, salt: user.salt }, function (err, pass, salt, hash) { if (err) return fn(err); if (hash === user.hash) return fn(null, user) fn(new Error('invalid password')); }); }
javascript
function authenticate(name, pass, fn) { if (!module.parent) console.log('authenticating %s:%s', name, pass); var user = users[name]; // query the db for the given username if (!user) return fn(new Error('cannot find user')); // apply the same algorithm to the POSTed password, applying // the hash against the pass / salt, if there is a match we // found the user hash({ password: pass, salt: user.salt }, function (err, pass, salt, hash) { if (err) return fn(err); if (hash === user.hash) return fn(null, user) fn(new Error('invalid password')); }); }
[ "function", "authenticate", "(", "name", ",", "pass", ",", "fn", ")", "{", "if", "(", "!", "module", ".", "parent", ")", "console", ".", "log", "(", "'authenticating %s:%s'", ",", "name", ",", "pass", ")", ";", "var", "user", "=", "users", "[", "name...
Authenticate using our plain-object database of doom!
[ "Authenticate", "using", "our", "plain", "-", "object", "database", "of", "doom!" ]
dc538f6e810bd462c98ee7e6aae24c64d4b1da93
https://github.com/expressjs/express/blob/dc538f6e810bd462c98ee7e6aae24c64d4b1da93/examples/auth/index.js#L58-L71
train
authenticate the user
[ 30522, 3853, 14469, 3686, 1006, 2171, 1010, 3413, 1010, 1042, 2078, 1007, 1063, 2065, 1006, 999, 11336, 1012, 6687, 1007, 10122, 1012, 8833, 1006, 1005, 14469, 5844, 1003, 1055, 1024, 1003, 1055, 1005, 1010, 2171, 1010, 3413, 1007, 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...
jgraph/mxgraph
javascript/mxClient.js
function(a, b) { if ((a == null && b != null) || (a != null && b == null) || (a != null && b != null && a.length != b.length)) { return false; } else if (a != null && b != null) { // Counts keys in b to check if all values have been compared var count = 0; for (var key in b) { count++; } for (var key in a) { count-- if ((!mxUtils.isNaN(a[key]) || !mxUtils.isNaN(b[key])) && a[key] != b[key]) { return false; } } } return count == 0; }
javascript
function(a, b) { if ((a == null && b != null) || (a != null && b == null) || (a != null && b != null && a.length != b.length)) { return false; } else if (a != null && b != null) { // Counts keys in b to check if all values have been compared var count = 0; for (var key in b) { count++; } for (var key in a) { count-- if ((!mxUtils.isNaN(a[key]) || !mxUtils.isNaN(b[key])) && a[key] != b[key]) { return false; } } } return count == 0; }
[ "function", "(", "a", ",", "b", ")", "{", "if", "(", "(", "a", "==", "null", "&&", "b", "!=", "null", ")", "||", "(", "a", "!=", "null", "&&", "b", "==", "null", ")", "||", "(", "a", "!=", "null", "&&", "b", "!=", "null", "&&", "a", ".", ...
Function: equalEntries Returns true if all properties of the given objects are equal. Values with NaN are equal to NaN and unequal to any other value. Parameters: a - First object to be compared. b - Second object to be compared.
[ "Function", ":", "equalEntries" ]
33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44
https://github.com/jgraph/mxgraph/blob/33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44/javascript/mxClient.js#L3930-L3959
train
Compares two values in a with the values in b.
[ 30522, 3853, 1006, 1037, 1010, 1038, 1007, 1063, 2065, 1006, 1006, 1037, 1027, 1027, 19701, 1004, 1004, 1038, 999, 1027, 19701, 1007, 1064, 1064, 1006, 1037, 999, 1027, 19701, 1004, 1004, 1038, 1027, 1027, 19701, 1007, 1064, 1064, 1006, 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/thirdparty/jszip.js
function(asUTF8) { var result = getRawData(this); if (result === null || typeof result === "undefined") { return ""; } // if the data is a base64 string, we decode it before checking the encoding ! if (this.options.base64) { result = base64.decode(result); } if (asUTF8 && this.options.binary) { // JSZip.prototype.utf8decode supports arrays as input // skip to array => string step, utf8decode will do it. result = out.utf8decode(result); } else { // no utf8 transformation, do the array => string step. result = utils.transformTo("string", result); } if (!asUTF8 && !this.options.binary) { result = out.utf8encode(result); } return result; }
javascript
function(asUTF8) { var result = getRawData(this); if (result === null || typeof result === "undefined") { return ""; } // if the data is a base64 string, we decode it before checking the encoding ! if (this.options.base64) { result = base64.decode(result); } if (asUTF8 && this.options.binary) { // JSZip.prototype.utf8decode supports arrays as input // skip to array => string step, utf8decode will do it. result = out.utf8decode(result); } else { // no utf8 transformation, do the array => string step. result = utils.transformTo("string", result); } if (!asUTF8 && !this.options.binary) { result = out.utf8encode(result); } return result; }
[ "function", "(", "asUTF8", ")", "{", "var", "result", "=", "getRawData", "(", "this", ")", ";", "if", "(", "result", "===", "null", "||", "typeof", "result", "===", "\"undefined\"", ")", "{", "return", "\"\"", ";", "}", "// if the data is a base64 string, we...
Transform this._data into a string. @param {function} filter a function String -> String, applied if not null on the result. @return {String} the string representing this._data.
[ "Transform", "this", ".", "_data", "into", "a", "string", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/thirdparty/jszip.js#L422-L445
train
Returns the raw data of the file
[ 30522, 3853, 1006, 2004, 4904, 2546, 2620, 1007, 1063, 13075, 2765, 1027, 2131, 2527, 21724, 6790, 1006, 2023, 1007, 1025, 2065, 1006, 2765, 1027, 1027, 1027, 19701, 1064, 1064, 2828, 11253, 2765, 1027, 1027, 1027, 1000, 6151, 28344, 1000, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/caja-html-sanitizer.js
sanitizeHistorySensitive
function sanitizeHistorySensitive(blockOfProperties) { var elide = false; for (var i = 0, n = blockOfProperties.length; i < n-1; ++i) { var token = blockOfProperties[i]; if (':' === blockOfProperties[i+1]) { elide = !(cssSchema[token].cssPropBits & CSS_PROP_BIT_ALLOWED_IN_LINK); } if (elide) { blockOfProperties[i] = ''; } if (';' === token) { elide = false; } } return blockOfProperties.join(''); }
javascript
function sanitizeHistorySensitive(blockOfProperties) { var elide = false; for (var i = 0, n = blockOfProperties.length; i < n-1; ++i) { var token = blockOfProperties[i]; if (':' === blockOfProperties[i+1]) { elide = !(cssSchema[token].cssPropBits & CSS_PROP_BIT_ALLOWED_IN_LINK); } if (elide) { blockOfProperties[i] = ''; } if (';' === token) { elide = false; } } return blockOfProperties.join(''); }
[ "function", "sanitizeHistorySensitive", "(", "blockOfProperties", ")", "{", "var", "elide", "=", "false", ";", "for", "(", "var", "i", "=", "0", ",", "n", "=", "blockOfProperties", ".", "length", ";", "i", "<", "n", "-", "1", ";", "++", "i", ")", "{"...
Given a series of sanitized tokens, removes any properties that would leak user history if allowed to style links differently depending on whether the linked URL is in the user's browser history. @param {Array.<string>} blockOfProperties
[ "Given", "a", "series", "of", "sanitized", "tokens", "removes", "any", "properties", "that", "would", "leak", "user", "history", "if", "allowed", "to", "style", "links", "differently", "depending", "on", "whether", "the", "linked", "URL", "is", "in", "the", ...
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/thirdparty/caja-html-sanitizer.js#L1493-L1504
train
Sanitize history sensitive
[ 30522, 3853, 2624, 25090, 4371, 24158, 7062, 5054, 28032, 3512, 1006, 3796, 11253, 21572, 4842, 7368, 1007, 1063, 13075, 12005, 3207, 1027, 6270, 1025, 2005, 1006, 13075, 1045, 1027, 1014, 1010, 1050, 1027, 3796, 11253, 21572, 4842, 7368, 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...
adobe/brackets
src/language/HTMLUtils.js
findBlocks
function findBlocks(editor, modeName) { // Start scanning from beginning of file var ctx = TokenUtils.getInitialContext(editor._codeMirror, {line: 0, ch: 0}), blocks = [], currentBlock = null, inBlock = false, outerMode = editor._codeMirror.getMode(), tokenModeName, previousMode; while (TokenUtils.moveNextToken(ctx, false)) { tokenModeName = CodeMirror.innerMode(outerMode, ctx.token.state).mode.name; if (inBlock) { if (!currentBlock.end) { // Handle empty blocks currentBlock.end = currentBlock.start; } // Check for end of this block if (tokenModeName === previousMode) { // currentBlock.end is already set to pos of the last token by now currentBlock.text = editor.document.getRange(currentBlock.start, currentBlock.end); inBlock = false; } else { currentBlock.end = { line: ctx.pos.line, ch: ctx.pos.ch }; } } else { // Check for start of a block if (tokenModeName === modeName) { currentBlock = { start: { line: ctx.pos.line, ch: ctx.pos.ch } }; blocks.push(currentBlock); inBlock = true; } else { previousMode = tokenModeName; } // else, random token: ignore } } return blocks; }
javascript
function findBlocks(editor, modeName) { // Start scanning from beginning of file var ctx = TokenUtils.getInitialContext(editor._codeMirror, {line: 0, ch: 0}), blocks = [], currentBlock = null, inBlock = false, outerMode = editor._codeMirror.getMode(), tokenModeName, previousMode; while (TokenUtils.moveNextToken(ctx, false)) { tokenModeName = CodeMirror.innerMode(outerMode, ctx.token.state).mode.name; if (inBlock) { if (!currentBlock.end) { // Handle empty blocks currentBlock.end = currentBlock.start; } // Check for end of this block if (tokenModeName === previousMode) { // currentBlock.end is already set to pos of the last token by now currentBlock.text = editor.document.getRange(currentBlock.start, currentBlock.end); inBlock = false; } else { currentBlock.end = { line: ctx.pos.line, ch: ctx.pos.ch }; } } else { // Check for start of a block if (tokenModeName === modeName) { currentBlock = { start: { line: ctx.pos.line, ch: ctx.pos.ch } }; blocks.push(currentBlock); inBlock = true; } else { previousMode = tokenModeName; } // else, random token: ignore } } return blocks; }
[ "function", "findBlocks", "(", "editor", ",", "modeName", ")", "{", "// Start scanning from beginning of file", "var", "ctx", "=", "TokenUtils", ".", "getInitialContext", "(", "editor", ".", "_codeMirror", ",", "{", "line", ":", "0", ",", "ch", ":", "0", "}", ...
Returns an Array of info about all blocks whose token mode name matches that passed in, in the given Editor's HTML document (assumes the Editor contains HTML text). @param {!Editor} editor - the editor containing the HTML text @param {string} modeName - the mode name of the tokens to look for @return {Array.<{start:{line:number, ch:number}, end:{line:number, ch:number}, text:string}>}
[ "Returns", "an", "Array", "of", "info", "about", "all", "blocks", "whose", "token", "mode", "name", "matches", "that", "passed", "in", "in", "the", "given", "Editor", "s", "HTML", "document", "(", "assumes", "the", "Editor", "contains", "HTML", "text", ")"...
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/language/HTMLUtils.js#L518-L559
train
Find blocks in the current file
[ 30522, 3853, 2424, 23467, 2015, 1006, 3559, 1010, 5549, 18442, 1007, 1063, 1013, 1013, 2707, 13722, 2013, 2927, 1997, 5371, 13075, 14931, 2595, 1027, 19204, 21823, 4877, 1012, 2131, 5498, 20925, 8663, 18209, 1006, 3559, 1012, 1035, 3642, 14...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 (_callback) { Strophe.error("Server did not send any auth methods"); this._conn._changeConnectStatus(Strophe.Status.CONNFAIL, "Server did not send any auth methods"); if (_callback) { _callback = _callback.bind(this._conn); _callback(); } this._conn._doDisconnect(); }
javascript
function (_callback) { Strophe.error("Server did not send any auth methods"); this._conn._changeConnectStatus(Strophe.Status.CONNFAIL, "Server did not send any auth methods"); if (_callback) { _callback = _callback.bind(this._conn); _callback(); } this._conn._doDisconnect(); }
[ "function", "(", "_callback", ")", "{", "Strophe", ".", "error", "(", "\"Server did not send any auth methods\"", ")", ";", "this", ".", "_conn", ".", "_changeConnectStatus", "(", "Strophe", ".", "Status", ".", "CONNFAIL", ",", "\"Server did not send any auth methods\...
PrivateFunction: _no_auth_received Called on stream start/restart when no stream:features has been received.
[ "PrivateFunction", ":", "_no_auth_received" ]
ff74c90a1671a552f3604b1288bf38a4126312d0
https://github.com/dcloudio/mui/blob/ff74c90a1671a552f3604b1288bf38a4126312d0/examples/login/libs/easymob-webim-sdk/strophe-custom-2.0.0.js#L5057-L5066
train
Send any auth methods to the server
[ 30522, 3853, 1006, 1035, 2655, 5963, 1007, 1063, 2358, 18981, 5369, 1012, 7561, 1006, 1000, 8241, 2106, 2025, 4604, 2151, 8740, 2705, 4725, 1000, 1007, 1025, 2023, 1012, 1035, 9530, 2078, 1012, 1035, 2689, 8663, 2638, 16649, 29336, 2271, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/hello-mui/js/mui.js
function(element, event, selector, callback) { return function(e) { //same event var callbackObjs = delegates[element._mid][event]; var handlerQueue = []; var target = e.target; var selectorAlls = {}; for (; target && target !== document; target = target.parentNode) { if (target === element) { break; } if (~['click', 'tap', 'doubletap', 'longtap', 'hold'].indexOf(event) && (target.disabled || target.classList.contains('mui-disabled'))) { break; } var matches = {}; $.each(callbackObjs, function(selector, callbacks) { //same selector selectorAlls[selector] || (selectorAlls[selector] = $.qsa(selector, element)); if (selectorAlls[selector] && ~(selectorAlls[selector]).indexOf(target)) { if (!matches[selector]) { matches[selector] = callbacks; } } }, true); if (!$.isEmptyObject(matches)) { handlerQueue.push({ element: target, handlers: matches }); } } selectorAlls = null; e = compatible(e); //compatible event $.each(handlerQueue, function(index, handler) { target = handler.element; var tagName = target.tagName; if (event === 'tap' && (tagName !== 'INPUT' && tagName !== 'TEXTAREA' && tagName !== 'SELECT')) { e.preventDefault(); e.detail && e.detail.gesture && e.detail.gesture.preventDefault(); } $.each(handler.handlers, function(index, handler) { $.each(handler, function(index, callback) { if (callback.call(target, e) === false) { e.preventDefault(); e.stopPropagation(); } }, true); }, true) if (e.isPropagationStopped()) { return false; } }, true); }; }
javascript
function(element, event, selector, callback) { return function(e) { //same event var callbackObjs = delegates[element._mid][event]; var handlerQueue = []; var target = e.target; var selectorAlls = {}; for (; target && target !== document; target = target.parentNode) { if (target === element) { break; } if (~['click', 'tap', 'doubletap', 'longtap', 'hold'].indexOf(event) && (target.disabled || target.classList.contains('mui-disabled'))) { break; } var matches = {}; $.each(callbackObjs, function(selector, callbacks) { //same selector selectorAlls[selector] || (selectorAlls[selector] = $.qsa(selector, element)); if (selectorAlls[selector] && ~(selectorAlls[selector]).indexOf(target)) { if (!matches[selector]) { matches[selector] = callbacks; } } }, true); if (!$.isEmptyObject(matches)) { handlerQueue.push({ element: target, handlers: matches }); } } selectorAlls = null; e = compatible(e); //compatible event $.each(handlerQueue, function(index, handler) { target = handler.element; var tagName = target.tagName; if (event === 'tap' && (tagName !== 'INPUT' && tagName !== 'TEXTAREA' && tagName !== 'SELECT')) { e.preventDefault(); e.detail && e.detail.gesture && e.detail.gesture.preventDefault(); } $.each(handler.handlers, function(index, handler) { $.each(handler, function(index, callback) { if (callback.call(target, e) === false) { e.preventDefault(); e.stopPropagation(); } }, true); }, true) if (e.isPropagationStopped()) { return false; } }, true); }; }
[ "function", "(", "element", ",", "event", ",", "selector", ",", "callback", ")", "{", "return", "function", "(", "e", ")", "{", "//same event", "var", "callbackObjs", "=", "delegates", "[", "element", ".", "_mid", "]", "[", "event", "]", ";", "var", "h...
返回事件委托的wrap事件回调
[ "返回事件委托的wrap事件回调" ]
ff74c90a1671a552f3604b1288bf38a4126312d0
https://github.com/dcloudio/mui/blob/ff74c90a1671a552f3604b1288bf38a4126312d0/examples/hello-mui/js/mui.js#L597-L649
train
The event handler function
[ 30522, 3853, 1006, 5783, 1010, 2724, 1010, 27000, 1010, 2655, 5963, 1007, 1063, 2709, 3853, 1006, 1041, 1007, 1063, 1013, 1013, 2168, 2724, 13075, 2655, 5963, 16429, 22578, 1027, 10284, 1031, 5783, 1012, 1035, 3054, 1033, 1031, 2724, 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...
aframevr/aframe
src/core/component.js
function (value, clobber) { var newAttrValue; var tempObject; var property; if (value === undefined) { return; } // If null value is the new attribute value, make the attribute value falsy. if (value === null) { if (this.isObjectBased && this.attrValue) { this.objectPool.recycle(this.attrValue); } this.attrValue = undefined; return; } if (value instanceof Object && !(value instanceof window.HTMLElement)) { // If value is an object, copy it to our pooled newAttrValue object to use to update // the attrValue. tempObject = this.objectPool.use(); newAttrValue = utils.extend(tempObject, value); } else { newAttrValue = this.parseAttrValueForCache(value); } // Merge new data with previous `attrValue` if updating and not clobbering. if (this.isObjectBased && !clobber && this.attrValue) { for (property in this.attrValue) { if (newAttrValue[property] === undefined) { newAttrValue[property] = this.attrValue[property]; } } } // Update attrValue. if (this.isObjectBased && !this.attrValue) { this.attrValue = this.objectPool.use(); } utils.objectPool.clearObject(this.attrValue); this.attrValue = extendProperties(this.attrValue, newAttrValue, this.isObjectBased); utils.objectPool.clearObject(tempObject); }
javascript
function (value, clobber) { var newAttrValue; var tempObject; var property; if (value === undefined) { return; } // If null value is the new attribute value, make the attribute value falsy. if (value === null) { if (this.isObjectBased && this.attrValue) { this.objectPool.recycle(this.attrValue); } this.attrValue = undefined; return; } if (value instanceof Object && !(value instanceof window.HTMLElement)) { // If value is an object, copy it to our pooled newAttrValue object to use to update // the attrValue. tempObject = this.objectPool.use(); newAttrValue = utils.extend(tempObject, value); } else { newAttrValue = this.parseAttrValueForCache(value); } // Merge new data with previous `attrValue` if updating and not clobbering. if (this.isObjectBased && !clobber && this.attrValue) { for (property in this.attrValue) { if (newAttrValue[property] === undefined) { newAttrValue[property] = this.attrValue[property]; } } } // Update attrValue. if (this.isObjectBased && !this.attrValue) { this.attrValue = this.objectPool.use(); } utils.objectPool.clearObject(this.attrValue); this.attrValue = extendProperties(this.attrValue, newAttrValue, this.isObjectBased); utils.objectPool.clearObject(tempObject); }
[ "function", "(", "value", ",", "clobber", ")", "{", "var", "newAttrValue", ";", "var", "tempObject", ";", "var", "property", ";", "if", "(", "value", "===", "undefined", ")", "{", "return", ";", "}", "// If null value is the new attribute value, make the attribute...
Update the cache of the pre-parsed attribute value. @param {string} value - New data. @param {boolean } clobber - Whether to wipe out and replace previous data.
[ "Update", "the", "cache", "of", "the", "pre", "-", "parsed", "attribute", "value", "." ]
24acc78a7299a4cdfe3ef617f4d40ddf6275c992
https://github.com/aframevr/aframe/blob/24acc78a7299a4cdfe3ef617f4d40ddf6275c992/src/core/component.js#L186-L227
train
Updates the attrValue object with the new value.
[ 30522, 3853, 1006, 3643, 1010, 18856, 16429, 5677, 1007, 1063, 13075, 2047, 19321, 26585, 5657, 1025, 13075, 13657, 2497, 20614, 1025, 13075, 3200, 1025, 2065, 1006, 3643, 1027, 1027, 1027, 6151, 28344, 1007, 1063, 2709, 1025, 1065, 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.core/src/sap/ui/model/odata/type/Time.js
getErrorMessage
function getErrorMessage(oType) { return sap.ui.getCore().getLibraryResourceBundle().getText("EnterTime", [oType.formatValue(oDemoTime, "string")]); }
javascript
function getErrorMessage(oType) { return sap.ui.getCore().getLibraryResourceBundle().getText("EnterTime", [oType.formatValue(oDemoTime, "string")]); }
[ "function", "getErrorMessage", "(", "oType", ")", "{", "return", "sap", ".", "ui", ".", "getCore", "(", ")", ".", "getLibraryResourceBundle", "(", ")", ".", "getText", "(", "\"EnterTime\"", ",", "[", "oType", ".", "formatValue", "(", "oDemoTime", ",", "\"s...
Returns the locale-dependent error message. @param {sap.ui.model.odata.type.Time} oType the type @returns {string} the locale-dependent error message @private
[ "Returns", "the", "locale", "-", "dependent", "error", "message", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/type/Time.js#L36-L39
train
Returns the error message for the given type.
[ 30522, 3853, 2131, 2121, 29165, 7834, 3736, 3351, 1006, 27178, 18863, 1007, 1063, 2709, 20066, 1012, 21318, 1012, 2131, 17345, 1006, 1007, 1012, 2131, 29521, 19848, 16363, 6499, 3126, 3401, 27265, 2571, 1006, 1007, 1012, 2131, 18209, 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...
adobe/brackets
src/extensions/default/JavaScriptCodeHints/main.js
installEditorListeners
function installEditorListeners(editor, previousEditor) { // always clean up cached scope and hint info resetCachedHintContext(); if (!jsHintsEnabled) { return; } if (editor && HintUtils.isSupportedLanguage(LanguageManager.getLanguageForPath(editor.document.file.fullPath).getId())) { initializeSession(editor, previousEditor); editor .on(HintUtils.eventName("change"), function (event, editor, changeList) { if (!ignoreChange) { ScopeManager.handleFileChange(changeList); } ignoreChange = false; }); } else { session = null; } }
javascript
function installEditorListeners(editor, previousEditor) { // always clean up cached scope and hint info resetCachedHintContext(); if (!jsHintsEnabled) { return; } if (editor && HintUtils.isSupportedLanguage(LanguageManager.getLanguageForPath(editor.document.file.fullPath).getId())) { initializeSession(editor, previousEditor); editor .on(HintUtils.eventName("change"), function (event, editor, changeList) { if (!ignoreChange) { ScopeManager.handleFileChange(changeList); } ignoreChange = false; }); } else { session = null; } }
[ "function", "installEditorListeners", "(", "editor", ",", "previousEditor", ")", "{", "// always clean up cached scope and hint info", "resetCachedHintContext", "(", ")", ";", "if", "(", "!", "jsHintsEnabled", ")", "{", "return", ";", "}", "if", "(", "editor", "&&",...
/* Connects to the given editor, creating a new Session & adding listeners @param {?Editor} editor - editor context on which to listen for changes. If null, 'session' is cleared. @param {?Editor} previousEditor - the previous editor
[ "/", "*", "Connects", "to", "the", "given", "editor", "creating", "a", "new", "Session", "&", "adding", "listeners" ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/extensions/default/JavaScriptCodeHints/main.js#L659-L679
train
install editor listeners
[ 30522, 3853, 5361, 15660, 9863, 24454, 2015, 1006, 3559, 1010, 3025, 2098, 15660, 1007, 1063, 1013, 1013, 2467, 4550, 2039, 17053, 2094, 9531, 1998, 9374, 18558, 25141, 3540, 7690, 10606, 13535, 28040, 18413, 1006, 1007, 1025, 2065, 1006, 9...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/prefer-arrow-callback.js
getCallbackInfo
function getCallbackInfo(node) { const retv = { isCallback: false, isLexicalThis: false }; let currentNode = node; let parent = node.parent; while (currentNode) { switch (parent.type) { // Checks parents recursively. case "LogicalExpression": case "ConditionalExpression": break; // Checks whether the parent node is `.bind(this)` call. case "MemberExpression": if (parent.object === currentNode && !parent.property.computed && parent.property.type === "Identifier" && parent.property.name === "bind" && parent.parent.type === "CallExpression" && parent.parent.callee === parent ) { retv.isLexicalThis = ( parent.parent.arguments.length === 1 && parent.parent.arguments[0].type === "ThisExpression" ); parent = parent.parent; } else { return retv; } break; // Checks whether the node is a callback. case "CallExpression": case "NewExpression": if (parent.callee !== currentNode) { retv.isCallback = true; } return retv; default: return retv; } currentNode = parent; parent = parent.parent; } /* istanbul ignore next */ throw new Error("unreachable"); }
javascript
function getCallbackInfo(node) { const retv = { isCallback: false, isLexicalThis: false }; let currentNode = node; let parent = node.parent; while (currentNode) { switch (parent.type) { // Checks parents recursively. case "LogicalExpression": case "ConditionalExpression": break; // Checks whether the parent node is `.bind(this)` call. case "MemberExpression": if (parent.object === currentNode && !parent.property.computed && parent.property.type === "Identifier" && parent.property.name === "bind" && parent.parent.type === "CallExpression" && parent.parent.callee === parent ) { retv.isLexicalThis = ( parent.parent.arguments.length === 1 && parent.parent.arguments[0].type === "ThisExpression" ); parent = parent.parent; } else { return retv; } break; // Checks whether the node is a callback. case "CallExpression": case "NewExpression": if (parent.callee !== currentNode) { retv.isCallback = true; } return retv; default: return retv; } currentNode = parent; parent = parent.parent; } /* istanbul ignore next */ throw new Error("unreachable"); }
[ "function", "getCallbackInfo", "(", "node", ")", "{", "const", "retv", "=", "{", "isCallback", ":", "false", ",", "isLexicalThis", ":", "false", "}", ";", "let", "currentNode", "=", "node", ";", "let", "parent", "=", "node", ".", "parent", ";", "while", ...
Checkes whether or not a given node is a callback. @param {ASTNode} node - A node to check. @returns {Object} {boolean} retv.isCallback - `true` if the node is a callback. {boolean} retv.isLexicalThis - `true` if the node is with `.bind(this)`.
[ "Checkes", "whether", "or", "not", "a", "given", "node", "is", "a", "callback", "." ]
bc0819c94aad14f7fad3cbc2338ea15658b0f272
https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/prefer-arrow-callback.js#L65-L116
train
Returns the callback info for a node
[ 30522, 3853, 2131, 9289, 20850, 8684, 2378, 14876, 1006, 13045, 1007, 1063, 9530, 3367, 2128, 9189, 1027, 1063, 2003, 9289, 20850, 8684, 1024, 6270, 1010, 8842, 9048, 9289, 15222, 2015, 1024, 6270, 1065, 1025, 2292, 2783, 3630, 3207, 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...
adobe/brackets
src/view/WorkspaceManager.js
updateResizeLimits
function updateResizeLimits() { var editorAreaHeight = $editorHolder.height(); $editorHolder.siblings().each(function (i, elem) { var $elem = $(elem); if ($elem.css("display") === "none") { $elem.data("maxsize", editorAreaHeight); } else { $elem.data("maxsize", editorAreaHeight + $elem.outerHeight()); } }); }
javascript
function updateResizeLimits() { var editorAreaHeight = $editorHolder.height(); $editorHolder.siblings().each(function (i, elem) { var $elem = $(elem); if ($elem.css("display") === "none") { $elem.data("maxsize", editorAreaHeight); } else { $elem.data("maxsize", editorAreaHeight + $elem.outerHeight()); } }); }
[ "function", "updateResizeLimits", "(", ")", "{", "var", "editorAreaHeight", "=", "$editorHolder", ".", "height", "(", ")", ";", "$editorHolder", ".", "siblings", "(", ")", ".", "each", "(", "function", "(", "i", ",", "elem", ")", "{", "var", "$elem", "="...
Updates panel resize limits to disallow making panels big enough to shrink editor area below 0
[ "Updates", "panel", "resize", "limits", "to", "disallow", "making", "panels", "big", "enough", "to", "shrink", "editor", "area", "below", "0" ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/view/WorkspaceManager.js#L91-L102
train
update resize limits
[ 30522, 3853, 10651, 6072, 4697, 17960, 12762, 1006, 1007, 1063, 13075, 3559, 12069, 4430, 7416, 13900, 1027, 1002, 3559, 14528, 1012, 4578, 1006, 1007, 1025, 1002, 3559, 14528, 1012, 9504, 1006, 1007, 1012, 2169, 1006, 3853, 1006, 1045, 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...