id
int32
0
58k
repo
stringlengths
5
67
path
stringlengths
4
116
func_name
stringlengths
0
58
original_string
stringlengths
52
373k
language
stringclasses
1 value
code
stringlengths
52
373k
code_tokens
list
docstring
stringlengths
4
11.8k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
86
226
6,300
maptalks/maptalks.js
src/geometry/ext/Geometry.Events.js
function (e) { const map = this.getMap(); const eventParam = { 'domEvent': e }; const actual = e.touches && e.touches.length > 0 ? e.touches[0] : e.changedTouches && e.changedTouches.length > 0 ? e.changedTouches[0] : e; if (actual) { const containerPoint...
javascript
function (e) { const map = this.getMap(); const eventParam = { 'domEvent': e }; const actual = e.touches && e.touches.length > 0 ? e.touches[0] : e.changedTouches && e.changedTouches.length > 0 ? e.changedTouches[0] : e; if (actual) { const containerPoint...
[ "function", "(", "e", ")", "{", "const", "map", "=", "this", ".", "getMap", "(", ")", ";", "const", "eventParam", "=", "{", "'domEvent'", ":", "e", "}", ";", "const", "actual", "=", "e", ".", "touches", "&&", "e", ".", "touches", ".", "length", "...
Generate event parameters @param {Event} event - dom event @return {Object} @private
[ "Generate", "event", "parameters" ]
8ee32cb20c5ea79dd687e1076c1310a288955792
https://github.com/maptalks/maptalks.js/blob/8ee32cb20c5ea79dd687e1076c1310a288955792/src/geometry/ext/Geometry.Events.js#L40-L54
6,301
maptalks/maptalks.js
src/map/Map.Topo.js
function (coord1, coord2) { if (!this.getProjection()) { return null; } const p1 = new Coordinate(coord1), p2 = new Coordinate(coord2); if (p1.equals(p2)) { return 0; } return this.getProjection().measureLength(p1, p2); }
javascript
function (coord1, coord2) { if (!this.getProjection()) { return null; } const p1 = new Coordinate(coord1), p2 = new Coordinate(coord2); if (p1.equals(p2)) { return 0; } return this.getProjection().measureLength(p1, p2); }
[ "function", "(", "coord1", ",", "coord2", ")", "{", "if", "(", "!", "this", ".", "getProjection", "(", ")", ")", "{", "return", "null", ";", "}", "const", "p1", "=", "new", "Coordinate", "(", "coord1", ")", ",", "p2", "=", "new", "Coordinate", "(",...
Caculate distance of two coordinates. @param {Number[]|Coordinate} coord1 - coordinate 1 @param {Number[]|Coordinate} coord2 - coordinate 2 @return {Number} distance, unit is meter @example var distance = map.computeLength([0, 0], [0, 20]);
[ "Caculate", "distance", "of", "two", "coordinates", "." ]
8ee32cb20c5ea79dd687e1076c1310a288955792
https://github.com/maptalks/maptalks.js/blob/8ee32cb20c5ea79dd687e1076c1310a288955792/src/map/Map.Topo.js#L18-L28
6,302
maptalks/maptalks.js
src/map/Map.Topo.js
function (opts, callback) { if (!opts) { return this; } const reqLayers = opts['layers']; if (!isArrayHasData(reqLayers)) { return this; } const layers = []; for (let i = 0, len = reqLayers.length; i < len; i++) { if (isString(r...
javascript
function (opts, callback) { if (!opts) { return this; } const reqLayers = opts['layers']; if (!isArrayHasData(reqLayers)) { return this; } const layers = []; for (let i = 0, len = reqLayers.length; i < len; i++) { if (isString(r...
[ "function", "(", "opts", ",", "callback", ")", "{", "if", "(", "!", "opts", ")", "{", "return", "this", ";", "}", "const", "reqLayers", "=", "opts", "[", "'layers'", "]", ";", "if", "(", "!", "isArrayHasData", "(", "reqLayers", ")", ")", "{", "retu...
Identify the geometries on the given coordinate. @param {Object} opts - the identify options @param {Coordinate} opts.coordinate - coordinate to identify @param {Object} opts.layers - the layers to perform identify on. @param {Function} [opts.filter=null] - filter function of the result geometries, return fals...
[ "Identify", "the", "geometries", "on", "the", "given", "coordinate", "." ]
8ee32cb20c5ea79dd687e1076c1310a288955792
https://github.com/maptalks/maptalks.js/blob/8ee32cb20c5ea79dd687e1076c1310a288955792/src/map/Map.Topo.js#L69-L107
6,303
maptalks/maptalks.js
src/geometry/ext/Geometry.Animation.js
function (styles, options, step) { if (this._animPlayer) { this._animPlayer.finish(); } if (isFunction(options)) { step = options; } if (!options) { options = {}; } const map = this.getMap(), projection = this._getPr...
javascript
function (styles, options, step) { if (this._animPlayer) { this._animPlayer.finish(); } if (isFunction(options)) { step = options; } if (!options) { options = {}; } const map = this.getMap(), projection = this._getPr...
[ "function", "(", "styles", ",", "options", ",", "step", ")", "{", "if", "(", "this", ".", "_animPlayer", ")", "{", "this", ".", "_animPlayer", ".", "finish", "(", ")", ";", "}", "if", "(", "isFunction", "(", "options", ")", ")", "{", "step", "=", ...
Animate the geometry @param {Object} styles - styles to animate @param {Object} [options=null] - animation options @param {NUmber} [options.duration=1000] - duration @param {Number} [options.startTime=null] - time to start animation in ms @param {String} [options.easing=linear] - anima...
[ "Animate", "the", "geometry" ]
8ee32cb20c5ea79dd687e1076c1310a288955792
https://github.com/maptalks/maptalks.js/blob/8ee32cb20c5ea79dd687e1076c1310a288955792/src/geometry/ext/Geometry.Animation.js#L33-L106
6,304
maptalks/maptalks.js
src/geometry/ext/Geometry.Animation.js
function (styles) { const symbol = this._getInternalSymbol(); const stylesToAnimate = {}; for (const p in styles) { if (styles.hasOwnProperty(p)) { const v = styles[p]; if (p !== 'translate' && p !== 'symbol') { //this.getRadius() /...
javascript
function (styles) { const symbol = this._getInternalSymbol(); const stylesToAnimate = {}; for (const p in styles) { if (styles.hasOwnProperty(p)) { const v = styles[p]; if (p !== 'translate' && p !== 'symbol') { //this.getRadius() /...
[ "function", "(", "styles", ")", "{", "const", "symbol", "=", "this", ".", "_getInternalSymbol", "(", ")", ";", "const", "stylesToAnimate", "=", "{", "}", ";", "for", "(", "const", "p", "in", "styles", ")", "{", "if", "(", "styles", ".", "hasOwnProperty...
Prepare styles for animation @return {Object} styles @private
[ "Prepare", "styles", "for", "animation" ]
8ee32cb20c5ea79dd687e1076c1310a288955792
https://github.com/maptalks/maptalks.js/blob/8ee32cb20c5ea79dd687e1076c1310a288955792/src/geometry/ext/Geometry.Animation.js#L112-L162
6,305
maptalks/maptalks.js
src/core/Ajax.js
function (url, options, cb) { if (isFunction(options)) { const t = cb; cb = options; options = t; } if (IS_NODE && Ajax.get.node) { return Ajax.get.node(url, cb, options); } const client = Ajax._getClient(cb); client.open('G...
javascript
function (url, options, cb) { if (isFunction(options)) { const t = cb; cb = options; options = t; } if (IS_NODE && Ajax.get.node) { return Ajax.get.node(url, cb, options); } const client = Ajax._getClient(cb); client.open('G...
[ "function", "(", "url", ",", "options", ",", "cb", ")", "{", "if", "(", "isFunction", "(", "options", ")", ")", "{", "const", "t", "=", "cb", ";", "cb", "=", "options", ";", "options", "=", "t", ";", "}", "if", "(", "IS_NODE", "&&", "Ajax", "."...
Fetch remote resource by HTTP "GET" method @param {String} url - resource url @param {Object} [options=null] - request options @param {Object} [options.headers=null] - HTTP headers @param {String} [options.responseType=null] - responseType @param {String} [options.credentials=null] - if with credentials...
[ "Fetch", "remote", "resource", "by", "HTTP", "GET", "method" ]
8ee32cb20c5ea79dd687e1076c1310a288955792
https://github.com/maptalks/maptalks.js/blob/8ee32cb20c5ea79dd687e1076c1310a288955792/src/core/Ajax.js#L62-L84
6,306
maptalks/maptalks.js
src/core/Ajax.js
function (url, options, cb) { let postData; if (!isString(url)) { //for compatible //options, postData, cb const t = cb; postData = options; options = url; url = options.url; cb = t; } else { if (isFu...
javascript
function (url, options, cb) { let postData; if (!isString(url)) { //for compatible //options, postData, cb const t = cb; postData = options; options = url; url = options.url; cb = t; } else { if (isFu...
[ "function", "(", "url", ",", "options", ",", "cb", ")", "{", "let", "postData", ";", "if", "(", "!", "isString", "(", "url", ")", ")", "{", "//for compatible", "//options, postData, cb", "const", "t", "=", "cb", ";", "postData", "=", "options", ";", "o...
Fetch remote resource by HTTP "POST" method @param {String} url - resource url @param {Object} options - request options @param {String|Object} options.postData - post data @param {Object} [options.headers=null] - HTTP headers @param {Function} cb - callback function when completed @return {Ajax} Ajax @e...
[ "Fetch", "remote", "resource", "by", "HTTP", "POST", "method" ]
8ee32cb20c5ea79dd687e1076c1310a288955792
https://github.com/maptalks/maptalks.js/blob/8ee32cb20c5ea79dd687e1076c1310a288955792/src/core/Ajax.js#L111-L154
6,307
maptalks/maptalks.js
src/map/Map.Pan.js
function (coordinate, options = {}, step) { if (!coordinate) { return this; } if (isFunction(options)) { step = options; options = {}; } coordinate = new Coordinate(coordinate); if (typeof (options['animation']) === 'undefined' || optio...
javascript
function (coordinate, options = {}, step) { if (!coordinate) { return this; } if (isFunction(options)) { step = options; options = {}; } coordinate = new Coordinate(coordinate); if (typeof (options['animation']) === 'undefined' || optio...
[ "function", "(", "coordinate", ",", "options", "=", "{", "}", ",", "step", ")", "{", "if", "(", "!", "coordinate", ")", "{", "return", "this", ";", "}", "if", "(", "isFunction", "(", "options", ")", ")", "{", "step", "=", "options", ";", "options",...
Pan to the given coordinate @param {Coordinate} coordinate - coordinate to pan to @param {Object} [options=null] - pan options @param {Boolean} [options.animation=null] - whether pan with animation @param {Boolean} [options.duration=600] - pan animation duration @return {Map} this
[ "Pan", "to", "the", "given", "coordinate" ]
8ee32cb20c5ea79dd687e1076c1310a288955792
https://github.com/maptalks/maptalks.js/blob/8ee32cb20c5ea79dd687e1076c1310a288955792/src/map/Map.Pan.js#L16-L31
6,308
maptalks/maptalks.js
src/map/Map.Pan.js
function (offset, options = {}, step) { if (!offset) { return this; } if (isFunction(options)) { step = options; options = {}; } offset = new Point(offset); this.onMoveStart(); if (typeof (options['animation']) === 'undefined' |...
javascript
function (offset, options = {}, step) { if (!offset) { return this; } if (isFunction(options)) { step = options; options = {}; } offset = new Point(offset); this.onMoveStart(); if (typeof (options['animation']) === 'undefined' |...
[ "function", "(", "offset", ",", "options", "=", "{", "}", ",", "step", ")", "{", "if", "(", "!", "offset", ")", "{", "return", "this", ";", "}", "if", "(", "isFunction", "(", "options", ")", ")", "{", "step", "=", "options", ";", "options", "=", ...
Pan the map by the give point @param {Point} point - distance to pan, in pixel @param {Object} [options=null] - pan options @param {Boolean} [options.animation=null] - whether pan with animation @param {Boolean} [options.duration=600] - pan animation duration @return {Map} this
[ "Pan", "the", "map", "by", "the", "give", "point" ]
8ee32cb20c5ea79dd687e1076c1310a288955792
https://github.com/maptalks/maptalks.js/blob/8ee32cb20c5ea79dd687e1076c1310a288955792/src/map/Map.Pan.js#L41-L60
6,309
maptalks/maptalks.js
src/geo/measurer/Sphere.js
rhumbBearing
function rhumbBearing(start, end, options = {}) { let bear360; if (options.final) bear360 = calculateRhumbBearing(end, start); else bear360 = calculateRhumbBearing(start, end); const bear180 = (bear360 > 180) ? -(360 - bear360) : bear360; return bear180; }
javascript
function rhumbBearing(start, end, options = {}) { let bear360; if (options.final) bear360 = calculateRhumbBearing(end, start); else bear360 = calculateRhumbBearing(start, end); const bear180 = (bear360 > 180) ? -(360 - bear360) : bear360; return bear180; }
[ "function", "rhumbBearing", "(", "start", ",", "end", ",", "options", "=", "{", "}", ")", "{", "let", "bear360", ";", "if", "(", "options", ".", "final", ")", "bear360", "=", "calculateRhumbBearing", "(", "end", ",", "start", ")", ";", "else", "bear360...
from turf.js
[ "from", "turf", ".", "js" ]
8ee32cb20c5ea79dd687e1076c1310a288955792
https://github.com/maptalks/maptalks.js/blob/8ee32cb20c5ea79dd687e1076c1310a288955792/src/geo/measurer/Sphere.js#L117-L125
6,310
CreateJS/TweenJS
build/updates/builder.js
function (helpers) { Y.log('Importing helpers: ' + helpers, 'info', 'builder'); helpers.forEach(function (imp) { if (!Y.Files.exists(imp) || Y.Files.exists(path.join(process.cwd(), imp))) { imp = path.join(process.cwd(), imp); } ...
javascript
function (helpers) { Y.log('Importing helpers: ' + helpers, 'info', 'builder'); helpers.forEach(function (imp) { if (!Y.Files.exists(imp) || Y.Files.exists(path.join(process.cwd(), imp))) { imp = path.join(process.cwd(), imp); } ...
[ "function", "(", "helpers", ")", "{", "Y", ".", "log", "(", "'Importing helpers: '", "+", "helpers", ",", "'info'", ",", "'builder'", ")", ";", "helpers", ".", "forEach", "(", "function", "(", "imp", ")", "{", "if", "(", "!", "Y", ".", "Files", ".", ...
Register a `Y.Handlebars` helper method @method _addHelpers @param {Object} helpers Object containing a hash of names and functions
[ "Register", "a", "Y", ".", "Handlebars", "helper", "method" ]
5678f99ce876a62b2b7f7ad686d0e5b2531def3a
https://github.com/CreateJS/TweenJS/blob/5678f99ce876a62b2b7f7ad686d0e5b2531def3a/build/updates/builder.js#L125-L136
6,311
CreateJS/TweenJS
build/updates/builder.js
function (md) { var html = marked(md, this.options.markdown); //Only reprocess if helpers were asked for if (this.options.helpers || (html.indexOf('{{#crossLink') > -1)) { //console.log('MD: ', html); try { // marked auto-escapes qu...
javascript
function (md) { var html = marked(md, this.options.markdown); //Only reprocess if helpers were asked for if (this.options.helpers || (html.indexOf('{{#crossLink') > -1)) { //console.log('MD: ', html); try { // marked auto-escapes qu...
[ "function", "(", "md", ")", "{", "var", "html", "=", "marked", "(", "md", ",", "this", ".", "options", ".", "markdown", ")", ";", "//Only reprocess if helpers were asked for", "if", "(", "this", ".", "options", ".", "helpers", "||", "(", "html", ".", "in...
Wrapper around the Markdown parser so it can be normalized or even side stepped @method markdown @private @param {String} md The Markdown string to parse @return {HTML} The rendered HTML
[ "Wrapper", "around", "the", "Markdown", "parser", "so", "it", "can", "be", "normalized", "or", "even", "side", "stepped" ]
5678f99ce876a62b2b7f7ad686d0e5b2531def3a
https://github.com/CreateJS/TweenJS/blob/5678f99ce876a62b2b7f7ad686d0e5b2531def3a/build/updates/builder.js#L144-L162
6,312
CreateJS/TweenJS
build/updates/builder.js
function () { var self = this; Y.log('External data received, mixing', 'info', 'builder'); self.options.externalData.forEach(function (exData) { ['files', 'classes', 'modules'].forEach(function (k) { Y.each(exData[k], function (item, key) { ...
javascript
function () { var self = this; Y.log('External data received, mixing', 'info', 'builder'); self.options.externalData.forEach(function (exData) { ['files', 'classes', 'modules'].forEach(function (k) { Y.each(exData[k], function (item, key) { ...
[ "function", "(", ")", "{", "var", "self", "=", "this", ";", "Y", ".", "log", "(", "'External data received, mixing'", ",", "'info'", ",", "'builder'", ")", ";", "self", ".", "options", ".", "externalData", ".", "forEach", "(", "function", "(", "exData", ...
Mixes the various external data soures together into the local data, augmenting it with flags. @method _mixExternal @private
[ "Mixes", "the", "various", "external", "data", "soures", "together", "into", "the", "local", "data", "augmenting", "it", "with", "flags", "." ]
5678f99ce876a62b2b7f7ad686d0e5b2531def3a
https://github.com/CreateJS/TweenJS/blob/5678f99ce876a62b2b7f7ad686d0e5b2531def3a/build/updates/builder.js#L330-L371
6,313
CreateJS/TweenJS
build/updates/builder.js
function (cb) { var self = this, info = self.options.external; if (!info) { cb(); return; } if (!info.merge) { info.merge = 'mix'; } if (!info.data) { Y.log('External ...
javascript
function (cb) { var self = this, info = self.options.external; if (!info) { cb(); return; } if (!info.merge) { info.merge = 'mix'; } if (!info.data) { Y.log('External ...
[ "function", "(", "cb", ")", "{", "var", "self", "=", "this", ",", "info", "=", "self", ".", "options", ".", "external", ";", "if", "(", "!", "info", ")", "{", "cb", "(", ")", ";", "return", ";", "}", "if", "(", "!", "info", ".", "merge", ")",...
Fetches the remote data and fires the callback when it's all complete @method mixExternal @param {Callback} cb The callback to execute when complete @async
[ "Fetches", "the", "remote", "data", "and", "fires", "the", "callback", "when", "it", "s", "all", "complete" ]
5678f99ce876a62b2b7f7ad686d0e5b2531def3a
https://github.com/CreateJS/TweenJS/blob/5678f99ce876a62b2b7f7ad686d0e5b2531def3a/build/updates/builder.js#L378-L438
6,314
CreateJS/TweenJS
build/updates/builder.js
function () { var obj = { meta: { yuiSeedUrl: 'http://yui.yahooapis.com/3.5.0/build/yui/yui-min.js', yuiGridsUrl: 'http://yui.yahooapis.com/3.5.0/build/cssgrids/cssgrids-min.css' } }; if (!this._meta) { ...
javascript
function () { var obj = { meta: { yuiSeedUrl: 'http://yui.yahooapis.com/3.5.0/build/yui/yui-min.js', yuiGridsUrl: 'http://yui.yahooapis.com/3.5.0/build/cssgrids/cssgrids-min.css' } }; if (!this._meta) { ...
[ "function", "(", ")", "{", "var", "obj", "=", "{", "meta", ":", "{", "yuiSeedUrl", ":", "'http://yui.yahooapis.com/3.5.0/build/yui/yui-min.js'", ",", "yuiGridsUrl", ":", "'http://yui.yahooapis.com/3.5.0/build/cssgrids/cssgrids-min.css'", "}", "}", ";", "if", "(", "!", ...
Prep the meta data to be fed to Selleck @method getProjectMeta @return {Object} The project metadata
[ "Prep", "the", "meta", "data", "to", "be", "fed", "to", "Selleck" ]
5678f99ce876a62b2b7f7ad686d0e5b2531def3a
https://github.com/CreateJS/TweenJS/blob/5678f99ce876a62b2b7f7ad686d0e5b2531def3a/build/updates/builder.js#L457-L494
6,315
CreateJS/TweenJS
build/updates/builder.js
function (opts) { opts.meta.classes = []; Y.each(this.data.classes, function (v) { if (v.external) { return; } opts.meta.classes.push({ displayName: v.name, name: v.name, ...
javascript
function (opts) { opts.meta.classes = []; Y.each(this.data.classes, function (v) { if (v.external) { return; } opts.meta.classes.push({ displayName: v.name, name: v.name, ...
[ "function", "(", "opts", ")", "{", "opts", ".", "meta", ".", "classes", "=", "[", "]", ";", "Y", ".", "each", "(", "this", ".", "data", ".", "classes", ",", "function", "(", "v", ")", "{", "if", "(", "v", ".", "external", ")", "{", "return", ...
Populate the meta data for classes @method populateClasses @param {Object} opts The original options @return {Object} The modified options
[ "Populate", "the", "meta", "data", "for", "classes" ]
5678f99ce876a62b2b7f7ad686d0e5b2531def3a
https://github.com/CreateJS/TweenJS/blob/5678f99ce876a62b2b7f7ad686d0e5b2531def3a/build/updates/builder.js#L501-L518
6,316
CreateJS/TweenJS
build/updates/builder.js
function (opts) { var self = this; opts.meta.modules = []; opts.meta.allModules = []; Y.each(this.data.modules, function (v) { if (v.external) { return; } opts.meta.allModules.push({ d...
javascript
function (opts) { var self = this; opts.meta.modules = []; opts.meta.allModules = []; Y.each(this.data.modules, function (v) { if (v.external) { return; } opts.meta.allModules.push({ d...
[ "function", "(", "opts", ")", "{", "var", "self", "=", "this", ";", "opts", ".", "meta", ".", "modules", "=", "[", "]", ";", "opts", ".", "meta", ".", "allModules", "=", "[", "]", ";", "Y", ".", "each", "(", "this", ".", "data", ".", "modules",...
Populate the meta data for modules @method populateModules @param {Object} opts The original options @return {Object} The modified options
[ "Populate", "the", "meta", "data", "for", "modules" ]
5678f99ce876a62b2b7f7ad686d0e5b2531def3a
https://github.com/CreateJS/TweenJS/blob/5678f99ce876a62b2b7f7ad686d0e5b2531def3a/build/updates/builder.js#L525-L564
6,317
CreateJS/TweenJS
build/updates/builder.js
function (opts) { var self = this; opts.meta.files = []; Y.each(this.data.files, function (v) { if (v.external) { return; } opts.meta.files.push({ displayName: v.name, name: se...
javascript
function (opts) { var self = this; opts.meta.files = []; Y.each(this.data.files, function (v) { if (v.external) { return; } opts.meta.files.push({ displayName: v.name, name: se...
[ "function", "(", "opts", ")", "{", "var", "self", "=", "this", ";", "opts", ".", "meta", ".", "files", "=", "[", "]", ";", "Y", ".", "each", "(", "this", ".", "data", ".", "files", ",", "function", "(", "v", ")", "{", "if", "(", "v", ".", "...
Populate the meta data for files @method populateFiles @param {Object} opts The original options @return {Object} The modified options
[ "Populate", "the", "meta", "data", "for", "files" ]
5678f99ce876a62b2b7f7ad686d0e5b2531def3a
https://github.com/CreateJS/TweenJS/blob/5678f99ce876a62b2b7f7ad686d0e5b2531def3a/build/updates/builder.js#L571-L621
6,318
CreateJS/TweenJS
build/updates/builder.js
function (a) { var self = this; if (a.file && a.line && !self.options.nocode) { a.foundAt = '../files/' + self.filterFileName(a.file) + '.html#l' + a.line; if (a.path) { a.foundAt = a.path + '#l' + a.line; } } ...
javascript
function (a) { var self = this; if (a.file && a.line && !self.options.nocode) { a.foundAt = '../files/' + self.filterFileName(a.file) + '.html#l' + a.line; if (a.path) { a.foundAt = a.path + '#l' + a.line; } } ...
[ "function", "(", "a", ")", "{", "var", "self", "=", "this", ";", "if", "(", "a", ".", "file", "&&", "a", ".", "line", "&&", "!", "self", ".", "options", ".", "nocode", ")", "{", "a", ".", "foundAt", "=", "'../files/'", "+", "self", ".", "filter...
Parses file and line number from an item object and build's an HREF @method addFoundAt @param {Object} a The item to parse @return {String} The parsed HREF
[ "Parses", "file", "and", "line", "number", "from", "an", "item", "object", "and", "build", "s", "an", "HREF" ]
5678f99ce876a62b2b7f7ad686d0e5b2531def3a
https://github.com/CreateJS/TweenJS/blob/5678f99ce876a62b2b7f7ad686d0e5b2531def3a/build/updates/builder.js#L628-L637
6,319
CreateJS/TweenJS
build/updates/builder.js
function (cb) { var self = this; var dirs = ['classes', 'modules', 'files']; if (self.options.dumpview) { dirs.push('json'); } var writeRedirect = function (dir, file, cb) { Y.Files.exists(file, function (x) { ...
javascript
function (cb) { var self = this; var dirs = ['classes', 'modules', 'files']; if (self.options.dumpview) { dirs.push('json'); } var writeRedirect = function (dir, file, cb) { Y.Files.exists(file, function (x) { ...
[ "function", "(", "cb", ")", "{", "var", "self", "=", "this", ";", "var", "dirs", "=", "[", "'classes'", ",", "'modules'", ",", "'files'", "]", ";", "if", "(", "self", ".", "options", ".", "dumpview", ")", "{", "dirs", ".", "push", "(", "'json'", ...
Makes the default directories needed @method makeDirs @param {Callback} cb The callback to execute after it's completed
[ "Makes", "the", "default", "directories", "needed" ]
5678f99ce876a62b2b7f7ad686d0e5b2531def3a
https://github.com/CreateJS/TweenJS/blob/5678f99ce876a62b2b7f7ad686d0e5b2531def3a/build/updates/builder.js#L709-L744
6,320
CreateJS/TweenJS
build/updates/builder.js
function (cb) { var self = this; Y.prepare([DEFAULT_THEME, themeDir], self.getProjectMeta(), function (err, opts) { opts.meta.title = self.data.project.name; opts.meta.projectRoot = './'; opts.meta.projectAssets = './assets'; opts....
javascript
function (cb) { var self = this; Y.prepare([DEFAULT_THEME, themeDir], self.getProjectMeta(), function (err, opts) { opts.meta.title = self.data.project.name; opts.meta.projectRoot = './'; opts.meta.projectAssets = './assets'; opts....
[ "function", "(", "cb", ")", "{", "var", "self", "=", "this", ";", "Y", ".", "prepare", "(", "[", "DEFAULT_THEME", ",", "themeDir", "]", ",", "self", ".", "getProjectMeta", "(", ")", ",", "function", "(", "err", ",", "opts", ")", "{", "opts", ".", ...
Render the index file @method renderIndex @param {Function} cb The callback fired when complete @param {String} cb.html The HTML to render this view @param {Object} cv.view The View Data
[ "Render", "the", "index", "file" ]
5678f99ce876a62b2b7f7ad686d0e5b2531def3a
https://github.com/CreateJS/TweenJS/blob/5678f99ce876a62b2b7f7ad686d0e5b2531def3a/build/updates/builder.js#L852-L869
6,321
CreateJS/TweenJS
build/updates/builder.js
function (cb) { var self = this, stack = new Y.Parallel(); Y.log('Preparing index.html', 'info', 'builder'); self.renderIndex(stack.add(function (html, view) { stack.html = html; stack.view = view; if (self.options.dump...
javascript
function (cb) { var self = this, stack = new Y.Parallel(); Y.log('Preparing index.html', 'info', 'builder'); self.renderIndex(stack.add(function (html, view) { stack.html = html; stack.view = view; if (self.options.dump...
[ "function", "(", "cb", ")", "{", "var", "self", "=", "this", ",", "stack", "=", "new", "Y", ".", "Parallel", "(", ")", ";", "Y", ".", "log", "(", "'Preparing index.html'", ",", "'info'", ",", "'builder'", ")", ";", "self", ".", "renderIndex", "(", ...
Generates the index.html file @method writeIndex @param {Callback} cb The callback to execute after it's completed
[ "Generates", "the", "index", ".", "html", "file" ]
5678f99ce876a62b2b7f7ad686d0e5b2531def3a
https://github.com/CreateJS/TweenJS/blob/5678f99ce876a62b2b7f7ad686d0e5b2531def3a/build/updates/builder.js#L875-L893
6,322
CreateJS/TweenJS
build/updates/builder.js
function (info, classItems, first) { var self = this; self._mergeCounter = (first) ? 0 : (self._mergeCounter + 1); if (self._mergeCounter === 100) { throw ('YUIDoc detected a loop extending class ' + info.name); } if (info.extends || info.uses...
javascript
function (info, classItems, first) { var self = this; self._mergeCounter = (first) ? 0 : (self._mergeCounter + 1); if (self._mergeCounter === 100) { throw ('YUIDoc detected a loop extending class ' + info.name); } if (info.extends || info.uses...
[ "function", "(", "info", ",", "classItems", ",", "first", ")", "{", "var", "self", "=", "this", ";", "self", ".", "_mergeCounter", "=", "(", "first", ")", "?", "0", ":", "(", "self", ".", "_mergeCounter", "+", "1", ")", ";", "if", "(", "self", "....
Merge superclass data into a child class @method mergeExtends @param {Object} info The item to extend @param {Array} classItems The list of items to merge in @param {Boolean} first Set for the first call
[ "Merge", "superclass", "data", "into", "a", "child", "class" ]
5678f99ce876a62b2b7f7ad686d0e5b2531def3a
https://github.com/CreateJS/TweenJS/blob/5678f99ce876a62b2b7f7ad686d0e5b2531def3a/build/updates/builder.js#L1050-L1094
6,323
CreateJS/TweenJS
build/updates/builder.js
function (cb, data, layout) { var self = this; Y.prepare([DEFAULT_THEME, themeDir], self.getProjectMeta(), function (err, opts) { if (err) { console.log(err); } if (!data.name) { return; } ...
javascript
function (cb, data, layout) { var self = this; Y.prepare([DEFAULT_THEME, themeDir], self.getProjectMeta(), function (err, opts) { if (err) { console.log(err); } if (!data.name) { return; } ...
[ "function", "(", "cb", ",", "data", ",", "layout", ")", "{", "var", "self", "=", "this", ";", "Y", ".", "prepare", "(", "[", "DEFAULT_THEME", ",", "themeDir", "]", ",", "self", ".", "getProjectMeta", "(", ")", ",", "function", "(", "err", ",", "opt...
Render the source file @method renderFile @param {Function} cb The callback fired when complete @param {String} cb.html The HTML to render this view @param {Object} cv.view The View Data
[ "Render", "the", "source", "file" ]
5678f99ce876a62b2b7f7ad686d0e5b2531def3a
https://github.com/CreateJS/TweenJS/blob/5678f99ce876a62b2b7f7ad686d0e5b2531def3a/build/updates/builder.js#L1503-L1549
6,324
CreateJS/TweenJS
build/updates/builder.js
function (cb) { Y.log('Writing API Meta Data', 'info', 'builder'); var self = this; this.renderAPIMeta(function (js) { fs.writeFile(path.join(self.options.outdir, 'api.js'), js, Y.charset, cb); }); }
javascript
function (cb) { Y.log('Writing API Meta Data', 'info', 'builder'); var self = this; this.renderAPIMeta(function (js) { fs.writeFile(path.join(self.options.outdir, 'api.js'), js, Y.charset, cb); }); }
[ "function", "(", "cb", ")", "{", "Y", ".", "log", "(", "'Writing API Meta Data'", ",", "'info'", ",", "'builder'", ")", ";", "var", "self", "=", "this", ";", "this", ".", "renderAPIMeta", "(", "function", "(", "js", ")", "{", "fs", ".", "writeFile", ...
Write the API meta data used for the AutoComplete widget @method writeAPIMeta @param {Callback} cb The callback to execute when complete @async
[ "Write", "the", "API", "meta", "data", "used", "for", "the", "AutoComplete", "widget" ]
5678f99ce876a62b2b7f7ad686d0e5b2531def3a
https://github.com/CreateJS/TweenJS/blob/5678f99ce876a62b2b7f7ad686d0e5b2531def3a/build/updates/builder.js#L1556-L1562
6,325
CreateJS/TweenJS
build/updates/builder.js
function (cb) { var opts = { meta: {} }; opts = this.populateClasses(opts); opts = this.populateModules(opts); ['classes', 'modules'].forEach(function (id) { opts.meta[id].forEach(function (v, k) { opts.met...
javascript
function (cb) { var opts = { meta: {} }; opts = this.populateClasses(opts); opts = this.populateModules(opts); ['classes', 'modules'].forEach(function (id) { opts.meta[id].forEach(function (v, k) { opts.met...
[ "function", "(", "cb", ")", "{", "var", "opts", "=", "{", "meta", ":", "{", "}", "}", ";", "opts", "=", "this", ".", "populateClasses", "(", "opts", ")", ";", "opts", "=", "this", ".", "populateModules", "(", "opts", ")", ";", "[", "'classes'", "...
Render the API meta and return the Javascript @method renderAPIMeta @param {Callback} cb The callback @async
[ "Render", "the", "API", "meta", "and", "return", "the", "Javascript" ]
5678f99ce876a62b2b7f7ad686d0e5b2531def3a
https://github.com/CreateJS/TweenJS/blob/5678f99ce876a62b2b7f7ad686d0e5b2531def3a/build/updates/builder.js#L1569-L1594
6,326
CreateJS/TweenJS
build/updates/builder.js
function (cb) { var self = this; var starttime = (new Date()).getTime(); Y.log('Compiling Templates', 'info', 'builder'); this.mixExternal(function () { self.makeDirs(function () { Y.log('Copying Assets', 'info', 'builder'); ...
javascript
function (cb) { var self = this; var starttime = (new Date()).getTime(); Y.log('Compiling Templates', 'info', 'builder'); this.mixExternal(function () { self.makeDirs(function () { Y.log('Copying Assets', 'info', 'builder'); ...
[ "function", "(", "cb", ")", "{", "var", "self", "=", "this", ";", "var", "starttime", "=", "(", "new", "Date", "(", ")", ")", ".", "getTime", "(", ")", ";", "Y", ".", "log", "(", "'Compiling Templates'", ",", "'info'", ",", "'builder'", ")", ";", ...
Compiles the templates from the meta-data provided by DocParser @method compile @param {Callback} cb The callback to execute after it's completed
[ "Compiles", "the", "templates", "from", "the", "meta", "-", "data", "provided", "by", "DocParser" ]
5678f99ce876a62b2b7f7ad686d0e5b2531def3a
https://github.com/CreateJS/TweenJS/blob/5678f99ce876a62b2b7f7ad686d0e5b2531def3a/build/updates/builder.js#L1613-L1661
6,327
CreateJS/TweenJS
src/tweenjs/plugins/CSSPlugin.js
parseMulti
function parseMulti(str, compare, arr) { // TODO: add logic to deal with "0" values? Troublesome because the browser automatically appends a unit for some 0 values. do { // pull out the next value (ex. "20px", "12.4rad"): var result = s.TRANSFORM_VALUE_RE.exec(str); if (!result) { return arr; } if (!arr...
javascript
function parseMulti(str, compare, arr) { // TODO: add logic to deal with "0" values? Troublesome because the browser automatically appends a unit for some 0 values. do { // pull out the next value (ex. "20px", "12.4rad"): var result = s.TRANSFORM_VALUE_RE.exec(str); if (!result) { return arr; } if (!arr...
[ "function", "parseMulti", "(", "str", ",", "compare", ",", "arr", ")", "{", "// TODO: add logic to deal with \"0\" values? Troublesome because the browser automatically appends a unit for some 0 values.", "do", "{", "// pull out the next value (ex. \"20px\", \"12.4rad\"):", "var", "res...
this was separated so that it can be used for other multi element styles in the future ex. transform-origin, border, etc.
[ "this", "was", "separated", "so", "that", "it", "can", "be", "used", "for", "other", "multi", "element", "styles", "in", "the", "future", "ex", ".", "transform", "-", "origin", "border", "etc", "." ]
5678f99ce876a62b2b7f7ad686d0e5b2531def3a
https://github.com/CreateJS/TweenJS/blob/5678f99ce876a62b2b7f7ad686d0e5b2531def3a/src/tweenjs/plugins/CSSPlugin.js#L267-L279
6,328
CreateJS/TweenJS
lib/tweenjs-NEXT.js
TweenGroup
function TweenGroup(paused, timeScale) { this._tweens = []; this.paused = paused; this.timeScale = timeScale; this.__onComplete = this._onComplete.bind(this); }
javascript
function TweenGroup(paused, timeScale) { this._tweens = []; this.paused = paused; this.timeScale = timeScale; this.__onComplete = this._onComplete.bind(this); }
[ "function", "TweenGroup", "(", "paused", ",", "timeScale", ")", "{", "this", ".", "_tweens", "=", "[", "]", ";", "this", ".", "paused", "=", "paused", ";", "this", ".", "timeScale", "=", "timeScale", ";", "this", ".", "__onComplete", "=", "this", ".", ...
TweenGroup allows you to pause and time scale a collection of tweens or timelines. For example, this could be used to stop all tweens associated with a view when leaving that view. myView.tweens = new createjs.TweenGroup(); myView.tweens.get(spinner, {loop: -1}).to({rotation:360}, 500); myView.tweens.get(image).to({al...
[ "TweenGroup", "allows", "you", "to", "pause", "and", "time", "scale", "a", "collection", "of", "tweens", "or", "timelines", ".", "For", "example", "this", "could", "be", "used", "to", "stop", "all", "tweens", "associated", "with", "a", "view", "when", "lea...
5678f99ce876a62b2b7f7ad686d0e5b2531def3a
https://github.com/CreateJS/TweenJS/blob/5678f99ce876a62b2b7f7ad686d0e5b2531def3a/lib/tweenjs-NEXT.js#L3872-L3877
6,329
ampproject/amp-toolbox
packages/cors/lib/cors.js
extractOriginHeaders_
function extractOriginHeaders_(headers) { const result = { isSameOrigin: false, }; for (const key in headers) { if (headers.hasOwnProperty(key)) { const normalizedKey = key.toLowerCase(); // for same-origin requests where the Origin header is missing, AMP sets the amp-same-origin...
javascript
function extractOriginHeaders_(headers) { const result = { isSameOrigin: false, }; for (const key in headers) { if (headers.hasOwnProperty(key)) { const normalizedKey = key.toLowerCase(); // for same-origin requests where the Origin header is missing, AMP sets the amp-same-origin...
[ "function", "extractOriginHeaders_", "(", "headers", ")", "{", "const", "result", "=", "{", "isSameOrigin", ":", "false", ",", "}", ";", "for", "(", "const", "key", "in", "headers", ")", "{", "if", "(", "headers", ".", "hasOwnProperty", "(", "key", ")", ...
Extracts the `AMP-Same-Origin` and `Origin` header values. @param {Object} headers @returns {Object} object containing the origin or isSameOrigin value @private
[ "Extracts", "the", "AMP", "-", "Same", "-", "Origin", "and", "Origin", "header", "values", "." ]
9d6243974ac2023a466656aa9790e47e1219a624
https://github.com/ampproject/amp-toolbox/blob/9d6243974ac2023a466656aa9790e47e1219a624/packages/cors/lib/cors.js#L100-L120
6,330
ampproject/amp-toolbox
packages/cors/lib/cors.js
isValidOrigin
async function isValidOrigin(origin, sourceOrigin) { // This will fetch the caches from https://cdn.ampproject.org/caches.json the first time it's // called. Subsequent calls will receive a cached version. const officialCacheList = await caches.list(); // Calculate the cache specific origin const ca...
javascript
async function isValidOrigin(origin, sourceOrigin) { // This will fetch the caches from https://cdn.ampproject.org/caches.json the first time it's // called. Subsequent calls will receive a cached version. const officialCacheList = await caches.list(); // Calculate the cache specific origin const ca...
[ "async", "function", "isValidOrigin", "(", "origin", ",", "sourceOrigin", ")", "{", "// This will fetch the caches from https://cdn.ampproject.org/caches.json the first time it's", "// called. Subsequent calls will receive a cached version.", "const", "officialCacheList", "=", "await", ...
Checks whether the given origin is a valid AMP cache. @param {String} origin @return {boolean} true if origin is valid @private
[ "Checks", "whether", "the", "given", "origin", "is", "a", "valid", "AMP", "cache", "." ]
9d6243974ac2023a466656aa9790e47e1219a624
https://github.com/ampproject/amp-toolbox/blob/9d6243974ac2023a466656aa9790e47e1219a624/packages/cors/lib/cors.js#L129-L143
6,331
ampproject/amp-toolbox
packages/optimizer/lib/HtmlDomHelper.js
findMetaViewport
function findMetaViewport(head) { for (let node = head.firstChild; node !== null; node = node.nextSibling) { if (node.tagName === 'meta' && node.attribs.name === 'viewport') { return node; } } return null; }
javascript
function findMetaViewport(head) { for (let node = head.firstChild; node !== null; node = node.nextSibling) { if (node.tagName === 'meta' && node.attribs.name === 'viewport') { return node; } } return null; }
[ "function", "findMetaViewport", "(", "head", ")", "{", "for", "(", "let", "node", "=", "head", ".", "firstChild", ";", "node", "!==", "null", ";", "node", "=", "node", ".", "nextSibling", ")", "{", "if", "(", "node", ".", "tagName", "===", "'meta'", ...
Finds and returns the first 'meta charset' element in the head. @param {Node} head the section to search for the meta charset node. @returns {Node} the '<meta charset>' node or null.
[ "Finds", "and", "returns", "the", "first", "meta", "charset", "element", "in", "the", "head", "." ]
9d6243974ac2023a466656aa9790e47e1219a624
https://github.com/ampproject/amp-toolbox/blob/9d6243974ac2023a466656aa9790e47e1219a624/packages/optimizer/lib/HtmlDomHelper.js#L25-L32
6,332
ampproject/amp-toolbox
packages/core/lib/oneBehindFetch.js
oneBehindFetch
async function oneBehindFetch(input, init) { let cachedResponse = cache.get(input); if (!cachedResponse) { cachedResponse = { maxAge: Promise.resolve(MaxAge.zero()), }; cache.set(input, cachedResponse); } const maxAge = await cachedResponse.maxAge; if (!maxAge.isExpired()) { // we have t...
javascript
async function oneBehindFetch(input, init) { let cachedResponse = cache.get(input); if (!cachedResponse) { cachedResponse = { maxAge: Promise.resolve(MaxAge.zero()), }; cache.set(input, cachedResponse); } const maxAge = await cachedResponse.maxAge; if (!maxAge.isExpired()) { // we have t...
[ "async", "function", "oneBehindFetch", "(", "input", ",", "init", ")", "{", "let", "cachedResponse", "=", "cache", ".", "get", "(", "input", ")", ";", "if", "(", "!", "cachedResponse", ")", "{", "cachedResponse", "=", "{", "maxAge", ":", "Promise", ".", ...
Implements fetch with a one-behind-caching strategy. @param {String|Request} input - path or Request instance @param {Object} init - fetch options @return Promise<Response>
[ "Implements", "fetch", "with", "a", "one", "-", "behind", "-", "caching", "strategy", "." ]
9d6243974ac2023a466656aa9790e47e1219a624
https://github.com/ampproject/amp-toolbox/blob/9d6243974ac2023a466656aa9790e47e1219a624/packages/core/lib/oneBehindFetch.js#L30-L57
6,333
ampproject/amp-toolbox
packages/optimizer/demo/simple/index.js
copyAndTransform
async function copyAndTransform(file, ampRuntimeVersion) { const originalHtml = await readFile(file); const ampFile = file.substring(1, file.length) .replace('.html', '.amp.html'); const allTransformationsFile = file.substring(1, file.length) .replace('.html', '.all.html'); const validTransformation...
javascript
async function copyAndTransform(file, ampRuntimeVersion) { const originalHtml = await readFile(file); const ampFile = file.substring(1, file.length) .replace('.html', '.amp.html'); const allTransformationsFile = file.substring(1, file.length) .replace('.html', '.all.html'); const validTransformation...
[ "async", "function", "copyAndTransform", "(", "file", ",", "ampRuntimeVersion", ")", "{", "const", "originalHtml", "=", "await", "readFile", "(", "file", ")", ";", "const", "ampFile", "=", "file", ".", "substring", "(", "1", ",", "file", ".", "length", ")"...
Copy original and transformed AMP file into the dist dir.
[ "Copy", "original", "and", "transformed", "AMP", "file", "into", "the", "dist", "dir", "." ]
9d6243974ac2023a466656aa9790e47e1219a624
https://github.com/ampproject/amp-toolbox/blob/9d6243974ac2023a466656aa9790e47e1219a624/packages/optimizer/demo/simple/index.js#L42-L74
6,334
ampproject/amp-toolbox
packages/optimizer/demo/simple/index.js
collectInputFiles
function collectInputFiles(pattern) { return new Promise((resolve, reject) => { glob(pattern, {root: SRC_DIR, nomount: true}, (err, files) => { if (err) { return reject(err); } resolve(files); }); }); }
javascript
function collectInputFiles(pattern) { return new Promise((resolve, reject) => { glob(pattern, {root: SRC_DIR, nomount: true}, (err, files) => { if (err) { return reject(err); } resolve(files); }); }); }
[ "function", "collectInputFiles", "(", "pattern", ")", "{", "return", "new", "Promise", "(", "(", "resolve", ",", "reject", ")", "=>", "{", "glob", "(", "pattern", ",", "{", "root", ":", "SRC_DIR", ",", "nomount", ":", "true", "}", ",", "(", "err", ",...
Collect all files in the src dir.
[ "Collect", "all", "files", "in", "the", "src", "dir", "." ]
9d6243974ac2023a466656aa9790e47e1219a624
https://github.com/ampproject/amp-toolbox/blob/9d6243974ac2023a466656aa9790e47e1219a624/packages/optimizer/demo/simple/index.js#L78-L87
6,335
paulmillr/chokidar
lib/fsevents-handler.js
setFSEventsListener
function setFSEventsListener(path, realPath, listener, rawEmitter) { let watchPath = sysPath.extname(path) ? sysPath.dirname(path) : path; const parentPath = sysPath.dirname(watchPath); let cont = FSEventsWatchers.get(watchPath); // If we've accumulated a substantial number of paths that // could have been c...
javascript
function setFSEventsListener(path, realPath, listener, rawEmitter) { let watchPath = sysPath.extname(path) ? sysPath.dirname(path) : path; const parentPath = sysPath.dirname(watchPath); let cont = FSEventsWatchers.get(watchPath); // If we've accumulated a substantial number of paths that // could have been c...
[ "function", "setFSEventsListener", "(", "path", ",", "realPath", ",", "listener", ",", "rawEmitter", ")", "{", "let", "watchPath", "=", "sysPath", ".", "extname", "(", "path", ")", "?", "sysPath", ".", "dirname", "(", "path", ")", ":", "path", ";", "cons...
Instantiates the fsevents interface or binds listeners to an existing one covering the same file tree. @param {Path} path - to be watched @param {Path} realPath - real path for symlinks @param {Function} listener - called when fsevents emits events @param {Function} rawEmitter - passes data to listene...
[ "Instantiates", "the", "fsevents", "interface", "or", "binds", "listeners", "to", "an", "existing", "one", "covering", "the", "same", "file", "tree", "." ]
3e576468febfb46ac47045293fdbcbd6885b0ff9
https://github.com/paulmillr/chokidar/blob/3e576468febfb46ac47045293fdbcbd6885b0ff9/lib/fsevents-handler.js#L72-L140
6,336
paulmillr/chokidar
lib/nodefs-handler.js
createFsWatchInstance
function createFsWatchInstance(path, options, listener, errHandler, emitRaw) { const handleEvent = (rawEvent, evPath) => { listener(path); emitRaw(rawEvent, evPath, {watchedPath: path}); // emit based on events occurring for files from a directory's watcher in // case the file's watcher misses it (an...
javascript
function createFsWatchInstance(path, options, listener, errHandler, emitRaw) { const handleEvent = (rawEvent, evPath) => { listener(path); emitRaw(rawEvent, evPath, {watchedPath: path}); // emit based on events occurring for files from a directory's watcher in // case the file's watcher misses it (an...
[ "function", "createFsWatchInstance", "(", "path", ",", "options", ",", "listener", ",", "errHandler", ",", "emitRaw", ")", "{", "const", "handleEvent", "=", "(", "rawEvent", ",", "evPath", ")", "=>", "{", "listener", "(", "path", ")", ";", "emitRaw", "(", ...
Instantiates the fs_watch interface @param {String} path to be watched @param {Object} options to be passed to fs_watch @param {Function} listener main event handler @param {Function} errHandler emits info about errors @param {Function} emitRaw emits raw event data @returns {fs.FSWatcher} new fsevents instance
[ "Instantiates", "the", "fs_watch", "interface" ]
3e576468febfb46ac47045293fdbcbd6885b0ff9
https://github.com/paulmillr/chokidar/blob/3e576468febfb46ac47045293fdbcbd6885b0ff9/lib/nodefs-handler.js#L40-L58
6,337
sitespeedio/sitespeed.io
lib/plugins/text/textBuilder.js
abbr
function abbr(str) { if (/total|overall/i.test(str)) return str.trim(); return str.replace(/\w+\s?/g, a => a[0]); }
javascript
function abbr(str) { if (/total|overall/i.test(str)) return str.trim(); return str.replace(/\w+\s?/g, a => a[0]); }
[ "function", "abbr", "(", "str", ")", "{", "if", "(", "/", "total|overall", "/", "i", ".", "test", "(", "str", ")", ")", "return", "str", ".", "trim", "(", ")", ";", "return", "str", ".", "replace", "(", "/", "\\w+\\s?", "/", "g", ",", "a", "=>"...
foo bar -> fb
[ "foo", "bar", "-", ">", "fb" ]
8ebb751e35667e13db458bcac9a4bf6b412281b6
https://github.com/sitespeedio/sitespeed.io/blob/8ebb751e35667e13db458bcac9a4bf6b412281b6/lib/plugins/text/textBuilder.js#L43-L46
6,338
sitespeedio/sitespeed.io
lib/core/queueHandler.js
validateMessageFormat
function validateMessageFormat(message) { function validateTypeStructure(message) { const typeParts = message.type.split('.'), baseType = typeParts[0], typeDepth = typeParts.length; if (typeDepth > 2) throw new Error( 'Message type has too many dot separated sections: ' + message.ty...
javascript
function validateMessageFormat(message) { function validateTypeStructure(message) { const typeParts = message.type.split('.'), baseType = typeParts[0], typeDepth = typeParts.length; if (typeDepth > 2) throw new Error( 'Message type has too many dot separated sections: ' + message.ty...
[ "function", "validateMessageFormat", "(", "message", ")", "{", "function", "validateTypeStructure", "(", "message", ")", "{", "const", "typeParts", "=", "message", ".", "type", ".", "split", "(", "'.'", ")", ",", "baseType", "=", "typeParts", "[", "0", "]", ...
Check some message format best practices that applies to sitespeed.io. Throws an error if message doesn't follow the rules. @param message the message to check
[ "Check", "some", "message", "format", "best", "practices", "that", "applies", "to", "sitespeed", ".", "io", ".", "Throws", "an", "error", "if", "message", "doesn", "t", "follow", "the", "rules", "." ]
8ebb751e35667e13db458bcac9a4bf6b412281b6
https://github.com/sitespeedio/sitespeed.io/blob/8ebb751e35667e13db458bcac9a4bf6b412281b6/lib/core/queueHandler.js#L27-L87
6,339
zeit/ncc
examples/programmatic/scripts/build.js
write
function write(file, data) { writeFileSync(file, data); console.log( `✓ ${relative(__dirname + "/../", file)} (${bytes(statSync(file).size)})` ); }
javascript
function write(file, data) { writeFileSync(file, data); console.log( `✓ ${relative(__dirname + "/../", file)} (${bytes(statSync(file).size)})` ); }
[ "function", "write", "(", "file", ",", "data", ")", "{", "writeFileSync", "(", "file", ",", "data", ")", ";", "console", ".", "log", "(", "`", "re", "lative(_", "_", "dirname +", "\"", "../\", ", "f", "le)}", " ", "(", "by", "tes(s", "t", "atSync(f",...
write file to disk and print final size
[ "write", "file", "to", "disk", "and", "print", "final", "size" ]
c86f124c11a64a65e4e96235260d98bb84ee8230
https://github.com/zeit/ncc/blob/c86f124c11a64a65e4e96235260d98bb84ee8230/examples/programmatic/scripts/build.js#L26-L32
6,340
zeit/ncc
examples/programmatic/scripts/build.js
build
async function build(file) { const { code, map, assets } = await ncc(file, options); if (Object.keys(assets).length) console.error("New unexpected assets are being emitted for", file); const name = basename(file, ".js"); await mkdirp(resolve(DIST_DIR, name)); write(resolve(DIST_DIR, name, "index.js"), c...
javascript
async function build(file) { const { code, map, assets } = await ncc(file, options); if (Object.keys(assets).length) console.error("New unexpected assets are being emitted for", file); const name = basename(file, ".js"); await mkdirp(resolve(DIST_DIR, name)); write(resolve(DIST_DIR, name, "index.js"), c...
[ "async", "function", "build", "(", "file", ")", "{", "const", "{", "code", ",", "map", ",", "assets", "}", "=", "await", "ncc", "(", "file", ",", "options", ")", ";", "if", "(", "Object", ".", "keys", "(", "assets", ")", ".", "length", ")", "cons...
build file with its dependencies using ncc
[ "build", "file", "with", "its", "dependencies", "using", "ncc" ]
c86f124c11a64a65e4e96235260d98bb84ee8230
https://github.com/zeit/ncc/blob/c86f124c11a64a65e4e96235260d98bb84ee8230/examples/programmatic/scripts/build.js#L35-L45
6,341
googleapis/nodejs-dialogflow
samples/quickstart.js
runSample
async function runSample(projectId = 'your-project-id') { // A unique identifier for the given session const sessionId = uuid.v4(); // Create a new session const sessionClient = new dialogflow.SessionsClient(); const sessionPath = sessionClient.sessionPath(projectId, sessionId); // The text query request....
javascript
async function runSample(projectId = 'your-project-id') { // A unique identifier for the given session const sessionId = uuid.v4(); // Create a new session const sessionClient = new dialogflow.SessionsClient(); const sessionPath = sessionClient.sessionPath(projectId, sessionId); // The text query request....
[ "async", "function", "runSample", "(", "projectId", "=", "'your-project-id'", ")", "{", "// A unique identifier for the given session", "const", "sessionId", "=", "uuid", ".", "v4", "(", ")", ";", "// Create a new session", "const", "sessionClient", "=", "new", "dialo...
Send a query to the dialogflow agent, and return the query result. @param {string} projectId The project to be used
[ "Send", "a", "query", "to", "the", "dialogflow", "agent", "and", "return", "the", "query", "result", "." ]
871070f4b1514448bbe442dee71b5bb8e6a77064
https://github.com/googleapis/nodejs-dialogflow/blob/871070f4b1514448bbe442dee71b5bb8e6a77064/samples/quickstart.js#L27-L59
6,342
bootstrap-tagsinput/bootstrap-tagsinput
dist/bootstrap-tagsinput.js
function() { var self = this, val = $.map(self.items(), function(item) { return self.options.itemValue(item).toString(); }); self.$element.val(val, true); if (self.options.triggerChange) self.$element.trigger('change'); }
javascript
function() { var self = this, val = $.map(self.items(), function(item) { return self.options.itemValue(item).toString(); }); self.$element.val(val, true); if (self.options.triggerChange) self.$element.trigger('change'); }
[ "function", "(", ")", "{", "var", "self", "=", "this", ",", "val", "=", "$", ".", "map", "(", "self", ".", "items", "(", ")", ",", "function", "(", "item", ")", "{", "return", "self", ".", "options", ".", "itemValue", "(", "item", ")", ".", "to...
Assembly value by retrieving the value of each item, and set it on the element.
[ "Assembly", "value", "by", "retrieving", "the", "value", "of", "each", "item", "and", "set", "it", "on", "the", "element", "." ]
41fe4aa2201c4af4cfc4293fa3fc8260ad60bf35
https://github.com/bootstrap-tagsinput/bootstrap-tagsinput/blob/41fe4aa2201c4af4cfc4293fa3fc8260ad60bf35/dist/bootstrap-tagsinput.js#L272-L282
6,343
bootstrap-tagsinput/bootstrap-tagsinput
dist/bootstrap-tagsinput.js
makeOptionItemFunction
function makeOptionItemFunction(options, key) { if (typeof options[key] !== 'function') { var propertyName = options[key]; options[key] = function(item) { return item[propertyName]; }; } }
javascript
function makeOptionItemFunction(options, key) { if (typeof options[key] !== 'function') { var propertyName = options[key]; options[key] = function(item) { return item[propertyName]; }; } }
[ "function", "makeOptionItemFunction", "(", "options", ",", "key", ")", "{", "if", "(", "typeof", "options", "[", "key", "]", "!==", "'function'", ")", "{", "var", "propertyName", "=", "options", "[", "key", "]", ";", "options", "[", "key", "]", "=", "f...
Most options support both a string or number as well as a function as option value. This function makes sure that the option with the given key in the given options is wrapped in a function
[ "Most", "options", "support", "both", "a", "string", "or", "number", "as", "well", "as", "a", "function", "as", "option", "value", ".", "This", "function", "makes", "sure", "that", "the", "option", "with", "the", "given", "key", "in", "the", "given", "op...
41fe4aa2201c4af4cfc4293fa3fc8260ad60bf35
https://github.com/bootstrap-tagsinput/bootstrap-tagsinput/blob/41fe4aa2201c4af4cfc4293fa3fc8260ad60bf35/dist/bootstrap-tagsinput.js#L600-L605
6,344
bootstrap-tagsinput/bootstrap-tagsinput
dist/bootstrap-tagsinput.js
keyCombinationInList
function keyCombinationInList(keyPressEvent, lookupList) { var found = false; $.each(lookupList, function (index, keyCombination) { if (typeof (keyCombination) === 'number' && keyPressEvent.which === keyCombination) { found = true; return false; } i...
javascript
function keyCombinationInList(keyPressEvent, lookupList) { var found = false; $.each(lookupList, function (index, keyCombination) { if (typeof (keyCombination) === 'number' && keyPressEvent.which === keyCombination) { found = true; return false; } i...
[ "function", "keyCombinationInList", "(", "keyPressEvent", ",", "lookupList", ")", "{", "var", "found", "=", "false", ";", "$", ".", "each", "(", "lookupList", ",", "function", "(", "index", ",", "keyCombination", ")", "{", "if", "(", "typeof", "(", "keyCom...
Returns boolean indicates whether user has pressed an expected key combination. @param object keyPressEvent: JavaScript event object, refer http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html @param object lookupList: expected key combinations, as in: [13, {which: 188, shiftKey: true}]
[ "Returns", "boolean", "indicates", "whether", "user", "has", "pressed", "an", "expected", "key", "combination", "." ]
41fe4aa2201c4af4cfc4293fa3fc8260ad60bf35
https://github.com/bootstrap-tagsinput/bootstrap-tagsinput/blob/41fe4aa2201c4af4cfc4293fa3fc8260ad60bf35/dist/bootstrap-tagsinput.js#L648-L668
6,345
maicki/why-did-you-update
lib/index.js
createClassComponent
function createClassComponent(ctor, displayName, opts) { var cdu = createComponentDidUpdate(displayName, opts); // the wrapper class extends the original class, // and overwrites its `componentDidUpdate` method, // to allow why-did-you-update to listen for updates. // If the component had its own `componentD...
javascript
function createClassComponent(ctor, displayName, opts) { var cdu = createComponentDidUpdate(displayName, opts); // the wrapper class extends the original class, // and overwrites its `componentDidUpdate` method, // to allow why-did-you-update to listen for updates. // If the component had its own `componentD...
[ "function", "createClassComponent", "(", "ctor", ",", "displayName", ",", "opts", ")", "{", "var", "cdu", "=", "createComponentDidUpdate", "(", "displayName", ",", "opts", ")", ";", "// the wrapper class extends the original class,", "// and overwrites its `componentDidUpda...
Creates a wrapper for a React class component
[ "Creates", "a", "wrapper", "for", "a", "React", "class", "component" ]
8c8c25c87bc65f737b5ab12c07de69f1d237433c
https://github.com/maicki/why-did-you-update/blob/8c8c25c87bc65f737b5ab12c07de69f1d237433c/lib/index.js#L49-L79
6,346
maicki/why-did-you-update
lib/index.js
createFunctionalComponent
function createFunctionalComponent(ctor, displayName, opts, ReactComponent) { var cdu = createComponentDidUpdate(displayName, opts); // We call the original function in the render() method, // and implement `componentDidUpdate` for `why-did-you-update` var WDYUFunctionalComponent = function (_ReactComponent) {...
javascript
function createFunctionalComponent(ctor, displayName, opts, ReactComponent) { var cdu = createComponentDidUpdate(displayName, opts); // We call the original function in the render() method, // and implement `componentDidUpdate` for `why-did-you-update` var WDYUFunctionalComponent = function (_ReactComponent) {...
[ "function", "createFunctionalComponent", "(", "ctor", ",", "displayName", ",", "opts", ",", "ReactComponent", ")", "{", "var", "cdu", "=", "createComponentDidUpdate", "(", "displayName", ",", "opts", ")", ";", "// We call the original function in the render() method,", ...
Creates a wrapper for a React functional component
[ "Creates", "a", "wrapper", "for", "a", "React", "functional", "component" ]
8c8c25c87bc65f737b5ab12c07de69f1d237433c
https://github.com/maicki/why-did-you-update/blob/8c8c25c87bc65f737b5ab12c07de69f1d237433c/lib/index.js#L82-L116
6,347
wux-weapp/wux-weapp
dist/helpers/relationsBehavior.js
bindFunc
function bindFunc(obj, method, observer) { const oldFn = obj[method] obj[method] = function(target) { if (observer) { observer.call(this, target, { [method]: true, }) } if (oldFn) { oldFn.call(this, target) } } }
javascript
function bindFunc(obj, method, observer) { const oldFn = obj[method] obj[method] = function(target) { if (observer) { observer.call(this, target, { [method]: true, }) } if (oldFn) { oldFn.call(this, target) } } }
[ "function", "bindFunc", "(", "obj", ",", "method", ",", "observer", ")", "{", "const", "oldFn", "=", "obj", "[", "method", "]", "obj", "[", "method", "]", "=", "function", "(", "target", ")", "{", "if", "(", "observer", ")", "{", "observer", ".", "...
bind func to obj
[ "bind", "func", "to", "obj" ]
7e472f5e7080bde7e6da2411dded3bf94fcd02f0
https://github.com/wux-weapp/wux-weapp/blob/7e472f5e7080bde7e6da2411dded3bf94fcd02f0/dist/helpers/relationsBehavior.js#L7-L19
6,348
snapappointments/bootstrap-select
docs/custom_theme/js/base.js
search
function search (query) { if (!allowSearch) { console.error('Assets for search still loading'); return; } var resultDocuments = []; var results = index.search(query + '~2'); // fuzzy for (var i=0; i < results.length; i++){ var result = results[i]; doc = documents[result.ref]; doc.summary ...
javascript
function search (query) { if (!allowSearch) { console.error('Assets for search still loading'); return; } var resultDocuments = []; var results = index.search(query + '~2'); // fuzzy for (var i=0; i < results.length; i++){ var result = results[i]; doc = documents[result.ref]; doc.summary ...
[ "function", "search", "(", "query", ")", "{", "if", "(", "!", "allowSearch", ")", "{", "console", ".", "error", "(", "'Assets for search still loading'", ")", ";", "return", ";", "}", "var", "resultDocuments", "=", "[", "]", ";", "var", "results", "=", "...
enable fuzzy searching
[ "enable", "fuzzy", "searching" ]
b6135994a96269c7920169ae18d42852c62a6c1b
https://github.com/snapappointments/bootstrap-select/blob/b6135994a96269c7920169ae18d42852c62a6c1b/docs/custom_theme/js/base.js#L81-L96
6,349
snapappointments/bootstrap-select
js/bootstrap-select.js
isEqual
function isEqual (array1, array2) { return array1.length === array2.length && array1.every(function (element, index) { return element === array2[index]; }); }
javascript
function isEqual (array1, array2) { return array1.length === array2.length && array1.every(function (element, index) { return element === array2[index]; }); }
[ "function", "isEqual", "(", "array1", ",", "array2", ")", "{", "return", "array1", ".", "length", "===", "array2", ".", "length", "&&", "array1", ".", "every", "(", "function", "(", "element", ",", "index", ")", "{", "return", "element", "===", "array2",...
shallow array comparison
[ "shallow", "array", "comparison" ]
b6135994a96269c7920169ae18d42852c62a6c1b
https://github.com/snapappointments/bootstrap-select/blob/b6135994a96269c7920169ae18d42852c62a6c1b/js/bootstrap-select.js#L215-L219
6,350
ExpressGateway/express-gateway
lib/policies/proxy/proxy.js
readCertificateDataFromFile
function readCertificateDataFromFile ({ keyFile, certFile, caFile }) { let key, cert, ca; if (keyFile) { key = fs.readFileSync(keyFile); } if (certFile) { cert = fs.readFileSync(certFile); } if (caFile) { ca = fs.readFileSync(caFile); } return { key, cert, ca }; }
javascript
function readCertificateDataFromFile ({ keyFile, certFile, caFile }) { let key, cert, ca; if (keyFile) { key = fs.readFileSync(keyFile); } if (certFile) { cert = fs.readFileSync(certFile); } if (caFile) { ca = fs.readFileSync(caFile); } return { key, cert, ca }; }
[ "function", "readCertificateDataFromFile", "(", "{", "keyFile", ",", "certFile", ",", "caFile", "}", ")", "{", "let", "key", ",", "cert", ",", "ca", ";", "if", "(", "keyFile", ")", "{", "key", "=", "fs", ".", "readFileSync", "(", "keyFile", ")", ";", ...
Parse endpoint URL if single URL is provided. Extend proxy options by allowing and parsing keyFile, certFile and caFile.
[ "Parse", "endpoint", "URL", "if", "single", "URL", "is", "provided", ".", "Extend", "proxy", "options", "by", "allowing", "and", "parsing", "keyFile", "certFile", "and", "caFile", "." ]
fc77679e66278a117389a94a1cdb01122603d59b
https://github.com/ExpressGateway/express-gateway/blob/fc77679e66278a117389a94a1cdb01122603d59b/lib/policies/proxy/proxy.js#L104-L120
6,351
finos/perspective
packages/perspective-viewer-highcharts/src/js/highcharts/externals.js
walk
function walk(arr, key, fn) { var l = arr.length, children; while (l--) { children = arr[l][key]; if (children) { walk(children, key, fn); } fn(arr[l]); } }
javascript
function walk(arr, key, fn) { var l = arr.length, children; while (l--) { children = arr[l][key]; if (children) { walk(children, key, fn); } fn(arr[l]); } }
[ "function", "walk", "(", "arr", ",", "key", ",", "fn", ")", "{", "var", "l", "=", "arr", ".", "length", ",", "children", ";", "while", "(", "l", "--", ")", "{", "children", "=", "arr", "[", "l", "]", "[", "key", "]", ";", "if", "(", "children...
Pushes part of grid to path
[ "Pushes", "part", "of", "grid", "to", "path" ]
6adfed1360e2d20e673930785e3bc4c19ba6d857
https://github.com/finos/perspective/blob/6adfed1360e2d20e673930785e3bc4c19ba6d857/packages/perspective-viewer-highcharts/src/js/highcharts/externals.js#L138-L150
6,352
finos/perspective
packages/perspective/bench/js/browser_runtime.js
run_table_cases
async function* run_table_cases(worker, data, test) { console.log(`Benchmarking \`${test}\``); try { for (let x = 0; x < ITERATIONS + TOSS_ITERATIONS; x++) { const start = performance.now(); const table = worker.table(data.slice ? data.slice() : data); await table.siz...
javascript
async function* run_table_cases(worker, data, test) { console.log(`Benchmarking \`${test}\``); try { for (let x = 0; x < ITERATIONS + TOSS_ITERATIONS; x++) { const start = performance.now(); const table = worker.table(data.slice ? data.slice() : data); await table.siz...
[ "async", "function", "*", "run_table_cases", "(", "worker", ",", "data", ",", "test", ")", "{", "console", ".", "log", "(", "`", "\\`", "${", "test", "}", "\\`", "`", ")", ";", "try", "{", "for", "(", "let", "x", "=", "0", ";", "x", "<", "ITERA...
Define benchmark cases
[ "Define", "benchmark", "cases" ]
6adfed1360e2d20e673930785e3bc4c19ba6d857
https://github.com/finos/perspective/blob/6adfed1360e2d20e673930785e3bc4c19ba6d857/packages/perspective/bench/js/browser_runtime.js#L59-L81
6,353
finos/perspective
packages/perspective-cli/src/js/index.js
convert
async function convert(filename, options) { let file; if (filename) { file = fs.readFileSync(filename).toString(); } else { file = await read_stdin(); } try { file = JSON.parse(file); } catch {} let tbl = table(file); let view = tbl.view(); let out; option...
javascript
async function convert(filename, options) { let file; if (filename) { file = fs.readFileSync(filename).toString(); } else { file = await read_stdin(); } try { file = JSON.parse(file); } catch {} let tbl = table(file); let view = tbl.view(); let out; option...
[ "async", "function", "convert", "(", "filename", ",", "options", ")", "{", "let", "file", ";", "if", "(", "filename", ")", "{", "file", "=", "fs", ".", "readFileSync", "(", "filename", ")", ".", "toString", "(", ")", ";", "}", "else", "{", "file", ...
Convert data from one format to another. @param {*} filename @param {*} options
[ "Convert", "data", "from", "one", "format", "to", "another", "." ]
6adfed1360e2d20e673930785e3bc4c19ba6d857
https://github.com/finos/perspective/blob/6adfed1360e2d20e673930785e3bc4c19ba6d857/packages/perspective-cli/src/js/index.js#L22-L60
6,354
finos/perspective
packages/perspective-cli/src/js/index.js
host
async function host(filename, options) { let files = [path.join(__dirname, "html")]; if (options.assets) { files = [options.assets, ...files]; } const server = new WebSocketHost({assets: files, port: options.port}); let file; if (filename) { file = fs.readFileSync(filename).toStr...
javascript
async function host(filename, options) { let files = [path.join(__dirname, "html")]; if (options.assets) { files = [options.assets, ...files]; } const server = new WebSocketHost({assets: files, port: options.port}); let file; if (filename) { file = fs.readFileSync(filename).toStr...
[ "async", "function", "host", "(", "filename", ",", "options", ")", "{", "let", "files", "=", "[", "path", ".", "join", "(", "__dirname", ",", "\"html\"", ")", "]", ";", "if", "(", "options", ".", "assets", ")", "{", "files", "=", "[", "options", "....
Host a Perspective on a web server. @param {*} filename @param {*} options
[ "Host", "a", "Perspective", "on", "a", "web", "server", "." ]
6adfed1360e2d20e673930785e3bc4c19ba6d857
https://github.com/finos/perspective/blob/6adfed1360e2d20e673930785e3bc4c19ba6d857/packages/perspective-cli/src/js/index.js#L68-L84
6,355
finos/perspective
packages/perspective-viewer-hypergrid/src/js/PerspectiveDataModel.js
async function(row, col, event) { if (this.isTreeCol(col)) { let isShift = false; if (event.primitiveEvent.detail.primitiveEvent) { isShift = !!event.primitiveEvent.detail.primitiveEvent.shiftKey; // typecast to boolean } let is_expanded = await th...
javascript
async function(row, col, event) { if (this.isTreeCol(col)) { let isShift = false; if (event.primitiveEvent.detail.primitiveEvent) { isShift = !!event.primitiveEvent.detail.primitiveEvent.shiftKey; // typecast to boolean } let is_expanded = await th...
[ "async", "function", "(", "row", ",", "col", ",", "event", ")", "{", "if", "(", "this", ".", "isTreeCol", "(", "col", ")", ")", "{", "let", "isShift", "=", "false", ";", "if", "(", "event", ".", "primitiveEvent", ".", "detail", ".", "primitiveEvent",...
Called when clicking on a row group expand
[ "Called", "when", "clicking", "on", "a", "row", "group", "expand" ]
6adfed1360e2d20e673930785e3bc4c19ba6d857
https://github.com/finos/perspective/blob/6adfed1360e2d20e673930785e3bc4c19ba6d857/packages/perspective-viewer-hypergrid/src/js/PerspectiveDataModel.js#L65-L93
6,356
jasonday/printThis
printThis.js
copyValues
function copyValues(origin, clone, elementSelector) { var $originalElements = origin.find(elementSelector); clone.find(elementSelector).each(function(index, item) { $(item).val($originalElements.eq(index).val()); }); }
javascript
function copyValues(origin, clone, elementSelector) { var $originalElements = origin.find(elementSelector); clone.find(elementSelector).each(function(index, item) { $(item).val($originalElements.eq(index).val()); }); }
[ "function", "copyValues", "(", "origin", ",", "clone", ",", "elementSelector", ")", "{", "var", "$originalElements", "=", "origin", ".", "find", "(", "elementSelector", ")", ";", "clone", ".", "find", "(", "elementSelector", ")", ".", "each", "(", "function"...
Copies values from origin to clone for passed in elementSelector
[ "Copies", "values", "from", "origin", "to", "clone", "for", "passed", "in", "elementSelector" ]
edc43df38e745fddf4823e227316250068a898db
https://github.com/jasonday/printThis/blob/edc43df38e745fddf4823e227316250068a898db/printThis.js#L81-L87
6,357
jasonday/printThis
printThis.js
setDocType
function setDocType($iframe, doctype){ var win, doc; win = $iframe.get(0); win = win.contentWindow || win.contentDocument || win; doc = win.document || win.contentDocument || win; doc.open(); doc.write(doctype); ...
javascript
function setDocType($iframe, doctype){ var win, doc; win = $iframe.get(0); win = win.contentWindow || win.contentDocument || win; doc = win.document || win.contentDocument || win; doc.open(); doc.write(doctype); ...
[ "function", "setDocType", "(", "$iframe", ",", "doctype", ")", "{", "var", "win", ",", "doc", ";", "win", "=", "$iframe", ".", "get", "(", "0", ")", ";", "win", "=", "win", ".", "contentWindow", "||", "win", ".", "contentDocument", "||", "win", ";", ...
Add doctype to fix the style difference between printing and render
[ "Add", "doctype", "to", "fix", "the", "style", "difference", "between", "printing", "and", "render" ]
edc43df38e745fddf4823e227316250068a898db
https://github.com/jasonday/printThis/blob/edc43df38e745fddf4823e227316250068a898db/printThis.js#L133-L141
6,358
jasonday/printThis
printThis.js
attachOnBeforePrintEvent
function attachOnBeforePrintEvent($iframe, beforePrintHandler) { var win = $iframe.get(0); win = win.contentWindow || win.contentDocument || win; if (typeof beforePrintHandler === "function") { if ('matchMedia' in win) { win.ma...
javascript
function attachOnBeforePrintEvent($iframe, beforePrintHandler) { var win = $iframe.get(0); win = win.contentWindow || win.contentDocument || win; if (typeof beforePrintHandler === "function") { if ('matchMedia' in win) { win.ma...
[ "function", "attachOnBeforePrintEvent", "(", "$iframe", ",", "beforePrintHandler", ")", "{", "var", "win", "=", "$iframe", ".", "get", "(", "0", ")", ";", "win", "=", "win", ".", "contentWindow", "||", "win", ".", "contentDocument", "||", "win", ";", "if",...
attach event handler function to beforePrint event
[ "attach", "event", "handler", "function", "to", "beforePrint", "event" ]
edc43df38e745fddf4823e227316250068a898db
https://github.com/jasonday/printThis/blob/edc43df38e745fddf4823e227316250068a898db/printThis.js#L261-L274
6,359
npm/node-semver
semver.js
isSatisfiable
function isSatisfiable (comparators, options) { var result = true var remainingComparators = comparators.slice() var testComparator = remainingComparators.pop() while (result && remainingComparators.length) { result = remainingComparators.every(function (otherComparator) { return testComparator.inter...
javascript
function isSatisfiable (comparators, options) { var result = true var remainingComparators = comparators.slice() var testComparator = remainingComparators.pop() while (result && remainingComparators.length) { result = remainingComparators.every(function (otherComparator) { return testComparator.inter...
[ "function", "isSatisfiable", "(", "comparators", ",", "options", ")", "{", "var", "result", "=", "true", "var", "remainingComparators", "=", "comparators", ".", "slice", "(", ")", "var", "testComparator", "=", "remainingComparators", ".", "pop", "(", ")", "whi...
take a set of comparators and determine whether there exists a version which can satisfy it
[ "take", "a", "set", "of", "comparators", "and", "determine", "whether", "there", "exists", "a", "version", "which", "can", "satisfy", "it" ]
5fb517b2906a0763518e1941a3f4a163956a81d3
https://github.com/npm/node-semver/blob/5fb517b2906a0763518e1941a3f4a163956a81d3/semver.js#L955-L969
6,360
apache/cordova-plugin-camera
src/windows/CameraProxy.js
resizeImageBase64
function resizeImageBase64 (successCallback, errorCallback, file, targetWidth, targetHeight) { fileIO.readBufferAsync(file).done(function (buffer) { var strBase64 = encodeToBase64String(buffer); var imageData = 'data:' + file.contentType + ';base64,' + strBase64; var image = new Image(); /*...
javascript
function resizeImageBase64 (successCallback, errorCallback, file, targetWidth, targetHeight) { fileIO.readBufferAsync(file).done(function (buffer) { var strBase64 = encodeToBase64String(buffer); var imageData = 'data:' + file.contentType + ';base64,' + strBase64; var image = new Image(); /*...
[ "function", "resizeImageBase64", "(", "successCallback", ",", "errorCallback", ",", "file", ",", "targetWidth", ",", "targetHeight", ")", "{", "fileIO", ".", "readBufferAsync", "(", "file", ")", ".", "done", "(", "function", "(", "buffer", ")", "{", "var", "...
Because of asynchronous method, so let the successCallback be called in it.
[ "Because", "of", "asynchronous", "method", "so", "let", "the", "successCallback", "be", "called", "in", "it", "." ]
295e928784e2a9785982fbf15b05215a317774df
https://github.com/apache/cordova-plugin-camera/blob/295e928784e2a9785982fbf15b05215a317774df/src/windows/CameraProxy.js#L133-L162
6,361
apache/cordova-plugin-camera
src/windows/CameraProxy.js
orientationToRotation
function orientationToRotation (orientation) { // VideoRotation enumerable and BitmapRotation enumerable have the same values // https://msdn.microsoft.com/en-us/library/windows/apps/windows.media.capture.videorotation.aspx // https://msdn.microsoft.com/en-us/library/windows/apps/windows.graphic...
javascript
function orientationToRotation (orientation) { // VideoRotation enumerable and BitmapRotation enumerable have the same values // https://msdn.microsoft.com/en-us/library/windows/apps/windows.media.capture.videorotation.aspx // https://msdn.microsoft.com/en-us/library/windows/apps/windows.graphic...
[ "function", "orientationToRotation", "(", "orientation", ")", "{", "// VideoRotation enumerable and BitmapRotation enumerable have the same values", "// https://msdn.microsoft.com/en-us/library/windows/apps/windows.media.capture.videorotation.aspx", "// https://msdn.microsoft.com/en-us/library/windo...
Converts SimpleOrientation to a VideoRotation to remove difference between camera sensor orientation and video orientation @param {number} orientation - Windows.Devices.Sensors.SimpleOrientation @return {number} - Windows.Media.Capture.VideoRotation
[ "Converts", "SimpleOrientation", "to", "a", "VideoRotation", "to", "remove", "difference", "between", "camera", "sensor", "orientation", "and", "video", "orientation" ]
295e928784e2a9785982fbf15b05215a317774df
https://github.com/apache/cordova-plugin-camera/blob/295e928784e2a9785982fbf15b05215a317774df/src/windows/CameraProxy.js#L651-L675
6,362
apache/cordova-plugin-camera
src/windows/CameraProxy.js
function (picture) { if (options.destinationType === Camera.DestinationType.FILE_URI || options.destinationType === Camera.DestinationType.NATIVE_URI) { if (options.targetHeight > 0 && options.targetWidth > 0) { resizeImage(successCallback, errorCallback, picture, options.targetWidth...
javascript
function (picture) { if (options.destinationType === Camera.DestinationType.FILE_URI || options.destinationType === Camera.DestinationType.NATIVE_URI) { if (options.targetHeight > 0 && options.targetWidth > 0) { resizeImage(successCallback, errorCallback, picture, options.targetWidth...
[ "function", "(", "picture", ")", "{", "if", "(", "options", ".", "destinationType", "===", "Camera", ".", "DestinationType", ".", "FILE_URI", "||", "options", ".", "destinationType", "===", "Camera", ".", "DestinationType", ".", "NATIVE_URI", ")", "{", "if", ...
success callback for capture operation
[ "success", "callback", "for", "capture", "operation" ]
295e928784e2a9785982fbf15b05215a317774df
https://github.com/apache/cordova-plugin-camera/blob/295e928784e2a9785982fbf15b05215a317774df/src/windows/CameraProxy.js#L783-L811
6,363
firefox-devtools/debugger
packages/devtools-reps/src/reps/grip.js
getProps
function getProps(componentProps, properties, indexes, suppressQuotes) { // Make indexes ordered by ascending. indexes.sort(function(a, b) { return a - b; }); const propertiesKeys = Object.keys(properties); return indexes.map(i => { const name = propertiesKeys[i]; const value = getPropValue(prope...
javascript
function getProps(componentProps, properties, indexes, suppressQuotes) { // Make indexes ordered by ascending. indexes.sort(function(a, b) { return a - b; }); const propertiesKeys = Object.keys(properties); return indexes.map(i => { const name = propertiesKeys[i]; const value = getPropValue(prope...
[ "function", "getProps", "(", "componentProps", ",", "properties", ",", "indexes", ",", "suppressQuotes", ")", "{", "// Make indexes ordered by ascending.", "indexes", ".", "sort", "(", "function", "(", "a", ",", "b", ")", "{", "return", "a", "-", "b", ";", "...
Get props ordered by index. @param {Object} componentProps Grip Component props. @param {Object} properties Properties of the object the Grip describes. @param {Array} indexes Indexes of properties. @param {Boolean} suppressQuotes true if we should suppress quotes on property names. @return {Array} Props.
[ "Get", "props", "ordered", "by", "index", "." ]
a1cb80a1c9f9b1d9aae463ec188fdc58ea4f8d2f
https://github.com/firefox-devtools/debugger/blob/a1cb80a1c9f9b1d9aae463ec188fdc58ea4f8d2f/packages/devtools-reps/src/reps/grip.js#L244-L266
6,364
firefox-devtools/debugger
packages/devtools-reps/src/reps/grip.js
getPropIndexes
function getPropIndexes(properties, max, filter) { const indexes = []; try { let i = 0; for (const name in properties) { if (indexes.length >= max) { return indexes; } // Type is specified in grip's "class" field and for primitive // values use typeof. const value = g...
javascript
function getPropIndexes(properties, max, filter) { const indexes = []; try { let i = 0; for (const name in properties) { if (indexes.length >= max) { return indexes; } // Type is specified in grip's "class" field and for primitive // values use typeof. const value = g...
[ "function", "getPropIndexes", "(", "properties", ",", "max", ",", "filter", ")", "{", "const", "indexes", "=", "[", "]", ";", "try", "{", "let", "i", "=", "0", ";", "for", "(", "const", "name", "in", "properties", ")", "{", "if", "(", "indexes", "....
Get the indexes of props in the object. @param {Object} properties Props object. @param {Number} max The maximum length of indexes array. @param {Function} filter Filter the props you want. @return {Array} Indexes of interesting props in the object.
[ "Get", "the", "indexes", "of", "props", "in", "the", "object", "." ]
a1cb80a1c9f9b1d9aae463ec188fdc58ea4f8d2f
https://github.com/firefox-devtools/debugger/blob/a1cb80a1c9f9b1d9aae463ec188fdc58ea4f8d2f/packages/devtools-reps/src/reps/grip.js#L276-L301
6,365
firefox-devtools/debugger
packages/devtools-reps/src/reps/grip.js
getPropValue
function getPropValue(property) { let value = property; if (typeof property === "object") { const keys = Object.keys(property); if (keys.includes("value")) { value = property.value; } else if (keys.includes("getterValue")) { value = property.getterValue; } } return value; }
javascript
function getPropValue(property) { let value = property; if (typeof property === "object") { const keys = Object.keys(property); if (keys.includes("value")) { value = property.value; } else if (keys.includes("getterValue")) { value = property.getterValue; } } return value; }
[ "function", "getPropValue", "(", "property", ")", "{", "let", "value", "=", "property", ";", "if", "(", "typeof", "property", "===", "\"object\"", ")", "{", "const", "keys", "=", "Object", ".", "keys", "(", "property", ")", ";", "if", "(", "keys", ".",...
Get the actual value of a property. @param {Object} property @return {Object} Value of the property.
[ "Get", "the", "actual", "value", "of", "a", "property", "." ]
a1cb80a1c9f9b1d9aae463ec188fdc58ea4f8d2f
https://github.com/firefox-devtools/debugger/blob/a1cb80a1c9f9b1d9aae463ec188fdc58ea4f8d2f/packages/devtools-reps/src/reps/grip.js#L309-L320
6,366
firefox-devtools/debugger
packages/devtools-components/src/tree.js
oncePerAnimationFrame
function oncePerAnimationFrame(fn) { let animationId = null; let argsToPass = null; return function(...args) { argsToPass = args; if (animationId !== null) { return; } animationId = requestAnimationFrame(() => { fn.call(this, ...argsToPass); animationId = null; argsToPass ...
javascript
function oncePerAnimationFrame(fn) { let animationId = null; let argsToPass = null; return function(...args) { argsToPass = args; if (animationId !== null) { return; } animationId = requestAnimationFrame(() => { fn.call(this, ...argsToPass); animationId = null; argsToPass ...
[ "function", "oncePerAnimationFrame", "(", "fn", ")", "{", "let", "animationId", "=", "null", ";", "let", "argsToPass", "=", "null", ";", "return", "function", "(", "...", "args", ")", "{", "argsToPass", "=", "args", ";", "if", "(", "animationId", "!==", ...
Create a function that calls the given function `fn` only once per animation frame. @param {Function} fn @returns {Function}
[ "Create", "a", "function", "that", "calls", "the", "given", "function", "fn", "only", "once", "per", "animation", "frame", "." ]
a1cb80a1c9f9b1d9aae463ec188fdc58ea4f8d2f
https://github.com/firefox-devtools/debugger/blob/a1cb80a1c9f9b1d9aae463ec188fdc58ea4f8d2f/packages/devtools-components/src/tree.js#L227-L242
6,367
firefox-devtools/debugger
packages/devtools-reps/src/reps/rep-utils.js
escapeString
function escapeString(str, escapeWhitespace) { return `"${str.replace(escapeRegexp, (match, offset) => { const c = match.charCodeAt(0); if (c in escapeMap) { if (!escapeWhitespace && (c === 9 || c === 0xa || c === 0xd)) { return match[0]; } return escapeMap[c]; } if (c >= 0xd...
javascript
function escapeString(str, escapeWhitespace) { return `"${str.replace(escapeRegexp, (match, offset) => { const c = match.charCodeAt(0); if (c in escapeMap) { if (!escapeWhitespace && (c === 9 || c === 0xa || c === 0xd)) { return match[0]; } return escapeMap[c]; } if (c >= 0xd...
[ "function", "escapeString", "(", "str", ",", "escapeWhitespace", ")", "{", "return", "`", "${", "str", ".", "replace", "(", "escapeRegexp", ",", "(", "match", ",", "offset", ")", "=>", "{", "const", "c", "=", "match", ".", "charCodeAt", "(", "0", ")", ...
Escape a string so that the result is viewable and valid JS. Control characters, other invisibles, invalid characters, backslash, and double quotes are escaped. The resulting string is surrounded by double quotes. @param {String} str the input @param {Boolean} escapeWhitespace if true, TAB, CR, and NL characters will...
[ "Escape", "a", "string", "so", "that", "the", "result", "is", "viewable", "and", "valid", "JS", ".", "Control", "characters", "other", "invisibles", "invalid", "characters", "backslash", "and", "double", "quotes", "are", "escaped", ".", "The", "resulting", "st...
a1cb80a1c9f9b1d9aae463ec188fdc58ea4f8d2f
https://github.com/firefox-devtools/debugger/blob/a1cb80a1c9f9b1d9aae463ec188fdc58ea4f8d2f/packages/devtools-reps/src/reps/rep-utils.js#L137-L171
6,368
firefox-devtools/debugger
packages/devtools-reps/src/reps/rep-utils.js
getGripPreviewItems
function getGripPreviewItems(grip) { if (!grip) { return []; } // Promise resolved value Grip if (grip.promiseState && grip.promiseState.value) { return [grip.promiseState.value]; } // Array Grip if (grip.preview && grip.preview.items) { return grip.preview.items; } // Node Grip if (g...
javascript
function getGripPreviewItems(grip) { if (!grip) { return []; } // Promise resolved value Grip if (grip.promiseState && grip.promiseState.value) { return [grip.promiseState.value]; } // Array Grip if (grip.preview && grip.preview.items) { return grip.preview.items; } // Node Grip if (g...
[ "function", "getGripPreviewItems", "(", "grip", ")", "{", "if", "(", "!", "grip", ")", "{", "return", "[", "]", ";", "}", "// Promise resolved value Grip", "if", "(", "grip", ".", "promiseState", "&&", "grip", ".", "promiseState", ".", "value", ")", "{", ...
Get preview items from a Grip. @param {Object} Grip from which we want the preview items @return {Array} Array of the preview items of the grip, or an empty array if the grip does not have preview items
[ "Get", "preview", "items", "from", "a", "Grip", "." ]
a1cb80a1c9f9b1d9aae463ec188fdc58ea4f8d2f
https://github.com/firefox-devtools/debugger/blob/a1cb80a1c9f9b1d9aae463ec188fdc58ea4f8d2f/packages/devtools-reps/src/reps/rep-utils.js#L340-L399
6,369
firefox-devtools/debugger
packages/devtools-reps/src/reps/rep-utils.js
getGripType
function getGripType(object, noGrip) { if (noGrip || Object(object) !== object) { return typeof object; } if (object.type === "object") { return object.class; } return object.type; }
javascript
function getGripType(object, noGrip) { if (noGrip || Object(object) !== object) { return typeof object; } if (object.type === "object") { return object.class; } return object.type; }
[ "function", "getGripType", "(", "object", ",", "noGrip", ")", "{", "if", "(", "noGrip", "||", "Object", "(", "object", ")", "!==", "object", ")", "{", "return", "typeof", "object", ";", "}", "if", "(", "object", ".", "type", "===", "\"object\"", ")", ...
Get the type of an object. @param {Object} Grip from which we want the type. @param {boolean} noGrip true if the object is not a grip. @return {boolean}
[ "Get", "the", "type", "of", "an", "object", "." ]
a1cb80a1c9f9b1d9aae463ec188fdc58ea4f8d2f
https://github.com/firefox-devtools/debugger/blob/a1cb80a1c9f9b1d9aae463ec188fdc58ea4f8d2f/packages/devtools-reps/src/reps/rep-utils.js#L408-L416
6,370
firefox-devtools/debugger
packages/devtools-reps/src/reps/rep-utils.js
isURL
function isURL(token) { try { if (!validProtocols.test(token)) { return false; } new URL(token); return true; } catch (e) { return false; } }
javascript
function isURL(token) { try { if (!validProtocols.test(token)) { return false; } new URL(token); return true; } catch (e) { return false; } }
[ "function", "isURL", "(", "token", ")", "{", "try", "{", "if", "(", "!", "validProtocols", ".", "test", "(", "token", ")", ")", "{", "return", "false", ";", "}", "new", "URL", "(", "token", ")", ";", "return", "true", ";", "}", "catch", "(", "e",...
Determines whether a string token is a valid URL. @param string token The token. @return boolean Whether the token is a URL.
[ "Determines", "whether", "a", "string", "token", "is", "a", "valid", "URL", "." ]
a1cb80a1c9f9b1d9aae463ec188fdc58ea4f8d2f
https://github.com/firefox-devtools/debugger/blob/a1cb80a1c9f9b1d9aae463ec188fdc58ea4f8d2f/packages/devtools-reps/src/reps/rep-utils.js#L443-L453
6,371
firefox-devtools/debugger
packages/devtools-reps/src/reps/rep-utils.js
interleave
function interleave(items, char) { return items.reduce((res, item, index) => { if (index !== items.length - 1) { return res.concat(item, char); } return res.concat(item); }, []); }
javascript
function interleave(items, char) { return items.reduce((res, item, index) => { if (index !== items.length - 1) { return res.concat(item, char); } return res.concat(item); }, []); }
[ "function", "interleave", "(", "items", ",", "char", ")", "{", "return", "items", ".", "reduce", "(", "(", "res", ",", "item", ",", "index", ")", "=>", "{", "if", "(", "index", "!==", "items", ".", "length", "-", "1", ")", "{", "return", "res", "...
Returns new array in which `char` are interleaved between the original items. @param {Array} items @param {String} char @returns Array
[ "Returns", "new", "array", "in", "which", "char", "are", "interleaved", "between", "the", "original", "items", "." ]
a1cb80a1c9f9b1d9aae463ec188fdc58ea4f8d2f
https://github.com/firefox-devtools/debugger/blob/a1cb80a1c9f9b1d9aae463ec188fdc58ea4f8d2f/packages/devtools-reps/src/reps/rep-utils.js#L462-L469
6,372
firefox-devtools/debugger
src/utils/pause/frames/annotateFrames.js
getBabelFrameIndexes
function getBabelFrameIndexes(frames) { const startIndexes = frames.reduce((accumulator, frame, index) => { if ( getFrameUrl(frame).match(/regenerator-runtime/i) && frame.displayName === "tryCatch" ) { return [...accumulator, index]; } return accumulator; }, []); const endIndexe...
javascript
function getBabelFrameIndexes(frames) { const startIndexes = frames.reduce((accumulator, frame, index) => { if ( getFrameUrl(frame).match(/regenerator-runtime/i) && frame.displayName === "tryCatch" ) { return [...accumulator, index]; } return accumulator; }, []); const endIndexe...
[ "function", "getBabelFrameIndexes", "(", "frames", ")", "{", "const", "startIndexes", "=", "frames", ".", "reduce", "(", "(", "accumulator", ",", "frame", ",", "index", ")", "=>", "{", "if", "(", "getFrameUrl", "(", "frame", ")", ".", "match", "(", "/", ...
Receives an array of frames and looks for babel async call stack groups.
[ "Receives", "an", "array", "of", "frames", "and", "looks", "for", "babel", "async", "call", "stack", "groups", "." ]
a1cb80a1c9f9b1d9aae463ec188fdc58ea4f8d2f
https://github.com/firefox-devtools/debugger/blob/a1cb80a1c9f9b1d9aae463ec188fdc58ea4f8d2f/src/utils/pause/frames/annotateFrames.js#L46-L81
6,373
firefox-devtools/debugger
packages/devtools-reps/src/reps/error.js
parseStackString
function parseStackString(stack) { const res = []; if (!stack) { return res; } const isStacktraceALongString = isLongString(stack); const stackString = isStacktraceALongString ? stack.initial : stack; stackString.split("\n").forEach((frame, index, frames) => { if (!frame) { // Skip any blank...
javascript
function parseStackString(stack) { const res = []; if (!stack) { return res; } const isStacktraceALongString = isLongString(stack); const stackString = isStacktraceALongString ? stack.initial : stack; stackString.split("\n").forEach((frame, index, frames) => { if (!frame) { // Skip any blank...
[ "function", "parseStackString", "(", "stack", ")", "{", "const", "res", "=", "[", "]", ";", "if", "(", "!", "stack", ")", "{", "return", "res", ";", "}", "const", "isStacktraceALongString", "=", "isLongString", "(", "stack", ")", ";", "const", "stackStri...
Parse a string that should represent a stack trace and returns an array of the frames. The shape of the frames are extremely important as they can then be processed here or in the toolbox by other components. @param {String} stack @returns {Array} Array of frames, which are object with the following shape: - {String} f...
[ "Parse", "a", "string", "that", "should", "represent", "a", "stack", "trace", "and", "returns", "an", "array", "of", "the", "frames", ".", "The", "shape", "of", "the", "frames", "are", "extremely", "important", "as", "they", "can", "then", "be", "processed...
a1cb80a1c9f9b1d9aae463ec188fdc58ea4f8d2f
https://github.com/firefox-devtools/debugger/blob/a1cb80a1c9f9b1d9aae463ec188fdc58ea4f8d2f/packages/devtools-reps/src/reps/error.js#L165-L229
6,374
firefox-devtools/debugger
src/utils/fromJS.js
hasOwnProperty
function hasOwnProperty(value, key) { if (value.hasOwnProperty && isFunction(value.hasOwnProperty)) { return value.hasOwnProperty(key); } if (value.prototype && value.prototype.hasOwnProperty) { return value.prototype.hasOwnProperty(key); } return false; }
javascript
function hasOwnProperty(value, key) { if (value.hasOwnProperty && isFunction(value.hasOwnProperty)) { return value.hasOwnProperty(key); } if (value.prototype && value.prototype.hasOwnProperty) { return value.prototype.hasOwnProperty(key); } return false; }
[ "function", "hasOwnProperty", "(", "value", ",", "key", ")", "{", "if", "(", "value", ".", "hasOwnProperty", "&&", "isFunction", "(", "value", ".", "hasOwnProperty", ")", ")", "{", "return", "value", ".", "hasOwnProperty", "(", "key", ")", ";", "}", "if"...
hasOwnProperty is defensive because it is possible that the object that we're creating a map for has a `hasOwnProperty` field
[ "hasOwnProperty", "is", "defensive", "because", "it", "is", "possible", "that", "the", "object", "that", "we", "re", "creating", "a", "map", "for", "has", "a", "hasOwnProperty", "field" ]
a1cb80a1c9f9b1d9aae463ec188fdc58ea4f8d2f
https://github.com/firefox-devtools/debugger/blob/a1cb80a1c9f9b1d9aae463ec188fdc58ea4f8d2f/src/utils/fromJS.js#L18-L28
6,375
firefox-devtools/debugger
src/utils/pause/frames/collapseFrames.js
addGroupToList
function addGroupToList(group, list) { if (!group) { return list; } if (group.length > 1) { list.push(group); } else { list = list.concat(group); } return list; }
javascript
function addGroupToList(group, list) { if (!group) { return list; } if (group.length > 1) { list.push(group); } else { list = list.concat(group); } return list; }
[ "function", "addGroupToList", "(", "group", ",", "list", ")", "{", "if", "(", "!", "group", ")", "{", "return", "list", ";", "}", "if", "(", "group", ".", "length", ">", "1", ")", "{", "list", ".", "push", "(", "group", ")", ";", "}", "else", "...
We collapse groups of one so that user frames are not in a group of one
[ "We", "collapse", "groups", "of", "one", "so", "that", "user", "frames", "are", "not", "in", "a", "group", "of", "one" ]
a1cb80a1c9f9b1d9aae463ec188fdc58ea4f8d2f
https://github.com/firefox-devtools/debugger/blob/a1cb80a1c9f9b1d9aae463ec188fdc58ea4f8d2f/src/utils/pause/frames/collapseFrames.js#L33-L45
6,376
firefox-devtools/debugger
packages/devtools-reps/src/reps/grip-map.js
getEntries
function getEntries(props, entries, indexes) { const { onDOMNodeMouseOver, onDOMNodeMouseOut, onInspectIconClick } = props; // Make indexes ordered by ascending. indexes.sort(function(a, b) { return a - b; }); return indexes.map((index, i) => { const [key, entryValue] = entries[index]; const val...
javascript
function getEntries(props, entries, indexes) { const { onDOMNodeMouseOver, onDOMNodeMouseOut, onInspectIconClick } = props; // Make indexes ordered by ascending. indexes.sort(function(a, b) { return a - b; }); return indexes.map((index, i) => { const [key, entryValue] = entries[index]; const val...
[ "function", "getEntries", "(", "props", ",", "entries", ",", "indexes", ")", "{", "const", "{", "onDOMNodeMouseOver", ",", "onDOMNodeMouseOut", ",", "onInspectIconClick", "}", "=", "props", ";", "// Make indexes ordered by ascending.", "indexes", ".", "sort", "(", ...
Get entries ordered by index. @param {Object} props Component props. @param {Array} entries Entries array. @param {Array} indexes Indexes of entries. @return {Array} Array of PropRep.
[ "Get", "entries", "ordered", "by", "index", "." ]
a1cb80a1c9f9b1d9aae463ec188fdc58ea4f8d2f
https://github.com/firefox-devtools/debugger/blob/a1cb80a1c9f9b1d9aae463ec188fdc58ea4f8d2f/packages/devtools-reps/src/reps/grip-map.js#L141-L164
6,377
firefox-devtools/debugger
packages/devtools-reps/src/reps/grip-map.js
getEntriesIndexes
function getEntriesIndexes(entries, max, filter) { return entries.reduce((indexes, [key, entry], i) => { if (indexes.length < max) { const value = entry && entry.value !== undefined ? entry.value : entry; // Type is specified in grip's "class" field and for primitive // values use typeof. ...
javascript
function getEntriesIndexes(entries, max, filter) { return entries.reduce((indexes, [key, entry], i) => { if (indexes.length < max) { const value = entry && entry.value !== undefined ? entry.value : entry; // Type is specified in grip's "class" field and for primitive // values use typeof. ...
[ "function", "getEntriesIndexes", "(", "entries", ",", "max", ",", "filter", ")", "{", "return", "entries", ".", "reduce", "(", "(", "indexes", ",", "[", "key", ",", "entry", "]", ",", "i", ")", "=>", "{", "if", "(", "indexes", ".", "length", "<", "...
Get the indexes of entries in the map. @param {Array} entries Entries array. @param {Number} max The maximum length of indexes array. @param {Function} filter Filter the entry you want. @return {Array} Indexes of filtered entries in the map.
[ "Get", "the", "indexes", "of", "entries", "in", "the", "map", "." ]
a1cb80a1c9f9b1d9aae463ec188fdc58ea4f8d2f
https://github.com/firefox-devtools/debugger/blob/a1cb80a1c9f9b1d9aae463ec188fdc58ea4f8d2f/packages/devtools-reps/src/reps/grip-map.js#L174-L192
6,378
firefox-devtools/debugger
bin/copy-modules.js
createMozBuildFiles
function createMozBuildFiles() { const builds = {}; getFiles() .filter(file => file.match(/.js$/)) .filter(file => { if (file.match(/\/workers\.js/)) { return true; } // We exclude worker files because they are bundled and we include // worker/index.js files because are requi...
javascript
function createMozBuildFiles() { const builds = {}; getFiles() .filter(file => file.match(/.js$/)) .filter(file => { if (file.match(/\/workers\.js/)) { return true; } // We exclude worker files because they are bundled and we include // worker/index.js files because are requi...
[ "function", "createMozBuildFiles", "(", ")", "{", "const", "builds", "=", "{", "}", ";", "getFiles", "(", ")", ".", "filter", "(", "file", "=>", "file", ".", "match", "(", "/", ".js$", "/", ")", ")", ".", "filter", "(", "file", "=>", "{", "if", "...
Create the mandatory manifest file that should exist in each folder to list files and subfolders that should be packaged in Firefox.
[ "Create", "the", "mandatory", "manifest", "file", "that", "should", "exist", "in", "each", "folder", "to", "list", "files", "and", "subfolders", "that", "should", "be", "packaged", "in", "Firefox", "." ]
a1cb80a1c9f9b1d9aae463ec188fdc58ea4f8d2f
https://github.com/firefox-devtools/debugger/blob/a1cb80a1c9f9b1d9aae463ec188fdc58ea4f8d2f/bin/copy-modules.js#L66-L133
6,379
firefox-devtools/debugger
packages/devtools-reps/src/reps/string.js
getLinkifiedElements
function getLinkifiedElements(text, cropLimit, openLink, isInContentPage) { const halfLimit = Math.ceil((cropLimit - ELLIPSIS.length) / 2); const startCropIndex = cropLimit ? halfLimit : null; const endCropIndex = cropLimit ? text.length - halfLimit : null; const items = []; let currentIndex = 0; let conte...
javascript
function getLinkifiedElements(text, cropLimit, openLink, isInContentPage) { const halfLimit = Math.ceil((cropLimit - ELLIPSIS.length) / 2); const startCropIndex = cropLimit ? halfLimit : null; const endCropIndex = cropLimit ? text.length - halfLimit : null; const items = []; let currentIndex = 0; let conte...
[ "function", "getLinkifiedElements", "(", "text", ",", "cropLimit", ",", "openLink", ",", "isInContentPage", ")", "{", "const", "halfLimit", "=", "Math", ".", "ceil", "(", "(", "cropLimit", "-", "ELLIPSIS", ".", "length", ")", "/", "2", ")", ";", "const", ...
Get an array of the elements representing the string, cropped if needed, with actual links. @param {String} text: The actual string to linkify. @param {Integer | null} cropLimit @param {Function} openLink: Function handling the link opening. @param {Boolean} isInContentPage: pass true if the reps is rendered in the co...
[ "Get", "an", "array", "of", "the", "elements", "representing", "the", "string", "cropped", "if", "needed", "with", "actual", "links", "." ]
a1cb80a1c9f9b1d9aae463ec188fdc58ea4f8d2f
https://github.com/firefox-devtools/debugger/blob/a1cb80a1c9f9b1d9aae463ec188fdc58ea4f8d2f/packages/devtools-reps/src/reps/string.js#L182-L259
6,380
firefox-devtools/debugger
packages/devtools-reps/src/reps/string.js
getCroppedString
function getCroppedString(text, offset = 0, startCropIndex, endCropIndex) { if (!startCropIndex) { return text; } const start = offset; const end = offset + text.length; const shouldBeVisible = !(start >= startCropIndex && end <= endCropIndex); if (!shouldBeVisible) { return null; } const sho...
javascript
function getCroppedString(text, offset = 0, startCropIndex, endCropIndex) { if (!startCropIndex) { return text; } const start = offset; const end = offset + text.length; const shouldBeVisible = !(start >= startCropIndex && end <= endCropIndex); if (!shouldBeVisible) { return null; } const sho...
[ "function", "getCroppedString", "(", "text", ",", "offset", "=", "0", ",", "startCropIndex", ",", "endCropIndex", ")", "{", "if", "(", "!", "startCropIndex", ")", "{", "return", "text", ";", "}", "const", "start", "=", "offset", ";", "const", "end", "=",...
Returns a cropped substring given an offset, start and end crop indices in a parent string. @param {String} text: The substring to crop. @param {Integer} offset: The offset corresponding to the index at which the substring is in the parent string. @param {Integer|null} startCropIndex: the index where the start of the ...
[ "Returns", "a", "cropped", "substring", "given", "an", "offset", "start", "and", "end", "crop", "indices", "in", "a", "parent", "string", "." ]
a1cb80a1c9f9b1d9aae463ec188fdc58ea4f8d2f
https://github.com/firefox-devtools/debugger/blob/a1cb80a1c9f9b1d9aae463ec188fdc58ea4f8d2f/packages/devtools-reps/src/reps/string.js#L275-L306
6,381
firefox-devtools/debugger
src/workers/parser/mapBindings.js
globalizeDeclaration
function globalizeDeclaration(node, bindings) { return node.declarations.map(declaration => t.expressionStatement( t.assignmentExpression( "=", getAssignmentTarget(declaration.id, bindings), declaration.init || t.unaryExpression("void", t.numericLiteral(0)) ) ) ); }
javascript
function globalizeDeclaration(node, bindings) { return node.declarations.map(declaration => t.expressionStatement( t.assignmentExpression( "=", getAssignmentTarget(declaration.id, bindings), declaration.init || t.unaryExpression("void", t.numericLiteral(0)) ) ) ); }
[ "function", "globalizeDeclaration", "(", "node", ",", "bindings", ")", "{", "return", "node", ".", "declarations", ".", "map", "(", "declaration", "=>", "t", ".", "expressionStatement", "(", "t", ".", "assignmentExpression", "(", "\"=\"", ",", "getAssignmentTarg...
translates new bindings `var a = 3` into `self.a = 3` and existing bindings `var a = 3` into `a = 3` for re-assignments
[ "translates", "new", "bindings", "var", "a", "=", "3", "into", "self", ".", "a", "=", "3", "and", "existing", "bindings", "var", "a", "=", "3", "into", "a", "=", "3", "for", "re", "-", "assignments" ]
a1cb80a1c9f9b1d9aae463ec188fdc58ea4f8d2f
https://github.com/firefox-devtools/debugger/blob/a1cb80a1c9f9b1d9aae463ec188fdc58ea4f8d2f/src/workers/parser/mapBindings.js#L57-L67
6,382
firefox-devtools/debugger
src/workers/parser/mapBindings.js
globalizeAssignment
function globalizeAssignment(node, bindings) { return t.assignmentExpression( node.operator, getAssignmentTarget(node.left, bindings), node.right ); }
javascript
function globalizeAssignment(node, bindings) { return t.assignmentExpression( node.operator, getAssignmentTarget(node.left, bindings), node.right ); }
[ "function", "globalizeAssignment", "(", "node", ",", "bindings", ")", "{", "return", "t", ".", "assignmentExpression", "(", "node", ".", "operator", ",", "getAssignmentTarget", "(", "node", ".", "left", ",", "bindings", ")", ",", "node", ".", "right", ")", ...
translates new bindings `a = 3` into `self.a = 3` and keeps assignments the same for existing bindings.
[ "translates", "new", "bindings", "a", "=", "3", "into", "self", ".", "a", "=", "3", "and", "keeps", "assignments", "the", "same", "for", "existing", "bindings", "." ]
a1cb80a1c9f9b1d9aae463ec188fdc58ea4f8d2f
https://github.com/firefox-devtools/debugger/blob/a1cb80a1c9f9b1d9aae463ec188fdc58ea4f8d2f/src/workers/parser/mapBindings.js#L71-L77
6,383
firefox-devtools/debugger
src/actions/breakpoints/syncBreakpoint.js
findExistingBreakpoint
function findExistingBreakpoint(state, generatedLocation) { const breakpoints = getBreakpointsList(state); return breakpoints.find(bp => { return ( bp.generatedLocation.sourceUrl == generatedLocation.sourceUrl && bp.generatedLocation.line == generatedLocation.line && bp.generatedLocation.colu...
javascript
function findExistingBreakpoint(state, generatedLocation) { const breakpoints = getBreakpointsList(state); return breakpoints.find(bp => { return ( bp.generatedLocation.sourceUrl == generatedLocation.sourceUrl && bp.generatedLocation.line == generatedLocation.line && bp.generatedLocation.colu...
[ "function", "findExistingBreakpoint", "(", "state", ",", "generatedLocation", ")", "{", "const", "breakpoints", "=", "getBreakpointsList", "(", "state", ")", ";", "return", "breakpoints", ".", "find", "(", "bp", "=>", "{", "return", "(", "bp", ".", "generatedL...
Look for an existing breakpoint at the specified generated location.
[ "Look", "for", "an", "existing", "breakpoint", "at", "the", "specified", "generated", "location", "." ]
a1cb80a1c9f9b1d9aae463ec188fdc58ea4f8d2f
https://github.com/firefox-devtools/debugger/blob/a1cb80a1c9f9b1d9aae463ec188fdc58ea4f8d2f/src/actions/breakpoints/syncBreakpoint.js#L92-L102
6,384
firefox-devtools/debugger
packages/devtools-reps/src/reps/function.js
getFunctionName
function getFunctionName(grip, props = {}) { let { functionName } = props; let name; if (functionName) { const end = functionName.length - 1; functionName = functionName.startsWith('"') && functionName.endsWith('"') ? functionName.substring(1, end) : functionName; } if ( gr...
javascript
function getFunctionName(grip, props = {}) { let { functionName } = props; let name; if (functionName) { const end = functionName.length - 1; functionName = functionName.startsWith('"') && functionName.endsWith('"') ? functionName.substring(1, end) : functionName; } if ( gr...
[ "function", "getFunctionName", "(", "grip", ",", "props", "=", "{", "}", ")", "{", "let", "{", "functionName", "}", "=", "props", ";", "let", "name", ";", "if", "(", "functionName", ")", "{", "const", "end", "=", "functionName", ".", "length", "-", "...
Returns a ReactElement representing the function name. @param {Object} grip : Function grip @param {Object} props: Function rep props
[ "Returns", "a", "ReactElement", "representing", "the", "function", "name", "." ]
a1cb80a1c9f9b1d9aae463ec188fdc58ea4f8d2f
https://github.com/firefox-devtools/debugger/blob/a1cb80a1c9f9b1d9aae463ec188fdc58ea4f8d2f/packages/devtools-reps/src/reps/function.js#L100-L129
6,385
firefox-devtools/debugger
src/workers/parser/findOutOfScopeLocations.js
getLocation
function getLocation(func) { const location = { ...func.location }; // if the function has an identifier, start the block after it so the // identifier is included in the "scope" of its parent const identifierEnd = get(func, "identifier.loc.end"); if (identifierEnd) { location.start = identifierEnd; } ...
javascript
function getLocation(func) { const location = { ...func.location }; // if the function has an identifier, start the block after it so the // identifier is included in the "scope" of its parent const identifierEnd = get(func, "identifier.loc.end"); if (identifierEnd) { location.start = identifierEnd; } ...
[ "function", "getLocation", "(", "func", ")", "{", "const", "location", "=", "{", "...", "func", ".", "location", "}", ";", "// if the function has an identifier, start the block after it so the", "// identifier is included in the \"scope\" of its parent", "const", "identifierEn...
Returns the location for a given function path. If the path represents a function declaration, the location will begin after the function identifier but before the function parameters.
[ "Returns", "the", "location", "for", "a", "given", "function", "path", ".", "If", "the", "path", "represents", "a", "function", "declaration", "the", "location", "will", "begin", "after", "the", "function", "identifier", "but", "before", "the", "function", "pa...
a1cb80a1c9f9b1d9aae463ec188fdc58ea4f8d2f
https://github.com/firefox-devtools/debugger/blob/a1cb80a1c9f9b1d9aae463ec188fdc58ea4f8d2f/src/workers/parser/findOutOfScopeLocations.js#L28-L39
6,386
firefox-devtools/debugger
packages/devtools-reps/src/reps/rep.js
function(props) { const { object, defaultRep } = props; const rep = getRep(object, defaultRep, props.noGrip); return rep(props); }
javascript
function(props) { const { object, defaultRep } = props; const rep = getRep(object, defaultRep, props.noGrip); return rep(props); }
[ "function", "(", "props", ")", "{", "const", "{", "object", ",", "defaultRep", "}", "=", "props", ";", "const", "rep", "=", "getRep", "(", "object", ",", "defaultRep", ",", "props", ".", "noGrip", ")", ";", "return", "rep", "(", "props", ")", ";", ...
Generic rep that is used for rendering native JS types or an object. The right template used for rendering is picked automatically according to the current value type. The value must be passed in as the 'object' property.
[ "Generic", "rep", "that", "is", "used", "for", "rendering", "native", "JS", "types", "or", "an", "object", ".", "The", "right", "template", "used", "for", "rendering", "is", "picked", "automatically", "according", "to", "the", "current", "value", "type", "."...
a1cb80a1c9f9b1d9aae463ec188fdc58ea4f8d2f
https://github.com/firefox-devtools/debugger/blob/a1cb80a1c9f9b1d9aae463ec188fdc58ea4f8d2f/packages/devtools-reps/src/reps/rep.js#L87-L91
6,387
firefox-devtools/debugger
packages/devtools-reps/src/reps/rep.js
getRep
function getRep(object, defaultRep = Grip, noGrip = false) { for (let i = 0; i < reps.length; i++) { const rep = reps[i]; try { // supportsObject could return weight (not only true/false // but a number), which would allow to priorities templates and // support better extensibility. if...
javascript
function getRep(object, defaultRep = Grip, noGrip = false) { for (let i = 0; i < reps.length; i++) { const rep = reps[i]; try { // supportsObject could return weight (not only true/false // but a number), which would allow to priorities templates and // support better extensibility. if...
[ "function", "getRep", "(", "object", ",", "defaultRep", "=", "Grip", ",", "noGrip", "=", "false", ")", "{", "for", "(", "let", "i", "=", "0", ";", "i", "<", "reps", ".", "length", ";", "i", "++", ")", "{", "const", "rep", "=", "reps", "[", "i",...
Helpers Return a rep object that is responsible for rendering given object. @param object {Object} Object to be rendered in the UI. This can be generic JS object as well as a grip (handle to a remote debuggee object). @param defaultRep {React.Component} The default template that should be used to render given object...
[ "Helpers", "Return", "a", "rep", "object", "that", "is", "responsible", "for", "rendering", "given", "object", "." ]
a1cb80a1c9f9b1d9aae463ec188fdc58ea4f8d2f
https://github.com/firefox-devtools/debugger/blob/a1cb80a1c9f9b1d9aae463ec188fdc58ea4f8d2f/packages/devtools-reps/src/reps/rep.js#L109-L125
6,388
firefox-devtools/debugger
bin/copy-assets.js
lastRelease
function lastRelease() { const {stdout: branches} = exec(`git branch -a | grep 'origin/release'`) const releases = branches. split("\n") .map(b => b.replace(/remotes\/origin\//, '').trim()) .filter(b => b.match(/^release-(\d+)$/)) const ordered = sortBy(releases, r => parseInt(/\d+/.exec(r)[0], 10) ...
javascript
function lastRelease() { const {stdout: branches} = exec(`git branch -a | grep 'origin/release'`) const releases = branches. split("\n") .map(b => b.replace(/remotes\/origin\//, '').trim()) .filter(b => b.match(/^release-(\d+)$/)) const ordered = sortBy(releases, r => parseInt(/\d+/.exec(r)[0], 10) ...
[ "function", "lastRelease", "(", ")", "{", "const", "{", "stdout", ":", "branches", "}", "=", "exec", "(", "`", "`", ")", "const", "releases", "=", "branches", ".", "split", "(", "\"\\n\"", ")", ".", "map", "(", "b", "=>", "b", ".", "replace", "(", ...
searches the git branches for the last release branch
[ "searches", "the", "git", "branches", "for", "the", "last", "release", "branch" ]
a1cb80a1c9f9b1d9aae463ec188fdc58ea4f8d2f
https://github.com/firefox-devtools/debugger/blob/a1cb80a1c9f9b1d9aae463ec188fdc58ea4f8d2f/bin/copy-assets.js#L187-L196
6,389
firefox-devtools/debugger
bin/copy-assets.js
updateManifest
function updateManifest() { const {stdout: branch} = exec(`git rev-parse --abbrev-ref HEAD`) if (!branch.includes("release")) { return; } console.log("[copy-assets] update assets manifest"); const last = lastRelease(); exec(`git cat-file -p ${last}:assets/module-manifest.json > assets/module-manifest...
javascript
function updateManifest() { const {stdout: branch} = exec(`git rev-parse --abbrev-ref HEAD`) if (!branch.includes("release")) { return; } console.log("[copy-assets] update assets manifest"); const last = lastRelease(); exec(`git cat-file -p ${last}:assets/module-manifest.json > assets/module-manifest...
[ "function", "updateManifest", "(", ")", "{", "const", "{", "stdout", ":", "branch", "}", "=", "exec", "(", "`", "`", ")", "if", "(", "!", "branch", ".", "includes", "(", "\"release\"", ")", ")", "{", "return", ";", "}", "console", ".", "log", "(", ...
updates the assets manifest with the latest release manifest so that webpack bundles remain largely the same
[ "updates", "the", "assets", "manifest", "with", "the", "latest", "release", "manifest", "so", "that", "webpack", "bundles", "remain", "largely", "the", "same" ]
a1cb80a1c9f9b1d9aae463ec188fdc58ea4f8d2f
https://github.com/firefox-devtools/debugger/blob/a1cb80a1c9f9b1d9aae463ec188fdc58ea4f8d2f/bin/copy-assets.js#L200-L211
6,390
deepstreamIO/deepstream.io
src/permission/rule-application.js
getRecordUpdateData
function getRecordUpdateData (msg) { let data try { data = JSON.parse(msg.data[2]) } catch (error) { return error } return data }
javascript
function getRecordUpdateData (msg) { let data try { data = JSON.parse(msg.data[2]) } catch (error) { return error } return data }
[ "function", "getRecordUpdateData", "(", "msg", ")", "{", "let", "data", "try", "{", "data", "=", "JSON", ".", "parse", "(", "msg", ".", "data", "[", "2", "]", ")", "}", "catch", "(", "error", ")", "{", "return", "error", "}", "return", "data", "}" ...
Extracts the data from record update messages @param {Object} msg a deepstream message @private @returns {Object} recordData
[ "Extracts", "the", "data", "from", "record", "update", "messages" ]
247aea5e49a94f57f72fbac8e2f4dc0cdbbded18
https://github.com/deepstreamIO/deepstream.io/blob/247aea5e49a94f57f72fbac8e2f4dc0cdbbded18/src/permission/rule-application.js#L428-L438
6,391
deepstreamIO/deepstream.io
src/config/js-yaml-loader.js
setGlobalConfigDirectory
function setGlobalConfigDirectory (argv, filePath) { const customConfigPath = argv.c || argv.config || filePath || process.env.DEEPSTREAM_CONFIG_DIRECTORY const configPath = customConfigPath ? verifyCustomConfigPath(customConfigPath) : getDefaultConfigPath() global.deepstreamConfDi...
javascript
function setGlobalConfigDirectory (argv, filePath) { const customConfigPath = argv.c || argv.config || filePath || process.env.DEEPSTREAM_CONFIG_DIRECTORY const configPath = customConfigPath ? verifyCustomConfigPath(customConfigPath) : getDefaultConfigPath() global.deepstreamConfDi...
[ "function", "setGlobalConfigDirectory", "(", "argv", ",", "filePath", ")", "{", "const", "customConfigPath", "=", "argv", ".", "c", "||", "argv", ".", "config", "||", "filePath", "||", "process", ".", "env", ".", "DEEPSTREAM_CONFIG_DIRECTORY", "const", "configPa...
Set the globalConfig prefix that will be used as the directory for ssl, permissions and auth relative files within the config file
[ "Set", "the", "globalConfig", "prefix", "that", "will", "be", "used", "as", "the", "directory", "for", "ssl", "permissions", "and", "auth", "relative", "files", "within", "the", "config", "file" ]
247aea5e49a94f57f72fbac8e2f4dc0cdbbded18
https://github.com/deepstreamIO/deepstream.io/blob/247aea5e49a94f57f72fbac8e2f4dc0cdbbded18/src/config/js-yaml-loader.js#L127-L138
6,392
deepstreamIO/deepstream.io
src/config/js-yaml-loader.js
setGlobalLibDirectory
function setGlobalLibDirectory (argv, config) { const libDir = argv.l || argv.libDir || (config.libDir && fileUtils.lookupConfRequirePath(config.libDir)) || process.env.DEEPSTREAM_LIBRARY_DIRECTORY global.deepstreamLibDir = libDir }
javascript
function setGlobalLibDirectory (argv, config) { const libDir = argv.l || argv.libDir || (config.libDir && fileUtils.lookupConfRequirePath(config.libDir)) || process.env.DEEPSTREAM_LIBRARY_DIRECTORY global.deepstreamLibDir = libDir }
[ "function", "setGlobalLibDirectory", "(", "argv", ",", "config", ")", "{", "const", "libDir", "=", "argv", ".", "l", "||", "argv", ".", "libDir", "||", "(", "config", ".", "libDir", "&&", "fileUtils", ".", "lookupConfRequirePath", "(", "config", ".", "libD...
Set the globalLib prefix that will be used as the directory for the logger and plugins within the config file
[ "Set", "the", "globalLib", "prefix", "that", "will", "be", "used", "as", "the", "directory", "for", "the", "logger", "and", "plugins", "within", "the", "config", "file" ]
247aea5e49a94f57f72fbac8e2f4dc0cdbbded18
https://github.com/deepstreamIO/deepstream.io/blob/247aea5e49a94f57f72fbac8e2f4dc0cdbbded18/src/config/js-yaml-loader.js#L144-L151
6,393
deepstreamIO/deepstream.io
src/config/js-yaml-loader.js
extendConfig
function extendConfig (config, argv) { const cliArgs = {} let key for (key in defaultOptions.get()) { cliArgs[key] = argv[key] } if (argv.port) { overrideEndpointOption('port', argv.port, 'websocket', config) } if (argv.host) { overrideEndpointOption('host', argv.host, 'websocket', config) ...
javascript
function extendConfig (config, argv) { const cliArgs = {} let key for (key in defaultOptions.get()) { cliArgs[key] = argv[key] } if (argv.port) { overrideEndpointOption('port', argv.port, 'websocket', config) } if (argv.host) { overrideEndpointOption('host', argv.host, 'websocket', config) ...
[ "function", "extendConfig", "(", "config", ",", "argv", ")", "{", "const", "cliArgs", "=", "{", "}", "let", "key", "for", "(", "key", "in", "defaultOptions", ".", "get", "(", ")", ")", "{", "cliArgs", "[", "key", "]", "=", "argv", "[", "key", "]", ...
Augments the basic configuration with command line parameters and normalizes paths within it @param {Object} config configuration @param {Object} argv command line arguments @param {String} configDir config directory @private @returns {Object} extended config
[ "Augments", "the", "basic", "configuration", "with", "command", "line", "parameters", "and", "normalizes", "paths", "within", "it" ]
247aea5e49a94f57f72fbac8e2f4dc0cdbbded18
https://github.com/deepstreamIO/deepstream.io/blob/247aea5e49a94f57f72fbac8e2f4dc0cdbbded18/src/config/js-yaml-loader.js#L164-L185
6,394
deepstreamIO/deepstream.io
src/config/js-yaml-loader.js
getDefaultConfigPath
function getDefaultConfigPath () { let filePath let i let k for (k = 0; k < DEFAULT_CONFIG_DIRS.length; k++) { for (i = 0; i < SUPPORTED_EXTENSIONS.length; i++) { filePath = DEFAULT_CONFIG_DIRS[k] + SUPPORTED_EXTENSIONS[i] if (fileUtils.fileExistsSync(filePath)) { return filePath ...
javascript
function getDefaultConfigPath () { let filePath let i let k for (k = 0; k < DEFAULT_CONFIG_DIRS.length; k++) { for (i = 0; i < SUPPORTED_EXTENSIONS.length; i++) { filePath = DEFAULT_CONFIG_DIRS[k] + SUPPORTED_EXTENSIONS[i] if (fileUtils.fileExistsSync(filePath)) { return filePath ...
[ "function", "getDefaultConfigPath", "(", ")", "{", "let", "filePath", "let", "i", "let", "k", "for", "(", "k", "=", "0", ";", "k", "<", "DEFAULT_CONFIG_DIRS", ".", "length", ";", "k", "++", ")", "{", "for", "(", "i", "=", "0", ";", "i", "<", "SUP...
Fallback if no config path is specified. Will attempt to load the file from the default directory @private @returns {String} filePath
[ "Fallback", "if", "no", "config", "path", "is", "specified", ".", "Will", "attempt", "to", "load", "the", "file", "from", "the", "default", "directory" ]
247aea5e49a94f57f72fbac8e2f4dc0cdbbded18
https://github.com/deepstreamIO/deepstream.io/blob/247aea5e49a94f57f72fbac8e2f4dc0cdbbded18/src/config/js-yaml-loader.js#L220-L235
6,395
deepstreamIO/deepstream.io
src/config/js-yaml-loader.js
replaceEnvironmentVariables
function replaceEnvironmentVariables (fileContent) { const environmentVariable = new RegExp(/\${([^}]+)}/g) // eslint-disable-next-line fileContent = fileContent.replace(environmentVariable, (a, b) => process.env[b] || '') return fileContent }
javascript
function replaceEnvironmentVariables (fileContent) { const environmentVariable = new RegExp(/\${([^}]+)}/g) // eslint-disable-next-line fileContent = fileContent.replace(environmentVariable, (a, b) => process.env[b] || '') return fileContent }
[ "function", "replaceEnvironmentVariables", "(", "fileContent", ")", "{", "const", "environmentVariable", "=", "new", "RegExp", "(", "/", "\\${([^}]+)}", "/", "g", ")", "// eslint-disable-next-line", "fileContent", "=", "fileContent", ".", "replace", "(", "environmentV...
Handle the introduction of global enviroment variables within the yml file, allowing value substitution. For example: ``` host: $HOST_NAME port: $HOST_PORT ``` @param {String} fileContent The loaded yml file @private @returns {void}
[ "Handle", "the", "introduction", "of", "global", "enviroment", "variables", "within", "the", "yml", "file", "allowing", "value", "substitution", "." ]
247aea5e49a94f57f72fbac8e2f4dc0cdbbded18
https://github.com/deepstreamIO/deepstream.io/blob/247aea5e49a94f57f72fbac8e2f4dc0cdbbded18/src/config/js-yaml-loader.js#L252-L257
6,396
deepstreamIO/deepstream.io
bin/deepstream-start.js
parseLogLevel
function parseLogLevel (logLevel) { if (!/debug|info|warn|error|off/i.test(logLevel)) { console.error('Log level must be one of the following (debug|info|warn|error|off)') process.exit(1) } return logLevel.toUpperCase() }
javascript
function parseLogLevel (logLevel) { if (!/debug|info|warn|error|off/i.test(logLevel)) { console.error('Log level must be one of the following (debug|info|warn|error|off)') process.exit(1) } return logLevel.toUpperCase() }
[ "function", "parseLogLevel", "(", "logLevel", ")", "{", "if", "(", "!", "/", "debug|info|warn|error|off", "/", "i", ".", "test", "(", "logLevel", ")", ")", "{", "console", ".", "error", "(", "'Log level must be one of the following (debug|info|warn|error|off)'", ")"...
Used by commander to parse the log level and fails if invalid value is passed in @private
[ "Used", "by", "commander", "to", "parse", "the", "log", "level", "and", "fails", "if", "invalid", "value", "is", "passed", "in" ]
247aea5e49a94f57f72fbac8e2f4dc0cdbbded18
https://github.com/deepstreamIO/deepstream.io/blob/247aea5e49a94f57f72fbac8e2f4dc0cdbbded18/bin/deepstream-start.js#L54-L60
6,397
deepstreamIO/deepstream.io
bin/deepstream-start.js
parseInteger
function parseInteger (name, port) { const portNumber = Number(port) if (!portNumber) { console.error(`Provided ${name} must be an integer`) process.exit(1) } return portNumber }
javascript
function parseInteger (name, port) { const portNumber = Number(port) if (!portNumber) { console.error(`Provided ${name} must be an integer`) process.exit(1) } return portNumber }
[ "function", "parseInteger", "(", "name", ",", "port", ")", "{", "const", "portNumber", "=", "Number", "(", "port", ")", "if", "(", "!", "portNumber", ")", "{", "console", ".", "error", "(", "`", "${", "name", "}", "`", ")", "process", ".", "exit", ...
Used by commander to parse numbers and fails if invalid value is passed in @private
[ "Used", "by", "commander", "to", "parse", "numbers", "and", "fails", "if", "invalid", "value", "is", "passed", "in" ]
247aea5e49a94f57f72fbac8e2f4dc0cdbbded18
https://github.com/deepstreamIO/deepstream.io/blob/247aea5e49a94f57f72fbac8e2f4dc0cdbbded18/bin/deepstream-start.js#L67-L74
6,398
deepstreamIO/deepstream.io
bin/deepstream-start.js
parseBoolean
function parseBoolean (name, enabled) { let isEnabled if (typeof enabled === 'undefined' || enabled === 'true') { isEnabled = true } else if (typeof enabled !== 'undefined' && enabled === 'false') { isEnabled = false } else { console.error(`Invalid argument for ${name}, please provide true or false`...
javascript
function parseBoolean (name, enabled) { let isEnabled if (typeof enabled === 'undefined' || enabled === 'true') { isEnabled = true } else if (typeof enabled !== 'undefined' && enabled === 'false') { isEnabled = false } else { console.error(`Invalid argument for ${name}, please provide true or false`...
[ "function", "parseBoolean", "(", "name", ",", "enabled", ")", "{", "let", "isEnabled", "if", "(", "typeof", "enabled", "===", "'undefined'", "||", "enabled", "===", "'true'", ")", "{", "isEnabled", "=", "true", "}", "else", "if", "(", "typeof", "enabled", ...
Used by commander to parse boolean and fails if invalid value is passed in @private
[ "Used", "by", "commander", "to", "parse", "boolean", "and", "fails", "if", "invalid", "value", "is", "passed", "in" ]
247aea5e49a94f57f72fbac8e2f4dc0cdbbded18
https://github.com/deepstreamIO/deepstream.io/blob/247aea5e49a94f57f72fbac8e2f4dc0cdbbded18/bin/deepstream-start.js#L81-L92
6,399
deepstreamIO/deepstream.io
src/record/record-handler.js
handleForceWriteAcknowledgement
function handleForceWriteAcknowledgement ( socketWrapper, message, cacheResponse, storageResponse, error ) { if (storageResponse && cacheResponse) { socketWrapper.sendMessage(RECORD, C.ACTIONS.WRITE_ACKNOWLEDGEMENT, [ message.data[0], [message.data[1]], messageBuilder.typed(error) ], true)...
javascript
function handleForceWriteAcknowledgement ( socketWrapper, message, cacheResponse, storageResponse, error ) { if (storageResponse && cacheResponse) { socketWrapper.sendMessage(RECORD, C.ACTIONS.WRITE_ACKNOWLEDGEMENT, [ message.data[0], [message.data[1]], messageBuilder.typed(error) ], true)...
[ "function", "handleForceWriteAcknowledgement", "(", "socketWrapper", ",", "message", ",", "cacheResponse", ",", "storageResponse", ",", "error", ")", "{", "if", "(", "storageResponse", "&&", "cacheResponse", ")", "{", "socketWrapper", ".", "sendMessage", "(", "RECOR...
Handles write acknowledgements during a force write. @param {SocketWrapper} socketWrapper the socket that sent the request @param {Object} message the update message @param {Boolean} cacheResponse flag indicating whether the cache has been set @param {Boolean} storageResponse flag indicating whether the storage la...
[ "Handles", "write", "acknowledgements", "during", "a", "force", "write", "." ]
247aea5e49a94f57f72fbac8e2f4dc0cdbbded18
https://github.com/deepstreamIO/deepstream.io/blob/247aea5e49a94f57f72fbac8e2f4dc0cdbbded18/src/record/record-handler.js#L29-L39