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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
53,400 | vivangkumar/node-data-structures | lib/Iterator.js | function() {
if(this._collection.getAll()[this._pos + 1]) {
this._hasNext = true;
} else {
this._hasNext = false;
}
if(!this._nextCalled) {
this._pos ++;
this._hasNextCalled = true;
}
return this._hasNex... | javascript | function() {
if(this._collection.getAll()[this._pos + 1]) {
this._hasNext = true;
} else {
this._hasNext = false;
}
if(!this._nextCalled) {
this._pos ++;
this._hasNextCalled = true;
}
return this._hasNex... | [
"function",
"(",
")",
"{",
"if",
"(",
"this",
".",
"_collection",
".",
"getAll",
"(",
")",
"[",
"this",
".",
"_pos",
"+",
"1",
"]",
")",
"{",
"this",
".",
"_hasNext",
"=",
"true",
";",
"}",
"else",
"{",
"this",
".",
"_hasNext",
"=",
"false",
";... | Returns true if there are more elements.
@return boolean
@throws Error | [
"Returns",
"true",
"if",
"there",
"are",
"more",
"elements",
"."
] | 703d0795fba9d15534fa149f605d54fcfe0844e0 | https://github.com/vivangkumar/node-data-structures/blob/703d0795fba9d15534fa149f605d54fcfe0844e0/lib/Iterator.js#L58-L71 | |
53,401 | wallacegibbon/sqlmaker | index.js | mkInsert | function mkInsert(table, obj) {
const ks = Object.keys(obj).map(x => `\`${x}\``);
const vs = Object.values(obj).map(toMysqlObj);
return `INSERT INTO \`${table}\`(${ks}) VALUES(${vs})`;
} | javascript | function mkInsert(table, obj) {
const ks = Object.keys(obj).map(x => `\`${x}\``);
const vs = Object.values(obj).map(toMysqlObj);
return `INSERT INTO \`${table}\`(${ks}) VALUES(${vs})`;
} | [
"function",
"mkInsert",
"(",
"table",
",",
"obj",
")",
"{",
"const",
"ks",
"=",
"Object",
".",
"keys",
"(",
"obj",
")",
".",
"map",
"(",
"x",
"=>",
"`",
"\\`",
"${",
"x",
"}",
"\\`",
"`",
")",
";",
"const",
"vs",
"=",
"Object",
".",
"values",
... | INSERT is the simplest operation, because there is no WHERE part in it.
@param {Object} obj - Object like { name: "Abc", age: 15 }.
@returns {string} - e.g. "INSERT INTO X(name, age) VALUES('Abc', 15)" | [
"INSERT",
"is",
"the",
"simplest",
"operation",
"because",
"there",
"is",
"no",
"WHERE",
"part",
"in",
"it",
"."
] | 58e4b84ca120e6ff1b12779f941c04b431e961be | https://github.com/wallacegibbon/sqlmaker/blob/58e4b84ca120e6ff1b12779f941c04b431e961be/index.js#L21-L26 |
53,402 | wallacegibbon/sqlmaker | index.js | toMysqlObj | function toMysqlObj(obj) {
if (obj === undefined || obj === null)
return "NULL";
switch (obj.constructor) {
case Date:
return `'${formatDate(obj)}'`;
case String:
return `'${obj.replace(/'/g, "''")}'`;
case Number:
return obj;
default:
throw new TypeError(`${util.inspect(obj)}`);
}... | javascript | function toMysqlObj(obj) {
if (obj === undefined || obj === null)
return "NULL";
switch (obj.constructor) {
case Date:
return `'${formatDate(obj)}'`;
case String:
return `'${obj.replace(/'/g, "''")}'`;
case Number:
return obj;
default:
throw new TypeError(`${util.inspect(obj)}`);
}... | [
"function",
"toMysqlObj",
"(",
"obj",
")",
"{",
"if",
"(",
"obj",
"===",
"undefined",
"||",
"obj",
"===",
"null",
")",
"return",
"\"NULL\"",
";",
"switch",
"(",
"obj",
".",
"constructor",
")",
"{",
"case",
"Date",
":",
"return",
"`",
"${",
"formatDate"... | Transform normal Javascript object to Mysql object. Only String, Number,
Date are supported. | [
"Transform",
"normal",
"Javascript",
"object",
"to",
"Mysql",
"object",
".",
"Only",
"String",
"Number",
"Date",
"are",
"supported",
"."
] | 58e4b84ca120e6ff1b12779f941c04b431e961be | https://github.com/wallacegibbon/sqlmaker/blob/58e4b84ca120e6ff1b12779f941c04b431e961be/index.js#L84-L101 |
53,403 | atd-schubert/node-stream-lib | lib/pipe.js | function (chain) {
if (chain.readable) {
chain.chainAfter = chain.chainAfter || Pipe.Chain.prototype.chainAfter;
chain.nextChain = chain.nextChain || Pipe.Chain.prototype.nextChain;
}
if (chain.writable) { // Duplex
chain.chainBefore = chain.chainBefore || Pip... | javascript | function (chain) {
if (chain.readable) {
chain.chainAfter = chain.chainAfter || Pipe.Chain.prototype.chainAfter;
chain.nextChain = chain.nextChain || Pipe.Chain.prototype.nextChain;
}
if (chain.writable) { // Duplex
chain.chainBefore = chain.chainBefore || Pip... | [
"function",
"(",
"chain",
")",
"{",
"if",
"(",
"chain",
".",
"readable",
")",
"{",
"chain",
".",
"chainAfter",
"=",
"chain",
".",
"chainAfter",
"||",
"Pipe",
".",
"Chain",
".",
"prototype",
".",
"chainAfter",
";",
"chain",
".",
"nextChain",
"=",
"chain... | Enhance a stream to a chainable one
@private
@param {stream} chain | [
"Enhance",
"a",
"stream",
"to",
"a",
"chainable",
"one"
] | 90f27042fae84d2fbdbf9d28149b0673997f151a | https://github.com/atd-schubert/node-stream-lib/blob/90f27042fae84d2fbdbf9d28149b0673997f151a/lib/pipe.js#L78-L92 | |
53,404 | atd-schubert/node-stream-lib | lib/pipe.js | function (chain) {
if (chain.previousChain) {
chain.previousChain.unpipe(chain);
chain.previousChain.pipe(this);
chain.previousChain.nextChain = this;
}
if (this.autoEnhance) {
this.enhanceForeignStream(chain);
}
this.pipe(chain)... | javascript | function (chain) {
if (chain.previousChain) {
chain.previousChain.unpipe(chain);
chain.previousChain.pipe(this);
chain.previousChain.nextChain = this;
}
if (this.autoEnhance) {
this.enhanceForeignStream(chain);
}
this.pipe(chain)... | [
"function",
"(",
"chain",
")",
"{",
"if",
"(",
"chain",
".",
"previousChain",
")",
"{",
"chain",
".",
"previousChain",
".",
"unpipe",
"(",
"chain",
")",
";",
"chain",
".",
"previousChain",
".",
"pipe",
"(",
"this",
")",
";",
"chain",
".",
"previousChai... | Chain this chain before the stream given as parameter
@param {stream.Writable|stream.Transform|stream.Duplex} chain - Next stream
@returns {Pipe.Chain} | [
"Chain",
"this",
"chain",
"before",
"the",
"stream",
"given",
"as",
"parameter"
] | 90f27042fae84d2fbdbf9d28149b0673997f151a | https://github.com/atd-schubert/node-stream-lib/blob/90f27042fae84d2fbdbf9d28149b0673997f151a/lib/pipe.js#L98-L114 | |
53,405 | ernestoalejo/grunt-diff-deploy | tasks/push.js | function(callback) {
ftpout.raw.pwd(function(err) {
if (err && err.code === 530) {
grunt.fatal('bad username or password');
}
callback(err);
});
} | javascript | function(callback) {
ftpout.raw.pwd(function(err) {
if (err && err.code === 530) {
grunt.fatal('bad username or password');
}
callback(err);
});
} | [
"function",
"(",
"callback",
")",
"{",
"ftpout",
".",
"raw",
".",
"pwd",
"(",
"function",
"(",
"err",
")",
"{",
"if",
"(",
"err",
"&&",
"err",
".",
"code",
"===",
"530",
")",
"{",
"grunt",
".",
"fatal",
"(",
"'bad username or password'",
")",
";",
... | Check user name & password | [
"Check",
"user",
"name",
"&",
"password"
] | c1cdf9f95865fcb784499418e60a0b7682786c91 | https://github.com/ernestoalejo/grunt-diff-deploy/blob/c1cdf9f95865fcb784499418e60a0b7682786c91/tasks/push.js#L78-L85 | |
53,406 | ernestoalejo/grunt-diff-deploy | tasks/push.js | function(callback) {
grunt.log.write(wrap('===== saving hashes... '));
ftpout.put(new Buffer(JSON.stringify(localHashes)), 'push-hashes', function(err) {
if (err) { done(err); }
grunt.log.writeln(wrapRight('[SUCCESS]').green);
callback();
});
} | javascript | function(callback) {
grunt.log.write(wrap('===== saving hashes... '));
ftpout.put(new Buffer(JSON.stringify(localHashes)), 'push-hashes', function(err) {
if (err) { done(err); }
grunt.log.writeln(wrapRight('[SUCCESS]').green);
callback();
});
} | [
"function",
"(",
"callback",
")",
"{",
"grunt",
".",
"log",
".",
"write",
"(",
"wrap",
"(",
"'===== saving hashes... '",
")",
")",
";",
"ftpout",
".",
"put",
"(",
"new",
"Buffer",
"(",
"JSON",
".",
"stringify",
"(",
"localHashes",
")",
")",
",",
"'push... | Change folder & files perms | [
"Change",
"folder",
"&",
"files",
"perms"
] | c1cdf9f95865fcb784499418e60a0b7682786c91 | https://github.com/ernestoalejo/grunt-diff-deploy/blob/c1cdf9f95865fcb784499418e60a0b7682786c91/tasks/push.js#L269-L276 | |
53,407 | ernestoalejo/grunt-diff-deploy | tasks/push.js | function(localHashes, files, done) {
fetchRemoteHashes(function(err, remoteHashes) {
done(err, localHashes, remoteHashes, files);
});
} | javascript | function(localHashes, files, done) {
fetchRemoteHashes(function(err, remoteHashes) {
done(err, localHashes, remoteHashes, files);
});
} | [
"function",
"(",
"localHashes",
",",
"files",
",",
"done",
")",
"{",
"fetchRemoteHashes",
"(",
"function",
"(",
"err",
",",
"remoteHashes",
")",
"{",
"done",
"(",
"err",
",",
"localHashes",
",",
"remoteHashes",
",",
"files",
")",
";",
"}",
")",
";",
"}... | Fetch the remote hashes | [
"Fetch",
"the",
"remote",
"hashes"
] | c1cdf9f95865fcb784499418e60a0b7682786c91 | https://github.com/ernestoalejo/grunt-diff-deploy/blob/c1cdf9f95865fcb784499418e60a0b7682786c91/tasks/push.js#L330-L334 | |
53,408 | psalaets/ray-vs-line-segment | index.js | rayVsLineSegment | function rayVsLineSegment(ray, segment) {
var result = lineIntersect.checkIntersection(
ray.start.x, ray.start.y, ray.end.x, ray.end.y,
segment.start.x, segment.start.y, segment.end.x, segment.end.y
);
// definitely no intersection
if (result.type == 'none' || result.type == 'parallel') return null;
... | javascript | function rayVsLineSegment(ray, segment) {
var result = lineIntersect.checkIntersection(
ray.start.x, ray.start.y, ray.end.x, ray.end.y,
segment.start.x, segment.start.y, segment.end.x, segment.end.y
);
// definitely no intersection
if (result.type == 'none' || result.type == 'parallel') return null;
... | [
"function",
"rayVsLineSegment",
"(",
"ray",
",",
"segment",
")",
"{",
"var",
"result",
"=",
"lineIntersect",
".",
"checkIntersection",
"(",
"ray",
".",
"start",
".",
"x",
",",
"ray",
".",
"start",
".",
"y",
",",
"ray",
".",
"end",
".",
"x",
",",
"ray... | Finds where a ray hits a line segment, if at all.
@param {object} ray - Object that looks like
{
start: {x: number, y: number},
end: {x: number, y: number}
}
@param {object} segment - Object that looks like
{
start: {x: number, y: number},
end: {x: number, y: number}
}
@return {object} point (x/y) where ray hits seg... | [
"Finds",
"where",
"a",
"ray",
"hits",
"a",
"line",
"segment",
"if",
"at",
"all",
"."
] | 7dfde5f2c7853bf34ca4394fa897f4c315a9be88 | https://github.com/psalaets/ray-vs-line-segment/blob/7dfde5f2c7853bf34ca4394fa897f4c315a9be88/index.js#L21-L44 |
53,409 | influx6/ToolStack | lib/stack.structures.js | function(elem){
if(!this.root){
this.root = struct.Node(elem);
this.tail = this.root;
this.size = 1;
return this;
// this.root.isRoot = true;
}
this.root.prepend(elem);
this.root = this.root.previous;... | javascript | function(elem){
if(!this.root){
this.root = struct.Node(elem);
this.tail = this.root;
this.size = 1;
return this;
// this.root.isRoot = true;
}
this.root.prepend(elem);
this.root = this.root.previous;... | [
"function",
"(",
"elem",
")",
"{",
"if",
"(",
"!",
"this",
".",
"root",
")",
"{",
"this",
".",
"root",
"=",
"struct",
".",
"Node",
"(",
"elem",
")",
";",
"this",
".",
"tail",
"=",
"this",
".",
"root",
";",
"this",
".",
"size",
"=",
"1",
";",
... | adds from the back of the tail element | [
"adds",
"from",
"the",
"back",
"of",
"the",
"tail",
"element"
] | d0c7b1acc1546f5e7ff9d04ca6c9222b2577e0db | https://github.com/influx6/ToolStack/blob/d0c7b1acc1546f5e7ff9d04ca6c9222b2577e0db/lib/stack.structures.js#L111-L124 | |
53,410 | influx6/ToolStack | lib/stack.structures.js | function(elem){
if(!this.root){
this.root = struct.Node(elem);
this.tail = this.root;
this.size = 1;
return this;
// this.root.isRoot = true;
}
// this.add(elem);
this.tail.append(elem);
th... | javascript | function(elem){
if(!this.root){
this.root = struct.Node(elem);
this.tail = this.root;
this.size = 1;
return this;
// this.root.isRoot = true;
}
// this.add(elem);
this.tail.append(elem);
th... | [
"function",
"(",
"elem",
")",
"{",
"if",
"(",
"!",
"this",
".",
"root",
")",
"{",
"this",
".",
"root",
"=",
"struct",
".",
"Node",
"(",
"elem",
")",
";",
"this",
".",
"tail",
"=",
"this",
".",
"root",
";",
"this",
".",
"size",
"=",
"1",
";",
... | adds in front of the tail element | [
"adds",
"in",
"front",
"of",
"the",
"tail",
"element"
] | d0c7b1acc1546f5e7ff9d04ca6c9222b2577e0db | https://github.com/influx6/ToolStack/blob/d0c7b1acc1546f5e7ff9d04ca6c9222b2577e0db/lib/stack.structures.js#L126-L139 | |
53,411 | influx6/ToolStack | lib/stack.structures.js | function(){
if(!this.size) return;
var n = this.root, pr = n.previous, nx = n.next;
if(this.size === 1){
this.root = this.tail = null; this.size = 0;
return n;
}
nx.previous = pr;
delete this.root;
this... | javascript | function(){
if(!this.size) return;
var n = this.root, pr = n.previous, nx = n.next;
if(this.size === 1){
this.root = this.tail = null; this.size = 0;
return n;
}
nx.previous = pr;
delete this.root;
this... | [
"function",
"(",
")",
"{",
"if",
"(",
"!",
"this",
".",
"size",
")",
"return",
";",
"var",
"n",
"=",
"this",
".",
"root",
",",
"pr",
"=",
"n",
".",
"previous",
",",
"nx",
"=",
"n",
".",
"next",
";",
"if",
"(",
"this",
".",
"size",
"===",
"1... | pops of the root of the list | [
"pops",
"of",
"the",
"root",
"of",
"the",
"list"
] | d0c7b1acc1546f5e7ff9d04ca6c9222b2577e0db | https://github.com/influx6/ToolStack/blob/d0c7b1acc1546f5e7ff9d04ca6c9222b2577e0db/lib/stack.structures.js#L141-L153 | |
53,412 | skerit/alchemy | lib/core/client_alchemy.js | markLinkElement | function markLinkElement(element, active_nr) {
var mark_wrapper;
// Always remove the current classes
element.classList.remove('active-link');
element.classList.remove('active-sublink');
if (element.parentElement && element.parentElement.classList.contains('js-he-link-wrapper')) {
markLinkElement(element.pare... | javascript | function markLinkElement(element, active_nr) {
var mark_wrapper;
// Always remove the current classes
element.classList.remove('active-link');
element.classList.remove('active-sublink');
if (element.parentElement && element.parentElement.classList.contains('js-he-link-wrapper')) {
markLinkElement(element.pare... | [
"function",
"markLinkElement",
"(",
"element",
",",
"active_nr",
")",
"{",
"var",
"mark_wrapper",
";",
"// Always remove the current classes",
"element",
".",
"classList",
".",
"remove",
"(",
"'active-link'",
")",
";",
"element",
".",
"classList",
".",
"remove",
"... | Mark element as active or not
@author Jelle De Loecker <jelle@develry.be>
@since 0.3.0
@version 0.3.0
@param {Element} element
@param {Number} active_nr | [
"Mark",
"element",
"as",
"active",
"or",
"not"
] | ede1dad07a5a737d5d1e10c2ff87fdfb057443f8 | https://github.com/skerit/alchemy/blob/ede1dad07a5a737d5d1e10c2ff87fdfb057443f8/lib/core/client_alchemy.js#L439-L460 |
53,413 | sjberry/bristol-hipchat | main.js | Target | function Target(options = {}) {
options = clone(options);
let client = new Hipchatter(options.token);
let room = options.room;
delete options.token;
delete options.room;
let proto = {
message_format: 'html',
notify: false
};
for (let key in options) {
if (!options.hasOwnProperty(key)) {
break;
}
... | javascript | function Target(options = {}) {
options = clone(options);
let client = new Hipchatter(options.token);
let room = options.room;
delete options.token;
delete options.room;
let proto = {
message_format: 'html',
notify: false
};
for (let key in options) {
if (!options.hasOwnProperty(key)) {
break;
}
... | [
"function",
"Target",
"(",
"options",
"=",
"{",
"}",
")",
"{",
"options",
"=",
"clone",
"(",
"options",
")",
";",
"let",
"client",
"=",
"new",
"Hipchatter",
"(",
"options",
".",
"token",
")",
";",
"let",
"room",
"=",
"options",
".",
"room",
";",
"d... | Creates and configures an instance of the bristol-hipchat target. Establishes message defaults by way of an internal
Message constructor.
@constructor
@param {Object} options
@param {String} options.token The API key (must have the notification permission to send messages).
@param {Number} options.room The Room ID to ... | [
"Creates",
"and",
"configures",
"an",
"instance",
"of",
"the",
"bristol",
"-",
"hipchat",
"target",
".",
"Establishes",
"message",
"defaults",
"by",
"way",
"of",
"an",
"internal",
"Message",
"constructor",
"."
] | c90f64721543e3b00e28657ba841fbc04214dbf9 | https://github.com/sjberry/bristol-hipchat/blob/c90f64721543e3b00e28657ba841fbc04214dbf9/main.js#L23-L83 |
53,414 | CascadeEnergy/dispatch-fn | index.js | dispatch | function dispatch() {
var commands = [].slice.call(arguments);
return function fn() {
var args = [].slice.call(arguments);
var result;
for (var i = 0; i < commands.length; i++) {
result = commands[i].apply(undefined, args);
if (result !== undefined) {
break;
}
}
ret... | javascript | function dispatch() {
var commands = [].slice.call(arguments);
return function fn() {
var args = [].slice.call(arguments);
var result;
for (var i = 0; i < commands.length; i++) {
result = commands[i].apply(undefined, args);
if (result !== undefined) {
break;
}
}
ret... | [
"function",
"dispatch",
"(",
")",
"{",
"var",
"commands",
"=",
"[",
"]",
".",
"slice",
".",
"call",
"(",
"arguments",
")",
";",
"return",
"function",
"fn",
"(",
")",
"{",
"var",
"args",
"=",
"[",
"]",
".",
"slice",
".",
"call",
"(",
"arguments",
... | Dispatch returns a function which iterates a series of commands
looking for one to return something other than undefined.
@param commands
@returns {Function} | [
"Dispatch",
"returns",
"a",
"function",
"which",
"iterates",
"a",
"series",
"of",
"commands",
"looking",
"for",
"one",
"to",
"return",
"something",
"other",
"than",
"undefined",
"."
] | e3ac8135f4c15c21016c9c972a9652b09474074d | https://github.com/CascadeEnergy/dispatch-fn/blob/e3ac8135f4c15c21016c9c972a9652b09474074d/index.js#L8-L25 |
53,415 | hyjin/node-oauth-toolkit | index.js | toArray | function toArray(obj) {
var key, val, arr = [];
for (key in obj) {
val = obj[key];
if (Array.isArray(val))
for (var i = 0; i < val.length; i++)
arr.push([ key, val[i] ]);
else
arr.push([ key, val ]);
}
return arr;
} | javascript | function toArray(obj) {
var key, val, arr = [];
for (key in obj) {
val = obj[key];
if (Array.isArray(val))
for (var i = 0; i < val.length; i++)
arr.push([ key, val[i] ]);
else
arr.push([ key, val ]);
}
return arr;
} | [
"function",
"toArray",
"(",
"obj",
")",
"{",
"var",
"key",
",",
"val",
",",
"arr",
"=",
"[",
"]",
";",
"for",
"(",
"key",
"in",
"obj",
")",
"{",
"val",
"=",
"obj",
"[",
"key",
"]",
";",
"if",
"(",
"Array",
".",
"isArray",
"(",
"val",
")",
"... | Maps object to bi-dimensional array @example toArray({ foo: 'A', bar: [ 'b', 'B' ]}) will be [ ['foo', 'A'], ['bar', 'b'], ['bar', 'B'] ] | [
"Maps",
"object",
"to",
"bi",
"-",
"dimensional",
"array"
] | 17135947c2b888cd1cfa0e80aa09f981ec1d854e | https://github.com/hyjin/node-oauth-toolkit/blob/17135947c2b888cd1cfa0e80aa09f981ec1d854e/index.js#L126-L137 |
53,416 | chickendinosaur/yeoman-generator-node-package | generators/app/1-initializing.js | assignDeep | function assignDeep(dest, source) {
if (source && source.constructor === Object) {
var sourceBaseKeys = Object.keys(source);
for (var i = 0; i < sourceBaseKeys.length; ++i) {
var sourceBaseKey = sourceBaseKeys[i];
var destinationField = dest[sourceBaseKey];
var sourceField = source[sourceBaseKey];
if... | javascript | function assignDeep(dest, source) {
if (source && source.constructor === Object) {
var sourceBaseKeys = Object.keys(source);
for (var i = 0; i < sourceBaseKeys.length; ++i) {
var sourceBaseKey = sourceBaseKeys[i];
var destinationField = dest[sourceBaseKey];
var sourceField = source[sourceBaseKey];
if... | [
"function",
"assignDeep",
"(",
"dest",
",",
"source",
")",
"{",
"if",
"(",
"source",
"&&",
"source",
".",
"constructor",
"===",
"Object",
")",
"{",
"var",
"sourceBaseKeys",
"=",
"Object",
".",
"keys",
"(",
"source",
")",
";",
"for",
"(",
"var",
"i",
... | Object.assign removes special characters that are needed for the pacakge name
and ruins the default value. | [
"Object",
".",
"assign",
"removes",
"special",
"characters",
"that",
"are",
"needed",
"for",
"the",
"pacakge",
"name",
"and",
"ruins",
"the",
"default",
"value",
"."
] | 53e3020595294e10c5ef2428a385501a8a5cd2ac | https://github.com/chickendinosaur/yeoman-generator-node-package/blob/53e3020595294e10c5ef2428a385501a8a5cd2ac/generators/app/1-initializing.js#L92-L109 |
53,417 | coderaiser/util-io | lib/util.js | check | function check(args, names) {
var msg = '',
name = '',
template = '{{ name }} coud not be empty!',
indexOf = Array.prototype.indexOf,
lenNames = names.length... | javascript | function check(args, names) {
var msg = '',
name = '',
template = '{{ name }} coud not be empty!',
indexOf = Array.prototype.indexOf,
lenNames = names.length... | [
"function",
"check",
"(",
"args",
",",
"names",
")",
"{",
"var",
"msg",
"=",
"''",
",",
"name",
"=",
"''",
",",
"template",
"=",
"'{{ name }} coud not be empty!'",
",",
"indexOf",
"=",
"Array",
".",
"prototype",
".",
"indexOf",
",",
"lenNames",
"=",
"nam... | Check is all arguments with names present
@param name
@param arg
@param type | [
"Check",
"is",
"all",
"arguments",
"with",
"names",
"present"
] | cccd3550f96a99e3176d24de5328663a3f7f1c1e | https://github.com/coderaiser/util-io/blob/cccd3550f96a99e3176d24de5328663a3f7f1c1e/lib/util.js#L72-L99 |
53,418 | coderaiser/util-io | lib/util.js | type | function type(variable) {
var regExp = /\s([a-zA-Z]+)/,
str = {}.toString.call(variable),
typeBig = str.match(regExp)[1],
result = typeBig.toLowerCase();
return result;
} | javascript | function type(variable) {
var regExp = /\s([a-zA-Z]+)/,
str = {}.toString.call(variable),
typeBig = str.match(regExp)[1],
result = typeBig.toLowerCase();
return result;
} | [
"function",
"type",
"(",
"variable",
")",
"{",
"var",
"regExp",
"=",
"/",
"\\s([a-zA-Z]+)",
"/",
",",
"str",
"=",
"{",
"}",
".",
"toString",
".",
"call",
"(",
"variable",
")",
",",
"typeBig",
"=",
"str",
".",
"match",
"(",
"regExp",
")",
"[",
"1",
... | get type of variable
@param variable | [
"get",
"type",
"of",
"variable"
] | cccd3550f96a99e3176d24de5328663a3f7f1c1e | https://github.com/coderaiser/util-io/blob/cccd3550f96a99e3176d24de5328663a3f7f1c1e/lib/util.js#L285-L292 |
53,419 | coderaiser/util-io | lib/util.js | function(callback) {
var ret,
isFunc = Util.type.function(callback),
args = [].slice.call(arguments, 1);
if (isFunc)
ret = callback.apply(null, args);
return ret;
... | javascript | function(callback) {
var ret,
isFunc = Util.type.function(callback),
args = [].slice.call(arguments, 1);
if (isFunc)
ret = callback.apply(null, args);
return ret;
... | [
"function",
"(",
"callback",
")",
"{",
"var",
"ret",
",",
"isFunc",
"=",
"Util",
".",
"type",
".",
"function",
"(",
"callback",
")",
",",
"args",
"=",
"[",
"]",
".",
"slice",
".",
"call",
"(",
"arguments",
",",
"1",
")",
";",
"if",
"(",
"isFunc",... | function do save exec of function
@param callback
@param arg1
...
@param argN | [
"function",
"do",
"save",
"exec",
"of",
"function"
] | cccd3550f96a99e3176d24de5328663a3f7f1c1e | https://github.com/coderaiser/util-io/blob/cccd3550f96a99e3176d24de5328663a3f7f1c1e/lib/util.js#L330-L339 | |
53,420 | novemberborn/chai-sentinels | lib/Sentinel.js | Sentinel | function Sentinel(label, propertiesObject) {
if (!(this instanceof Sentinel)) {
return new Sentinel(label, propertiesObject);
}
if (typeof label === 'object' && label) {
propertiesObject = label;
label = undefined;
}
if (typeof label === 'number') {
label = String(label);
} else if (typeof... | javascript | function Sentinel(label, propertiesObject) {
if (!(this instanceof Sentinel)) {
return new Sentinel(label, propertiesObject);
}
if (typeof label === 'object' && label) {
propertiesObject = label;
label = undefined;
}
if (typeof label === 'number') {
label = String(label);
} else if (typeof... | [
"function",
"Sentinel",
"(",
"label",
",",
"propertiesObject",
")",
"{",
"if",
"(",
"!",
"(",
"this",
"instanceof",
"Sentinel",
")",
")",
"{",
"return",
"new",
"Sentinel",
"(",
"label",
",",
"propertiesObject",
")",
";",
"}",
"if",
"(",
"typeof",
"label"... | If truey, `propertiesObject` is used to define properties on the sentinel instance. Can be used without `new`. | [
"If",
"truey",
"propertiesObject",
"is",
"used",
"to",
"define",
"properties",
"on",
"the",
"sentinel",
"instance",
".",
"Can",
"be",
"used",
"without",
"new",
"."
] | 23b52bb40eba43b053ed4236dddc8a5f9ba82d0c | https://github.com/novemberborn/chai-sentinels/blob/23b52bb40eba43b053ed4236dddc8a5f9ba82d0c/lib/Sentinel.js#L20-L53 |
53,421 | johnpaulvaughan/itunes-music-library-path | index.js | _buildPaths | function _buildPaths() {
var home = os.homedir();
var path1 = path.resolve(home + '/Music/iTunes/iTunes Music Library.xml');
var path2 = path.resolve(home + '/Music/iTunes/iTunes Library.xml');
return [path1, path1];
} | javascript | function _buildPaths() {
var home = os.homedir();
var path1 = path.resolve(home + '/Music/iTunes/iTunes Music Library.xml');
var path2 = path.resolve(home + '/Music/iTunes/iTunes Library.xml');
return [path1, path1];
} | [
"function",
"_buildPaths",
"(",
")",
"{",
"var",
"home",
"=",
"os",
".",
"homedir",
"(",
")",
";",
"var",
"path1",
"=",
"path",
".",
"resolve",
"(",
"home",
"+",
"'/Music/iTunes/iTunes Music Library.xml'",
")",
";",
"var",
"path2",
"=",
"path",
".",
"res... | return an array containing the two most likely iTunes XML filepaths.
@param null
@return Array<string> | [
"return",
"an",
"array",
"containing",
"the",
"two",
"most",
"likely",
"iTunes",
"XML",
"filepaths",
"."
] | b798340d9ece1a8a9cc575e50a23f34df86a6ac5 | https://github.com/johnpaulvaughan/itunes-music-library-path/blob/b798340d9ece1a8a9cc575e50a23f34df86a6ac5/index.js#L25-L30 |
53,422 | Wiredcraft/carcass | lib/proto/loader.js | function() {
var parser, source;
source = this.source();
if (source == null) {
return;
}
parser = this.parser();
if (parser != null) {
return parser(source);
} else {
return source;
}
} | javascript | function() {
var parser, source;
source = this.source();
if (source == null) {
return;
}
parser = this.parser();
if (parser != null) {
return parser(source);
} else {
return source;
}
} | [
"function",
"(",
")",
"{",
"var",
"parser",
",",
"source",
";",
"source",
"=",
"this",
".",
"source",
"(",
")",
";",
"if",
"(",
"source",
"==",
"null",
")",
"{",
"return",
";",
"}",
"parser",
"=",
"this",
".",
"parser",
"(",
")",
";",
"if",
"("... | Reload from source. Parse source if a parser is available.
@return {value} | [
"Reload",
"from",
"source",
".",
"Parse",
"source",
"if",
"a",
"parser",
"is",
"available",
"."
] | 3527ec0253f55abba8e6b255e7bf3412b3ca7501 | https://github.com/Wiredcraft/carcass/blob/3527ec0253f55abba8e6b255e7bf3412b3ca7501/lib/proto/loader.js#L22-L34 | |
53,423 | dalekjs/dalek-driver-sauce | index.js | function (opts) {
// get the browser configuration & the browser module
var browserConf = {name: null};
var browser = opts.browserMo;
// prepare properties
this._initializeProperties(opts);
// create a new webdriver client instance
this.webdriverClient = new WD(browser, this.events);
// listen on bro... | javascript | function (opts) {
// get the browser configuration & the browser module
var browserConf = {name: null};
var browser = opts.browserMo;
// prepare properties
this._initializeProperties(opts);
// create a new webdriver client instance
this.webdriverClient = new WD(browser, this.events);
// listen on bro... | [
"function",
"(",
"opts",
")",
"{",
"// get the browser configuration & the browser module",
"var",
"browserConf",
"=",
"{",
"name",
":",
"null",
"}",
";",
"var",
"browser",
"=",
"opts",
".",
"browserMo",
";",
"// prepare properties",
"this",
".",
"_initializePropert... | Initializes the sauce labs driver & the remote browser instance
@param {object} opts Initializer options
@constructor | [
"Initializes",
"the",
"sauce",
"labs",
"driver",
"&",
"the",
"remote",
"browser",
"instance"
] | 4b3ef87a0c35a91db8456d074b0d47a3e0df58f7 | https://github.com/dalekjs/dalek-driver-sauce/blob/4b3ef87a0c35a91db8456d074b0d47a3e0df58f7/index.js#L42-L75 | |
53,424 | dalekjs/dalek-driver-sauce | index.js | function (opts) {
// prepare properties
this.actionQueue = [];
this.config = opts.config;
this.lastCalledUrl = null;
this.driverStatus = {};
this.sessionStatus = {};
// store injcted options in object properties
this.events = opts.events;
this.reporterEvents = opts.reporter;
this... | javascript | function (opts) {
// prepare properties
this.actionQueue = [];
this.config = opts.config;
this.lastCalledUrl = null;
this.driverStatus = {};
this.sessionStatus = {};
// store injcted options in object properties
this.events = opts.events;
this.reporterEvents = opts.reporter;
this... | [
"function",
"(",
"opts",
")",
"{",
"// prepare properties",
"this",
".",
"actionQueue",
"=",
"[",
"]",
";",
"this",
".",
"config",
"=",
"opts",
".",
"config",
";",
"this",
".",
"lastCalledUrl",
"=",
"null",
";",
"this",
".",
"driverStatus",
"=",
"{",
"... | Initializes the driver properties
@method _initializeProperties
@param {object} opts Options needed to kick off the driver
@chainable
@private | [
"Initializes",
"the",
"driver",
"properties"
] | 4b3ef87a0c35a91db8456d074b0d47a3e0df58f7 | https://github.com/dalekjs/dalek-driver-sauce/blob/4b3ef87a0c35a91db8456d074b0d47a3e0df58f7/index.js#L175-L187 | |
53,425 | dalekjs/dalek-driver-sauce | index.js | function (browser) {
// issue the kill command to the browser, when all tests are completed
this.events.on('tests:complete:sauce:' + this.browserName, browser.kill.bind(browser));
// clear the webdriver session, when all tests are completed
this.events.on('tests:complete:sauce:' + this.browserName, this... | javascript | function (browser) {
// issue the kill command to the browser, when all tests are completed
this.events.on('tests:complete:sauce:' + this.browserName, browser.kill.bind(browser));
// clear the webdriver session, when all tests are completed
this.events.on('tests:complete:sauce:' + this.browserName, this... | [
"function",
"(",
"browser",
")",
"{",
"// issue the kill command to the browser, when all tests are completed",
"this",
".",
"events",
".",
"on",
"(",
"'tests:complete:sauce:'",
"+",
"this",
".",
"browserName",
",",
"browser",
".",
"kill",
".",
"bind",
"(",
"browser",... | Binds listeners on browser events
@method _initializeProperties
@param {object} browser Browser module
@chainable
@private | [
"Binds",
"listeners",
"on",
"browser",
"events"
] | 4b3ef87a0c35a91db8456d074b0d47a3e0df58f7 | https://github.com/dalekjs/dalek-driver-sauce/blob/4b3ef87a0c35a91db8456d074b0d47a3e0df58f7/index.js#L198-L204 | |
53,426 | dalekjs/dalek-driver-sauce | index.js | function () {
var deferred = Q.defer();
// store desired capabilities of this session
this.desiredCapabilities = this.browserData.getDesiredCapabilities(this.browserName, this.config);
this.browserDefaults = this.browserData.driverDefaults;
this.browserDefaults.status = this.browserData.getStatusDe... | javascript | function () {
var deferred = Q.defer();
// store desired capabilities of this session
this.desiredCapabilities = this.browserData.getDesiredCapabilities(this.browserName, this.config);
this.browserDefaults = this.browserData.driverDefaults;
this.browserDefaults.status = this.browserData.getStatusDe... | [
"function",
"(",
")",
"{",
"var",
"deferred",
"=",
"Q",
".",
"defer",
"(",
")",
";",
"// store desired capabilities of this session",
"this",
".",
"desiredCapabilities",
"=",
"this",
".",
"browserData",
".",
"getDesiredCapabilities",
"(",
"this",
".",
"browserName... | Checks if a webdriver session has already been established,
if not, create a new one
@method start
@return {object} promise Driver promise | [
"Checks",
"if",
"a",
"webdriver",
"session",
"has",
"already",
"been",
"established",
"if",
"not",
"create",
"a",
"new",
"one"
] | 4b3ef87a0c35a91db8456d074b0d47a3e0df58f7 | https://github.com/dalekjs/dalek-driver-sauce/blob/4b3ef87a0c35a91db8456d074b0d47a3e0df58f7/index.js#L214-L226 | |
53,427 | dalekjs/dalek-driver-sauce | index.js | function () {
var result = Q.resolve();
// loop through all promises created by the remote methods
// this is synchronous, so it waits if a method is finished before
// the next one will be executed
this.actionQueue.forEach(function (f) {
result = result.then(f);
});
// flush the que... | javascript | function () {
var result = Q.resolve();
// loop through all promises created by the remote methods
// this is synchronous, so it waits if a method is finished before
// the next one will be executed
this.actionQueue.forEach(function (f) {
result = result.then(f);
});
// flush the que... | [
"function",
"(",
")",
"{",
"var",
"result",
"=",
"Q",
".",
"resolve",
"(",
")",
";",
"// loop through all promises created by the remote methods",
"// this is synchronous, so it waits if a method is finished before",
"// the next one will be executed",
"this",
".",
"actionQueue",... | Starts to execution of a batch of tests
@method end
@chainable | [
"Starts",
"to",
"execution",
"of",
"a",
"batch",
"of",
"tests"
] | 4b3ef87a0c35a91db8456d074b0d47a3e0df58f7 | https://github.com/dalekjs/dalek-driver-sauce/blob/4b3ef87a0c35a91db8456d074b0d47a3e0df58f7/index.js#L281-L295 | |
53,428 | dalekjs/dalek-driver-sauce | index.js | function (sessionInfo) {
var defer = Q.defer();
this.sessionStatus = JSON.parse(sessionInfo).value;
this.events.emit('driver:sessionStatus:sauce:' + this.browserName, this.sessionStatus);
defer.resolve();
return defer.promise;
} | javascript | function (sessionInfo) {
var defer = Q.defer();
this.sessionStatus = JSON.parse(sessionInfo).value;
this.events.emit('driver:sessionStatus:sauce:' + this.browserName, this.sessionStatus);
defer.resolve();
return defer.promise;
} | [
"function",
"(",
"sessionInfo",
")",
"{",
"var",
"defer",
"=",
"Q",
".",
"defer",
"(",
")",
";",
"this",
".",
"sessionStatus",
"=",
"JSON",
".",
"parse",
"(",
"sessionInfo",
")",
".",
"value",
";",
"this",
".",
"events",
".",
"emit",
"(",
"'driver:se... | Loads the browser session status
@method _sessionStatus
@param {object} sessionInfo Session information
@return {object} promise Browser session promise
@private | [
"Loads",
"the",
"browser",
"session",
"status"
] | 4b3ef87a0c35a91db8456d074b0d47a3e0df58f7 | https://github.com/dalekjs/dalek-driver-sauce/blob/4b3ef87a0c35a91db8456d074b0d47a3e0df58f7/index.js#L328-L334 | |
53,429 | dalekjs/dalek-driver-sauce | index.js | function (statusInfo) {
var defer = Q.defer();
this.driverStatus = JSON.parse(statusInfo).value;
this.events.emit('driver:status:sauce:' + this.browserName, this.driverStatus);
defer.resolve();
return defer.promise;
} | javascript | function (statusInfo) {
var defer = Q.defer();
this.driverStatus = JSON.parse(statusInfo).value;
this.events.emit('driver:status:sauce:' + this.browserName, this.driverStatus);
defer.resolve();
return defer.promise;
} | [
"function",
"(",
"statusInfo",
")",
"{",
"var",
"defer",
"=",
"Q",
".",
"defer",
"(",
")",
";",
"this",
".",
"driverStatus",
"=",
"JSON",
".",
"parse",
"(",
"statusInfo",
")",
".",
"value",
";",
"this",
".",
"events",
".",
"emit",
"(",
"'driver:statu... | Loads the browser driver status
@method _driverStatus
@param {object} statusInfo Driver status information
@return {object} promise Driver status promise
@private | [
"Loads",
"the",
"browser",
"driver",
"status"
] | 4b3ef87a0c35a91db8456d074b0d47a3e0df58f7 | https://github.com/dalekjs/dalek-driver-sauce/blob/4b3ef87a0c35a91db8456d074b0d47a3e0df58f7/index.js#L345-L351 | |
53,430 | OpenSmartEnvironment/ose-lirc | lib/lirc/node.js | onError | function onError() { // {{{2
O.log.unhandled('LIRC ERROR', arguments);
delete this.socket;
setTimeout(connect.bind(null, this), 1000);
} | javascript | function onError() { // {{{2
O.log.unhandled('LIRC ERROR', arguments);
delete this.socket;
setTimeout(connect.bind(null, this), 1000);
} | [
"function",
"onError",
"(",
")",
"{",
"// {{{2",
"O",
".",
"log",
".",
"unhandled",
"(",
"'LIRC ERROR'",
",",
"arguments",
")",
";",
"delete",
"this",
".",
"socket",
";",
"setTimeout",
"(",
"connect",
".",
"bind",
"(",
"null",
",",
"this",
")",
",",
... | Entry Event Handlers {{{1 `this` is bound to entry. | [
"Entry",
"Event",
"Handlers",
"{{{",
"1",
"this",
"is",
"bound",
"to",
"entry",
"."
] | a9882e44d84d75420eae3da25f89977ac70a33fe | https://github.com/OpenSmartEnvironment/ose-lirc/blob/a9882e44d84d75420eae3da25f89977ac70a33fe/lib/lirc/node.js#L14-L20 |
53,431 | lr360/fidem-signer | lib/auth-header.js | extractParameters | function extractParameters(header) {
var SEPARATOR = /(?: |,)/g;
var OPERATOR = /=/;
return header.split(SEPARATOR).reduce(function (parameters, property) {
var parts = property.split(OPERATOR).map(function (part) {
return part.trim();
});
if (parts.length === 2)
parameters[parts[0]] = p... | javascript | function extractParameters(header) {
var SEPARATOR = /(?: |,)/g;
var OPERATOR = /=/;
return header.split(SEPARATOR).reduce(function (parameters, property) {
var parts = property.split(OPERATOR).map(function (part) {
return part.trim();
});
if (parts.length === 2)
parameters[parts[0]] = p... | [
"function",
"extractParameters",
"(",
"header",
")",
"{",
"var",
"SEPARATOR",
"=",
"/",
"(?: |,)",
"/",
"g",
";",
"var",
"OPERATOR",
"=",
"/",
"=",
"/",
";",
"return",
"header",
".",
"split",
"(",
"SEPARATOR",
")",
".",
"reduce",
"(",
"function",
"(",
... | Extract parameters from header.
@param {string} header
@returns {object} | [
"Extract",
"parameters",
"from",
"header",
"."
] | 12b3265f5373195d2842a65ed0d0ae4f242027c9 | https://github.com/lr360/fidem-signer/blob/12b3265f5373195d2842a65ed0d0ae4f242027c9/lib/auth-header.js#L54-L68 |
53,432 | jka6502/stratum | lib/require.js | each | function each(object, callback) {
if (!object) { return true; }
if (object.forEach) { return object.forEach(callback); }
if (object instanceof Array) {
var length = array ? array.length : 0;
for(var index = 0; index < length; index++) {
callback(array[index], index);
}
}else{
for(var ke... | javascript | function each(object, callback) {
if (!object) { return true; }
if (object.forEach) { return object.forEach(callback); }
if (object instanceof Array) {
var length = array ? array.length : 0;
for(var index = 0; index < length; index++) {
callback(array[index], index);
}
}else{
for(var ke... | [
"function",
"each",
"(",
"object",
",",
"callback",
")",
"{",
"if",
"(",
"!",
"object",
")",
"{",
"return",
"true",
";",
"}",
"if",
"(",
"object",
".",
"forEach",
")",
"{",
"return",
"object",
".",
"forEach",
"(",
"callback",
")",
";",
"}",
"if",
... | Generic iterator. Iterate over array elements, or object properties, invoking the `callback` specified on each item, using `Array.prototype.forEach` when available, or a polyfill, when not. | [
"Generic",
"iterator",
".",
"Iterate",
"over",
"array",
"elements",
"or",
"object",
"properties",
"invoking",
"the",
"callback",
"specified",
"on",
"each",
"item",
"using",
"Array",
".",
"prototype",
".",
"forEach",
"when",
"available",
"or",
"a",
"polyfill",
... | 698a8abfb07436eda76813786de2d49f08d4081b | https://github.com/jka6502/stratum/blob/698a8abfb07436eda76813786de2d49f08d4081b/lib/require.js#L15-L30 |
53,433 | jka6502/stratum | lib/require.js | every | function every(object, callback) {
if (!object) { return true; }
if (object.every) { return object.every(callback); }
if (object instanceof Array) {
var length = array ? array.length : 0;
for(var index = 0; index < length; index++) {
if (!callback(array[index], index)) { return false; }
}
}... | javascript | function every(object, callback) {
if (!object) { return true; }
if (object.every) { return object.every(callback); }
if (object instanceof Array) {
var length = array ? array.length : 0;
for(var index = 0; index < length; index++) {
if (!callback(array[index], index)) { return false; }
}
}... | [
"function",
"every",
"(",
"object",
",",
"callback",
")",
"{",
"if",
"(",
"!",
"object",
")",
"{",
"return",
"true",
";",
"}",
"if",
"(",
"object",
".",
"every",
")",
"{",
"return",
"object",
".",
"every",
"(",
"callback",
")",
";",
"}",
"if",
"(... | Generic 'every' function. Tolerant of null 'objects' and works on arrays or arbitrary objects. | [
"Generic",
"every",
"function",
".",
"Tolerant",
"of",
"null",
"objects",
"and",
"works",
"on",
"arrays",
"or",
"arbitrary",
"objects",
"."
] | 698a8abfb07436eda76813786de2d49f08d4081b | https://github.com/jka6502/stratum/blob/698a8abfb07436eda76813786de2d49f08d4081b/lib/require.js#L62-L77 |
53,434 | jka6502/stratum | lib/require.js | clone | function clone(object, deep) {
if (!object) { return object; }
var clone = object.prototype
? Object.create(object.prototype.constructor) : {};
for(var key in object) {
if (!object.hasOwnProperty(key)) { continue; }
clone[key] = deep ? clone(object[key], deep) : object[key];
}
return clo... | javascript | function clone(object, deep) {
if (!object) { return object; }
var clone = object.prototype
? Object.create(object.prototype.constructor) : {};
for(var key in object) {
if (!object.hasOwnProperty(key)) { continue; }
clone[key] = deep ? clone(object[key], deep) : object[key];
}
return clo... | [
"function",
"clone",
"(",
"object",
",",
"deep",
")",
"{",
"if",
"(",
"!",
"object",
")",
"{",
"return",
"object",
";",
"}",
"var",
"clone",
"=",
"object",
".",
"prototype",
"?",
"Object",
".",
"create",
"(",
"object",
".",
"prototype",
".",
"constru... | Create a clone of the object specified. If `deep` is truthy, clone any referenced properties too. | [
"Create",
"a",
"clone",
"of",
"the",
"object",
"specified",
".",
"If",
"deep",
"is",
"truthy",
"clone",
"any",
"referenced",
"properties",
"too",
"."
] | 698a8abfb07436eda76813786de2d49f08d4081b | https://github.com/jka6502/stratum/blob/698a8abfb07436eda76813786de2d49f08d4081b/lib/require.js#L102-L112 |
53,435 | jka6502/stratum | lib/require.js | function(paths) {
var base = Script.current(this).absolute;
each(paths, function(item, index) {
var path = paths[index] = URL.absolute(URL.clean(item), base);
if (path[path.length - 1] !== '/') {
paths[index] += '/';
}
});
return paths;
} | javascript | function(paths) {
var base = Script.current(this).absolute;
each(paths, function(item, index) {
var path = paths[index] = URL.absolute(URL.clean(item), base);
if (path[path.length - 1] !== '/') {
paths[index] += '/';
}
});
return paths;
} | [
"function",
"(",
"paths",
")",
"{",
"var",
"base",
"=",
"Script",
".",
"current",
"(",
"this",
")",
".",
"absolute",
";",
"each",
"(",
"paths",
",",
"function",
"(",
"item",
",",
"index",
")",
"{",
"var",
"path",
"=",
"paths",
"[",
"index",
"]",
... | Resolve supplied paths relative to the current script, or page URL, to configure absolute base paths of a `Loader` instance. | [
"Resolve",
"supplied",
"paths",
"relative",
"to",
"the",
"current",
"script",
"or",
"page",
"URL",
"to",
"configure",
"absolute",
"base",
"paths",
"of",
"a",
"Loader",
"instance",
"."
] | 698a8abfb07436eda76813786de2d49f08d4081b | https://github.com/jka6502/stratum/blob/698a8abfb07436eda76813786de2d49f08d4081b/lib/require.js#L165-L174 | |
53,436 | jka6502/stratum | lib/require.js | function(script) {
if (script.loader !== this) { return script.loader.load(script); }
Loader.loaded = false;
if (this.loaded[script.id]) { return true; }
if (this.failed[script.id]) {
throw new Error('No such file: ' + script.url);
}
this.pending[script.id] = script;
return false;
... | javascript | function(script) {
if (script.loader !== this) { return script.loader.load(script); }
Loader.loaded = false;
if (this.loaded[script.id]) { return true; }
if (this.failed[script.id]) {
throw new Error('No such file: ' + script.url);
}
this.pending[script.id] = script;
return false;
... | [
"function",
"(",
"script",
")",
"{",
"if",
"(",
"script",
".",
"loader",
"!==",
"this",
")",
"{",
"return",
"script",
".",
"loader",
".",
"load",
"(",
"script",
")",
";",
"}",
"Loader",
".",
"loaded",
"=",
"false",
";",
"if",
"(",
"this",
".",
"l... | Queue the `Script` specified for loading. | [
"Queue",
"the",
"Script",
"specified",
"for",
"loading",
"."
] | 698a8abfb07436eda76813786de2d49f08d4081b | https://github.com/jka6502/stratum/blob/698a8abfb07436eda76813786de2d49f08d4081b/lib/require.js#L185-L195 | |
53,437 | jka6502/stratum | lib/require.js | function() {
if (Loader.loading) { return false; }
var count = 0;
if (some(this.pending, function(script) {
count++;
if (script.satisfied()) {
Loader.loading = script;
script.module.install();
script.load();
return true;
}
return false;
}) || count === 0) ... | javascript | function() {
if (Loader.loading) { return false; }
var count = 0;
if (some(this.pending, function(script) {
count++;
if (script.satisfied()) {
Loader.loading = script;
script.module.install();
script.load();
return true;
}
return false;
}) || count === 0) ... | [
"function",
"(",
")",
"{",
"if",
"(",
"Loader",
".",
"loading",
")",
"{",
"return",
"false",
";",
"}",
"var",
"count",
"=",
"0",
";",
"if",
"(",
"some",
"(",
"this",
".",
"pending",
",",
"function",
"(",
"script",
")",
"{",
"count",
"++",
";",
... | Begin loading the next viable `Script`. | [
"Begin",
"loading",
"the",
"next",
"viable",
"Script",
"."
] | 698a8abfb07436eda76813786de2d49f08d4081b | https://github.com/jka6502/stratum/blob/698a8abfb07436eda76813786de2d49f08d4081b/lib/require.js#L199-L215 | |
53,438 | jka6502/stratum | lib/require.js | function() {
var pending = this.pending,
script;
for(var name in pending) {
if (!pending.hasOwnProperty(name)) { continue; }
var cycle = pending[name].cycle();
if (cycle) {
cycle[0].allow(cycle[1]);
this.load(cycle[0]);
return true;
}
}
} | javascript | function() {
var pending = this.pending,
script;
for(var name in pending) {
if (!pending.hasOwnProperty(name)) { continue; }
var cycle = pending[name].cycle();
if (cycle) {
cycle[0].allow(cycle[1]);
this.load(cycle[0]);
return true;
}
}
} | [
"function",
"(",
")",
"{",
"var",
"pending",
"=",
"this",
".",
"pending",
",",
"script",
";",
"for",
"(",
"var",
"name",
"in",
"pending",
")",
"{",
"if",
"(",
"!",
"pending",
".",
"hasOwnProperty",
"(",
"name",
")",
")",
"{",
"continue",
";",
"}",
... | Resolve a cyclic dependency between queued `Script`s. | [
"Resolve",
"a",
"cyclic",
"dependency",
"between",
"queued",
"Script",
"s",
"."
] | 698a8abfb07436eda76813786de2d49f08d4081b | https://github.com/jka6502/stratum/blob/698a8abfb07436eda76813786de2d49f08d4081b/lib/require.js#L219-L232 | |
53,439 | jka6502/stratum | lib/require.js | function(script) {
script.module.uninstall();
if (script.stopped || (!script.callback && Loader.loading !== script)) {
script.loader.load(script);
Loader.next();
return;
}
this.loaded[script.id] = script;
delete this.pending[script.id];
Loader.loading = null;
Loader.next();
... | javascript | function(script) {
script.module.uninstall();
if (script.stopped || (!script.callback && Loader.loading !== script)) {
script.loader.load(script);
Loader.next();
return;
}
this.loaded[script.id] = script;
delete this.pending[script.id];
Loader.loading = null;
Loader.next();
... | [
"function",
"(",
"script",
")",
"{",
"script",
".",
"module",
".",
"uninstall",
"(",
")",
";",
"if",
"(",
"script",
".",
"stopped",
"||",
"(",
"!",
"script",
".",
"callback",
"&&",
"Loader",
".",
"loading",
"!==",
"script",
")",
")",
"{",
"script",
... | Event fired when a `Script` managed by this `Loader` has loaded. | [
"Event",
"fired",
"when",
"a",
"Script",
"managed",
"by",
"this",
"Loader",
"has",
"loaded",
"."
] | 698a8abfb07436eda76813786de2d49f08d4081b | https://github.com/jka6502/stratum/blob/698a8abfb07436eda76813786de2d49f08d4081b/lib/require.js#L236-L247 | |
53,440 | jka6502/stratum | lib/require.js | function(script) {
script.module.uninstall();
if (Loader.loading === script) {
Loader.loading = null;
}
script.destroy();
if (!script.next()) {
delete this.pending[script.id];
this.failed[script.id] = script;
}
Loader.next();
} | javascript | function(script) {
script.module.uninstall();
if (Loader.loading === script) {
Loader.loading = null;
}
script.destroy();
if (!script.next()) {
delete this.pending[script.id];
this.failed[script.id] = script;
}
Loader.next();
} | [
"function",
"(",
"script",
")",
"{",
"script",
".",
"module",
".",
"uninstall",
"(",
")",
";",
"if",
"(",
"Loader",
".",
"loading",
"===",
"script",
")",
"{",
"Loader",
".",
"loading",
"=",
"null",
";",
"}",
"script",
".",
"destroy",
"(",
")",
";",... | Even fired when a `Script` managed by this `Loader` has failed. | [
"Even",
"fired",
"when",
"a",
"Script",
"managed",
"by",
"this",
"Loader",
"has",
"failed",
"."
] | 698a8abfb07436eda76813786de2d49f08d4081b | https://github.com/jka6502/stratum/blob/698a8abfb07436eda76813786de2d49f08d4081b/lib/require.js#L251-L262 | |
53,441 | jka6502/stratum | lib/require.js | function(url) {
var loaded = this.loaded,
pending = this.pending,
failed = this.failed,
relative = this.relative(url);
return loaded[relative] || pending[relative] || [failed[relative]];
} | javascript | function(url) {
var loaded = this.loaded,
pending = this.pending,
failed = this.failed,
relative = this.relative(url);
return loaded[relative] || pending[relative] || [failed[relative]];
} | [
"function",
"(",
"url",
")",
"{",
"var",
"loaded",
"=",
"this",
".",
"loaded",
",",
"pending",
"=",
"this",
".",
"pending",
",",
"failed",
"=",
"this",
".",
"failed",
",",
"relative",
"=",
"this",
".",
"relative",
"(",
"url",
")",
";",
"return",
"l... | Find the first `Script` that matches the `url` passed, resolving possible base path relative urls. | [
"Find",
"the",
"first",
"Script",
"that",
"matches",
"the",
"url",
"passed",
"resolving",
"possible",
"base",
"path",
"relative",
"urls",
"."
] | 698a8abfb07436eda76813786de2d49f08d4081b | https://github.com/jka6502/stratum/blob/698a8abfb07436eda76813786de2d49f08d4081b/lib/require.js#L267-L274 | |
53,442 | jka6502/stratum | lib/require.js | function(callback) {
var original = Loader.using;
Loader.using = this;
try{
callback();
}finally{
Loader.using = original;
}
} | javascript | function(callback) {
var original = Loader.using;
Loader.using = this;
try{
callback();
}finally{
Loader.using = original;
}
} | [
"function",
"(",
"callback",
")",
"{",
"var",
"original",
"=",
"Loader",
".",
"using",
";",
"Loader",
".",
"using",
"=",
"this",
";",
"try",
"{",
"callback",
"(",
")",
";",
"}",
"finally",
"{",
"Loader",
".",
"using",
"=",
"original",
";",
"}",
"}"... | Use this `Loader` for the duration of the callback specified. | [
"Use",
"this",
"Loader",
"for",
"the",
"duration",
"of",
"the",
"callback",
"specified",
"."
] | 698a8abfb07436eda76813786de2d49f08d4081b | https://github.com/jka6502/stratum/blob/698a8abfb07436eda76813786de2d49f08d4081b/lib/require.js#L349-L357 | |
53,443 | jka6502/stratum | lib/require.js | function(url) {
var paths = this.paths;
for(var index = 0; index < paths.length; index++) {
var path = paths[index];
if (path === url.substring(0, path.length)) {
return url.substring(path.length);
}
}
return url;
} | javascript | function(url) {
var paths = this.paths;
for(var index = 0; index < paths.length; index++) {
var path = paths[index];
if (path === url.substring(0, path.length)) {
return url.substring(path.length);
}
}
return url;
} | [
"function",
"(",
"url",
")",
"{",
"var",
"paths",
"=",
"this",
".",
"paths",
";",
"for",
"(",
"var",
"index",
"=",
"0",
";",
"index",
"<",
"paths",
".",
"length",
";",
"index",
"++",
")",
"{",
"var",
"path",
"=",
"paths",
"[",
"index",
"]",
";"... | Find the `url` supplied, relative to the first matching base path. | [
"Find",
"the",
"url",
"supplied",
"relative",
"to",
"the",
"first",
"matching",
"base",
"path",
"."
] | 698a8abfb07436eda76813786de2d49f08d4081b | https://github.com/jka6502/stratum/blob/698a8abfb07436eda76813786de2d49f08d4081b/lib/require.js#L361-L370 | |
53,444 | jka6502/stratum | lib/require.js | function() {
if (!this.remain.length) { return false; }
var next = this.remain.shift();
this.absolute = URL.absolute(this.url, next);
return true;
} | javascript | function() {
if (!this.remain.length) { return false; }
var next = this.remain.shift();
this.absolute = URL.absolute(this.url, next);
return true;
} | [
"function",
"(",
")",
"{",
"if",
"(",
"!",
"this",
".",
"remain",
".",
"length",
")",
"{",
"return",
"false",
";",
"}",
"var",
"next",
"=",
"this",
".",
"remain",
".",
"shift",
"(",
")",
";",
"this",
".",
"absolute",
"=",
"URL",
".",
"absolute",
... | Select the next viable `path` from the owning `Loader` to try and load this script from, returns true if another path is viable, false if there are no remaining acceptable paths. | [
"Select",
"the",
"next",
"viable",
"path",
"from",
"the",
"owning",
"Loader",
"to",
"try",
"and",
"load",
"this",
"script",
"from",
"returns",
"true",
"if",
"another",
"path",
"is",
"viable",
"false",
"if",
"there",
"are",
"no",
"remaining",
"acceptable",
... | 698a8abfb07436eda76813786de2d49f08d4081b | https://github.com/jka6502/stratum/blob/698a8abfb07436eda76813786de2d49f08d4081b/lib/require.js#L493-L498 | |
53,445 | jka6502/stratum | lib/require.js | function() {
delete this.stopped;
if (this.callback) {
try{
this.module.exports = this.callback();
}catch(e) {
if (e === STOP_EVENT) {
this.onfail();
}else{
return this.onfail();
}
}
return this.onload();
}else{
this.create();
this.bind();
... | javascript | function() {
delete this.stopped;
if (this.callback) {
try{
this.module.exports = this.callback();
}catch(e) {
if (e === STOP_EVENT) {
this.onfail();
}else{
return this.onfail();
}
}
return this.onload();
}else{
this.create();
this.bind();
... | [
"function",
"(",
")",
"{",
"delete",
"this",
".",
"stopped",
";",
"if",
"(",
"this",
".",
"callback",
")",
"{",
"try",
"{",
"this",
".",
"module",
".",
"exports",
"=",
"this",
".",
"callback",
"(",
")",
";",
"}",
"catch",
"(",
"e",
")",
"{",
"i... | Attempt to load this `Script`. | [
"Attempt",
"to",
"load",
"this",
"Script",
"."
] | 698a8abfb07436eda76813786de2d49f08d4081b | https://github.com/jka6502/stratum/blob/698a8abfb07436eda76813786de2d49f08d4081b/lib/require.js#L502-L520 | |
53,446 | jka6502/stratum | lib/require.js | function() {
if (this.events) { return; }
var tag = this.tag,
script = this,
prefix = '',
method = 'addEventListener';
// The alternative is nuking Redmond from orbit, its the only way to
// be sure...
if (!tag.addEventListener) {
prefix = 'on';
method = 'attachEvent';
... | javascript | function() {
if (this.events) { return; }
var tag = this.tag,
script = this,
prefix = '',
method = 'addEventListener';
// The alternative is nuking Redmond from orbit, its the only way to
// be sure...
if (!tag.addEventListener) {
prefix = 'on';
method = 'attachEvent';
... | [
"function",
"(",
")",
"{",
"if",
"(",
"this",
".",
"events",
")",
"{",
"return",
";",
"}",
"var",
"tag",
"=",
"this",
".",
"tag",
",",
"script",
"=",
"this",
",",
"prefix",
"=",
"''",
",",
"method",
"=",
"'addEventListener'",
";",
"// The alternative... | Bind events to indicate success, or failure, of loading this `Script` instance. | [
"Bind",
"events",
"to",
"indicate",
"success",
"or",
"failure",
"of",
"loading",
"this",
"Script",
"instance",
"."
] | 698a8abfb07436eda76813786de2d49f08d4081b | https://github.com/jka6502/stratum/blob/698a8abfb07436eda76813786de2d49f08d4081b/lib/require.js#L572-L616 | |
53,447 | jka6502/stratum | lib/require.js | function() {
var depends = this.depends,
allowed = this.allowed;
return every(depends, function(depend) {
return depend.loader.loaded[depend.id]
|| depend.loader.failed[depend.id]
|| allowed[depend.id];
});
} | javascript | function() {
var depends = this.depends,
allowed = this.allowed;
return every(depends, function(depend) {
return depend.loader.loaded[depend.id]
|| depend.loader.failed[depend.id]
|| allowed[depend.id];
});
} | [
"function",
"(",
")",
"{",
"var",
"depends",
"=",
"this",
".",
"depends",
",",
"allowed",
"=",
"this",
".",
"allowed",
";",
"return",
"every",
"(",
"depends",
",",
"function",
"(",
"depend",
")",
"{",
"return",
"depend",
".",
"loader",
".",
"loaded",
... | Check whether this `Script`'s dependencies have been satisfied. | [
"Check",
"whether",
"this",
"Script",
"s",
"dependencies",
"have",
"been",
"satisfied",
"."
] | 698a8abfb07436eda76813786de2d49f08d4081b | https://github.com/jka6502/stratum/blob/698a8abfb07436eda76813786de2d49f08d4081b/lib/require.js#L665-L674 | |
53,448 | jka6502/stratum | lib/require.js | function(requesters, parent) {
if (this.satisfied()) { return null; }
requesters = requesters || {};
var id = this.id;
if (requesters[id] && !parent.allowed[id]) {
return [parent, this];
}
requesters[id] = this;
var depends = this.depends;
for(var name in depends) {
if (!de... | javascript | function(requesters, parent) {
if (this.satisfied()) { return null; }
requesters = requesters || {};
var id = this.id;
if (requesters[id] && !parent.allowed[id]) {
return [parent, this];
}
requesters[id] = this;
var depends = this.depends;
for(var name in depends) {
if (!de... | [
"function",
"(",
"requesters",
",",
"parent",
")",
"{",
"if",
"(",
"this",
".",
"satisfied",
"(",
")",
")",
"{",
"return",
"null",
";",
"}",
"requesters",
"=",
"requesters",
"||",
"{",
"}",
";",
"var",
"id",
"=",
"this",
".",
"id",
";",
"if",
"("... | Detect cyclic dependencies between this `Script` and those it depends on. | [
"Detect",
"cyclic",
"dependencies",
"between",
"this",
"Script",
"and",
"those",
"it",
"depends",
"on",
"."
] | 698a8abfb07436eda76813786de2d49f08d4081b | https://github.com/jka6502/stratum/blob/698a8abfb07436eda76813786de2d49f08d4081b/lib/require.js#L686-L706 | |
53,449 | jka6502/stratum | lib/require.js | function() {
this.loaded = false;
this.stopped = true;
var current = Script.current(this.loader);
// Unbind and remove the relevant tag, if any.
this.destroy();
// Welcome traveller! You've discovered the ugly truth! This is
// the 'magic' of the require script, allowing execution t... | javascript | function() {
this.loaded = false;
this.stopped = true;
var current = Script.current(this.loader);
// Unbind and remove the relevant tag, if any.
this.destroy();
// Welcome traveller! You've discovered the ugly truth! This is
// the 'magic' of the require script, allowing execution t... | [
"function",
"(",
")",
"{",
"this",
".",
"loaded",
"=",
"false",
";",
"this",
".",
"stopped",
"=",
"true",
";",
"var",
"current",
"=",
"Script",
".",
"current",
"(",
"this",
".",
"loader",
")",
";",
"// Unbind and remove the relevant tag, if any.\r",
"this",
... | Stop this `Script` from executing, even if this function has been called from within the actual code referenced by `Script`. | [
"Stop",
"this",
"Script",
"from",
"executing",
"even",
"if",
"this",
"function",
"has",
"been",
"called",
"from",
"within",
"the",
"actual",
"code",
"referenced",
"by",
"Script",
"."
] | 698a8abfb07436eda76813786de2d49f08d4081b | https://github.com/jka6502/stratum/blob/698a8abfb07436eda76813786de2d49f08d4081b/lib/require.js#L711-L755 | |
53,450 | jka6502/stratum | lib/require.js | function(url, base) {
if (!url || url.indexOf('://') !== -1) { return url; }
var anchor = document.createElement('a');
anchor.href = (base || location.href);
var protocol = anchor.protocol + '//',
host = anchor.host,
path = anchor.pathname,
parts = filter(path.split('/'), function(... | javascript | function(url, base) {
if (!url || url.indexOf('://') !== -1) { return url; }
var anchor = document.createElement('a');
anchor.href = (base || location.href);
var protocol = anchor.protocol + '//',
host = anchor.host,
path = anchor.pathname,
parts = filter(path.split('/'), function(... | [
"function",
"(",
"url",
",",
"base",
")",
"{",
"if",
"(",
"!",
"url",
"||",
"url",
".",
"indexOf",
"(",
"'://'",
")",
"!==",
"-",
"1",
")",
"{",
"return",
"url",
";",
"}",
"var",
"anchor",
"=",
"document",
".",
"createElement",
"(",
"'a'",
")",
... | Convert a relative url to an absolute, relative to the `base` url specified. | [
"Convert",
"a",
"relative",
"url",
"to",
"an",
"absolute",
"relative",
"to",
"the",
"base",
"url",
"specified",
"."
] | 698a8abfb07436eda76813786de2d49f08d4081b | https://github.com/jka6502/stratum/blob/698a8abfb07436eda76813786de2d49f08d4081b/lib/require.js#L931-L955 | |
53,451 | jka6502/stratum | lib/require.js | function(url) {
var index = url ? url.lastIndexOf('/') : -1;
return index == -1 ? url : url.substring(0, index + 1);
} | javascript | function(url) {
var index = url ? url.lastIndexOf('/') : -1;
return index == -1 ? url : url.substring(0, index + 1);
} | [
"function",
"(",
"url",
")",
"{",
"var",
"index",
"=",
"url",
"?",
"url",
".",
"lastIndexOf",
"(",
"'/'",
")",
":",
"-",
"1",
";",
"return",
"index",
"==",
"-",
"1",
"?",
"url",
":",
"url",
".",
"substring",
"(",
"0",
",",
"index",
"+",
"1",
... | Remove the filename from a url, if possible, returning the url describing only the parent 'path'. | [
"Remove",
"the",
"filename",
"from",
"a",
"url",
"if",
"possible",
"returning",
"the",
"url",
"describing",
"only",
"the",
"parent",
"path",
"."
] | 698a8abfb07436eda76813786de2d49f08d4081b | https://github.com/jka6502/stratum/blob/698a8abfb07436eda76813786de2d49f08d4081b/lib/require.js#L959-L962 | |
53,452 | jka6502/stratum | lib/require.js | extract | function extract(type) {
for(var index = 0; index < 3; index++) {
if (typeof args[index] === type) { return args[index]; }
}
} | javascript | function extract(type) {
for(var index = 0; index < 3; index++) {
if (typeof args[index] === type) { return args[index]; }
}
} | [
"function",
"extract",
"(",
"type",
")",
"{",
"for",
"(",
"var",
"index",
"=",
"0",
";",
"index",
"<",
"3",
";",
"index",
"++",
")",
"{",
"if",
"(",
"typeof",
"args",
"[",
"index",
"]",
"===",
"type",
")",
"{",
"return",
"args",
"[",
"index",
"... | Slightly looser than AMD, identify supplied parameters by type. | [
"Slightly",
"looser",
"than",
"AMD",
"identify",
"supplied",
"parameters",
"by",
"type",
"."
] | 698a8abfb07436eda76813786de2d49f08d4081b | https://github.com/jka6502/stratum/blob/698a8abfb07436eda76813786de2d49f08d4081b/lib/require.js#L1039-L1043 |
53,453 | JohnnieFucker/dreamix-monitor | lib/systemMonitor.js | getBasicInfo | function getBasicInfo() {
const result = {};
for (const key in info) {
if (info.hasOwnProperty(key)) {
result[key] = info[key]();
}
}
return result;
} | javascript | function getBasicInfo() {
const result = {};
for (const key in info) {
if (info.hasOwnProperty(key)) {
result[key] = info[key]();
}
}
return result;
} | [
"function",
"getBasicInfo",
"(",
")",
"{",
"const",
"result",
"=",
"{",
"}",
";",
"for",
"(",
"const",
"key",
"in",
"info",
")",
"{",
"if",
"(",
"info",
".",
"hasOwnProperty",
"(",
"key",
")",
")",
"{",
"result",
"[",
"key",
"]",
"=",
"info",
"["... | get basic information of operating-system
@return {Object} result
@api private | [
"get",
"basic",
"information",
"of",
"operating",
"-",
"system"
] | c9e18d386f48a9bfca9dcb6211229cea3a0eed0e | https://github.com/JohnnieFucker/dreamix-monitor/blob/c9e18d386f48a9bfca9dcb6211229cea3a0eed0e/lib/systemMonitor.js#L50-L58 |
53,454 | emeryrose/latest-torbrowser-version | index.js | checkPlatformSupported | function checkPlatformSupported(version, platform) {
const url = `${base}/${version}`;
if (platform === 'darwin') {
platform = 'osx64';
}
return new Promise((resolve, reject) => {
https.get(url, (res) => {
let body = '';
res.on('error', reject);
res.on('data', (d) => body += d.toStr... | javascript | function checkPlatformSupported(version, platform) {
const url = `${base}/${version}`;
if (platform === 'darwin') {
platform = 'osx64';
}
return new Promise((resolve, reject) => {
https.get(url, (res) => {
let body = '';
res.on('error', reject);
res.on('data', (d) => body += d.toStr... | [
"function",
"checkPlatformSupported",
"(",
"version",
",",
"platform",
")",
"{",
"const",
"url",
"=",
"`",
"${",
"base",
"}",
"${",
"version",
"}",
"`",
";",
"if",
"(",
"platform",
"===",
"'darwin'",
")",
"{",
"platform",
"=",
"'osx64'",
";",
"}",
"ret... | Scrapes the dist page by the given tor version and returns if the platform
is supported by the release
@param {string} version
@param {string} platform | [
"Scrapes",
"the",
"dist",
"page",
"by",
"the",
"given",
"tor",
"version",
"and",
"returns",
"if",
"the",
"platform",
"is",
"supported",
"by",
"the",
"release"
] | 2818e5f67528e44c41cfc414c2f470d0f2422b30 | https://github.com/emeryrose/latest-torbrowser-version/blob/2818e5f67528e44c41cfc414c2f470d0f2422b30/index.js#L77-L110 |
53,455 | artsy/scribe-plugin-jump-link | index.js | function () {
return function (scribe) {
var jumpLinkCommand = new scribe.api.Command('createLink');
jumpLinkCommand.nodeName = 'A';
jumpLinkCommand.execute = function () {
var selection = new scribe.api.Selection(),
that = this;
var fullString = selection.selection.ba... | javascript | function () {
return function (scribe) {
var jumpLinkCommand = new scribe.api.Command('createLink');
jumpLinkCommand.nodeName = 'A';
jumpLinkCommand.execute = function () {
var selection = new scribe.api.Selection(),
that = this;
var fullString = selection.selection.ba... | [
"function",
"(",
")",
"{",
"return",
"function",
"(",
"scribe",
")",
"{",
"var",
"jumpLinkCommand",
"=",
"new",
"scribe",
".",
"api",
".",
"Command",
"(",
"'createLink'",
")",
";",
"jumpLinkCommand",
".",
"nodeName",
"=",
"'A'",
";",
"jumpLinkCommand",
"."... | The main plugin function | [
"The",
"main",
"plugin",
"function"
] | 4d6b6494fcca343666d91f89cf46114179622ffe | https://github.com/artsy/scribe-plugin-jump-link/blob/4d6b6494fcca343666d91f89cf46114179622ffe/index.js#L8-L40 | |
53,456 | MakerCollider/node-red-contrib-smartnode-hook | html/scripts/highchart/modules/exporting.src.js | function (svg) {
return svg
.replace(/zIndex="[^"]+"/g, '')
.replace(/isShadow="[^"]+"/g, '')
.replace(/symbolName="[^"]+"/g, '')
.replace(/jQuery[0-9]+="[^"]+"/g, '')
.replace(/url\([^#]+#/g, 'url(#')
.replace(/<svg /, '<svg xmlns:xlink="http://www.w3.org/1999/xlink" ')
.replace(/ (NS[0-9]+\:)?h... | javascript | function (svg) {
return svg
.replace(/zIndex="[^"]+"/g, '')
.replace(/isShadow="[^"]+"/g, '')
.replace(/symbolName="[^"]+"/g, '')
.replace(/jQuery[0-9]+="[^"]+"/g, '')
.replace(/url\([^#]+#/g, 'url(#')
.replace(/<svg /, '<svg xmlns:xlink="http://www.w3.org/1999/xlink" ')
.replace(/ (NS[0-9]+\:)?h... | [
"function",
"(",
"svg",
")",
"{",
"return",
"svg",
".",
"replace",
"(",
"/",
"zIndex=\"[^\"]+\"",
"/",
"g",
",",
"''",
")",
".",
"replace",
"(",
"/",
"isShadow=\"[^\"]+\"",
"/",
"g",
",",
"''",
")",
".",
"replace",
"(",
"/",
"symbolName=\"[^\"]+\"",
"/... | A collection of regex fixes on the produces SVG to account for expando properties,
browser bugs, VML problems and other. Returns a cleaned SVG. | [
"A",
"collection",
"of",
"regex",
"fixes",
"on",
"the",
"produces",
"SVG",
"to",
"account",
"for",
"expando",
"properties",
"browser",
"bugs",
"VML",
"problems",
"and",
"other",
".",
"Returns",
"a",
"cleaned",
"SVG",
"."
] | 245c267e832968bad880ca009929043e82c7bc25 | https://github.com/MakerCollider/node-red-contrib-smartnode-hook/blob/245c267e832968bad880ca009929043e82c7bc25/html/scripts/highchart/modules/exporting.src.js#L198-L233 | |
53,457 | MakerCollider/node-red-contrib-smartnode-hook | html/scripts/highchart/modules/exporting.src.js | function (options, chartOptions) {
var svg = this.getSVGForExport(options, chartOptions);
// merge the options
options = merge(this.options.exporting, options);
// do the post
Highcharts.post(options.url, {
filename: options.filename || 'chart',
type: options.type,
width: options.width || 0, // ... | javascript | function (options, chartOptions) {
var svg = this.getSVGForExport(options, chartOptions);
// merge the options
options = merge(this.options.exporting, options);
// do the post
Highcharts.post(options.url, {
filename: options.filename || 'chart',
type: options.type,
width: options.width || 0, // ... | [
"function",
"(",
"options",
",",
"chartOptions",
")",
"{",
"var",
"svg",
"=",
"this",
".",
"getSVGForExport",
"(",
"options",
",",
"chartOptions",
")",
";",
"// merge the options",
"options",
"=",
"merge",
"(",
"this",
".",
"options",
".",
"exporting",
",",
... | Submit the SVG representation of the chart to the server
@param {Object} options Exporting options. Possible members are url, type, width and formAttributes.
@param {Object} chartOptions Additional chart options for the SVG representation of the chart | [
"Submit",
"the",
"SVG",
"representation",
"of",
"the",
"chart",
"to",
"the",
"server"
] | 245c267e832968bad880ca009929043e82c7bc25 | https://github.com/MakerCollider/node-red-contrib-smartnode-hook/blob/245c267e832968bad880ca009929043e82c7bc25/html/scripts/highchart/modules/exporting.src.js#L372-L388 | |
53,458 | MakerCollider/node-red-contrib-smartnode-hook | html/scripts/highchart/modules/exporting.src.js | function () {
var chart = this,
container = chart.container,
origDisplay = [],
origParent = container.parentNode,
body = doc.body,
childNodes = body.childNodes;
if (chart.isPrinting) { // block the button while in printing mode
return;
}
chart.isPrinting = true;
fireEvent(chart, 'beforeP... | javascript | function () {
var chart = this,
container = chart.container,
origDisplay = [],
origParent = container.parentNode,
body = doc.body,
childNodes = body.childNodes;
if (chart.isPrinting) { // block the button while in printing mode
return;
}
chart.isPrinting = true;
fireEvent(chart, 'beforeP... | [
"function",
"(",
")",
"{",
"var",
"chart",
"=",
"this",
",",
"container",
"=",
"chart",
".",
"container",
",",
"origDisplay",
"=",
"[",
"]",
",",
"origParent",
"=",
"container",
".",
"parentNode",
",",
"body",
"=",
"doc",
".",
"body",
",",
"childNodes"... | Print the chart | [
"Print",
"the",
"chart"
] | 245c267e832968bad880ca009929043e82c7bc25 | https://github.com/MakerCollider/node-red-contrib-smartnode-hook/blob/245c267e832968bad880ca009929043e82c7bc25/html/scripts/highchart/modules/exporting.src.js#L393-L444 | |
53,459 | MakerCollider/node-red-contrib-smartnode-hook | html/scripts/highchart/modules/exporting.src.js | function (options) {
var chart = this,
renderer = chart.renderer,
btnOptions = merge(chart.options.navigation.buttonOptions, options),
onclick = btnOptions.onclick,
menuItems = btnOptions.menuItems,
symbol,
button,
symbolAttr = {
stroke: btnOptions.symbolStroke,
fill: btnOptions.symbolFil... | javascript | function (options) {
var chart = this,
renderer = chart.renderer,
btnOptions = merge(chart.options.navigation.buttonOptions, options),
onclick = btnOptions.onclick,
menuItems = btnOptions.menuItems,
symbol,
button,
symbolAttr = {
stroke: btnOptions.symbolStroke,
fill: btnOptions.symbolFil... | [
"function",
"(",
"options",
")",
"{",
"var",
"chart",
"=",
"this",
",",
"renderer",
"=",
"chart",
".",
"renderer",
",",
"btnOptions",
"=",
"merge",
"(",
"chart",
".",
"options",
".",
"navigation",
".",
"buttonOptions",
",",
"options",
")",
",",
"onclick"... | Add the export button to the chart | [
"Add",
"the",
"export",
"button",
"to",
"the",
"chart"
] | 245c267e832968bad880ca009929043e82c7bc25 | https://github.com/MakerCollider/node-red-contrib-smartnode-hook/blob/245c267e832968bad880ca009929043e82c7bc25/html/scripts/highchart/modules/exporting.src.js#L578-L677 | |
53,460 | MakerCollider/node-red-contrib-smartnode-hook | html/scripts/highchart/modules/exporting.src.js | function (e) {
var chart = e.target,
i,
elem;
// Destroy the extra buttons added
for (i = 0; i < chart.exportSVGElements.length; i++) {
elem = chart.exportSVGElements[i];
// Destroy and null the svg/vml elements
if (elem) { // #1822
elem.onclick = elem.ontouchstart = null;
chart.exportSVG... | javascript | function (e) {
var chart = e.target,
i,
elem;
// Destroy the extra buttons added
for (i = 0; i < chart.exportSVGElements.length; i++) {
elem = chart.exportSVGElements[i];
// Destroy and null the svg/vml elements
if (elem) { // #1822
elem.onclick = elem.ontouchstart = null;
chart.exportSVG... | [
"function",
"(",
"e",
")",
"{",
"var",
"chart",
"=",
"e",
".",
"target",
",",
"i",
",",
"elem",
";",
"// Destroy the extra buttons added",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"chart",
".",
"exportSVGElements",
".",
"length",
";",
"i",
"++",
")"... | Destroy the buttons. | [
"Destroy",
"the",
"buttons",
"."
] | 245c267e832968bad880ca009929043e82c7bc25 | https://github.com/MakerCollider/node-red-contrib-smartnode-hook/blob/245c267e832968bad880ca009929043e82c7bc25/html/scripts/highchart/modules/exporting.src.js#L682-L711 | |
53,461 | vincentpeyrouse/passport-supinfo | lib/passport-supinfo/errors/internalopeniderror.js | InternalOpenIDError | function InternalOpenIDError(message, err) {
Error.call(this);
Error.captureStackTrace(this, arguments.callee);
this.name = 'InternalOpenIDError';
this.message = message;
this.openidError = err;
} | javascript | function InternalOpenIDError(message, err) {
Error.call(this);
Error.captureStackTrace(this, arguments.callee);
this.name = 'InternalOpenIDError';
this.message = message;
this.openidError = err;
} | [
"function",
"InternalOpenIDError",
"(",
"message",
",",
"err",
")",
"{",
"Error",
".",
"call",
"(",
"this",
")",
";",
"Error",
".",
"captureStackTrace",
"(",
"this",
",",
"arguments",
".",
"callee",
")",
";",
"this",
".",
"name",
"=",
"'InternalOpenIDError... | `InternalOpenIDError` error.
InternalOpenIDError wraps errors generated by node-openid. By wrapping these
objects, error messages can be formatted in a manner that aids in debugging
OpenID issues.
@api public | [
"InternalOpenIDError",
"error",
"."
] | 1d02da38251710a1a2528eb1c27d23fc43565928 | https://github.com/vincentpeyrouse/passport-supinfo/blob/1d02da38251710a1a2528eb1c27d23fc43565928/lib/passport-supinfo/errors/internalopeniderror.js#L10-L16 |
53,462 | chrisJohn404/ljswitchboard-device_scanner | lib/temp_files/oa_managed_device.js | printCollectedDeviceData | function printCollectedDeviceData(results) {
var dataToKeep = {
'AIN0': 'val',
'FIRMWARE_VERSION': 'val',
'WIFI_IP': 'str',
'ETHERNET_IP': 'str',
'WIFI_RSSI': 'str',
'WIFI_VERSION': 'val',
'SERIAL_NUMBER': 'val',
'HA... | javascript | function printCollectedDeviceData(results) {
var dataToKeep = {
'AIN0': 'val',
'FIRMWARE_VERSION': 'val',
'WIFI_IP': 'str',
'ETHERNET_IP': 'str',
'WIFI_RSSI': 'str',
'WIFI_VERSION': 'val',
'SERIAL_NUMBER': 'val',
'HA... | [
"function",
"printCollectedDeviceData",
"(",
"results",
")",
"{",
"var",
"dataToKeep",
"=",
"{",
"'AIN0'",
":",
"'val'",
",",
"'FIRMWARE_VERSION'",
":",
"'val'",
",",
"'WIFI_IP'",
":",
"'str'",
",",
"'ETHERNET_IP'",
":",
"'str'",
",",
"'WIFI_RSSI'",
":",
"'str... | This is a "debugging" function that prints out the important attributes of the data being queried from a device. | [
"This",
"is",
"a",
"debugging",
"function",
"that",
"prints",
"out",
"the",
"important",
"attributes",
"of",
"the",
"data",
"being",
"queried",
"from",
"a",
"device",
"."
] | 9a8f0936387bfedc09ab1b2d655cecf79ad15a6b | https://github.com/chrisJohn404/ljswitchboard-device_scanner/blob/9a8f0936387bfedc09ab1b2d655cecf79ad15a6b/lib/temp_files/oa_managed_device.js#L50-L82 |
53,463 | chrisJohn404/ljswitchboard-device_scanner | lib/temp_files/oa_managed_device.js | curatedDeviceDisconnected | function curatedDeviceDisconnected(eventData) {
self.log(' *** Handle', self.handle, 'triggered event: DEVICE_DISCONNECTED', eventData.name, eventData.operation);
} | javascript | function curatedDeviceDisconnected(eventData) {
self.log(' *** Handle', self.handle, 'triggered event: DEVICE_DISCONNECTED', eventData.name, eventData.operation);
} | [
"function",
"curatedDeviceDisconnected",
"(",
"eventData",
")",
"{",
"self",
".",
"log",
"(",
"' *** Handle'",
",",
"self",
".",
"handle",
",",
"'triggered event: DEVICE_DISCONNECTED'",
",",
"eventData",
".",
"name",
",",
"eventData",
".",
"operation",
")",
";",
... | Define various functions to be used as curated device event listeners. | [
"Define",
"various",
"functions",
"to",
"be",
"used",
"as",
"curated",
"device",
"event",
"listeners",
"."
] | 9a8f0936387bfedc09ab1b2d655cecf79ad15a6b | https://github.com/chrisJohn404/ljswitchboard-device_scanner/blob/9a8f0936387bfedc09ab1b2d655cecf79ad15a6b/lib/temp_files/oa_managed_device.js#L98-L100 |
53,464 | chrisJohn404/ljswitchboard-device_scanner | lib/temp_files/oa_managed_device.js | linkToCuratedDeviceEvents | function linkToCuratedDeviceEvents() {
self.curatedDevice.on(
'DEVICE_DISCONNECTED',
curatedDeviceDisconnected
);
self.curatedDevice.on(
'DEVICE_RECONNECTED',
curatedDeviceReconnected
);
self.curatedDevice.on(
'DEVICE_ER... | javascript | function linkToCuratedDeviceEvents() {
self.curatedDevice.on(
'DEVICE_DISCONNECTED',
curatedDeviceDisconnected
);
self.curatedDevice.on(
'DEVICE_RECONNECTED',
curatedDeviceReconnected
);
self.curatedDevice.on(
'DEVICE_ER... | [
"function",
"linkToCuratedDeviceEvents",
"(",
")",
"{",
"self",
".",
"curatedDevice",
".",
"on",
"(",
"'DEVICE_DISCONNECTED'",
",",
"curatedDeviceDisconnected",
")",
";",
"self",
".",
"curatedDevice",
".",
"on",
"(",
"'DEVICE_RECONNECTED'",
",",
"curatedDeviceReconnec... | Define a function that links the device manager to several of the curated device's events. | [
"Define",
"a",
"function",
"that",
"links",
"the",
"device",
"manager",
"to",
"several",
"of",
"the",
"curated",
"device",
"s",
"events",
"."
] | 9a8f0936387bfedc09ab1b2d655cecf79ad15a6b | https://github.com/chrisJohn404/ljswitchboard-device_scanner/blob/9a8f0936387bfedc09ab1b2d655cecf79ad15a6b/lib/temp_files/oa_managed_device.js#L118-L139 |
53,465 | chrisJohn404/ljswitchboard-device_scanner | lib/temp_files/oa_managed_device.js | unlinkFromCuratedDeviceEvents | function unlinkFromCuratedDeviceEvents() {
self.curatedDevice.removeListener(
'DEVICE_DISCONNECTED',
curatedDeviceDisconnected
);
self.curatedDevice.removeListener(
'DEVICE_RECONNECTED',
curatedDeviceReconnected
);
self.curatedDevic... | javascript | function unlinkFromCuratedDeviceEvents() {
self.curatedDevice.removeListener(
'DEVICE_DISCONNECTED',
curatedDeviceDisconnected
);
self.curatedDevice.removeListener(
'DEVICE_RECONNECTED',
curatedDeviceReconnected
);
self.curatedDevic... | [
"function",
"unlinkFromCuratedDeviceEvents",
"(",
")",
"{",
"self",
".",
"curatedDevice",
".",
"removeListener",
"(",
"'DEVICE_DISCONNECTED'",
",",
"curatedDeviceDisconnected",
")",
";",
"self",
".",
"curatedDevice",
".",
"removeListener",
"(",
"'DEVICE_RECONNECTED'",
"... | Define a function that unlinks the device manager from several of the curated device's events. | [
"Define",
"a",
"function",
"that",
"unlinks",
"the",
"device",
"manager",
"from",
"several",
"of",
"the",
"curated",
"device",
"s",
"events",
"."
] | 9a8f0936387bfedc09ab1b2d655cecf79ad15a6b | https://github.com/chrisJohn404/ljswitchboard-device_scanner/blob/9a8f0936387bfedc09ab1b2d655cecf79ad15a6b/lib/temp_files/oa_managed_device.js#L143-L164 |
53,466 | chrisJohn404/ljswitchboard-device_scanner | lib/temp_files/oa_managed_device.js | saveCollectedDeviceData | function saveCollectedDeviceData(results) {
self.log('Finished Collecting Data from Device:', self.handle);
// Loop through each of the results.
results.forEach(function(result) {
// De-reference the actual data
var data = result.data;
// Determine what regi... | javascript | function saveCollectedDeviceData(results) {
self.log('Finished Collecting Data from Device:', self.handle);
// Loop through each of the results.
results.forEach(function(result) {
// De-reference the actual data
var data = result.data;
// Determine what regi... | [
"function",
"saveCollectedDeviceData",
"(",
"results",
")",
"{",
"self",
".",
"log",
"(",
"'Finished Collecting Data from Device:'",
",",
"self",
".",
"handle",
")",
";",
"// Loop through each of the results.",
"results",
".",
"forEach",
"(",
"function",
"(",
"result"... | Save Data to the cached device results object... | [
"Save",
"Data",
"to",
"the",
"cached",
"device",
"results",
"object",
"..."
] | 9a8f0936387bfedc09ab1b2d655cecf79ad15a6b | https://github.com/chrisJohn404/ljswitchboard-device_scanner/blob/9a8f0936387bfedc09ab1b2d655cecf79ad15a6b/lib/temp_files/oa_managed_device.js#L167-L181 |
53,467 | chrisJohn404/ljswitchboard-device_scanner | lib/temp_files/oa_managed_device.js | innerCollectDeviceData | function innerCollectDeviceData(infoToCache) {
var defered = q.defer();
self.dataCollectionDefered = defered;
self.log('Collecting Data from a handle', self.handle);
// Indicate that this device was opened by the device scanner.
self.openedByScanner = true;
var... | javascript | function innerCollectDeviceData(infoToCache) {
var defered = q.defer();
self.dataCollectionDefered = defered;
self.log('Collecting Data from a handle', self.handle);
// Indicate that this device was opened by the device scanner.
self.openedByScanner = true;
var... | [
"function",
"innerCollectDeviceData",
"(",
"infoToCache",
")",
"{",
"var",
"defered",
"=",
"q",
".",
"defer",
"(",
")",
";",
"self",
".",
"dataCollectionDefered",
"=",
"defered",
";",
"self",
".",
"log",
"(",
"'Collecting Data from a handle'",
",",
"self",
"."... | Link supplied device handle to the curated device object and collect the required information from the device. | [
"Link",
"supplied",
"device",
"handle",
"to",
"the",
"curated",
"device",
"object",
"and",
"collect",
"the",
"required",
"information",
"from",
"the",
"device",
"."
] | 9a8f0936387bfedc09ab1b2d655cecf79ad15a6b | https://github.com/chrisJohn404/ljswitchboard-device_scanner/blob/9a8f0936387bfedc09ab1b2d655cecf79ad15a6b/lib/temp_files/oa_managed_device.js#L193-L251 |
53,468 | Whitebolt/lodash-provider | index.js | lodashRequire | function lodashRequire(functionName) {
var moduleId = getLodashId(functionName);
try {
var method = localRequire(moduleId);
method.toString = lodashFunctionToString(functionName);
return method;
} catch (err) {
throw new ReferenceError('Could not find '+functionName+', did you forget to install '+moduleId);... | javascript | function lodashRequire(functionName) {
var moduleId = getLodashId(functionName);
try {
var method = localRequire(moduleId);
method.toString = lodashFunctionToString(functionName);
return method;
} catch (err) {
throw new ReferenceError('Could not find '+functionName+', did you forget to install '+moduleId);... | [
"function",
"lodashRequire",
"(",
"functionName",
")",
"{",
"var",
"moduleId",
"=",
"getLodashId",
"(",
"functionName",
")",
";",
"try",
"{",
"var",
"method",
"=",
"localRequire",
"(",
"moduleId",
")",
";",
"method",
".",
"toString",
"=",
"lodashFunctionToStri... | Get the given function from lodash. Given a function name try to load the corresponding module.
@throws {ReferenceError} If function not found then throw error.
@param {string} functionName The function name to find (this will be lower-cased).
@returns {Function} The lodash function. | [
"Get",
"the",
"given",
"function",
"from",
"lodash",
".",
"Given",
"a",
"function",
"name",
"try",
"to",
"load",
"the",
"corresponding",
"module",
"."
] | d8e34737346e370f1d4e4cf5595ed4040d1521e8 | https://github.com/Whitebolt/lodash-provider/blob/d8e34737346e370f1d4e4cf5595ed4040d1521e8/index.js#L46-L56 |
53,469 | Whitebolt/lodash-provider | index.js | getPathStack | function getPathStack() {
return (module.parent || module).paths.map(function(path) {
return lop(path)
}).filter(function(path) {
return (path !== '');
});
} | javascript | function getPathStack() {
return (module.parent || module).paths.map(function(path) {
return lop(path)
}).filter(function(path) {
return (path !== '');
});
} | [
"function",
"getPathStack",
"(",
")",
"{",
"return",
"(",
"module",
".",
"parent",
"||",
"module",
")",
".",
"paths",
".",
"map",
"(",
"function",
"(",
"path",
")",
"{",
"return",
"lop",
"(",
"path",
")",
"}",
")",
".",
"filter",
"(",
"function",
"... | Find all possible local directories for node_modules loading.
@returns {Array.<string>} Load paths. | [
"Find",
"all",
"possible",
"local",
"directories",
"for",
"node_modules",
"loading",
"."
] | d8e34737346e370f1d4e4cf5595ed4040d1521e8 | https://github.com/Whitebolt/lodash-provider/blob/d8e34737346e370f1d4e4cf5595ed4040d1521e8/index.js#L155-L161 |
53,470 | Whitebolt/lodash-provider | index.js | loadPackageModules | function loadPackageModules(packages, packageData, modType) {
Object.keys(packageData[modType] || {}).forEach(function(packageName) {
if (lodashTest.test(packageName)) packages.push(tryModule(packageName));
});
} | javascript | function loadPackageModules(packages, packageData, modType) {
Object.keys(packageData[modType] || {}).forEach(function(packageName) {
if (lodashTest.test(packageName)) packages.push(tryModule(packageName));
});
} | [
"function",
"loadPackageModules",
"(",
"packages",
",",
"packageData",
",",
"modType",
")",
"{",
"Object",
".",
"keys",
"(",
"packageData",
"[",
"modType",
"]",
"||",
"{",
"}",
")",
".",
"forEach",
"(",
"function",
"(",
"packageName",
")",
"{",
"if",
"("... | Load all the lodash methods from given packages array.
@param {Array.<Object>} packages Packages array to load into.
@param {Array.<Object>} packageData Package data array.
@param {string} modType Section of package data to load from (eg. 'dependencies'). | [
"Load",
"all",
"the",
"lodash",
"methods",
"from",
"given",
"packages",
"array",
"."
] | d8e34737346e370f1d4e4cf5595ed4040d1521e8 | https://github.com/Whitebolt/lodash-provider/blob/d8e34737346e370f1d4e4cf5595ed4040d1521e8/index.js#L203-L207 |
53,471 | derdesign/protos | engines/jade.js | Jade | function Jade() {
var opts = (app.config.engines && app.config.engines.jade) || {};
this.options = protos.extend({
pretty: true
}, opts);
this.module = jade;
this.multiPart = false;
this.extensions = ['jade', 'jade.html'];
} | javascript | function Jade() {
var opts = (app.config.engines && app.config.engines.jade) || {};
this.options = protos.extend({
pretty: true
}, opts);
this.module = jade;
this.multiPart = false;
this.extensions = ['jade', 'jade.html'];
} | [
"function",
"Jade",
"(",
")",
"{",
"var",
"opts",
"=",
"(",
"app",
".",
"config",
".",
"engines",
"&&",
"app",
".",
"config",
".",
"engines",
".",
"jade",
")",
"||",
"{",
"}",
";",
"this",
".",
"options",
"=",
"protos",
".",
"extend",
"(",
"{",
... | Jade engine class
https://github.com/visionmedia/jade | [
"Jade",
"engine",
"class"
] | 0b679b2a7581dfbb5d065fd4b0914436ef4ef2c9 | https://github.com/derdesign/protos/blob/0b679b2a7581dfbb5d065fd4b0914436ef4ef2c9/engines/jade.js#L15-L27 |
53,472 | IonicaBizau/node-w-json | lib/index.js | wJson | function wJson(path, data, options, callback) {
if (typeof options === "function") {
callback = options;
options = {};
} else if (typeof options === "number") {
options = {
space: options
};
} else if (typeof options === "boolean") {
options = {
... | javascript | function wJson(path, data, options, callback) {
if (typeof options === "function") {
callback = options;
options = {};
} else if (typeof options === "number") {
options = {
space: options
};
} else if (typeof options === "boolean") {
options = {
... | [
"function",
"wJson",
"(",
"path",
",",
"data",
",",
"options",
",",
"callback",
")",
"{",
"if",
"(",
"typeof",
"options",
"===",
"\"function\"",
")",
"{",
"callback",
"=",
"options",
";",
"options",
"=",
"{",
"}",
";",
"}",
"else",
"if",
"(",
"typeof... | wJson
Writes a JSON file.
@name wJson
@function
@param {String} path The JSON file path.
@param {Object} data The JSON data to write in the provided file.
@param {Object|Number|Boolean} options An object containing the fields below.
If boolean, it will be handled as `new_line`, if number it will be handled as `space`.... | [
"wJson",
"Writes",
"a",
"JSON",
"file",
"."
] | 7f709f84325d86d4bee548abac16dfe84b3d94af | https://github.com/IonicaBizau/node-w-json/blob/7f709f84325d86d4bee548abac16dfe84b3d94af/lib/index.js#L20-L45 |
53,473 | sendanor/nor-nopg | src/schema/v0022.js | function(db) {
function merge(a_, b_, plv8, ERROR) {
function copy_properties(o, a) {
Object.keys(a).forEach(function(k) {
o[k] = a[k];
});
return o;
}
function copy(a, b) {
return copy_properties(copy_properties({}, a), b);
}
try {
return copy(a_, b_);
} catch (e) {
... | javascript | function(db) {
function merge(a_, b_, plv8, ERROR) {
function copy_properties(o, a) {
Object.keys(a).forEach(function(k) {
o[k] = a[k];
});
return o;
}
function copy(a, b) {
return copy_properties(copy_properties({}, a), b);
}
try {
return copy(a_, b_);
} catch (e) {
... | [
"function",
"(",
"db",
")",
"{",
"function",
"merge",
"(",
"a_",
",",
"b_",
",",
"plv8",
",",
"ERROR",
")",
"{",
"function",
"copy_properties",
"(",
"o",
",",
"a",
")",
"{",
"Object",
".",
"keys",
"(",
"a",
")",
".",
"forEach",
"(",
"function",
"... | Implement merge function to merge two objects for use in UPDATE | [
"Implement",
"merge",
"function",
"to",
"merge",
"two",
"objects",
"for",
"use",
"in",
"UPDATE"
] | 0d99b86c1a1996b5828b56de8de23700df8bbc0c | https://github.com/sendanor/nor-nopg/blob/0d99b86c1a1996b5828b56de8de23700df8bbc0c/src/schema/v0022.js#L7-L31 | |
53,474 | byron-dupreez/aws-stream-consumer-core | taskdef-settings.js | describeMessage | function describeMessage(message, batch, context) {
const b = batch || context.batch;
const state = b && b.states.get(message);
return message ? `Message (${state && state.msgDesc})` : '';
} | javascript | function describeMessage(message, batch, context) {
const b = batch || context.batch;
const state = b && b.states.get(message);
return message ? `Message (${state && state.msgDesc})` : '';
} | [
"function",
"describeMessage",
"(",
"message",
",",
"batch",
",",
"context",
")",
"{",
"const",
"b",
"=",
"batch",
"||",
"context",
".",
"batch",
";",
"const",
"state",
"=",
"b",
"&&",
"b",
".",
"states",
".",
"get",
"(",
"message",
")",
";",
"return... | A `describeItem` implementation that accepts and describes the arguments passed to a "process one message at a time" function.
@param {Message} message - the message being processed
@param {Batch} batch - the current batch
@param {StreamConsumerContext} context - the context to use
@returns {string} a short description... | [
"A",
"describeItem",
"implementation",
"that",
"accepts",
"and",
"describes",
"the",
"arguments",
"passed",
"to",
"a",
"process",
"one",
"message",
"at",
"a",
"time",
"function",
"."
] | 9b256084297f80d373bcf483aaf68a9da176b3d7 | https://github.com/byron-dupreez/aws-stream-consumer-core/blob/9b256084297f80d373bcf483aaf68a9da176b3d7/taskdef-settings.js#L58-L62 |
53,475 | byron-dupreez/aws-stream-consumer-core | taskdef-settings.js | describeUnusableRecord | function describeUnusableRecord(unusableRecord, batch, context) {
const b = batch || context.batch;
const state = b && b.states.get(unusableRecord);
return `Unusable record (${state && state.recDesc})`;
} | javascript | function describeUnusableRecord(unusableRecord, batch, context) {
const b = batch || context.batch;
const state = b && b.states.get(unusableRecord);
return `Unusable record (${state && state.recDesc})`;
} | [
"function",
"describeUnusableRecord",
"(",
"unusableRecord",
",",
"batch",
",",
"context",
")",
"{",
"const",
"b",
"=",
"batch",
"||",
"context",
".",
"batch",
";",
"const",
"state",
"=",
"b",
"&&",
"b",
".",
"states",
".",
"get",
"(",
"unusableRecord",
... | A `describeItem` implementation that accepts and describes the arguments passed to a `discardUnusableRecord` function.
@param {UnusableRecord} unusableRecord - the unusable record to be discarded
@param {Batch} batch - the batch being processed
@param {StreamConsumerContext} context - the context to use
@returns {strin... | [
"A",
"describeItem",
"implementation",
"that",
"accepts",
"and",
"describes",
"the",
"arguments",
"passed",
"to",
"a",
"discardUnusableRecord",
"function",
"."
] | 9b256084297f80d373bcf483aaf68a9da176b3d7 | https://github.com/byron-dupreez/aws-stream-consumer-core/blob/9b256084297f80d373bcf483aaf68a9da176b3d7/taskdef-settings.js#L94-L98 |
53,476 | byron-dupreez/aws-stream-consumer-core | taskdef-settings.js | describeRejectedMessage | function describeRejectedMessage(rejectedMessage, batch, context) {
const b = batch || context.batch;
const state = b && b.states.get(rejectedMessage);
return `Rejected message (${state && (state.msgDesc || state.recDesc)})`;
} | javascript | function describeRejectedMessage(rejectedMessage, batch, context) {
const b = batch || context.batch;
const state = b && b.states.get(rejectedMessage);
return `Rejected message (${state && (state.msgDesc || state.recDesc)})`;
} | [
"function",
"describeRejectedMessage",
"(",
"rejectedMessage",
",",
"batch",
",",
"context",
")",
"{",
"const",
"b",
"=",
"batch",
"||",
"context",
".",
"batch",
";",
"const",
"state",
"=",
"b",
"&&",
"b",
".",
"states",
".",
"get",
"(",
"rejectedMessage",... | A `describeItem` implementation that accepts and describes the arguments passed to a `discardRejectedMessage` function.
@param {Message} rejectedMessage - the rejected message to be discarded
@param {Batch} batch - the batch being processed
@param {StreamConsumerContext} context - the context to use
@returns {string} a... | [
"A",
"describeItem",
"implementation",
"that",
"accepts",
"and",
"describes",
"the",
"arguments",
"passed",
"to",
"a",
"discardRejectedMessage",
"function",
"."
] | 9b256084297f80d373bcf483aaf68a9da176b3d7 | https://github.com/byron-dupreez/aws-stream-consumer-core/blob/9b256084297f80d373bcf483aaf68a9da176b3d7/taskdef-settings.js#L107-L111 |
53,477 | tjunghans/stylus-deps-to-css | lib/stylus-deps-to-css.js | readStylusFile | function readStylusFile(file, callback) {
fs.readFile(file, function (err, data) {
if (err) {
throw err;
}
stylus.render(data.toString(), function (err, css) {
if (err) {
throw err;
}
callback(css);
});
});
} | javascript | function readStylusFile(file, callback) {
fs.readFile(file, function (err, data) {
if (err) {
throw err;
}
stylus.render(data.toString(), function (err, css) {
if (err) {
throw err;
}
callback(css);
});
});
} | [
"function",
"readStylusFile",
"(",
"file",
",",
"callback",
")",
"{",
"fs",
".",
"readFile",
"(",
"file",
",",
"function",
"(",
"err",
",",
"data",
")",
"{",
"if",
"(",
"err",
")",
"{",
"throw",
"err",
";",
"}",
"stylus",
".",
"render",
"(",
"data"... | Yields callback with css | [
"Yields",
"callback",
"with",
"css"
] | 0957237c993f19339ea89011d4af73c644e75364 | https://github.com/tjunghans/stylus-deps-to-css/blob/0957237c993f19339ea89011d4af73c644e75364/lib/stylus-deps-to-css.js#L38-L50 |
53,478 | kevinoid/promised-read | lib/eof-error.js | EOFError | function EOFError(message) {
// Like http://www.ecma-international.org/ecma-262/6.0/#sec-error-message
if (!(this instanceof EOFError)) { return new EOFError(message); }
Error.captureStackTrace(this, EOFError);
if (message !== undefined) {
Object.defineProperty(this, 'message', {
value: String(message... | javascript | function EOFError(message) {
// Like http://www.ecma-international.org/ecma-262/6.0/#sec-error-message
if (!(this instanceof EOFError)) { return new EOFError(message); }
Error.captureStackTrace(this, EOFError);
if (message !== undefined) {
Object.defineProperty(this, 'message', {
value: String(message... | [
"function",
"EOFError",
"(",
"message",
")",
"{",
"// Like http://www.ecma-international.org/ecma-262/6.0/#sec-error-message",
"if",
"(",
"!",
"(",
"this",
"instanceof",
"EOFError",
")",
")",
"{",
"return",
"new",
"EOFError",
"(",
"message",
")",
";",
"}",
"Error",
... | Constructs an EOFError.
@class Represents an error caused by reaching the end-of-file (or, more
generally, end-of-input).
@constructor
@param {string=} message Human-readable description of the error. | [
"Constructs",
"an",
"EOFError",
"."
] | c6adf477f4a64d5142363d84f7f83f5f07b8f682 | https://github.com/kevinoid/promised-read/blob/c6adf477f4a64d5142363d84f7f83f5f07b8f682/lib/eof-error.js#L17-L28 |
53,479 | dickhardt/node-a2p3 | lib/jwt.js | jws | function jws ( details ) {
if (!details.header)
throw new Error('No header for JWS token')
if (!details.header.alg)
throw new Error('No JWS signing algorithm specified')
if (!signAlg[details.header.alg])
throw new Error('Unsupported JWS signing algorithm:"'+details.header.alg+'"')
if (!details.paylo... | javascript | function jws ( details ) {
if (!details.header)
throw new Error('No header for JWS token')
if (!details.header.alg)
throw new Error('No JWS signing algorithm specified')
if (!signAlg[details.header.alg])
throw new Error('Unsupported JWS signing algorithm:"'+details.header.alg+'"')
if (!details.paylo... | [
"function",
"jws",
"(",
"details",
")",
"{",
"if",
"(",
"!",
"details",
".",
"header",
")",
"throw",
"new",
"Error",
"(",
"'No header for JWS token'",
")",
"if",
"(",
"!",
"details",
".",
"header",
".",
"alg",
")",
"throw",
"new",
"Error",
"(",
"'No JW... | make a JWS | [
"make",
"a",
"JWS"
] | ca9dd8802d7ed2e90f6754bfced0ac9014c230a3 | https://github.com/dickhardt/node-a2p3/blob/ca9dd8802d7ed2e90f6754bfced0ac9014c230a3/lib/jwt.js#L278-L294 |
53,480 | dickhardt/node-a2p3 | lib/jwt.js | keygen | function keygen (alg) {
var algs =
{ 'HS256': 256/8
, 'HS512': 512/8
, 'A128CBC+HS256': 256/8
, 'A256CBC+HS512': 512/8
};
if (!algs[alg]) return null;
return (b64url.encode(crypto.randomBytes(algs[alg])))
} | javascript | function keygen (alg) {
var algs =
{ 'HS256': 256/8
, 'HS512': 512/8
, 'A128CBC+HS256': 256/8
, 'A256CBC+HS512': 512/8
};
if (!algs[alg]) return null;
return (b64url.encode(crypto.randomBytes(algs[alg])))
} | [
"function",
"keygen",
"(",
"alg",
")",
"{",
"var",
"algs",
"=",
"{",
"'HS256'",
":",
"256",
"/",
"8",
",",
"'HS512'",
":",
"512",
"/",
"8",
",",
"'A128CBC+HS256'",
":",
"256",
"/",
"8",
",",
"'A256CBC+HS512'",
":",
"512",
"/",
"8",
"}",
";",
"if"... | generates a key for the passed algorithm | [
"generates",
"a",
"key",
"for",
"the",
"passed",
"algorithm"
] | ca9dd8802d7ed2e90f6754bfced0ac9014c230a3 | https://github.com/dickhardt/node-a2p3/blob/ca9dd8802d7ed2e90f6754bfced0ac9014c230a3/lib/jwt.js#L369-L378 |
53,481 | acos-server/acos-jsparsons | static/js-parsons/parsons.js | builtinRead | function builtinRead(x) {
if (Sk.builtinFiles === undefined || Sk.builtinFiles["files"][x] === undefined)
throw "File not found: '" + x + "'";
return Sk.builtinFiles["files"][x];
} | javascript | function builtinRead(x) {
if (Sk.builtinFiles === undefined || Sk.builtinFiles["files"][x] === undefined)
throw "File not found: '" + x + "'";
return Sk.builtinFiles["files"][x];
} | [
"function",
"builtinRead",
"(",
"x",
")",
"{",
"if",
"(",
"Sk",
".",
"builtinFiles",
"===",
"undefined",
"||",
"Sk",
".",
"builtinFiles",
"[",
"\"files\"",
"]",
"[",
"x",
"]",
"===",
"undefined",
")",
"throw",
"\"File not found: '\"",
"+",
"x",
"+",
"\"'... | function for reading python imports with skulpt | [
"function",
"for",
"reading",
"python",
"imports",
"with",
"skulpt"
] | 8c504c261137b0bedf1939a60dd76cfe21d01d7f | https://github.com/acos-server/acos-jsparsons/blob/8c504c261137b0bedf1939a60dd76cfe21d01d7f/static/js-parsons/parsons.js#L110-L114 |
53,482 | acos-server/acos-jsparsons | static/js-parsons/parsons.js | function(options) {
// Contains line objects of the user-draggable code.
// The order is not meaningful (unchanged from the initial state) but
// indent property for each line object is updated as the user moves
// codelines around. (see parseCode for line object description)
this.modified_lines = [];
... | javascript | function(options) {
// Contains line objects of the user-draggable code.
// The order is not meaningful (unchanged from the initial state) but
// indent property for each line object is updated as the user moves
// codelines around. (see parseCode for line object description)
this.modified_lines = [];
... | [
"function",
"(",
"options",
")",
"{",
"// Contains line objects of the user-draggable code.",
"// The order is not meaningful (unchanged from the initial state) but",
"// indent property for each line object is updated as the user moves",
"// codelines around. (see parseCode for line object descript... | Creates a parsons widget. Init must be called after creating an object. | [
"Creates",
"a",
"parsons",
"widget",
".",
"Init",
"must",
"be",
"called",
"after",
"creating",
"an",
"object",
"."
] | 8c504c261137b0bedf1939a60dd76cfe21d01d7f | https://github.com/acos-server/acos-jsparsons/blob/8c504c261137b0bedf1939a60dd76cfe21d01d7f/static/js-parsons/parsons.js#L860-L923 | |
53,483 | Maultasche/BaconNodeAutoPauseLineStream | src/index.js | createAutoPauseLineStream | function createAutoPauseLineStream(readStream) {
//Use readline to read the lines of text
const lineReader = readline.createInterface({
input: readStream
});
//Create a line queue for the lines that are emitted from the line reader.
//Once the line reader has read a chunk from the read stream, it will
//contin... | javascript | function createAutoPauseLineStream(readStream) {
//Use readline to read the lines of text
const lineReader = readline.createInterface({
input: readStream
});
//Create a line queue for the lines that are emitted from the line reader.
//Once the line reader has read a chunk from the read stream, it will
//contin... | [
"function",
"createAutoPauseLineStream",
"(",
"readStream",
")",
"{",
"//Use readline to read the lines of text",
"const",
"lineReader",
"=",
"readline",
".",
"createInterface",
"(",
"{",
"input",
":",
"readStream",
"}",
")",
";",
"//Create a line queue for the lines that a... | Creates a Bacon stream that emits lines of text read from a
readable stream. The stream pauses itself every time a line
is emitted and can be unpaused by calling the unpause function
the is emitted along with the line of text
@param readStream - A readable stream
@returns a Bacon stream that emits objects containing a... | [
"Creates",
"a",
"Bacon",
"stream",
"that",
"emits",
"lines",
"of",
"text",
"read",
"from",
"a",
"readable",
"stream",
".",
"The",
"stream",
"pauses",
"itself",
"every",
"time",
"a",
"line",
"is",
"emitted",
"and",
"can",
"be",
"unpaused",
"by",
"calling",
... | 587684a7e807bb1c0fff4bfda8cf70e96adeafaf | https://github.com/Maultasche/BaconNodeAutoPauseLineStream/blob/587684a7e807bb1c0fff4bfda8cf70e96adeafaf/src/index.js#L15-L99 |
53,484 | Maultasche/BaconNodeAutoPauseLineStream | src/index.js | emitLine | function emitLine() {
if(lineQueue.size() > 0)
{
pause();
sink({line: lineQueue.deq(), resume});
}
else if(streamEnd) {
sink(new Bacon.End());
}
else {
//If we've run out of lines to emit
readStream.resume();
}
} | javascript | function emitLine() {
if(lineQueue.size() > 0)
{
pause();
sink({line: lineQueue.deq(), resume});
}
else if(streamEnd) {
sink(new Bacon.End());
}
else {
//If we've run out of lines to emit
readStream.resume();
}
} | [
"function",
"emitLine",
"(",
")",
"{",
"if",
"(",
"lineQueue",
".",
"size",
"(",
")",
">",
"0",
")",
"{",
"pause",
"(",
")",
";",
"sink",
"(",
"{",
"line",
":",
"lineQueue",
".",
"deq",
"(",
")",
",",
"resume",
"}",
")",
";",
"}",
"else",
"if... | Emits a line if possible | [
"Emits",
"a",
"line",
"if",
"possible"
] | 587684a7e807bb1c0fff4bfda8cf70e96adeafaf | https://github.com/Maultasche/BaconNodeAutoPauseLineStream/blob/587684a7e807bb1c0fff4bfda8cf70e96adeafaf/src/index.js#L67-L81 |
53,485 | mitchallen/connection-grid-square | modules/index.js | function(x, y, dir) {
if(!this.isCell(x, y)) { return null; }
// dir must be string and in dirmap
if(!this.isDir(dir)) { return null; }
let _DX = { "E": 1, "W": -1, "N": 0, "S": 0 };
let _DY = { "E": 0, "W": 0, "N": -1, "S": 1 };
var nx = x + _DX[d... | javascript | function(x, y, dir) {
if(!this.isCell(x, y)) { return null; }
// dir must be string and in dirmap
if(!this.isDir(dir)) { return null; }
let _DX = { "E": 1, "W": -1, "N": 0, "S": 0 };
let _DY = { "E": 0, "W": 0, "N": -1, "S": 1 };
var nx = x + _DX[d... | [
"function",
"(",
"x",
",",
"y",
",",
"dir",
")",
"{",
"if",
"(",
"!",
"this",
".",
"isCell",
"(",
"x",
",",
"y",
")",
")",
"{",
"return",
"null",
";",
"}",
"// dir must be string and in dirmap",
"if",
"(",
"!",
"this",
".",
"isDir",
"(",
"dir",
"... | Returns neighbor for direction
@param {string} dir A string representing a direction
@function
@instance
@memberof module:connection-grid-square
@returns {string}
@example <caption>usage</caption>
var cell = grid.getNeighbor(1,1,"S"); | [
"Returns",
"neighbor",
"for",
"direction"
] | 88cea02e210e9814b4c74f6a4c355b7695da6271 | https://github.com/mitchallen/connection-grid-square/blob/88cea02e210e9814b4c74f6a4c355b7695da6271/modules/index.js#L84-L96 | |
53,486 | novemberborn/legendary | lib/fn.js | compose | function compose() {
var funcs = slice.call(arguments);
return function() {
var thisArg = this;
var boundFuncs = funcs.map(function(func) {
return function() {
return promise.Promise.from(func.apply(thisArg, arguments));
};
});
var args = slice.call(arguments);
args.unshift... | javascript | function compose() {
var funcs = slice.call(arguments);
return function() {
var thisArg = this;
var boundFuncs = funcs.map(function(func) {
return function() {
return promise.Promise.from(func.apply(thisArg, arguments));
};
});
var args = slice.call(arguments);
args.unshift... | [
"function",
"compose",
"(",
")",
"{",
"var",
"funcs",
"=",
"slice",
".",
"call",
"(",
"arguments",
")",
";",
"return",
"function",
"(",
")",
"{",
"var",
"thisArg",
"=",
"this",
";",
"var",
"boundFuncs",
"=",
"funcs",
".",
"map",
"(",
"function",
"(",... | The first `func` will be invoked with the other arguments that are passed. These arguments may also be promises, however instead of invoking `func` with the promises, it'll be invoked with the fulfillment values. If an argument promise is rejected, the returned promise will be rejected with the same reason. | [
"The",
"first",
"func",
"will",
"be",
"invoked",
"with",
"the",
"other",
"arguments",
"that",
"are",
"passed",
".",
"These",
"arguments",
"may",
"also",
"be",
"promises",
"however",
"instead",
"of",
"invoking",
"func",
"with",
"the",
"promises",
"it",
"ll",
... | 8420f2dd20e2e3eaced51385fb6b0dc65b81a9fc | https://github.com/novemberborn/legendary/blob/8420f2dd20e2e3eaced51385fb6b0dc65b81a9fc/lib/fn.js#L159-L175 |
53,487 | ForgeRock/node-openam-agent-cache-memcached | lib/memcached-cache.js | MemcachedCache | function MemcachedCache(options) {
options = options || {};
this.client = memjs.Client.create(options.url || 'localhost/11211');
this.expireAfterSeconds = options.expireAfterSeconds || 60;
} | javascript | function MemcachedCache(options) {
options = options || {};
this.client = memjs.Client.create(options.url || 'localhost/11211');
this.expireAfterSeconds = options.expireAfterSeconds || 60;
} | [
"function",
"MemcachedCache",
"(",
"options",
")",
"{",
"options",
"=",
"options",
"||",
"{",
"}",
";",
"this",
".",
"client",
"=",
"memjs",
".",
"Client",
".",
"create",
"(",
"options",
".",
"url",
"||",
"'localhost/11211'",
")",
";",
"this",
".",
"ex... | Cache implementation for memcached
@extends Cache
@param {object} [options] Options
@param {string} [options.url=http://localhost/11211] memcached URL
@param {number} [options.expireAfterSeconds=60] Expiration time in seconds
@example
var memcachedCache = new MemcachedCache({
url: 'cache.example.com:11211',
expireAf... | [
"Cache",
"implementation",
"for",
"memcached"
] | 3705fca89a5c4ef251e70944dcd2d6df81e9aa92 | https://github.com/ForgeRock/node-openam-agent-cache-memcached/blob/3705fca89a5c4ef251e70944dcd2d6df81e9aa92/lib/memcached-cache.js#L26-L31 |
53,488 | espadrine/queread | learn.js | function() {
this.links.forEach(link => {
link.labelCount.forEach((count, label) => {
link.labelWeight.set(label, count / this.numExamples.get(label))
})
})
this.weightsNeedBuilding = false
} | javascript | function() {
this.links.forEach(link => {
link.labelCount.forEach((count, label) => {
link.labelWeight.set(label, count / this.numExamples.get(label))
})
})
this.weightsNeedBuilding = false
} | [
"function",
"(",
")",
"{",
"this",
".",
"links",
".",
"forEach",
"(",
"link",
"=>",
"{",
"link",
".",
"labelCount",
".",
"forEach",
"(",
"(",
"count",
",",
"label",
")",
"=>",
"{",
"link",
".",
"labelWeight",
".",
"set",
"(",
"label",
",",
"count",... | Build link.labelWeight. | [
"Build",
"link",
".",
"labelWeight",
"."
] | 5a0d5017ee1d1911983cc5252a27e160438837f7 | https://github.com/espadrine/queread/blob/5a0d5017ee1d1911983cc5252a27e160438837f7/learn.js#L44-L51 | |
53,489 | smbape/node-fs-explorer | index.js | _explore | function _explore(start, callfile, calldir, options, done) {
const {fs, followSymlink, resolve} = options;
let count = 0;
function take() {
++count;
}
function give(err) {
if (--count === 0 || err) {
done(err);
}
}
// Start process
take();
fs.l... | javascript | function _explore(start, callfile, calldir, options, done) {
const {fs, followSymlink, resolve} = options;
let count = 0;
function take() {
++count;
}
function give(err) {
if (--count === 0 || err) {
done(err);
}
}
// Start process
take();
fs.l... | [
"function",
"_explore",
"(",
"start",
",",
"callfile",
",",
"calldir",
",",
"options",
",",
"done",
")",
"{",
"const",
"{",
"fs",
",",
"followSymlink",
",",
"resolve",
"}",
"=",
"options",
";",
"let",
"count",
"=",
"0",
";",
"function",
"take",
"(",
... | Explore a file or a directory with no checking of paramters correctness
Calling next with err cancels the reading
Not calling next will make the process hang forever
If you want fast reading, call next before processing the file or folder
If you want listing control, call next after you processed the file or folder
@p... | [
"Explore",
"a",
"file",
"or",
"a",
"directory",
"with",
"no",
"checking",
"of",
"paramters",
"correctness"
] | e502aecfbe193506750d2a24680859ae03ca4c1e | https://github.com/smbape/node-fs-explorer/blob/e502aecfbe193506750d2a24680859ae03ca4c1e/index.js#L97-L143 |
53,490 | vorg/fit-rect | index.js | fitRect | function fitRect(rect, target, mode) {
mode = mode || 'contain';
var sw = target[2]/rect[2];
var sh = target[3]/rect[3];
var scale = 1;
if (mode == 'contain') {
scale = Math.min(sw, sh);
}
else if (mode == 'cover') {
scale = Math.max(sw, sh);
}
return [
tar... | javascript | function fitRect(rect, target, mode) {
mode = mode || 'contain';
var sw = target[2]/rect[2];
var sh = target[3]/rect[3];
var scale = 1;
if (mode == 'contain') {
scale = Math.min(sw, sh);
}
else if (mode == 'cover') {
scale = Math.max(sw, sh);
}
return [
tar... | [
"function",
"fitRect",
"(",
"rect",
",",
"target",
",",
"mode",
")",
"{",
"mode",
"=",
"mode",
"||",
"'contain'",
";",
"var",
"sw",
"=",
"target",
"[",
"2",
"]",
"/",
"rect",
"[",
"2",
"]",
";",
"var",
"sh",
"=",
"target",
"[",
"3",
"]",
"/",
... | Fits one rectangle into another
@param {Array} rect [x,y,w,h]
@param {Array} target [x,y,w,h]
@param {String} mode ['contain' (default) or 'cover']
@return {Array} [x,y,w,h] | [
"Fits",
"one",
"rectangle",
"into",
"another"
] | cfd54e8f6d413b90e790bd43290e61e326c33abe | https://github.com/vorg/fit-rect/blob/cfd54e8f6d413b90e790bd43290e61e326c33abe/index.js#L8-L28 |
53,491 | azendal/argon | argon/utility/field_encoder.js | encode | function encode(params) {
var data, property, className;
if(params === null){
return params;
}
className = Object.prototype.toString.call(params).replace('[object ', '').replace(']', '');
if ( className == 'Object' ) {
data = {};
Object.key... | javascript | function encode(params) {
var data, property, className;
if(params === null){
return params;
}
className = Object.prototype.toString.call(params).replace('[object ', '').replace(']', '');
if ( className == 'Object' ) {
data = {};
Object.key... | [
"function",
"encode",
"(",
"params",
")",
"{",
"var",
"data",
",",
"property",
",",
"className",
";",
"if",
"(",
"params",
"===",
"null",
")",
"{",
"return",
"params",
";",
"}",
"className",
"=",
"Object",
".",
"prototype",
".",
"toString",
".",
"call"... | encondes the properties of the object with snake case style in a recursive strategy
@property encode [Function]
@param params [Object] any JavaScript
@return object* [Object] the modified object | [
"encondes",
"the",
"properties",
"of",
"the",
"object",
"with",
"snake",
"case",
"style",
"in",
"a",
"recursive",
"strategy"
] | 0cfd3a3b3731b69abca55c956c757476779ec1bd | https://github.com/azendal/argon/blob/0cfd3a3b3731b69abca55c956c757476779ec1bd/argon/utility/field_encoder.js#L12-L41 |
53,492 | aledbf/deis-api | lib/config.js | list | function list(appName, callback) {
var uri = format('/%s/apps/%s/config/', deis.version, appName);
commons.get(uri, function onListResponse(err, result) {
callback(err, result ? result.values : null);
});
} | javascript | function list(appName, callback) {
var uri = format('/%s/apps/%s/config/', deis.version, appName);
commons.get(uri, function onListResponse(err, result) {
callback(err, result ? result.values : null);
});
} | [
"function",
"list",
"(",
"appName",
",",
"callback",
")",
"{",
"var",
"uri",
"=",
"format",
"(",
"'/%s/apps/%s/config/'",
",",
"deis",
".",
"version",
",",
"appName",
")",
";",
"commons",
".",
"get",
"(",
"uri",
",",
"function",
"onListResponse",
"(",
"e... | List environment variables for an app | [
"List",
"environment",
"variables",
"for",
"an",
"app"
] | f0833789998032b11221a3a617bb566ade1fcc13 | https://github.com/aledbf/deis-api/blob/f0833789998032b11221a3a617bb566ade1fcc13/lib/config.js#L12-L17 |
53,493 | aledbf/deis-api | lib/config.js | set | function set(appName, keyValues, keyLimits, callback) {
var config = {};
if (!isObject(keyValues)) {
return callback(new Error('To set a variable pass an object'));
}
config.values = keyValues;
if (isObject(keyLimits)) {
if (keyLimits.hasOwnProperty('memory')) {
config.memory ... | javascript | function set(appName, keyValues, keyLimits, callback) {
var config = {};
if (!isObject(keyValues)) {
return callback(new Error('To set a variable pass an object'));
}
config.values = keyValues;
if (isObject(keyLimits)) {
if (keyLimits.hasOwnProperty('memory')) {
config.memory ... | [
"function",
"set",
"(",
"appName",
",",
"keyValues",
",",
"keyLimits",
",",
"callback",
")",
"{",
"var",
"config",
"=",
"{",
"}",
";",
"if",
"(",
"!",
"isObject",
"(",
"keyValues",
")",
")",
"{",
"return",
"callback",
"(",
"new",
"Error",
"(",
"'To s... | Set environment variables for an application | [
"Set",
"environment",
"variables",
"for",
"an",
"application"
] | f0833789998032b11221a3a617bb566ade1fcc13 | https://github.com/aledbf/deis-api/blob/f0833789998032b11221a3a617bb566ade1fcc13/lib/config.js#L22-L46 |
53,494 | aledbf/deis-api | lib/config.js | unset | function unset(appName, variableNames, callback) {
if (!util.isArray(variableNames)) {
return callback(new Error('To unset a variable pass an array of names'));
}
var keyValues = {};
variableNames.forEach(function onUnsetResponse(variableName) {
keyValues[variableName] = null;
});
... | javascript | function unset(appName, variableNames, callback) {
if (!util.isArray(variableNames)) {
return callback(new Error('To unset a variable pass an array of names'));
}
var keyValues = {};
variableNames.forEach(function onUnsetResponse(variableName) {
keyValues[variableName] = null;
});
... | [
"function",
"unset",
"(",
"appName",
",",
"variableNames",
",",
"callback",
")",
"{",
"if",
"(",
"!",
"util",
".",
"isArray",
"(",
"variableNames",
")",
")",
"{",
"return",
"callback",
"(",
"new",
"Error",
"(",
"'To unset a variable pass an array of names'",
"... | Unset environment variables for an app | [
"Unset",
"environment",
"variables",
"for",
"an",
"app"
] | f0833789998032b11221a3a617bb566ade1fcc13 | https://github.com/aledbf/deis-api/blob/f0833789998032b11221a3a617bb566ade1fcc13/lib/config.js#L51-L62 |
53,495 | glennschler/spotspec | lib/logger.js | LogWrapper | function LogWrapper (isLogging) {
if (this.constructor.name === 'Function') {
throw new Error('Missing object context')
}
if (!isLogging) {
// stub the logger out
this.logger = {}
this.logger.info = function () {}
this.logger.error = function () {}
this.logger.warn = function () {}
r... | javascript | function LogWrapper (isLogging) {
if (this.constructor.name === 'Function') {
throw new Error('Missing object context')
}
if (!isLogging) {
// stub the logger out
this.logger = {}
this.logger.info = function () {}
this.logger.error = function () {}
this.logger.warn = function () {}
r... | [
"function",
"LogWrapper",
"(",
"isLogging",
")",
"{",
"if",
"(",
"this",
".",
"constructor",
".",
"name",
"===",
"'Function'",
")",
"{",
"throw",
"new",
"Error",
"(",
"'Missing object context'",
")",
"}",
"if",
"(",
"!",
"isLogging",
")",
"{",
"// stub the... | Function to be assigned to an objects logger method
@private
@function LogWrapper | [
"Function",
"to",
"be",
"assigned",
"to",
"an",
"objects",
"logger",
"method"
] | ca6f5b17b84b3536b6b2ce9a472d5ae91c8cd727 | https://github.com/glennschler/spotspec/blob/ca6f5b17b84b3536b6b2ce9a472d5ae91c8cd727/lib/logger.js#L8-L34 |
53,496 | unkhz/almost-static-site | main/index.js | function(suffix) {
if ( suffix.match(/^([a-z]*:?\d*)\/\//) ) { return suffix; }
var base = this.enablePushState ? this.baseUrl : '#/';
return base + suffix.replace(/^\//,'');
} | javascript | function(suffix) {
if ( suffix.match(/^([a-z]*:?\d*)\/\//) ) { return suffix; }
var base = this.enablePushState ? this.baseUrl : '#/';
return base + suffix.replace(/^\//,'');
} | [
"function",
"(",
"suffix",
")",
"{",
"if",
"(",
"suffix",
".",
"match",
"(",
"/",
"^([a-z]*:?\\d*)\\/\\/",
"/",
")",
")",
"{",
"return",
"suffix",
";",
"}",
"var",
"base",
"=",
"this",
".",
"enablePushState",
"?",
"this",
".",
"baseUrl",
":",
"'#/'",
... | Generate url for navigation link href | [
"Generate",
"url",
"for",
"navigation",
"link",
"href"
] | cd09f02ffec06ee2c7494a76ef9a545dbdb58653 | https://github.com/unkhz/almost-static-site/blob/cd09f02ffec06ee2c7494a76ef9a545dbdb58653/main/index.js#L20-L24 | |
53,497 | carrascoMDD/protractor-relaunchable | lib/protractor.js | function(to, from, fnName, setupFn) {
to[fnName] = function() {
if (setupFn) {
setupFn();
}
return from[fnName].apply(from, arguments);
};
} | javascript | function(to, from, fnName, setupFn) {
to[fnName] = function() {
if (setupFn) {
setupFn();
}
return from[fnName].apply(from, arguments);
};
} | [
"function",
"(",
"to",
",",
"from",
",",
"fnName",
",",
"setupFn",
")",
"{",
"to",
"[",
"fnName",
"]",
"=",
"function",
"(",
")",
"{",
"if",
"(",
"setupFn",
")",
"{",
"setupFn",
"(",
")",
";",
"}",
"return",
"from",
"[",
"fnName",
"]",
".",
"ap... | Mix a function from one object onto another. The function will still be
called in the context of the original object.
@private
@param {Object} to
@param {Object} from
@param {string} fnName
@param {function=} setupFn | [
"Mix",
"a",
"function",
"from",
"one",
"object",
"onto",
"another",
".",
"The",
"function",
"will",
"still",
"be",
"called",
"in",
"the",
"context",
"of",
"the",
"original",
"object",
"."
] | c18e17ecd8b5b036217f87680800c6e14b47361f | https://github.com/carrascoMDD/protractor-relaunchable/blob/c18e17ecd8b5b036217f87680800c6e14b47361f/lib/protractor.js#L53-L60 | |
53,498 | carrascoMDD/protractor-relaunchable | lib/protractor.js | function() {
return elementArrayFinder.getWebElements().then(function(webElements) {
if (webElements.length === 0) {
throw new webdriver.error.Error(
webdriver.error.ErrorCode.NO_SUCH_ELEMENT,
'No element found using locator: ' +
elementArrayFinder.l... | javascript | function() {
return elementArrayFinder.getWebElements().then(function(webElements) {
if (webElements.length === 0) {
throw new webdriver.error.Error(
webdriver.error.ErrorCode.NO_SUCH_ELEMENT,
'No element found using locator: ' +
elementArrayFinder.l... | [
"function",
"(",
")",
"{",
"return",
"elementArrayFinder",
".",
"getWebElements",
"(",
")",
".",
"then",
"(",
"function",
"(",
"webElements",
")",
"{",
"if",
"(",
"webElements",
".",
"length",
"===",
"0",
")",
"{",
"throw",
"new",
"webdriver",
".",
"erro... | This filter verifies that there is only 1 element returned by the elementArrayFinder. It will warn if there are more than 1 element and throw an error if there are no elements. | [
"This",
"filter",
"verifies",
"that",
"there",
"is",
"only",
"1",
"element",
"returned",
"by",
"the",
"elementArrayFinder",
".",
"It",
"will",
"warn",
"if",
"there",
"are",
"more",
"than",
"1",
"element",
"and",
"throw",
"an",
"error",
"if",
"there",
"are"... | c18e17ecd8b5b036217f87680800c6e14b47361f | https://github.com/carrascoMDD/protractor-relaunchable/blob/c18e17ecd8b5b036217f87680800c6e14b47361f/lib/protractor.js#L689-L705 | |
53,499 | jonschlinkert/conflicts | lib/diff.js | diffFile | function diffFile(existing, proposed, options) {
let { ensureContents, exists, readChunk } = utils;
let opts = options || {};
let contentsA = existing.contents;
let contentsB = proposed.contents;
if (!contentsA && exists(existing)) {
contentsA = readChunk(existing.path, 0, 4 + 4096);
}
if (!content... | javascript | function diffFile(existing, proposed, options) {
let { ensureContents, exists, readChunk } = utils;
let opts = options || {};
let contentsA = existing.contents;
let contentsB = proposed.contents;
if (!contentsA && exists(existing)) {
contentsA = readChunk(existing.path, 0, 4 + 4096);
}
if (!content... | [
"function",
"diffFile",
"(",
"existing",
",",
"proposed",
",",
"options",
")",
"{",
"let",
"{",
"ensureContents",
",",
"exists",
",",
"readChunk",
"}",
"=",
"utils",
";",
"let",
"opts",
"=",
"options",
"||",
"{",
"}",
";",
"let",
"contentsA",
"=",
"exi... | Returns a formatted diff for binary or text files | [
"Returns",
"a",
"formatted",
"diff",
"for",
"binary",
"or",
"text",
"files"
] | 0f45ab63f6cc24a03ce381b3d2159283923bc20d | https://github.com/jonschlinkert/conflicts/blob/0f45ab63f6cc24a03ce381b3d2159283923bc20d/lib/diff.js#L10-L35 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.