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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
17,600 | medialab/artoo | src/artoo.helpers.js | parallel | function parallel(tasks, params, last) {
var onEnd = (typeof params === 'function') ? params : params.done || last,
running = [],
results = [],
d = 0,
t,
l,
i;
if (typeof onEnd !== 'function')
onEnd = noop;
function cleanup() {
running.forEach(fu... | javascript | function parallel(tasks, params, last) {
var onEnd = (typeof params === 'function') ? params : params.done || last,
running = [],
results = [],
d = 0,
t,
l,
i;
if (typeof onEnd !== 'function')
onEnd = noop;
function cleanup() {
running.forEach(fu... | [
"function",
"parallel",
"(",
"tasks",
",",
"params",
",",
"last",
")",
"{",
"var",
"onEnd",
"=",
"(",
"typeof",
"params",
"===",
"'function'",
")",
"?",
"params",
":",
"params",
".",
"done",
"||",
"last",
",",
"running",
"=",
"[",
"]",
",",
"results"... | Launching tasks in parallel with an optional limit | [
"Launching",
"tasks",
"in",
"parallel",
"with",
"an",
"optional",
"limit"
] | 89fe334cb2c2ec38b16012edfab2977822e1ecda | https://github.com/medialab/artoo/blob/89fe334cb2c2ec38b16012edfab2977822e1ecda/src/artoo.helpers.js#L324-L368 |
17,601 | medialab/artoo | src/artoo.log.js | isAllowed | function isAllowed(level) {
var threshold = artoo.settings.log.level;
if (artoo.helpers.isArray(threshold))
return !!~threshold.indexOf(level);
else
return priorities.indexOf(level) >=
priorities.indexOf(threshold);
} | javascript | function isAllowed(level) {
var threshold = artoo.settings.log.level;
if (artoo.helpers.isArray(threshold))
return !!~threshold.indexOf(level);
else
return priorities.indexOf(level) >=
priorities.indexOf(threshold);
} | [
"function",
"isAllowed",
"(",
"level",
")",
"{",
"var",
"threshold",
"=",
"artoo",
".",
"settings",
".",
"log",
".",
"level",
";",
"if",
"(",
"artoo",
".",
"helpers",
".",
"isArray",
"(",
"threshold",
")",
")",
"return",
"!",
"!",
"~",
"threshold",
"... | Is the level allowed to log? | [
"Is",
"the",
"level",
"allowed",
"to",
"log?"
] | 89fe334cb2c2ec38b16012edfab2977822e1ecda | https://github.com/medialab/artoo/blob/89fe334cb2c2ec38b16012edfab2977822e1ecda/src/artoo.log.js#L31-L39 |
17,602 | medialab/artoo | src/methods/artoo.methods.scrape.js | scrape | function scrape(iterator, data, params, cb) {
var $ = artoo.$,
scraped = [],
loneSelector = !!data.attr || !!data.method || data.scrape ||
typeof data === 'string' ||
typeof data === 'function';
params = params || {};
// Transforming to selecto... | javascript | function scrape(iterator, data, params, cb) {
var $ = artoo.$,
scraped = [],
loneSelector = !!data.attr || !!data.method || data.scrape ||
typeof data === 'string' ||
typeof data === 'function';
params = params || {};
// Transforming to selecto... | [
"function",
"scrape",
"(",
"iterator",
",",
"data",
",",
"params",
",",
"cb",
")",
"{",
"var",
"$",
"=",
"artoo",
".",
"$",
",",
"scraped",
"=",
"[",
"]",
",",
"loneSelector",
"=",
"!",
"!",
"data",
".",
"attr",
"||",
"!",
"!",
"data",
".",
"me... | Scraping function after polymorphism has been taken care of | [
"Scraping",
"function",
"after",
"polymorphism",
"has",
"been",
"taken",
"care",
"of"
] | 89fe334cb2c2ec38b16012edfab2977822e1ecda | https://github.com/medialab/artoo/blob/89fe334cb2c2ec38b16012edfab2977822e1ecda/src/methods/artoo.methods.scrape.js#L47-L104 |
17,603 | medialab/artoo | src/methods/artoo.methods.scrape.js | polymorphism | function polymorphism(iterator, data, params, cb) {
var h = artoo.helpers,
i, d, p, c;
if (h.isPlainObject(iterator) &&
!h.isSelector(iterator) &&
!h.isDocument(iterator) &&
(iterator.iterator || iterator.data || iterator.params)) {
d = iterator.data;
p = h.isPlainOb... | javascript | function polymorphism(iterator, data, params, cb) {
var h = artoo.helpers,
i, d, p, c;
if (h.isPlainObject(iterator) &&
!h.isSelector(iterator) &&
!h.isDocument(iterator) &&
(iterator.iterator || iterator.data || iterator.params)) {
d = iterator.data;
p = h.isPlainOb... | [
"function",
"polymorphism",
"(",
"iterator",
",",
"data",
",",
"params",
",",
"cb",
")",
"{",
"var",
"h",
"=",
"artoo",
".",
"helpers",
",",
"i",
",",
"d",
",",
"p",
",",
"c",
";",
"if",
"(",
"h",
".",
"isPlainObject",
"(",
"iterator",
")",
"&&",... | Function taking care of harsh polymorphism | [
"Function",
"taking",
"care",
"of",
"harsh",
"polymorphism"
] | 89fe334cb2c2ec38b16012edfab2977822e1ecda | https://github.com/medialab/artoo/blob/89fe334cb2c2ec38b16012edfab2977822e1ecda/src/methods/artoo.methods.scrape.js#L107-L133 |
17,604 | thumbsup/thumbsup | src/steps/step-album-zip.js | createZip | function createZip (targetZipPath, currentFolder, filesToInclude, done) {
const args = ['-FS', targetZipPath].concat(filesToInclude)
const startTime = Date.now()
trace(`Calling: zip ${args.join(' ')}`)
const child = childProcess.spawn('zip', args, {
cwd: currentFolder,
stdio: [ 'ignore', 'ignore', 'igno... | javascript | function createZip (targetZipPath, currentFolder, filesToInclude, done) {
const args = ['-FS', targetZipPath].concat(filesToInclude)
const startTime = Date.now()
trace(`Calling: zip ${args.join(' ')}`)
const child = childProcess.spawn('zip', args, {
cwd: currentFolder,
stdio: [ 'ignore', 'ignore', 'igno... | [
"function",
"createZip",
"(",
"targetZipPath",
",",
"currentFolder",
",",
"filesToInclude",
",",
"done",
")",
"{",
"const",
"args",
"=",
"[",
"'-FS'",
",",
"targetZipPath",
"]",
".",
"concat",
"(",
"filesToInclude",
")",
"const",
"startTime",
"=",
"Date",
".... | This function uses the Unix ZIP command, which supports "updating" a ZIP file In the future it could also delegate to 7zip on Windows | [
"This",
"function",
"uses",
"the",
"Unix",
"ZIP",
"command",
"which",
"supports",
"updating",
"a",
"ZIP",
"file",
"In",
"the",
"future",
"it",
"could",
"also",
"delegate",
"to",
"7zip",
"on",
"Windows"
] | d2ad35d225655b59515e4cd0f431e9d7d5447615 | https://github.com/thumbsup/thumbsup/blob/d2ad35d225655b59515e4cd0f431e9d7d5447615/src/steps/step-album-zip.js#L39-L56 |
17,605 | testem/testem | examples/template_stealjs/funcunit/syn/resources/jquery.event.drop.js | function( event, drag ) {
var el, drops, selector, sels;
this.last_active = [];
for(var i=0; i < this._elements.length; i++){ //for each element
el = this._elements[i]
var drops = $.event.findBySelector(el, eventNames)
for(selector in drops){ //find the selectors
sels = selector ? jQuery(sele... | javascript | function( event, drag ) {
var el, drops, selector, sels;
this.last_active = [];
for(var i=0; i < this._elements.length; i++){ //for each element
el = this._elements[i]
var drops = $.event.findBySelector(el, eventNames)
for(selector in drops){ //find the selectors
sels = selector ? jQuery(sele... | [
"function",
"(",
"event",
",",
"drag",
")",
"{",
"var",
"el",
",",
"drops",
",",
"selector",
",",
"sels",
";",
"this",
".",
"last_active",
"=",
"[",
"]",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"this",
".",
"_elements",
".",
"leng... | Gets all elements that are droppable, adds them | [
"Gets",
"all",
"elements",
"that",
"are",
"droppable",
"adds",
"them"
] | 47773ffe85627d7486496e5999082b01b4add222 | https://github.com/testem/testem/blob/47773ffe85627d7486496e5999082b01b4add222/examples/template_stealjs/funcunit/syn/resources/jquery.event.drop.js#L302-L318 | |
17,606 | testem/testem | examples/template_stealjs/steal/steal.js | function( url, expand ) {
var u = File(url);
// if this.path is absolutely referenced
if ( this.protocol() ) { //if we are absolutely referenced
//try to shorten the path as much as possible:
var firstDomain = this.domain(),
secondDomain = u.domain();
// if domains are equal, sho... | javascript | function( url, expand ) {
var u = File(url);
// if this.path is absolutely referenced
if ( this.protocol() ) { //if we are absolutely referenced
//try to shorten the path as much as possible:
var firstDomain = this.domain(),
secondDomain = u.domain();
// if domains are equal, sho... | [
"function",
"(",
"url",
",",
"expand",
")",
"{",
"var",
"u",
"=",
"File",
"(",
"url",
")",
";",
"// if this.path is absolutely referenced",
"if",
"(",
"this",
".",
"protocol",
"(",
")",
")",
"{",
"//if we are absolutely referenced",
"//try to shorten the path as m... | Returns the path of this file referenced from another url or path.
new steal.File('a/b.c').joinFrom('/d/e')//-> /d/e/a/b.c
@param {String} url
@param {Boolean} expand if the path should be expanded
@return {String} | [
"Returns",
"the",
"path",
"of",
"this",
"file",
"referenced",
"from",
"another",
"url",
"or",
"path",
"."
] | 47773ffe85627d7486496e5999082b01b4add222 | https://github.com/testem/testem/blob/47773ffe85627d7486496e5999082b01b4add222/examples/template_stealjs/steal/steal.js#L511-L566 | |
17,607 | testem/testem | examples/template_stealjs/steal/steal.js | function( url ) {
var parts = this.path.split('/'),
other_parts = url.split('/'),
result = '';
while ( parts.length > 0 && other_parts.length > 0 && parts[0] == other_parts[0] ) {
parts.shift();
other_parts.shift();
}
each(other_parts, function(){ result += '../'; })
return result + parts... | javascript | function( url ) {
var parts = this.path.split('/'),
other_parts = url.split('/'),
result = '';
while ( parts.length > 0 && other_parts.length > 0 && parts[0] == other_parts[0] ) {
parts.shift();
other_parts.shift();
}
each(other_parts, function(){ result += '../'; })
return result + parts... | [
"function",
"(",
"url",
")",
"{",
"var",
"parts",
"=",
"this",
".",
"path",
".",
"split",
"(",
"'/'",
")",
",",
"other_parts",
"=",
"url",
".",
"split",
"(",
"'/'",
")",
",",
"result",
"=",
"''",
";",
"while",
"(",
"parts",
".",
"length",
">",
... | Returns the relative path between two paths with common folders.
@codestart
new steal.File('a/b/c/x/y').toReferenceFromSameDomain('a/b/c/d/e')//-> ../../x/y
@codeend
@param {Object} url
@return {String} | [
"Returns",
"the",
"relative",
"path",
"between",
"two",
"paths",
"with",
"common",
"folders",
"."
] | 47773ffe85627d7486496e5999082b01b4add222 | https://github.com/testem/testem/blob/47773ffe85627d7486496e5999082b01b4add222/examples/template_stealjs/steal/steal.js#L579-L589 | |
17,608 | testem/testem | examples/template_stealjs/steal/steal.js | function() {
var current = File.cur().dir(),
//if you are cross domain from the page, and providing a path that doesn't have an domain
path = this.path;
if (/^\/\//.test(this.path)) { //if path is rooted from steal's root (DEPRECATED)
path = this.path.substr(2);
}
else if (/^\.\//.test(this.p... | javascript | function() {
var current = File.cur().dir(),
//if you are cross domain from the page, and providing a path that doesn't have an domain
path = this.path;
if (/^\/\//.test(this.path)) { //if path is rooted from steal's root (DEPRECATED)
path = this.path.substr(2);
}
else if (/^\.\//.test(this.p... | [
"function",
"(",
")",
"{",
"var",
"current",
"=",
"File",
".",
"cur",
"(",
")",
".",
"dir",
"(",
")",
",",
"//if you are cross domain from the page, and providing a path that doesn't have an domain",
"path",
"=",
"this",
".",
"path",
";",
"if",
"(",
"/",
"^\\/\\... | For a given path, a given working directory, and file location, update the path so
it points to a location relative to steal's root.
We want everything relative to steal's root so the same app can work in multiple pages.
./files/a.js = steals a.js
./files/a = a/a.js
files/a = //files/a/a.js
files/a.js = loads //files... | [
"For",
"a",
"given",
"path",
"a",
"given",
"working",
"directory",
"and",
"file",
"location",
"update",
"the",
"path",
"so",
"it",
"points",
"to",
"a",
"location",
"relative",
"to",
"steal",
"s",
"root",
"."
] | 47773ffe85627d7486496e5999082b01b4add222 | https://github.com/testem/testem/blob/47773ffe85627d7486496e5999082b01b4add222/examples/template_stealjs/steal/steal.js#L614-L637 | |
17,609 | testem/testem | examples/template_stealjs/steal/steal.js | function(options){
var stel = new steal.p.init(options),
rootSrc = stel.options.rootSrc;
if(stel.unique && rootSrc){
// the .js is b/c we are not adding that automatically until
// load because we defer 'type' determination until then
if(!steals[rootSrc] && ! steals[rootSrc+".js"]){ //if ... | javascript | function(options){
var stel = new steal.p.init(options),
rootSrc = stel.options.rootSrc;
if(stel.unique && rootSrc){
// the .js is b/c we are not adding that automatically until
// load because we defer 'type' determination until then
if(!steals[rootSrc] && ! steals[rootSrc+".js"]){ //if ... | [
"function",
"(",
"options",
")",
"{",
"var",
"stel",
"=",
"new",
"steal",
".",
"p",
".",
"init",
"(",
"options",
")",
",",
"rootSrc",
"=",
"stel",
".",
"options",
".",
"rootSrc",
";",
"if",
"(",
"stel",
".",
"unique",
"&&",
"rootSrc",
")",
"{",
"... | adds a new steal and throws an error if the script doesn't load this also checks the steals map | [
"adds",
"a",
"new",
"steal",
"and",
"throws",
"an",
"error",
"if",
"the",
"script",
"doesn",
"t",
"load",
"this",
"also",
"checks",
"the",
"steals",
"map"
] | 47773ffe85627d7486496e5999082b01b4add222 | https://github.com/testem/testem/blob/47773ffe85627d7486496e5999082b01b4add222/examples/template_stealjs/steal/steal.js#L654-L672 | |
17,610 | testem/testem | examples/template_stealjs/steal/steal.js | function(returnScript) {
// if we are already loading / loaded
if(this.loading || this.isLoaded){
return;
}
this.loading = true;
var self = this;
// get yourself
steal.require(this.options, function load_calling_loaded(script){
self.loaded(script);
}, function(error, src){
win.clearT... | javascript | function(returnScript) {
// if we are already loading / loaded
if(this.loading || this.isLoaded){
return;
}
this.loading = true;
var self = this;
// get yourself
steal.require(this.options, function load_calling_loaded(script){
self.loaded(script);
}, function(error, src){
win.clearT... | [
"function",
"(",
"returnScript",
")",
"{",
"// if we are already loading / loaded",
"if",
"(",
"this",
".",
"loading",
"||",
"this",
".",
"isLoaded",
")",
"{",
"return",
";",
"}",
"this",
".",
"loading",
"=",
"true",
";",
"var",
"self",
"=",
"this",
";",
... | Loads this steal | [
"Loads",
"this",
"steal"
] | 47773ffe85627d7486496e5999082b01b4add222 | https://github.com/testem/testem/blob/47773ffe85627d7486496e5999082b01b4add222/examples/template_stealjs/steal/steal.js#L864-L879 | |
17,611 | testem/testem | examples/template_stealjs/steal/steal.js | function(){
var args = typeof arguments[0] == 'function' ?
arguments : [function(){}].concat(makeArray( arguments ) )
return steal.apply(win, args );
} | javascript | function(){
var args = typeof arguments[0] == 'function' ?
arguments : [function(){}].concat(makeArray( arguments ) )
return steal.apply(win, args );
} | [
"function",
"(",
")",
"{",
"var",
"args",
"=",
"typeof",
"arguments",
"[",
"0",
"]",
"==",
"'function'",
"?",
"arguments",
":",
"[",
"function",
"(",
")",
"{",
"}",
"]",
".",
"concat",
"(",
"makeArray",
"(",
"arguments",
")",
")",
"return",
"steal",
... | Calls steal, but waits until all previous steals
have completed loading until loading the
files passed to the arguments. | [
"Calls",
"steal",
"but",
"waits",
"until",
"all",
"previous",
"steals",
"have",
"completed",
"loading",
"until",
"loading",
"the",
"files",
"passed",
"to",
"the",
"arguments",
"."
] | 47773ffe85627d7486496e5999082b01b4add222 | https://github.com/testem/testem/blob/47773ffe85627d7486496e5999082b01b4add222/examples/template_stealjs/steal/steal.js#L1042-L1046 | |
17,612 | testem/testem | examples/template_stealjs/steal/steal.js | function(event, listener){
if(!events[event]){
events[event] = []
}
var special = steal.events[event]
if(special && special.add){
listener = special.add(listener);
}
listener && events[event].push(listener);
return steal;
} | javascript | function(event, listener){
if(!events[event]){
events[event] = []
}
var special = steal.events[event]
if(special && special.add){
listener = special.add(listener);
}
listener && events[event].push(listener);
return steal;
} | [
"function",
"(",
"event",
",",
"listener",
")",
"{",
"if",
"(",
"!",
"events",
"[",
"event",
"]",
")",
"{",
"events",
"[",
"event",
"]",
"=",
"[",
"]",
"}",
"var",
"special",
"=",
"steal",
".",
"events",
"[",
"event",
"]",
"if",
"(",
"special",
... | Listens to events on Steal
@param {String} event
@param {Function} listener | [
"Listens",
"to",
"events",
"on",
"Steal"
] | 47773ffe85627d7486496e5999082b01b4add222 | https://github.com/testem/testem/blob/47773ffe85627d7486496e5999082b01b4add222/examples/template_stealjs/steal/steal.js#L1052-L1062 | |
17,613 | testem/testem | examples/template_stealjs/steal/steal.js | function(event, listener){
var evs = events[event] || [],
i = 0;
while(i < evs.length){
if(listener === evs[i]){
evs.splice(i,1);
}else{
i++;
}
}
} | javascript | function(event, listener){
var evs = events[event] || [],
i = 0;
while(i < evs.length){
if(listener === evs[i]){
evs.splice(i,1);
}else{
i++;
}
}
} | [
"function",
"(",
"event",
",",
"listener",
")",
"{",
"var",
"evs",
"=",
"events",
"[",
"event",
"]",
"||",
"[",
"]",
",",
"i",
"=",
"0",
";",
"while",
"(",
"i",
"<",
"evs",
".",
"length",
")",
"{",
"if",
"(",
"listener",
"===",
"evs",
"[",
"i... | Unbinds an event listener on steal
@param {Object} event
@param {Object} listener | [
"Unbinds",
"an",
"event",
"listener",
"on",
"steal"
] | 47773ffe85627d7486496e5999082b01b4add222 | https://github.com/testem/testem/blob/47773ffe85627d7486496e5999082b01b4add222/examples/template_stealjs/steal/steal.js#L1076-L1086 | |
17,614 | testem/testem | examples/template_stealjs/steal/steal.js | function(name){
// create the steal, mark it as loading, then as loaded
var stel = steal.p.make( name );
stel.loading = true;
convert(stel, "complete");
steal.preloaded(stel);
stel.loaded()
return steal;
} | javascript | function(name){
// create the steal, mark it as loading, then as loaded
var stel = steal.p.make( name );
stel.loading = true;
convert(stel, "complete");
steal.preloaded(stel);
stel.loaded()
return steal;
} | [
"function",
"(",
"name",
")",
"{",
"// create the steal, mark it as loading, then as loaded",
"var",
"stel",
"=",
"steal",
".",
"p",
".",
"make",
"(",
"name",
")",
";",
"stel",
".",
"loading",
"=",
"true",
";",
"convert",
"(",
"stel",
",",
"\"complete\"",
")... | called when a script has loaded via production | [
"called",
"when",
"a",
"script",
"has",
"loaded",
"via",
"production"
] | 47773ffe85627d7486496e5999082b01b4add222 | https://github.com/testem/testem/blob/47773ffe85627d7486496e5999082b01b4add222/examples/template_stealjs/steal/steal.js#L1114-L1123 | |
17,615 | testem/testem | examples/template_stealjs/steal/steal.js | function(script) {
script[ STR_ONREADYSTATECHANGE ]
= script[ STR_ONLOAD ]
= script[STR_ONERROR]
= null;
head().removeChild( script );
} | javascript | function(script) {
script[ STR_ONREADYSTATECHANGE ]
= script[ STR_ONLOAD ]
= script[STR_ONERROR]
= null;
head().removeChild( script );
} | [
"function",
"(",
"script",
")",
"{",
"script",
"[",
"STR_ONREADYSTATECHANGE",
"]",
"=",
"script",
"[",
"STR_ONLOAD",
"]",
"=",
"script",
"[",
"STR_ONERROR",
"]",
"=",
"null",
";",
"head",
"(",
")",
".",
"removeChild",
"(",
"script",
")",
";",
"}"
] | a clean up script that prevents memory leaks and removes the script | [
"a",
"clean",
"up",
"script",
"that",
"prevents",
"memory",
"leaks",
"and",
"removes",
"the",
"script"
] | 47773ffe85627d7486496e5999082b01b4add222 | https://github.com/testem/testem/blob/47773ffe85627d7486496e5999082b01b4add222/examples/template_stealjs/steal/steal.js#L1292-L1299 | |
17,616 | testem/testem | examples/template_stealjs/steal/steal.js | function(){
// if we don't have a current 'top' steal
// we create one and set it up
// to start loading its dependencies (the current pending steals)
if(! currentCollection ){
currentCollection = new steal.p.init();
// keep a reference in case it disappears
var cur = currentCollection,
... | javascript | function(){
// if we don't have a current 'top' steal
// we create one and set it up
// to start loading its dependencies (the current pending steals)
if(! currentCollection ){
currentCollection = new steal.p.init();
// keep a reference in case it disappears
var cur = currentCollection,
... | [
"function",
"(",
")",
"{",
"// if we don't have a current 'top' steal",
"// we create one and set it up",
"// to start loading its dependencies (the current pending steals)",
"if",
"(",
"!",
"currentCollection",
")",
"{",
"currentCollection",
"=",
"new",
"steal",
".",
"p",
".",... | called after steals are added to the pending queue | [
"called",
"after",
"steals",
"are",
"added",
"to",
"the",
"pending",
"queue"
] | 47773ffe85627d7486496e5999082b01b4add222 | https://github.com/testem/testem/blob/47773ffe85627d7486496e5999082b01b4add222/examples/template_stealjs/steal/steal.js#L1535-L1562 | |
17,617 | testem/testem | examples/template_stealjs/steal/steal.js | function(){
// indicates that a collection of steals has started
steal.trigger("start", cur);
when(cur,"complete", function(){
steal.trigger("end", cur);
});
cur.loaded();
} | javascript | function(){
// indicates that a collection of steals has started
steal.trigger("start", cur);
when(cur,"complete", function(){
steal.trigger("end", cur);
});
cur.loaded();
} | [
"function",
"(",
")",
"{",
"// indicates that a collection of steals has started",
"steal",
".",
"trigger",
"(",
"\"start\"",
",",
"cur",
")",
";",
"when",
"(",
"cur",
",",
"\"complete\"",
",",
"function",
"(",
")",
"{",
"steal",
".",
"trigger",
"(",
"\"end\""... | keep a reference in case it disappears | [
"keep",
"a",
"reference",
"in",
"case",
"it",
"disappears"
] | 47773ffe85627d7486496e5999082b01b4add222 | https://github.com/testem/testem/blob/47773ffe85627d7486496e5999082b01b4add222/examples/template_stealjs/steal/steal.js#L1545-L1552 | |
17,618 | testem/testem | examples/template_stealjs/steal/steal.js | after | function after(f, after, changeRet){
return changeRet ?
function after_CRet(){
return after.apply(this,[f.apply(this,arguments)].concat(makeArray(arguments)));
}:
function after_Ret(){
var ret = f.apply(this,arguments);
after.apply(this,arguments);
return ret;
}
} | javascript | function after(f, after, changeRet){
return changeRet ?
function after_CRet(){
return after.apply(this,[f.apply(this,arguments)].concat(makeArray(arguments)));
}:
function after_Ret(){
var ret = f.apply(this,arguments);
after.apply(this,arguments);
return ret;
}
} | [
"function",
"after",
"(",
"f",
",",
"after",
",",
"changeRet",
")",
"{",
"return",
"changeRet",
"?",
"function",
"after_CRet",
"(",
")",
"{",
"return",
"after",
".",
"apply",
"(",
"this",
",",
"[",
"f",
".",
"apply",
"(",
"this",
",",
"arguments",
")... | Set up a function that runs after the first param.
@param {Object} f
@param {Object} after
@param {Object} changeRet If true, the result of the function will be passed to the after function as the first param. If false, the after function's params are the
same as the original function's params | [
"Set",
"up",
"a",
"function",
"that",
"runs",
"after",
"the",
"first",
"param",
"."
] | 47773ffe85627d7486496e5999082b01b4add222 | https://github.com/testem/testem/blob/47773ffe85627d7486496e5999082b01b4add222/examples/template_stealjs/steal/steal.js#L1642-L1653 |
17,619 | testem/testem | examples/template_stealjs/steal/steal.js | convert | function convert(ob, func){
var oldFunc = ob[func];
// if we don't have callbacks
if(!ob[func].callbacks){
//replace start with a function that will call ob2's method
ob[func] = function(){
var me = arguments.callee,
ret;
// call the original function
ret = oldFunc.apply(ob,argu... | javascript | function convert(ob, func){
var oldFunc = ob[func];
// if we don't have callbacks
if(!ob[func].callbacks){
//replace start with a function that will call ob2's method
ob[func] = function(){
var me = arguments.callee,
ret;
// call the original function
ret = oldFunc.apply(ob,argu... | [
"function",
"convert",
"(",
"ob",
",",
"func",
")",
"{",
"var",
"oldFunc",
"=",
"ob",
"[",
"func",
"]",
";",
"// if we don't have callbacks",
"if",
"(",
"!",
"ob",
"[",
"func",
"]",
".",
"callbacks",
")",
"{",
"//replace start with a function that will call ob... | converts a function to work with when | [
"converts",
"a",
"function",
"to",
"work",
"with",
"when"
] | 47773ffe85627d7486496e5999082b01b4add222 | https://github.com/testem/testem/blob/47773ffe85627d7486496e5999082b01b4add222/examples/template_stealjs/steal/steal.js#L1656-L1687 |
17,620 | testem/testem | examples/template_stealjs/steal/steal.js | function(obj, meth){
// converts the function to be able to call
// this join
var f = convert(obj, meth);
if(!f.called){
// adds us to the callback ... the callback will call
// called
f.callbacks.push(this);
this.calls++;
}
} | javascript | function(obj, meth){
// converts the function to be able to call
// this join
var f = convert(obj, meth);
if(!f.called){
// adds us to the callback ... the callback will call
// called
f.callbacks.push(this);
this.calls++;
}
} | [
"function",
"(",
"obj",
",",
"meth",
")",
"{",
"// converts the function to be able to call ",
"// this join",
"var",
"f",
"=",
"convert",
"(",
"obj",
",",
"meth",
")",
";",
"if",
"(",
"!",
"f",
".",
"called",
")",
"{",
"// adds us to the callback ... the callba... | adds functions that will call this join | [
"adds",
"functions",
"that",
"will",
"call",
"this",
"join"
] | 47773ffe85627d7486496e5999082b01b4add222 | https://github.com/testem/testem/blob/47773ffe85627d7486496e5999082b01b4add222/examples/template_stealjs/steal/steal.js#L1703-L1714 | |
17,621 | testem/testem | examples/template_stealjs/funcunit/syn/dist/syn.js | function( event, element, type, autoPrevent ) {
// dispatchEvent doesn't always work in IE (mostly in a popup)
if ( element.dispatchEvent && event ) {
var preventDefault = event.preventDefault,
prevents = autoPrevent ? -1 : 0;
//automatically prevents the default behavior for this event
//this ... | javascript | function( event, element, type, autoPrevent ) {
// dispatchEvent doesn't always work in IE (mostly in a popup)
if ( element.dispatchEvent && event ) {
var preventDefault = event.preventDefault,
prevents = autoPrevent ? -1 : 0;
//automatically prevents the default behavior for this event
//this ... | [
"function",
"(",
"event",
",",
"element",
",",
"type",
",",
"autoPrevent",
")",
"{",
"// dispatchEvent doesn't always work in IE (mostly in a popup)",
"if",
"(",
"element",
".",
"dispatchEvent",
"&&",
"event",
")",
"{",
"var",
"preventDefault",
"=",
"event",
".",
... | triggers an event on an element, returns true if default events should be run
Dispatches an event and returns true if default events should be run.
@hide
@param {Object} event
@param {Object} element
@param {Object} type
@param {Object} autoPrevent | [
"triggers",
"an",
"event",
"on",
"an",
"element",
"returns",
"true",
"if",
"default",
"events",
"should",
"be",
"run",
"Dispatches",
"an",
"event",
"and",
"returns",
"true",
"if",
"default",
"events",
"should",
"be",
"run",
"."
] | 47773ffe85627d7486496e5999082b01b4add222 | https://github.com/testem/testem/blob/47773ffe85627d7486496e5999082b01b4add222/examples/template_stealjs/funcunit/syn/dist/syn.js#L438-L470 | |
17,622 | testem/testem | examples/template_stealjs/funcunit/syn/dist/syn.js | function( timeout, callback ) {
if ( typeof timeout === 'function' ) {
callback = timeout;
timeout = null;
}
timeout = timeout || 600;
var self = this;
this.queue.unshift(function() {
setTimeout(function() {
callback && callback.apply(self, [])
self.done.apply(self, arguments);
... | javascript | function( timeout, callback ) {
if ( typeof timeout === 'function' ) {
callback = timeout;
timeout = null;
}
timeout = timeout || 600;
var self = this;
this.queue.unshift(function() {
setTimeout(function() {
callback && callback.apply(self, [])
self.done.apply(self, arguments);
... | [
"function",
"(",
"timeout",
",",
"callback",
")",
"{",
"if",
"(",
"typeof",
"timeout",
"===",
"'function'",
")",
"{",
"callback",
"=",
"timeout",
";",
"timeout",
"=",
"null",
";",
"}",
"timeout",
"=",
"timeout",
"||",
"600",
";",
"var",
"self",
"=",
... | Delays the next command a set timeout.
@param {Number} [timeout]
@param {Function} [callback] | [
"Delays",
"the",
"next",
"command",
"a",
"set",
"timeout",
"."
] | 47773ffe85627d7486496e5999082b01b4add222 | https://github.com/testem/testem/blob/47773ffe85627d7486496e5999082b01b4add222/examples/template_stealjs/funcunit/syn/dist/syn.js#L681-L695 | |
17,623 | testem/testem | examples/template_stealjs/funcunit/syn/dist/syn.js | function( keyCode ) {
var specials = S.key.kinds.special;
for ( var i = 0; i < specials.length; i++ ) {
if ( Syn.keycodes[specials[i]] == keyCode ) {
return specials[i];
}
}
} | javascript | function( keyCode ) {
var specials = S.key.kinds.special;
for ( var i = 0; i < specials.length; i++ ) {
if ( Syn.keycodes[specials[i]] == keyCode ) {
return specials[i];
}
}
} | [
"function",
"(",
"keyCode",
")",
"{",
"var",
"specials",
"=",
"S",
".",
"key",
".",
"kinds",
".",
"special",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"specials",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"Syn",
".",
"ke... | returns the special key if special | [
"returns",
"the",
"special",
"key",
"if",
"special"
] | 47773ffe85627d7486496e5999082b01b4add222 | https://github.com/testem/testem/blob/47773ffe85627d7486496e5999082b01b4add222/examples/template_stealjs/funcunit/syn/dist/syn.js#L1576-L1583 | |
17,624 | testem/testem | examples/template_stealjs/funcunit/syn/dist/syn.js | function( key ) {
//check if it is described directly
if ( Syn.key.defaults[key] ) {
return Syn.key.defaults[key];
}
for ( var kind in Syn.key.kinds ) {
if ( h.inArray(key, Syn.key.kinds[kind]) > -1 && Syn.key.defaults[kind] ) {
return Syn.key.defaults[kind];
}
}
return Syn.key.defaul... | javascript | function( key ) {
//check if it is described directly
if ( Syn.key.defaults[key] ) {
return Syn.key.defaults[key];
}
for ( var kind in Syn.key.kinds ) {
if ( h.inArray(key, Syn.key.kinds[kind]) > -1 && Syn.key.defaults[kind] ) {
return Syn.key.defaults[kind];
}
}
return Syn.key.defaul... | [
"function",
"(",
"key",
")",
"{",
"//check if it is described directly",
"if",
"(",
"Syn",
".",
"key",
".",
"defaults",
"[",
"key",
"]",
")",
"{",
"return",
"Syn",
".",
"key",
".",
"defaults",
"[",
"key",
"]",
";",
"}",
"for",
"(",
"var",
"kind",
"in... | returns the default function | [
"returns",
"the",
"default",
"function"
] | 47773ffe85627d7486496e5999082b01b4add222 | https://github.com/testem/testem/blob/47773ffe85627d7486496e5999082b01b4add222/examples/template_stealjs/funcunit/syn/dist/syn.js#L1627-L1638 | |
17,625 | testem/testem | examples/template_stealjs/funcunit/syn/dist/syn.js | function( type, options, element ) { //Everyone Else
var doc = h.getWindow(element).document || document;
if ( doc.createEvent ) {
var event;
try {
event = doc.createEvent("KeyEvents");
event.initKeyEvent(type, true, true, window, options.ctrlKey, options.altKey, options.shiftKey, option... | javascript | function( type, options, element ) { //Everyone Else
var doc = h.getWindow(element).document || document;
if ( doc.createEvent ) {
var event;
try {
event = doc.createEvent("KeyEvents");
event.initKeyEvent(type, true, true, window, options.ctrlKey, options.altKey, options.shiftKey, option... | [
"function",
"(",
"type",
",",
"options",
",",
"element",
")",
"{",
"//Everyone Else",
"var",
"doc",
"=",
"h",
".",
"getWindow",
"(",
"element",
")",
".",
"document",
"||",
"document",
";",
"if",
"(",
"doc",
".",
"createEvent",
")",
"{",
"var",
"event",... | creates a key event | [
"creates",
"a",
"key",
"event"
] | 47773ffe85627d7486496e5999082b01b4add222 | https://github.com/testem/testem/blob/47773ffe85627d7486496e5999082b01b4add222/examples/template_stealjs/funcunit/syn/dist/syn.js#L1927-L1953 | |
17,626 | testem/testem | examples/template_stealjs/funcunit/syn/dist/syn.js | function( runDefaults, el ) {
var part = parts.shift();
if (!part ) {
callback(runDefaults, el);
return;
}
el = el || element;
if ( part.length > 1 ) {
part = part.substr(1, part.length - 2)
}
self._key(part, el, runNextPart)
} | javascript | function( runDefaults, el ) {
var part = parts.shift();
if (!part ) {
callback(runDefaults, el);
return;
}
el = el || element;
if ( part.length > 1 ) {
part = part.substr(1, part.length - 2)
}
self._key(part, el, runNextPart)
} | [
"function",
"(",
"runDefaults",
",",
"el",
")",
"{",
"var",
"part",
"=",
"parts",
".",
"shift",
"(",
")",
";",
"if",
"(",
"!",
"part",
")",
"{",
"callback",
"(",
"runDefaults",
",",
"el",
")",
";",
"return",
";",
"}",
"el",
"=",
"el",
"||",
"el... | break it up into parts ... go through each type and run | [
"break",
"it",
"up",
"into",
"parts",
"...",
"go",
"through",
"each",
"type",
"and",
"run"
] | 47773ffe85627d7486496e5999082b01b4add222 | https://github.com/testem/testem/blob/47773ffe85627d7486496e5999082b01b4add222/examples/template_stealjs/funcunit/syn/dist/syn.js#L2076-L2087 | |
17,627 | testem/testem | lib/browser_launcher.js | getAvailableBrowsers | function getAvailableBrowsers(config, browsers, cb) {
browsers.forEach(function(b) {
b.protocol = 'browser';
});
return Bluebird.filter(browsers, function(browser) {
return isInstalled(browser, config).then(function(result) {
if (!result) {
return false;
}
browser.exe = result;... | javascript | function getAvailableBrowsers(config, browsers, cb) {
browsers.forEach(function(b) {
b.protocol = 'browser';
});
return Bluebird.filter(browsers, function(browser) {
return isInstalled(browser, config).then(function(result) {
if (!result) {
return false;
}
browser.exe = result;... | [
"function",
"getAvailableBrowsers",
"(",
"config",
",",
"browsers",
",",
"cb",
")",
"{",
"browsers",
".",
"forEach",
"(",
"function",
"(",
"b",
")",
"{",
"b",
".",
"protocol",
"=",
"'browser'",
";",
"}",
")",
";",
"return",
"Bluebird",
".",
"filter",
"... | Returns the available browsers on the current machine. | [
"Returns",
"the",
"available",
"browsers",
"on",
"the",
"current",
"machine",
"."
] | 47773ffe85627d7486496e5999082b01b4add222 | https://github.com/testem/testem/blob/47773ffe85627d7486496e5999082b01b4add222/lib/browser_launcher.js#L22-L37 |
17,628 | testem/testem | examples/template_stealjs/funcunit/browser/actions.js | function( direction, amount, success ) {
this._addExists();
var selector = this.selector,
context = this.context,
direction;
if (direction == "left" || direction == "right") {
direction = "Left";
} else if (direction == "top" || direction == "bottom") {
direction = "Top";
}
FuncUnit.a... | javascript | function( direction, amount, success ) {
this._addExists();
var selector = this.selector,
context = this.context,
direction;
if (direction == "left" || direction == "right") {
direction = "Left";
} else if (direction == "top" || direction == "bottom") {
direction = "Top";
}
FuncUnit.a... | [
"function",
"(",
"direction",
",",
"amount",
",",
"success",
")",
"{",
"this",
".",
"_addExists",
"(",
")",
";",
"var",
"selector",
"=",
"this",
".",
"selector",
",",
"context",
"=",
"this",
".",
"context",
",",
"direction",
";",
"if",
"(",
"direction"... | Scrolls an element in a particular direction by setting the scrollTop or srollLeft.
@param {String} direction "left" or "top"
@param {Number} amount number of pixels to scroll
@param {Function} success | [
"Scrolls",
"an",
"element",
"in",
"a",
"particular",
"direction",
"by",
"setting",
"the",
"scrollTop",
"or",
"srollLeft",
"."
] | 47773ffe85627d7486496e5999082b01b4add222 | https://github.com/testem/testem/blob/47773ffe85627d7486496e5999082b01b4add222/examples/template_stealjs/funcunit/browser/actions.js#L277-L301 | |
17,629 | testem/testem | examples/template_stealjs/funcunit/syn/demo/record.js | function( target ) {
var selector = target.nodeName.toLowerCase();
if(target.id){
return "#"+target.id
}else{
var parent = target.parentNode;
while(parent){
if(parent.id){
selector = "#"+parent.id+" "+selector;
break;
}else{
parent = parent.parentNode
}
... | javascript | function( target ) {
var selector = target.nodeName.toLowerCase();
if(target.id){
return "#"+target.id
}else{
var parent = target.parentNode;
while(parent){
if(parent.id){
selector = "#"+parent.id+" "+selector;
break;
}else{
parent = parent.parentNode
}
... | [
"function",
"(",
"target",
")",
"{",
"var",
"selector",
"=",
"target",
".",
"nodeName",
".",
"toLowerCase",
"(",
")",
";",
"if",
"(",
"target",
".",
"id",
")",
"{",
"return",
"\"#\"",
"+",
"target",
".",
"id",
"}",
"else",
"{",
"var",
"parent",
"="... | returns a selector | [
"returns",
"a",
"selector"
] | 47773ffe85627d7486496e5999082b01b4add222 | https://github.com/testem/testem/blob/47773ffe85627d7486496e5999082b01b4add222/examples/template_stealjs/funcunit/syn/demo/record.js#L132-L158 | |
17,630 | testem/testem | examples/template_stealjs/funcunit/browser/waits.js | function( timeout, success, message ) {
var logMessage = "Waiting for '"+this.selector+"' to exist";
if(timeout === false){ // pass false to suppress this wait (make it not print any logMessage)
logMessage = false
}
return this.size({
condition: function(size){
return size > 0;
},
timeout: timeo... | javascript | function( timeout, success, message ) {
var logMessage = "Waiting for '"+this.selector+"' to exist";
if(timeout === false){ // pass false to suppress this wait (make it not print any logMessage)
logMessage = false
}
return this.size({
condition: function(size){
return size > 0;
},
timeout: timeo... | [
"function",
"(",
"timeout",
",",
"success",
",",
"message",
")",
"{",
"var",
"logMessage",
"=",
"\"Waiting for '\"",
"+",
"this",
".",
"selector",
"+",
"\"' to exist\"",
";",
"if",
"(",
"timeout",
"===",
"false",
")",
"{",
"// pass false to suppress this wait (m... | Waits until an element exists before running the next action.
@codestart
//waits until #foo exists before clicking it.
S("#foo").exists().click()
@codeend
@param {Number} [timeout] overrides FuncUnit.timeout. If provided, the wait will fail if not completed before this timeout.
@param {Function} [success] a success th... | [
"Waits",
"until",
"an",
"element",
"exists",
"before",
"running",
"the",
"next",
"action",
"."
] | 47773ffe85627d7486496e5999082b01b4add222 | https://github.com/testem/testem/blob/47773ffe85627d7486496e5999082b01b4add222/examples/template_stealjs/funcunit/browser/waits.js#L162-L177 | |
17,631 | testem/testem | examples/template_stealjs/funcunit/browser/waits.js | function( timeout, success, message ) {
var self = this,
sel = this.selector,
ret;
return this.size(function(size){
return this.is(":visible") === true;
}, timeout, success, message)
} | javascript | function( timeout, success, message ) {
var self = this,
sel = this.selector,
ret;
return this.size(function(size){
return this.is(":visible") === true;
}, timeout, success, message)
} | [
"function",
"(",
"timeout",
",",
"success",
",",
"message",
")",
"{",
"var",
"self",
"=",
"this",
",",
"sel",
"=",
"this",
".",
"selector",
",",
"ret",
";",
"return",
"this",
".",
"size",
"(",
"function",
"(",
"size",
")",
"{",
"return",
"this",
".... | Waits until the funcUnit selector is visible.
@codestart
//waits until #foo is visible.
S("#foo").visible()
@codeend
@param {Number} [timeout] overrides FuncUnit.timeout. If provided, the wait will fail if not completed before this timeout.
@param {Function} [success] a callback that runs after the funcUnit is visible... | [
"Waits",
"until",
"the",
"funcUnit",
"selector",
"is",
"visible",
"."
] | 47773ffe85627d7486496e5999082b01b4add222 | https://github.com/testem/testem/blob/47773ffe85627d7486496e5999082b01b4add222/examples/template_stealjs/funcunit/browser/waits.js#L204-L211 | |
17,632 | testem/testem | examples/template_stealjs/funcunit/browser/open.js | function(){
var loaded = FuncUnit.win.document.readyState === "complete" &&
FuncUnit.win.location.href != "about:blank" &&
FuncUnit.win.document.body;
return loaded;
} | javascript | function(){
var loaded = FuncUnit.win.document.readyState === "complete" &&
FuncUnit.win.location.href != "about:blank" &&
FuncUnit.win.document.body;
return loaded;
} | [
"function",
"(",
")",
"{",
"var",
"loaded",
"=",
"FuncUnit",
".",
"win",
".",
"document",
".",
"readyState",
"===",
"\"complete\"",
"&&",
"FuncUnit",
".",
"win",
".",
"location",
".",
"href",
"!=",
"\"about:blank\"",
"&&",
"FuncUnit",
".",
"win",
".",
"d... | return true if document is currently loaded, false if its loading actions check this | [
"return",
"true",
"if",
"document",
"is",
"currently",
"loaded",
"false",
"if",
"its",
"loading",
"actions",
"check",
"this"
] | 47773ffe85627d7486496e5999082b01b4add222 | https://github.com/testem/testem/blob/47773ffe85627d7486496e5999082b01b4add222/examples/template_stealjs/funcunit/browser/open.js#L249-L254 | |
17,633 | testem/testem | examples/template_stealjs/steal/dev/dev.js | function( out ) {
if(steal.options.logLevel < 2){
Array.prototype.unshift.call(arguments, 'steal.js WARN:');
if ( window.console && console.warn ) {
this._logger( "warn", Array.prototype.slice.call(arguments) );
} else if ( window.console && console.log ) {
this._logger( "log", Array.prototype.slice.... | javascript | function( out ) {
if(steal.options.logLevel < 2){
Array.prototype.unshift.call(arguments, 'steal.js WARN:');
if ( window.console && console.warn ) {
this._logger( "warn", Array.prototype.slice.call(arguments) );
} else if ( window.console && console.log ) {
this._logger( "log", Array.prototype.slice.... | [
"function",
"(",
"out",
")",
"{",
"if",
"(",
"steal",
".",
"options",
".",
"logLevel",
"<",
"2",
")",
"{",
"Array",
".",
"prototype",
".",
"unshift",
".",
"call",
"(",
"arguments",
",",
"'steal.js WARN:'",
")",
";",
"if",
"(",
"window",
".",
"console... | Adds a warning message to the console.
@codestart
steal.dev.warn("something evil");
@codeend
@param {String} out the message | [
"Adds",
"a",
"warning",
"message",
"to",
"the",
"console",
"."
] | 47773ffe85627d7486496e5999082b01b4add222 | https://github.com/testem/testem/blob/47773ffe85627d7486496e5999082b01b4add222/examples/template_stealjs/steal/dev/dev.js#L52-L64 | |
17,634 | testem/testem | lib/utils/process.js | kill | function kill(p, sig) {
if (isWin) {
let command = 'taskkill.exe';
let args = ['/t', '/pid', p.pid];
if (sig === 'SIGKILL') {
args.push('/f');
}
execa(command, args).then(result => {
// Processes without windows can't be killed without /F, detect and force
// kill them directly
... | javascript | function kill(p, sig) {
if (isWin) {
let command = 'taskkill.exe';
let args = ['/t', '/pid', p.pid];
if (sig === 'SIGKILL') {
args.push('/f');
}
execa(command, args).then(result => {
// Processes without windows can't be killed without /F, detect and force
// kill them directly
... | [
"function",
"kill",
"(",
"p",
",",
"sig",
")",
"{",
"if",
"(",
"isWin",
")",
"{",
"let",
"command",
"=",
"'taskkill.exe'",
";",
"let",
"args",
"=",
"[",
"'/t'",
",",
"'/pid'",
",",
"p",
".",
"pid",
"]",
";",
"if",
"(",
"sig",
"===",
"'SIGKILL'",
... | Kill process and all child processes cross platform | [
"Kill",
"process",
"and",
"all",
"child",
"processes",
"cross",
"platform"
] | 47773ffe85627d7486496e5999082b01b4add222 | https://github.com/testem/testem/blob/47773ffe85627d7486496e5999082b01b4add222/lib/utils/process.js#L119-L139 |
17,635 | testem/testem | examples/template_stealjs/funcunit/syn/resources/jquery.event.drag.js | function( f ) {
var i, vec, newArr = [];
for ( i = 0; i < this.array.length; i++ ) {
newArr.push(f(this.array[i]));
}
vec = new $.Vector();
return vec.update(newArr);
} | javascript | function( f ) {
var i, vec, newArr = [];
for ( i = 0; i < this.array.length; i++ ) {
newArr.push(f(this.array[i]));
}
vec = new $.Vector();
return vec.update(newArr);
} | [
"function",
"(",
"f",
")",
"{",
"var",
"i",
",",
"vec",
",",
"newArr",
"=",
"[",
"]",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"this",
".",
"array",
".",
"length",
";",
"i",
"++",
")",
"{",
"newArr",
".",
"push",
"(",
"f",
"(",
"thi... | Applys the function to every item in the vector. Returns the new vector.
@param {Function} f
@return {jQuery.Vector} new vector class. | [
"Applys",
"the",
"function",
"to",
"every",
"item",
"in",
"the",
"vector",
".",
"Returns",
"the",
"new",
"vector",
"."
] | 47773ffe85627d7486496e5999082b01b4add222 | https://github.com/testem/testem/blob/47773ffe85627d7486496e5999082b01b4add222/examples/template_stealjs/funcunit/syn/resources/jquery.event.drag.js#L28-L36 | |
17,636 | testem/testem | examples/template_stealjs/funcunit/syn/resources/jquery.event.drag.js | function() {
var i, args = arguments[0] instanceof $.Vector ? arguments[0].array : $.makeArray(arguments),
arr = this.array.slice(0),
vec = new $.Vector();
for ( i = 0; i < args.length; i++ ) {
if ( arr[i] != args[i] ) {
return null;
}
}
return vec.update(arr);
} | javascript | function() {
var i, args = arguments[0] instanceof $.Vector ? arguments[0].array : $.makeArray(arguments),
arr = this.array.slice(0),
vec = new $.Vector();
for ( i = 0; i < args.length; i++ ) {
if ( arr[i] != args[i] ) {
return null;
}
}
return vec.update(arr);
} | [
"function",
"(",
")",
"{",
"var",
"i",
",",
"args",
"=",
"arguments",
"[",
"0",
"]",
"instanceof",
"$",
".",
"Vector",
"?",
"arguments",
"[",
"0",
"]",
".",
"array",
":",
"$",
".",
"makeArray",
"(",
"arguments",
")",
",",
"arr",
"=",
"this",
".",... | Returns the current vector if it is equal to the vector passed in.
False if otherwise.
@return {jQuery.Vector} | [
"Returns",
"the",
"current",
"vector",
"if",
"it",
"is",
"equal",
"to",
"the",
"vector",
"passed",
"in",
".",
"False",
"if",
"otherwise",
"."
] | 47773ffe85627d7486496e5999082b01b4add222 | https://github.com/testem/testem/blob/47773ffe85627d7486496e5999082b01b4add222/examples/template_stealjs/funcunit/syn/resources/jquery.event.drag.js#L72-L82 | |
17,637 | testem/testem | examples/template_stealjs/funcunit/syn/resources/jquery.event.drag.js | function( array ) {
var i;
if ( this.array ) {
for ( i = 0; i < this.array.length; i++ ) {
delete this.array[i];
}
}
this.array = array;
for ( i = 0; i < array.length; i++ ) {
this[i] = this.array[i];
}
return this;
} | javascript | function( array ) {
var i;
if ( this.array ) {
for ( i = 0; i < this.array.length; i++ ) {
delete this.array[i];
}
}
this.array = array;
for ( i = 0; i < array.length; i++ ) {
this[i] = this.array[i];
}
return this;
} | [
"function",
"(",
"array",
")",
"{",
"var",
"i",
";",
"if",
"(",
"this",
".",
"array",
")",
"{",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"this",
".",
"array",
".",
"length",
";",
"i",
"++",
")",
"{",
"delete",
"this",
".",
"array",
"[",
"i... | Replaces the vectors contents
@param {Object} array | [
"Replaces",
"the",
"vectors",
"contents"
] | 47773ffe85627d7486496e5999082b01b4add222 | https://github.com/testem/testem/blob/47773ffe85627d7486496e5999082b01b4add222/examples/template_stealjs/funcunit/syn/resources/jquery.event.drag.js#L116-L128 | |
17,638 | testem/testem | examples/template_stealjs/funcunit/syn/resources/jquery.event.drag.js | function( ev, element ) {
var isLeftButton = ev.button === 0 || ev.button == 1;
if (!isLeftButton || this.current ) {
return;
} //only allows 1 drag at a time, but in future could allow more
//ev.preventDefault();
//create Drag
var drag = new $.Drag(),
delegate = ev.liveFired || element,
s... | javascript | function( ev, element ) {
var isLeftButton = ev.button === 0 || ev.button == 1;
if (!isLeftButton || this.current ) {
return;
} //only allows 1 drag at a time, but in future could allow more
//ev.preventDefault();
//create Drag
var drag = new $.Drag(),
delegate = ev.liveFired || element,
s... | [
"function",
"(",
"ev",
",",
"element",
")",
"{",
"var",
"isLeftButton",
"=",
"ev",
".",
"button",
"===",
"0",
"||",
"ev",
".",
"button",
"==",
"1",
";",
"if",
"(",
"!",
"isLeftButton",
"||",
"this",
".",
"current",
")",
"{",
"return",
";",
"}",
"... | Called when someone mouses down on a draggable object.
Gathers all callback functions and creates a new Draggable.
@hide | [
"Called",
"when",
"someone",
"mouses",
"down",
"on",
"a",
"draggable",
"object",
".",
"Gathers",
"all",
"callback",
"functions",
"and",
"creates",
"a",
"new",
"Draggable",
"."
] | 47773ffe85627d7486496e5999082b01b4add222 | https://github.com/testem/testem/blob/47773ffe85627d7486496e5999082b01b4add222/examples/template_stealjs/funcunit/syn/resources/jquery.event.drag.js#L412-L442 | |
17,639 | testem/testem | examples/template_stealjs/funcunit/syn/resources/jquery.event.drag.js | function() {
$(document).unbind('mousemove', this._mousemove);
$(document).unbind('mouseup', this._mouseup);
if (!this.moved ) {
this.event = this.element = null;
}
//this.selection();
this.destroyed();
} | javascript | function() {
$(document).unbind('mousemove', this._mousemove);
$(document).unbind('mouseup', this._mouseup);
if (!this.moved ) {
this.event = this.element = null;
}
//this.selection();
this.destroyed();
} | [
"function",
"(",
")",
"{",
"$",
"(",
"document",
")",
".",
"unbind",
"(",
"'mousemove'",
",",
"this",
".",
"_mousemove",
")",
";",
"$",
"(",
"document",
")",
".",
"unbind",
"(",
"'mouseup'",
",",
"this",
".",
"_mouseup",
")",
";",
"if",
"(",
"!",
... | Unbinds listeners and allows other drags ...
@hide | [
"Unbinds",
"listeners",
"and",
"allows",
"other",
"drags",
"..."
] | 47773ffe85627d7486496e5999082b01b4add222 | https://github.com/testem/testem/blob/47773ffe85627d7486496e5999082b01b4add222/examples/template_stealjs/funcunit/syn/resources/jquery.event.drag.js#L475-L483 | |
17,640 | testem/testem | examples/template_stealjs/funcunit/syn/resources/jquery.event.drag.js | function( pointer, event ) {
// only drag if we haven't been cancelled;
if ( this._cancelled ) {
return;
}
/**
* @attribute location
* The location of where the element should be in the page. This
* takes into account the start position of the cursor on the element.
*/
this.location... | javascript | function( pointer, event ) {
// only drag if we haven't been cancelled;
if ( this._cancelled ) {
return;
}
/**
* @attribute location
* The location of where the element should be in the page. This
* takes into account the start position of the cursor on the element.
*/
this.location... | [
"function",
"(",
"pointer",
",",
"event",
")",
"{",
"// only drag if we haven't been cancelled;",
"if",
"(",
"this",
".",
"_cancelled",
")",
"{",
"return",
";",
"}",
"/**\n\t\t\t * @attribute location\n\t\t\t * The location of where the element should be in the page. This \n\t\t... | draws the position of the dragmove object | [
"draws",
"the",
"position",
"of",
"the",
"dragmove",
"object"
] | 47773ffe85627d7486496e5999082b01b4add222 | https://github.com/testem/testem/blob/47773ffe85627d7486496e5999082b01b4add222/examples/template_stealjs/funcunit/syn/resources/jquery.event.drag.js#L577-L601 | |
17,641 | testem/testem | examples/template_stealjs/funcunit/syn/resources/jquery.event.drag.js | function( newOffsetv ) { //should draw it on the page
var style, dragged_element_css_offset = this.currentDelta(),
// the drag element's current left + top css attributes
dragged_element_position_vector = // the vector between the movingElement's page and css positions
this.movingElement.offsetv().minus... | javascript | function( newOffsetv ) { //should draw it on the page
var style, dragged_element_css_offset = this.currentDelta(),
// the drag element's current left + top css attributes
dragged_element_position_vector = // the vector between the movingElement's page and css positions
this.movingElement.offsetv().minus... | [
"function",
"(",
"newOffsetv",
")",
"{",
"//should draw it on the page",
"var",
"style",
",",
"dragged_element_css_offset",
"=",
"this",
".",
"currentDelta",
"(",
")",
",",
"// the drag element's current left + top css attributes",
"dragged_element_position_vector",
"=",
"//... | Sets the position of this drag.
The limit and scroll plugins
overwrite this to make sure the drag follows a particular path.
@param {jQuery.Vector} newOffsetv the position of the element (not the mouse) | [
"Sets",
"the",
"position",
"of",
"this",
"drag",
"."
] | 47773ffe85627d7486496e5999082b01b4add222 | https://github.com/testem/testem/blob/47773ffe85627d7486496e5999082b01b4add222/examples/template_stealjs/funcunit/syn/resources/jquery.event.drag.js#L610-L626 | |
17,642 | testem/testem | examples/template_stealjs/funcunit/syn/resources/jquery.event.drag.js | function( event ) {
if ( this._cancelled ) {
return;
}
if (!this._only && this.constructor.responder ) {
this.constructor.responder.end(event, this);
}
this.callEvents('end', this.element, event);
if ( this._revert ) {
var self = this;
this.movingElement.animate({
top: this.star... | javascript | function( event ) {
if ( this._cancelled ) {
return;
}
if (!this._only && this.constructor.responder ) {
this.constructor.responder.end(event, this);
}
this.callEvents('end', this.element, event);
if ( this._revert ) {
var self = this;
this.movingElement.animate({
top: this.star... | [
"function",
"(",
"event",
")",
"{",
"if",
"(",
"this",
".",
"_cancelled",
")",
"{",
"return",
";",
"}",
"if",
"(",
"!",
"this",
".",
"_only",
"&&",
"this",
".",
"constructor",
".",
"responder",
")",
"{",
"this",
".",
"constructor",
".",
"responder",
... | Called on drag up
@hide
@param {Event} event a mouseup event signalling drag/drop has completed | [
"Called",
"on",
"drag",
"up"
] | 47773ffe85627d7486496e5999082b01b4add222 | https://github.com/testem/testem/blob/47773ffe85627d7486496e5999082b01b4add222/examples/template_stealjs/funcunit/syn/resources/jquery.event.drag.js#L641-L664 | |
17,643 | testem/testem | examples/template_stealjs/funcunit/syn/resources/jquery.event.drag.js | function() {
this.movingElement.css({
zIndex: this.oldZIndex
});
if ( this.movingElement[0] !== this.element[0] ) {
this.movingElement.css({
display: 'none'
});
}
if ( this._removeMovingElement ) {
this.movingElement.remove();
}
this.movingElement = this.element = this.event =... | javascript | function() {
this.movingElement.css({
zIndex: this.oldZIndex
});
if ( this.movingElement[0] !== this.element[0] ) {
this.movingElement.css({
display: 'none'
});
}
if ( this._removeMovingElement ) {
this.movingElement.remove();
}
this.movingElement = this.element = this.event =... | [
"function",
"(",
")",
"{",
"this",
".",
"movingElement",
".",
"css",
"(",
"{",
"zIndex",
":",
"this",
".",
"oldZIndex",
"}",
")",
";",
"if",
"(",
"this",
".",
"movingElement",
"[",
"0",
"]",
"!==",
"this",
".",
"element",
"[",
"0",
"]",
")",
"{",... | Cleans up drag element after drag drop.
@hide | [
"Cleans",
"up",
"drag",
"element",
"after",
"drag",
"drop",
"."
] | 47773ffe85627d7486496e5999082b01b4add222 | https://github.com/testem/testem/blob/47773ffe85627d7486496e5999082b01b4add222/examples/template_stealjs/funcunit/syn/resources/jquery.event.drag.js#L669-L683 | |
17,644 | testem/testem | examples/template_stealjs/funcunit/syn/resources/jquery.event.drag.js | function() {
this._cancelled = true;
//this.end(this.event);
if (!this._only && this.constructor.responder ) {
this.constructor.responder.clear(this.event.vector(), this, this.event);
}
this.destroy();
} | javascript | function() {
this._cancelled = true;
//this.end(this.event);
if (!this._only && this.constructor.responder ) {
this.constructor.responder.clear(this.event.vector(), this, this.event);
}
this.destroy();
} | [
"function",
"(",
")",
"{",
"this",
".",
"_cancelled",
"=",
"true",
";",
"//this.end(this.event);",
"if",
"(",
"!",
"this",
".",
"_only",
"&&",
"this",
".",
"constructor",
".",
"responder",
")",
"{",
"this",
".",
"constructor",
".",
"responder",
".",
"cle... | Stops drag drop from running. | [
"Stops",
"drag",
"drop",
"from",
"running",
"."
] | 47773ffe85627d7486496e5999082b01b4add222 | https://github.com/testem/testem/blob/47773ffe85627d7486496e5999082b01b4add222/examples/template_stealjs/funcunit/syn/resources/jquery.event.drag.js#L687-L695 | |
17,645 | testem/testem | examples/template_stealjs/funcunit/syn/resources/jquery.event.drag.js | function( loc ) {
// create a ghost by cloning the source element and attach the clone to the dom after the source element
var ghost = this.movingElement.clone().css('position', 'absolute');
(loc ? $(loc) : this.movingElement).after(ghost);
ghost.width(this.movingElement.width()).height(this.movingElement.h... | javascript | function( loc ) {
// create a ghost by cloning the source element and attach the clone to the dom after the source element
var ghost = this.movingElement.clone().css('position', 'absolute');
(loc ? $(loc) : this.movingElement).after(ghost);
ghost.width(this.movingElement.width()).height(this.movingElement.h... | [
"function",
"(",
"loc",
")",
"{",
"// create a ghost by cloning the source element and attach the clone to the dom after the source element",
"var",
"ghost",
"=",
"this",
".",
"movingElement",
".",
"clone",
"(",
")",
".",
"css",
"(",
"'position'",
",",
"'absolute'",
")",
... | Clones the element and uses it as the moving element.
@return {jQuery.fn} the ghost | [
"Clones",
"the",
"element",
"and",
"uses",
"it",
"as",
"the",
"moving",
"element",
"."
] | 47773ffe85627d7486496e5999082b01b4add222 | https://github.com/testem/testem/blob/47773ffe85627d7486496e5999082b01b4add222/examples/template_stealjs/funcunit/syn/resources/jquery.event.drag.js#L700-L710 | |
17,646 | testem/testem | examples/template_stealjs/funcunit/syn/resources/jquery.event.drag.js | function( element, offsetX, offsetY ) {
this._offsetX = offsetX || 0;
this._offsetY = offsetY || 0;
var p = this.mouseStartPosition;
this.movingElement = $(element);
this.movingElement.css({
top: (p.y() - this._offsetY) + "px",
left: (p.x() - this._offsetX) + "px",
display: 'block',
pos... | javascript | function( element, offsetX, offsetY ) {
this._offsetX = offsetX || 0;
this._offsetY = offsetY || 0;
var p = this.mouseStartPosition;
this.movingElement = $(element);
this.movingElement.css({
top: (p.y() - this._offsetY) + "px",
left: (p.x() - this._offsetX) + "px",
display: 'block',
pos... | [
"function",
"(",
"element",
",",
"offsetX",
",",
"offsetY",
")",
"{",
"this",
".",
"_offsetX",
"=",
"offsetX",
"||",
"0",
";",
"this",
".",
"_offsetY",
"=",
"offsetY",
"||",
"0",
";",
"var",
"p",
"=",
"this",
".",
"mouseStartPosition",
";",
"this",
"... | Use a representative element, instead of the movingElement.
@param {HTMLElement} element the element you want to actually drag
@param {Number} offsetX the x position where you want your mouse on the object
@param {Number} offsetY the y position where you want your mouse on the object | [
"Use",
"a",
"representative",
"element",
"instead",
"of",
"the",
"movingElement",
"."
] | 47773ffe85627d7486496e5999082b01b4add222 | https://github.com/testem/testem/blob/47773ffe85627d7486496e5999082b01b4add222/examples/template_stealjs/funcunit/syn/resources/jquery.event.drag.js#L717-L732 | |
17,647 | liamcurry/passport-steam | lib/passport-steam/strategy.js | getUserProfile | function getUserProfile(key, steamID, callback) {
var steam = new SteamWebAPI({ apiKey: key, format: 'json' });
steam.getPlayerSummaries({
steamids: [ steamID ],
callback: function(err, result) {
if(err) {
return callback(err);
}
var profile = {
provider: 'steam',
... | javascript | function getUserProfile(key, steamID, callback) {
var steam = new SteamWebAPI({ apiKey: key, format: 'json' });
steam.getPlayerSummaries({
steamids: [ steamID ],
callback: function(err, result) {
if(err) {
return callback(err);
}
var profile = {
provider: 'steam',
... | [
"function",
"getUserProfile",
"(",
"key",
",",
"steamID",
",",
"callback",
")",
"{",
"var",
"steam",
"=",
"new",
"SteamWebAPI",
"(",
"{",
"apiKey",
":",
"key",
",",
"format",
":",
"'json'",
"}",
")",
";",
"steam",
".",
"getPlayerSummaries",
"(",
"{",
"... | Retrieve user's Steam profile information.
@param {String} key Steam WebAPI key.
@param {String} steamID SteamID64.
@return {Object} User's Steam profile. | [
"Retrieve",
"user",
"s",
"Steam",
"profile",
"information",
"."
] | bf2c3cca044a7aa174182b51fede9f72f147012e | https://github.com/liamcurry/passport-steam/blob/bf2c3cca044a7aa174182b51fede9f72f147012e/lib/passport-steam/strategy.js#L15-L42 |
17,648 | liamcurry/passport-steam | lib/passport-steam/strategy.js | verify | function verify(req, identifier, profile, done) {
var validOpEndpoint = 'https://steamcommunity.com/openid/login';
var identifierRegex = /^https?:\/\/steamcommunity\.com\/openid\/id\/(\d+)$/;
if(req.query['openid.op_endpoint'] !== validOpEndpoint ||
!identifierRegex.test(identifier)) {
return ... | javascript | function verify(req, identifier, profile, done) {
var validOpEndpoint = 'https://steamcommunity.com/openid/login';
var identifierRegex = /^https?:\/\/steamcommunity\.com\/openid\/id\/(\d+)$/;
if(req.query['openid.op_endpoint'] !== validOpEndpoint ||
!identifierRegex.test(identifier)) {
return ... | [
"function",
"verify",
"(",
"req",
",",
"identifier",
",",
"profile",
",",
"done",
")",
"{",
"var",
"validOpEndpoint",
"=",
"'https://steamcommunity.com/openid/login'",
";",
"var",
"identifierRegex",
"=",
"/",
"^https?:\\/\\/steamcommunity\\.com\\/openid\\/id\\/(\\d+)$",
"... | Request needs to be verified | [
"Request",
"needs",
"to",
"be",
"verified"
] | bf2c3cca044a7aa174182b51fede9f72f147012e | https://github.com/liamcurry/passport-steam/blob/bf2c3cca044a7aa174182b51fede9f72f147012e/lib/passport-steam/strategy.js#L86-L116 |
17,649 | springernature/shunter | bin/serve.js | addLatency | function addLatency(request, response, next) {
if (request.path === '/') {
return next();
}
setTimeout(next, args.latency);
} | javascript | function addLatency(request, response, next) {
if (request.path === '/') {
return next();
}
setTimeout(next, args.latency);
} | [
"function",
"addLatency",
"(",
"request",
",",
"response",
",",
"next",
")",
"{",
"if",
"(",
"request",
".",
"path",
"===",
"'/'",
")",
"{",
"return",
"next",
"(",
")",
";",
"}",
"setTimeout",
"(",
"next",
",",
"args",
".",
"latency",
")",
";",
"}"... | Middleware to add latency to a response | [
"Middleware",
"to",
"add",
"latency",
"to",
"a",
"response"
] | 45f6c46a6db83f652dbd4ba0bd945d490f80c2e9 | https://github.com/springernature/shunter/blob/45f6c46a6db83f652dbd4ba0bd945d490f80c2e9/bin/serve.js#L95-L100 |
17,650 | springernature/shunter | bin/serve.js | serveRemoteJson | function serveRemoteJson(request, response, next) {
if (request.path !== '/remote') {
return next();
}
var options = {
url: request.query.url,
headers: request.query.headers
};
var error;
if (!options.url || typeof options.url !== 'string') {
error = new Error('Invalid query parameter: url');
error.sta... | javascript | function serveRemoteJson(request, response, next) {
if (request.path !== '/remote') {
return next();
}
var options = {
url: request.query.url,
headers: request.query.headers
};
var error;
if (!options.url || typeof options.url !== 'string') {
error = new Error('Invalid query parameter: url');
error.sta... | [
"function",
"serveRemoteJson",
"(",
"request",
",",
"response",
",",
"next",
")",
"{",
"if",
"(",
"request",
".",
"path",
"!==",
"'/remote'",
")",
"{",
"return",
"next",
"(",
")",
";",
"}",
"var",
"options",
"=",
"{",
"url",
":",
"request",
".",
"que... | Middleware to serve remote JSON | [
"Middleware",
"to",
"serve",
"remote",
"JSON"
] | 45f6c46a6db83f652dbd4ba0bd945d490f80c2e9 | https://github.com/springernature/shunter/blob/45f6c46a6db83f652dbd4ba0bd945d490f80c2e9/bin/serve.js#L103-L136 |
17,651 | springernature/shunter | bin/serve.js | loadRemoteJson | function loadRemoteJson(options, done) {
var requestOptions = {
url: options.url,
headers: options.headers
};
var error;
request(requestOptions, function (err, response, body) {
if (err) {
return done(error);
}
if (response.statusCode < 200 || response.statusCode >= 300) {
error = new Error('Remote... | javascript | function loadRemoteJson(options, done) {
var requestOptions = {
url: options.url,
headers: options.headers
};
var error;
request(requestOptions, function (err, response, body) {
if (err) {
return done(error);
}
if (response.statusCode < 200 || response.statusCode >= 300) {
error = new Error('Remote... | [
"function",
"loadRemoteJson",
"(",
"options",
",",
"done",
")",
"{",
"var",
"requestOptions",
"=",
"{",
"url",
":",
"options",
".",
"url",
",",
"headers",
":",
"options",
".",
"headers",
"}",
";",
"var",
"error",
";",
"request",
"(",
"requestOptions",
",... | Load remote JSON | [
"Load",
"remote",
"JSON"
] | 45f6c46a6db83f652dbd4ba0bd945d490f80c2e9 | https://github.com/springernature/shunter/blob/45f6c46a6db83f652dbd4ba0bd945d490f80c2e9/bin/serve.js#L139-L162 |
17,652 | springernature/shunter | bin/serve.js | parseHeaders | function parseHeaders(headerString) {
var headers = {};
var headersArray = headerString.split(/[\r\n]+/);
headersArray.forEach(function (headerString) {
var headerChunks = headerString.split(':');
headers[headerChunks.shift().trim()] = headerChunks.join(':').trim();
});
return headers;
} | javascript | function parseHeaders(headerString) {
var headers = {};
var headersArray = headerString.split(/[\r\n]+/);
headersArray.forEach(function (headerString) {
var headerChunks = headerString.split(':');
headers[headerChunks.shift().trim()] = headerChunks.join(':').trim();
});
return headers;
} | [
"function",
"parseHeaders",
"(",
"headerString",
")",
"{",
"var",
"headers",
"=",
"{",
"}",
";",
"var",
"headersArray",
"=",
"headerString",
".",
"split",
"(",
"/",
"[\\r\\n]+",
"/",
")",
";",
"headersArray",
".",
"forEach",
"(",
"function",
"(",
"headerSt... | Parse a HTTP header string | [
"Parse",
"a",
"HTTP",
"header",
"string"
] | 45f6c46a6db83f652dbd4ba0bd945d490f80c2e9 | https://github.com/springernature/shunter/blob/45f6c46a6db83f652dbd4ba0bd945d490f80c2e9/bin/serve.js#L165-L173 |
17,653 | springernature/shunter | bin/compile.js | function (p, cb) {
var pth = p.replace(/\\\?/g, '\/'); // Glob must use / as path seperator even on windows
glob(pth + '/**/*.*', function (er, files) {
if (er) {
return cb(er);
}
return cb(null, files.map(function (f) {
return path.relative(p, f);
}));
});
} | javascript | function (p, cb) {
var pth = p.replace(/\\\?/g, '\/'); // Glob must use / as path seperator even on windows
glob(pth + '/**/*.*', function (er, files) {
if (er) {
return cb(er);
}
return cb(null, files.map(function (f) {
return path.relative(p, f);
}));
});
} | [
"function",
"(",
"p",
",",
"cb",
")",
"{",
"var",
"pth",
"=",
"p",
".",
"replace",
"(",
"/",
"\\\\\\?",
"/",
"g",
",",
"'\\/'",
")",
";",
"// Glob must use / as path seperator even on windows",
"glob",
"(",
"pth",
"+",
"'/**/*.*'",
",",
"function",
"(",
... | Glob returns absolute path and we need to strip that out | [
"Glob",
"returns",
"absolute",
"path",
"and",
"we",
"need",
"to",
"strip",
"that",
"out"
] | 45f6c46a6db83f652dbd4ba0bd945d490f80c2e9 | https://github.com/springernature/shunter/blob/45f6c46a6db83f652dbd4ba0bd945d490f80c2e9/bin/compile.js#L138-L148 | |
17,654 | springernature/shunter | lib/renderer.js | function (name) {
var isProduction = config.env.isProduction();
var asset = (isProduction) ? manifest.assets[name] : environment.findAsset(name);
if (!asset) {
return '';
}
var mountPath = config.argv && (config.argv['mount-path'] || '');
return (
isProduction ?
path.join(mountPath, config.web.pu... | javascript | function (name) {
var isProduction = config.env.isProduction();
var asset = (isProduction) ? manifest.assets[name] : environment.findAsset(name);
if (!asset) {
return '';
}
var mountPath = config.argv && (config.argv['mount-path'] || '');
return (
isProduction ?
path.join(mountPath, config.web.pu... | [
"function",
"(",
"name",
")",
"{",
"var",
"isProduction",
"=",
"config",
".",
"env",
".",
"isProduction",
"(",
")",
";",
"var",
"asset",
"=",
"(",
"isProduction",
")",
"?",
"manifest",
".",
"assets",
"[",
"name",
"]",
":",
"environment",
".",
"findAsse... | Host app can be shunter-based app or manifest, so rely on root | [
"Host",
"app",
"can",
"be",
"shunter",
"-",
"based",
"app",
"or",
"manifest",
"so",
"rely",
"on",
"root"
] | 45f6c46a6db83f652dbd4ba0bd945d490f80c2e9 | https://github.com/springernature/shunter/blob/45f6c46a6db83f652dbd4ba0bd945d490f80c2e9/lib/renderer.js#L50-L63 | |
17,655 | springernature/shunter | lib/renderer.js | function (paths) {
var self = this;
if (typeof paths === 'string') {
paths = [].slice.call(arguments, 0);
}
paths.forEach(function (name) {
// DEPRECATED: checking both themes and templates folders for the right template file
// when updated, should just look for 'self.compileFile(name));'
/... | javascript | function (paths) {
var self = this;
if (typeof paths === 'string') {
paths = [].slice.call(arguments, 0);
}
paths.forEach(function (name) {
// DEPRECATED: checking both themes and templates folders for the right template file
// when updated, should just look for 'self.compileFile(name));'
/... | [
"function",
"(",
"paths",
")",
"{",
"var",
"self",
"=",
"this",
";",
"if",
"(",
"typeof",
"paths",
"===",
"'string'",
")",
"{",
"paths",
"=",
"[",
"]",
".",
"slice",
".",
"call",
"(",
"arguments",
",",
"0",
")",
";",
"}",
"paths",
".",
"forEach",... | Just used for testing? | [
"Just",
"used",
"for",
"testing?"
] | 45f6c46a6db83f652dbd4ba0bd945d490f80c2e9 | https://github.com/springernature/shunter/blob/45f6c46a6db83f652dbd4ba0bd945d490f80c2e9/lib/renderer.js#L154-L178 | |
17,656 | webex/spark-js-sdk | deps.js | findPackages | function findPackages(packagesPath) {
return fs.readdirSync(packagesPath).reduce((acc, d) => {
const fullpath = path.resolve(packagesPath, d);
if (fs.statSync(fullpath).isDirectory()) {
try {
fs.statSync(path.resolve(fullpath, 'package.json'));
acc.push(fullpath);
}
catch (e... | javascript | function findPackages(packagesPath) {
return fs.readdirSync(packagesPath).reduce((acc, d) => {
const fullpath = path.resolve(packagesPath, d);
if (fs.statSync(fullpath).isDirectory()) {
try {
fs.statSync(path.resolve(fullpath, 'package.json'));
acc.push(fullpath);
}
catch (e... | [
"function",
"findPackages",
"(",
"packagesPath",
")",
"{",
"return",
"fs",
".",
"readdirSync",
"(",
"packagesPath",
")",
".",
"reduce",
"(",
"(",
"acc",
",",
"d",
")",
"=>",
"{",
"const",
"fullpath",
"=",
"path",
".",
"resolve",
"(",
"packagesPath",
",",... | Locates all packages below the specified directory
@param {string} packagesPath
@returns {Array<string>} | [
"Locates",
"all",
"packages",
"below",
"the",
"specified",
"directory"
] | e700847f3430da36140eafe8c51376076f249894 | https://github.com/webex/spark-js-sdk/blob/e700847f3430da36140eafe8c51376076f249894/deps.js#L264-L283 |
17,657 | webex/spark-js-sdk | deps.js | updateAllPackages | function updateAllPackages(rootPkgPath, packagesPath) {
const paths = findPackages(packagesPath);
return paths.reduce((promise, pkgPath) => promise.then(() => updateSinglePackage(rootPkgPath, pkgPath)), Promise.resolve());
} | javascript | function updateAllPackages(rootPkgPath, packagesPath) {
const paths = findPackages(packagesPath);
return paths.reduce((promise, pkgPath) => promise.then(() => updateSinglePackage(rootPkgPath, pkgPath)), Promise.resolve());
} | [
"function",
"updateAllPackages",
"(",
"rootPkgPath",
",",
"packagesPath",
")",
"{",
"const",
"paths",
"=",
"findPackages",
"(",
"packagesPath",
")",
";",
"return",
"paths",
".",
"reduce",
"(",
"(",
"promise",
",",
"pkgPath",
")",
"=>",
"promise",
".",
"then"... | Transforms all packages
@param {string} rootPkgPath
@param {string} packagesPath
@returns {Promise} | [
"Transforms",
"all",
"packages"
] | e700847f3430da36140eafe8c51376076f249894 | https://github.com/webex/spark-js-sdk/blob/e700847f3430da36140eafe8c51376076f249894/deps.js#L291-L295 |
17,658 | webex/spark-js-sdk | tooling/lib/version.js | checkLastCommit | async function checkLastCommit() {
debug('checking if the last commit message has explicit release instructions');
const summary = await git.lastLog();
const re = /^#release v(\d+\.\d+\.\d+)/;
const match = summary.match(re);
if (match) {
const version = match[1];
if (version) {
return version... | javascript | async function checkLastCommit() {
debug('checking if the last commit message has explicit release instructions');
const summary = await git.lastLog();
const re = /^#release v(\d+\.\d+\.\d+)/;
const match = summary.match(re);
if (match) {
const version = match[1];
if (version) {
return version... | [
"async",
"function",
"checkLastCommit",
"(",
")",
"{",
"debug",
"(",
"'checking if the last commit message has explicit release instructions'",
")",
";",
"const",
"summary",
"=",
"await",
"git",
".",
"lastLog",
"(",
")",
";",
"const",
"re",
"=",
"/",
"^#release v(\\... | Determines if the last commit specified an explicit version to set
@returns {Promise<string>} | [
"Determines",
"if",
"the",
"last",
"commit",
"specified",
"an",
"explicit",
"version",
"to",
"set"
] | e700847f3430da36140eafe8c51376076f249894 | https://github.com/webex/spark-js-sdk/blob/e700847f3430da36140eafe8c51376076f249894/tooling/lib/version.js#L171-L186 |
17,659 | webex/spark-js-sdk | tooling/lib/version.js | getChangeType | async function getChangeType() {
const subjects = await exec('git log upstream/master.. --format=%s');
for (const subject of subjects.split('\n')) {
if (subject.startsWith('feat')) {
return 'minor';
}
if (subject.startsWith('fix') || subject.startsWith('perf') || subject.startsWith('refactor')) ... | javascript | async function getChangeType() {
const subjects = await exec('git log upstream/master.. --format=%s');
for (const subject of subjects.split('\n')) {
if (subject.startsWith('feat')) {
return 'minor';
}
if (subject.startsWith('fix') || subject.startsWith('perf') || subject.startsWith('refactor')) ... | [
"async",
"function",
"getChangeType",
"(",
")",
"{",
"const",
"subjects",
"=",
"await",
"exec",
"(",
"'git log upstream/master.. --format=%s'",
")",
";",
"for",
"(",
"const",
"subject",
"of",
"subjects",
".",
"split",
"(",
"'\\n'",
")",
")",
"{",
"if",
"(",
... | Checks commit messages to determine change type
@returns {Promise<boolean>} | [
"Checks",
"commit",
"messages",
"to",
"determine",
"change",
"type"
] | e700847f3430da36140eafe8c51376076f249894 | https://github.com/webex/spark-js-sdk/blob/e700847f3430da36140eafe8c51376076f249894/tooling/lib/version.js#L210-L224 |
17,660 | webex/spark-js-sdk | tooling/lib/updated.js | fileToPackage | function fileToPackage(d) {
debug(d);
if (d.startsWith('packages/node_modules/')) {
d = d.replace('packages/node_modules/', '');
d = d.split('/');
if (d[0].startsWith('@')) {
return d.slice(0, 2).join('/');
}
return d[0];
}
if (d.startsWith('docs') || d.startsWith('documentation') ||... | javascript | function fileToPackage(d) {
debug(d);
if (d.startsWith('packages/node_modules/')) {
d = d.replace('packages/node_modules/', '');
d = d.split('/');
if (d[0].startsWith('@')) {
return d.slice(0, 2).join('/');
}
return d[0];
}
if (d.startsWith('docs') || d.startsWith('documentation') ||... | [
"function",
"fileToPackage",
"(",
"d",
")",
"{",
"debug",
"(",
"d",
")",
";",
"if",
"(",
"d",
".",
"startsWith",
"(",
"'packages/node_modules/'",
")",
")",
"{",
"d",
"=",
"d",
".",
"replace",
"(",
"'packages/node_modules/'",
",",
"''",
")",
";",
"d",
... | Determines the package to which a given file belongs. Includes the meta
packages "docs" and "tooling"
@param {string} d
@private
@returns {string} | [
"Determines",
"the",
"package",
"to",
"which",
"a",
"given",
"file",
"belongs",
".",
"Includes",
"the",
"meta",
"packages",
"docs",
"and",
"tooling"
] | e700847f3430da36140eafe8c51376076f249894 | https://github.com/webex/spark-js-sdk/blob/e700847f3430da36140eafe8c51376076f249894/tooling/lib/updated.js#L49-L66 |
17,661 | webex/spark-js-sdk | tooling/util/package.js | read | async function read(packageName) {
const packagePath = path.join(cwd, packageName, 'package.json');
return JSON.parse(await fs.readFile(packagePath));
} | javascript | async function read(packageName) {
const packagePath = path.join(cwd, packageName, 'package.json');
return JSON.parse(await fs.readFile(packagePath));
} | [
"async",
"function",
"read",
"(",
"packageName",
")",
"{",
"const",
"packagePath",
"=",
"path",
".",
"join",
"(",
"cwd",
",",
"packageName",
",",
"'package.json'",
")",
";",
"return",
"JSON",
".",
"parse",
"(",
"await",
"fs",
".",
"readFile",
"(",
"packa... | Reads a package.json into an object
@param {string} packageName
@returns {Promise<Object>} | [
"Reads",
"a",
"package",
".",
"json",
"into",
"an",
"object"
] | e700847f3430da36140eafe8c51376076f249894 | https://github.com/webex/spark-js-sdk/blob/e700847f3430da36140eafe8c51376076f249894/tooling/util/package.js#L30-L34 |
17,662 | webex/spark-js-sdk | tooling/util/package.js | write | async function write(packageName, pkg) {
const packagePath = path.join(cwd, packageName, 'package.json');
await fs.writeFile(packagePath, `${JSON.stringify(pkg, null, 2)}\n`);
} | javascript | async function write(packageName, pkg) {
const packagePath = path.join(cwd, packageName, 'package.json');
await fs.writeFile(packagePath, `${JSON.stringify(pkg, null, 2)}\n`);
} | [
"async",
"function",
"write",
"(",
"packageName",
",",
"pkg",
")",
"{",
"const",
"packagePath",
"=",
"path",
".",
"join",
"(",
"cwd",
",",
"packageName",
",",
"'package.json'",
")",
";",
"await",
"fs",
".",
"writeFile",
"(",
"packagePath",
",",
"`",
"${"... | Writes an object to a package.json
@param {string} packageName
@param {Object} pkg | [
"Writes",
"an",
"object",
"to",
"a",
"package",
".",
"json"
] | e700847f3430da36140eafe8c51376076f249894 | https://github.com/webex/spark-js-sdk/blob/e700847f3430da36140eafe8c51376076f249894/tooling/util/package.js#L43-L47 |
17,663 | webex/spark-js-sdk | tooling/lib/openh264.js | encode | function encode(fp) {
return new Promise((resolve, reject) => {
fp.encode((err, encoded) => {
if (err) {
reject(err);
return;
}
resolve(encoded);
});
});
} | javascript | function encode(fp) {
return new Promise((resolve, reject) => {
fp.encode((err, encoded) => {
if (err) {
reject(err);
return;
}
resolve(encoded);
});
});
} | [
"function",
"encode",
"(",
"fp",
")",
"{",
"return",
"new",
"Promise",
"(",
"(",
"resolve",
",",
"reject",
")",
"=>",
"{",
"fp",
".",
"encode",
"(",
"(",
"err",
",",
"encoded",
")",
"=>",
"{",
"if",
"(",
"err",
")",
"{",
"reject",
"(",
"err",
"... | denodeifies FirefoxProfile.encode
@param {FirefoxProfile} fp
@returns {Promise<string>} | [
"denodeifies",
"FirefoxProfile",
".",
"encode"
] | e700847f3430da36140eafe8c51376076f249894 | https://github.com/webex/spark-js-sdk/blob/e700847f3430da36140eafe8c51376076f249894/tooling/lib/openh264.js#L23-L34 |
17,664 | webex/spark-js-sdk | tooling/lib/openh264.js | injectLocal | async function injectLocal(def) {
debug(`checking ${def.base} for firefox`);
if (def.base.toLowerCase().includes('firefox')) {
debug('def is a firefox def');
const platform = platformToShortName(os.platform());
debug(`injecting ${platform} profile into ${def.base}`);
const dest = await prepareLocal... | javascript | async function injectLocal(def) {
debug(`checking ${def.base} for firefox`);
if (def.base.toLowerCase().includes('firefox')) {
debug('def is a firefox def');
const platform = platformToShortName(os.platform());
debug(`injecting ${platform} profile into ${def.base}`);
const dest = await prepareLocal... | [
"async",
"function",
"injectLocal",
"(",
"def",
")",
"{",
"debug",
"(",
"`",
"${",
"def",
".",
"base",
"}",
"`",
")",
";",
"if",
"(",
"def",
".",
"base",
".",
"toLowerCase",
"(",
")",
".",
"includes",
"(",
"'firefox'",
")",
")",
"{",
"debug",
"("... | Injects a the path of a firefox profile directory into a local browser definition
@param {Object} def | [
"Injects",
"a",
"the",
"path",
"of",
"a",
"firefox",
"profile",
"directory",
"into",
"a",
"local",
"browser",
"definition"
] | e700847f3430da36140eafe8c51376076f249894 | https://github.com/webex/spark-js-sdk/blob/e700847f3430da36140eafe8c51376076f249894/tooling/lib/openh264.js#L114-L126 |
17,665 | webex/spark-js-sdk | tooling/lib/openh264.js | injectSauce | async function injectSauce(def) {
debug(`checking ${def.base} for firefox`);
if (def.browserName.toLowerCase().includes('firefox')) {
debug('def is a firefox def');
const platform = platformToShortName(def.platform);
if (platform !== 'mac') {
throw new Error(`No tooling implemented for injecting ... | javascript | async function injectSauce(def) {
debug(`checking ${def.base} for firefox`);
if (def.browserName.toLowerCase().includes('firefox')) {
debug('def is a firefox def');
const platform = platformToShortName(def.platform);
if (platform !== 'mac') {
throw new Error(`No tooling implemented for injecting ... | [
"async",
"function",
"injectSauce",
"(",
"def",
")",
"{",
"debug",
"(",
"`",
"${",
"def",
".",
"base",
"}",
"`",
")",
";",
"if",
"(",
"def",
".",
"browserName",
".",
"toLowerCase",
"(",
")",
".",
"includes",
"(",
"'firefox'",
")",
")",
"{",
"debug"... | Injects a gzipped, base64-encoded firefox profile directory into a Sauce Labs
browser definition
@param {Object} def | [
"Injects",
"a",
"gzipped",
"base64",
"-",
"encoded",
"firefox",
"profile",
"directory",
"into",
"a",
"Sauce",
"Labs",
"browser",
"definition"
] | e700847f3430da36140eafe8c51376076f249894 | https://github.com/webex/spark-js-sdk/blob/e700847f3430da36140eafe8c51376076f249894/tooling/lib/openh264.js#L154-L175 |
17,666 | webex/spark-js-sdk | tooling/karma.js | watchSauce | async function watchSauce(server, cfg) {
try {
debug('reading sauce pid');
const pid = parseInt(await readFile(process.env.SC_PID_FILE), 10);
debug(`sauce pid is ${pid}`);
let done = false;
server.once('run_complete', () => {
debug('run complete');
done = true;
... | javascript | async function watchSauce(server, cfg) {
try {
debug('reading sauce pid');
const pid = parseInt(await readFile(process.env.SC_PID_FILE), 10);
debug(`sauce pid is ${pid}`);
let done = false;
server.once('run_complete', () => {
debug('run complete');
done = true;
... | [
"async",
"function",
"watchSauce",
"(",
"server",
",",
"cfg",
")",
"{",
"try",
"{",
"debug",
"(",
"'reading sauce pid'",
")",
";",
"const",
"pid",
"=",
"parseInt",
"(",
"await",
"readFile",
"(",
"process",
".",
"env",
".",
"SC_PID_FILE",
")",
",",
"10",
... | Periodically checks that the sauce process is still running and kills the
test suite if it is not
@param {Object} server
@param {Object} cfg | [
"Periodically",
"checks",
"that",
"the",
"sauce",
"process",
"is",
"still",
"running",
"and",
"kills",
"the",
"test",
"suite",
"if",
"it",
"is",
"not"
] | e700847f3430da36140eafe8c51376076f249894 | https://github.com/webex/spark-js-sdk/blob/e700847f3430da36140eafe8c51376076f249894/tooling/karma.js#L19-L77 |
17,667 | webex/spark-js-sdk | tooling/util/server.js | start | async function start() {
if (child) {
await stop();
}
return new Promise((resolve) => {
const serverPath = path.resolve(process.cwd(), 'packages/node_modules/@webex/test-helper-server');
child = spawn(process.argv[0], [serverPath], {
env: process.env,
stdio: ['ignore', 'pipe', process.st... | javascript | async function start() {
if (child) {
await stop();
}
return new Promise((resolve) => {
const serverPath = path.resolve(process.cwd(), 'packages/node_modules/@webex/test-helper-server');
child = spawn(process.argv[0], [serverPath], {
env: process.env,
stdio: ['ignore', 'pipe', process.st... | [
"async",
"function",
"start",
"(",
")",
"{",
"if",
"(",
"child",
")",
"{",
"await",
"stop",
"(",
")",
";",
"}",
"return",
"new",
"Promise",
"(",
"(",
"resolve",
")",
"=>",
"{",
"const",
"serverPath",
"=",
"path",
".",
"resolve",
"(",
"process",
"."... | Starts the test server
@returns {Promise} | [
"Starts",
"the",
"test",
"server"
] | e700847f3430da36140eafe8c51376076f249894 | https://github.com/webex/spark-js-sdk/blob/e700847f3430da36140eafe8c51376076f249894/tooling/util/server.js#L15-L39 |
17,668 | webex/spark-js-sdk | tooling/util/server.js | stop | function stop() {
return new Promise((resolve) => {
if (child && child.kill) {
debug('stopping test server');
child.kill('SIGTERM');
process.removeListener('exit', stop);
child = null;
debug('stopped test server');
}
resolve();
});
} | javascript | function stop() {
return new Promise((resolve) => {
if (child && child.kill) {
debug('stopping test server');
child.kill('SIGTERM');
process.removeListener('exit', stop);
child = null;
debug('stopped test server');
}
resolve();
});
} | [
"function",
"stop",
"(",
")",
"{",
"return",
"new",
"Promise",
"(",
"(",
"resolve",
")",
"=>",
"{",
"if",
"(",
"child",
"&&",
"child",
".",
"kill",
")",
"{",
"debug",
"(",
"'stopping test server'",
")",
";",
"child",
".",
"kill",
"(",
"'SIGTERM'",
")... | Stops the test server
@returns {Promise} | [
"Stops",
"the",
"test",
"server"
] | e700847f3430da36140eafe8c51376076f249894 | https://github.com/webex/spark-js-sdk/blob/e700847f3430da36140eafe8c51376076f249894/tooling/util/server.js#L45-L57 |
17,669 | webex/spark-js-sdk | tooling/babel-plugin-inject-package-version.js | versionFromState | function versionFromState(state) {
// eslint-disable-next-line global-require
return require(pkgUp.sync(state.file.opts.filename)).version;
} | javascript | function versionFromState(state) {
// eslint-disable-next-line global-require
return require(pkgUp.sync(state.file.opts.filename)).version;
} | [
"function",
"versionFromState",
"(",
"state",
")",
"{",
"// eslint-disable-next-line global-require",
"return",
"require",
"(",
"pkgUp",
".",
"sync",
"(",
"state",
".",
"file",
".",
"opts",
".",
"filename",
")",
")",
".",
"version",
";",
"}"
] | Uses pkgUp to find the appropriate package.json for the specified babel state
object
@param {Object} state
@private
@returns {string} | [
"Uses",
"pkgUp",
"to",
"find",
"the",
"appropriate",
"package",
".",
"json",
"for",
"the",
"specified",
"babel",
"state",
"object"
] | e700847f3430da36140eafe8c51376076f249894 | https://github.com/webex/spark-js-sdk/blob/e700847f3430da36140eafe8c51376076f249894/tooling/babel-plugin-inject-package-version.js#L15-L18 |
17,670 | webex/spark-js-sdk | tooling/lib/dependencies.js | buildLocalDepTree | async function buildLocalDepTree() {
for (const packageName of await _list()) {
tree.set(packageName, await exports.list(packageName, {
includeTransitive: false,
localOnly: true
}));
}
} | javascript | async function buildLocalDepTree() {
for (const packageName of await _list()) {
tree.set(packageName, await exports.list(packageName, {
includeTransitive: false,
localOnly: true
}));
}
} | [
"async",
"function",
"buildLocalDepTree",
"(",
")",
"{",
"for",
"(",
"const",
"packageName",
"of",
"await",
"_list",
"(",
")",
")",
"{",
"tree",
".",
"set",
"(",
"packageName",
",",
"await",
"exports",
".",
"list",
"(",
"packageName",
",",
"{",
"includeT... | Walks all packages to generate a tree of direct dependencies | [
"Walks",
"all",
"packages",
"to",
"generate",
"a",
"tree",
"of",
"direct",
"dependencies"
] | e700847f3430da36140eafe8c51376076f249894 | https://github.com/webex/spark-js-sdk/blob/e700847f3430da36140eafe8c51376076f249894/tooling/lib/dependencies.js#L52-L59 |
17,671 | webex/spark-js-sdk | tooling/lib/dependencies.js | buildDirectDependentTree | async function buildDirectDependentTree() {
const dependents = new Map();
for (const packageName of await _list()) {
dependents.set(packageName, new Set());
}
for (const packageName of await _list()) {
for (const dep of tree.get(packageName)) {
dependents.get(dep).add(packageName);
}
}
... | javascript | async function buildDirectDependentTree() {
const dependents = new Map();
for (const packageName of await _list()) {
dependents.set(packageName, new Set());
}
for (const packageName of await _list()) {
for (const dep of tree.get(packageName)) {
dependents.get(dep).add(packageName);
}
}
... | [
"async",
"function",
"buildDirectDependentTree",
"(",
")",
"{",
"const",
"dependents",
"=",
"new",
"Map",
"(",
")",
";",
"for",
"(",
"const",
"packageName",
"of",
"await",
"_list",
"(",
")",
")",
"{",
"dependents",
".",
"set",
"(",
"packageName",
",",
"n... | Builds a tree of direct dependent packages
@returns {Map<string, Set>} | [
"Builds",
"a",
"tree",
"of",
"direct",
"dependent",
"packages"
] | e700847f3430da36140eafe8c51376076f249894 | https://github.com/webex/spark-js-sdk/blob/e700847f3430da36140eafe8c51376076f249894/tooling/lib/dependencies.js#L96-L110 |
17,672 | webex/spark-js-sdk | tooling/lib/dependencies.js | findDeps | function findDeps(entrypoints) {
let deps = new Set();
for (const entrypoint of entrypoints) {
deps = new Set([...deps, ...walk(entrypoint)]);
}
return deps;
} | javascript | function findDeps(entrypoints) {
let deps = new Set();
for (const entrypoint of entrypoints) {
deps = new Set([...deps, ...walk(entrypoint)]);
}
return deps;
} | [
"function",
"findDeps",
"(",
"entrypoints",
")",
"{",
"let",
"deps",
"=",
"new",
"Set",
"(",
")",
";",
"for",
"(",
"const",
"entrypoint",
"of",
"entrypoints",
")",
"{",
"deps",
"=",
"new",
"Set",
"(",
"[",
"...",
"deps",
",",
"...",
"walk",
"(",
"e... | Finds all the dependencies for a given set of entrypoints
@param {Array<string>} entrypoints
@returns {Array<string>} | [
"Finds",
"all",
"the",
"dependencies",
"for",
"a",
"given",
"set",
"of",
"entrypoints"
] | e700847f3430da36140eafe8c51376076f249894 | https://github.com/webex/spark-js-sdk/blob/e700847f3430da36140eafe8c51376076f249894/tooling/lib/dependencies.js#L146-L154 |
17,673 | webex/spark-js-sdk | tooling/lib/dependencies.js | requireToPackage | function requireToPackage(d) {
d = d.split('/');
if (d[0].startsWith('@')) {
return d.slice(0, 2).join('/');
}
return d[0];
} | javascript | function requireToPackage(d) {
d = d.split('/');
if (d[0].startsWith('@')) {
return d.slice(0, 2).join('/');
}
return d[0];
} | [
"function",
"requireToPackage",
"(",
"d",
")",
"{",
"d",
"=",
"d",
".",
"split",
"(",
"'/'",
")",
";",
"if",
"(",
"d",
"[",
"0",
"]",
".",
"startsWith",
"(",
"'@'",
")",
")",
"{",
"return",
"d",
".",
"slice",
"(",
"0",
",",
"2",
")",
".",
"... | Translates a required filename into a package name
@param {strig} d
@returns {string} | [
"Translates",
"a",
"required",
"filename",
"into",
"a",
"package",
"name"
] | e700847f3430da36140eafe8c51376076f249894 | https://github.com/webex/spark-js-sdk/blob/e700847f3430da36140eafe8c51376076f249894/tooling/lib/dependencies.js#L161-L168 |
17,674 | webex/spark-js-sdk | tooling/lib/dependencies.js | listEntryPoints | function listEntryPoints(pkg) {
debug(`listing entrypoints for ${pkg.name}`);
if (!pkg.name) {
throw new Error('cannot read dependencies for unnamed package');
}
let paths = [];
if (pkg.main) {
debug(`found main path for ${pkg.name}`);
paths.push(pkg.main);
}
if (pkg.bin) {
debug(`found ... | javascript | function listEntryPoints(pkg) {
debug(`listing entrypoints for ${pkg.name}`);
if (!pkg.name) {
throw new Error('cannot read dependencies for unnamed package');
}
let paths = [];
if (pkg.main) {
debug(`found main path for ${pkg.name}`);
paths.push(pkg.main);
}
if (pkg.bin) {
debug(`found ... | [
"function",
"listEntryPoints",
"(",
"pkg",
")",
"{",
"debug",
"(",
"`",
"${",
"pkg",
".",
"name",
"}",
"`",
")",
";",
"if",
"(",
"!",
"pkg",
".",
"name",
")",
"{",
"throw",
"new",
"Error",
"(",
"'cannot read dependencies for unnamed package'",
")",
";",
... | Finds all the entrypoints for the specified package
@param {Object} pkg
@returns {Array<string>} | [
"Finds",
"all",
"the",
"entrypoints",
"for",
"the",
"specified",
"package"
] | e700847f3430da36140eafe8c51376076f249894 | https://github.com/webex/spark-js-sdk/blob/e700847f3430da36140eafe8c51376076f249894/tooling/lib/dependencies.js#L175-L201 |
17,675 | webex/spark-js-sdk | tooling/lib/dependencies.js | walk | function walk(entrypoint) {
try {
if (!visited.has(entrypoint)) {
debug(`finding requires for ${entrypoint}`);
// This whole thing is *way* easier if we do it synchronously
// eslint-disable-next-line no-sync
const requires = detective(fs.readFileSync(entrypoint));
visited.set(entry... | javascript | function walk(entrypoint) {
try {
if (!visited.has(entrypoint)) {
debug(`finding requires for ${entrypoint}`);
// This whole thing is *way* easier if we do it synchronously
// eslint-disable-next-line no-sync
const requires = detective(fs.readFileSync(entrypoint));
visited.set(entry... | [
"function",
"walk",
"(",
"entrypoint",
")",
"{",
"try",
"{",
"if",
"(",
"!",
"visited",
".",
"has",
"(",
"entrypoint",
")",
")",
"{",
"debug",
"(",
"`",
"${",
"entrypoint",
"}",
"`",
")",
";",
"// This whole thing is *way* easier if we do it synchronously",
... | Finds all dependencies of entrypoint
@param {string} entrypoint
@returns {Set<string>} | [
"Finds",
"all",
"dependencies",
"of",
"entrypoint"
] | e700847f3430da36140eafe8c51376076f249894 | https://github.com/webex/spark-js-sdk/blob/e700847f3430da36140eafe8c51376076f249894/tooling/lib/dependencies.js#L210-L246 |
17,676 | webex/spark-js-sdk | tooling/util/proxies.js | startProxies | async function startProxies() {
await Promise.all(services.map((service) => setEnv(service)));
return Promise.all(services.map((service) => start(service)));
} | javascript | async function startProxies() {
await Promise.all(services.map((service) => setEnv(service)));
return Promise.all(services.map((service) => start(service)));
} | [
"async",
"function",
"startProxies",
"(",
")",
"{",
"await",
"Promise",
".",
"all",
"(",
"services",
".",
"map",
"(",
"(",
"service",
")",
"=>",
"setEnv",
"(",
"service",
")",
")",
")",
";",
"return",
"Promise",
".",
"all",
"(",
"services",
".",
"map... | Start yakbak proxy servers for each service
and return an array of those servers.
@returns {Promise} | [
"Start",
"yakbak",
"proxy",
"servers",
"for",
"each",
"service",
"and",
"return",
"an",
"array",
"of",
"those",
"servers",
"."
] | e700847f3430da36140eafe8c51376076f249894 | https://github.com/webex/spark-js-sdk/blob/e700847f3430da36140eafe8c51376076f249894/tooling/util/proxies.js#L55-L59 |
17,677 | webex/spark-js-sdk | tooling/util/proxies.js | stopProxies | async function stopProxies() {
if (proxies && proxies.length) {
return Promise.all(proxies.map((proxy) => stop(proxy)));
}
return Promise.resolve();
} | javascript | async function stopProxies() {
if (proxies && proxies.length) {
return Promise.all(proxies.map((proxy) => stop(proxy)));
}
return Promise.resolve();
} | [
"async",
"function",
"stopProxies",
"(",
")",
"{",
"if",
"(",
"proxies",
"&&",
"proxies",
".",
"length",
")",
"{",
"return",
"Promise",
".",
"all",
"(",
"proxies",
".",
"map",
"(",
"(",
"proxy",
")",
"=>",
"stop",
"(",
"proxy",
")",
")",
")",
";",
... | Stop each of the proxy servers
in the given array.
@param {Array} proxies
@returns {Promise} | [
"Stop",
"each",
"of",
"the",
"proxy",
"servers",
"in",
"the",
"given",
"array",
"."
] | e700847f3430da36140eafe8c51376076f249894 | https://github.com/webex/spark-js-sdk/blob/e700847f3430da36140eafe8c51376076f249894/tooling/util/proxies.js#L67-L73 |
17,678 | webex/spark-js-sdk | tooling/util/proxies.js | start | async function start(service) {
return new Promise((resolve) => {
const snapshotsDir = path.join(__dirname, '../../test/services/', service.name, 'snapshots');
const app = yakbak(service.defaultUrl, {
dirname: snapshotsDir,
hash: customHash
});
const proxy = http.createServer(app).listen(s... | javascript | async function start(service) {
return new Promise((resolve) => {
const snapshotsDir = path.join(__dirname, '../../test/services/', service.name, 'snapshots');
const app = yakbak(service.defaultUrl, {
dirname: snapshotsDir,
hash: customHash
});
const proxy = http.createServer(app).listen(s... | [
"async",
"function",
"start",
"(",
"service",
")",
"{",
"return",
"new",
"Promise",
"(",
"(",
"resolve",
")",
"=>",
"{",
"const",
"snapshotsDir",
"=",
"path",
".",
"join",
"(",
"__dirname",
",",
"'../../test/services/'",
",",
"service",
".",
"name",
",",
... | Starts a proxy server for the given service.
@param {Service} service
@returns {Promise|http.server} proxy server | [
"Starts",
"a",
"proxy",
"server",
"for",
"the",
"given",
"service",
"."
] | e700847f3430da36140eafe8c51376076f249894 | https://github.com/webex/spark-js-sdk/blob/e700847f3430da36140eafe8c51376076f249894/tooling/util/proxies.js#L93-L106 |
17,679 | webex/spark-js-sdk | tooling/util/proxies.js | customHash | function customHash(req, body) {
const hash = crypto.createHash('md5');
updateHash(hash, req);
hash.write(body);
return hash.digest('hex');
} | javascript | function customHash(req, body) {
const hash = crypto.createHash('md5');
updateHash(hash, req);
hash.write(body);
return hash.digest('hex');
} | [
"function",
"customHash",
"(",
"req",
",",
"body",
")",
"{",
"const",
"hash",
"=",
"crypto",
".",
"createHash",
"(",
"'md5'",
")",
";",
"updateHash",
"(",
"hash",
",",
"req",
")",
";",
"hash",
".",
"write",
"(",
"body",
")",
";",
"return",
"hash",
... | Creates a custom hash used as the snapshot's filename.
@param {http.ClientRequest} req
@param {Object} body
@returns {String} hashed filename | [
"Creates",
"a",
"custom",
"hash",
"used",
"as",
"the",
"snapshot",
"s",
"filename",
"."
] | e700847f3430da36140eafe8c51376076f249894 | https://github.com/webex/spark-js-sdk/blob/e700847f3430da36140eafe8c51376076f249894/tooling/util/proxies.js#L126-L133 |
17,680 | webex/spark-js-sdk | tooling/util/proxies.js | pruneHeaders | function pruneHeaders(requestHeaders) {
const headers = Object.assign({}, requestHeaders);
delete headers.trackingid;
delete headers.authorization;
return headers;
} | javascript | function pruneHeaders(requestHeaders) {
const headers = Object.assign({}, requestHeaders);
delete headers.trackingid;
delete headers.authorization;
return headers;
} | [
"function",
"pruneHeaders",
"(",
"requestHeaders",
")",
"{",
"const",
"headers",
"=",
"Object",
".",
"assign",
"(",
"{",
"}",
",",
"requestHeaders",
")",
";",
"delete",
"headers",
".",
"trackingid",
";",
"delete",
"headers",
".",
"authorization",
";",
"retur... | Remove headers that are unique for each request
from the given headers object. This ensures
that certain headers do not "bust" the hash.
@param {Object} requestHeaders
@returns {Object} a new, pruned headers object | [
"Remove",
"headers",
"that",
"are",
"unique",
"for",
"each",
"request",
"from",
"the",
"given",
"headers",
"object",
".",
"This",
"ensures",
"that",
"certain",
"headers",
"do",
"not",
"bust",
"the",
"hash",
"."
] | e700847f3430da36140eafe8c51376076f249894 | https://github.com/webex/spark-js-sdk/blob/e700847f3430da36140eafe8c51376076f249894/tooling/util/proxies.js#L160-L167 |
17,681 | nobitagit/react-material-floating-button | mfb/src/mfb.js | attachEvt | function attachEvt( elems, evt ){
for( var i = 0, len = elems.length; i < len; i++ ){
mainButton = elems[i].querySelector('.' + mainButtonClass);
mainButton.addEventListener( evt , toggleButton, false);
}
} | javascript | function attachEvt( elems, evt ){
for( var i = 0, len = elems.length; i < len; i++ ){
mainButton = elems[i].querySelector('.' + mainButtonClass);
mainButton.addEventListener( evt , toggleButton, false);
}
} | [
"function",
"attachEvt",
"(",
"elems",
",",
"evt",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"len",
"=",
"elems",
".",
"length",
";",
"i",
"<",
"len",
";",
"i",
"++",
")",
"{",
"mainButton",
"=",
"elems",
"[",
"i",
"]",
".",
"querySelect... | For every menu we need to get the main button and attach the appropriate evt. | [
"For",
"every",
"menu",
"we",
"need",
"to",
"get",
"the",
"main",
"button",
"and",
"attach",
"the",
"appropriate",
"evt",
"."
] | e735370b70f085b131b54244c9231fa63fe1e126 | https://github.com/nobitagit/react-material-floating-button/blob/e735370b70f085b131b54244c9231fa63fe1e126/mfb/src/mfb.js#L36-L41 |
17,682 | nobitagit/react-material-floating-button | mfb/src/mfb.js | replaceAttrs | function replaceAttrs( elems ){
for( var i = 0, len = elems.length; i < len; i++ ){
elems[i].setAttribute( toggleMethod, clickOpt );
elems[i].setAttribute( menuState, isClosed );
}
} | javascript | function replaceAttrs( elems ){
for( var i = 0, len = elems.length; i < len; i++ ){
elems[i].setAttribute( toggleMethod, clickOpt );
elems[i].setAttribute( menuState, isClosed );
}
} | [
"function",
"replaceAttrs",
"(",
"elems",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"len",
"=",
"elems",
".",
"length",
";",
"i",
"<",
"len",
";",
"i",
"++",
")",
"{",
"elems",
"[",
"i",
"]",
".",
"setAttribute",
"(",
"toggleMethod",
",",
... | Remove the hover option, set a click toggle and a default,
initial state of 'closed' to menu that's been targeted. | [
"Remove",
"the",
"hover",
"option",
"set",
"a",
"click",
"toggle",
"and",
"a",
"default",
"initial",
"state",
"of",
"closed",
"to",
"menu",
"that",
"s",
"been",
"targeted",
"."
] | e735370b70f085b131b54244c9231fa63fe1e126 | https://github.com/nobitagit/react-material-floating-button/blob/e735370b70f085b131b54244c9231fa63fe1e126/mfb/src/mfb.js#L47-L52 |
17,683 | GoogleChrome/omnitone | src/hoa-renderer.js | HOARenderer | function HOARenderer(context, config) {
this._context = Utils.isAudioContext(context) ?
context :
Utils.throw('HOARenderer: Invalid BaseAudioContext.');
this._config = {
ambisonicOrder: 3,
renderingMode: RenderingMode.AMBISONIC,
};
if (config && config.ambisonicOrder) {
if (SupportedAm... | javascript | function HOARenderer(context, config) {
this._context = Utils.isAudioContext(context) ?
context :
Utils.throw('HOARenderer: Invalid BaseAudioContext.');
this._config = {
ambisonicOrder: 3,
renderingMode: RenderingMode.AMBISONIC,
};
if (config && config.ambisonicOrder) {
if (SupportedAm... | [
"function",
"HOARenderer",
"(",
"context",
",",
"config",
")",
"{",
"this",
".",
"_context",
"=",
"Utils",
".",
"isAudioContext",
"(",
"context",
")",
"?",
"context",
":",
"Utils",
".",
"throw",
"(",
"'HOARenderer: Invalid BaseAudioContext.'",
")",
";",
"this"... | Omnitone HOA renderer class. Uses the optimized convolution technique.
@constructor
@param {AudioContext} context - Associated AudioContext.
@param {Object} config
@param {Number} [config.ambisonicOrder=3] - Ambisonic order.
@param {Array} [config.hrirPathList] - A list of paths to HRIR files. It
overrides the internal... | [
"Omnitone",
"HOA",
"renderer",
"class",
".",
"Uses",
"the",
"optimized",
"convolution",
"technique",
"."
] | 891f31ca630622ced5e2413f88d7899144e895f4 | https://github.com/GoogleChrome/omnitone/blob/891f31ca630622ced5e2413f88d7899144e895f4/src/hoa-renderer.js#L64-L114 |
17,684 | GoogleChrome/omnitone | src/foa-router.js | FOARouter | function FOARouter(context, channelMap) {
this._context = context;
this._splitter = this._context.createChannelSplitter(4);
this._merger = this._context.createChannelMerger(4);
// input/output proxy.
this.input = this._splitter;
this.output = this._merger;
this.setChannelMap(channelMap || ChannelMap.DE... | javascript | function FOARouter(context, channelMap) {
this._context = context;
this._splitter = this._context.createChannelSplitter(4);
this._merger = this._context.createChannelMerger(4);
// input/output proxy.
this.input = this._splitter;
this.output = this._merger;
this.setChannelMap(channelMap || ChannelMap.DE... | [
"function",
"FOARouter",
"(",
"context",
",",
"channelMap",
")",
"{",
"this",
".",
"_context",
"=",
"context",
";",
"this",
".",
"_splitter",
"=",
"this",
".",
"_context",
".",
"createChannelSplitter",
"(",
"4",
")",
";",
"this",
".",
"_merger",
"=",
"th... | Channel router for FOA stream.
@constructor
@param {AudioContext} context - Associated AudioContext.
@param {Number[]} channelMap - Routing destination array. | [
"Channel",
"router",
"for",
"FOA",
"stream",
"."
] | 891f31ca630622ced5e2413f88d7899144e895f4 | https://github.com/GoogleChrome/omnitone/blob/891f31ca630622ced5e2413f88d7899144e895f4/src/foa-router.js#L47-L58 |
17,685 | GoogleChrome/omnitone | src/hoa-rotator.js | computeHOAMatrices | function computeHOAMatrices(matrix) {
// We start by computing the 2nd-order matrix from the 1st-order matrix.
for (let i = 2; i <= matrix.length; i++) {
computeBandRotation(matrix, i);
}
} | javascript | function computeHOAMatrices(matrix) {
// We start by computing the 2nd-order matrix from the 1st-order matrix.
for (let i = 2; i <= matrix.length; i++) {
computeBandRotation(matrix, i);
}
} | [
"function",
"computeHOAMatrices",
"(",
"matrix",
")",
"{",
"// We start by computing the 2nd-order matrix from the 1st-order matrix.",
"for",
"(",
"let",
"i",
"=",
"2",
";",
"i",
"<=",
"matrix",
".",
"length",
";",
"i",
"++",
")",
"{",
"computeBandRotation",
"(",
... | Compute the HOA rotation matrix after setting the transform matrix.
@param {Array} matrix - N matrices of gainNodes, each with (2n+1) x (2n+1)
elements, where n=1,2,...,N. | [
"Compute",
"the",
"HOA",
"rotation",
"matrix",
"after",
"setting",
"the",
"transform",
"matrix",
"."
] | 891f31ca630622ced5e2413f88d7899144e895f4 | https://github.com/GoogleChrome/omnitone/blob/891f31ca630622ced5e2413f88d7899144e895f4/src/hoa-rotator.js#L244-L249 |
17,686 | sendgrid/nodejs-http-client | lib/client.js | buildPath | function buildPath (basePath, queryParams) {
basePath = basePath.concat('?')
var url = basePath.concat(queryString.stringify(queryParams))
return url
} | javascript | function buildPath (basePath, queryParams) {
basePath = basePath.concat('?')
var url = basePath.concat(queryString.stringify(queryParams))
return url
} | [
"function",
"buildPath",
"(",
"basePath",
",",
"queryParams",
")",
"{",
"basePath",
"=",
"basePath",
".",
"concat",
"(",
"'?'",
")",
"var",
"url",
"=",
"basePath",
".",
"concat",
"(",
"queryString",
".",
"stringify",
"(",
"queryParams",
")",
")",
"return",... | add query paramaters to a URL | [
"add",
"query",
"paramaters",
"to",
"a",
"URL"
] | 306db085db2818a442ad26a4396522970cc01855 | https://github.com/sendgrid/nodejs-http-client/blob/306db085db2818a442ad26a4396522970cc01855/lib/client.js#L58-L62 |
17,687 | monojack/graphql-normalizr | src/pluralize.js | restoreCase | function restoreCase (word, token) {
// Tokens are an exact match.
if (word === token) return token
// Upper cased words. E.g. "HELLO".
if (word === word.toUpperCase()) return token.toUpperCase()
// Title cased words. E.g. "Title".
if (word[0] === word[0].toUpperCase()) {
return token.charAt(0).toUppe... | javascript | function restoreCase (word, token) {
// Tokens are an exact match.
if (word === token) return token
// Upper cased words. E.g. "HELLO".
if (word === word.toUpperCase()) return token.toUpperCase()
// Title cased words. E.g. "Title".
if (word[0] === word[0].toUpperCase()) {
return token.charAt(0).toUppe... | [
"function",
"restoreCase",
"(",
"word",
",",
"token",
")",
"{",
"// Tokens are an exact match.",
"if",
"(",
"word",
"===",
"token",
")",
"return",
"token",
"// Upper cased words. E.g. \"HELLO\".",
"if",
"(",
"word",
"===",
"word",
".",
"toUpperCase",
"(",
")",
"... | Pass in a word token to produce a function that can replicate the case on
another word.
@param {string} word
@param {string} token
@return {Function} | [
"Pass",
"in",
"a",
"word",
"token",
"to",
"produce",
"a",
"function",
"that",
"can",
"replicate",
"the",
"case",
"on",
"another",
"word",
"."
] | 3c456de06978cd3bca97fcab4945bd95bcc53e6f | https://github.com/monojack/graphql-normalizr/blob/3c456de06978cd3bca97fcab4945bd95bcc53e6f/src/pluralize.js#L201-L215 |
17,688 | paypal/glamorous | src/get-glamor-classname.js | extractGlamorStyles | function extractGlamorStyles(className) {
const glamorlessClassName = []
const glamorStyles = []
className
.toString()
.split(' ')
.forEach(name => {
if (styleSheet.registered[name.substring(4)] === undefined) {
glamorlessClassName.push(name)
} else {
const style = buildGla... | javascript | function extractGlamorStyles(className) {
const glamorlessClassName = []
const glamorStyles = []
className
.toString()
.split(' ')
.forEach(name => {
if (styleSheet.registered[name.substring(4)] === undefined) {
glamorlessClassName.push(name)
} else {
const style = buildGla... | [
"function",
"extractGlamorStyles",
"(",
"className",
")",
"{",
"const",
"glamorlessClassName",
"=",
"[",
"]",
"const",
"glamorStyles",
"=",
"[",
"]",
"className",
".",
"toString",
"(",
")",
".",
"split",
"(",
"' '",
")",
".",
"forEach",
"(",
"name",
"=>",
... | This function takes a className string and gets all the
associated glamor styles. It's used to merge glamor styles
from a className to make sure that specificity is not
a problem when passing a className to a component.
@param {String} [className=''] the className string
@return {Object} { glamorStyles, glamorlessClass... | [
"This",
"function",
"takes",
"a",
"className",
"string",
"and",
"gets",
"all",
"the",
"associated",
"glamor",
"styles",
".",
"It",
"s",
"used",
"to",
"merge",
"glamor",
"styles",
"from",
"a",
"className",
"to",
"make",
"sure",
"that",
"specificity",
"is",
... | 031484cd5eff92ff135038200ba49a300859a335 | https://github.com/paypal/glamorous/blob/031484cd5eff92ff135038200ba49a300859a335/src/get-glamor-classname.js#L13-L29 |
17,689 | paypal/glamorous | src/get-glamor-classname.js | handleStyles | function handleStyles(styles, props, context) {
let current
const mappedArgs = []
const nonGlamorClassNames = []
for (let i = 0; i < styles.length; i++) {
current = styles[i]
while (typeof current === 'function') {
current = current(props, context)
}
if (typeof current === 'string') {
... | javascript | function handleStyles(styles, props, context) {
let current
const mappedArgs = []
const nonGlamorClassNames = []
for (let i = 0; i < styles.length; i++) {
current = styles[i]
while (typeof current === 'function') {
current = current(props, context)
}
if (typeof current === 'string') {
... | [
"function",
"handleStyles",
"(",
"styles",
",",
"props",
",",
"context",
")",
"{",
"let",
"current",
"const",
"mappedArgs",
"=",
"[",
"]",
"const",
"nonGlamorClassNames",
"=",
"[",
"]",
"for",
"(",
"let",
"i",
"=",
"0",
";",
"i",
"<",
"styles",
".",
... | this next function is on a "hot" code-path so it's pretty complex to make sure it's fast. eslint-disable-next-line complexity | [
"this",
"next",
"function",
"is",
"on",
"a",
"hot",
"code",
"-",
"path",
"so",
"it",
"s",
"pretty",
"complex",
"to",
"make",
"sure",
"it",
"s",
"fast",
".",
"eslint",
"-",
"disable",
"-",
"next",
"-",
"line",
"complexity"
] | 031484cd5eff92ff135038200ba49a300859a335 | https://github.com/paypal/glamorous/blob/031484cd5eff92ff135038200ba49a300859a335/src/get-glamor-classname.js#L73-L95 |
17,690 | paypal/glamorous | src/create-glamorous.js | getPropsToApply | function getPropsToApply(propsToApply, accumulator, props, context) {
// using forEach rather than reduce here because the reduce solution
// effectively did the same thing because we manipulate the `accumulator`
propsToApply.forEach(propsToApplyItem => {
if (typeof propsToApplyItem === 'function') {
re... | javascript | function getPropsToApply(propsToApply, accumulator, props, context) {
// using forEach rather than reduce here because the reduce solution
// effectively did the same thing because we manipulate the `accumulator`
propsToApply.forEach(propsToApplyItem => {
if (typeof propsToApplyItem === 'function') {
re... | [
"function",
"getPropsToApply",
"(",
"propsToApply",
",",
"accumulator",
",",
"props",
",",
"context",
")",
"{",
"// using forEach rather than reduce here because the reduce solution",
"// effectively did the same thing because we manipulate the `accumulator`",
"propsToApply",
".",
"f... | reduces the propsToApply given to a single props object
@param {Array} propsToApply an array of propsToApply objects:
- object
- array of propsToApply items
- function that accepts the accumulated props and the context
@param {Object} accumulator an object to apply props onto
@param {Object} props the props that should... | [
"reduces",
"the",
"propsToApply",
"given",
"to",
"a",
"single",
"props",
"object"
] | 031484cd5eff92ff135038200ba49a300859a335 | https://github.com/paypal/glamorous/blob/031484cd5eff92ff135038200ba49a300859a335/src/create-glamorous.js#L225-L244 |
17,691 | pbeshai/react-url-query | examples/redux-with-actions/src/MainPage.js | mapDispatchToProps | function mapDispatchToProps(dispatch) {
return {
onChangeArr: (arr) => dispatch(changeArr(arr)),
onChangeFoo: (foo) => dispatch(changeFoo(foo)),
onChangeBar: (bar) => dispatch(changeBar(bar)),
onChangeBaz: (baz) => dispatch(changeBaz(baz)),
onChangeMany: (foo) => dispatch(changeMany({ foo })),
}... | javascript | function mapDispatchToProps(dispatch) {
return {
onChangeArr: (arr) => dispatch(changeArr(arr)),
onChangeFoo: (foo) => dispatch(changeFoo(foo)),
onChangeBar: (bar) => dispatch(changeBar(bar)),
onChangeBaz: (baz) => dispatch(changeBaz(baz)),
onChangeMany: (foo) => dispatch(changeMany({ foo })),
}... | [
"function",
"mapDispatchToProps",
"(",
"dispatch",
")",
"{",
"return",
"{",
"onChangeArr",
":",
"(",
"arr",
")",
"=>",
"dispatch",
"(",
"changeArr",
"(",
"arr",
")",
")",
",",
"onChangeFoo",
":",
"(",
"foo",
")",
"=>",
"dispatch",
"(",
"changeFoo",
"(",
... | Standard react-redux mapDispatchToProps | [
"Standard",
"react",
"-",
"redux",
"mapDispatchToProps"
] | 14dde6c9e7f374cc92e13a4ed70a7462d250d073 | https://github.com/pbeshai/react-url-query/blob/14dde6c9e7f374cc92e13a4ed70a7462d250d073/examples/redux-with-actions/src/MainPage.js#L37-L45 |
17,692 | pbeshai/react-url-query | examples/basic-mapUrlToProps/src/MainPage.js | mapUrlToProps | function mapUrlToProps(url, props) {
return {
foo: decode(UrlQueryParamTypes.number, url.fooInUrl),
bar: url.bar,
};
} | javascript | function mapUrlToProps(url, props) {
return {
foo: decode(UrlQueryParamTypes.number, url.fooInUrl),
bar: url.bar,
};
} | [
"function",
"mapUrlToProps",
"(",
"url",
",",
"props",
")",
"{",
"return",
"{",
"foo",
":",
"decode",
"(",
"UrlQueryParamTypes",
".",
"number",
",",
"url",
".",
"fooInUrl",
")",
",",
"bar",
":",
"url",
".",
"bar",
",",
"}",
";",
"}"
] | Map from url query params to props. The values in `url` will still be encoded
as strings since we did not pass a `urlPropsQueryConfig` to addUrlProps. | [
"Map",
"from",
"url",
"query",
"params",
"to",
"props",
".",
"The",
"values",
"in",
"url",
"will",
"still",
"be",
"encoded",
"as",
"strings",
"since",
"we",
"did",
"not",
"pass",
"a",
"urlPropsQueryConfig",
"to",
"addUrlProps",
"."
] | 14dde6c9e7f374cc92e13a4ed70a7462d250d073 | https://github.com/pbeshai/react-url-query/blob/14dde6c9e7f374cc92e13a4ed70a7462d250d073/examples/basic-mapUrlToProps/src/MainPage.js#L9-L14 |
17,693 | pbeshai/react-url-query | examples/basic-mapUrlToProps/src/MainPage.js | mapUrlChangeHandlersToProps | function mapUrlChangeHandlersToProps(props) {
return {
onChangeFoo: (value) => replaceInUrlQuery('fooInUrl', encode(UrlQueryParamTypes.number, value)),
onChangeBar: (value) => replaceInUrlQuery('bar', value),
}
} | javascript | function mapUrlChangeHandlersToProps(props) {
return {
onChangeFoo: (value) => replaceInUrlQuery('fooInUrl', encode(UrlQueryParamTypes.number, value)),
onChangeBar: (value) => replaceInUrlQuery('bar', value),
}
} | [
"function",
"mapUrlChangeHandlersToProps",
"(",
"props",
")",
"{",
"return",
"{",
"onChangeFoo",
":",
"(",
"value",
")",
"=>",
"replaceInUrlQuery",
"(",
"'fooInUrl'",
",",
"encode",
"(",
"UrlQueryParamTypes",
".",
"number",
",",
"value",
")",
")",
",",
"onChan... | Manually specify how to deal with changes to URL query param props.
We do this since we are not using a urlPropsQueryConfig. | [
"Manually",
"specify",
"how",
"to",
"deal",
"with",
"changes",
"to",
"URL",
"query",
"param",
"props",
".",
"We",
"do",
"this",
"since",
"we",
"are",
"not",
"using",
"a",
"urlPropsQueryConfig",
"."
] | 14dde6c9e7f374cc92e13a4ed70a7462d250d073 | https://github.com/pbeshai/react-url-query/blob/14dde6c9e7f374cc92e13a4ed70a7462d250d073/examples/basic-mapUrlToProps/src/MainPage.js#L20-L25 |
17,694 | pbeshai/react-url-query | src/updateUrlQuery.js | multiUpdateInLocation | function multiUpdateInLocation(queryReplacements, location) {
location = getLocation(location);
// if a query is there, use it, otherwise parse the search string
const currQuery = location.query || parseQueryString(location.search);
const newQuery = {
...currQuery,
...queryReplacements,
};
// rem... | javascript | function multiUpdateInLocation(queryReplacements, location) {
location = getLocation(location);
// if a query is there, use it, otherwise parse the search string
const currQuery = location.query || parseQueryString(location.search);
const newQuery = {
...currQuery,
...queryReplacements,
};
// rem... | [
"function",
"multiUpdateInLocation",
"(",
"queryReplacements",
",",
"location",
")",
"{",
"location",
"=",
"getLocation",
"(",
"location",
")",
";",
"// if a query is there, use it, otherwise parse the search string",
"const",
"currQuery",
"=",
"location",
".",
"query",
"... | Update multiple parts of the location at once | [
"Update",
"multiple",
"parts",
"of",
"the",
"location",
"at",
"once"
] | 14dde6c9e7f374cc92e13a4ed70a7462d250d073 | https://github.com/pbeshai/react-url-query/blob/14dde6c9e7f374cc92e13a4ed70a7462d250d073/src/updateUrlQuery.js#L89-L114 |
17,695 | pbeshai/react-url-query | examples/react-router-v2-and-redux/src/state/rootReducer.js | app | function app(state = {}, action) {
switch (action.type) {
case CHANGE_BAZ:
return {
...state,
baz: action.payload,
};
default:
return state;
}
} | javascript | function app(state = {}, action) {
switch (action.type) {
case CHANGE_BAZ:
return {
...state,
baz: action.payload,
};
default:
return state;
}
} | [
"function",
"app",
"(",
"state",
"=",
"{",
"}",
",",
"action",
")",
"{",
"switch",
"(",
"action",
".",
"type",
")",
"{",
"case",
"CHANGE_BAZ",
":",
"return",
"{",
"...",
"state",
",",
"baz",
":",
"action",
".",
"payload",
",",
"}",
";",
"default",
... | Simple redux reducer that handles the CHANGE_BAZ action, updating
the redux store to have the new value of baz. | [
"Simple",
"redux",
"reducer",
"that",
"handles",
"the",
"CHANGE_BAZ",
"action",
"updating",
"the",
"redux",
"store",
"to",
"have",
"the",
"new",
"value",
"of",
"baz",
"."
] | 14dde6c9e7f374cc92e13a4ed70a7462d250d073 | https://github.com/pbeshai/react-url-query/blob/14dde6c9e7f374cc92e13a4ed70a7462d250d073/examples/react-router-v2-and-redux/src/state/rootReducer.js#L9-L19 |
17,696 | google/tracing-framework | bin/dump.js | runTool | function runTool(platform, args_, done) {
var args = optimist.argv;
var allzones = args['allzones'];
var inputFile = args['_'][0];
if (!inputFile) {
console.log('usage: dump.js [--allzones] file.wtf-trace');
done(1);
return;
}
console.log('Dumping ' + inputFile + '...');
console.log('');
w... | javascript | function runTool(platform, args_, done) {
var args = optimist.argv;
var allzones = args['allzones'];
var inputFile = args['_'][0];
if (!inputFile) {
console.log('usage: dump.js [--allzones] file.wtf-trace');
done(1);
return;
}
console.log('Dumping ' + inputFile + '...');
console.log('');
w... | [
"function",
"runTool",
"(",
"platform",
",",
"args_",
",",
"done",
")",
"{",
"var",
"args",
"=",
"optimist",
".",
"argv",
";",
"var",
"allzones",
"=",
"args",
"[",
"'allzones'",
"]",
";",
"var",
"inputFile",
"=",
"args",
"[",
"'_'",
"]",
"[",
"0",
... | Dump tool.
@param {!wtf.pal.IPlatform} platform Platform abstraction layer.
@param {!Array.<string>} args Command line arguments.
@param {function(number)} done Call to end the program with a return code. | [
"Dump",
"tool",
"."
] | 495ced98de99a5895e484b2e09771edb42d3c7ab | https://github.com/google/tracing-framework/blob/495ced98de99a5895e484b2e09771edb42d3c7ab/bin/dump.js#L28-L49 |
17,697 | google/tracing-framework | bin/dump.js | dumpDatabase | function dumpDatabase(db, allzones) {
var sources = db.getSources();
for (var n = 0; n < sources.length; n++) {
util.logContextInfo(sources[n].getContextInfo());
}
var zones = db.getZones();
if (!zones.length) {
console.log('No zones');
return 0;
}
var count = allzones ? zones.length : 1;
... | javascript | function dumpDatabase(db, allzones) {
var sources = db.getSources();
for (var n = 0; n < sources.length; n++) {
util.logContextInfo(sources[n].getContextInfo());
}
var zones = db.getZones();
if (!zones.length) {
console.log('No zones');
return 0;
}
var count = allzones ? zones.length : 1;
... | [
"function",
"dumpDatabase",
"(",
"db",
",",
"allzones",
")",
"{",
"var",
"sources",
"=",
"db",
".",
"getSources",
"(",
")",
";",
"for",
"(",
"var",
"n",
"=",
"0",
";",
"n",
"<",
"sources",
".",
"length",
";",
"n",
"++",
")",
"{",
"util",
".",
"... | Dump the database.
@param {!wtf.db.Database} db Database.
@param {!boolean} allzones Whether it's needed to dump all the zones or just the first one
@return {number} Return code. | [
"Dump",
"the",
"database",
"."
] | 495ced98de99a5895e484b2e09771edb42d3c7ab | https://github.com/google/tracing-framework/blob/495ced98de99a5895e484b2e09771edb42d3c7ab/bin/dump.js#L58-L81 |
17,698 | google/tracing-framework | src/wtf/app/loader.js | finishLoad | function finishLoad() {
// Pick a title, unless one was specified.
var title = opt_title || this.generateTitleFromEntries_(entries);
this.mainDisplay_.setTitle(title);
// Show the document.
var documentView = this.mainDisplay_.openDocument(doc);
goog.asserts.assert(documentView);
// Zoom t... | javascript | function finishLoad() {
// Pick a title, unless one was specified.
var title = opt_title || this.generateTitleFromEntries_(entries);
this.mainDisplay_.setTitle(title);
// Show the document.
var documentView = this.mainDisplay_.openDocument(doc);
goog.asserts.assert(documentView);
// Zoom t... | [
"function",
"finishLoad",
"(",
")",
"{",
"// Pick a title, unless one was specified.",
"var",
"title",
"=",
"opt_title",
"||",
"this",
".",
"generateTitleFromEntries_",
"(",
"entries",
")",
";",
"this",
".",
"mainDisplay_",
".",
"setTitle",
"(",
"title",
")",
";",... | This is called after the dialog has closed to give it a chance to animate out. | [
"This",
"is",
"called",
"after",
"the",
"dialog",
"has",
"closed",
"to",
"give",
"it",
"a",
"chance",
"to",
"animate",
"out",
"."
] | 495ced98de99a5895e484b2e09771edb42d3c7ab | https://github.com/google/tracing-framework/blob/495ced98de99a5895e484b2e09771edb42d3c7ab/src/wtf/app/loader.js#L428-L442 |
17,699 | google/tracing-framework | extensions/wtf-injector-firefox/lib/main.js | acquireMemoryObserver | function acquireMemoryObserver() {
// Only enable on first use.
++memoryObservationCount;
if (memoryObservationCount > 1) {
return;
}
// Enable memory notification.
setTemporaryPreference('javascript.options.mem.notify', true);
// Listen for events.
Services.obs.addObserver(
handleMemoryEven... | javascript | function acquireMemoryObserver() {
// Only enable on first use.
++memoryObservationCount;
if (memoryObservationCount > 1) {
return;
}
// Enable memory notification.
setTemporaryPreference('javascript.options.mem.notify', true);
// Listen for events.
Services.obs.addObserver(
handleMemoryEven... | [
"function",
"acquireMemoryObserver",
"(",
")",
"{",
"// Only enable on first use.",
"++",
"memoryObservationCount",
";",
"if",
"(",
"memoryObservationCount",
">",
"1",
")",
"{",
"return",
";",
"}",
"// Enable memory notification.",
"setTemporaryPreference",
"(",
"'javascr... | Acquires a reference to the memory observer, starting it if this is the first
reference. | [
"Acquires",
"a",
"reference",
"to",
"the",
"memory",
"observer",
"starting",
"it",
"if",
"this",
"is",
"the",
"first",
"reference",
"."
] | 495ced98de99a5895e484b2e09771edb42d3c7ab | https://github.com/google/tracing-framework/blob/495ced98de99a5895e484b2e09771edb42d3c7ab/extensions/wtf-injector-firefox/lib/main.js#L148-L161 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.