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
aframevr/aframe
examples/showcase/link-traversal/js/components/aframe-tooltip-component.js
setPos
function setPos(id, x, y) { pos[3 * id] = x; pos[3 * id + 1] = y; }
javascript
function setPos(id, x, y) { pos[3 * id] = x; pos[3 * id + 1] = y; }
[ "function", "setPos", "(", "id", ",", "x", ",", "y", ")", "{", "pos", "[", "3", "*", "id", "]", "=", "x", ";", "pos", "[", "3", "*", "id", "+", "1", "]", "=", "y", ";", "}" ]
/* 0--1------------------------------2--3 | | | | 4--5------------------------------6--7 | | | | | | | | | | | | 8--9-----------------------------10--11 | | | | 12-13----------------------------14--15
[ "/", "*", "0", "--", "1", "------------------------------", "2", "--", "3", "|", "|", "|", "|", "4", "--", "5", "------------------------------", "6", "--", "7", "|", "|", "|", "|", "|", "|", "|", "|", "|", "|", "|", "|", "8", "--", "9", "-------...
24acc78a7299a4cdfe3ef617f4d40ddf6275c992
https://github.com/aframevr/aframe/blob/24acc78a7299a4cdfe3ef617f4d40ddf6275c992/examples/showcase/link-traversal/js/components/aframe-tooltip-component.js#L242-L245
train
set the position of the entry at the given index
[ 30522, 3853, 2275, 6873, 2015, 1006, 8909, 1010, 1060, 1010, 1061, 1007, 1063, 13433, 2015, 1031, 1017, 1008, 8909, 1033, 1027, 1060, 1025, 13433, 2015, 1031, 1017, 1008, 8909, 1009, 1015, 1033, 1027, 1061, 1025, 1065, 102, 0, 0, 0, 0, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
ColorlibHQ/AdminLTE
bower_components/ion.rangeSlider/js/ion.rangeSlider.js
function (value, no_min) { var diapason = this.options.max - this.options.min, one_percent = diapason / 100, val, percent; if (!diapason) { this.no_diapason = true; return 0; } if (no_min) { val = value; } else { val = value - this.options.min; } percent = val / one_percent; return this.toFixed(percent); }
javascript
function (value, no_min) { var diapason = this.options.max - this.options.min, one_percent = diapason / 100, val, percent; if (!diapason) { this.no_diapason = true; return 0; } if (no_min) { val = value; } else { val = value - this.options.min; } percent = val / one_percent; return this.toFixed(percent); }
[ "function", "(", "value", ",", "no_min", ")", "{", "var", "diapason", "=", "this", ".", "options", ".", "max", "-", "this", ".", "options", ".", "min", ",", "one_percent", "=", "diapason", "/", "100", ",", "val", ",", "percent", ";", "if", "(", "!"...
Convert real value to percent @param value {Number} X in real @param no_min {boolean=} don't use min value @returns {Number} X in percent
[ "Convert", "real", "value", "to", "percent" ]
19113c3cbc19a7afe0cfd3158d647064d2d30661
https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/bower_components/ion.rangeSlider/js/ion.rangeSlider.js#L1743-L1762
train
cargar diapason
[ 30522, 3853, 1006, 3643, 1010, 2053, 1035, 8117, 1007, 1063, 13075, 22939, 19707, 2239, 1027, 2023, 1012, 7047, 1012, 4098, 1011, 2023, 1012, 7047, 1012, 8117, 1010, 2028, 1035, 3867, 1027, 22939, 19707, 2239, 1013, 2531, 1010, 11748, 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...
graphql/graphql-js
src/type/scalars.js
serializeObject
function serializeObject(value: mixed): mixed { if (typeof value === 'object' && value !== null) { if (typeof value.valueOf === 'function') { const valueOfResult = value.valueOf(); if (typeof valueOfResult !== 'object') { return valueOfResult; } } if (typeof value.toJSON === 'function') { // $FlowFixMe(>=0.90.0) return value.toJSON(); } } return value; }
javascript
function serializeObject(value: mixed): mixed { if (typeof value === 'object' && value !== null) { if (typeof value.valueOf === 'function') { const valueOfResult = value.valueOf(); if (typeof valueOfResult !== 'object') { return valueOfResult; } } if (typeof value.toJSON === 'function') { // $FlowFixMe(>=0.90.0) return value.toJSON(); } } return value; }
[ "function", "serializeObject", "(", "value", ":", "mixed", ")", ":", "mixed", "{", "if", "(", "typeof", "value", "===", "'object'", "&&", "value", "!==", "null", ")", "{", "if", "(", "typeof", "value", ".", "valueOf", "===", "'function'", ")", "{", "co...
Support serializing objects with custom valueOf() or toJSON() functions - a common way to represent a complex value which can be represented as a string (ex: MongoDB id objects).
[ "Support", "serializing", "objects", "with", "custom", "valueOf", "()", "or", "toJSON", "()", "functions", "-", "a", "common", "way", "to", "represent", "a", "complex", "value", "which", "can", "be", "represented", "as", "a", "string", "(", "ex", ":", "Mon...
b65ff6db8893c1c68f0f236c4b2d663e6c55f5ef
https://github.com/graphql/graphql-js/blob/b65ff6db8893c1c68f0f236c4b2d663e6c55f5ef/src/type/scalars.js#L123-L137
train
Serialize an object
[ 30522, 3853, 7642, 4697, 16429, 20614, 1006, 3643, 1024, 3816, 1007, 1024, 3816, 1063, 2065, 1006, 2828, 11253, 3643, 1027, 1027, 1027, 1005, 4874, 1005, 1004, 1004, 3643, 999, 1027, 1027, 19701, 1007, 1063, 2065, 1006, 2828, 11253, 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...
lovell/sharp
lib/output.js
withMetadata
function withMetadata (withMetadata) { this.options.withMetadata = is.bool(withMetadata) ? withMetadata : true; if (is.object(withMetadata)) { if (is.defined(withMetadata.orientation)) { if (is.integer(withMetadata.orientation) && is.inRange(withMetadata.orientation, 1, 8)) { this.options.withMetadataOrientation = withMetadata.orientation; } else { throw new Error('Invalid orientation (1 to 8) ' + withMetadata.orientation); } } } return this; }
javascript
function withMetadata (withMetadata) { this.options.withMetadata = is.bool(withMetadata) ? withMetadata : true; if (is.object(withMetadata)) { if (is.defined(withMetadata.orientation)) { if (is.integer(withMetadata.orientation) && is.inRange(withMetadata.orientation, 1, 8)) { this.options.withMetadataOrientation = withMetadata.orientation; } else { throw new Error('Invalid orientation (1 to 8) ' + withMetadata.orientation); } } } return this; }
[ "function", "withMetadata", "(", "withMetadata", ")", "{", "this", ".", "options", ".", "withMetadata", "=", "is", ".", "bool", "(", "withMetadata", ")", "?", "withMetadata", ":", "true", ";", "if", "(", "is", ".", "object", "(", "withMetadata", ")", ")"...
Include all metadata (EXIF, XMP, IPTC) from the input image in the output image. The default behaviour, when `withMetadata` is not used, is to strip all metadata and convert to the device-independent sRGB colour space. This will also convert to and add a web-friendly sRGB ICC profile. @example sharp('input.jpg') .withMetadata() .toFile('output-with-metadata.jpg') .then(info => { ... }); @param {Object} [withMetadata] @param {Number} [withMetadata.orientation] value between 1 and 8, used to update the EXIF `Orientation` tag. @returns {Sharp} @throws {Error} Invalid parameters
[ "Include", "all", "metadata", "(", "EXIF", "XMP", "IPTC", ")", "from", "the", "input", "image", "in", "the", "output", "image", ".", "The", "default", "behaviour", "when", "withMetadata", "is", "not", "used", "is", "to", "strip", "all", "metadata", "and", ...
05d76eeadfe54713606a615185b2da047923406b
https://github.com/lovell/sharp/blob/05d76eeadfe54713606a615185b2da047923406b/lib/output.js#L117-L129
train
Sets the metadata for the resource
[ 30522, 3853, 2007, 11368, 8447, 2696, 1006, 2007, 11368, 8447, 2696, 1007, 1063, 2023, 1012, 7047, 1012, 2007, 11368, 8447, 2696, 1027, 2003, 1012, 22017, 2140, 1006, 2007, 11368, 8447, 2696, 1007, 1029, 2007, 11368, 8447, 2696, 1024, 2995,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/RecentProjects/main.js
cleanupDropdown
function cleanupDropdown() { $("html").off("click", closeDropdown); $("#project-files-container").off("scroll", closeDropdown); $("#titlebar .nav").off("click", closeDropdown); $dropdown = null; MainViewManager.focusActivePane(); $(window).off("keydown", keydownHook); }
javascript
function cleanupDropdown() { $("html").off("click", closeDropdown); $("#project-files-container").off("scroll", closeDropdown); $("#titlebar .nav").off("click", closeDropdown); $dropdown = null; MainViewManager.focusActivePane(); $(window).off("keydown", keydownHook); }
[ "function", "cleanupDropdown", "(", ")", "{", "$", "(", "\"html\"", ")", ".", "off", "(", "\"click\"", ",", "closeDropdown", ")", ";", "$", "(", "\"#project-files-container\"", ")", ".", "off", "(", "\"scroll\"", ",", "closeDropdown", ")", ";", "$", "(", ...
Remove the various event handlers that close the dropdown. This is called by the PopUpManager when the dropdown is closed.
[ "Remove", "the", "various", "event", "handlers", "that", "close", "the", "dropdown", ".", "This", "is", "called", "by", "the", "PopUpManager", "when", "the", "dropdown", "is", "closed", "." ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/extensions/default/RecentProjects/main.js#L262-L271
train
Removes the dropdown events
[ 30522, 3853, 27686, 25711, 7698, 1006, 1007, 1063, 1002, 1006, 1000, 16129, 1000, 1007, 1012, 2125, 1006, 1000, 11562, 1000, 1010, 2701, 18981, 7698, 1007, 1025, 1002, 1006, 1000, 1001, 2622, 1011, 6764, 1011, 11661, 1000, 1007, 1012, 2125,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SeleniumHQ/selenium
third_party/js/mozmill/shared-modules/addons.js
addonsManager_getAddonLink
function addonsManager_getAddonLink(aSpec) { var spec = aSpec || { }; var addon = spec.addon; var link = spec.link; if (!link) throw new Error(arguments.callee.name + ": Link not specified."); return this.getAddonChildElement({addon: addon, type: link + "Link"}); }
javascript
function addonsManager_getAddonLink(aSpec) { var spec = aSpec || { }; var addon = spec.addon; var link = spec.link; if (!link) throw new Error(arguments.callee.name + ": Link not specified."); return this.getAddonChildElement({addon: addon, type: link + "Link"}); }
[ "function", "addonsManager_getAddonLink", "(", "aSpec", ")", "{", "var", "spec", "=", "aSpec", "||", "{", "}", ";", "var", "addon", "=", "spec", ".", "addon", ";", "var", "link", "=", "spec", ".", "link", ";", "if", "(", "!", "link", ")", "throw", ...
Returns the element of the specified add-ons link @param {object} aSpec Information on which add-on to operate on Elements: addon - Add-on element link - Link List view (more, restart, undo) Detail view (findUpdates, restart, undo) @return Add-on link @type {ElemBase}
[ "Returns", "the", "element", "of", "the", "specified", "add", "-", "ons", "link" ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/js/mozmill/shared-modules/addons.js#L484-L493
train
Get the link element of an addon
[ 30522, 3853, 5587, 5644, 24805, 4590, 1035, 2131, 4215, 5280, 13767, 1006, 2004, 5051, 2278, 1007, 1063, 13075, 28699, 1027, 2004, 5051, 2278, 1064, 1064, 1063, 1065, 1025, 13075, 5587, 2239, 1027, 28699, 1012, 5587, 2239, 1025, 30524, 7561...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/languageTools/LanguageClient/NodeToBracketsInterface.js
NodeToBracketsInterface
function NodeToBracketsInterface(domainManager, domainName) { this.domainManager = domainManager; this.domainName = domainName; this.nodeFn = {}; this._registerDataEvents(domainManager, domainName); }
javascript
function NodeToBracketsInterface(domainManager, domainName) { this.domainManager = domainManager; this.domainName = domainName; this.nodeFn = {}; this._registerDataEvents(domainManager, domainName); }
[ "function", "NodeToBracketsInterface", "(", "domainManager", ",", "domainName", ")", "{", "this", ".", "domainManager", "=", "domainManager", ";", "this", ".", "domainName", "=", "domainName", ";", "this", ".", "nodeFn", "=", "{", "}", ";", "this", ".", "_re...
/*eslint-enable
[ "/", "*", "eslint", "-", "enable" ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/languageTools/LanguageClient/NodeToBracketsInterface.js#L49-L55
train
NodeToBracketsInterface constructor.
[ 30522, 3853, 13045, 3406, 10024, 19869, 3215, 18447, 2121, 12172, 1006, 5884, 24805, 4590, 1010, 5884, 18442, 1007, 1063, 2023, 1012, 5884, 24805, 4590, 1027, 5884, 24805, 4590, 1025, 2023, 1012, 5884, 18442, 1027, 5884, 18442, 1025, 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...
jgraph/mxgraph
javascript/examples/grapheditor/www/js/Graph.js
short
function short(str, max) { if (str.length > max) { str = str.substring(0, Math.round(max / 2)) + '...' + str.substring(str.length - Math.round(max / 4)); } return str; }
javascript
function short(str, max) { if (str.length > max) { str = str.substring(0, Math.round(max / 2)) + '...' + str.substring(str.length - Math.round(max / 4)); } return str; }
[ "function", "short", "(", "str", ",", "max", ")", "{", "if", "(", "str", ".", "length", ">", "max", ")", "{", "str", "=", "str", ".", "substring", "(", "0", ",", "Math", ".", "round", "(", "max", "/", "2", ")", ")", "+", "'...'", "+", "str", ...
Helper function to shorten strings
[ "Helper", "function", "to", "shorten", "strings" ]
33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44
https://github.com/jgraph/mxgraph/blob/33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44/javascript/examples/grapheditor/www/js/Graph.js#L6835-L6844
train
shorten a string
[ 30522, 3853, 2460, 1006, 2358, 2099, 1010, 4098, 1007, 1063, 2065, 1006, 2358, 2099, 1012, 3091, 1028, 4098, 1007, 1063, 2358, 2099, 1027, 2358, 2099, 1012, 4942, 3367, 4892, 1006, 1014, 1010, 8785, 1012, 2461, 1006, 4098, 1013, 1016, 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...
adobe/brackets
src/LiveDevelopment/LiveDevMultiBrowser.js
_styleSheetAdded
function _styleSheetAdded(event, url, roots) { var path = _server && _server.urlToPath(url), alreadyAdded = !!_relatedDocuments[url]; // path may be null if loading an external stylesheet. // Also, the stylesheet may already exist and be reported as added twice // due to Chrome reporting added/removed events after incremental changes // are pushed to the browser if (!path || alreadyAdded) { return; } var docPromise = DocumentManager.getDocumentForPath(path); docPromise.done(function (doc) { if ((_classForDocument(doc) === LiveCSSDocument) && (!_liveDocument || (doc !== _liveDocument.doc))) { var liveDoc = _createLiveDocument(doc, doc._masterEditor, roots); if (liveDoc) { _server.add(liveDoc); _relatedDocuments[doc.url] = liveDoc; liveDoc.on("updateDoc", function (event, url) { var path = _server.urlToPath(url), doc = getLiveDocForPath(path); doc._updateBrowser(); }); } } }); }
javascript
function _styleSheetAdded(event, url, roots) { var path = _server && _server.urlToPath(url), alreadyAdded = !!_relatedDocuments[url]; // path may be null if loading an external stylesheet. // Also, the stylesheet may already exist and be reported as added twice // due to Chrome reporting added/removed events after incremental changes // are pushed to the browser if (!path || alreadyAdded) { return; } var docPromise = DocumentManager.getDocumentForPath(path); docPromise.done(function (doc) { if ((_classForDocument(doc) === LiveCSSDocument) && (!_liveDocument || (doc !== _liveDocument.doc))) { var liveDoc = _createLiveDocument(doc, doc._masterEditor, roots); if (liveDoc) { _server.add(liveDoc); _relatedDocuments[doc.url] = liveDoc; liveDoc.on("updateDoc", function (event, url) { var path = _server.urlToPath(url), doc = getLiveDocForPath(path); doc._updateBrowser(); }); } } }); }
[ "function", "_styleSheetAdded", "(", "event", ",", "url", ",", "roots", ")", "{", "var", "path", "=", "_server", "&&", "_server", ".", "urlToPath", "(", "url", ")", ",", "alreadyAdded", "=", "!", "!", "_relatedDocuments", "[", "url", "]", ";", "// path m...
Handles a notification from the browser that a stylesheet was loaded into the live HTML document. If the stylesheet maps to a file in the project, then creates a live document for the stylesheet and adds it to _relatedDocuments. @param {$.Event} event @param {string} url The URL of the stylesheet that was added. @param {array} roots The URLs of the roots of the stylesheet (the css files loaded through <link>)
[ "Handles", "a", "notification", "from", "the", "browser", "that", "a", "stylesheet", "was", "loaded", "into", "the", "live", "HTML", "document", ".", "If", "the", "stylesheet", "maps", "to", "a", "file", "in", "the", "project", "then", "creates", "a", "liv...
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/LiveDevelopment/LiveDevMultiBrowser.js#L293-L322
train
This function is called when a stylesheet is added to the page
[ 30522, 3853, 1035, 6782, 21030, 17713, 5732, 1006, 2724, 1010, 24471, 2140, 1010, 6147, 1007, 1063, 13075, 4130, 1027, 1035, 8241, 1004, 1004, 1035, 8241, 1012, 24471, 23223, 15069, 1006, 24471, 2140, 1007, 1010, 2525, 4215, 5732, 1027, 999...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/routing/sync/Target.js
function (vData) { var oParentInfo; if (this._oParent) { oParentInfo = this._oParent.display(vData); } return this._place(oParentInfo, vData); }
javascript
function (vData) { var oParentInfo; if (this._oParent) { oParentInfo = this._oParent.display(vData); } return this._place(oParentInfo, vData); }
[ "function", "(", "vData", ")", "{", "var", "oParentInfo", ";", "if", "(", "this", ".", "_oParent", ")", "{", "oParentInfo", "=", "this", ".", "_oParent", ".", "display", "(", "vData", ")", ";", "}", "return", "this", ".", "_place", "(", "oParentInfo", ...
Creates a view and puts it in an aggregation of a control that has been defined in the {@link #constructor}. @param {*} [vData] an object that will be passed to the display event in the data property. If the target has parents, the data will also be passed to them. @private
[ "Creates", "a", "view", "and", "puts", "it", "in", "an", "aggregation", "of", "a", "control", "that", "has", "been", "defined", "in", "the", "{", "@link", "#constructor", "}", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/routing/sync/Target.js#L21-L29
train
Display the data in the parent
[ 30522, 3853, 1006, 1058, 2850, 2696, 1007, 1063, 13075, 6728, 12069, 16778, 2078, 14876, 1025, 2065, 1006, 2023, 1012, 1035, 6728, 12069, 3372, 1007, 1063, 6728, 12069, 16778, 2078, 14876, 1027, 2023, 1012, 1035, 6728, 12069, 3372, 1012, 46...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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...
ReactTraining/react-router
website/modules/examples/Auth.js
AuthExample
function AuthExample() { return ( <Router> <div> <AuthButton /> <ul> <li> <Link to="/public">Public Page</Link> </li> <li> <Link to="/protected">Protected Page</Link> </li> </ul> <Route path="/public" component={Public} /> <Route path="/login" component={Login} /> <PrivateRoute path="/protected" component={Protected} /> </div> </Router> ); }
javascript
function AuthExample() { return ( <Router> <div> <AuthButton /> <ul> <li> <Link to="/public">Public Page</Link> </li> <li> <Link to="/protected">Protected Page</Link> </li> </ul> <Route path="/public" component={Public} /> <Route path="/login" component={Login} /> <PrivateRoute path="/protected" component={Protected} /> </div> </Router> ); }
[ "function", "AuthExample", "(", ")", "{", "return", "(", "<", "Router", ">", "\n ", "<", "div", ">", "\n ", "<", "AuthButton", "/", ">", "\n ", "<", "ul", ">", "\n ", "<", "li", ">", "\n ", "<", "Link", "to", "=", ...
////////////////////////////////////////////////////////// 1. Click the public page 2. Click the protected page 3. Log in 4. Click the back button, note the URL each time
[ "//////////////////////////////////////////////////////////", "1", ".", "Click", "the", "public", "page", "2", ".", "Click", "the", "protected", "page", "3", ".", "Log", "in", "4", ".", "Click", "the", "back", "button", "note", "the", "URL", "each", "time" ]
82ce94c3b4e74f71018d104df6dc999801fa9ab2
https://github.com/ReactTraining/react-router/blob/82ce94c3b4e74f71018d104df6dc999801fa9ab2/website/modules/examples/Auth.js#L16-L35
train
AuthExample - The main example of the application
[ 30522, 3853, 8740, 10760, 18684, 23344, 1006, 1007, 1063, 2709, 1006, 1026, 2799, 2099, 1028, 1026, 4487, 2615, 1028, 1026, 8740, 2705, 8569, 15474, 1013, 1028, 1026, 17359, 1028, 1026, 5622, 1028, 1026, 4957, 2000, 1027, 1000, 1013, 2270, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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...
airyland/vux
src/components/video/zy.media.js
timeFormat
function timeFormat(time, options) { // Video's duration is Infinity in GiONEE(金立) device if (!isFinite(time) || time < 0) { time = 0; } // Get hours var _time = options.alwaysShowHours ? [0] : []; if (Math.floor(time / 3600) % 24) { _time.push(Math.floor(time / 3600) % 24) } // Get minutes _time.push(Math.floor(time / 60) % 60); // Get seconds _time.push(Math.floor(time % 60)); _time = _time.join(':'); // Fill '0' if (options.timeFormatType == 1) { _time = _time.replace(/(:|^)([0-9])(?=:|$)/g, '$10$2') } return _time }
javascript
function timeFormat(time, options) { // Video's duration is Infinity in GiONEE(金立) device if (!isFinite(time) || time < 0) { time = 0; } // Get hours var _time = options.alwaysShowHours ? [0] : []; if (Math.floor(time / 3600) % 24) { _time.push(Math.floor(time / 3600) % 24) } // Get minutes _time.push(Math.floor(time / 60) % 60); // Get seconds _time.push(Math.floor(time % 60)); _time = _time.join(':'); // Fill '0' if (options.timeFormatType == 1) { _time = _time.replace(/(:|^)([0-9])(?=:|$)/g, '$10$2') } return _time }
[ "function", "timeFormat", "(", "time", ",", "options", ")", "{", "// Video's duration is Infinity in GiONEE(金立) device", "if", "(", "!", "isFinite", "(", "time", ")", "||", "time", "<", "0", ")", "{", "time", "=", "0", ";", "}", "// Get hours", "var", "_time...
Get time format
[ "Get", "time", "format" ]
484fc3c18bdca99b0c08efbb678c0ee0f5ceedd6
https://github.com/airyland/vux/blob/484fc3c18bdca99b0c08efbb678c0ee0f5ceedd6/src/components/video/zy.media.js#L138-L159
train
Format time in seconds
[ 30522, 3853, 2051, 14192, 4017, 1006, 2051, 1010, 7047, 1007, 1063, 1013, 1013, 2678, 1005, 1055, 9367, 2003, 15579, 1999, 21025, 5643, 2063, 1006, 1964, 1931, 1007, 5080, 2065, 1006, 999, 2003, 16294, 4221, 1006, 2051, 1007, 1064, 1064, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.table/src/sap/ui/table/TableMenuUtils.js
function(oTable, oElement, bHoverFirstMenuItem, bFireEvent, oEvent) { if (!oTable || !oElement) { return; } bFireEvent = bFireEvent !== false; var $TableCell = MenuUtils.TableUtils.getCell(oTable, oElement); var oCellInfo = MenuUtils.TableUtils.getCellInfo($TableCell); var iColumnIndex = oCellInfo.columnIndex; var iRowIndex = oCellInfo.rowIndex; var bExecuteDefault; if (oCellInfo.isOfType(MenuUtils.TableUtils.CELLTYPE.COLUMNHEADER)) { var bCellHasMenuButton = $TableCell.find(".sapUiTableColDropDown").length > 0; if (Device.system.desktop || bCellHasMenuButton) { MenuUtils.removeColumnHeaderCellMenu(oTable, iColumnIndex); bExecuteDefault = true; if (bFireEvent) { bExecuteDefault = oTable.fireColumnSelect({ column: oTable.getColumns()[iColumnIndex] }); } if (bExecuteDefault) { MenuUtils.openColumnContextMenu(oTable, iColumnIndex, bHoverFirstMenuItem, $TableCell); } } else { MenuUtils.applyColumnHeaderCellMenu(oTable, iColumnIndex, $TableCell); } } else if (oCellInfo.isOfType(MenuUtils.TableUtils.CELLTYPE.ANYCONTENTCELL)) { bExecuteDefault = true; if (bFireEvent) { var oRowColCell = MenuUtils.TableUtils.getRowColCell(oTable, iRowIndex, iColumnIndex, iColumnIndex >= 0); var oRow = oRowColCell.row; var oRowBindingContext; var oRowBindingInfo = oTable.getBindingInfo("rows"); if (oRowBindingInfo) { oRowBindingContext = oRow.getBindingContext(oRowBindingInfo.model); } var oRowContextMenu = oTable.getContextMenu(); if (oRowContextMenu) { oRowContextMenu.setBindingContext(oRowBindingContext); } if (iColumnIndex >= 0) { bExecuteDefault = oTable.fireCellContextmenu({ rowIndex: oRow.getIndex(), columnIndex: iColumnIndex, columnId: oRowColCell.column.getId(), cellControl: oRowColCell.cell, rowBindingContext: oRowBindingContext, cellDomRef: $TableCell[0] }); } // fire beforeOpenContextMenu event if the default is not prevented in the cellContextMenu event if (bExecuteDefault) { bExecuteDefault = oTable.fireBeforeOpenContextMenu({ rowIndex: oRow.getIndex(), columnIndex: oRowColCell.column ? iColumnIndex : null, contextMenu: oRowContextMenu }); } } if (bExecuteDefault) { MenuUtils.openDataCellContextMenu(oTable, oCellInfo, bHoverFirstMenuItem, oEvent); } } }
javascript
function(oTable, oElement, bHoverFirstMenuItem, bFireEvent, oEvent) { if (!oTable || !oElement) { return; } bFireEvent = bFireEvent !== false; var $TableCell = MenuUtils.TableUtils.getCell(oTable, oElement); var oCellInfo = MenuUtils.TableUtils.getCellInfo($TableCell); var iColumnIndex = oCellInfo.columnIndex; var iRowIndex = oCellInfo.rowIndex; var bExecuteDefault; if (oCellInfo.isOfType(MenuUtils.TableUtils.CELLTYPE.COLUMNHEADER)) { var bCellHasMenuButton = $TableCell.find(".sapUiTableColDropDown").length > 0; if (Device.system.desktop || bCellHasMenuButton) { MenuUtils.removeColumnHeaderCellMenu(oTable, iColumnIndex); bExecuteDefault = true; if (bFireEvent) { bExecuteDefault = oTable.fireColumnSelect({ column: oTable.getColumns()[iColumnIndex] }); } if (bExecuteDefault) { MenuUtils.openColumnContextMenu(oTable, iColumnIndex, bHoverFirstMenuItem, $TableCell); } } else { MenuUtils.applyColumnHeaderCellMenu(oTable, iColumnIndex, $TableCell); } } else if (oCellInfo.isOfType(MenuUtils.TableUtils.CELLTYPE.ANYCONTENTCELL)) { bExecuteDefault = true; if (bFireEvent) { var oRowColCell = MenuUtils.TableUtils.getRowColCell(oTable, iRowIndex, iColumnIndex, iColumnIndex >= 0); var oRow = oRowColCell.row; var oRowBindingContext; var oRowBindingInfo = oTable.getBindingInfo("rows"); if (oRowBindingInfo) { oRowBindingContext = oRow.getBindingContext(oRowBindingInfo.model); } var oRowContextMenu = oTable.getContextMenu(); if (oRowContextMenu) { oRowContextMenu.setBindingContext(oRowBindingContext); } if (iColumnIndex >= 0) { bExecuteDefault = oTable.fireCellContextmenu({ rowIndex: oRow.getIndex(), columnIndex: iColumnIndex, columnId: oRowColCell.column.getId(), cellControl: oRowColCell.cell, rowBindingContext: oRowBindingContext, cellDomRef: $TableCell[0] }); } // fire beforeOpenContextMenu event if the default is not prevented in the cellContextMenu event if (bExecuteDefault) { bExecuteDefault = oTable.fireBeforeOpenContextMenu({ rowIndex: oRow.getIndex(), columnIndex: oRowColCell.column ? iColumnIndex : null, contextMenu: oRowContextMenu }); } } if (bExecuteDefault) { MenuUtils.openDataCellContextMenu(oTable, oCellInfo, bHoverFirstMenuItem, oEvent); } } }
[ "function", "(", "oTable", ",", "oElement", ",", "bHoverFirstMenuItem", ",", "bFireEvent", ",", "oEvent", ")", "{", "if", "(", "!", "oTable", "||", "!", "oElement", ")", "{", "return", ";", "}", "bFireEvent", "=", "bFireEvent", "!==", "false", ";", "var"...
Avoid cyclic dependency. Will be filled by TableUtils Opens the context menu of a column or a data cell. If a column header cell or an element inside a column header cell is passed as the parameter <code>oElement</code>, the context menu of this column will be opened. If a data cell or an element inside a data cell is passed, then the context menu of this data cell will be opened. The context menu will not be opened, if the configuration of the table does not allow it, or one of the event handlers attached to the events <code>ColumnSelect</code> or <code>CellContextmenu</code> calls preventDefault(). On mobile devices, when trying to open a column context menu, a column header cell menu is created instead with buttons to actually open the column context menu or to resize the column. If this function is called when this cell menu already exists, then it is closed and the column context menu is opened. @param {sap.ui.table.Table} oTable Instance of the table. @param {jQuery | HTMLElement} oElement The header or data cell, or an element inside, for which to open the context menu. @param {boolean} [bHoverFirstMenuItem] If <code>true</code>, the first item in the opened menu will be hovered. @param {boolean} [bFireEvent=true] If <code>true</code>, an event will be fired. Fires the <code>ColumnSelect</code> event when a column context menu should be opened. Fires the <code>CellContextmenu</code> event when a data cell context menu should be opened. @param {jQuery.Event} oEvent Event object. @see openColumnContextMenu @see closeColumnContextMenu @see openDataCellContextMenu @see closeDataCellContextMenu @see applyColumnHeaderCellMenu @see removeColumnHeaderCellMenu
[ "Avoid", "cyclic", "dependency", ".", "Will", "be", "filled", "by", "TableUtils", "Opens", "the", "context", "menu", "of", "a", "column", "or", "a", "data", "cell", ".", "If", "a", "column", "header", "cell", "or", "an", "element", "inside", "a", "column...
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TableMenuUtils.js#L59-L135
train
Handles the column header menu.
[ 30522, 3853, 1006, 27178, 3085, 1010, 1051, 12260, 3672, 1010, 1038, 6806, 6299, 8873, 12096, 3549, 14663, 6633, 1010, 28939, 7442, 18697, 3372, 1010, 1051, 18697, 3372, 1007, 1063, 2065, 1006, 999, 27178, 3085, 1064, 1064, 999, 1051, 12260...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
eslint/eslint
lib/rules/callback-return.js
containsOnlyIdentifiers
function containsOnlyIdentifiers(node) { if (node.type === "Identifier") { return true; } if (node.type === "MemberExpression") { if (node.object.type === "Identifier") { return true; } if (node.object.type === "MemberExpression") { return containsOnlyIdentifiers(node.object); } } return false; }
javascript
function containsOnlyIdentifiers(node) { if (node.type === "Identifier") { return true; } if (node.type === "MemberExpression") { if (node.object.type === "Identifier") { return true; } if (node.object.type === "MemberExpression") { return containsOnlyIdentifiers(node.object); } } return false; }
[ "function", "containsOnlyIdentifiers", "(", "node", ")", "{", "if", "(", "node", ".", "type", "===", "\"Identifier\"", ")", "{", "return", "true", ";", "}", "if", "(", "node", ".", "type", "===", "\"MemberExpression\"", ")", "{", "if", "(", "node", ".", ...
Check to see if a node contains only identifers @param {ASTNode} node The node to check @returns {boolean} Whether or not the node contains only identifers
[ "Check", "to", "see", "if", "a", "node", "contains", "only", "identifers" ]
bc0819c94aad14f7fad3cbc2338ea15658b0f272
https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/callback-return.js#L62-L77
train
returns true if node contains only identifiers
[ 30522, 3853, 3397, 2239, 2135, 5178, 16778, 30524, 10288, 20110, 3258, 1000, 1007, 1063, 2065, 1006, 13045, 1012, 4874, 1012, 2828, 1027, 1027, 1027, 1000, 8909, 4765, 18095, 1000, 1007, 1063, 2709, 2995, 1025, 1065, 2065, 1006, 13045, 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...
dequelabs/axe-core
lib/commons/dom/is-in-text-block.js
walkDomNode
function walkDomNode(node, functor) { if (functor(node.actualNode) !== false) { node.children.forEach(child => walkDomNode(child, functor)); } }
javascript
function walkDomNode(node, functor) { if (functor(node.actualNode) !== false) { node.children.forEach(child => walkDomNode(child, functor)); } }
[ "function", "walkDomNode", "(", "node", ",", "functor", ")", "{", "if", "(", "functor", "(", "node", ".", "actualNode", ")", "!==", "false", ")", "{", "node", ".", "children", ".", "forEach", "(", "child", "=>", "walkDomNode", "(", "child", ",", "funct...
/* global axe, dom, window
[ "/", "*", "global", "axe", "dom", "window" ]
727323c07980e2291575f545444d389fb942906f
https://github.com/dequelabs/axe-core/blob/727323c07980e2291575f545444d389fb942906f/lib/commons/dom/is-in-text-block.js#L2-L6
train
Walks the DOM tree and calls the function for each node
[ 30522, 3853, 3328, 9527, 3630, 3207, 1006, 13045, 1010, 4569, 16761, 1007, 1063, 2065, 1006, 4569, 16761, 1006, 13045, 1012, 5025, 3630, 3207, 1007, 999, 1027, 1027, 6270, 1007, 1063, 13045, 1012, 2336, 1012, 18921, 6776, 1006, 2775, 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...
caolan/async
lib/forever.js
forever
function forever(fn, errback) { var done = onlyOnce(errback); var task = wrapAsync(ensureAsync(fn)); function next(err) { if (err) return done(err); if (err === false) return; task(next); } return next(); }
javascript
function forever(fn, errback) { var done = onlyOnce(errback); var task = wrapAsync(ensureAsync(fn)); function next(err) { if (err) return done(err); if (err === false) return; task(next); } return next(); }
[ "function", "forever", "(", "fn", ",", "errback", ")", "{", "var", "done", "=", "onlyOnce", "(", "errback", ")", ";", "var", "task", "=", "wrapAsync", "(", "ensureAsync", "(", "fn", ")", ")", ";", "function", "next", "(", "err", ")", "{", "if", "("...
Calls the asynchronous function `fn` with a callback parameter that allows it to call itself again, in series, indefinitely. If an error is passed to the callback then `errback` is called with the error, and execution stops, otherwise it will never be called. @name forever @static @memberOf module:ControlFlow @method @category Control Flow @param {AsyncFunction} fn - an async function to call repeatedly. Invoked with (next). @param {Function} [errback] - when `fn` passes an error to it's callback, this function will be called, and execution stops. Invoked with (err). @returns {Promise} a promise that rejects if an error occurs and an errback is not passed @example async.forever( function(next) { // next is suitable for passing to things that need a callback(err [, whatever]); // it will result in this function being called again. }, function(err) { // if next is called with a value in its first parameter, it will appear // in here as 'err', and execution will stop. } );
[ "Calls", "the", "asynchronous", "function", "fn", "with", "a", "callback", "parameter", "that", "allows", "it", "to", "call", "itself", "again", "in", "series", "indefinitely", "." ]
4330d536c106592139fa82062494c9dba0da1fdb
https://github.com/caolan/async/blob/4330d536c106592139fa82062494c9dba0da1fdb/lib/forever.js#L37-L47
train
A function that will run once for each resource in the cluster
[ 30522, 3853, 5091, 1006, 1042, 2078, 1010, 9413, 28483, 3600, 1007, 1063, 13075, 2589, 1027, 2069, 2239, 3401, 1006, 9413, 28483, 3600, 1007, 1025, 13075, 4708, 1027, 10236, 3022, 6038, 2278, 1006, 5676, 3022, 6038, 2278, 1006, 1042, 2078, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/fs.js
ensureFolder
function ensureFolder(rootFolder) { return rmDir(rootFolder) .fail(function() { return Promise(); }) .then(function() { return Promise.nfcall(mkdirp, rootFolder); }); }
javascript
function ensureFolder(rootFolder) { return rmDir(rootFolder) .fail(function() { return Promise(); }) .then(function() { return Promise.nfcall(mkdirp, rootFolder); }); }
[ "function", "ensureFolder", "(", "rootFolder", ")", "{", "return", "rmDir", "(", "rootFolder", ")", ".", "fail", "(", "function", "(", ")", "{", "return", "Promise", "(", ")", ";", "}", ")", ".", "then", "(", "function", "(", ")", "{", "return", "Pro...
Ensure that a directory exists and is empty @param {String} folder @return {Promise}
[ "Ensure", "that", "a", "directory", "exists", "and", "is", "empty" ]
6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4
https://github.com/GitbookIO/gitbook/blob/6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4/lib/utils/fs.js#L138-L146
train
Ensure that the root folder exists
[ 30522, 3853, 5676, 10371, 2121, 1006, 7117, 10371, 2121, 1007, 1063, 2709, 28549, 4305, 2099, 1006, 7117, 10371, 2121, 1007, 1012, 8246, 1006, 3853, 1006, 1007, 1063, 2709, 4872, 1006, 1007, 1025, 1065, 1007, 1012, 2059, 1006, 3853, 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...
babel/babel
packages/babel-plugin-transform-block-scoping/src/index.js
isInLoop
function isInLoop(path) { const loopOrFunctionParent = path.find( path => path.isLoop() || path.isFunction(), ); return loopOrFunctionParent && loopOrFunctionParent.isLoop(); }
javascript
function isInLoop(path) { const loopOrFunctionParent = path.find( path => path.isLoop() || path.isFunction(), ); return loopOrFunctionParent && loopOrFunctionParent.isLoop(); }
[ "function", "isInLoop", "(", "path", ")", "{", "const", "loopOrFunctionParent", "=", "path", ".", "find", "(", "path", "=>", "path", ".", "isLoop", "(", ")", "||", "path", ".", "isFunction", "(", ")", ",", ")", ";", "return", "loopOrFunctionParent", "&&"...
If there is a loop ancestor closer than the closest function, we consider ourselves to be in a loop.
[ "If", "there", "is", "a", "loop", "ancestor", "closer", "than", "the", "closest", "function", "we", "consider", "ourselves", "to", "be", "in", "a", "loop", "." ]
1969e6b6aa7d90be3fbb3aca98ea96849656a55a
https://github.com/babel/babel/blob/1969e6b6aa7d90be3fbb3aca98ea96849656a55a/packages/babel-plugin-transform-block-scoping/src/index.js#L123-L129
train
Check if path is a loop or function
[ 30522, 3853, 2003, 2378, 4135, 7361, 1006, 4130, 1007, 1063, 9530, 3367, 7077, 16347, 4609, 7542, 19362, 4765, 1027, 4130, 1012, 2424, 1006, 4130, 1027, 1028, 4130, 1012, 2003, 4135, 7361, 1006, 1007, 1064, 1064, 4130, 1012, 2003, 11263, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
adobe/brackets
src/editor/EditorManager.js
_notifyActiveEditorChanged
function _notifyActiveEditorChanged(current) { // Skip if the Editor that gained focus was already the most recently focused editor. // This may happen e.g. if the window loses then regains focus. if (_lastFocusedEditor === current) { return; } var previous = _lastFocusedEditor; _lastFocusedEditor = current; exports.trigger("activeEditorChange", current, previous); }
javascript
function _notifyActiveEditorChanged(current) { // Skip if the Editor that gained focus was already the most recently focused editor. // This may happen e.g. if the window loses then regains focus. if (_lastFocusedEditor === current) { return; } var previous = _lastFocusedEditor; _lastFocusedEditor = current; exports.trigger("activeEditorChange", current, previous); }
[ "function", "_notifyActiveEditorChanged", "(", "current", ")", "{", "// Skip if the Editor that gained focus was already the most recently focused editor.", "// This may happen e.g. if the window loses then regains focus.", "if", "(", "_lastFocusedEditor", "===", "current", ")", "{", "...
Editor focus handler to change the currently active editor @private @param {?Editor} current - the editor that will be the active editor
[ "Editor", "focus", "handler", "to", "change", "the", "currently", "active", "editor" ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/editor/EditorManager.js#L143-L153
train
Notify the active editor that the current editor has changed.
[ 30522, 3853, 1035, 2025, 8757, 19620, 2098, 15660, 22305, 2098, 1006, 2783, 1007, 1063, 1013, 1013, 13558, 2065, 1996, 3559, 2008, 4227, 3579, 2001, 2525, 1996, 2087, 3728, 4208, 3559, 1012, 1013, 1013, 2023, 2089, 4148, 1041, 1012, 1043, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/performance/trace/FESR.js
createFESRopt
function createFESRopt(oInteraction, oFESRHandle) { return [ format(oFESRHandle.appNameShort, 20, true), // application_name format(oFESRHandle.stepName, 20, true), // step_name "", // not assigned format(CLIENT_MODEL, 20), // client_model format(oInteraction.bytesSent, 16), // client_data_sent format(oInteraction.bytesReceived, 16), // client_data_received "", // network_protocol "", // network_provider format(oInteraction.processing, 16), // client_processing_time oInteraction.requestCompression ? "X" : "", // compressed - empty if not compressed "", // not assigned "", // persistency_accesses "", // persistency_time "", // persistency_data_transferred format(oInteraction.busyDuration, 16), // extension_1 - busy duration "", // extension_2 format(CLIENT_DEVICE, 1), // extension_3 - client device "", // extension_4 format(formatInteractionStartTimestamp(oInteraction.start), 20), // extension_5 - interaction start time format(oFESRHandle.appNameLong, 70, true) // application_name with 70 characters, trimmed from left ].join(","); }
javascript
function createFESRopt(oInteraction, oFESRHandle) { return [ format(oFESRHandle.appNameShort, 20, true), // application_name format(oFESRHandle.stepName, 20, true), // step_name "", // not assigned format(CLIENT_MODEL, 20), // client_model format(oInteraction.bytesSent, 16), // client_data_sent format(oInteraction.bytesReceived, 16), // client_data_received "", // network_protocol "", // network_provider format(oInteraction.processing, 16), // client_processing_time oInteraction.requestCompression ? "X" : "", // compressed - empty if not compressed "", // not assigned "", // persistency_accesses "", // persistency_time "", // persistency_data_transferred format(oInteraction.busyDuration, 16), // extension_1 - busy duration "", // extension_2 format(CLIENT_DEVICE, 1), // extension_3 - client device "", // extension_4 format(formatInteractionStartTimestamp(oInteraction.start), 20), // extension_5 - interaction start time format(oFESRHandle.appNameLong, 70, true) // application_name with 70 characters, trimmed from left ].join(","); }
[ "function", "createFESRopt", "(", "oInteraction", ",", "oFESRHandle", ")", "{", "return", "[", "format", "(", "oFESRHandle", ".", "appNameShort", ",", "20", ",", "true", ")", ",", "// application_name", "format", "(", "oFESRHandle", ".", "stepName", ",", "20",...
creates optional FESR header string
[ "creates", "optional", "FESR", "header", "string" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/performance/trace/FESR.js#L126-L149
train
Creates a FESRopt object from the given interaction and FESRHandle
[ 30522, 3853, 3443, 7959, 21338, 7361, 2102, 1006, 1051, 18447, 6906, 7542, 1010, 1997, 2229, 25032, 5685, 2571, 1007, 1063, 2709, 1031, 4289, 1006, 1997, 2229, 25032, 5685, 2571, 1012, 10439, 18442, 22231, 5339, 1010, 2322, 1010, 2995, 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...
SeleniumHQ/selenium
third_party/js/mozmill/shared-modules/localization.js
filterAccessKeys
function filterAccessKeys(node) { // Menus will need a separate filter set var notAllowedLocalNames = ["menu", "menubar", "menupopup", "popupset"]; if (!node.disabled && !node.collapsed && !node.hidden && notAllowedLocalNames.indexOf(node.localName) == -1) { // Code specific to the preferences panes to reject out not visible nodes // in the panes. if (node.parentNode && (node.parentNode.localName == "prefwindow" && node.parentNode.currentPane.id != node.id) || ((node.parentNode.localName == "tabpanels" || node.parentNode.localName == "deck") && node.parentNode.selectedPanel.id != node.id)) { return domUtils.DOMWalker.FILTER_REJECT; // end of the specific code } else if (node.accessKey) { return domUtils.DOMWalker.FILTER_ACCEPT; } else { return domUtils.DOMWalker.FILTER_SKIP; } } else { // we don't want to test not visible elements return domUtils.DOMWalker.FILTER_REJECT; } }
javascript
function filterAccessKeys(node) { // Menus will need a separate filter set var notAllowedLocalNames = ["menu", "menubar", "menupopup", "popupset"]; if (!node.disabled && !node.collapsed && !node.hidden && notAllowedLocalNames.indexOf(node.localName) == -1) { // Code specific to the preferences panes to reject out not visible nodes // in the panes. if (node.parentNode && (node.parentNode.localName == "prefwindow" && node.parentNode.currentPane.id != node.id) || ((node.parentNode.localName == "tabpanels" || node.parentNode.localName == "deck") && node.parentNode.selectedPanel.id != node.id)) { return domUtils.DOMWalker.FILTER_REJECT; // end of the specific code } else if (node.accessKey) { return domUtils.DOMWalker.FILTER_ACCEPT; } else { return domUtils.DOMWalker.FILTER_SKIP; } } else { // we don't want to test not visible elements return domUtils.DOMWalker.FILTER_REJECT; } }
[ "function", "filterAccessKeys", "(", "node", ")", "{", "// Menus will need a separate filter set", "var", "notAllowedLocalNames", "=", "[", "\"menu\"", ",", "\"menubar\"", ",", "\"menupopup\"", ",", "\"popupset\"", "]", ";", "if", "(", "!", "node", ".", "disabled", ...
Filters out nodes which should not be tested because they are not in the current access key scope. @param {node} node @returns Filter status of the given node @type {array of array of int}
[ "Filters", "out", "nodes", "which", "should", "not", "be", "tested", "because", "they", "are", "not", "in", "the", "current", "access", "key", "scope", "." ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/js/mozmill/shared-modules/localization.js#L191-L215
train
filter access keys
[ 30522, 3853, 11307, 6305, 9623, 17140, 7274, 1006, 13045, 1007, 1063, 1013, 1013, 12183, 2015, 2097, 2342, 1037, 3584, 11307, 2275, 13075, 2025, 8095, 15096, 4135, 9289, 18442, 2015, 1027, 1031, 1000, 12183, 1000, 1010, 1000, 12183, 8237, 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/document/DocumentCommandHandlers.js
handleFileDelete
function handleFileDelete() { var entry = ProjectManager.getSelectedItem(); Dialogs.showModalDialog( DefaultDialogs.DIALOG_ID_EXT_DELETED, Strings.CONFIRM_DELETE_TITLE, StringUtils.format( entry.isFile ? Strings.CONFIRM_FILE_DELETE : Strings.CONFIRM_FOLDER_DELETE, StringUtils.breakableUrl(entry.name) ), [ { className : Dialogs.DIALOG_BTN_CLASS_NORMAL, id : Dialogs.DIALOG_BTN_CANCEL, text : Strings.CANCEL }, { className : Dialogs.DIALOG_BTN_CLASS_PRIMARY, id : Dialogs.DIALOG_BTN_OK, text : Strings.DELETE } ] ) .done(function (id) { if (id === Dialogs.DIALOG_BTN_OK) { ProjectManager.deleteItem(entry); } }); }
javascript
function handleFileDelete() { var entry = ProjectManager.getSelectedItem(); Dialogs.showModalDialog( DefaultDialogs.DIALOG_ID_EXT_DELETED, Strings.CONFIRM_DELETE_TITLE, StringUtils.format( entry.isFile ? Strings.CONFIRM_FILE_DELETE : Strings.CONFIRM_FOLDER_DELETE, StringUtils.breakableUrl(entry.name) ), [ { className : Dialogs.DIALOG_BTN_CLASS_NORMAL, id : Dialogs.DIALOG_BTN_CANCEL, text : Strings.CANCEL }, { className : Dialogs.DIALOG_BTN_CLASS_PRIMARY, id : Dialogs.DIALOG_BTN_OK, text : Strings.DELETE } ] ) .done(function (id) { if (id === Dialogs.DIALOG_BTN_OK) { ProjectManager.deleteItem(entry); } }); }
[ "function", "handleFileDelete", "(", ")", "{", "var", "entry", "=", "ProjectManager", ".", "getSelectedItem", "(", ")", ";", "Dialogs", ".", "showModalDialog", "(", "DefaultDialogs", ".", "DIALOG_ID_EXT_DELETED", ",", "Strings", ".", "CONFIRM_DELETE_TITLE", ",", "...
Delete file command handler *
[ "Delete", "file", "command", "handler", "*" ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/document/DocumentCommandHandlers.js#L1594-L1621
train
Handle file delete
[ 30522, 3853, 5047, 8873, 3709, 12260, 2618, 1006, 1007, 1063, 13075, 4443, 1027, 2622, 24805, 4590, 1012, 4152, 12260, 10985, 4221, 2213, 1006, 1007, 1025, 13764, 8649, 2015, 1012, 2265, 5302, 9305, 27184, 8649, 1006, 12398, 27184, 8649, 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...
fex-team/webuploader
_draft/music/webuploader.js
function( type/*, args...*/ ) { var args = [].slice.call( arguments, 1 ), opts = this.options, name = 'on' + type.substring( 0, 1 ).toUpperCase() + type.substring( 1 ); if ( Mediator.trigger.apply( this, arguments ) === false ) { return false; } if ( $.isFunction( opts[ name ] ) && opts[ name ].apply( this, args ) === false ) { return false; } if ( $.isFunction( this[ name ] ) && this[ name ].apply( this, args ) === false ) { return false; } return true; }
javascript
function( type/*, args...*/ ) { var args = [].slice.call( arguments, 1 ), opts = this.options, name = 'on' + type.substring( 0, 1 ).toUpperCase() + type.substring( 1 ); if ( Mediator.trigger.apply( this, arguments ) === false ) { return false; } if ( $.isFunction( opts[ name ] ) && opts[ name ].apply( this, args ) === false ) { return false; } if ( $.isFunction( this[ name ] ) && this[ name ].apply( this, args ) === false ) { return false; } return true; }
[ "function", "(", "type", "/*, args...*/", ")", "{", "var", "args", "=", "[", "]", ".", "slice", ".", "call", "(", "arguments", ",", "1", ")", ",", "opts", "=", "this", ".", "options", ",", "name", "=", "'on'", "+", "type", ".", "substring", "(", ...
需要重写此方法来来支持opts.onEvent和instance.onEvent的处理器
[ "需要重写此方法来来支持opts", ".", "onEvent和instance", ".", "onEvent的处理器" ]
7094e4476c5af3b06993d91dde2d223200b9feb7
https://github.com/fex-team/webuploader/blob/7094e4476c5af3b06993d91dde2d223200b9feb7/_draft/music/webuploader.js#L779-L800
train
trigger a event
[ 30522, 3853, 1006, 2828, 1013, 1008, 1010, 12098, 5620, 1012, 1012, 1012, 1008, 1013, 1007, 1063, 13075, 12098, 5620, 1027, 1031, 1033, 1012, 14704, 1012, 2655, 1006, 9918, 1010, 1015, 1007, 1010, 23569, 2015, 1027, 2023, 1012, 7047, 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...
GitbookIO/gitbook
lib/parse/listAssets.js
listAssets
function listAssets(book, pages) { var fs = book.getContentFS(); var summary = book.getSummary(); var summaryFile = summary.getFile().getPath(); var glossary = book.getGlossary(); var glossaryFile = glossary.getFile().getPath(); var langs = book.getLanguages(); var langsFile = langs.getFile().getPath(); var config = book.getConfig(); var configFile = config.getFile().getPath(); function filterFile(file) { return !( file === summaryFile || file === glossaryFile || file === langsFile || file === configFile || book.isContentFileIgnored(file) || pages.has(file) ); } return timing.measure( 'parse.listAssets', fs.listAllFiles('.', filterFile) ); }
javascript
function listAssets(book, pages) { var fs = book.getContentFS(); var summary = book.getSummary(); var summaryFile = summary.getFile().getPath(); var glossary = book.getGlossary(); var glossaryFile = glossary.getFile().getPath(); var langs = book.getLanguages(); var langsFile = langs.getFile().getPath(); var config = book.getConfig(); var configFile = config.getFile().getPath(); function filterFile(file) { return !( file === summaryFile || file === glossaryFile || file === langsFile || file === configFile || book.isContentFileIgnored(file) || pages.has(file) ); } return timing.measure( 'parse.listAssets', fs.listAllFiles('.', filterFile) ); }
[ "function", "listAssets", "(", "book", ",", "pages", ")", "{", "var", "fs", "=", "book", ".", "getContentFS", "(", ")", ";", "var", "summary", "=", "book", ".", "getSummary", "(", ")", ";", "var", "summaryFile", "=", "summary", ".", "getFile", "(", "...
List all assets in a book Assets are file not ignored and not a page @param {Book} book @param {List<String>} pages @param
[ "List", "all", "assets", "in", "a", "book", "Assets", "are", "file", "not", "ignored", "and", "not", "a", "page" ]
6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4
https://github.com/GitbookIO/gitbook/blob/6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4/lib/parse/listAssets.js#L11-L41
train
List assets from book
[ 30522, 3853, 2862, 27241, 3215, 1006, 2338, 1010, 5530, 1007, 1063, 13075, 1042, 2015, 1027, 2338, 1012, 2131, 8663, 6528, 24475, 2015, 1006, 1007, 1025, 13075, 12654, 1027, 2338, 1012, 4152, 30524, 5649, 1027, 2338, 1012, 2131, 23296, 2184...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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...
pixijs/pixi.js
packages/prepare/src/BasePrepare.js
calculateTextStyle
function calculateTextStyle(helper, item) { if (item instanceof TextStyle) { const font = item.toFontString(); TextMetrics.measureFont(font); return true; } return false; }
javascript
function calculateTextStyle(helper, item) { if (item instanceof TextStyle) { const font = item.toFontString(); TextMetrics.measureFont(font); return true; } return false; }
[ "function", "calculateTextStyle", "(", "helper", ",", "item", ")", "{", "if", "(", "item", "instanceof", "TextStyle", ")", "{", "const", "font", "=", "item", ".", "toFontString", "(", ")", ";", "TextMetrics", ".", "measureFont", "(", "font", ")", ";", "r...
Built-in hook to calculate a text style for a PIXI.Text object. @private @param {PIXI.Renderer|PIXI.CanvasPrepare} helper - Not used by this upload handler @param {PIXI.DisplayObject} item - Item to check @return {boolean} If item was uploaded.
[ "Built", "-", "in", "hook", "to", "calculate", "a", "text", "style", "for", "a", "PIXI", ".", "Text", "object", "." ]
99ae03b7565ae7ca5a6de633b0a277f7128fa4d0
https://github.com/pixijs/pixi.js/blob/99ae03b7565ae7ca5a6de633b0a277f7128fa4d0/packages/prepare/src/BasePrepare.js#L426-L438
train
Calculate text style
[ 30522, 3853, 18422, 18209, 21756, 2571, 1006, 2393, 2121, 1010, 8875, 1007, 1063, 2065, 1006, 8875, 6013, 11253, 6981, 27983, 1007, 1063, 9530, 3367, 15489, 1027, 8875, 1012, 2000, 14876, 7666, 18886, 3070, 1006, 1007, 1025, 3793, 12589, 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...
adobe/brackets
src/search/FileFilters.js
_updatePicker
function _updatePicker() { var filter = getActiveFilter(); if (filter && filter.patterns.length) { var label = filter.name || _getCondensedForm(filter.patterns); _picker.setButtonLabel(StringUtils.format(Strings.EXCLUDE_FILE_FILTER, label)); } else { _picker.setButtonLabel(Strings.NO_FILE_FILTER); } }
javascript
function _updatePicker() { var filter = getActiveFilter(); if (filter && filter.patterns.length) { var label = filter.name || _getCondensedForm(filter.patterns); _picker.setButtonLabel(StringUtils.format(Strings.EXCLUDE_FILE_FILTER, label)); } else { _picker.setButtonLabel(Strings.NO_FILE_FILTER); } }
[ "function", "_updatePicker", "(", ")", "{", "var", "filter", "=", "getActiveFilter", "(", ")", ";", "if", "(", "filter", "&&", "filter", ".", "patterns", ".", "length", ")", "{", "var", "label", "=", "filter", ".", "name", "||", "_getCondensedForm", "(",...
Update the picker button label with the name/patterns of the selected filter or No Files Excluded if no filter is selected.
[ "Update", "the", "picker", "button", "label", "with", "the", "name", "/", "patterns", "of", "the", "selected", "filter", "or", "No", "Files", "Excluded", "if", "no", "filter", "is", "selected", "." ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/search/FileFilters.js#L158-L166
train
Update the picker
[ 30522, 3853, 1035, 10651, 24330, 5484, 1006, 1007, 1063, 13075, 11307, 1027, 2131, 19620, 8873, 21928, 1006, 1007, 1025, 2065, 1006, 11307, 1004, 1004, 11307, 1012, 7060, 1012, 3091, 1007, 1063, 13075, 3830, 1027, 11307, 1012, 2171, 1064, 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/_ODataMetaModelUtils.js
function (sV2AnnotationName, oEntitySet, oProperty) { var aNames = mV2ToV4PropertyCollection[sV2AnnotationName], sTerm = aNames[0], sCollection = aNames[1], oAnnotation = oEntitySet[sTerm] || {}, aCollection = oAnnotation[sCollection] || []; aCollection.push({ "PropertyPath" : oProperty.name }); oAnnotation[sCollection] = aCollection; oEntitySet[sTerm] = oAnnotation; }
javascript
function (sV2AnnotationName, oEntitySet, oProperty) { var aNames = mV2ToV4PropertyCollection[sV2AnnotationName], sTerm = aNames[0], sCollection = aNames[1], oAnnotation = oEntitySet[sTerm] || {}, aCollection = oAnnotation[sCollection] || []; aCollection.push({ "PropertyPath" : oProperty.name }); oAnnotation[sCollection] = aCollection; oEntitySet[sTerm] = oAnnotation; }
[ "function", "(", "sV2AnnotationName", ",", "oEntitySet", ",", "oProperty", ")", "{", "var", "aNames", "=", "mV2ToV4PropertyCollection", "[", "sV2AnnotationName", "]", ",", "sTerm", "=", "aNames", "[", "0", "]", ",", "sCollection", "=", "aNames", "[", "1", "]...
Adds current property to the property collection for given V2 annotation. @param {string} sV2AnnotationName V2 annotation name (key in map mV2ToV4PropertyCollection) @param {object} oEntitySet the entity set @param {object} oProperty the property of the entity
[ "Adds", "current", "property", "to", "the", "property", "collection", "for", "given", "V2", "annotation", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/_ODataMetaModelUtils.js#L270-L280
train
Adds the given property to the end of the entity set
[ 30522, 3853, 1006, 17917, 2475, 11639, 17287, 3508, 18442, 1010, 1051, 4765, 3012, 13462, 1010, 6728, 18981, 15010, 1007, 1063, 13075, 9617, 7834, 1027, 19842, 2475, 26525, 2549, 21572, 4842, 3723, 26895, 18491, 1031, 17917, 2475, 11639, 1728...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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...
electron/electron
lib/browser/api/menu.js
areValidTemplateItems
function areValidTemplateItems (template) { return template.every(item => item != null && typeof item === 'object' && (item.hasOwnProperty('label') || item.hasOwnProperty('role') || item.type === 'separator')) }
javascript
function areValidTemplateItems (template) { return template.every(item => item != null && typeof item === 'object' && (item.hasOwnProperty('label') || item.hasOwnProperty('role') || item.type === 'separator')) }
[ "function", "areValidTemplateItems", "(", "template", ")", "{", "return", "template", ".", "every", "(", "item", "=>", "item", "!=", "null", "&&", "typeof", "item", "===", "'object'", "&&", "(", "item", ".", "hasOwnProperty", "(", "'label'", ")", "||", "it...
/* Helper Functions validate the template against having the wrong attribute
[ "/", "*", "Helper", "Functions", "validate", "the", "template", "against", "having", "the", "wrong", "attribute" ]
6e29611788277729647acf465f10db1ea6f15788
https://github.com/electron/electron/blob/6e29611788277729647acf465f10db1ea6f15788/lib/browser/api/menu.js#L192-L199
train
Check if the template contains valid items
[ 30522, 3853, 2024, 10175, 3593, 18532, 15725, 4221, 5244, 1006, 23561, 1007, 1063, 2709, 23561, 1012, 2296, 1006, 8875, 1027, 1028, 8875, 999, 1027, 19701, 1004, 1004, 2828, 11253, 8875, 1027, 1027, 1027, 1005, 4874, 1005, 1004, 1004, 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...
catapult-project/catapult
dashboard/dashboard/spa/alerts-section.js
handleBatch
function handleBatch(results, showingTriaged) { const alerts = []; const nextRequests = []; const triagedRequests = []; let totalCount = 0; for (const {body, response} of results) { alerts.push.apply(alerts, response.anomalies); if (body.count_limit) totalCount += response.count; const cursor = response.next_cursor; if (cursor) { const request = {...body, cursor}; delete request.count_limit; nextRequests.push(request); } if (!showingTriaged && body.bug_id === '') { // Prepare to fetch triaged alerts for the untriaged alerts that // were just received. const request = {...body, bug_id: '*'}; delete request.recovered; delete request.count_limit; delete request.cursor; delete request.is_improvement; triagedRequests.push(request); } } return {alerts, nextRequests, triagedRequests, totalCount}; }
javascript
function handleBatch(results, showingTriaged) { const alerts = []; const nextRequests = []; const triagedRequests = []; let totalCount = 0; for (const {body, response} of results) { alerts.push.apply(alerts, response.anomalies); if (body.count_limit) totalCount += response.count; const cursor = response.next_cursor; if (cursor) { const request = {...body, cursor}; delete request.count_limit; nextRequests.push(request); } if (!showingTriaged && body.bug_id === '') { // Prepare to fetch triaged alerts for the untriaged alerts that // were just received. const request = {...body, bug_id: '*'}; delete request.recovered; delete request.count_limit; delete request.cursor; delete request.is_improvement; triagedRequests.push(request); } } return {alerts, nextRequests, triagedRequests, totalCount}; }
[ "function", "handleBatch", "(", "results", ",", "showingTriaged", ")", "{", "const", "alerts", "=", "[", "]", ";", "const", "nextRequests", "=", "[", "]", ";", "const", "triagedRequests", "=", "[", "]", ";", "let", "totalCount", "=", "0", ";", "for", "...
The BatchIterator in actions.loadAlerts yielded a batch of results. Collect all alerts from all batches into `alerts`. Chase cursors in `nextRequests`. Fetch triaged alerts when a request for untriaged alerts returns.
[ "The", "BatchIterator", "in", "actions", ".", "loadAlerts", "yielded", "a", "batch", "of", "results", ".", "Collect", "all", "alerts", "from", "all", "batches", "into", "alerts", ".", "Chase", "cursors", "in", "nextRequests", ".", "Fetch", "triaged", "alerts",...
992929ffccac68827869a497f01ee4d653ed4f25
https://github.com/catapult-project/catapult/blob/992929ffccac68827869a497f01ee4d653ed4f25/dashboard/dashboard/spa/alerts-section.js#L291-L321
train
Handle a batch of alerts
[ 30522, 3853, 5047, 14479, 2818, 1006, 3463, 1010, 4760, 18886, 18655, 1007, 1063, 9530, 3367, 9499, 2015, 1027, 1031, 1033, 1025, 9530, 3367, 2279, 2890, 15500, 2015, 1027, 1031, 1033, 1025, 9530, 3367, 13012, 18655, 2890, 15500, 2015, 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...
aframevr/aframe
src/systems/camera.js
function () { var cameraEls; var i; var sceneEl = this.sceneEl; var self = this; // Camera already defined or the one defined it is an spectator one. if (sceneEl.camera && !sceneEl.camera.el.getAttribute('camera').spectator) { sceneEl.emit('cameraready', {cameraEl: sceneEl.camera.el}); return; } // Search for initial user-defined camera. cameraEls = sceneEl.querySelectorAll('a-camera, [camera]'); // No user cameras, create default one. if (!cameraEls.length) { this.createDefaultCamera(); return; } this.numUserCameras = cameraEls.length; for (i = 0; i < cameraEls.length; i++) { cameraEls[i].addEventListener('object3dset', function (evt) { if (evt.detail.type !== 'camera') { return; } self.checkUserCamera(this); }); // Load camera and wait for camera to initialize. if (cameraEls[i].isNode) { cameraEls[i].load(); } else { cameraEls[i].addEventListener('nodeready', function () { this.load(); }); } } }
javascript
function () { var cameraEls; var i; var sceneEl = this.sceneEl; var self = this; // Camera already defined or the one defined it is an spectator one. if (sceneEl.camera && !sceneEl.camera.el.getAttribute('camera').spectator) { sceneEl.emit('cameraready', {cameraEl: sceneEl.camera.el}); return; } // Search for initial user-defined camera. cameraEls = sceneEl.querySelectorAll('a-camera, [camera]'); // No user cameras, create default one. if (!cameraEls.length) { this.createDefaultCamera(); return; } this.numUserCameras = cameraEls.length; for (i = 0; i < cameraEls.length; i++) { cameraEls[i].addEventListener('object3dset', function (evt) { if (evt.detail.type !== 'camera') { return; } self.checkUserCamera(this); }); // Load camera and wait for camera to initialize. if (cameraEls[i].isNode) { cameraEls[i].load(); } else { cameraEls[i].addEventListener('nodeready', function () { this.load(); }); } } }
[ "function", "(", ")", "{", "var", "cameraEls", ";", "var", "i", ";", "var", "sceneEl", "=", "this", ".", "sceneEl", ";", "var", "self", "=", "this", ";", "// Camera already defined or the one defined it is an spectator one.", "if", "(", "sceneEl", ".", "camera",...
Setup initial camera, either searching for camera or creating a default camera if user has not added one during the initial scene traversal. We want sceneEl.camera to be ready, set, and initialized before the rest of the scene loads. Default camera offset height is at average eye level (~1.6m).
[ "Setup", "initial", "camera", "either", "searching", "for", "camera", "or", "creating", "a", "default", "camera", "if", "user", "has", "not", "added", "one", "during", "the", "initial", "scene", "traversal", ".", "We", "want", "sceneEl", ".", "camera", "to",...
24acc78a7299a4cdfe3ef617f4d40ddf6275c992
https://github.com/aframevr/aframe/blob/24acc78a7299a4cdfe3ef617f4d40ddf6275c992/src/systems/camera.js#L33-L70
train
Check if the scene has a camera
[ 30522, 3853, 1006, 1007, 1063, 13075, 4950, 9050, 1025, 13075, 1045, 1025, 13075, 3496, 2884, 1027, 2023, 1012, 3496, 2884, 1025, 13075, 2969, 1027, 2023, 1025, 1013, 1013, 4950, 2525, 4225, 2030, 1996, 2028, 4225, 30524, 3496, 2884, 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...
google/code-prettify
js-modules/numberLines.js
breakAfter
function breakAfter(lineEndNode) { // If there's nothing to the right, then we can skip ending the line // here, and move root-wards since splitting just before an end-tag // would require us to create a bunch of empty copies. while (!lineEndNode.nextSibling) { lineEndNode = lineEndNode.parentNode; if (!lineEndNode) { return; } } function breakLeftOf(limit, copy) { // Clone shallowly if this node needs to be on both sides of the break. var rightSide = copy ? limit.cloneNode(false) : limit; var parent = limit.parentNode; if (parent) { // We clone the parent chain. // This helps us resurrect important styling elements that cross lines. // E.g. in <i>Foo<br>Bar</i> // should be rewritten to <li><i>Foo</i></li><li><i>Bar</i></li>. var parentClone = breakLeftOf(parent, 1); // Move the clone and everything to the right of the original // onto the cloned parent. var next = limit.nextSibling; parentClone.appendChild(rightSide); for (var sibling = next; sibling; sibling = next) { next = sibling.nextSibling; parentClone.appendChild(sibling); } } return rightSide; } var copiedListItem = breakLeftOf(lineEndNode.nextSibling, 0); // Walk the parent chain until we reach an unattached LI. for (var parent; // Check nodeType since IE invents document fragments. (parent = copiedListItem.parentNode) && parent.nodeType === 1;) { copiedListItem = parent; } // Put it on the list of lines for later processing. listItems.push(copiedListItem); }
javascript
function breakAfter(lineEndNode) { // If there's nothing to the right, then we can skip ending the line // here, and move root-wards since splitting just before an end-tag // would require us to create a bunch of empty copies. while (!lineEndNode.nextSibling) { lineEndNode = lineEndNode.parentNode; if (!lineEndNode) { return; } } function breakLeftOf(limit, copy) { // Clone shallowly if this node needs to be on both sides of the break. var rightSide = copy ? limit.cloneNode(false) : limit; var parent = limit.parentNode; if (parent) { // We clone the parent chain. // This helps us resurrect important styling elements that cross lines. // E.g. in <i>Foo<br>Bar</i> // should be rewritten to <li><i>Foo</i></li><li><i>Bar</i></li>. var parentClone = breakLeftOf(parent, 1); // Move the clone and everything to the right of the original // onto the cloned parent. var next = limit.nextSibling; parentClone.appendChild(rightSide); for (var sibling = next; sibling; sibling = next) { next = sibling.nextSibling; parentClone.appendChild(sibling); } } return rightSide; } var copiedListItem = breakLeftOf(lineEndNode.nextSibling, 0); // Walk the parent chain until we reach an unattached LI. for (var parent; // Check nodeType since IE invents document fragments. (parent = copiedListItem.parentNode) && parent.nodeType === 1;) { copiedListItem = parent; } // Put it on the list of lines for later processing. listItems.push(copiedListItem); }
[ "function", "breakAfter", "(", "lineEndNode", ")", "{", "// If there's nothing to the right, then we can skip ending the line", "// here, and move root-wards since splitting just before an end-tag", "// would require us to create a bunch of empty copies.", "while", "(", "!", "lineEndNode", ...
Split a line after the given node.
[ "Split", "a", "line", "after", "the", "given", "node", "." ]
e14ed1c3c40f78fca2a11af4cb0fa251f6f997fc
https://github.com/google/code-prettify/blob/e14ed1c3c40f78fca2a11af4cb0fa251f6f997fc/js-modules/numberLines.js#L66-L107
train
This function is called when a line is ending in a tag.
[ 30522, 3853, 3338, 10354, 3334, 1006, 2240, 10497, 3630, 3207, 1007, 1063, 1013, 1013, 2065, 2045, 1005, 1055, 2498, 2000, 1996, 2157, 1010, 2059, 2057, 2064, 13558, 4566, 1996, 2240, 1013, 1013, 2182, 1010, 1998, 2693, 7117, 1011, 11682, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/moduleTreeHelper.js
function (oTree, bSelected) { oTree.selected = bSelected; for (var i = 0; i < oTree.nodes.length; i++) { this.recursiveSelect(oTree.nodes[i], bSelected); } }
javascript
function (oTree, bSelected) { oTree.selected = bSelected; for (var i = 0; i < oTree.nodes.length; i++) { this.recursiveSelect(oTree.nodes[i], bSelected); } }
[ "function", "(", "oTree", ",", "bSelected", ")", "{", "oTree", ".", "selected", "=", "bSelected", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "oTree", ".", "nodes", ".", "length", ";", "i", "++", ")", "{", "this", ".", "recursiveSelect", ...
Recursively selected or deselects a branch of the tree @param {object} oTree The tree to be selected @param {boolean} bSelected Whether the branch should be selected or not
[ "Recursively", "selected", "or", "deselects", "a", "branch", "of", "the", "tree" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/support/techinfo/moduleTreeHelper.js#L314-L319
train
Recursively selects the nodes in the tree
[ 30522, 3853, 1006, 27178, 9910, 1010, 18667, 12260, 10985, 1007, 1063, 27178, 9910, 1012, 3479, 1027, 18667, 12260, 10985, 1025, 2005, 1006, 13075, 1045, 1027, 1014, 1025, 1045, 1026, 27178, 9910, 1012, 14164, 1012, 3091, 1025, 1045, 1009, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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...
uikit/uikit
src/js/util/options.js
concatStrat
function concatStrat(parentVal, childVal) { parentVal = parentVal && !isArray(parentVal) ? [parentVal] : parentVal; return childVal ? parentVal ? parentVal.concat(childVal) : isArray(childVal) ? childVal : [childVal] : parentVal; }
javascript
function concatStrat(parentVal, childVal) { parentVal = parentVal && !isArray(parentVal) ? [parentVal] : parentVal; return childVal ? parentVal ? parentVal.concat(childVal) : isArray(childVal) ? childVal : [childVal] : parentVal; }
[ "function", "concatStrat", "(", "parentVal", ",", "childVal", ")", "{", "parentVal", "=", "parentVal", "&&", "!", "isArray", "(", "parentVal", ")", "?", "[", "parentVal", "]", ":", "parentVal", ";", "return", "childVal", "?", "parentVal", "?", "parentVal", ...
concat strategy
[ "concat", "strategy" ]
b7760008135313b6a81f645c750db6f285a89488
https://github.com/uikit/uikit/blob/b7760008135313b6a81f645c750db6f285a89488/src/js/util/options.js#L80-L91
train
concatStrat - Concatenates two terms of terms
[ 30522, 3853, 9530, 19588, 6494, 2102, 1006, 6687, 10175, 1010, 2775, 10175, 1007, 1063, 6687, 10175, 1027, 6687, 10175, 1004, 1004, 999, 18061, 11335, 2100, 1006, 6687, 10175, 1007, 1029, 1031, 6687, 10175, 1033, 1024, 6687, 30524, 0, 0, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
openlayers/openlayers
src/ol/interaction/Modify.js
pointDistanceToSegmentDataSquared
function pointDistanceToSegmentDataSquared(pointCoordinates, segmentData) { const geometry = segmentData.geometry; if (geometry.getType() === GeometryType.CIRCLE) { const circleGeometry = /** @type {import("../geom/Circle.js").default} */ (geometry); if (segmentData.index === CIRCLE_CIRCUMFERENCE_INDEX) { const distanceToCenterSquared = squaredCoordinateDistance(circleGeometry.getCenter(), pointCoordinates); const distanceToCircumference = Math.sqrt(distanceToCenterSquared) - circleGeometry.getRadius(); return distanceToCircumference * distanceToCircumference; } } return squaredDistanceToSegment(pointCoordinates, segmentData.segment); }
javascript
function pointDistanceToSegmentDataSquared(pointCoordinates, segmentData) { const geometry = segmentData.geometry; if (geometry.getType() === GeometryType.CIRCLE) { const circleGeometry = /** @type {import("../geom/Circle.js").default} */ (geometry); if (segmentData.index === CIRCLE_CIRCUMFERENCE_INDEX) { const distanceToCenterSquared = squaredCoordinateDistance(circleGeometry.getCenter(), pointCoordinates); const distanceToCircumference = Math.sqrt(distanceToCenterSquared) - circleGeometry.getRadius(); return distanceToCircumference * distanceToCircumference; } } return squaredDistanceToSegment(pointCoordinates, segmentData.segment); }
[ "function", "pointDistanceToSegmentDataSquared", "(", "pointCoordinates", ",", "segmentData", ")", "{", "const", "geometry", "=", "segmentData", ".", "geometry", ";", "if", "(", "geometry", ".", "getType", "(", ")", "===", "GeometryType", ".", "CIRCLE", ")", "{"...
Returns the distance from a point to a line segment. @param {import("../coordinate.js").Coordinate} pointCoordinates The coordinates of the point from which to calculate the distance. @param {SegmentData} segmentData The object describing the line segment we are calculating the distance to. @return {number} The square of the distance between a point and a line segment.
[ "Returns", "the", "distance", "from", "a", "point", "to", "a", "line", "segment", "." ]
f366eaea522388fb575b11010e69d309164baca7
https://github.com/openlayers/openlayers/blob/f366eaea522388fb575b11010e69d309164baca7/src/ol/interaction/Modify.js#L1202-L1217
train
Returns the squared distance to the point coordinates in the segmentData
[ 30522, 3853, 2391, 10521, 26897, 22282, 21693, 30524, 1012, 4418, 1007, 1063, 9530, 3367, 4418, 3351, 8462, 11129, 1027, 1013, 1008, 1008, 1030, 2828, 1063, 12324, 1006, 1000, 1012, 1012, 1013, 20248, 2213, 1013, 4418, 1012, 1046, 2015, 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...
dequelabs/axe-core
lib/core/utils/get-selector.js
filterAttributes
function filterAttributes(at) { return ( !ignoredAttributes.includes(at.name) && at.name.indexOf(':') === -1 && (!at.value || at.value.length < MAXATTRIBUTELENGTH) ); }
javascript
function filterAttributes(at) { return ( !ignoredAttributes.includes(at.name) && at.name.indexOf(':') === -1 && (!at.value || at.value.length < MAXATTRIBUTELENGTH) ); }
[ "function", "filterAttributes", "(", "at", ")", "{", "return", "(", "!", "ignoredAttributes", ".", "includes", "(", "at", ".", "name", ")", "&&", "at", ".", "name", ".", "indexOf", "(", "':'", ")", "===", "-", "1", "&&", "(", "!", "at", ".", "value...
Filter the attributes @param {Attribute} The potential attribute @return {Boolean} Whether to include or exclude
[ "Filter", "the", "attributes" ]
727323c07980e2291575f545444d389fb942906f
https://github.com/dequelabs/axe-core/blob/727323c07980e2291575f545444d389fb942906f/lib/core/utils/get-selector.js#L65-L71
train
filter attributes to ignore
[ 30522, 3853, 11307, 19321, 3089, 8569, 4570, 1006, 2012, 1007, 1063, 2709, 1006, 999, 6439, 19321, 3089, 8569, 4570, 1012, 2950, 1006, 2012, 1012, 2171, 1007, 1004, 1004, 2012, 1012, 2171, 1012, 5950, 11253, 1006, 1005, 1024, 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...
adobe/brackets
src/document/DocumentCommandHandlers.js
_handleNewItemInProject
function _handleNewItemInProject(isFolder) { if (fileNewInProgress) { ProjectManager.forceFinishRename(); return; } fileNewInProgress = true; // Determine the directory to put the new file // If a file is currently selected in the tree, put it next to it. // If a directory is currently selected in the tree, put it in it. // If an Untitled document is selected or nothing is selected in the tree, put it at the root of the project. var baseDirEntry, selected = ProjectManager.getFileTreeContext(); if ((!selected) || (selected instanceof InMemoryFile)) { selected = ProjectManager.getProjectRoot(); } if (selected.isFile) { baseDirEntry = FileSystem.getDirectoryForPath(selected.parentPath); } baseDirEntry = baseDirEntry || selected; // Create the new node. The createNewItem function does all the heavy work // of validating file name, creating the new file and selecting. function createWithSuggestedName(suggestedName) { return ProjectManager.createNewItem(baseDirEntry, suggestedName, false, isFolder) .always(function () { fileNewInProgress = false; }); } return _getUntitledFileSuggestion(baseDirEntry, Strings.UNTITLED, isFolder) .then(createWithSuggestedName, createWithSuggestedName.bind(undefined, Strings.UNTITLED)); }
javascript
function _handleNewItemInProject(isFolder) { if (fileNewInProgress) { ProjectManager.forceFinishRename(); return; } fileNewInProgress = true; // Determine the directory to put the new file // If a file is currently selected in the tree, put it next to it. // If a directory is currently selected in the tree, put it in it. // If an Untitled document is selected or nothing is selected in the tree, put it at the root of the project. var baseDirEntry, selected = ProjectManager.getFileTreeContext(); if ((!selected) || (selected instanceof InMemoryFile)) { selected = ProjectManager.getProjectRoot(); } if (selected.isFile) { baseDirEntry = FileSystem.getDirectoryForPath(selected.parentPath); } baseDirEntry = baseDirEntry || selected; // Create the new node. The createNewItem function does all the heavy work // of validating file name, creating the new file and selecting. function createWithSuggestedName(suggestedName) { return ProjectManager.createNewItem(baseDirEntry, suggestedName, false, isFolder) .always(function () { fileNewInProgress = false; }); } return _getUntitledFileSuggestion(baseDirEntry, Strings.UNTITLED, isFolder) .then(createWithSuggestedName, createWithSuggestedName.bind(undefined, Strings.UNTITLED)); }
[ "function", "_handleNewItemInProject", "(", "isFolder", ")", "{", "if", "(", "fileNewInProgress", ")", "{", "ProjectManager", ".", "forceFinishRename", "(", ")", ";", "return", ";", "}", "fileNewInProgress", "=", "true", ";", "// Determine the directory to put the new...
Bottleneck function for creating new files and folders in the project tree. @private @param {boolean} isFolder - true if creating a new folder, false if creating a new file
[ "Bottleneck", "function", "for", "creating", "new", "files", "and", "folders", "in", "the", "project", "tree", "." ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/document/DocumentCommandHandlers.js#L644-L676
train
Handle the new item in the project
[ 30522, 3853, 1035, 5047, 2638, 9148, 18532, 2378, 21572, 20614, 1006, 2003, 10371, 2121, 1007, 1063, 2065, 1006, 5371, 2638, 10105, 21572, 17603, 4757, 1007, 1063, 2622, 24805, 4590, 1012, 2486, 16294, 4509, 7389, 14074, 1006, 1007, 1025, 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...
TryGhost/Ghost
core/server/services/auth/auth-strategies.js
bearerStrategy
function bearerStrategy(accessToken, done) { return models.Accesstoken.findOne({token: accessToken}) .then(function then(model) { if (model) { var token = model.toJSON(); if (token.expires > Date.now()) { return models.User.findOne({id: token.user_id}) .then(function then(model) { if (!model) { return done(null, false); } if (!model.isActive()) { throw new common.errors.NoPermissionError({ message: common.i18n.t('errors.models.user.accountSuspended') }); } var user = model.toJSON(), info = {scope: '*'}; return done(null, {id: user.id}, info); }) .catch(function (err) { return done(err); }); } else { return done(null, false); } } else { return done(null, false); } }); }
javascript
function bearerStrategy(accessToken, done) { return models.Accesstoken.findOne({token: accessToken}) .then(function then(model) { if (model) { var token = model.toJSON(); if (token.expires > Date.now()) { return models.User.findOne({id: token.user_id}) .then(function then(model) { if (!model) { return done(null, false); } if (!model.isActive()) { throw new common.errors.NoPermissionError({ message: common.i18n.t('errors.models.user.accountSuspended') }); } var user = model.toJSON(), info = {scope: '*'}; return done(null, {id: user.id}, info); }) .catch(function (err) { return done(err); }); } else { return done(null, false); } } else { return done(null, false); } }); }
[ "function", "bearerStrategy", "(", "accessToken", ",", "done", ")", "{", "return", "models", ".", "Accesstoken", ".", "findOne", "(", "{", "token", ":", "accessToken", "}", ")", ".", "then", "(", "function", "then", "(", "model", ")", "{", "if", "(", "...
BearerStrategy This strategy is used to authenticate users based on an access token (aka a bearer token). The user must have previously authorized a client application, which is issued an access token to make requests on behalf of the authorizing user.
[ "BearerStrategy" ]
bb7bb55cf3e60af99ebbc56099928827b58461bc
https://github.com/TryGhost/Ghost/blob/bb7bb55cf3e60af99ebbc56099928827b58461bc/core/server/services/auth/auth-strategies.js#L39-L72
train
bearerStrategy - The bearer strategy
[ 30522, 3853, 20905, 20528, 2618, 6292, 1006, 3229, 18715, 2368, 1010, 2589, 1007, 1063, 2709, 4275, 1012, 3229, 18715, 2368, 1012, 2424, 5643, 1006, 1063, 19204, 1024, 3229, 18715, 2368, 1065, 1007, 1012, 2059, 1006, 3853, 2059, 1006, 2944,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/Component.js
runWithOwner
function runWithOwner(fn, sOwnerId, oThisArg) { assert(typeof fn === "function", "fn must be a function"); var oldOwnerId = ManagedObject._sOwnerId; try { ManagedObject._sOwnerId = sOwnerId; return fn.call(oThisArg); } finally { ManagedObject._sOwnerId = oldOwnerId; } }
javascript
function runWithOwner(fn, sOwnerId, oThisArg) { assert(typeof fn === "function", "fn must be a function"); var oldOwnerId = ManagedObject._sOwnerId; try { ManagedObject._sOwnerId = sOwnerId; return fn.call(oThisArg); } finally { ManagedObject._sOwnerId = oldOwnerId; } }
[ "function", "runWithOwner", "(", "fn", ",", "sOwnerId", ",", "oThisArg", ")", "{", "assert", "(", "typeof", "fn", "===", "\"function\"", ",", "\"fn must be a function\"", ")", ";", "var", "oldOwnerId", "=", "ManagedObject", ".", "_sOwnerId", ";", "try", "{", ...
Calls the function <code>fn</code> once and marks all ManagedObjects created during that call as "owned" by the given ID. @param {function} fn Function to execute @param {string} sOwnerId Id of the owner @param {Object} [oThisArg=undefined] Value to use as <code>this</code> when executing <code>fn</code> @return {any} result of function <code>fn</code>
[ "Calls", "the", "function", "<code", ">", "fn<", "/", "code", ">", "once", "and", "marks", "all", "ManagedObjects", "created", "during", "that", "call", "as", "owned", "by", "the", "given", "ID", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/Component.js#L182-L194
train
Runs a function on the specified object and returns the result
[ 30522, 3853, 2448, 24415, 12384, 2121, 1006, 1042, 2078, 1010, 2061, 7962, 11124, 2094, 1010, 27178, 24158, 2906, 2290, 1007, 1063, 20865, 1006, 2828, 11253, 1042, 2078, 1027, 1027, 1027, 1000, 3853, 1000, 1010, 1000, 1042, 2078, 2442, 2022...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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.dt/src/sap/ui/dt/ContextMenuControl.js
function (aButtons) { var iVisibleButtons = 0; for (var i = 0; i < aButtons.length; i++) { if (iVisibleButtons < this.getMaxButtonsDisplayed() && aButtons[i].getVisible()) { iVisibleButtons++; } else { aButtons[i].setVisible(false); } } return iVisibleButtons; }
javascript
function (aButtons) { var iVisibleButtons = 0; for (var i = 0; i < aButtons.length; i++) { if (iVisibleButtons < this.getMaxButtonsDisplayed() && aButtons[i].getVisible()) { iVisibleButtons++; } else { aButtons[i].setVisible(false); } } return iVisibleButtons; }
[ "function", "(", "aButtons", ")", "{", "var", "iVisibleButtons", "=", "0", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "aButtons", ".", "length", ";", "i", "++", ")", "{", "if", "(", "iVisibleButtons", "<", "this", ".", "getMaxButtonsDispla...
Hides the buttons in overflow @param {array} aButtons some Buttons @return {int} the number of visible buttons
[ "Hides", "the", "buttons", "in", "overflow" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.dt/src/sap/ui/dt/ContextMenuControl.js#L285-L296
train
Sets the visibility of the buttons
[ 30522, 3853, 1006, 8273, 15474, 2015, 1007, 1063, 13075, 4921, 17417, 3468, 8569, 15474, 2015, 1027, 1014, 1025, 2005, 1006, 13075, 1045, 1027, 1014, 1025, 1045, 1026, 8273, 15474, 2015, 1012, 3091, 1025, 1045, 1009, 1009, 1007, 1063, 2065,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
firebase/firebase-js-sdk
packages/auth/demo/public/script.js
checkDatabaseAuthAccess
function checkDatabaseAuthAccess() { var randomString = Math.floor(Math.random() * 10000000).toString(); var dbRef; var dbPath; var errMessage; // Run this check only when Database module is available. if (typeof firebase !== 'undefined' && typeof firebase.database !== 'undefined') { if (lastUser && !firebase.auth().currentUser) { dbPath = 'users/' + lastUser.uid; // After sign out, confirm read/write access to users/$user_id blocked. dbRef = firebase.database().ref(dbPath); dbRef.set({ 'test': randomString }).then(function() { alertError( 'Error: Unauthenticated write to Database node ' + dbPath + ' unexpectedly succeeded!'); }).catch(function(error) { errMessage = error.message.toLowerCase(); // Permission denied error should be thrown. if (errMessage.indexOf('permission_denied') == -1) { alertError('Error: ' + error.code); return; } dbRef.once('value') .then(function() { alertError('Error: Unauthenticated read to Database node ' + dbPath + ' unexpectedly succeeded!'); }).catch(function(error) { errMessage = error.message.toLowerCase(); // Permission denied error should be thrown. if (errMessage.indexOf('permission_denied') == -1) { alertError('Error: ' + error.code); return; } log('Unauthenticated read/write to Database node ' + dbPath + ' failed as expected!'); }); }); } else if (firebase.auth().currentUser) { dbPath = 'users/' + firebase.auth().currentUser.uid; // Confirm read/write access to users/$user_id allowed. dbRef = firebase.database().ref(dbPath); dbRef.set({ 'test': randomString }).then(function() { return dbRef.once('value'); }).then(function(snapshot) { if (snapshot.val().test === randomString) { // read/write successful. log('Authenticated read/write to Database node ' + dbPath + ' succeeded!'); } else { throw new Error('Authenticated read/write to Database node ' + dbPath + ' failed!'); } // Clean up: clear that node's content. return dbRef.remove(); }).catch(function(error) { alertError('Error: ' + error.code); }); } } }
javascript
function checkDatabaseAuthAccess() { var randomString = Math.floor(Math.random() * 10000000).toString(); var dbRef; var dbPath; var errMessage; // Run this check only when Database module is available. if (typeof firebase !== 'undefined' && typeof firebase.database !== 'undefined') { if (lastUser && !firebase.auth().currentUser) { dbPath = 'users/' + lastUser.uid; // After sign out, confirm read/write access to users/$user_id blocked. dbRef = firebase.database().ref(dbPath); dbRef.set({ 'test': randomString }).then(function() { alertError( 'Error: Unauthenticated write to Database node ' + dbPath + ' unexpectedly succeeded!'); }).catch(function(error) { errMessage = error.message.toLowerCase(); // Permission denied error should be thrown. if (errMessage.indexOf('permission_denied') == -1) { alertError('Error: ' + error.code); return; } dbRef.once('value') .then(function() { alertError('Error: Unauthenticated read to Database node ' + dbPath + ' unexpectedly succeeded!'); }).catch(function(error) { errMessage = error.message.toLowerCase(); // Permission denied error should be thrown. if (errMessage.indexOf('permission_denied') == -1) { alertError('Error: ' + error.code); return; } log('Unauthenticated read/write to Database node ' + dbPath + ' failed as expected!'); }); }); } else if (firebase.auth().currentUser) { dbPath = 'users/' + firebase.auth().currentUser.uid; // Confirm read/write access to users/$user_id allowed. dbRef = firebase.database().ref(dbPath); dbRef.set({ 'test': randomString }).then(function() { return dbRef.once('value'); }).then(function(snapshot) { if (snapshot.val().test === randomString) { // read/write successful. log('Authenticated read/write to Database node ' + dbPath + ' succeeded!'); } else { throw new Error('Authenticated read/write to Database node ' + dbPath + ' failed!'); } // Clean up: clear that node's content. return dbRef.remove(); }).catch(function(error) { alertError('Error: ' + error.code); }); } } }
[ "function", "checkDatabaseAuthAccess", "(", ")", "{", "var", "randomString", "=", "Math", ".", "floor", "(", "Math", ".", "random", "(", ")", "*", "10000000", ")", ".", "toString", "(", ")", ";", "var", "dbRef", ";", "var", "dbPath", ";", "var", "errMe...
Provides basic Database checks for authenticated and unauthenticated access. The Database node being tested has the following rule: "users": { "$user_id": { ".read": "$user_id === auth.uid", ".write": "$user_id === auth.uid" } } This applies when Real-time database service is available.
[ "Provides", "basic", "Database", "checks", "for", "authenticated", "and", "unauthenticated", "access", ".", "The", "Database", "node", "being", "tested", "has", "the", "following", "rule", ":", "users", ":", "{", "$user_id", ":", "{", ".", "read", ":", "$use...
491598a499813dacc23724de5e237ec220cc560e
https://github.com/firebase/firebase-js-sdk/blob/491598a499813dacc23724de5e237ec220cc560e/packages/auth/demo/public/script.js#L1185-L1249
train
Checks if Database Auth is allowed.
[ 30522, 3853, 4638, 2850, 2696, 15058, 4887, 8322, 9468, 7971, 1006, 1007, 1063, 13075, 6721, 3367, 4892, 1027, 8785, 1012, 2723, 1006, 8785, 1012, 6721, 1006, 1007, 1008, 6694, 8889, 8889, 1007, 1012, 2000, 3367, 4892, 1006, 1007, 1025, 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...
goldfire/howler.js
dist/howler.js
function(id) { var self = this; var sound = self._soundById(id); if (sound && sound._interval) { if (self._webAudio) { sound._node.gain.cancelScheduledValues(Howler.ctx.currentTime); } clearInterval(sound._interval); sound._interval = null; self.volume(sound._fadeTo, id); sound._fadeTo = null; self._emit('fade', id); } return self; }
javascript
function(id) { var self = this; var sound = self._soundById(id); if (sound && sound._interval) { if (self._webAudio) { sound._node.gain.cancelScheduledValues(Howler.ctx.currentTime); } clearInterval(sound._interval); sound._interval = null; self.volume(sound._fadeTo, id); sound._fadeTo = null; self._emit('fade', id); } return self; }
[ "function", "(", "id", ")", "{", "var", "self", "=", "this", ";", "var", "sound", "=", "self", ".", "_soundById", "(", "id", ")", ";", "if", "(", "sound", "&&", "sound", ".", "_interval", ")", "{", "if", "(", "self", ".", "_webAudio", ")", "{", ...
Internal method that stops the currently playing fade when a new fade starts, volume is changed or the sound is stopped. @param {Number} id The sound id. @return {Howl}
[ "Internal", "method", "that", "stops", "the", "currently", "playing", "fade", "when", "a", "new", "fade", "starts", "volume", "is", "changed", "or", "the", "sound", "is", "stopped", "." ]
030db918dd8ce640afd57e172418472497e8f113
https://github.com/goldfire/howler.js/blob/030db918dd8ce640afd57e172418472497e8f113/dist/howler.js#L1376-L1393
train
fade a sound
[ 30522, 3853, 1006, 8909, 1007, 1063, 13075, 2969, 1027, 2023, 1025, 13075, 2614, 1027, 2969, 1012, 1035, 2614, 3762, 3593, 1006, 8909, 1007, 1025, 2065, 1006, 2614, 1004, 1004, 2614, 1012, 1035, 13483, 1007, 1063, 2065, 1006, 2969, 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.core/src/sap/ui/model/odata/v4/ODataMetaModel.js
getQualifier
function getQualifier(sTerm, sExpectedTerm) { if (sTerm === sExpectedTerm) { return ""; } if (sTerm.indexOf(sExpectedTerm) === 0 && sTerm[sExpectedTerm.length] === "#" && sTerm.indexOf("@", sExpectedTerm.length) < 0) { return sTerm.slice(sExpectedTerm.length + 1); } }
javascript
function getQualifier(sTerm, sExpectedTerm) { if (sTerm === sExpectedTerm) { return ""; } if (sTerm.indexOf(sExpectedTerm) === 0 && sTerm[sExpectedTerm.length] === "#" && sTerm.indexOf("@", sExpectedTerm.length) < 0) { return sTerm.slice(sExpectedTerm.length + 1); } }
[ "function", "getQualifier", "(", "sTerm", ",", "sExpectedTerm", ")", "{", "if", "(", "sTerm", "===", "sExpectedTerm", ")", "{", "return", "\"\"", ";", "}", "if", "(", "sTerm", ".", "indexOf", "(", "sExpectedTerm", ")", "===", "0", "&&", "sTerm", "[", "...
Checks that the term is the expected term and determines the qualifier. @param {string} sTerm The term @param {string} sExpectedTerm The expected term @returns {string} The qualifier or undefined, if the term is not the expected term
[ "Checks", "that", "the", "term", "is", "the", "expected", "term", "and", "determines", "the", "qualifier", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/v4/ODataMetaModel.js#L221-L229
train
Returns the qualifier of the term
[ 30522, 3853, 2131, 26426, 18095, 1006, 26261, 10867, 1010, 3348, 5051, 10985, 3334, 2213, 1007, 1063, 2065, 1006, 26261, 10867, 1027, 1027, 1027, 3348, 5051, 10985, 3334, 2213, 1007, 1063, 2709, 1000, 1000, 1025, 1065, 2065, 1006, 26261, 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...
wangfupeng1988/wangEditor
src/js/text/index.js
function () { const editor = this.editor const $textElem = editor.$textElem // 为图片增加 selected 样式 $textElem.on('click', 'img', function (e) { const img = this const $img = $(img) if ($img.attr('data-w-e') === '1') { // 是表情图片,忽略 return } // 记录当前点击过的图片 editor._selectedImg = $img // 修改选区并 restore ,防止用户此时点击退格键,会删除其他内容 editor.selection.createRangeByElem($img) editor.selection.restoreSelection() }) // 去掉图片的 selected 样式 $textElem.on('click keyup', e => { if (e.target.matches('img')) { // 点击的是图片,忽略 return } // 删除记录 editor._selectedImg = null }) }
javascript
function () { const editor = this.editor const $textElem = editor.$textElem // 为图片增加 selected 样式 $textElem.on('click', 'img', function (e) { const img = this const $img = $(img) if ($img.attr('data-w-e') === '1') { // 是表情图片,忽略 return } // 记录当前点击过的图片 editor._selectedImg = $img // 修改选区并 restore ,防止用户此时点击退格键,会删除其他内容 editor.selection.createRangeByElem($img) editor.selection.restoreSelection() }) // 去掉图片的 selected 样式 $textElem.on('click keyup', e => { if (e.target.matches('img')) { // 点击的是图片,忽略 return } // 删除记录 editor._selectedImg = null }) }
[ "function", "(", ")", "{", "const", "editor", "=", "this", ".", "editor", "const", "$textElem", "=", "editor", ".", "$textElem", "// 为图片增加 selected 样式", "$textElem", ".", "on", "(", "'click'", ",", "'img'", ",", "function", "(", "e", ")", "{", "const", "...
img 点击
[ "img", "点击" ]
b77696f5e81c8ec13d9d341252d6b9fa8a22db18
https://github.com/wangfupeng1988/wangEditor/blob/b77696f5e81c8ec13d9d341252d6b9fa8a22db18/src/js/text/index.js#L494-L525
train
Select the image
[ 30522, 3853, 1006, 1007, 1063, 9530, 3367, 3559, 1027, 2023, 1012, 3559, 9530, 3367, 1002, 3793, 12260, 2213, 1027, 3559, 1012, 1002, 3793, 12260, 2213, 1013, 1013, 100, 100, 100, 100, 1779, 3479, 100, 100, 1002, 3793, 12260, 2213, 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...
SheetJS/js-xlsx
xlsx.js
read_bits_n
function read_bits_n(buf, bl, n) { var w = (bl&7), h = (bl>>>3), f = ((1<<n)-1); var v = buf[h] >>> w; if(n < 8 - w) return v & f; v |= buf[h+1]<<(8-w); if(n < 16 - w) return v & f; v |= buf[h+2]<<(16-w); if(n < 24 - w) return v & f; v |= buf[h+3]<<(24-w); return v & f; }
javascript
function read_bits_n(buf, bl, n) { var w = (bl&7), h = (bl>>>3), f = ((1<<n)-1); var v = buf[h] >>> w; if(n < 8 - w) return v & f; v |= buf[h+1]<<(8-w); if(n < 16 - w) return v & f; v |= buf[h+2]<<(16-w); if(n < 24 - w) return v & f; v |= buf[h+3]<<(24-w); return v & f; }
[ "function", "read_bits_n", "(", "buf", ",", "bl", ",", "n", ")", "{", "var", "w", "=", "(", "bl", "&", "7", ")", ",", "h", "=", "(", "bl", ">>>", "3", ")", ",", "f", "=", "(", "(", "1", "<<", "n", ")", "-", "1", ")", ";", "var", "v", ...
/* works up to n = 3 * 8 + 1 = 25
[ "/", "*", "works", "up", "to", "n", "=", "3", "*", "8", "+", "1", "=", "25" ]
9a6d8a1d3d80c78dad5201fb389316f935279cdc
https://github.com/SheetJS/js-xlsx/blob/9a6d8a1d3d80c78dad5201fb389316f935279cdc/xlsx.js#L2006-L2016
train
read n bits from buffer
[ 30522, 3853, 3191, 1035, 9017, 1035, 1050, 1006, 20934, 2546, 1010, 1038, 2140, 1010, 1050, 1007, 1063, 13075, 1059, 1027, 1006, 1038, 2140, 1004, 1021, 1007, 1010, 1044, 1027, 1006, 1038, 2140, 1028, 1028, 1028, 1017, 1007, 1010, 1042, 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...
angular/material
src/core/util/util.js
function(template) { if (usesStandardSymbols) { return template; } else { if (!template || !angular.isString(template)) return template; return template.replace(/\{\{/g, startSymbol).replace(/}}/g, endSymbol); } }
javascript
function(template) { if (usesStandardSymbols) { return template; } else { if (!template || !angular.isString(template)) return template; return template.replace(/\{\{/g, startSymbol).replace(/}}/g, endSymbol); } }
[ "function", "(", "template", ")", "{", "if", "(", "usesStandardSymbols", ")", "{", "return", "template", ";", "}", "else", "{", "if", "(", "!", "template", "||", "!", "angular", ".", "isString", "(", "template", ")", ")", "return", "template", ";", "re...
Processes a template and replaces the start/end symbols if the application has overridden them. @param template The template to process whose start/end tags may be replaced. @returns {*}
[ "Processes", "a", "template", "and", "replaces", "the", "start", "/", "end", "symbols", "if", "the", "application", "has", "overridden", "them", "." ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/core/util/util.js#L721-L728
train
Returns the template string
[ 30522, 3853, 1006, 23561, 1007, 1063, 2065, 1006, 3594, 21515, 18117, 24335, 14956, 2015, 1007, 1063, 2709, 23561, 1025, 1065, 2842, 1063, 2065, 1006, 999, 23561, 1064, 1064, 999, 16108, 1012, 26354, 18886, 3070, 1006, 23561, 1007, 1007, 27...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
LLK/scratch-blocks
blocks_vertical/data.js
function() { this.jsonInit({ "message0": Blockly.Msg.DATA_ITEMOFLIST, "args0": [ { "type": "input_value", "name": "INDEX" }, { "type": "field_variable", "name": "LIST", "variableTypes": [Blockly.LIST_VARIABLE_TYPE] } ], "output": null, "category": Blockly.Categories.dataLists, "extensions": ["colours_data_lists"], "outputShape": Blockly.OUTPUT_SHAPE_ROUND }); }
javascript
function() { this.jsonInit({ "message0": Blockly.Msg.DATA_ITEMOFLIST, "args0": [ { "type": "input_value", "name": "INDEX" }, { "type": "field_variable", "name": "LIST", "variableTypes": [Blockly.LIST_VARIABLE_TYPE] } ], "output": null, "category": Blockly.Categories.dataLists, "extensions": ["colours_data_lists"], "outputShape": Blockly.OUTPUT_SHAPE_ROUND }); }
[ "function", "(", ")", "{", "this", ".", "jsonInit", "(", "{", "\"message0\"", ":", "Blockly", ".", "Msg", ".", "DATA_ITEMOFLIST", ",", "\"args0\"", ":", "[", "{", "\"type\"", ":", "\"input_value\"", ",", "\"name\"", ":", "\"INDEX\"", "}", ",", "{", "\"ty...
Block for reporting item of list. @this Blockly.Block
[ "Block", "for", "reporting", "item", "of", "list", "." ]
455b2a854435c0a67da1da92320ddc3ec3e2b799
https://github.com/LLK/scratch-blocks/blob/455b2a854435c0a67da1da92320ddc3ec3e2b799/blocks_vertical/data.js#L365-L384
train
Block for the .
[ 30522, 3853, 1006, 1007, 1063, 2023, 1012, 1046, 3385, 5498, 2102, 1006, 1063, 1000, 4471, 2692, 1000, 1024, 3796, 2135, 1012, 5796, 2290, 1012, 2951, 1035, 8875, 11253, 9863, 1010, 1000, 12098, 5620, 2692, 1000, 1024, 1031, 1063, 1000, 2...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.core/src/sap/ui/base/ManagedObject.js
getStashedControls
function getStashedControls(sId) { if (!StashedControlSupport) { StashedControlSupport = sap.ui.require("sap/ui/core/StashedControlSupport"); } if (StashedControlSupport) { return StashedControlSupport.getStashedControls(sId); } return []; }
javascript
function getStashedControls(sId) { if (!StashedControlSupport) { StashedControlSupport = sap.ui.require("sap/ui/core/StashedControlSupport"); } if (StashedControlSupport) { return StashedControlSupport.getStashedControls(sId); } return []; }
[ "function", "getStashedControls", "(", "sId", ")", "{", "if", "(", "!", "StashedControlSupport", ")", "{", "StashedControlSupport", "=", "sap", ".", "ui", ".", "require", "(", "\"sap/ui/core/StashedControlSupport\"", ")", ";", "}", "if", "(", "StashedControlSuppor...
Returns an array of stashed child elements or an empty array if there are none. @param {string} sId id of the object which should have stashed children @return {sap.ui.core._StashedControl[]} array of stashed children @private
[ "Returns", "an", "array", "of", "stashed", "child", "elements", "or", "an", "empty", "array", "if", "there", "are", "none", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/base/ManagedObject.js#L970-L978
train
Returns an array of all stashed control instances.
[ 30522, 3853, 4152, 10230, 9072, 8663, 13181, 4877, 1006, 15765, 1007, 1063, 2065, 1006, 999, 2358, 11823, 2098, 8663, 13181, 4877, 6279, 6442, 1007, 1063, 2358, 11823, 2098, 8663, 13181, 4877, 6279, 6442, 1027, 20066, 1012, 21318, 1012, 547...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/yield-star-spacing.js
checkExpression
function checkExpression(node) { if (!node.delegate) { return; } const tokens = sourceCode.getFirstTokens(node, 3); const yieldToken = tokens[0]; const starToken = tokens[1]; const nextToken = tokens[2]; checkSpacing("before", yieldToken, starToken); checkSpacing("after", starToken, nextToken); }
javascript
function checkExpression(node) { if (!node.delegate) { return; } const tokens = sourceCode.getFirstTokens(node, 3); const yieldToken = tokens[0]; const starToken = tokens[1]; const nextToken = tokens[2]; checkSpacing("before", yieldToken, starToken); checkSpacing("after", starToken, nextToken); }
[ "function", "checkExpression", "(", "node", ")", "{", "if", "(", "!", "node", ".", "delegate", ")", "{", "return", ";", "}", "const", "tokens", "=", "sourceCode", ".", "getFirstTokens", "(", "node", ",", "3", ")", ";", "const", "yieldToken", "=", "toke...
Enforces the spacing around the star if node is a yield* expression. @param {ASTNode} node A yield expression node. @returns {void}
[ "Enforces", "the", "spacing", "around", "the", "star", "if", "node", "is", "a", "yield", "*", "expression", "." ]
bc0819c94aad14f7fad3cbc2338ea15658b0f272
https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/yield-star-spacing.js#L108-L120
train
Check if the expression is a yield or a star expression.
[ 30522, 3853, 4638, 10288, 20110, 3258, 1006, 13045, 1007, 1063, 2065, 1006, 999, 13045, 1012, 11849, 1007, 1063, 2709, 1025, 1065, 9530, 3367, 19204, 2015, 1027, 3120, 16044, 1012, 2131, 8873, 12096, 18715, 6132, 1006, 13045, 1010, 1017, 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...
eslint/eslint
lib/rules/no-restricted-properties.js
checkPropertyAccess
function checkPropertyAccess(node, objectName, propertyName) { if (propertyName === null) { return; } const matchedObject = restrictedProperties.get(objectName); const matchedObjectProperty = matchedObject ? matchedObject.get(propertyName) : globallyRestrictedObjects.get(objectName); const globalMatchedProperty = globallyRestrictedProperties.get(propertyName); if (matchedObjectProperty) { const message = matchedObjectProperty.message ? ` ${matchedObjectProperty.message}` : ""; context.report({ node, // eslint-disable-next-line eslint-plugin/report-message-format message: "'{{objectName}}.{{propertyName}}' is restricted from being used.{{message}}", data: { objectName, propertyName, message } }); } else if (globalMatchedProperty) { const message = globalMatchedProperty.message ? ` ${globalMatchedProperty.message}` : ""; context.report({ node, // eslint-disable-next-line eslint-plugin/report-message-format message: "'{{propertyName}}' is restricted from being used.{{message}}", data: { propertyName, message } }); } }
javascript
function checkPropertyAccess(node, objectName, propertyName) { if (propertyName === null) { return; } const matchedObject = restrictedProperties.get(objectName); const matchedObjectProperty = matchedObject ? matchedObject.get(propertyName) : globallyRestrictedObjects.get(objectName); const globalMatchedProperty = globallyRestrictedProperties.get(propertyName); if (matchedObjectProperty) { const message = matchedObjectProperty.message ? ` ${matchedObjectProperty.message}` : ""; context.report({ node, // eslint-disable-next-line eslint-plugin/report-message-format message: "'{{objectName}}.{{propertyName}}' is restricted from being used.{{message}}", data: { objectName, propertyName, message } }); } else if (globalMatchedProperty) { const message = globalMatchedProperty.message ? ` ${globalMatchedProperty.message}` : ""; context.report({ node, // eslint-disable-next-line eslint-plugin/report-message-format message: "'{{propertyName}}' is restricted from being used.{{message}}", data: { propertyName, message } }); } }
[ "function", "checkPropertyAccess", "(", "node", ",", "objectName", ",", "propertyName", ")", "{", "if", "(", "propertyName", "===", "null", ")", "{", "return", ";", "}", "const", "matchedObject", "=", "restrictedProperties", ".", "get", "(", "objectName", ")",...
Checks to see whether a property access is restricted, and reports it if so. @param {ASTNode} node The node to report @param {string} objectName The name of the object @param {string} propertyName The name of the property @returns {undefined}
[ "Checks", "to", "see", "whether", "a", "property", "access", "is", "restricted", "and", "reports", "it", "if", "so", "." ]
bc0819c94aad14f7fad3cbc2338ea15658b0f272
https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/no-restricted-properties.js#L104-L138
train
Check if a property is restricted from being used.
[ 30522, 3853, 4638, 21572, 4842, 21426, 9468, 7971, 1006, 13045, 1010, 4874, 18442, 1010, 3200, 18442, 1007, 1063, 2065, 1006, 3200, 18442, 1027, 1027, 1027, 19701, 1007, 1063, 2709, 1025, 1065, 9530, 3367, 10349, 16429, 20614, 1027, 7775, 2...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.table/src/sap/ui/table/TableUtils.js
function(oTable, row) { if (isNaN(row)) { var $Ref = jQuery(row); row = parseInt($Ref.add($Ref.parent()).filter("[data-sap-ui-rowindex]").attr("data-sap-ui-rowindex")); } var iFixed = oTable.getFixedBottomRowCount() || 0; return row == oTable.getVisibleRowCount() - iFixed - 1; }
javascript
function(oTable, row) { if (isNaN(row)) { var $Ref = jQuery(row); row = parseInt($Ref.add($Ref.parent()).filter("[data-sap-ui-rowindex]").attr("data-sap-ui-rowindex")); } var iFixed = oTable.getFixedBottomRowCount() || 0; return row == oTable.getVisibleRowCount() - iFixed - 1; }
[ "function", "(", "oTable", ",", "row", ")", "{", "if", "(", "isNaN", "(", "row", ")", ")", "{", "var", "$Ref", "=", "jQuery", "(", "row", ")", ";", "row", "=", "parseInt", "(", "$Ref", ".", "add", "(", "$Ref", ".", "parent", "(", ")", ")", "....
Checks whether the cell of the given DOM reference is in the last row (from DOM point of view) of the scrollable area. @param {sap.ui.table.Table} oTable Instance of the table. @param {jQuery | HTMLElement | int} row The row element or row index. @returns {boolean} Whether the row is the last scrollable row of the table based on the data.
[ "Checks", "whether", "the", "cell", "of", "the", "given", "DOM", "reference", "is", "in", "the", "last", "row", "(", "from", "DOM", "point", "of", "view", ")", "of", "the", "scrollable", "area", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TableUtils.js#L1009-L1016
train
Returns true if the row is in the bottom of the table
[ 30522, 3853, 1006, 27178, 3085, 1010, 5216, 1007, 1063, 2065, 1006, 3475, 2319, 1006, 5216, 1007, 1007, 1063, 13075, 1002, 25416, 1027, 1046, 4226, 2854, 1006, 5216, 1007, 1025, 5216, 1027, 11968, 20240, 3372, 1006, 1002, 25416, 1012, 5587,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
sass/node-sass
lib/index.js
getSourceMap
function getSourceMap(options) { var sourceMap = options.sourceMap; if (sourceMap && typeof sourceMap !== 'string' && options.outFile) { sourceMap = options.outFile + '.map'; } return sourceMap && typeof sourceMap === 'string' ? path.resolve(sourceMap) : null; }
javascript
function getSourceMap(options) { var sourceMap = options.sourceMap; if (sourceMap && typeof sourceMap !== 'string' && options.outFile) { sourceMap = options.outFile + '.map'; } return sourceMap && typeof sourceMap === 'string' ? path.resolve(sourceMap) : null; }
[ "function", "getSourceMap", "(", "options", ")", "{", "var", "sourceMap", "=", "options", ".", "sourceMap", ";", "if", "(", "sourceMap", "&&", "typeof", "sourceMap", "!==", "'string'", "&&", "options", ".", "outFile", ")", "{", "sourceMap", "=", "options", ...
Get source map @param {Object} options @api private
[ "Get", "source", "map" ]
0c1a49eefa37544d16041c5fe5b2e3d9168004b7
https://github.com/sass/node-sass/blob/0c1a49eefa37544d16041c5fe5b2e3d9168004b7/lib/index.js#L51-L59
train
Get the source map path
[ 30522, 3853, 4152, 8162, 3401, 2863, 2361, 1006, 7047, 1007, 1063, 13075, 3120, 2863, 2361, 1027, 7047, 1012, 3120, 2863, 2361, 1025, 2065, 1006, 3120, 2863, 2361, 1004, 1004, 2828, 11253, 3120, 2863, 2361, 999, 1027, 1027, 1005, 5164, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
babel/babel
packages/babel-generator/src/generators/statements.js
getLastStatement
function getLastStatement(statement) { if (!t.isStatement(statement.body)) return statement; return getLastStatement(statement.body); }
javascript
function getLastStatement(statement) { if (!t.isStatement(statement.body)) return statement; return getLastStatement(statement.body); }
[ "function", "getLastStatement", "(", "statement", ")", "{", "if", "(", "!", "t", ".", "isStatement", "(", "statement", ".", "body", ")", ")", "return", "statement", ";", "return", "getLastStatement", "(", "statement", ".", "body", ")", ";", "}" ]
Recursively get the last statement.
[ "Recursively", "get", "the", "last", "statement", "." ]
1969e6b6aa7d90be3fbb3aca98ea96849656a55a
https://github.com/babel/babel/blob/1969e6b6aa7d90be3fbb3aca98ea96849656a55a/packages/babel-generator/src/generators/statements.js#L45-L48
train
Returns the last statement in the body of a given statement
[ 30522, 3853, 2131, 8523, 3215, 12259, 3672, 1006, 4861, 1007, 1063, 2065, 1006, 999, 1056, 1012, 26354, 12259, 3672, 1006, 4861, 1012, 2303, 1007, 1007, 2709, 4861, 1025, 2709, 2131, 8523, 3215, 12259, 3672, 1006, 4861, 1012, 2303, 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...
BlackrockDigital/startbootstrap-sb-admin-2
vendor/chart.js/Chart.js
function(point, area) { var epsilon = 1e-6; // 1e-6 is margin in pixels for accumulated error. return point.x > area.left - epsilon && point.x < area.right + epsilon && point.y > area.top - epsilon && point.y < area.bottom + epsilon; }
javascript
function(point, area) { var epsilon = 1e-6; // 1e-6 is margin in pixels for accumulated error. return point.x > area.left - epsilon && point.x < area.right + epsilon && point.y > area.top - epsilon && point.y < area.bottom + epsilon; }
[ "function", "(", "point", ",", "area", ")", "{", "var", "epsilon", "=", "1e-6", ";", "// 1e-6 is margin in pixels for accumulated error.", "return", "point", ".", "x", ">", "area", ".", "left", "-", "epsilon", "&&", "point", ".", "x", "<", "area", ".", "ri...
Returns true if the point is inside the rectangle @param {object} point - The point to test @param {object} area - The rectangle @returns {boolean} @private
[ "Returns", "true", "if", "the", "point", "is", "inside", "the", "rectangle" ]
ddfaceb4a8e65a41f163e2fdc4eab49384b810a1
https://github.com/BlackrockDigital/startbootstrap-sb-admin-2/blob/ddfaceb4a8e65a41f163e2fdc4eab49384b810a1/vendor/chart.js/Chart.js#L2458-L2463
train
Check if point is within area
[ 30522, 3853, 1006, 2391, 1010, 2181, 1007, 1063, 13075, 28038, 1027, 1015, 2063, 1011, 1020, 1025, 1013, 1013, 1015, 2063, 1011, 1020, 2003, 7785, 1999, 27725, 2005, 14830, 7561, 1012, 2709, 2391, 1012, 1060, 1028, 2181, 1012, 2187, 1011, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.core/src/sap/ui/core/support/techinfo/moduleTreeHelper.js
function (oTree) { var sDebugString = this.toDebugInfo(oTree); if (sDebugString === true) { return 1; } else if (sDebugString) { return sDebugString.split(",").length; } return 0; }
javascript
function (oTree) { var sDebugString = this.toDebugInfo(oTree); if (sDebugString === true) { return 1; } else if (sDebugString) { return sDebugString.split(",").length; } return 0; }
[ "function", "(", "oTree", ")", "{", "var", "sDebugString", "=", "this", ".", "toDebugInfo", "(", "oTree", ")", ";", "if", "(", "sDebugString", "===", "true", ")", "{", "return", "1", ";", "}", "else", "if", "(", "sDebugString", ")", "{", "return", "s...
Calculates the number of currently selected debug modules @param {object} oTree The tree to be analyzed @return {int} The amount of selected tree nodes
[ "Calculates", "the", "number", "of", "currently", "selected", "debug", "modules" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/support/techinfo/moduleTreeHelper.js#L298-L307
train
Returns the number of nodes in the tree that are not in debug info.
[ 30522, 3853, 1006, 27178, 9910, 1007, 1063, 13075, 17371, 15878, 15916, 3367, 4892, 1027, 2023, 1012, 28681, 15878, 15916, 2378, 14876, 1006, 27178, 9910, 1007, 1025, 2065, 1006, 17371, 15878, 15916, 3367, 4892, 1027, 1027, 1027, 2995, 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...
eslint/eslint
lib/rules/function-paren-newline.js
getParenTokens
function getParenTokens(node) { switch (node.type) { case "NewExpression": if (!node.arguments.length && !( astUtils.isOpeningParenToken(sourceCode.getLastToken(node, { skip: 1 })) && astUtils.isClosingParenToken(sourceCode.getLastToken(node)) )) { // If the NewExpression does not have parens (e.g. `new Foo`), return null. return null; } // falls through case "CallExpression": return { leftParen: sourceCode.getTokenAfter(node.callee, astUtils.isOpeningParenToken), rightParen: sourceCode.getLastToken(node) }; case "FunctionDeclaration": case "FunctionExpression": { const leftParen = sourceCode.getFirstToken(node, astUtils.isOpeningParenToken); const rightParen = node.params.length ? sourceCode.getTokenAfter(node.params[node.params.length - 1], astUtils.isClosingParenToken) : sourceCode.getTokenAfter(leftParen); return { leftParen, rightParen }; } case "ArrowFunctionExpression": { const firstToken = sourceCode.getFirstToken(node); if (!astUtils.isOpeningParenToken(firstToken)) { // If the ArrowFunctionExpression has a single param without parens, return null. return null; } return { leftParen: firstToken, rightParen: sourceCode.getTokenBefore(node.body, astUtils.isClosingParenToken) }; } default: throw new TypeError(`unexpected node with type ${node.type}`); } }
javascript
function getParenTokens(node) { switch (node.type) { case "NewExpression": if (!node.arguments.length && !( astUtils.isOpeningParenToken(sourceCode.getLastToken(node, { skip: 1 })) && astUtils.isClosingParenToken(sourceCode.getLastToken(node)) )) { // If the NewExpression does not have parens (e.g. `new Foo`), return null. return null; } // falls through case "CallExpression": return { leftParen: sourceCode.getTokenAfter(node.callee, astUtils.isOpeningParenToken), rightParen: sourceCode.getLastToken(node) }; case "FunctionDeclaration": case "FunctionExpression": { const leftParen = sourceCode.getFirstToken(node, astUtils.isOpeningParenToken); const rightParen = node.params.length ? sourceCode.getTokenAfter(node.params[node.params.length - 1], astUtils.isClosingParenToken) : sourceCode.getTokenAfter(leftParen); return { leftParen, rightParen }; } case "ArrowFunctionExpression": { const firstToken = sourceCode.getFirstToken(node); if (!astUtils.isOpeningParenToken(firstToken)) { // If the ArrowFunctionExpression has a single param without parens, return null. return null; } return { leftParen: firstToken, rightParen: sourceCode.getTokenBefore(node.body, astUtils.isClosingParenToken) }; } default: throw new TypeError(`unexpected node with type ${node.type}`); } }
[ "function", "getParenTokens", "(", "node", ")", "{", "switch", "(", "node", ".", "type", ")", "{", "case", "\"NewExpression\"", ":", "if", "(", "!", "node", ".", "arguments", ".", "length", "&&", "!", "(", "astUtils", ".", "isOpeningParenToken", "(", "so...
Gets the left paren and right paren tokens of a node. @param {ASTNode} node The node with parens @returns {Object} An object with keys `leftParen` for the left paren token, and `rightParen` for the right paren token. Can also return `null` if an expression has no parens (e.g. a NewExpression with no arguments, or an ArrowFunctionExpression with a single parameter)
[ "Gets", "the", "left", "paren", "and", "right", "paren", "tokens", "of", "a", "node", "." ]
bc0819c94aad14f7fad3cbc2338ea15658b0f272
https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/function-paren-newline.js#L190-L238
train
Gets the left and right parens of a given node
[ 30522, 3853, 2131, 19362, 4765, 11045, 3619, 1006, 13045, 1007, 1063, 6942, 1006, 13045, 1012, 2828, 1007, 1063, 2553, 1000, 2047, 10288, 20110, 3258, 1000, 1024, 2065, 1006, 999, 13045, 1012, 9918, 1012, 3091, 1004, 1004, 999, 1006, 2004, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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
build/transpile.js
createFolderRecursively
function createFolderRecursively (folder) { const parts = folder.split (path.sep) for (let i = 1; i <= parts.length; i++) { createFolder (path.join.apply (null, parts.slice (0, i))) } }
javascript
function createFolderRecursively (folder) { const parts = folder.split (path.sep) for (let i = 1; i <= parts.length; i++) { createFolder (path.join.apply (null, parts.slice (0, i))) } }
[ "function", "createFolderRecursively", "(", "folder", ")", "{", "const", "parts", "=", "folder", ".", "split", "(", "path", ".", "sep", ")", "for", "(", "let", "i", "=", "1", ";", "i", "<=", "parts", ".", "length", ";", "i", "++", ")", "{", "create...
-----------------------------------------------------------------------------
[ "-----------------------------------------------------------------------------" ]
8168069b9180a465532905e225586215e115a565
https://github.com/ccxt/ccxt/blob/8168069b9180a465532905e225586215e115a565/build/transpile.js#L779-L786
train
Create a folder recursively
[ 30522, 3853, 3443, 10371, 28849, 10841, 2869, 14547, 1006, 19622, 1007, 1063, 9530, 3367, 3033, 1027, 19622, 1012, 3975, 1006, 4130, 1012, 19802, 1007, 2005, 1006, 2292, 1045, 1027, 1015, 1025, 1045, 1026, 1027, 3033, 1012, 3091, 1025, 1045...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.core/src/sap/ui/core/support/techinfo/moduleTreeHelper.js
function (oObject, sName) { sName = sName === '/' ? '' : sName; var aNames = sName.split('/'), l = aNames.length, i; if (l > 0) { for (i = 0; oObject && i < l - 1; i++) { if (!oObject[aNames[i]]) { return false; } oObject = oObject[aNames[i]]; } return oObject[aNames[l - 1]]; } }
javascript
function (oObject, sName) { sName = sName === '/' ? '' : sName; var aNames = sName.split('/'), l = aNames.length, i; if (l > 0) { for (i = 0; oObject && i < l - 1; i++) { if (!oObject[aNames[i]]) { return false; } oObject = oObject[aNames[i]]; } return oObject[aNames[l - 1]]; } }
[ "function", "(", "oObject", ",", "sName", ")", "{", "sName", "=", "sName", "===", "'/'", "?", "''", ":", "sName", ";", "var", "aNames", "=", "sName", ".", "split", "(", "'/'", ")", ",", "l", "=", "aNames", ".", "length", ",", "i", ";", "if", "(...
* Gets the selection state for a package/module. Package names must end with a slash, modules must not. If an ancestor package of the package/module does not exists, undefined is returned. @param {object} oObject The resulting hierarchy object @param {string} sName The name to be set in the hierarchy @returns {boolean} the selected state of a name
[ "*", "Gets", "the", "selection", "state", "for", "a", "package", "/", "module", ".", "Package", "names", "must", "end", "with", "a", "slash", "modules", "must", "not", ".", "If", "an", "ancestor", "package", "of", "the", "package", "/", "module", "does",...
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/support/techinfo/moduleTreeHelper.js#L52-L66
train
Returns the object with the given name
[ 30522, 3853, 1006, 1051, 16429, 20614, 1010, 1055, 18442, 1007, 1063, 1055, 18442, 1027, 1055, 18442, 1027, 1027, 1027, 1005, 1013, 1005, 1029, 1005, 1005, 1024, 1055, 18442, 1025, 13075, 9617, 7834, 1027, 1055, 18442, 1012, 3975, 1006, 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...
SAP/openui5
src/sap.ui.core/src/sap/ui/events/jquery/EventSimulation.js
function(oEvent, oConfig) { if (oEvent.isMarked("handledByTouchToMouse")) { return; } oEvent.setMarked("handledByTouchToMouse"); var oNewStartEvent, oNewEndEvent, bSimulateClick; function createNewEvent() { return fnCreateNewEvent(oEvent, oConfig, oConfig.eventName === "mouseup" ? oEvent.changedTouches[0] : oEvent.touches[0]); } if (oEvent.type === "touchstart") { var oTouch = oEvent.originalEvent.touches[0]; bFingerIsMoved = false; iLastTouchMoveTime = 0; iStartX = oTouch.pageX; iStartY = oTouch.pageY; iOffsetX = Math.round(oTouch.pageX - jQuery(oEvent.target).offset().left); iOffsetY = Math.round(oTouch.pageY - jQuery(oEvent.target).offset().top); oNewStartEvent = createNewEvent(); setTimeout(function() { oNewStartEvent.setMark("handledByUIArea", false); oConfig.eventHandle.handler.call(oConfig.domRef, oNewStartEvent); }, 0); } else if (oEvent.type === "touchend") { oNewEndEvent = createNewEvent(); bSimulateClick = !bFingerIsMoved; setTimeout(function() { oNewEndEvent.setMark("handledByUIArea", false); oConfig.eventHandle.handler.call(oConfig.domRef, oNewEndEvent); if (bSimulateClick) { // also call the onclick event handler when touchend event is received and the movement is within threshold oNewEndEvent.type = "click"; oNewEndEvent.getPseudoTypes = jQuery.Event.prototype.getPseudoTypes; //Reset the pseudo types due to type change oNewEndEvent.setMark("handledByUIArea", false); oNewEndEvent.offsetX = iOffsetX; // use offset from touchstart oNewEndEvent.offsetY = iOffsetY; // use offset from touchstart oConfig.eventHandle.handler.call(oConfig.domRef, oNewEndEvent); } }, 0); } }
javascript
function(oEvent, oConfig) { if (oEvent.isMarked("handledByTouchToMouse")) { return; } oEvent.setMarked("handledByTouchToMouse"); var oNewStartEvent, oNewEndEvent, bSimulateClick; function createNewEvent() { return fnCreateNewEvent(oEvent, oConfig, oConfig.eventName === "mouseup" ? oEvent.changedTouches[0] : oEvent.touches[0]); } if (oEvent.type === "touchstart") { var oTouch = oEvent.originalEvent.touches[0]; bFingerIsMoved = false; iLastTouchMoveTime = 0; iStartX = oTouch.pageX; iStartY = oTouch.pageY; iOffsetX = Math.round(oTouch.pageX - jQuery(oEvent.target).offset().left); iOffsetY = Math.round(oTouch.pageY - jQuery(oEvent.target).offset().top); oNewStartEvent = createNewEvent(); setTimeout(function() { oNewStartEvent.setMark("handledByUIArea", false); oConfig.eventHandle.handler.call(oConfig.domRef, oNewStartEvent); }, 0); } else if (oEvent.type === "touchend") { oNewEndEvent = createNewEvent(); bSimulateClick = !bFingerIsMoved; setTimeout(function() { oNewEndEvent.setMark("handledByUIArea", false); oConfig.eventHandle.handler.call(oConfig.domRef, oNewEndEvent); if (bSimulateClick) { // also call the onclick event handler when touchend event is received and the movement is within threshold oNewEndEvent.type = "click"; oNewEndEvent.getPseudoTypes = jQuery.Event.prototype.getPseudoTypes; //Reset the pseudo types due to type change oNewEndEvent.setMark("handledByUIArea", false); oNewEndEvent.offsetX = iOffsetX; // use offset from touchstart oNewEndEvent.offsetY = iOffsetY; // use offset from touchstart oConfig.eventHandle.handler.call(oConfig.domRef, oNewEndEvent); } }, 0); } }
[ "function", "(", "oEvent", ",", "oConfig", ")", "{", "if", "(", "oEvent", ".", "isMarked", "(", "\"handledByTouchToMouse\"", ")", ")", "{", "return", ";", "}", "oEvent", ".", "setMarked", "(", "\"handledByTouchToMouse\"", ")", ";", "var", "oNewStartEvent", "...
This function simulates the corresponding mouse event by listening to touch event (touchstart, touchend, touchcancel). The simulated event will be dispatch through UI5 event delegation which means that the on"EventName" function is called on control's prototype. @param {jQuery.Event} oEvent The original event object @param {object} oConfig Additional configuration passed from createSimulatedEvent function
[ "This", "function", "simulates", "the", "corresponding", "mouse", "event", "by", "listening", "to", "touch", "event", "(", "touchstart", "touchend", "touchcancel", ")", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/events/jquery/EventSimulation.js#L298-L343
train
This function is called when the mouse event is handled by touch.
[ 30522, 3853, 1006, 1051, 18697, 3372, 1010, 1051, 8663, 8873, 2290, 1007, 1063, 2065, 1006, 1051, 18697, 3372, 1012, 2003, 10665, 2098, 1006, 1000, 8971, 3762, 24826, 10143, 19506, 8557, 1000, 1007, 1007, 1063, 2709, 1025, 1065, 1051, 18697...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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.rta/src/sap/ui/rta/ControlTreeModifier.js
function (oParent, sName, oObject, iIndex) { var oOldAggregationValue = JsControlTreeModifier.getAggregation.call(this, oParent, sName); JsControlTreeModifier.insertAggregation.apply(this, arguments); if (oParent) { if (oParent.getMetadata) { var oMetadata = oParent.getMetadata(); var oAggregations = oMetadata.getAllAggregations(); if (oAggregations) { var oAggregation = oAggregations[sName]; if (oAggregation) { if (oAggregation.multiple) { this._saveUndoOperation("removeAggregation", [oParent, sName, oObject]); } else { this._saveUndoOperation("insertAggregation", [oParent, sName, oOldAggregationValue]); } } } } } }
javascript
function (oParent, sName, oObject, iIndex) { var oOldAggregationValue = JsControlTreeModifier.getAggregation.call(this, oParent, sName); JsControlTreeModifier.insertAggregation.apply(this, arguments); if (oParent) { if (oParent.getMetadata) { var oMetadata = oParent.getMetadata(); var oAggregations = oMetadata.getAllAggregations(); if (oAggregations) { var oAggregation = oAggregations[sName]; if (oAggregation) { if (oAggregation.multiple) { this._saveUndoOperation("removeAggregation", [oParent, sName, oObject]); } else { this._saveUndoOperation("insertAggregation", [oParent, sName, oOldAggregationValue]); } } } } } }
[ "function", "(", "oParent", ",", "sName", ",", "oObject", ",", "iIndex", ")", "{", "var", "oOldAggregationValue", "=", "JsControlTreeModifier", ".", "getAggregation", ".", "call", "(", "this", ",", "oParent", ",", "sName", ")", ";", "JsControlTreeModifier", "....
Adds an additional item to the aggregation or changes it in case it is not a multiple one Adds removeAggregation as the undo operation @override
[ "Adds", "an", "additional", "item", "to", "the", "aggregation", "or", "changes", "it", "in", "case", "it", "is", "not", "a", "multiple", "one", "Adds", "removeAggregation", "as", "the", "undo", "operation" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.rta/src/sap/ui/rta/ControlTreeModifier.js#L261-L282
train
Inserts an aggregation to the undo operation
[ 30522, 3853, 1006, 6728, 12069, 3372, 1010, 1055, 18442, 1010, 1051, 16429, 20614, 1010, 2462, 13629, 2595, 1007, 1063, 13075, 1051, 11614, 8490, 17603, 12540, 10175, 5657, 1027, 1046, 9363, 3372, 13153, 13334, 5302, 4305, 8873, 2121, 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...
chriso/validator.js
lib/isEmail.js
isEmail
function isEmail(str, options) { (0, _assertString.default)(str); options = (0, _merge.default)(options, default_email_options); if (options.require_display_name || options.allow_display_name) { var display_email = str.match(displayName); if (display_email) { str = display_email[1]; } else if (options.require_display_name) { return false; } } var parts = str.split('@'); var domain = parts.pop(); var user = parts.join('@'); var lower_domain = domain.toLowerCase(); if (options.domain_specific_validation && (lower_domain === 'gmail.com' || lower_domain === 'googlemail.com')) { /* Previously we removed dots for gmail addresses before validating. This was removed because it allows `multiple..dots@gmail.com` to be reported as valid, but it is not. Gmail only normalizes single dots, removing them from here is pointless, should be done in normalizeEmail */ user = user.toLowerCase(); // Removing sub-address from username before gmail validation var username = user.split('+')[0]; // Dots are not included in gmail length restriction if (!(0, _isByteLength.default)(username.replace('.', ''), { min: 6, max: 30 })) { return false; } var _user_parts = username.split('.'); for (var i = 0; i < _user_parts.length; i++) { if (!gmailUserPart.test(_user_parts[i])) { return false; } } } if (!(0, _isByteLength.default)(user, { max: 64 }) || !(0, _isByteLength.default)(domain, { max: 254 })) { return false; } if (!(0, _isFQDN.default)(domain, { require_tld: options.require_tld })) { if (!options.allow_ip_domain) { return false; } if (!(0, _isIP.default)(domain)) { if (!domain.startsWith('[') || !domain.endsWith(']')) { return false; } var noBracketdomain = domain.substr(1, domain.length - 2); if (noBracketdomain.length === 0 || !(0, _isIP.default)(noBracketdomain)) { return false; } } } if (user[0] === '"') { user = user.slice(1, user.length - 1); return options.allow_utf8_local_part ? quotedEmailUserUtf8.test(user) : quotedEmailUser.test(user); } var pattern = options.allow_utf8_local_part ? emailUserUtf8Part : emailUserPart; var user_parts = user.split('.'); for (var _i = 0; _i < user_parts.length; _i++) { if (!pattern.test(user_parts[_i])) { return false; } } return true; }
javascript
function isEmail(str, options) { (0, _assertString.default)(str); options = (0, _merge.default)(options, default_email_options); if (options.require_display_name || options.allow_display_name) { var display_email = str.match(displayName); if (display_email) { str = display_email[1]; } else if (options.require_display_name) { return false; } } var parts = str.split('@'); var domain = parts.pop(); var user = parts.join('@'); var lower_domain = domain.toLowerCase(); if (options.domain_specific_validation && (lower_domain === 'gmail.com' || lower_domain === 'googlemail.com')) { /* Previously we removed dots for gmail addresses before validating. This was removed because it allows `multiple..dots@gmail.com` to be reported as valid, but it is not. Gmail only normalizes single dots, removing them from here is pointless, should be done in normalizeEmail */ user = user.toLowerCase(); // Removing sub-address from username before gmail validation var username = user.split('+')[0]; // Dots are not included in gmail length restriction if (!(0, _isByteLength.default)(username.replace('.', ''), { min: 6, max: 30 })) { return false; } var _user_parts = username.split('.'); for (var i = 0; i < _user_parts.length; i++) { if (!gmailUserPart.test(_user_parts[i])) { return false; } } } if (!(0, _isByteLength.default)(user, { max: 64 }) || !(0, _isByteLength.default)(domain, { max: 254 })) { return false; } if (!(0, _isFQDN.default)(domain, { require_tld: options.require_tld })) { if (!options.allow_ip_domain) { return false; } if (!(0, _isIP.default)(domain)) { if (!domain.startsWith('[') || !domain.endsWith(']')) { return false; } var noBracketdomain = domain.substr(1, domain.length - 2); if (noBracketdomain.length === 0 || !(0, _isIP.default)(noBracketdomain)) { return false; } } } if (user[0] === '"') { user = user.slice(1, user.length - 1); return options.allow_utf8_local_part ? quotedEmailUserUtf8.test(user) : quotedEmailUser.test(user); } var pattern = options.allow_utf8_local_part ? emailUserUtf8Part : emailUserPart; var user_parts = user.split('.'); for (var _i = 0; _i < user_parts.length; _i++) { if (!pattern.test(user_parts[_i])) { return false; } } return true; }
[ "function", "isEmail", "(", "str", ",", "options", ")", "{", "(", "0", ",", "_assertString", ".", "default", ")", "(", "str", ")", ";", "options", "=", "(", "0", ",", "_merge", ".", "default", ")", "(", "options", ",", "default_email_options", ")", "...
/* eslint-enable max-len /* eslint-enable no-control-regex
[ "/", "*", "eslint", "-", "enable", "max", "-", "len", "/", "*", "eslint", "-", "enable", "no", "-", "control", "-", "regex" ]
63e4c78f07d08543af4be7b6c2c9cf24df009003
https://github.com/chriso/validator.js/blob/63e4c78f07d08543af4be7b6c2c9cf24df009003/lib/isEmail.js#L40-L130
train
Check if a string is an email address
[ 30522, 3853, 2003, 14545, 4014, 1006, 2358, 2099, 1010, 7047, 1007, 1063, 1006, 1014, 1010, 1035, 19514, 18886, 3070, 1012, 12398, 1007, 1006, 2358, 2099, 1007, 1025, 7047, 1027, 1006, 1014, 1010, 1035, 13590, 1012, 12398, 1007, 1006, 7047,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
firebase/firebase-js-sdk
packages/auth/demo/public/script.js
onApplyActionCode
function onApplyActionCode() { var code = $('#email-verification-code').val(); auth.applyActionCode(code).then(function() { alertSuccess('Email successfully verified!'); refreshUserData(); }, onAuthError); }
javascript
function onApplyActionCode() { var code = $('#email-verification-code').val(); auth.applyActionCode(code).then(function() { alertSuccess('Email successfully verified!'); refreshUserData(); }, onAuthError); }
[ "function", "onApplyActionCode", "(", ")", "{", "var", "code", "=", "$", "(", "'#email-verification-code'", ")", ".", "val", "(", ")", ";", "auth", ".", "applyActionCode", "(", "code", ")", ".", "then", "(", "function", "(", ")", "{", "alertSuccess", "("...
Confirms the email verification code given.
[ "Confirms", "the", "email", "verification", "code", "given", "." ]
491598a499813dacc23724de5e237ec220cc560e
https://github.com/firebase/firebase-js-sdk/blob/491598a499813dacc23724de5e237ec220cc560e/packages/auth/demo/public/script.js#L796-L802
train
Apply the email verification code
[ 30522, 3853, 2006, 29098, 2135, 18908, 3258, 16044, 1006, 1007, 1063, 13075, 3642, 1027, 1002, 1006, 1005, 1001, 10373, 1011, 22616, 1011, 3642, 1005, 1007, 1012, 11748, 1006, 1007, 1025, 8740, 2705, 1012, 6611, 18908, 3258, 16044, 1006, 36...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/Double.js
getFormatter
function getFormatter(oType) { var oFormatOptions; if (!oType.oFormat) { oFormatOptions = jQuery.extend({groupingEnabled : true}, oType.oFormatOptions); oType.oFormat = NumberFormat.getFloatInstance(oFormatOptions); } return oType.oFormat; }
javascript
function getFormatter(oType) { var oFormatOptions; if (!oType.oFormat) { oFormatOptions = jQuery.extend({groupingEnabled : true}, oType.oFormatOptions); oType.oFormat = NumberFormat.getFloatInstance(oFormatOptions); } return oType.oFormat; }
[ "function", "getFormatter", "(", "oType", ")", "{", "var", "oFormatOptions", ";", "if", "(", "!", "oType", ".", "oFormat", ")", "{", "oFormatOptions", "=", "jQuery", ".", "extend", "(", "{", "groupingEnabled", ":", "true", "}", ",", "oType", ".", "oForma...
Returns the formatter. Creates it lazily. @param {sap.ui.model.odata.type.Double} oType the type instance @returns {sap.ui.core.format.NumberFormat} the formatter
[ "Returns", "the", "formatter", ".", "Creates", "it", "lazily", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/type/Double.js#L34-L42
train
Returns the formatter for the given type.
[ 30522, 3853, 2131, 14192, 20097, 1006, 27178, 18863, 1007, 1063, 13075, 1997, 2953, 18900, 7361, 9285, 1025, 2065, 1006, 999, 27178, 18863, 1012, 1997, 2953, 18900, 1007, 1063, 1997, 2953, 18900, 7361, 9285, 1027, 1046, 4226, 2854, 1012, 79...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/ViewUtils.js
scrollElementIntoView
function scrollElementIntoView($view, $element, scrollHorizontal) { var elementOffset = $element.offset(); // scroll minimum amount var elementRect = { top: elementOffset.top, left: elementOffset.left, height: $element.height(), width: $element.width() }, clip = getElementClipSize($view, elementRect); if (clip.bottom > 0) { // below viewport $view.scrollTop($view.scrollTop() + clip.bottom); } else if (clip.top > 0) { // above viewport $view.scrollTop($view.scrollTop() - clip.top); } if (scrollHorizontal) { if (clip.left > 0) { $view.scrollLeft($view.scrollLeft() - clip.left); } else if (clip.right > 0) { $view.scrollLeft($view.scrollLeft() + clip.right); } } }
javascript
function scrollElementIntoView($view, $element, scrollHorizontal) { var elementOffset = $element.offset(); // scroll minimum amount var elementRect = { top: elementOffset.top, left: elementOffset.left, height: $element.height(), width: $element.width() }, clip = getElementClipSize($view, elementRect); if (clip.bottom > 0) { // below viewport $view.scrollTop($view.scrollTop() + clip.bottom); } else if (clip.top > 0) { // above viewport $view.scrollTop($view.scrollTop() - clip.top); } if (scrollHorizontal) { if (clip.left > 0) { $view.scrollLeft($view.scrollLeft() - clip.left); } else if (clip.right > 0) { $view.scrollLeft($view.scrollLeft() + clip.right); } } }
[ "function", "scrollElementIntoView", "(", "$view", ",", "$element", ",", "scrollHorizontal", ")", "{", "var", "elementOffset", "=", "$element", ".", "offset", "(", ")", ";", "// scroll minimum amount", "var", "elementRect", "=", "{", "top", ":", "elementOffset", ...
Within a scrolling DOMElement, if necessary, scroll element into viewport. To Perform the minimum amount of scrolling necessary, cases should be handled as follows: - element already completely in view : no scrolling - element above viewport : scroll view so element is at top - element left of viewport : scroll view so element is at left - element below viewport : scroll view so element is at bottom - element right of viewport : scroll view so element is at right Assumptions: - $view is a scrolling container @param {!DOMElement} $view - A jQuery scrolling container @param {!DOMElement} $element - A jQuery element @param {?boolean} scrollHorizontal - whether to also scroll horizontally
[ "Within", "a", "scrolling", "DOMElement", "if", "necessary", "scroll", "element", "into", "viewport", "." ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/utils/ViewUtils.js#L362-L389
train
scroll element into view
[ 30522, 3853, 17186, 12260, 3672, 18447, 4492, 2666, 2860, 1006, 1002, 3193, 1010, 1002, 5783, 1010, 17186, 16368, 10993, 12162, 2389, 1007, 1063, 13075, 5783, 27475, 3388, 1027, 1002, 5783, 1012, 16396, 1006, 1007, 1025, 1013, 1013, 17186, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/file/FileUtils.js
writeText
function writeText(file, text, allowBlindWrite) { var result = new $.Deferred(), options = {}; if (allowBlindWrite) { options.blind = true; } file.write(text, options, function (err) { if (!err) { result.resolve(); } else { result.reject(err); } }); return result.promise(); }
javascript
function writeText(file, text, allowBlindWrite) { var result = new $.Deferred(), options = {}; if (allowBlindWrite) { options.blind = true; } file.write(text, options, function (err) { if (!err) { result.resolve(); } else { result.reject(err); } }); return result.promise(); }
[ "function", "writeText", "(", "file", ",", "text", ",", "allowBlindWrite", ")", "{", "var", "result", "=", "new", "$", ".", "Deferred", "(", ")", ",", "options", "=", "{", "}", ";", "if", "(", "allowBlindWrite", ")", "{", "options", ".", "blind", "="...
Asynchronously writes a file as UTF-8 encoded text. @param {!File} file File to write @param {!string} text @param {boolean=} allowBlindWrite Indicates whether or not CONTENTS_MODIFIED errors---which can be triggered if the actual file contents differ from the FileSystem's last-known contents---should be ignored. @return {$.Promise} a jQuery promise that will be resolved when file writing completes, or rejected with a FileSystemError string constant.
[ "Asynchronously", "writes", "a", "file", "as", "UTF", "-", "8", "encoded", "text", "." ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/file/FileUtils.js#L101-L118
train
write text to file
[ 30522, 3853, 4339, 18209, 1006, 5371, 1010, 3793, 1010, 3499, 16558, 22254, 26373, 1007, 1063, 13075, 2765, 1027, 2047, 1002, 1012, 13366, 28849, 2094, 1006, 1007, 1010, 7047, 1027, 1063, 1065, 1025, 2065, 1006, 3499, 16558, 22254, 26373, 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.layout/src/sap/ui/layout/form/FormElement.js
_labelIsDisplayOnly
function _labelIsDisplayOnly(){ if (this.getDisplayOnly) { if (!this.isPropertyInitial("displayOnly")) { return this.getDisplayOnly(); } var oFormElement = this.getParent(); var oFormContainer = oFormElement.getParent(); if (oFormContainer) { var oForm = oFormContainer.getParent(); if (oForm) { return !oForm.getEditable(); } } } return false; }
javascript
function _labelIsDisplayOnly(){ if (this.getDisplayOnly) { if (!this.isPropertyInitial("displayOnly")) { return this.getDisplayOnly(); } var oFormElement = this.getParent(); var oFormContainer = oFormElement.getParent(); if (oFormContainer) { var oForm = oFormContainer.getParent(); if (oForm) { return !oForm.getEditable(); } } } return false; }
[ "function", "_labelIsDisplayOnly", "(", ")", "{", "if", "(", "this", ".", "getDisplayOnly", ")", "{", "if", "(", "!", "this", ".", "isPropertyInitial", "(", "\"displayOnly\"", ")", ")", "{", "return", "this", ".", "getDisplayOnly", "(", ")", ";", "}", "v...
/* overwrite Labels isDisplayOnly function to use the editable property of the Form to determine the mode. If DisplayOnly is set explicitly on the Label, this is used.
[ "/", "*", "overwrite", "Labels", "isDisplayOnly", "function", "to", "use", "the", "editable", "property", "of", "the", "Form", "to", "determine", "the", "mode", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.layout/src/sap/ui/layout/form/FormElement.js#L408-L429
train
Returns true if the label is display only
[ 30522, 3853, 1035, 3830, 2483, 10521, 13068, 2239, 2135, 1006, 1007, 1063, 2065, 1006, 2023, 1012, 2131, 10521, 13068, 2239, 2135, 1007, 1063, 2065, 1006, 999, 2023, 1012, 2003, 21572, 4842, 3723, 5498, 20925, 1006, 1000, 4653, 2239, 2135, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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
js/mui.ajax.js
function(error, type, xhr, settings) { settings.error.call(settings.context, xhr, type, error); ajaxComplete(type, xhr, settings); }
javascript
function(error, type, xhr, settings) { settings.error.call(settings.context, xhr, type, error); ajaxComplete(type, xhr, settings); }
[ "function", "(", "error", ",", "type", ",", "xhr", ",", "settings", ")", "{", "settings", ".", "error", ".", "call", "(", "settings", ".", "context", ",", "xhr", ",", "type", ",", "error", ")", ";", "ajaxComplete", "(", "type", ",", "xhr", ",", "se...
type: "timeout", "error", "abort", "parsererror"
[ "type", ":", "timeout", "error", "abort", "parsererror" ]
ff74c90a1671a552f3604b1288bf38a4126312d0
https://github.com/dcloudio/mui/blob/ff74c90a1671a552f3604b1288bf38a4126312d0/js/mui.ajax.js#L47-L50
train
Handle ajax error
[ 30522, 3853, 1006, 7561, 1010, 2828, 1010, 1060, 8093, 1010, 10906, 1007, 1063, 10906, 1012, 7561, 1012, 2655, 1006, 10906, 1012, 6123, 1010, 1060, 8093, 1010, 2828, 30524, 2828, 1010, 1060, 8093, 1010, 10906, 1007, 1025, 1065, 102, 0, 0,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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...
Microsoft/vscode
build/lib/bundle.js
positionToOffset
function positionToOffset(str, desiredLine, desiredCol) { if (desiredLine === 1) { return desiredCol - 1; } let line = 1; let lastNewLineOffset = -1; do { if (desiredLine === line) { return lastNewLineOffset + 1 + desiredCol - 1; } lastNewLineOffset = str.indexOf('\n', lastNewLineOffset + 1); line++; } while (lastNewLineOffset >= 0); return -1; }
javascript
function positionToOffset(str, desiredLine, desiredCol) { if (desiredLine === 1) { return desiredCol - 1; } let line = 1; let lastNewLineOffset = -1; do { if (desiredLine === line) { return lastNewLineOffset + 1 + desiredCol - 1; } lastNewLineOffset = str.indexOf('\n', lastNewLineOffset + 1); line++; } while (lastNewLineOffset >= 0); return -1; }
[ "function", "positionToOffset", "(", "str", ",", "desiredLine", ",", "desiredCol", ")", "{", "if", "(", "desiredLine", "===", "1", ")", "{", "return", "desiredCol", "-", "1", ";", "}", "let", "line", "=", "1", ";", "let", "lastNewLineOffset", "=", "-", ...
Convert a position (line:col) to (offset) in string `str`
[ "Convert", "a", "position", "(", "line", ":", "col", ")", "to", "(", "offset", ")", "in", "string", "str" ]
693a13cd32c5be798051edc0cb43e1e39fc456d9
https://github.com/Microsoft/vscode/blob/693a13cd32c5be798051edc0cb43e1e39fc456d9/build/lib/bundle.js#L386-L400
train
Returns the offset of the first line of the string that is at the given position.
[ 30522, 3853, 2597, 3406, 27475, 3388, 1006, 2358, 2099, 1010, 9059, 4179, 1010, 30524, 1011, 1015, 1025, 1065, 2292, 2240, 1027, 1015, 1025, 2292, 2197, 2638, 13668, 3170, 27475, 3388, 1027, 1011, 1015, 1025, 2079, 1063, 2065, 1006, 9059, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
vuejs/vue-cli
packages/@vue/cli/bin/vue.js
cleanArgs
function cleanArgs (cmd) { const args = {} cmd.options.forEach(o => { const key = camelize(o.long.replace(/^--/, '')) // if an option is not present and Command has a method with the same name // it should not be copied if (typeof cmd[key] !== 'function' && typeof cmd[key] !== 'undefined') { args[key] = cmd[key] } }) return args }
javascript
function cleanArgs (cmd) { const args = {} cmd.options.forEach(o => { const key = camelize(o.long.replace(/^--/, '')) // if an option is not present and Command has a method with the same name // it should not be copied if (typeof cmd[key] !== 'function' && typeof cmd[key] !== 'undefined') { args[key] = cmd[key] } }) return args }
[ "function", "cleanArgs", "(", "cmd", ")", "{", "const", "args", "=", "{", "}", "cmd", ".", "options", ".", "forEach", "(", "o", "=>", "{", "const", "key", "=", "camelize", "(", "o", ".", "long", ".", "replace", "(", "/", "^--", "/", ",", "''", ...
commander passes the Command object itself as options, extract only actual options into a fresh object.
[ "commander", "passes", "the", "Command", "object", "itself", "as", "options", "extract", "only", "actual", "options", "into", "a", "fresh", "object", "." ]
206803cbefefdfbc7d8ed12440b0b751688b77b2
https://github.com/vuejs/vue-cli/blob/206803cbefefdfbc7d8ed12440b0b751688b77b2/packages/@vue/cli/bin/vue.js#L239-L250
train
clean args from command
[ 30522, 3853, 4550, 2906, 5620, 1006, 4642, 2094, 1007, 1063, 9530, 3367, 12098, 5620, 1027, 1063, 1065, 4642, 2094, 1012, 7047, 1012, 18921, 6776, 1006, 1051, 1027, 1028, 1063, 9530, 3367, 3145, 1027, 19130, 4697, 1006, 1051, 1012, 2146, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
nhn/tui.editor
src/js/extensions/table/tableRangeHandler.js
_expandColMergedRange
function _expandColMergedRange(tableData, tableRange, rowIndex, colIndex) { const rowData = tableData[rowIndex]; const cellData = rowData[colIndex]; const {colMergeWith} = cellData; let lastColMergedIndex = -1; if (util.isExisty(colMergeWith)) { if (colMergeWith < tableRange.start.colIndex) { tableRange.start.colIndex = colMergeWith; } lastColMergedIndex = colMergeWith + rowData[colMergeWith].colspan - 1; } else if (cellData.colspan > 1) { lastColMergedIndex = colIndex + cellData.colspan - 1; } if (lastColMergedIndex > tableRange.end.colIndex) { tableRange.end.colIndex = lastColMergedIndex; } }
javascript
function _expandColMergedRange(tableData, tableRange, rowIndex, colIndex) { const rowData = tableData[rowIndex]; const cellData = rowData[colIndex]; const {colMergeWith} = cellData; let lastColMergedIndex = -1; if (util.isExisty(colMergeWith)) { if (colMergeWith < tableRange.start.colIndex) { tableRange.start.colIndex = colMergeWith; } lastColMergedIndex = colMergeWith + rowData[colMergeWith].colspan - 1; } else if (cellData.colspan > 1) { lastColMergedIndex = colIndex + cellData.colspan - 1; } if (lastColMergedIndex > tableRange.end.colIndex) { tableRange.end.colIndex = lastColMergedIndex; } }
[ "function", "_expandColMergedRange", "(", "tableData", ",", "tableRange", ",", "rowIndex", ",", "colIndex", ")", "{", "const", "rowData", "=", "tableData", "[", "rowIndex", "]", ";", "const", "cellData", "=", "rowData", "[", "colIndex", "]", ";", "const", "{...
Expand table range by column merge properties like colspan, colMergeWith. @param {Array.<Array.<object>>} tableData - table data @param {{ start: {rowIndex: number, colIndex: number}, end: {rowIndex: number, colIndex: number} }} tableRange - table range @param {number} rowIndex - row index @param {number} colIndex - column index @private
[ "Expand", "table", "range", "by", "column", "merge", "properties", "like", "colspan", "colMergeWith", "." ]
e75ab08c2a7ab07d1143e318f7cde135c5e3002e
https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/extensions/table/tableRangeHandler.js#L101-L120
train
Expand the col merged range
[ 30522, 3853, 1035, 7818, 25778, 5017, 5999, 24388, 2063, 1006, 2795, 2850, 2696, 1010, 2795, 24388, 2063, 1010, 5216, 22254, 10288, 1010, 6972, 3207, 2595, 1007, 1063, 9530, 3367, 5216, 2850, 2696, 1027, 2795, 30524, 2197, 25778, 5017, 5999...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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) { var list = element.mxListenerList; if (list != null) { while (list.length > 0) { var entry = list[0]; mxEvent.removeListener(element, entry.name, entry.f); } } }
javascript
function(element) { var list = element.mxListenerList; if (list != null) { while (list.length > 0) { var entry = list[0]; mxEvent.removeListener(element, entry.name, entry.f); } } }
[ "function", "(", "element", ")", "{", "var", "list", "=", "element", ".", "mxListenerList", ";", "if", "(", "list", "!=", "null", ")", "{", "while", "(", "list", ".", "length", ">", "0", ")", "{", "var", "entry", "=", "list", "[", "0", "]", ";", ...
Function: removeAllListeners Removes all listeners from the given element.
[ "Function", ":", "removeAllListeners" ]
33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44
https://github.com/jgraph/mxgraph/blob/33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44/javascript/mxClient.js#L9508-L9520
train
Removes the listener for the specified element
[ 30522, 3853, 1006, 5783, 1007, 1063, 13075, 2862, 1027, 5783, 1012, 25630, 9863, 24454, 9863, 1025, 2065, 1006, 2862, 999, 1027, 19701, 1007, 1063, 2096, 1006, 2862, 1012, 3091, 1028, 1014, 1007, 1063, 13075, 4443, 1027, 2862, 1031, 1014, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
cytoscape/cytoscape.js
dist/cytoscape.esm.js
aStar
function aStar(options) { var cy = this.cy(); var _aStarDefaults = aStarDefaults(options), root = _aStarDefaults.root, goal = _aStarDefaults.goal, heuristic = _aStarDefaults.heuristic, directed = _aStarDefaults.directed, weight = _aStarDefaults.weight; root = cy.collection(root)[0]; goal = cy.collection(goal)[0]; var sid = root.id(); var tid = goal.id(); var gScore = {}; var fScore = {}; var closedSetIds = {}; var openSet = new Heap(function (a, b) { return fScore[a.id()] - fScore[b.id()]; }); var openSetIds = new Set$1(); var cameFrom = {}; var cameFromEdge = {}; var addToOpenSet = function addToOpenSet(ele, id) { openSet.push(ele); openSetIds.add(id); }; var cMin, cMinId; var popFromOpenSet = function popFromOpenSet() { cMin = openSet.pop(); cMinId = cMin.id(); openSetIds.delete(cMinId); }; var isInOpenSet = function isInOpenSet(id) { return openSetIds.has(id); }; addToOpenSet(root, sid); gScore[sid] = 0; fScore[sid] = heuristic(root); // Counter var steps = 0; // Main loop while (openSet.size() > 0) { popFromOpenSet(); steps++; // If we've found our goal, then we are done if (cMinId === tid) { var path = []; var pathNode = goal; var pathNodeId = tid; var pathEdge = cameFromEdge[pathNodeId]; for (;;) { path.unshift(pathNode); if (pathEdge != null) { path.unshift(pathEdge); } pathNode = cameFrom[pathNodeId]; if (pathNode == null) { break; } pathNodeId = pathNode.id(); pathEdge = cameFromEdge[pathNodeId]; } return { found: true, distance: gScore[cMinId], path: this.spawn(path), steps: steps }; } // Add cMin to processed nodes closedSetIds[cMinId] = true; // Update scores for neighbors of cMin // Take into account if graph is directed or not var vwEdges = cMin._private.edges; for (var i = 0; i < vwEdges.length; i++) { var e = vwEdges[i]; // edge must be in set of calling eles if (!this.hasElementWithId(e.id())) { continue; } // cMin must be the source of edge if directed if (directed && e.data('source') !== cMinId) { continue; } var wSrc = e.source(); var wTgt = e.target(); var w = wSrc.id() !== cMinId ? wSrc : wTgt; var wid = w.id(); // node must be in set of calling eles if (!this.hasElementWithId(wid)) { continue; } // if node is in closedSet, ignore it if (closedSetIds[wid]) { continue; } // New tentative score for node w var tempScore = gScore[cMinId] + weight(e); // Update gScore for node w if: // w not present in openSet // OR // tentative gScore is less than previous value // w not in openSet if (!isInOpenSet(wid)) { gScore[wid] = tempScore; fScore[wid] = tempScore + heuristic(w); addToOpenSet(w, wid); cameFrom[wid] = cMin; cameFromEdge[wid] = e; continue; } // w already in openSet, but with greater gScore if (tempScore < gScore[wid]) { gScore[wid] = tempScore; fScore[wid] = tempScore + heuristic(w); cameFrom[wid] = cMin; } } // End of neighbors update } // End of main loop // If we've reached here, then we've not reached our goal return { found: false, distance: undefined, path: undefined, steps: steps }; }
javascript
function aStar(options) { var cy = this.cy(); var _aStarDefaults = aStarDefaults(options), root = _aStarDefaults.root, goal = _aStarDefaults.goal, heuristic = _aStarDefaults.heuristic, directed = _aStarDefaults.directed, weight = _aStarDefaults.weight; root = cy.collection(root)[0]; goal = cy.collection(goal)[0]; var sid = root.id(); var tid = goal.id(); var gScore = {}; var fScore = {}; var closedSetIds = {}; var openSet = new Heap(function (a, b) { return fScore[a.id()] - fScore[b.id()]; }); var openSetIds = new Set$1(); var cameFrom = {}; var cameFromEdge = {}; var addToOpenSet = function addToOpenSet(ele, id) { openSet.push(ele); openSetIds.add(id); }; var cMin, cMinId; var popFromOpenSet = function popFromOpenSet() { cMin = openSet.pop(); cMinId = cMin.id(); openSetIds.delete(cMinId); }; var isInOpenSet = function isInOpenSet(id) { return openSetIds.has(id); }; addToOpenSet(root, sid); gScore[sid] = 0; fScore[sid] = heuristic(root); // Counter var steps = 0; // Main loop while (openSet.size() > 0) { popFromOpenSet(); steps++; // If we've found our goal, then we are done if (cMinId === tid) { var path = []; var pathNode = goal; var pathNodeId = tid; var pathEdge = cameFromEdge[pathNodeId]; for (;;) { path.unshift(pathNode); if (pathEdge != null) { path.unshift(pathEdge); } pathNode = cameFrom[pathNodeId]; if (pathNode == null) { break; } pathNodeId = pathNode.id(); pathEdge = cameFromEdge[pathNodeId]; } return { found: true, distance: gScore[cMinId], path: this.spawn(path), steps: steps }; } // Add cMin to processed nodes closedSetIds[cMinId] = true; // Update scores for neighbors of cMin // Take into account if graph is directed or not var vwEdges = cMin._private.edges; for (var i = 0; i < vwEdges.length; i++) { var e = vwEdges[i]; // edge must be in set of calling eles if (!this.hasElementWithId(e.id())) { continue; } // cMin must be the source of edge if directed if (directed && e.data('source') !== cMinId) { continue; } var wSrc = e.source(); var wTgt = e.target(); var w = wSrc.id() !== cMinId ? wSrc : wTgt; var wid = w.id(); // node must be in set of calling eles if (!this.hasElementWithId(wid)) { continue; } // if node is in closedSet, ignore it if (closedSetIds[wid]) { continue; } // New tentative score for node w var tempScore = gScore[cMinId] + weight(e); // Update gScore for node w if: // w not present in openSet // OR // tentative gScore is less than previous value // w not in openSet if (!isInOpenSet(wid)) { gScore[wid] = tempScore; fScore[wid] = tempScore + heuristic(w); addToOpenSet(w, wid); cameFrom[wid] = cMin; cameFromEdge[wid] = e; continue; } // w already in openSet, but with greater gScore if (tempScore < gScore[wid]) { gScore[wid] = tempScore; fScore[wid] = tempScore + heuristic(w); cameFrom[wid] = cMin; } } // End of neighbors update } // End of main loop // If we've reached here, then we've not reached our goal return { found: false, distance: undefined, path: undefined, steps: steps }; }
[ "function", "aStar", "(", "options", ")", "{", "var", "cy", "=", "this", ".", "cy", "(", ")", ";", "var", "_aStarDefaults", "=", "aStarDefaults", "(", "options", ")", ",", "root", "=", "_aStarDefaults", ".", "root", ",", "goal", "=", "_aStarDefaults", ...
Implemented from pseudocode from wikipedia
[ "Implemented", "from", "pseudocode", "from", "wikipedia" ]
ad2051b65e2243cfd953d8b24a8bf95bfa8559e5
https://github.com/cytoscape/cytoscape.js/blob/ad2051b65e2243cfd953d8b24a8bf95bfa8559e5/dist/cytoscape.esm.js#L1559-L1707
train
A - Triangle Strength algorithm
[ 30522, 3853, 2004, 7559, 1006, 7047, 1007, 1063, 13075, 22330, 1027, 2023, 1012, 22330, 1006, 1007, 1025, 13075, 1035, 2004, 7559, 3207, 7011, 11314, 2015, 1027, 2004, 7559, 3207, 7011, 11314, 2015, 1006, 7047, 1007, 1010, 7117, 1027, 1035,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/ExpressionParser.js
parse
function parse(aTokens, sInput, mGlobals) { var fnFormatter, iNextToken = 0, oParser = { advance: advance, current: current, expression: expression, globals: mGlobals, input: sInput }, oToken; /** * Returns the next token in the array of tokens and advances the index in this array. * Throws an error if the next token's ID is not equal to the optional * <code>sExpectedTokenId</code>. * @param {string} [sExpectedTokenId] - the expected id of the next token * @returns {object} - the next token or undefined if all tokens have been read */ function advance(sExpectedTokenId) { var oToken = aTokens[iNextToken]; if (sExpectedTokenId) { if (!oToken) { error("Expected " + sExpectedTokenId + " but instead saw end of input", sInput); } else if (oToken.id !== sExpectedTokenId) { error("Expected " + sExpectedTokenId + " but instead saw " + sInput.slice(oToken.start, oToken.end), sInput, oToken.start + 1); } } iNextToken += 1; return oToken; } /** * Returns the next token in the array of tokens, but does not advance the index. * @returns {object} - the next token or undefined if all tokens have been read */ function current() { return aTokens[iNextToken]; } /** * Parse an expression starting at the current token. Throws an error if there are no more * tokens and * * @param {number} rbp * a "right binding power" * @returns {function} The formatter function for the expression */ function expression(rbp) { var fnLeft; oToken = advance(); if (!oToken) { error("Expected expression but instead saw end of input", sInput); } fnLeft = mSymbols[oToken.id].nud(oToken, oParser); while (iNextToken < aTokens.length) { oToken = current(); if (rbp >= (mSymbols[oToken.id].lbp || 0)) { break; } advance(); fnLeft = mSymbols[oToken.id].led(oToken, oParser, fnLeft); } return fnLeft; } fnFormatter = expression(0); // do this before calling current() below! return { at: current() && current().start, // call separate function to reduce the closure size of the formatter formatter: tryCatch(fnFormatter, sInput) }; }
javascript
function parse(aTokens, sInput, mGlobals) { var fnFormatter, iNextToken = 0, oParser = { advance: advance, current: current, expression: expression, globals: mGlobals, input: sInput }, oToken; /** * Returns the next token in the array of tokens and advances the index in this array. * Throws an error if the next token's ID is not equal to the optional * <code>sExpectedTokenId</code>. * @param {string} [sExpectedTokenId] - the expected id of the next token * @returns {object} - the next token or undefined if all tokens have been read */ function advance(sExpectedTokenId) { var oToken = aTokens[iNextToken]; if (sExpectedTokenId) { if (!oToken) { error("Expected " + sExpectedTokenId + " but instead saw end of input", sInput); } else if (oToken.id !== sExpectedTokenId) { error("Expected " + sExpectedTokenId + " but instead saw " + sInput.slice(oToken.start, oToken.end), sInput, oToken.start + 1); } } iNextToken += 1; return oToken; } /** * Returns the next token in the array of tokens, but does not advance the index. * @returns {object} - the next token or undefined if all tokens have been read */ function current() { return aTokens[iNextToken]; } /** * Parse an expression starting at the current token. Throws an error if there are no more * tokens and * * @param {number} rbp * a "right binding power" * @returns {function} The formatter function for the expression */ function expression(rbp) { var fnLeft; oToken = advance(); if (!oToken) { error("Expected expression but instead saw end of input", sInput); } fnLeft = mSymbols[oToken.id].nud(oToken, oParser); while (iNextToken < aTokens.length) { oToken = current(); if (rbp >= (mSymbols[oToken.id].lbp || 0)) { break; } advance(); fnLeft = mSymbols[oToken.id].led(oToken, oParser, fnLeft); } return fnLeft; } fnFormatter = expression(0); // do this before calling current() below! return { at: current() && current().start, // call separate function to reduce the closure size of the formatter formatter: tryCatch(fnFormatter, sInput) }; }
[ "function", "parse", "(", "aTokens", ",", "sInput", ",", "mGlobals", ")", "{", "var", "fnFormatter", ",", "iNextToken", "=", "0", ",", "oParser", "=", "{", "advance", ":", "advance", ",", "current", ":", "current", ",", "expression", ":", "expression", "...
Parses expression tokens to a result object as specified to be returned by {@link sap.ui.base.ExpressionParser#parse}. @param {object[]} aTokens - the array with the tokens @param {string} sInput - the expression string (used when logging errors) @param {object} mGlobals - the map of global variables @returns {object} the parse result with the following properties formatter: the formatter function to evaluate the expression which takes the parts corresponding to bindings embedded in the expression as parameters; undefined in case of an invalid expression at: the index of the first character after the expression in sInput, or <code>undefined</code> if all tokens have been consumed
[ "Parses", "expression", "tokens", "to", "a", "result", "object", "as", "specified", "to", "be", "returned", "by", "{" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/base/ExpressionParser.js#L715-L795
train
Parses an array of tokens and returns the next token in the array.
[ 30522, 3853, 11968, 3366, 1006, 2012, 11045, 3619, 1010, 8254, 18780, 1010, 11460, 4135, 10264, 2015, 1007, 1063, 13075, 1042, 2078, 14192, 20097, 1010, 1999, 10288, 9284, 7520, 1027, 1014, 1010, 6728, 11650, 2121, 1027, 1063, 5083, 1024, 5...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/computed-property-spacing.js
reportNoBeginningSpace
function reportNoBeginningSpace(node, token, tokenAfter) { context.report({ node, loc: token.loc.start, messageId: "unexpectedSpaceAfter", data: { tokenValue: token.value }, fix(fixer) { return fixer.removeRange([token.range[1], tokenAfter.range[0]]); } }); }
javascript
function reportNoBeginningSpace(node, token, tokenAfter) { context.report({ node, loc: token.loc.start, messageId: "unexpectedSpaceAfter", data: { tokenValue: token.value }, fix(fixer) { return fixer.removeRange([token.range[1], tokenAfter.range[0]]); } }); }
[ "function", "reportNoBeginningSpace", "(", "node", ",", "token", ",", "tokenAfter", ")", "{", "context", ".", "report", "(", "{", "node", ",", "loc", ":", "token", ".", "loc", ".", "start", ",", "messageId", ":", "\"unexpectedSpaceAfter\"", ",", "data", ":...
-------------------------------------------------------------------------- Helpers -------------------------------------------------------------------------- Reports that there shouldn't be a space after the first token @param {ASTNode} node - The node to report in the event of an error. @param {Token} token - The token to use for the report. @param {Token} tokenAfter - The token after `token`. @returns {void}
[ "--------------------------------------------------------------------------", "Helpers", "--------------------------------------------------------------------------", "Reports", "that", "there", "shouldn", "t", "be", "a", "space", "after", "the", "first", "token" ]
bc0819c94aad14f7fad3cbc2338ea15658b0f272
https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/computed-property-spacing.js#L56-L68
train
Reports an unexpected space after the given token.
[ 30522, 3853, 3189, 25083, 13910, 23111, 8613, 15327, 1006, 13045, 1010, 19204, 1010, 19204, 10354, 3334, 1007, 1063, 6123, 1012, 3189, 1006, 1063, 13045, 1010, 8840, 2278, 1024, 19204, 1012, 8840, 2278, 1012, 2707, 1010, 4471, 3593, 1024, 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...
emberjs/ember.js
bin/build-for-publishing.js
updateDocumentationVersion
function updateDocumentationVersion() { let docsPath = path.join(__dirname, '..', 'docs', 'data.json'); let contents = fs.readFileSync(docsPath, { encoding: 'utf-8' }); let docs = JSON.parse(contents); docs.project.version = buildInfo.version; fs.writeFileSync(docsPath, JSON.stringify(docs, null, 2), { encoding: 'utf-8', }); }
javascript
function updateDocumentationVersion() { let docsPath = path.join(__dirname, '..', 'docs', 'data.json'); let contents = fs.readFileSync(docsPath, { encoding: 'utf-8' }); let docs = JSON.parse(contents); docs.project.version = buildInfo.version; fs.writeFileSync(docsPath, JSON.stringify(docs, null, 2), { encoding: 'utf-8', }); }
[ "function", "updateDocumentationVersion", "(", ")", "{", "let", "docsPath", "=", "path", ".", "join", "(", "__dirname", ",", "'..'", ",", "'docs'", ",", "'data.json'", ")", ";", "let", "contents", "=", "fs", ".", "readFileSync", "(", "docsPath", ",", "{", ...
/* Updates the version number listed within the docs/data.json file to match `Ember.VERSION` and `package.json` version. This is needed because ember-cli-yuidoc automatically sets the version string property in the generated `docs/data.json` to `${packageJsonVersion}.${gitSha}`.
[ "/", "*", "Updates", "the", "version", "number", "listed", "within", "the", "docs", "/", "data", ".", "json", "file", "to", "match", "Ember", ".", "VERSION", "and", "package", ".", "json", "version", "." ]
7ef1d08b7fe44000cf97b3c43566d20337b0683d
https://github.com/emberjs/ember.js/blob/7ef1d08b7fe44000cf97b3c43566d20337b0683d/bin/build-for-publishing.js#L44-L53
train
Update the documentation version
[ 30522, 3853, 7172, 10085, 27417, 12516, 27774, 1006, 1007, 1063, 2292, 9986, 13102, 8988, 1027, 4130, 1012, 3693, 1006, 1035, 1035, 16101, 18442, 1010, 1005, 1012, 1012, 1005, 1010, 1005, 9986, 2015, 1005, 1010, 1005, 2951, 1012, 1046, 3385...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
cytoscape/cytoscape.js
dist/cytoscape.esm.js
addDescendantsToDrag
function addDescendantsToDrag(node, opts) { if (!node.cy().hasCompoundNodes()) { return; } if (opts.inDragLayer == null && opts.addToList == null) { return; } // nothing to do var innerNodes = node.descendants(); if (opts.inDragLayer) { innerNodes.forEach(setInDragLayer); innerNodes.connectedEdges().forEach(setInDragLayer); } if (opts.addToList) { opts.addToList.unmerge(innerNodes); } }
javascript
function addDescendantsToDrag(node, opts) { if (!node.cy().hasCompoundNodes()) { return; } if (opts.inDragLayer == null && opts.addToList == null) { return; } // nothing to do var innerNodes = node.descendants(); if (opts.inDragLayer) { innerNodes.forEach(setInDragLayer); innerNodes.connectedEdges().forEach(setInDragLayer); } if (opts.addToList) { opts.addToList.unmerge(innerNodes); } }
[ "function", "addDescendantsToDrag", "(", "node", ",", "opts", ")", "{", "if", "(", "!", "node", ".", "cy", "(", ")", ".", "hasCompoundNodes", "(", ")", ")", "{", "return", ";", "}", "if", "(", "opts", ".", "inDragLayer", "==", "null", "&&", "opts", ...
helper function to determine which child nodes and inner edges of a compound node to be dragged as well as the grabbed and selected nodes
[ "helper", "function", "to", "determine", "which", "child", "nodes", "and", "inner", "edges", "of", "a", "compound", "node", "to", "be", "dragged", "as", "well", "as", "the", "grabbed", "and", "selected", "nodes" ]
ad2051b65e2243cfd953d8b24a8bf95bfa8559e5
https://github.com/cytoscape/cytoscape.js/blob/ad2051b65e2243cfd953d8b24a8bf95bfa8559e5/dist/cytoscape.esm.js#L23284-L23304
train
Add all descendant nodes to the drag layer
[ 30522, 3853, 5587, 6155, 23865, 11390, 3406, 7265, 2290, 1006, 13045, 1010, 23569, 2015, 1007, 1063, 2065, 1006, 999, 13045, 1012, 22330, 1006, 1007, 1012, 30524, 1007, 1063, 2709, 1025, 1065, 2065, 1006, 23569, 2015, 1012, 27427, 29181, 24...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
google/material-design-lite
src/mdlComponentHandler.js
registerUpgradedCallbackInternal
function registerUpgradedCallbackInternal(jsClass, callback) { var regClass = findRegisteredClass_(jsClass); if (regClass) { regClass.callbacks.push(callback); } }
javascript
function registerUpgradedCallbackInternal(jsClass, callback) { var regClass = findRegisteredClass_(jsClass); if (regClass) { regClass.callbacks.push(callback); } }
[ "function", "registerUpgradedCallbackInternal", "(", "jsClass", ",", "callback", ")", "{", "var", "regClass", "=", "findRegisteredClass_", "(", "jsClass", ")", ";", "if", "(", "regClass", ")", "{", "regClass", ".", "callbacks", ".", "push", "(", "callback", ")...
Allows user to be alerted to any upgrades that are performed for a given component type @param {string} jsClass The class name of the MDL component we wish to hook into for any upgrades performed. @param {function(!HTMLElement)} callback The function to call upon an upgrade. This function should expect 1 parameter - the HTMLElement which got upgraded.
[ "Allows", "user", "to", "be", "alerted", "to", "any", "upgrades", "that", "are", "performed", "for", "a", "given", "component", "type" ]
60f441a22ed98ed2c03f6179adf460d888bf459f
https://github.com/google/material-design-lite/blob/60f441a22ed98ed2c03f6179adf460d888bf459f/src/mdlComponentHandler.js#L346-L351
train
Register a callback for a upgraded class
[ 30522, 3853, 4236, 6279, 24170, 16409, 8095, 5963, 18447, 11795, 2389, 1006, 1046, 11020, 27102, 1010, 2655, 5963, 1007, 1063, 13075, 19723, 26266, 1027, 2424, 2890, 24063, 6850, 26266, 1035, 1006, 1046, 11020, 27102, 1007, 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...
angular/material
src/components/tabs/js/tabsController.js
previousPage
function previousPage () { if (!ctrl.canPageBack()) { return; } var newOffset = MdTabsPaginationService.decreasePageOffset(getElements(), ctrl.offsetLeft); // Set the new offset ctrl.offsetLeft = fixOffset(newOffset); }
javascript
function previousPage () { if (!ctrl.canPageBack()) { return; } var newOffset = MdTabsPaginationService.decreasePageOffset(getElements(), ctrl.offsetLeft); // Set the new offset ctrl.offsetLeft = fixOffset(newOffset); }
[ "function", "previousPage", "(", ")", "{", "if", "(", "!", "ctrl", ".", "canPageBack", "(", ")", ")", "{", "return", ";", "}", "var", "newOffset", "=", "MdTabsPaginationService", ".", "decreasePageOffset", "(", "getElements", "(", ")", ",", "ctrl", ".", ...
Slides the tabs over approximately one page backward.
[ "Slides", "the", "tabs", "over", "approximately", "one", "page", "backward", "." ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/tabs/js/tabsController.js#L377-L384
train
Change the offsetLeft of the previous page
[ 30522, 3853, 3025, 13704, 1006, 1007, 1063, 2065, 1006, 999, 14931, 12190, 1012, 2064, 13704, 5963, 1006, 1007, 1007, 1063, 2709, 1025, 1065, 13075, 2047, 27475, 3388, 1027, 9108, 2696, 5910, 4502, 20876, 9285, 2121, 7903, 2063, 1012, 9885,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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...
testing-library/dom-testing-library
src/queries/label-text.js
getAllByLabelText
function getAllByLabelText(container, text, ...rest) { const els = queryAllByLabelText(container, text, ...rest) if (!els.length) { const labels = queryAllLabelsByText(container, text, ...rest) if (labels.length) { throw getElementError( `Found a label with the text of: ${text}, however no form control was found associated to that label. Make sure you're using the "for" attribute or "aria-labelledby" attribute correctly.`, container, ) } else { throw getElementError( `Unable to find a label with the text of: ${text}`, container, ) } } return els }
javascript
function getAllByLabelText(container, text, ...rest) { const els = queryAllByLabelText(container, text, ...rest) if (!els.length) { const labels = queryAllLabelsByText(container, text, ...rest) if (labels.length) { throw getElementError( `Found a label with the text of: ${text}, however no form control was found associated to that label. Make sure you're using the "for" attribute or "aria-labelledby" attribute correctly.`, container, ) } else { throw getElementError( `Unable to find a label with the text of: ${text}`, container, ) } } return els }
[ "function", "getAllByLabelText", "(", "container", ",", "text", ",", "...", "rest", ")", "{", "const", "els", "=", "queryAllByLabelText", "(", "container", ",", "text", ",", "...", "rest", ")", "if", "(", "!", "els", ".", "length", ")", "{", "const", "...
the getAll* query would normally look like this: const getAllByLabelText = makeGetAllQuery( queryAllByLabelText, (c, text) => `Unable to find a label with the text of: ${text}`, ) however, we can give a more helpful error message than the generic one, so we're writing this one out by hand.
[ "the", "getAll", "*", "query", "would", "normally", "look", "like", "this", ":", "const", "getAllByLabelText", "=", "makeGetAllQuery", "(", "queryAllByLabelText", "(", "c", "text", ")", "=", ">", "Unable", "to", "find", "a", "label", "with", "the", "text", ...
fcb2cbcffb7aff6ecff3be8731168c86eee82ce1
https://github.com/testing-library/dom-testing-library/blob/fcb2cbcffb7aff6ecff3be8731168c86eee82ce1/src/queries/label-text.js#L94-L111
train
Returns all elements with the given text
[ 30522, 3853, 2131, 8095, 3762, 20470, 20042, 10288, 2102, 1006, 11661, 1010, 3793, 1010, 1012, 1012, 1012, 2717, 1007, 1063, 9530, 3367, 3449, 2015, 1027, 23032, 8095, 3762, 20470, 20042, 10288, 2102, 1006, 11661, 1010, 3793, 1010, 1012, 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...
jgraph/mxgraph
javascript/mxClient.js
mxTerminalChange
function mxTerminalChange(model, cell, terminal, source) { this.model = model; this.cell = cell; this.terminal = terminal; this.previous = terminal; this.source = source; }
javascript
function mxTerminalChange(model, cell, terminal, source) { this.model = model; this.cell = cell; this.terminal = terminal; this.previous = terminal; this.source = source; }
[ "function", "mxTerminalChange", "(", "model", ",", "cell", ",", "terminal", ",", "source", ")", "{", "this", ".", "model", "=", "model", ";", "this", ".", "cell", "=", "cell", ";", "this", ".", "terminal", "=", "terminal", ";", "this", ".", "previous",...
Class: mxTerminalChange Action to change a terminal in a model. Constructor: mxTerminalChange Constructs a change of a terminal in the specified model.
[ "Class", ":", "mxTerminalChange" ]
33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44
https://github.com/jgraph/mxgraph/blob/33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44/javascript/mxClient.js#L41707-L41714
train
This is the main entry point of the terminal change event. It is called by the mxTerminalChange constructor.
[ 30522, 3853, 25630, 3334, 22311, 29358, 22043, 1006, 2944, 1010, 3526, 1010, 5536, 1010, 3120, 1007, 1063, 2023, 1012, 2944, 1027, 2944, 1025, 2023, 1012, 3526, 1027, 3526, 1025, 2023, 1012, 5536, 1027, 5536, 1025, 2023, 1012, 3025, 1027, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.core/src/sap/ui/model/odata/v4/lib/_Cache.js
missingValue
function missingValue(oValue, sSegment, iPathLength) { var sPropertyPath = "", sReadLink, sServiceUrl; if (sPath[0] !== '(') { sPropertyPath += "/"; } sPropertyPath += sPath.split("/").slice(0, iPathLength).join("/"); return that.oRequestor.getModelInterface() .fetchMetadata(that.sMetaPath + _Helper.getMetaPath(sPropertyPath)) .then(function (oProperty) { if (!oProperty) { return invalidSegment(sSegment); } if (oProperty.$Type === "Edm.Stream") { sReadLink = oValue[sSegment + "@odata.mediaReadLink"]; sServiceUrl = that.oRequestor.getServiceUrl(); return sReadLink || sServiceUrl + that.sResourcePath + sPropertyPath; } if (!bTransient) { return invalidSegment(sSegment); } if (oProperty.$kind === "NavigationProperty") { return null; } if (!oProperty.$Type.startsWith("Edm.")) { return {}; } if ("$DefaultValue" in oProperty) { return oProperty.$Type === "Edm.String" ? oProperty.$DefaultValue : _Helper.parseLiteral(oProperty.$DefaultValue, oProperty.$Type, sPropertyPath); } return null; }); }
javascript
function missingValue(oValue, sSegment, iPathLength) { var sPropertyPath = "", sReadLink, sServiceUrl; if (sPath[0] !== '(') { sPropertyPath += "/"; } sPropertyPath += sPath.split("/").slice(0, iPathLength).join("/"); return that.oRequestor.getModelInterface() .fetchMetadata(that.sMetaPath + _Helper.getMetaPath(sPropertyPath)) .then(function (oProperty) { if (!oProperty) { return invalidSegment(sSegment); } if (oProperty.$Type === "Edm.Stream") { sReadLink = oValue[sSegment + "@odata.mediaReadLink"]; sServiceUrl = that.oRequestor.getServiceUrl(); return sReadLink || sServiceUrl + that.sResourcePath + sPropertyPath; } if (!bTransient) { return invalidSegment(sSegment); } if (oProperty.$kind === "NavigationProperty") { return null; } if (!oProperty.$Type.startsWith("Edm.")) { return {}; } if ("$DefaultValue" in oProperty) { return oProperty.$Type === "Edm.String" ? oProperty.$DefaultValue : _Helper.parseLiteral(oProperty.$DefaultValue, oProperty.$Type, sPropertyPath); } return null; }); }
[ "function", "missingValue", "(", "oValue", ",", "sSegment", ",", "iPathLength", ")", "{", "var", "sPropertyPath", "=", "\"\"", ",", "sReadLink", ",", "sServiceUrl", ";", "if", "(", "sPath", "[", "0", "]", "!==", "'('", ")", "{", "sPropertyPath", "+=", "\...
Determine the implicit value if the value is missing in the cache. Report an invalid segment if there is no implicit value.
[ "Determine", "the", "implicit", "value", "if", "the", "value", "is", "missing", "in", "the", "cache", ".", "Report", "an", "invalid", "segment", "if", "there", "is", "no", "implicit", "value", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/v4/lib/_Cache.js#L429-L466
train
Returns the missing value if the given value is missing.
[ 30522, 3853, 4394, 10175, 5657, 1006, 9242, 5657, 1010, 7020, 13910, 3672, 1010, 24531, 2705, 7770, 13512, 2232, 1007, 1063, 13075, 11867, 18981, 15010, 15069, 1027, 1000, 1000, 1010, 5034, 13775, 13767, 1010, 7020, 2121, 7903, 11236, 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/editor/CSSInlineEditor.js
_getSelectorName
function _getSelectorName(editor, pos) { var tagInfo = HTMLUtils.getTagInfo(editor, pos), selectorName = "", reason; if (tagInfo.position.tokenType === HTMLUtils.TAG_NAME || tagInfo.position.tokenType === HTMLUtils.CLOSING_TAG) { // Type selector selectorName = tagInfo.tagName; } else if (tagInfo.position.tokenType === HTMLUtils.ATTR_NAME || tagInfo.position.tokenType === HTMLUtils.ATTR_VALUE) { if (tagInfo.attr.name === "class") { // Class selector. We only look for the class name // that includes the insertion point. For example, if // the attribute is: // class="error-dialog modal hide" // and the insertion point is inside "modal", we want ".modal" var attributeValue = tagInfo.attr.value; if (/\S/.test(attributeValue)) { var startIndex = attributeValue.substr(0, tagInfo.position.offset).lastIndexOf(" "); var endIndex = attributeValue.indexOf(" ", tagInfo.position.offset); selectorName = "." + attributeValue.substring( startIndex === -1 ? 0 : startIndex + 1, endIndex === -1 ? attributeValue.length : endIndex ); // If the insertion point is surrounded by space between two classnames, selectorName is "." if (selectorName === ".") { selectorName = ""; reason = Strings.ERROR_CSSQUICKEDIT_BETWEENCLASSES; } } else { reason = Strings.ERROR_CSSQUICKEDIT_CLASSNOTFOUND; } } else if (tagInfo.attr.name === "id") { // ID selector var trimmedVal = tagInfo.attr.value.trim(); if (trimmedVal) { selectorName = "#" + trimmedVal; } else { reason = Strings.ERROR_CSSQUICKEDIT_IDNOTFOUND; } } else { reason = Strings.ERROR_CSSQUICKEDIT_UNSUPPORTEDATTR; } } return { selectorName: selectorName, reason: reason }; }
javascript
function _getSelectorName(editor, pos) { var tagInfo = HTMLUtils.getTagInfo(editor, pos), selectorName = "", reason; if (tagInfo.position.tokenType === HTMLUtils.TAG_NAME || tagInfo.position.tokenType === HTMLUtils.CLOSING_TAG) { // Type selector selectorName = tagInfo.tagName; } else if (tagInfo.position.tokenType === HTMLUtils.ATTR_NAME || tagInfo.position.tokenType === HTMLUtils.ATTR_VALUE) { if (tagInfo.attr.name === "class") { // Class selector. We only look for the class name // that includes the insertion point. For example, if // the attribute is: // class="error-dialog modal hide" // and the insertion point is inside "modal", we want ".modal" var attributeValue = tagInfo.attr.value; if (/\S/.test(attributeValue)) { var startIndex = attributeValue.substr(0, tagInfo.position.offset).lastIndexOf(" "); var endIndex = attributeValue.indexOf(" ", tagInfo.position.offset); selectorName = "." + attributeValue.substring( startIndex === -1 ? 0 : startIndex + 1, endIndex === -1 ? attributeValue.length : endIndex ); // If the insertion point is surrounded by space between two classnames, selectorName is "." if (selectorName === ".") { selectorName = ""; reason = Strings.ERROR_CSSQUICKEDIT_BETWEENCLASSES; } } else { reason = Strings.ERROR_CSSQUICKEDIT_CLASSNOTFOUND; } } else if (tagInfo.attr.name === "id") { // ID selector var trimmedVal = tagInfo.attr.value.trim(); if (trimmedVal) { selectorName = "#" + trimmedVal; } else { reason = Strings.ERROR_CSSQUICKEDIT_IDNOTFOUND; } } else { reason = Strings.ERROR_CSSQUICKEDIT_UNSUPPORTEDATTR; } } return { selectorName: selectorName, reason: reason }; }
[ "function", "_getSelectorName", "(", "editor", ",", "pos", ")", "{", "var", "tagInfo", "=", "HTMLUtils", ".", "getTagInfo", "(", "editor", ",", "pos", ")", ",", "selectorName", "=", "\"\"", ",", "reason", ";", "if", "(", "tagInfo", ".", "position", ".", ...
Given a position in an HTML editor, returns the relevant selector for the attribute/tag surrounding that position, or "" if none is found. @param {!Editor} editor @param {!{line:Number, ch:Number}} pos @return {selectorName: {string}, reason: {string}} @private
[ "Given", "a", "position", "in", "an", "HTML", "editor", "returns", "the", "relevant", "selector", "for", "the", "attribute", "/", "tag", "surrounding", "that", "position", "or", "if", "none", "is", "found", "." ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/editor/CSSInlineEditor.js#L60-L111
train
Get selector name from tag position
[ 30522, 3853, 1035, 4152, 12260, 16761, 18442, 1006, 3559, 1010, 13433, 2015, 1007, 1063, 13075, 6415, 2378, 14876, 1027, 16129, 21823, 4877, 1012, 2131, 15900, 2378, 14876, 1006, 3559, 1010, 13433, 2015, 1007, 1010, 27000, 18442, 1027, 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...
apache/incubator-echarts
src/chart/sunburst/SunburstPiece.js
getRootId
function getRootId(node) { var ancestor = node; while (ancestor.depth > 1) { ancestor = ancestor.parentNode; } var virtualRoot = node.getAncestors()[0]; return zrUtil.indexOf(virtualRoot.children, ancestor); }
javascript
function getRootId(node) { var ancestor = node; while (ancestor.depth > 1) { ancestor = ancestor.parentNode; } var virtualRoot = node.getAncestors()[0]; return zrUtil.indexOf(virtualRoot.children, ancestor); }
[ "function", "getRootId", "(", "node", ")", "{", "var", "ancestor", "=", "node", ";", "while", "(", "ancestor", ".", "depth", ">", "1", ")", "{", "ancestor", "=", "ancestor", ".", "parentNode", ";", "}", "var", "virtualRoot", "=", "node", ".", "getAnces...
Get index of root in sorted order @param {TreeNode} node current node @return {number} index in root
[ "Get", "index", "of", "root", "in", "sorted", "order" ]
4d0ea095dc3929cb6de40c45748826e7999c7aa8
https://github.com/apache/incubator-echarts/blob/4d0ea095dc3929cb6de40c45748826e7999c7aa8/src/chart/sunburst/SunburstPiece.js#L392-L400
train
Get the root id of a node
[ 30522, 3853, 2131, 3217, 4140, 3593, 1006, 13045, 1007, 1063, 13075, 13032, 1027, 13045, 1025, 2096, 1006, 13032, 1012, 5995, 1028, 1015, 1007, 1063, 13032, 1027, 13032, 1012, 6687, 3630, 3207, 1025, 1065, 13075, 7484, 3217, 4140, 1027, 130...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
lovell/sharp
lib/input.js
clone
function clone () { const that = this; // Clone existing options const clone = this.constructor.call(); clone.options = Object.assign({}, this.options); // Pass 'finish' event to clone for Stream-based input if (this._isStreamInput()) { this.on('finish', function () { // Clone inherits input data that._flattenBufferIn(); clone.options.bufferIn = that.options.bufferIn; clone.emit('finish'); }); } return clone; }
javascript
function clone () { const that = this; // Clone existing options const clone = this.constructor.call(); clone.options = Object.assign({}, this.options); // Pass 'finish' event to clone for Stream-based input if (this._isStreamInput()) { this.on('finish', function () { // Clone inherits input data that._flattenBufferIn(); clone.options.bufferIn = that.options.bufferIn; clone.emit('finish'); }); } return clone; }
[ "function", "clone", "(", ")", "{", "const", "that", "=", "this", ";", "// Clone existing options", "const", "clone", "=", "this", ".", "constructor", ".", "call", "(", ")", ";", "clone", ".", "options", "=", "Object", ".", "assign", "(", "{", "}", ","...
Take a "snapshot" of the Sharp instance, returning a new instance. Cloned instances inherit the input of their parent instance. This allows multiple output Streams and therefore multiple processing pipelines to share a single input Stream. @example const pipeline = sharp().rotate(); pipeline.clone().resize(800, 600).pipe(firstWritableStream); pipeline.clone().extract({ left: 20, top: 20, width: 100, height: 100 }).pipe(secondWritableStream); readableStream.pipe(pipeline); // firstWritableStream receives auto-rotated, resized readableStream // secondWritableStream receives auto-rotated, extracted region of readableStream @returns {Sharp}
[ "Take", "a", "snapshot", "of", "the", "Sharp", "instance", "returning", "a", "new", "instance", ".", "Cloned", "instances", "inherit", "the", "input", "of", "their", "parent", "instance", ".", "This", "allows", "multiple", "output", "Streams", "and", "therefor...
05d76eeadfe54713606a615185b2da047923406b
https://github.com/lovell/sharp/blob/05d76eeadfe54713606a615185b2da047923406b/lib/input.js#L167-L182
train
Clone the object
[ 30522, 3853, 17598, 1006, 1007, 1063, 9530, 3367, 2008, 1027, 2023, 1025, 1013, 1013, 17598, 4493, 7047, 9530, 3367, 17598, 1027, 2023, 1012, 9570, 2953, 1012, 2655, 1006, 1007, 1025, 17598, 1012, 7047, 1027, 4874, 1012, 23911, 1006, 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...
juliangarnier/anime
src/index.js
setTargetsValue
function setTargetsValue(targets, properties) { const animatables = getAnimatables(targets); animatables.forEach(animatable => { for (let property in properties) { const value = getFunctionValue(properties[property], animatable); const target = animatable.target; const valueUnit = getUnit(value); const originalValue = getOriginalTargetValue(target, property, valueUnit, animatable); const unit = valueUnit || getUnit(originalValue); const to = getRelativeValue(validateValue(value, unit), originalValue); const animType = getAnimationType(target, property); setProgressValue[animType](target, property, to, animatable.transforms, true); } }); }
javascript
function setTargetsValue(targets, properties) { const animatables = getAnimatables(targets); animatables.forEach(animatable => { for (let property in properties) { const value = getFunctionValue(properties[property], animatable); const target = animatable.target; const valueUnit = getUnit(value); const originalValue = getOriginalTargetValue(target, property, valueUnit, animatable); const unit = valueUnit || getUnit(originalValue); const to = getRelativeValue(validateValue(value, unit), originalValue); const animType = getAnimationType(target, property); setProgressValue[animType](target, property, to, animatable.transforms, true); } }); }
[ "function", "setTargetsValue", "(", "targets", ",", "properties", ")", "{", "const", "animatables", "=", "getAnimatables", "(", "targets", ")", ";", "animatables", ".", "forEach", "(", "animatable", "=>", "{", "for", "(", "let", "property", "in", "properties",...
Set Value helper
[ "Set", "Value", "helper" ]
875a3d6745d4bff2e4c6ffe0e2d24aac3bf8a45a
https://github.com/juliangarnier/anime/blob/875a3d6745d4bff2e4c6ffe0e2d24aac3bf8a45a/src/index.js#L777-L791
train
Set the value of all targets in the given object
[ 30522, 3853, 2275, 7559, 18150, 2015, 10175, 5657, 1006, 7889, 1010, 5144, 1007, 1063, 9530, 3367, 2019, 9581, 10880, 2015, 1027, 2131, 7088, 21022, 13510, 1006, 7889, 1007, 1025, 2019, 9581, 10880, 2015, 1012, 18921, 6776, 1006, 2019, 9581...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SeleniumHQ/selenium
javascript/selenium-core/scripts/htmlutils.js
function( a, traditional ) { var s = []; // Set traditional to true for jQuery <= 1.3.2 behavior. if ( traditional === undefined ) { traditional = jQuery.ajaxSettings.traditional; } // If an array was passed in, assume that it is an array of form elements. if ( jQuery.isArray(a) || a.jquery ) { // Serialize the form elements jQuery.each( a, function() { add( this.name, this.value ); }); } else { // If traditional, encode the "old" way (the way 1.3.2 or older // did it), otherwise encode params recursively. for ( var prefix in a ) { buildParams( prefix, a[prefix] ); } } // Return the resulting serialization return s.join("&").replace(r20, "+"); function buildParams( prefix, obj ) { if ( jQuery.isArray(obj) ) { // Serialize array item. jQuery.each( obj, function( i, v ) { if ( traditional ) { // Treat each array item as a scalar. add( prefix, v ); } else { // If array item is non-scalar (array or object), encode its // numeric index to resolve deserialization ambiguity issues. // Note that rack (as of 1.0.0) can't currently deserialize // nested arrays properly, and attempting to do so may cause // a server error. Possible fixes are to modify rack's // deserialization algorithm or to provide an option or flag // to force array serialization to be shallow. buildParams( prefix + "[" + ( typeof v === "object" || jQuery.isArray(v) ? i : "" ) + "]", v ); } }); } else if ( !traditional && obj != null && typeof obj === "object" ) { // Serialize object item. jQuery.each( obj, function( k, v ) { buildParams( prefix + "[" + k + "]", v ); }); } else { // Serialize scalar item. add( prefix, obj ); } } function add( key, value ) { // If value is a function, invoke it and return its value value = jQuery.isFunction(value) ? value() : value; s[ s.length ] = encodeURIComponent(key) + "=" + encodeURIComponent(value); } }
javascript
function( a, traditional ) { var s = []; // Set traditional to true for jQuery <= 1.3.2 behavior. if ( traditional === undefined ) { traditional = jQuery.ajaxSettings.traditional; } // If an array was passed in, assume that it is an array of form elements. if ( jQuery.isArray(a) || a.jquery ) { // Serialize the form elements jQuery.each( a, function() { add( this.name, this.value ); }); } else { // If traditional, encode the "old" way (the way 1.3.2 or older // did it), otherwise encode params recursively. for ( var prefix in a ) { buildParams( prefix, a[prefix] ); } } // Return the resulting serialization return s.join("&").replace(r20, "+"); function buildParams( prefix, obj ) { if ( jQuery.isArray(obj) ) { // Serialize array item. jQuery.each( obj, function( i, v ) { if ( traditional ) { // Treat each array item as a scalar. add( prefix, v ); } else { // If array item is non-scalar (array or object), encode its // numeric index to resolve deserialization ambiguity issues. // Note that rack (as of 1.0.0) can't currently deserialize // nested arrays properly, and attempting to do so may cause // a server error. Possible fixes are to modify rack's // deserialization algorithm or to provide an option or flag // to force array serialization to be shallow. buildParams( prefix + "[" + ( typeof v === "object" || jQuery.isArray(v) ? i : "" ) + "]", v ); } }); } else if ( !traditional && obj != null && typeof obj === "object" ) { // Serialize object item. jQuery.each( obj, function( k, v ) { buildParams( prefix + "[" + k + "]", v ); }); } else { // Serialize scalar item. add( prefix, obj ); } } function add( key, value ) { // If value is a function, invoke it and return its value value = jQuery.isFunction(value) ? value() : value; s[ s.length ] = encodeURIComponent(key) + "=" + encodeURIComponent(value); } }
[ "function", "(", "a", ",", "traditional", ")", "{", "var", "s", "=", "[", "]", ";", "// Set traditional to true for jQuery <= 1.3.2 behavior.", "if", "(", "traditional", "===", "undefined", ")", "{", "traditional", "=", "jQuery", ".", "ajaxSettings", ".", "tradi...
Serialize an array of form elements or a set of key/values into a query string
[ "Serialize", "an", "array", "of", "form", "elements", "or", "a", "set", "of", "key", "/", "values", "into", "a", "query", "string" ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/javascript/selenium-core/scripts/htmlutils.js#L7817-L7879
train
Serialize an array of form elements
[ 30522, 3853, 1006, 1037, 1010, 3151, 1007, 1063, 13075, 1055, 1027, 1031, 1033, 1025, 1013, 1013, 2275, 3151, 2000, 2995, 2005, 1046, 4226, 2854, 1026, 1027, 1015, 1012, 1017, 1012, 1016, 5248, 1012, 2065, 1006, 3151, 1027, 1027, 1027, 61...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
angular/material
src/components/autocomplete/js/autocompleteDirective.js
MdAutocomplete
function MdAutocomplete ($$mdSvgRegistry) { var REPEAT_STANDARD = 'standard'; var REPEAT_VIRTUAL = 'virtual'; var REPEAT_MODES = [REPEAT_STANDARD, REPEAT_VIRTUAL]; /** get a valid repeat mode from an md-mode attribute string. */ function getRepeatMode(modeStr) { if (!modeStr) { return REPEAT_VIRTUAL; } modeStr = modeStr.toLowerCase(); return REPEAT_MODES.indexOf(modeStr) > -1 ? modeStr : REPEAT_VIRTUAL; } return { controller: 'MdAutocompleteCtrl', controllerAs: '$mdAutocompleteCtrl', scope: { inputName: '@mdInputName', inputMinlength: '@mdInputMinlength', inputMaxlength: '@mdInputMaxlength', searchText: '=?mdSearchText', selectedItem: '=?mdSelectedItem', itemsExpr: '@mdItems', itemText: '&mdItemText', placeholder: '@placeholder', inputAriaDescribedBy: '@?inputAriaDescribedby', inputAriaLabelledBy: '@?inputAriaLabelledby', inputAriaLabel: '@?inputAriaLabel', noCache: '=?mdNoCache', requireMatch: '=?mdRequireMatch', selectOnMatch: '=?mdSelectOnMatch', matchInsensitive: '=?mdMatchCaseInsensitive', itemChange: '&?mdSelectedItemChange', textChange: '&?mdSearchTextChange', minLength: '=?mdMinLength', delay: '=?mdDelay', autofocus: '=?mdAutofocus', floatingLabel: '@?mdFloatingLabel', autoselect: '=?mdAutoselect', menuClass: '@?mdMenuClass', menuContainerClass: '@?mdMenuContainerClass', inputClass: '@?mdInputClass', inputId: '@?mdInputId', escapeOptions: '@?mdEscapeOptions', dropdownItems: '=?mdDropdownItems', dropdownPosition: '@?mdDropdownPosition', clearButton: '=?mdClearButton', selectedMessage: '@?mdSelectedMessage', mdMode: '=?mdMode' }, compile: function(tElement, tAttrs) { var attributes = ['md-select-on-focus', 'md-no-asterisk', 'ng-trim', 'ng-pattern']; var input = tElement.find('input'); attributes.forEach(function(attribute) { var attrValue = tAttrs[tAttrs.$normalize(attribute)]; if (attrValue !== null) { input.attr(attribute, attrValue); } }); return function(scope, element, attrs, ctrl) { // Retrieve the state of using a md-not-found template by using our attribute, which will // be added to the element in the template function. ctrl.hasNotFound = !!element.attr('md-has-not-found'); // By default the inset autocomplete should show the clear button when not explicitly // overwritten or in floating label mode. if (!angular.isDefined(attrs.mdClearButton) && !scope.floatingLabel) { scope.clearButton = true; } scope.mdMode = getRepeatMode(attrs.mdMode); }; }, template: function (element, attr) { var noItemsTemplate = getNoItemsTemplate(), itemTemplate = getItemTemplate(), leftover = element.html(), tabindex = attr.tabindex; // Set our attribute for the link function above which runs later. // We will set an attribute, because otherwise the stored variables will be trashed when // removing the element is hidden while retrieving the template. For example when using ngIf. if (noItemsTemplate) element.attr('md-has-not-found', true); // Always set our tabindex of the autocomplete directive to -1, because our input // will hold the actual tabindex. element.attr('tabindex', '-1'); return '\ <md-autocomplete-wrap\ ng-class="{ \'md-whiteframe-z1\': !floatingLabel, \ \'md-menu-showing\': !$mdAutocompleteCtrl.hidden, \ \'md-show-clear-button\': !!clearButton }">\ ' + getInputElement() + '\ ' + getClearButton() + '\ <md-progress-linear\ class="' + (attr.mdFloatingLabel ? 'md-inline' : '') + '"\ ng-if="$mdAutocompleteCtrl.loadingIsVisible()"\ md-mode="indeterminate"></md-progress-linear>\ ' + getContainer(attr.mdMenuContainerClass, attr.mdMode) + '\ <ul class="md-autocomplete-suggestions"\ ng-class="::menuClass"\ id="ul-{{$mdAutocompleteCtrl.id}}"\ ng-mouseenter="$mdAutocompleteCtrl.listEnter()"\ ng-mouseleave="$mdAutocompleteCtrl.listLeave()"\ ng-mouseup="$mdAutocompleteCtrl.mouseUp()"\ role="listbox">\ <li ' + getRepeatType(attr.mdMode) + ' ="item in $mdAutocompleteCtrl.matches"\ ng-class="{ selected: $index === $mdAutocompleteCtrl.index }"\ ng-attr-id="{{$index === $mdAutocompleteCtrl.index ? \'selected_option\' : undefined}}"\ ng-click="$mdAutocompleteCtrl.select($index)"\ role="option"\ aria-setsize="{{$mdAutocompleteCtrl.matches.length}}"\ aria-posinset="{{$index+1}}"\ aria-selected="{{$index === $mdAutocompleteCtrl.index ? true : false}}" \ md-extra-name="$mdAutocompleteCtrl.itemName">\ ' + itemTemplate + '\ </li>' + noItemsTemplate + '\ </ul>\ ' + getContainerClosingTags(attr.mdMode) + '\ </md-autocomplete-wrap>'; function getItemTemplate() { var templateTag = element.find('md-item-template').detach(), html = templateTag.length ? templateTag.html() : element.html(); if (!templateTag.length) element.empty(); return '<md-autocomplete-parent-scope md-autocomplete-replace>' + html + '</md-autocomplete-parent-scope>'; } function getNoItemsTemplate() { var templateTag = element.find('md-not-found').detach(), template = templateTag.length ? templateTag.html() : ''; return template ? '<li ng-if="$mdAutocompleteCtrl.notFoundVisible()"\ md-autocomplete-parent-scope>' + template + '</li>' : ''; } function getContainer(menuContainerClass, repeatMode) { // prepend a space if needed menuContainerClass = menuContainerClass ? ' ' + menuContainerClass : ''; if (isVirtualRepeatDisabled(repeatMode)) { return '\ <div \ ng-hide="$mdAutocompleteCtrl.hidden"\ class="md-standard-list-container md-autocomplete-suggestions-container md-whiteframe-z1' + menuContainerClass + '"\ ng-class="{ \'md-not-found\': $mdAutocompleteCtrl.notFoundVisible() }"\ role="presentation">\ <div class="md-standard-list-scroller" role="presentation">'; } return '\ <md-virtual-repeat-container\ md-auto-shrink\ md-auto-shrink-min="1"\ ng-hide="$mdAutocompleteCtrl.hidden"\ class="md-virtual-repeat-container md-autocomplete-suggestions-container md-whiteframe-z1' + menuContainerClass + '"\ ng-class="{ \'md-not-found\': $mdAutocompleteCtrl.notFoundVisible() }"\ role="presentation">'; } function getContainerClosingTags(repeatMode) { return isVirtualRepeatDisabled(repeatMode) ? ' </div>\ </div>\ </div>' : '</md-virtual-repeat-container>'; } function getRepeatType(repeatMode) { return isVirtualRepeatDisabled(repeatMode) ? 'ng-repeat' : 'md-virtual-repeat'; } function isVirtualRepeatDisabled(repeatMode) { // ensure we have a valid repeat mode var correctedRepeatMode = getRepeatMode(repeatMode); return correctedRepeatMode !== REPEAT_VIRTUAL; } function getInputElement () { if (attr.mdFloatingLabel) { return '\ <md-input-container ng-if="floatingLabel">\ <label>{{floatingLabel}}</label>\ <input type="search"\ ' + (tabindex != null ? 'tabindex="' + tabindex + '"' : '') + '\ id="{{ inputId || \'fl-input-\' + $mdAutocompleteCtrl.id }}"\ name="{{inputName}}"\ ng-class="::inputClass"\ autocomplete="off"\ ng-required="$mdAutocompleteCtrl.isRequired"\ ng-readonly="$mdAutocompleteCtrl.isReadonly"\ ng-minlength="inputMinlength"\ ng-maxlength="inputMaxlength"\ ng-disabled="$mdAutocompleteCtrl.isDisabled"\ ng-model="$mdAutocompleteCtrl.scope.searchText"\ ng-model-options="{ allowInvalid: true }"\ ng-keydown="$mdAutocompleteCtrl.keydown($event)"\ ng-blur="$mdAutocompleteCtrl.blur($event)"\ ng-focus="$mdAutocompleteCtrl.focus($event)"\ aria-label="{{floatingLabel}}"\ aria-autocomplete="list"\ role="combobox"\ aria-haspopup="true"\ aria-expanded="{{!$mdAutocompleteCtrl.hidden}}"\ aria-owns="ul-{{$mdAutocompleteCtrl.id}}"\ ng-attr-aria-activedescendant="{{$mdAutocompleteCtrl.index >= 0 ? \'selected_option\' : undefined}}">\ <div md-autocomplete-parent-scope md-autocomplete-replace>' + leftover + '</div>\ </md-input-container>'; } else { return '\ <input type="search"\ ' + (tabindex != null ? 'tabindex="' + tabindex + '"' : '') + '\ id="{{ inputId || \'input-\' + $mdAutocompleteCtrl.id }}"\ name="{{inputName}}"\ ng-class="::inputClass"\ ng-if="!floatingLabel"\ autocomplete="off"\ ng-required="$mdAutocompleteCtrl.isRequired"\ ng-disabled="$mdAutocompleteCtrl.isDisabled"\ ng-readonly="$mdAutocompleteCtrl.isReadonly"\ ng-minlength="inputMinlength"\ ng-maxlength="inputMaxlength"\ ng-model="$mdAutocompleteCtrl.scope.searchText"\ ng-keydown="$mdAutocompleteCtrl.keydown($event)"\ ng-blur="$mdAutocompleteCtrl.blur($event)"\ ng-focus="$mdAutocompleteCtrl.focus($event)"\ placeholder="{{placeholder}}"\ aria-label="{{placeholder}}"\ aria-autocomplete="list"\ role="combobox"\ aria-haspopup="true"\ aria-expanded="{{!$mdAutocompleteCtrl.hidden}}"\ aria-owns="ul-{{$mdAutocompleteCtrl.id}}"\ ng-attr-aria-activedescendant="{{$mdAutocompleteCtrl.index >= 0 ? \'selected_option\' : undefined}}">'; } } function getClearButton() { return '' + '<button ' + 'type="button" ' + 'aria-label="Clear Input" ' + 'tabindex="-1" ' + 'ng-if="clearButton && $mdAutocompleteCtrl.scope.searchText" ' + 'ng-click="$mdAutocompleteCtrl.clear($event)">' + '<md-icon md-svg-src="' + $$mdSvgRegistry.mdClose + '"></md-icon>' + '</button>'; } } }; }
javascript
function MdAutocomplete ($$mdSvgRegistry) { var REPEAT_STANDARD = 'standard'; var REPEAT_VIRTUAL = 'virtual'; var REPEAT_MODES = [REPEAT_STANDARD, REPEAT_VIRTUAL]; /** get a valid repeat mode from an md-mode attribute string. */ function getRepeatMode(modeStr) { if (!modeStr) { return REPEAT_VIRTUAL; } modeStr = modeStr.toLowerCase(); return REPEAT_MODES.indexOf(modeStr) > -1 ? modeStr : REPEAT_VIRTUAL; } return { controller: 'MdAutocompleteCtrl', controllerAs: '$mdAutocompleteCtrl', scope: { inputName: '@mdInputName', inputMinlength: '@mdInputMinlength', inputMaxlength: '@mdInputMaxlength', searchText: '=?mdSearchText', selectedItem: '=?mdSelectedItem', itemsExpr: '@mdItems', itemText: '&mdItemText', placeholder: '@placeholder', inputAriaDescribedBy: '@?inputAriaDescribedby', inputAriaLabelledBy: '@?inputAriaLabelledby', inputAriaLabel: '@?inputAriaLabel', noCache: '=?mdNoCache', requireMatch: '=?mdRequireMatch', selectOnMatch: '=?mdSelectOnMatch', matchInsensitive: '=?mdMatchCaseInsensitive', itemChange: '&?mdSelectedItemChange', textChange: '&?mdSearchTextChange', minLength: '=?mdMinLength', delay: '=?mdDelay', autofocus: '=?mdAutofocus', floatingLabel: '@?mdFloatingLabel', autoselect: '=?mdAutoselect', menuClass: '@?mdMenuClass', menuContainerClass: '@?mdMenuContainerClass', inputClass: '@?mdInputClass', inputId: '@?mdInputId', escapeOptions: '@?mdEscapeOptions', dropdownItems: '=?mdDropdownItems', dropdownPosition: '@?mdDropdownPosition', clearButton: '=?mdClearButton', selectedMessage: '@?mdSelectedMessage', mdMode: '=?mdMode' }, compile: function(tElement, tAttrs) { var attributes = ['md-select-on-focus', 'md-no-asterisk', 'ng-trim', 'ng-pattern']; var input = tElement.find('input'); attributes.forEach(function(attribute) { var attrValue = tAttrs[tAttrs.$normalize(attribute)]; if (attrValue !== null) { input.attr(attribute, attrValue); } }); return function(scope, element, attrs, ctrl) { // Retrieve the state of using a md-not-found template by using our attribute, which will // be added to the element in the template function. ctrl.hasNotFound = !!element.attr('md-has-not-found'); // By default the inset autocomplete should show the clear button when not explicitly // overwritten or in floating label mode. if (!angular.isDefined(attrs.mdClearButton) && !scope.floatingLabel) { scope.clearButton = true; } scope.mdMode = getRepeatMode(attrs.mdMode); }; }, template: function (element, attr) { var noItemsTemplate = getNoItemsTemplate(), itemTemplate = getItemTemplate(), leftover = element.html(), tabindex = attr.tabindex; // Set our attribute for the link function above which runs later. // We will set an attribute, because otherwise the stored variables will be trashed when // removing the element is hidden while retrieving the template. For example when using ngIf. if (noItemsTemplate) element.attr('md-has-not-found', true); // Always set our tabindex of the autocomplete directive to -1, because our input // will hold the actual tabindex. element.attr('tabindex', '-1'); return '\ <md-autocomplete-wrap\ ng-class="{ \'md-whiteframe-z1\': !floatingLabel, \ \'md-menu-showing\': !$mdAutocompleteCtrl.hidden, \ \'md-show-clear-button\': !!clearButton }">\ ' + getInputElement() + '\ ' + getClearButton() + '\ <md-progress-linear\ class="' + (attr.mdFloatingLabel ? 'md-inline' : '') + '"\ ng-if="$mdAutocompleteCtrl.loadingIsVisible()"\ md-mode="indeterminate"></md-progress-linear>\ ' + getContainer(attr.mdMenuContainerClass, attr.mdMode) + '\ <ul class="md-autocomplete-suggestions"\ ng-class="::menuClass"\ id="ul-{{$mdAutocompleteCtrl.id}}"\ ng-mouseenter="$mdAutocompleteCtrl.listEnter()"\ ng-mouseleave="$mdAutocompleteCtrl.listLeave()"\ ng-mouseup="$mdAutocompleteCtrl.mouseUp()"\ role="listbox">\ <li ' + getRepeatType(attr.mdMode) + ' ="item in $mdAutocompleteCtrl.matches"\ ng-class="{ selected: $index === $mdAutocompleteCtrl.index }"\ ng-attr-id="{{$index === $mdAutocompleteCtrl.index ? \'selected_option\' : undefined}}"\ ng-click="$mdAutocompleteCtrl.select($index)"\ role="option"\ aria-setsize="{{$mdAutocompleteCtrl.matches.length}}"\ aria-posinset="{{$index+1}}"\ aria-selected="{{$index === $mdAutocompleteCtrl.index ? true : false}}" \ md-extra-name="$mdAutocompleteCtrl.itemName">\ ' + itemTemplate + '\ </li>' + noItemsTemplate + '\ </ul>\ ' + getContainerClosingTags(attr.mdMode) + '\ </md-autocomplete-wrap>'; function getItemTemplate() { var templateTag = element.find('md-item-template').detach(), html = templateTag.length ? templateTag.html() : element.html(); if (!templateTag.length) element.empty(); return '<md-autocomplete-parent-scope md-autocomplete-replace>' + html + '</md-autocomplete-parent-scope>'; } function getNoItemsTemplate() { var templateTag = element.find('md-not-found').detach(), template = templateTag.length ? templateTag.html() : ''; return template ? '<li ng-if="$mdAutocompleteCtrl.notFoundVisible()"\ md-autocomplete-parent-scope>' + template + '</li>' : ''; } function getContainer(menuContainerClass, repeatMode) { // prepend a space if needed menuContainerClass = menuContainerClass ? ' ' + menuContainerClass : ''; if (isVirtualRepeatDisabled(repeatMode)) { return '\ <div \ ng-hide="$mdAutocompleteCtrl.hidden"\ class="md-standard-list-container md-autocomplete-suggestions-container md-whiteframe-z1' + menuContainerClass + '"\ ng-class="{ \'md-not-found\': $mdAutocompleteCtrl.notFoundVisible() }"\ role="presentation">\ <div class="md-standard-list-scroller" role="presentation">'; } return '\ <md-virtual-repeat-container\ md-auto-shrink\ md-auto-shrink-min="1"\ ng-hide="$mdAutocompleteCtrl.hidden"\ class="md-virtual-repeat-container md-autocomplete-suggestions-container md-whiteframe-z1' + menuContainerClass + '"\ ng-class="{ \'md-not-found\': $mdAutocompleteCtrl.notFoundVisible() }"\ role="presentation">'; } function getContainerClosingTags(repeatMode) { return isVirtualRepeatDisabled(repeatMode) ? ' </div>\ </div>\ </div>' : '</md-virtual-repeat-container>'; } function getRepeatType(repeatMode) { return isVirtualRepeatDisabled(repeatMode) ? 'ng-repeat' : 'md-virtual-repeat'; } function isVirtualRepeatDisabled(repeatMode) { // ensure we have a valid repeat mode var correctedRepeatMode = getRepeatMode(repeatMode); return correctedRepeatMode !== REPEAT_VIRTUAL; } function getInputElement () { if (attr.mdFloatingLabel) { return '\ <md-input-container ng-if="floatingLabel">\ <label>{{floatingLabel}}</label>\ <input type="search"\ ' + (tabindex != null ? 'tabindex="' + tabindex + '"' : '') + '\ id="{{ inputId || \'fl-input-\' + $mdAutocompleteCtrl.id }}"\ name="{{inputName}}"\ ng-class="::inputClass"\ autocomplete="off"\ ng-required="$mdAutocompleteCtrl.isRequired"\ ng-readonly="$mdAutocompleteCtrl.isReadonly"\ ng-minlength="inputMinlength"\ ng-maxlength="inputMaxlength"\ ng-disabled="$mdAutocompleteCtrl.isDisabled"\ ng-model="$mdAutocompleteCtrl.scope.searchText"\ ng-model-options="{ allowInvalid: true }"\ ng-keydown="$mdAutocompleteCtrl.keydown($event)"\ ng-blur="$mdAutocompleteCtrl.blur($event)"\ ng-focus="$mdAutocompleteCtrl.focus($event)"\ aria-label="{{floatingLabel}}"\ aria-autocomplete="list"\ role="combobox"\ aria-haspopup="true"\ aria-expanded="{{!$mdAutocompleteCtrl.hidden}}"\ aria-owns="ul-{{$mdAutocompleteCtrl.id}}"\ ng-attr-aria-activedescendant="{{$mdAutocompleteCtrl.index >= 0 ? \'selected_option\' : undefined}}">\ <div md-autocomplete-parent-scope md-autocomplete-replace>' + leftover + '</div>\ </md-input-container>'; } else { return '\ <input type="search"\ ' + (tabindex != null ? 'tabindex="' + tabindex + '"' : '') + '\ id="{{ inputId || \'input-\' + $mdAutocompleteCtrl.id }}"\ name="{{inputName}}"\ ng-class="::inputClass"\ ng-if="!floatingLabel"\ autocomplete="off"\ ng-required="$mdAutocompleteCtrl.isRequired"\ ng-disabled="$mdAutocompleteCtrl.isDisabled"\ ng-readonly="$mdAutocompleteCtrl.isReadonly"\ ng-minlength="inputMinlength"\ ng-maxlength="inputMaxlength"\ ng-model="$mdAutocompleteCtrl.scope.searchText"\ ng-keydown="$mdAutocompleteCtrl.keydown($event)"\ ng-blur="$mdAutocompleteCtrl.blur($event)"\ ng-focus="$mdAutocompleteCtrl.focus($event)"\ placeholder="{{placeholder}}"\ aria-label="{{placeholder}}"\ aria-autocomplete="list"\ role="combobox"\ aria-haspopup="true"\ aria-expanded="{{!$mdAutocompleteCtrl.hidden}}"\ aria-owns="ul-{{$mdAutocompleteCtrl.id}}"\ ng-attr-aria-activedescendant="{{$mdAutocompleteCtrl.index >= 0 ? \'selected_option\' : undefined}}">'; } } function getClearButton() { return '' + '<button ' + 'type="button" ' + 'aria-label="Clear Input" ' + 'tabindex="-1" ' + 'ng-if="clearButton && $mdAutocompleteCtrl.scope.searchText" ' + 'ng-click="$mdAutocompleteCtrl.clear($event)">' + '<md-icon md-svg-src="' + $$mdSvgRegistry.mdClose + '"></md-icon>' + '</button>'; } } }; }
[ "function", "MdAutocomplete", "(", "$$mdSvgRegistry", ")", "{", "var", "REPEAT_STANDARD", "=", "'standard'", ";", "var", "REPEAT_VIRTUAL", "=", "'virtual'", ";", "var", "REPEAT_MODES", "=", "[", "REPEAT_STANDARD", ",", "REPEAT_VIRTUAL", "]", ";", "/** get a valid re...
@ngdoc directive @name mdAutocomplete @module material.components.autocomplete @description `<md-autocomplete>` is a special input component with a drop-down of all possible matches to a custom query. This component allows you to provide real-time suggestions as the user types in the input area. To start, you will need to specify the required parameters and provide a template for your results. The content inside `md-autocomplete` will be treated as a template. In more complex cases, you may want to include other content such as a message to display when no matches were found. You can do this by wrapping your template in `md-item-template` and adding a tag for `md-not-found`. An example of this is shown below. To reset the displayed value you must clear both values for `md-search-text` and `md-selected-item`. ### Validation You can use `ng-messages` to include validation the same way that you would normally validate; however, if you want to replicate a standard input with a floating label, you will have to do the following: - Make sure that your template is wrapped in `md-item-template` - Add your `ng-messages` code inside of `md-autocomplete` - Add your validation properties to `md-autocomplete` (ie. `required`) - Add a `name` to `md-autocomplete` (to be used on the generated `input`) There is an example below of how this should look. ### Snapping Drop-Down You can cause the autocomplete drop-down to snap to an ancestor element by applying the `md-autocomplete-snap` attribute to that element. You can also snap to the width of the `md-autocomplete-snap` element by setting the attribute's value to `width` (ie. `md-autocomplete-snap="width"`). ### Notes **Autocomplete Dropdown Items Rendering** The `md-autocomplete` uses the the <a ng-href="api/directive/mdVirtualRepeat"> mdVirtualRepeat</a> directive for displaying the results inside of the dropdown.<br/> > When encountering issues regarding the item template please take a look at the <a ng-href="api/directive/mdVirtualRepeatContainer">VirtualRepeatContainer</a> documentation. **Autocomplete inside of a Virtual Repeat** When using the `md-autocomplete` directive inside of a <a ng-href="api/directive/mdVirtualRepeatContainer">VirtualRepeatContainer</a> the dropdown items might not update properly, because caching of the results is enabled by default. The autocomplete will then show invalid dropdown items, because the Virtual Repeat only updates the scope bindings rather than re-creating the `md-autocomplete`. This means that the previous cached results will be used. > To avoid such problems, ensure that the autocomplete does not cache any results via `md-no-cache="true"`: <hljs lang="html"> <md-autocomplete md-no-cache="true" md-selected-item="selectedItem" md-items="item in items" md-search-text="searchText" md-item-text="item.display"> <span>{{ item.display }}</span> </md-autocomplete> </hljs> @param {expression} md-items An expression in the format of `item in results` to iterate over matches for your search.<br/><br/> The `results` expression can be also a function, which returns the results synchronously or asynchronously (per Promise). @param {expression=} md-selected-item-change An expression to be run each time a new item is selected. @param {expression=} md-search-text-change An expression to be run each time the search text updates. @param {expression=} md-search-text A model to bind the search query text to. @param {object=} md-selected-item A model to bind the selected item to. @param {expression=} md-item-text An expression that will convert your object to a single string. @param {string=} placeholder Placeholder text that will be forwarded to the input. @param {boolean=} md-no-cache Disables the internal caching that happens in autocomplete. @param {boolean=} ng-disabled Determines whether or not to disable the input field. @param {boolean=} md-require-match When set to true, the autocomplete will add a validator, which will evaluate to false, when no item is currently selected. @param {number=} md-min-length Specifies the minimum length of text before autocomplete will make suggestions. @param {number=} md-delay Specifies the amount of time (in milliseconds) to wait before looking for results. @param {boolean=} md-clear-button Whether the clear button for the autocomplete input should show up or not. @param {boolean=} md-autofocus If true, the autocomplete will be automatically focused when a `$mdDialog`, `$mdBottomsheet` or `$mdSidenav`, which contains the autocomplete, is opening. <br/><br/> Also the autocomplete will immediately focus the input element. @param {boolean=} md-no-asterisk When present, asterisk will not be appended to the floating label. @param {boolean=} md-autoselect If set to true, the first item will be automatically selected in the dropdown upon open. @param {string=} md-input-name The name attribute given to the input element to be used with FormController. @param {string=} md-menu-class This class will be applied to the dropdown menu for styling. @param {string=} md-menu-container-class This class will be applied to the parent container of the dropdown panel. @param {string=} md-input-class This will be applied to the input for styling. This attribute is only valid when a `md-floating-label` is defined. @param {string=} md-floating-label This will add a floating label to autocomplete and wrap it in `md-input-container`. @param {string=} md-select-on-focus When present the input's text will be automatically selected on focus. @param {string=} md-input-id An ID to be added to the input element. @param {number=} md-input-minlength The minimum length for the input's value for validation. @param {number=} md-input-maxlength The maximum length for the input's value for validation. @param {boolean=} md-select-on-match When set, autocomplete will automatically select the item if the search text is an exact match. <br/><br/> An exact match is when only one match is displayed. @param {boolean=} md-match-case-insensitive When set and using `md-select-on-match`, autocomplete will select on case-insensitive match. @param {string=} md-escape-options Override escape key logic. Default is `blur clear`.<br/> Options: `blur`, `clear`, `none`. @param {string=} md-dropdown-items Specifies the maximum amount of items to be shown in the dropdown.<br/><br/> When the dropdown doesn't fit into the viewport, the dropdown will shrink as much as possible. @param {string=} md-dropdown-position Overrides the default dropdown position. Options: `top`, `bottom`. @param {string=} input-aria-describedby A space-separated list of element IDs. This should contain the IDs of any elements that describe this autocomplete. Screen readers will read the content of these elements at the end of announcing that the autocomplete has been selected and describing its current state. The descriptive elements do not need to be visible on the page. @param {string=} input-aria-labelledby A space-separated list of element IDs. The ideal use case is that this would contain the ID of a `<label>` element that is associated with this autocomplete. This will only have affect when `md-floating-label` is not defined.<br><br> For `<label id="state">US State</label>`, you would set this to `input-aria-labelledby="state"`. @param {string=} input-aria-label A label that will be applied to the autocomplete's input. This will be announced by screen readers before the placeholder. This will only have affect when `md-floating-label` is not defined. If you define both `input-aria-label` and `input-aria-labelledby`, then `input-aria-label` will take precedence. @param {string=} md-selected-message Attribute to specify the text that the screen reader will announce after a value is selected. Default is: "selected". If `Alaska` is selected in the options panel, it will read "Alaska selected". You will want to override this when your app is running in a non-English locale. @param {boolean=} ng-trim If set to false, the search text will be not trimmed automatically. Defaults to true. @param {string=} ng-pattern Adds the pattern validator to the ngModel of the search text. See the [ngPattern Directive](https://docs.angularjs.org/api/ng/directive/ngPattern) for more details. @param {string=} md-mode Specify the repeat mode for suggestion lists. Acceptable values include `virtual` (md-virtual-repeat) and `standard` (ng-repeat). See the `Specifying Repeat Mode` example for mode details. Default is `virtual`. @usage ### Basic Example <hljs lang="html"> <md-autocomplete md-selected-item="selectedItem" md-search-text="searchText" md-items="item in getMatches(searchText)" md-item-text="item.display"> <span md-highlight-text="searchText">{{item.display}}</span> </md-autocomplete> </hljs> ### Example with "not found" message <hljs lang="html"> <md-autocomplete md-selected-item="selectedItem" md-search-text="searchText" md-items="item in getMatches(searchText)" md-item-text="item.display"> <md-item-template> <span md-highlight-text="searchText">{{item.display}}</span> </md-item-template> <md-not-found> No matches found. </md-not-found> </md-autocomplete> </hljs> In this example, our code utilizes `md-item-template` and `md-not-found` to specify the different parts that make up our component. ### Clear button for the input By default, the clear button is displayed when there is input. This aligns with the spec's [Search Pattern](https://material.io/archive/guidelines/patterns/search.html#search-in-app-search). In floating label mode, when `md-floating-label="My Label"` is applied, the clear button is not displayed by default (see the spec's [Autocomplete Text Field](https://material.io/archive/guidelines/components/text-fields.html#text-fields-layout)). Nevertheless, developers are able to explicitly toggle the clear button for all autocomplete components with `md-clear-button`. <hljs lang="html"> <md-autocomplete ... md-clear-button="true"></md-autocomplete> <md-autocomplete ... md-clear-button="false"></md-autocomplete> </hljs> In previous versions, the clear button was always hidden when the component was disabled. This changed in `1.1.5` to give the developer control of this behavior. This example will hide the clear button only when the component is disabled. <hljs lang="html"> <md-autocomplete ... ng-disabled="disabled" md-clear-button="!disabled"></md-autocomplete> </hljs> ### Example with validation <hljs lang="html"> <form name="autocompleteForm"> <md-autocomplete required md-input-name="autocomplete" md-selected-item="selectedItem" md-search-text="searchText" md-items="item in getMatches(searchText)" md-item-text="item.display"> <md-item-template> <span md-highlight-text="searchText">{{item.display}}</span> </md-item-template> <div ng-messages="autocompleteForm.autocomplete.$error"> <div ng-message="required">This field is required</div> </div> </md-autocomplete> </form> </hljs> In this example, our code utilizes `md-item-template` and `ng-messages` to specify input validation for the field. ### Asynchronous Results The autocomplete items expression also supports promises, which will resolve with the query results. <hljs lang="js"> function AppController($scope, $http) { $scope.query = function(searchText) { return $http .get(BACKEND_URL + '/items/' + searchText) .then(function(data) { // Map the response object to the data object. return data; }); }; } </hljs> <hljs lang="html"> <md-autocomplete md-selected-item="selectedItem" md-search-text="searchText" md-items="item in query(searchText)"> <md-item-template> <span md-highlight-text="searchText">{{item}}</span> </md-item-template> </md-autocomplete> </hljs> ### Specifying Repeat Mode You can use `md-mode` to specify whether to use standard or virtual lists for rendering autocomplete options. The `md-mode` accepts two values: - `virtual` (default) Uses `md-virtual-repeat` to render list items. Virtual mode requires you to have consistent heights for all suggestions. - `standard` uses `ng-repeat` to render list items. This allows you to have options of varying heights. Note that using 'standard' mode will require you to address any list performance issues (e.g. pagination) separately within your application. <hljs lang="html"> <md-autocomplete md-selected-item="selectedItem" md-search-text="searchText" md-items="item in getMatches(searchText)" md-item-text="item.display" md-mode="standard"> <span md-highlight-text="searchText">{{item.display}}</span> </md-autocomplete> </hljs>
[ "@ngdoc", "directive", "@name", "mdAutocomplete", "@module", "material", ".", "components", ".", "autocomplete" ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/autocomplete/js/autocompleteDirective.js#L292-L547
train
Augment the md - autocomplete attribute
[ 30522, 3853, 9108, 4887, 3406, 9006, 10814, 2618, 1006, 1002, 1002, 9108, 2015, 2615, 17603, 24063, 2854, 1007, 1063, 13075, 9377, 1035, 3115, 1027, 1005, 3115, 1005, 1025, 13075, 9377, 1035, 7484, 1027, 1005, 7484, 1005, 1025, 13075, 9377,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
adobe/brackets
src/extensions/default/CodeFolding/foldhelpers/foldgutter.js
moveRange
function moveRange(range, numLines) { return {from: CodeMirror.Pos(range.from.line + numLines, range.from.ch), to: CodeMirror.Pos(range.to.line + numLines, range.to.ch)}; }
javascript
function moveRange(range, numLines) { return {from: CodeMirror.Pos(range.from.line + numLines, range.from.ch), to: CodeMirror.Pos(range.to.line + numLines, range.to.ch)}; }
[ "function", "moveRange", "(", "range", ",", "numLines", ")", "{", "return", "{", "from", ":", "CodeMirror", ".", "Pos", "(", "range", ".", "from", ".", "line", "+", "numLines", ",", "range", ".", "from", ".", "ch", ")", ",", "to", ":", "CodeMirror", ...
Helper function to move a fold range object by the specified number of lines @param {Object} range An object specifying the fold range to move. It contains {from, to} which are CodeMirror.Pos objects. @param {Number} numLines A positive or negative number representing the numbe of lines to move the range by
[ "Helper", "function", "to", "move", "a", "fold", "range", "object", "by", "the", "specified", "number", "of", "lines" ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/extensions/default/CodeFolding/foldhelpers/foldgutter.js#L190-L193
train
Move the given range to the next line
[ 30522, 3853, 2693, 24388, 2063, 1006, 2846, 1010, 16371, 19968, 10586, 1007, 1063, 2709, 1063, 2013, 1024, 3642, 14503, 29165, 1012, 13433, 2015, 1006, 2846, 1012, 2013, 1012, 2240, 1009, 16371, 19968, 10586, 1010, 2846, 1012, 2013, 1012, 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...
NetEase/pomelo
lib/connectors/hybrid/tcpsocket.js
function(socket, data, offset) { var hlen = socket.headSize - socket.headOffset; var dlen = data.length - offset; var len = Math.min(hlen, dlen); var dend = offset + len; data.copy(socket.headBuffer, socket.headOffset, offset, dend); socket.headOffset += len; if(socket.headOffset === socket.headSize) { // if head segment finished var size = socket.headHandler(socket.headBuffer); if(size < 0) { throw new Error('invalid body size: ' + size); } // check if header contains a valid type if(checkTypeData(socket.headBuffer[0])) { socket.packageSize = size + socket.headSize; socket.packageBuffer = new Buffer(socket.packageSize); socket.headBuffer.copy(socket.packageBuffer, 0, 0, socket.headSize); socket.packageOffset = socket.headSize; socket.state = ST_BODY; } else { dend = data.length; logger.error('close the connection with invalid head message, the remote ip is %s && port is %s && message is %j', socket._socket.remoteAddress, socket._socket.remotePort, data); socket.close(); } } return dend; }
javascript
function(socket, data, offset) { var hlen = socket.headSize - socket.headOffset; var dlen = data.length - offset; var len = Math.min(hlen, dlen); var dend = offset + len; data.copy(socket.headBuffer, socket.headOffset, offset, dend); socket.headOffset += len; if(socket.headOffset === socket.headSize) { // if head segment finished var size = socket.headHandler(socket.headBuffer); if(size < 0) { throw new Error('invalid body size: ' + size); } // check if header contains a valid type if(checkTypeData(socket.headBuffer[0])) { socket.packageSize = size + socket.headSize; socket.packageBuffer = new Buffer(socket.packageSize); socket.headBuffer.copy(socket.packageBuffer, 0, 0, socket.headSize); socket.packageOffset = socket.headSize; socket.state = ST_BODY; } else { dend = data.length; logger.error('close the connection with invalid head message, the remote ip is %s && port is %s && message is %j', socket._socket.remoteAddress, socket._socket.remotePort, data); socket.close(); } } return dend; }
[ "function", "(", "socket", ",", "data", ",", "offset", ")", "{", "var", "hlen", "=", "socket", ".", "headSize", "-", "socket", ".", "headOffset", ";", "var", "dlen", "=", "data", ".", "length", "-", "offset", ";", "var", "len", "=", "Math", ".", "m...
Read head segment from data to socket.headBuffer. @param {Object} socket Socket instance @param {Object} data Buffer instance @param {Number} offset offset read star from data @return {Number} new offset of data after read
[ "Read", "head", "segment", "from", "data", "to", "socket", ".", "headBuffer", "." ]
defcf019631ed399cc4dad932d3b028a04a039a4
https://github.com/NetEase/pomelo/blob/defcf019631ed399cc4dad932d3b028a04a039a4/lib/connectors/hybrid/tcpsocket.js#L129-L160
train
read the head message
[ 30522, 3853, 1006, 22278, 1010, 2951, 1010, 16396, 1007, 1063, 13075, 1044, 7770, 1027, 22278, 1012, 4641, 4697, 1011, 22278, 1012, 2132, 27475, 3388, 1025, 13075, 21469, 2368, 1027, 2951, 1012, 3091, 1011, 16396, 1025, 13075, 18798, 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...
aframevr/aframe
src/systems/material.js
function (src, data, handleImageTextureLoaded) { var hash = this.hash(data); var textureCache = this.textureCache; // Texture already being loaded or already loaded. Wait on promise. if (textureCache[hash]) { textureCache[hash].then(handleImageTextureLoaded); return; } // Texture not yet being loaded. Start loading it. textureCache[hash] = loadImageTexture(src, data); textureCache[hash].then(handleImageTextureLoaded); }
javascript
function (src, data, handleImageTextureLoaded) { var hash = this.hash(data); var textureCache = this.textureCache; // Texture already being loaded or already loaded. Wait on promise. if (textureCache[hash]) { textureCache[hash].then(handleImageTextureLoaded); return; } // Texture not yet being loaded. Start loading it. textureCache[hash] = loadImageTexture(src, data); textureCache[hash].then(handleImageTextureLoaded); }
[ "function", "(", "src", ",", "data", ",", "handleImageTextureLoaded", ")", "{", "var", "hash", "=", "this", ".", "hash", "(", "data", ")", ";", "var", "textureCache", "=", "this", ".", "textureCache", ";", "// Texture already being loaded or already loaded. Wait o...
High-level function for loading image textures (THREE.Texture). @param {Element|string} src - Texture source. @param {object} data - Texture data. @param {function} cb - Callback to pass texture to.
[ "High", "-", "level", "function", "for", "loading", "image", "textures", "(", "THREE", ".", "Texture", ")", "." ]
24acc78a7299a4cdfe3ef617f4d40ddf6275c992
https://github.com/aframevr/aframe/blob/24acc78a7299a4cdfe3ef617f4d40ddf6275c992/src/systems/material.js#L79-L92
train
Load an image texture
[ 30522, 3853, 1006, 5034, 2278, 1010, 2951, 1010, 5047, 9581, 18150, 10288, 11244, 17468, 1007, 1063, 13075, 23325, 1027, 2023, 1012, 23325, 1006, 2951, 1007, 1025, 13075, 14902, 3540, 30524, 1025, 2709, 1025, 1065, 1013, 1013, 14902, 2025, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
wuchangming/spy-debugger
buildin_modules/weinre/web/client/UglifyJS/process.js
Scope
function Scope(parent) { this.names = {}; // names defined in this scope this.mangled = {}; // mangled names (orig.name => mangled) this.rev_mangled = {}; // reverse lookup (mangled => orig.name) this.cname = -1; // current mangled name this.refs = {}; // names referenced from this scope this.uses_with = false; // will become TRUE if eval() is detected in this or any subscopes this.uses_eval = false; // will become TRUE if with() is detected in this or any subscopes this.parent = parent; // parent scope this.children = []; // sub-scopes if (parent) { this.level = parent.level + 1; parent.children.push(this); } else { this.level = 0; } }
javascript
function Scope(parent) { this.names = {}; // names defined in this scope this.mangled = {}; // mangled names (orig.name => mangled) this.rev_mangled = {}; // reverse lookup (mangled => orig.name) this.cname = -1; // current mangled name this.refs = {}; // names referenced from this scope this.uses_with = false; // will become TRUE if eval() is detected in this or any subscopes this.uses_eval = false; // will become TRUE if with() is detected in this or any subscopes this.parent = parent; // parent scope this.children = []; // sub-scopes if (parent) { this.level = parent.level + 1; parent.children.push(this); } else { this.level = 0; } }
[ "function", "Scope", "(", "parent", ")", "{", "this", ".", "names", "=", "{", "}", ";", "// names defined in this scope", "this", ".", "mangled", "=", "{", "}", ";", "// mangled names (orig.name => mangled)", "this", ".", "rev_mangled", "=", "{", "}", ";", "...
/* -----[ Scope and mangling ]-----
[ "/", "*", "-----", "[", "Scope", "and", "mangling", "]", "-----" ]
55c1dda0dff0c44920673711656ddfd7ff03c307
https://github.com/wuchangming/spy-debugger/blob/55c1dda0dff0c44920673711656ddfd7ff03c307/buildin_modules/weinre/web/client/UglifyJS/process.js#L253-L269
train
Scope constructor.
[ 30522, 3853, 9531, 1006, 6687, 1007, 1063, 2023, 1012, 3415, 1027, 1063, 1065, 1025, 1013, 1013, 3415, 4225, 1999, 2023, 9531, 2023, 1012, 2158, 11533, 1027, 1063, 1065, 1025, 1013, 1013, 2158, 11533, 3415, 1006, 2030, 8004, 1012, 2171, 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...
cytoscape/cytoscape.js
src/collection/index.js
function( cy, elements, options ){ if( cy === undefined || !is.core( cy ) ){ util.error( 'A collection must have a reference to the core' ); return; } let map = new Map(); let createdElements = false; if( !elements ){ elements = []; } else if( elements.length > 0 && is.plainObject( elements[0] ) && !is.element( elements[0] ) ){ createdElements = true; // make elements from json and restore all at once later let eles = []; let elesIds = new Set(); for( let i = 0, l = elements.length; i < l; i++ ){ let json = elements[ i ]; if( json.data == null ){ json.data = {}; } let data = json.data; // make sure newly created elements have valid ids if( data.id == null ){ data.id = idFactory.generate( cy, json ); } else if( cy.hasElementWithId( data.id ) || elesIds.has( data.id ) ){ continue; // can't create element if prior id already exists } let ele = new Element( cy, json, false ); eles.push( ele ); elesIds.add( data.id ); } elements = eles; } this.length = 0; for( let i = 0, l = elements.length; i < l; i++ ){ let element = elements[i][0]; // [0] in case elements is an array of collections, rather than array of elements if( element == null ){ continue; } let id = element._private.data.id; if( options == null || ( options.unique && !map.has(id) ) ){ map.set( id, { index: this.length, ele: element } ); this[ this.length ] = element; this.length++; } } this._private = { cy: cy, map: map }; // restore the elements if we created them from json if( createdElements ){ this.restore(); } }
javascript
function( cy, elements, options ){ if( cy === undefined || !is.core( cy ) ){ util.error( 'A collection must have a reference to the core' ); return; } let map = new Map(); let createdElements = false; if( !elements ){ elements = []; } else if( elements.length > 0 && is.plainObject( elements[0] ) && !is.element( elements[0] ) ){ createdElements = true; // make elements from json and restore all at once later let eles = []; let elesIds = new Set(); for( let i = 0, l = elements.length; i < l; i++ ){ let json = elements[ i ]; if( json.data == null ){ json.data = {}; } let data = json.data; // make sure newly created elements have valid ids if( data.id == null ){ data.id = idFactory.generate( cy, json ); } else if( cy.hasElementWithId( data.id ) || elesIds.has( data.id ) ){ continue; // can't create element if prior id already exists } let ele = new Element( cy, json, false ); eles.push( ele ); elesIds.add( data.id ); } elements = eles; } this.length = 0; for( let i = 0, l = elements.length; i < l; i++ ){ let element = elements[i][0]; // [0] in case elements is an array of collections, rather than array of elements if( element == null ){ continue; } let id = element._private.data.id; if( options == null || ( options.unique && !map.has(id) ) ){ map.set( id, { index: this.length, ele: element } ); this[ this.length ] = element; this.length++; } } this._private = { cy: cy, map: map }; // restore the elements if we created them from json if( createdElements ){ this.restore(); } }
[ "function", "(", "cy", ",", "elements", ",", "options", ")", "{", "if", "(", "cy", "===", "undefined", "||", "!", "is", ".", "core", "(", "cy", ")", ")", "{", "util", ".", "error", "(", "'A collection must have a reference to the core'", ")", ";", "retur...
represents a set of nodes, edges, or both together
[ "represents", "a", "set", "of", "nodes", "edges", "or", "both", "together" ]
ad2051b65e2243cfd953d8b24a8bf95bfa8559e5
https://github.com/cytoscape/cytoscape.js/blob/ad2051b65e2243cfd953d8b24a8bf95bfa8559e5/src/collection/index.js#L38-L108
train
Creates an array of elements from a json object
[ 30522, 3853, 1006, 22330, 1010, 3787, 1010, 7047, 1007, 1063, 2065, 1006, 22330, 1027, 1027, 1027, 6151, 28344, 1064, 1064, 999, 2003, 1012, 4563, 1006, 22330, 1007, 1007, 1063, 21183, 4014, 1012, 7561, 1006, 1005, 1037, 3074, 2442, 2031, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/dom/containsOrEquals.js
function(oDomRefContainer, oDomRefChild) { if (oDomRefChild && oDomRefContainer && oDomRefChild != document && oDomRefChild != window) { return (oDomRefContainer === oDomRefChild) || jQuery.contains(oDomRefContainer, oDomRefChild); } return false; }
javascript
function(oDomRefContainer, oDomRefChild) { if (oDomRefChild && oDomRefContainer && oDomRefChild != document && oDomRefChild != window) { return (oDomRefContainer === oDomRefChild) || jQuery.contains(oDomRefContainer, oDomRefChild); } return false; }
[ "function", "(", "oDomRefContainer", ",", "oDomRefChild", ")", "{", "if", "(", "oDomRefChild", "&&", "oDomRefContainer", "&&", "oDomRefChild", "!=", "document", "&&", "oDomRefChild", "!=", "window", ")", "{", "return", "(", "oDomRefContainer", "===", "oDomRefChild...
Returns whether <code>oDomRefChild</code> is contained in or equal to <code>oDomRefContainer</code>. This is a browser-independent version of the <code>.contains</code> method of Internet Explorer. For compatibility reasons it returns <code>true</code> if <code>oDomRefContainer</code> and <code>oDomRefChild</code> are equal. This method intentionally does not operate on the jQuery object, as the original <code>jQuery.contains()</code> method also does not do so. @function @since 1.58 @param {Element} oDomRefContainer The container element @param {Element} oDomRefChild The child element (must not be a text node, must be an element) @return {boolean} Whether <code>oDomRefChild</code> is contained in or equal to <code>oDomRefContainer</code> @public @alias module:sap/ui/dom/containsOrEquals
[ "Returns", "whether", "<code", ">", "oDomRefChild<", "/", "code", ">", "is", "contained", "in", "or", "equal", "to", "<code", ">", "oDomRefContainer<", "/", "code", ">", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/dom/containsOrEquals.js#L25-L30
train
Returns true if the given DOM reference is a descendant of the given DOM reference.
[ 30522, 3853, 1006, 1051, 9527, 2890, 11329, 12162, 18175, 2099, 1010, 1051, 9527, 2890, 11329, 19466, 2094, 1007, 1063, 2065, 1006, 1051, 9527, 2890, 11329, 19466, 2094, 1004, 1004, 1051, 9527, 2890, 11329, 12162, 18175, 2099, 1004, 1004, 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...
verdaccio/verdaccio
src/lib/logger.js
setup
function setup(logs) { const streams = []; if (logs == null) { logs = [{ type: 'stdout', format: 'pretty', level: 'http' }]; } logs.forEach(function(target) { let level = target.level || 35; if (level === 'http') { level = 35; } // create a stream for each log configuration if (target.type === 'rotating-file') { if (target.format !== 'json') { throw new Error('Rotating file streams only work with JSON!'); } if (cluster.isWorker) { // https://github.com/trentm/node-bunyan#stream-type-rotating-file throw new Error('Cluster mode is not supported for rotating-file!'); } const stream = new VerdaccioRotatingFileStream( _.merge( {}, // Defaults can be found here: https://github.com/trentm/node-bunyan#stream-type-rotating-file target.options || {}, { path: target.path, level } ) ); streams.push({ type: 'raw', level, stream, }); } else { const stream = new Stream(); stream.writable = true; let destination; let destinationIsTTY = false; if (target.type === 'file') { // destination stream destination = require('fs').createWriteStream(target.path, { flags: 'a', encoding: 'utf8' }); destination.on('error', function(err) { stream.emit('error', err); }); } else if (target.type === 'stdout' || target.type === 'stderr') { destination = target.type === 'stdout' ? process.stdout : process.stderr; destinationIsTTY = destination.isTTY; } else { throw Error('wrong target type for a log'); } if (target.format === 'pretty') { // making fake stream for pretty printing stream.write = obj => { destination.write(`${print(obj.level, obj.msg, obj, destinationIsTTY)}\n`); }; } else if (target.format === 'pretty-timestamped') { // making fake stream for pretty printing stream.write = obj => { destination.write(`[${dayjs(obj.time).format('YYYY-MM-DD HH:mm:ss')}] ${print(obj.level, obj.msg, obj, destinationIsTTY)}\n`); }; } else { stream.write = obj => { const msg = fillInMsgTemplate(obj.msg, obj, destinationIsTTY); destination.write(`${JSON.stringify({ ...obj, msg }, Logger.safeCycles())}\n`); }; } streams.push({ type: 'raw', level, stream: stream, }); } }); // buyan default configuration const logger = new Logger({ name: pkgJSON.name, streams: streams, serializers: { err: Logger.stdSerializers.err, req: Logger.stdSerializers.req, res: Logger.stdSerializers.res, }, }); process.on('SIGUSR2', function() { Logger.reopenFileStreams(); }); module.exports.logger = logger; }
javascript
function setup(logs) { const streams = []; if (logs == null) { logs = [{ type: 'stdout', format: 'pretty', level: 'http' }]; } logs.forEach(function(target) { let level = target.level || 35; if (level === 'http') { level = 35; } // create a stream for each log configuration if (target.type === 'rotating-file') { if (target.format !== 'json') { throw new Error('Rotating file streams only work with JSON!'); } if (cluster.isWorker) { // https://github.com/trentm/node-bunyan#stream-type-rotating-file throw new Error('Cluster mode is not supported for rotating-file!'); } const stream = new VerdaccioRotatingFileStream( _.merge( {}, // Defaults can be found here: https://github.com/trentm/node-bunyan#stream-type-rotating-file target.options || {}, { path: target.path, level } ) ); streams.push({ type: 'raw', level, stream, }); } else { const stream = new Stream(); stream.writable = true; let destination; let destinationIsTTY = false; if (target.type === 'file') { // destination stream destination = require('fs').createWriteStream(target.path, { flags: 'a', encoding: 'utf8' }); destination.on('error', function(err) { stream.emit('error', err); }); } else if (target.type === 'stdout' || target.type === 'stderr') { destination = target.type === 'stdout' ? process.stdout : process.stderr; destinationIsTTY = destination.isTTY; } else { throw Error('wrong target type for a log'); } if (target.format === 'pretty') { // making fake stream for pretty printing stream.write = obj => { destination.write(`${print(obj.level, obj.msg, obj, destinationIsTTY)}\n`); }; } else if (target.format === 'pretty-timestamped') { // making fake stream for pretty printing stream.write = obj => { destination.write(`[${dayjs(obj.time).format('YYYY-MM-DD HH:mm:ss')}] ${print(obj.level, obj.msg, obj, destinationIsTTY)}\n`); }; } else { stream.write = obj => { const msg = fillInMsgTemplate(obj.msg, obj, destinationIsTTY); destination.write(`${JSON.stringify({ ...obj, msg }, Logger.safeCycles())}\n`); }; } streams.push({ type: 'raw', level, stream: stream, }); } }); // buyan default configuration const logger = new Logger({ name: pkgJSON.name, streams: streams, serializers: { err: Logger.stdSerializers.err, req: Logger.stdSerializers.req, res: Logger.stdSerializers.res, }, }); process.on('SIGUSR2', function() { Logger.reopenFileStreams(); }); module.exports.logger = logger; }
[ "function", "setup", "(", "logs", ")", "{", "const", "streams", "=", "[", "]", ";", "if", "(", "logs", "==", "null", ")", "{", "logs", "=", "[", "{", "type", ":", "'stdout'", ",", "format", ":", "'pretty'", ",", "level", ":", "'http'", "}", "]", ...
Setup the Buyan logger @param {*} logs list of log configuration
[ "Setup", "the", "Buyan", "logger" ]
daa7e897b6d093bf8282ff12df3f450bcd73476c
https://github.com/verdaccio/verdaccio/blob/daa7e897b6d093bf8282ff12df3f450bcd73476c/src/lib/logger.js#L54-L150
train
Creates a stream for the given logs
[ 30522, 3853, 16437, 1006, 15664, 1007, 1063, 9530, 3367, 9199, 1027, 1031, 1033, 1025, 2065, 1006, 15664, 1027, 1027, 19701, 1007, 1063, 15664, 1027, 1031, 1063, 2828, 1024, 1005, 2358, 26797, 2102, 1005, 1010, 4289, 1024, 1005, 3492, 1005,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SeleniumHQ/selenium
third_party/js/mozmill/shared-modules/dom-utils.js
DOMWalker
function DOMWalker(controller, callbackFilter, callbackNodeTest, callbackResults) { this._controller = controller; this._callbackFilter = callbackFilter; this._callbackNodeTest = callbackNodeTest; this._callbackResults = callbackResults; }
javascript
function DOMWalker(controller, callbackFilter, callbackNodeTest, callbackResults) { this._controller = controller; this._callbackFilter = callbackFilter; this._callbackNodeTest = callbackNodeTest; this._callbackResults = callbackResults; }
[ "function", "DOMWalker", "(", "controller", ",", "callbackFilter", ",", "callbackNodeTest", ",", "callbackResults", ")", "{", "this", ".", "_controller", "=", "controller", ";", "this", ".", "_callbackFilter", "=", "callbackFilter", ";", "this", ".", "_callbackNod...
DOMWalker Constructor @param {MozMillController} controller MozMill controller of the window to operate on. @param {Function} callbackFilter callback-method to filter nodes @param {Function} callbackNodeTest callback-method to test accepted nodes @param {Function} callbackResults callback-method to process the results [optional - default: undefined]
[ "DOMWalker", "Constructor" ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/js/mozmill/shared-modules/dom-utils.js#L79-L86
train
DOMWalker constructor.
[ 30522, 3853, 14383, 26965, 1006, 11486, 1010, 2655, 5963, 8873, 21928, 1010, 2655, 5963, 3630, 3207, 22199, 1010, 2655, 5963, 6072, 11314, 2015, 1007, 1063, 2023, 1012, 1035, 11486, 1027, 11486, 1025, 2023, 1012, 1035, 2655, 5963, 8873, 219...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/InlineColorEditor/ColorEditor.js
ColorEditor
function ColorEditor($parent, color, callback, swatches) { // Create the DOM structure, filling in localized strings via Mustache this.$element = $(Mustache.render(ColorEditorTemplate, Strings)); $parent.append(this.$element); this._callback = callback; this._handleKeydown = this._handleKeydown.bind(this); this._handleOpacityKeydown = this._handleOpacityKeydown.bind(this); this._handleHslKeydown = this._handleHslKeydown.bind(this); this._handleHueKeydown = this._handleHueKeydown.bind(this); this._handleSelectionKeydown = this._handleSelectionKeydown.bind(this); this._handleOpacityDrag = this._handleOpacityDrag.bind(this); this._handleHueDrag = this._handleHueDrag.bind(this); this._handleSelectionFieldDrag = this._handleSelectionFieldDrag.bind(this); this._originalColor = color; this._color = checkSetFormat(color); this._redoColor = null; this._isUpperCase = PreferencesManager.get("uppercaseColors"); PreferencesManager.on("change", "uppercaseColors", function () { this._isUpperCase = PreferencesManager.get("uppercaseColors"); }.bind(this)); this.$colorValue = this.$element.find(".color-value"); this.$buttonList = this.$element.find("ul.button-bar"); this.$rgbaButton = this.$element.find(".rgba"); this.$hexButton = this.$element.find(".hex"); this.$hslButton = this.$element.find(".hsla"); this.$0xButton = this.$element.find(".0x"); this.$currentColor = this.$element.find(".current-color"); this.$originalColor = this.$element.find(".original-color"); this.$selection = this.$element.find(".color-selection-field"); this.$selectionBase = this.$element.find(".color-selection-field .selector-base"); this.$hueBase = this.$element.find(".hue-slider .selector-base"); this.$opacityGradient = this.$element.find(".opacity-gradient"); this.$hueSlider = this.$element.find(".hue-slider"); this.$hueSelector = this.$element.find(".hue-slider .selector-base"); this.$opacitySlider = this.$element.find(".opacity-slider"); this.$opacitySelector = this.$element.find(".opacity-slider .selector-base"); this.$swatches = this.$element.find(".swatches"); // Create quick-access color swatches this._addSwatches(swatches); // Attach event listeners to main UI elements this._addListeners(); // Initially selected color this.$originalColor.css("background-color", checkSetFormat(this._originalColor)); this._commitColor(color); }
javascript
function ColorEditor($parent, color, callback, swatches) { // Create the DOM structure, filling in localized strings via Mustache this.$element = $(Mustache.render(ColorEditorTemplate, Strings)); $parent.append(this.$element); this._callback = callback; this._handleKeydown = this._handleKeydown.bind(this); this._handleOpacityKeydown = this._handleOpacityKeydown.bind(this); this._handleHslKeydown = this._handleHslKeydown.bind(this); this._handleHueKeydown = this._handleHueKeydown.bind(this); this._handleSelectionKeydown = this._handleSelectionKeydown.bind(this); this._handleOpacityDrag = this._handleOpacityDrag.bind(this); this._handleHueDrag = this._handleHueDrag.bind(this); this._handleSelectionFieldDrag = this._handleSelectionFieldDrag.bind(this); this._originalColor = color; this._color = checkSetFormat(color); this._redoColor = null; this._isUpperCase = PreferencesManager.get("uppercaseColors"); PreferencesManager.on("change", "uppercaseColors", function () { this._isUpperCase = PreferencesManager.get("uppercaseColors"); }.bind(this)); this.$colorValue = this.$element.find(".color-value"); this.$buttonList = this.$element.find("ul.button-bar"); this.$rgbaButton = this.$element.find(".rgba"); this.$hexButton = this.$element.find(".hex"); this.$hslButton = this.$element.find(".hsla"); this.$0xButton = this.$element.find(".0x"); this.$currentColor = this.$element.find(".current-color"); this.$originalColor = this.$element.find(".original-color"); this.$selection = this.$element.find(".color-selection-field"); this.$selectionBase = this.$element.find(".color-selection-field .selector-base"); this.$hueBase = this.$element.find(".hue-slider .selector-base"); this.$opacityGradient = this.$element.find(".opacity-gradient"); this.$hueSlider = this.$element.find(".hue-slider"); this.$hueSelector = this.$element.find(".hue-slider .selector-base"); this.$opacitySlider = this.$element.find(".opacity-slider"); this.$opacitySelector = this.$element.find(".opacity-slider .selector-base"); this.$swatches = this.$element.find(".swatches"); // Create quick-access color swatches this._addSwatches(swatches); // Attach event listeners to main UI elements this._addListeners(); // Initially selected color this.$originalColor.css("background-color", checkSetFormat(this._originalColor)); this._commitColor(color); }
[ "function", "ColorEditor", "(", "$parent", ",", "color", ",", "callback", ",", "swatches", ")", "{", "// Create the DOM structure, filling in localized strings via Mustache", "this", ".", "$element", "=", "$", "(", "Mustache", ".", "render", "(", "ColorEditorTemplate", ...
Color picker control; may be used standalone or within an InlineColorEditor inline widget. @param {!jQuery} $parent DOM node into which to append the root of the color picker UI @param {!string} color Initially selected color @param {!function(string)} callback Called whenever selected color changes @param {!Array.<{value:string, count:number}>} swatches Quick-access color swatches to include in UI
[ "Color", "picker", "control", ";", "may", "be", "used", "standalone", "or", "within", "an", "InlineColorEditor", "inline", "widget", "." ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/extensions/default/InlineColorEditor/ColorEditor.js#L106-L159
train
ColorEditor constructor.
[ 30522, 3853, 6910, 15660, 1006, 1002, 6687, 1010, 3609, 1010, 2655, 5963, 1010, 25414, 8376, 1007, 1063, 1013, 1013, 3443, 1996, 14383, 3252, 1010, 8110, 1999, 22574, 7817, 3081, 28786, 2023, 1012, 1002, 5783, 1027, 1002, 1006, 28786, 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...
adobe/brackets
src/LiveDevelopment/LiveDevServerManager.js
getServer
function getServer(localPath) { var provider, server, i; for (i = 0; i < _serverProviders.length; i++) { provider = _serverProviders[i]; server = provider.create(); if (server.canServe(localPath)) { return server; } } return null; }
javascript
function getServer(localPath) { var provider, server, i; for (i = 0; i < _serverProviders.length; i++) { provider = _serverProviders[i]; server = provider.create(); if (server.canServe(localPath)) { return server; } } return null; }
[ "function", "getServer", "(", "localPath", ")", "{", "var", "provider", ",", "server", ",", "i", ";", "for", "(", "i", "=", "0", ";", "i", "<", "_serverProviders", ".", "length", ";", "i", "++", ")", "{", "provider", "=", "_serverProviders", "[", "i"...
Determines which provider can serve a file with a local path. @param {string} localPath A local path to file being served. @return {?BaseServer} A server no null if no servers can serve the file
[ "Determines", "which", "provider", "can", "serve", "a", "file", "with", "a", "local", "path", "." ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/LiveDevelopment/LiveDevServerManager.js#L63-L76
train
Get a server instance from the list of server providers
[ 30522, 3853, 4152, 2121, 6299, 1006, 2334, 15069, 1007, 1063, 13075, 10802, 1010, 8241, 1010, 1045, 1025, 2005, 1006, 1045, 1027, 1014, 1025, 1045, 1026, 1035, 8241, 21572, 17258, 2545, 1012, 3091, 1025, 1045, 1009, 1009, 1007, 1063, 10802,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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...
wangfupeng1988/wangEditor
src/js/menus/fontSize/index.js
FontSize
function FontSize(editor) { this.editor = editor this.$elem = $('<div class="w-e-menu"><i class="w-e-icon-text-heigh"></i></div>') this.type = 'droplist' // 当前是否 active 状态 this._active = false // 初始化 droplist this.droplist = new DropList(this, { width: 160, $title: $('<p>字号</p>'), type: 'list', // droplist 以列表形式展示 list: [ { $elem: $('<span style="font-size: x-small;">x-small</span>'), value: '1' }, { $elem: $('<span style="font-size: small;">small</span>'), value: '2' }, { $elem: $('<span>normal</span>'), value: '3' }, { $elem: $('<span style="font-size: large;">large</span>'), value: '4' }, { $elem: $('<span style="font-size: x-large;">x-large</span>'), value: '5' }, { $elem: $('<span style="font-size: xx-large;">xx-large</span>'), value: '6' } ], onClick: (value) => { // 注意 this 是指向当前的 FontSize 对象 this._command(value) } }) }
javascript
function FontSize(editor) { this.editor = editor this.$elem = $('<div class="w-e-menu"><i class="w-e-icon-text-heigh"></i></div>') this.type = 'droplist' // 当前是否 active 状态 this._active = false // 初始化 droplist this.droplist = new DropList(this, { width: 160, $title: $('<p>字号</p>'), type: 'list', // droplist 以列表形式展示 list: [ { $elem: $('<span style="font-size: x-small;">x-small</span>'), value: '1' }, { $elem: $('<span style="font-size: small;">small</span>'), value: '2' }, { $elem: $('<span>normal</span>'), value: '3' }, { $elem: $('<span style="font-size: large;">large</span>'), value: '4' }, { $elem: $('<span style="font-size: x-large;">x-large</span>'), value: '5' }, { $elem: $('<span style="font-size: xx-large;">xx-large</span>'), value: '6' } ], onClick: (value) => { // 注意 this 是指向当前的 FontSize 对象 this._command(value) } }) }
[ "function", "FontSize", "(", "editor", ")", "{", "this", ".", "editor", "=", "editor", "this", ".", "$elem", "=", "$", "(", "'<div class=\"w-e-menu\"><i class=\"w-e-icon-text-heigh\"></i></div>'", ")", "this", ".", "type", "=", "'droplist'", "// 当前是否 active 状态", "th...
构造函数
[ "构造函数" ]
b77696f5e81c8ec13d9d341252d6b9fa8a22db18
https://github.com/wangfupeng1988/wangEditor/blob/b77696f5e81c8ec13d9d341252d6b9fa8a22db18/src/js/menus/fontSize/index.js#L9-L35
train
Font size 对象
[ 30522, 3853, 15489, 5332, 4371, 1006, 3559, 1007, 1063, 2023, 1012, 3559, 1027, 3559, 2023, 1012, 1002, 3449, 6633, 1027, 1002, 1006, 1005, 1026, 4487, 2615, 2465, 1027, 1000, 1059, 1011, 1041, 1011, 12183, 1000, 1028, 1026, 1045, 2465, 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...
SeleniumHQ/selenium
javascript/selenium-core/scripts/htmlutils.js
clone
function clone(orig) { var copy; switch(typeof(orig)) { case 'object': copy = (orig.length) ? [] : {}; for (var attr in orig) { copy[attr] = clone(orig[attr]); } break; default: copy = orig; break; } return copy; }
javascript
function clone(orig) { var copy; switch(typeof(orig)) { case 'object': copy = (orig.length) ? [] : {}; for (var attr in orig) { copy[attr] = clone(orig[attr]); } break; default: copy = orig; break; } return copy; }
[ "function", "clone", "(", "orig", ")", "{", "var", "copy", ";", "switch", "(", "typeof", "(", "orig", ")", ")", "{", "case", "'object'", ":", "copy", "=", "(", "orig", ".", "length", ")", "?", "[", "]", ":", "{", "}", ";", "for", "(", "var", ...
Create a clone of an object and return it. This is a deep copy of everything but functions, whose references are copied. You shouldn't expect a deep copy of functions anyway. @param orig the original object to copy @return a deep copy of the original object. Any functions attached, however, will have their references copied only.
[ "Create", "a", "clone", "of", "an", "object", "and", "return", "it", ".", "This", "is", "a", "deep", "copy", "of", "everything", "but", "functions", "whose", "references", "are", "copied", ".", "You", "shouldn", "t", "expect", "a", "deep", "copy", "of", ...
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/javascript/selenium-core/scripts/htmlutils.js#L2339-L2353
train
Clone an object
[ 30522, 3853, 17598, 1006, 2030, 8004, 1007, 1063, 13075, 6100, 1025, 6942, 1006, 2828, 11253, 1006, 2030, 8004, 1007, 1007, 1063, 2553, 1005, 4874, 1005, 1024, 6100, 1027, 1006, 2030, 8004, 1012, 3091, 1007, 1029, 1031, 1033, 1024, 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/extensions/default/InAppNotifications/main.js
checkForNotification
function checkForNotification(versionInfoUrl) { var result = new $.Deferred(); _getNotificationInformation(versionInfoUrl) .done(function (notificationInfo) { // Get all available notifications var notifications = notificationInfo.notifications; if (notifications && notifications.length > 0) { // Iterate through notifications and act only on the most recent // applicable notification notifications.every(function(notificationObj) { // Only show the notification overlay if the user hasn't been // alerted of this notification if (_checkNotificationValidity(notificationObj)) { if (notificationObj.silent) { // silent notifications, to gather user validity based on filters HealthLogger.sendAnalyticsData("notification", notificationObj.sequence, "handled"); } else { showNotification(notificationObj); } // Break, we have acted on one notification already return false; } // Continue, we haven't yet got a notification to act on return true; }); } result.resolve(); }) .fail(function () { // Error fetching the update data. If this is a forced check, alert the user result.reject(); }); return result.promise(); }
javascript
function checkForNotification(versionInfoUrl) { var result = new $.Deferred(); _getNotificationInformation(versionInfoUrl) .done(function (notificationInfo) { // Get all available notifications var notifications = notificationInfo.notifications; if (notifications && notifications.length > 0) { // Iterate through notifications and act only on the most recent // applicable notification notifications.every(function(notificationObj) { // Only show the notification overlay if the user hasn't been // alerted of this notification if (_checkNotificationValidity(notificationObj)) { if (notificationObj.silent) { // silent notifications, to gather user validity based on filters HealthLogger.sendAnalyticsData("notification", notificationObj.sequence, "handled"); } else { showNotification(notificationObj); } // Break, we have acted on one notification already return false; } // Continue, we haven't yet got a notification to act on return true; }); } result.resolve(); }) .fail(function () { // Error fetching the update data. If this is a forced check, alert the user result.reject(); }); return result.promise(); }
[ "function", "checkForNotification", "(", "versionInfoUrl", ")", "{", "var", "result", "=", "new", "$", ".", "Deferred", "(", ")", ";", "_getNotificationInformation", "(", "versionInfoUrl", ")", ".", "done", "(", "function", "(", "notificationInfo", ")", "{", "...
Check for notifications, notification overlays are always displayed @return {$.Promise} jQuery Promise object that is resolved or rejected after the notification check is complete.
[ "Check", "for", "notifications", "notification", "overlays", "are", "always", "displayed" ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/extensions/default/InAppNotifications/main.js#L157-L192
train
Checks if the user has been notified on a notification
[ 30522, 3853, 4638, 29278, 17048, 9031, 1006, 2544, 2378, 14876, 3126, 2140, 1007, 1063, 13075, 2765, 1027, 2047, 1002, 1012, 13366, 28849, 2094, 1006, 1007, 1025, 1035, 2131, 17048, 9031, 2378, 14192, 3370, 1006, 2544, 2378, 14876, 3126, 21...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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
mergeOptions
function mergeOptions() { config = _.defaultsDeep(configFile, Moleculer.ServiceBroker.defaultOptions); if (config.logger == null && !flags.silent) config.logger = console; function normalizeEnvValue(value) { if (value.toLowerCase() === "true" || value.toLowerCase() === "false") { // Convert to boolean value = value === "true"; } else if (!isNaN(value)) { // Convert to number value = Number(value); } return value; } function overwriteFromEnv(obj, prefix) { Object.keys(obj).forEach(key => { const envName = ((prefix ? prefix + "_" : "") + key).toUpperCase(); if (process.env[envName]) { obj[key] = normalizeEnvValue(process.env[envName]); } if (_.isPlainObject(obj[key])) obj[key] = overwriteFromEnv(obj[key], (prefix ? prefix + "_" : "") + key); }); const moleculerPrefix = "MOL_"; Object.keys(process.env) .filter(key => key.startsWith(moleculerPrefix)) .map(key => ({ key, withoutPrefix: key.substr(moleculerPrefix.length) })) .forEach(variable => { const dotted = variable.withoutPrefix .split("__") .map(level => level.toLocaleLowerCase()) .map(level => level .split("_") .map((value, index) => { if (index == 0) { return value; } else { return value[0].toUpperCase() + value.substring(1); } }) .join("") ) .join("."); obj = utils.dotSet(obj, dotted, normalizeEnvValue(process.env[variable.key])); }); return obj; } config = overwriteFromEnv(config); if (flags.silent) { config.logger = null; } if (flags.hot) { config.hotReload = true; } //console.log("Config", config); }
javascript
function mergeOptions() { config = _.defaultsDeep(configFile, Moleculer.ServiceBroker.defaultOptions); if (config.logger == null && !flags.silent) config.logger = console; function normalizeEnvValue(value) { if (value.toLowerCase() === "true" || value.toLowerCase() === "false") { // Convert to boolean value = value === "true"; } else if (!isNaN(value)) { // Convert to number value = Number(value); } return value; } function overwriteFromEnv(obj, prefix) { Object.keys(obj).forEach(key => { const envName = ((prefix ? prefix + "_" : "") + key).toUpperCase(); if (process.env[envName]) { obj[key] = normalizeEnvValue(process.env[envName]); } if (_.isPlainObject(obj[key])) obj[key] = overwriteFromEnv(obj[key], (prefix ? prefix + "_" : "") + key); }); const moleculerPrefix = "MOL_"; Object.keys(process.env) .filter(key => key.startsWith(moleculerPrefix)) .map(key => ({ key, withoutPrefix: key.substr(moleculerPrefix.length) })) .forEach(variable => { const dotted = variable.withoutPrefix .split("__") .map(level => level.toLocaleLowerCase()) .map(level => level .split("_") .map((value, index) => { if (index == 0) { return value; } else { return value[0].toUpperCase() + value.substring(1); } }) .join("") ) .join("."); obj = utils.dotSet(obj, dotted, normalizeEnvValue(process.env[variable.key])); }); return obj; } config = overwriteFromEnv(config); if (flags.silent) { config.logger = null; } if (flags.hot) { config.hotReload = true; } //console.log("Config", config); }
[ "function", "mergeOptions", "(", ")", "{", "config", "=", "_", ".", "defaultsDeep", "(", "configFile", ",", "Moleculer", ".", "ServiceBroker", ".", "defaultOptions", ")", ";", "if", "(", "config", ".", "logger", "==", "null", "&&", "!", "flags", ".", "si...
Merge broker options Merge options from environment variables and config file. First load the config file if exists. After it overwrite the vars from the environment values. Example options: Original broker option: `logLevel` Config file property: `logLevel` Env variable: `LOGLEVEL` Original broker option: `circuitBreaker.enabled` Config file property: `circuitBreaker.enabled` Env variable: `CIRCUITBREAKER_ENABLED`
[ "Merge", "broker", "options" ]
f95aadc2d61b0d0e3c643a43c3ed28bca6425cde
https://github.com/moleculerjs/moleculer/blob/f95aadc2d61b0d0e3c643a43c3ed28bca6425cde/bin/moleculer-runner.js#L172-L243
train
Merge options from config file
[ 30522, 3853, 13590, 7361, 9285, 1006, 1007, 1063, 9530, 8873, 2290, 1027, 1035, 1012, 12398, 16150, 4402, 2361, 1006, 9530, 8873, 25708, 9463, 1010, 13922, 2099, 1012, 2326, 12618, 5484, 1012, 12398, 7361, 9285, 1007, 1025, 2065, 1006, 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...