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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
52,400 | berkeleybop/bbop-core | lib/core.js | function(len){
var random_base = [
'1', '2', '3', '4', '5', '6', '7', '8', '9', '0',
'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm',
'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'
];
var length = len || 10;
var cache = new Array();
for( var ii = 0; ii < length; ii+... | javascript | function(len){
var random_base = [
'1', '2', '3', '4', '5', '6', '7', '8', '9', '0',
'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm',
'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'
];
var length = len || 10;
var cache = new Array();
for( var ii = 0; ii < length; ii+... | [
"function",
"(",
"len",
")",
"{",
"var",
"random_base",
"=",
"[",
"'1'",
",",
"'2'",
",",
"'3'",
",",
"'4'",
",",
"'5'",
",",
"'6'",
",",
"'7'",
",",
"'8'",
",",
"'9'",
",",
"'0'",
",",
"'a'",
",",
"'b'",
",",
"'c'",
",",
"'d'",
",",
"'e'",
... | Random number generator of fixed length. Return a random number
string of length len.
@param {} len - the number of random character to return.
@returns {string} string | [
"Random",
"number",
"generator",
"of",
"fixed",
"length",
".",
"Return",
"a",
"random",
"number",
"string",
"of",
"length",
"len",
"."
] | d9ce82a3a7d4f5e7300c0b637d8f7ff0e6969adf | https://github.com/berkeleybop/bbop-core/blob/d9ce82a3a7d4f5e7300c0b637d8f7ff0e6969adf/lib/core.js#L716-L730 | |
52,401 | berkeleybop/bbop-core | lib/core.js | function(url){
var retlist = [];
// Pull parameters.
var tmp = url.split('?');
var path = '';
var parms = [];
if( ! tmp[1] ){ // catch bad url--nothing before '?'
parms = tmp[0].split('&');
}else{ // normal structure
path = tmp[0];
parms = tmp[1].split('&');
}
// Decompose parameters.
each(p... | javascript | function(url){
var retlist = [];
// Pull parameters.
var tmp = url.split('?');
var path = '';
var parms = [];
if( ! tmp[1] ){ // catch bad url--nothing before '?'
parms = tmp[0].split('&');
}else{ // normal structure
path = tmp[0];
parms = tmp[1].split('&');
}
// Decompose parameters.
each(p... | [
"function",
"(",
"url",
")",
"{",
"var",
"retlist",
"=",
"[",
"]",
";",
"// Pull parameters.",
"var",
"tmp",
"=",
"url",
".",
"split",
"(",
"'?'",
")",
";",
"var",
"path",
"=",
"''",
";",
"var",
"parms",
"=",
"[",
"]",
";",
"if",
"(",
"!",
"tmp... | Return the parameters part of a URL.
Unit tests make the edge cases clear.
@param {} url - url (or similar string)
@returns {Array} list of part lists | [
"Return",
"the",
"parameters",
"part",
"of",
"a",
"URL",
"."
] | d9ce82a3a7d4f5e7300c0b637d8f7ff0e6969adf | https://github.com/berkeleybop/bbop-core/blob/d9ce82a3a7d4f5e7300c0b637d8f7ff0e6969adf/lib/core.js#L740-L766 | |
52,402 | berkeleybop/bbop-core | lib/core.js | function(str){
var retstr = str;
if( ! us.isUndefined(str) && str.length > 2 ){
var end = str.length -1;
if( str.charAt(0) == '"' && str.charAt(end) == '"' ){
retstr = str.substr(1, end -1);
}
}
return retstr;
} | javascript | function(str){
var retstr = str;
if( ! us.isUndefined(str) && str.length > 2 ){
var end = str.length -1;
if( str.charAt(0) == '"' && str.charAt(end) == '"' ){
retstr = str.substr(1, end -1);
}
}
return retstr;
} | [
"function",
"(",
"str",
")",
"{",
"var",
"retstr",
"=",
"str",
";",
"if",
"(",
"!",
"us",
".",
"isUndefined",
"(",
"str",
")",
"&&",
"str",
".",
"length",
">",
"2",
")",
"{",
"var",
"end",
"=",
"str",
".",
"length",
"-",
"1",
";",
"if",
"(",
... | Remove the quotes from a string.
@param {string} str - the string to dequote
@returns {string} the dequoted string (or the original string) | [
"Remove",
"the",
"quotes",
"from",
"a",
"string",
"."
] | d9ce82a3a7d4f5e7300c0b637d8f7ff0e6969adf | https://github.com/berkeleybop/bbop-core/blob/d9ce82a3a7d4f5e7300c0b637d8f7ff0e6969adf/lib/core.js#L845-L856 | |
52,403 | berkeleybop/bbop-core | lib/core.js | function(str, delimiter){
var retlist = null;
if( ! us.isUndefined(str) ){
if( us.isUndefined(delimiter) ){
delimiter = /\s+/;
}
retlist = str.split(delimiter);
}
return retlist;
} | javascript | function(str, delimiter){
var retlist = null;
if( ! us.isUndefined(str) ){
if( us.isUndefined(delimiter) ){
delimiter = /\s+/;
}
retlist = str.split(delimiter);
}
return retlist;
} | [
"function",
"(",
"str",
",",
"delimiter",
")",
"{",
"var",
"retlist",
"=",
"null",
";",
"if",
"(",
"!",
"us",
".",
"isUndefined",
"(",
"str",
")",
")",
"{",
"if",
"(",
"us",
".",
"isUndefined",
"(",
"delimiter",
")",
")",
"{",
"delimiter",
"=",
"... | Break apart a string on certain delimiter.
@param {} str - the string to ensure that has the property
@param {} delimiter - *[optional]* either a string or a simple regexp; defaults to ws
@returns {Array} a list of separated substrings | [
"Break",
"apart",
"a",
"string",
"on",
"certain",
"delimiter",
"."
] | d9ce82a3a7d4f5e7300c0b637d8f7ff0e6969adf | https://github.com/berkeleybop/bbop-core/blob/d9ce82a3a7d4f5e7300c0b637d8f7ff0e6969adf/lib/core.js#L936-L949 | |
52,404 | wshager/js-rrb-vector | lib/concat.js | insertRight | function insertRight(parent, node) {
var index = parent.length - 1;
parent[index] = node;
parent.sizes[index] = (0, _util.length)(node) + (index > 0 ? parent.sizes[index - 1] : 0);
} | javascript | function insertRight(parent, node) {
var index = parent.length - 1;
parent[index] = node;
parent.sizes[index] = (0, _util.length)(node) + (index > 0 ? parent.sizes[index - 1] : 0);
} | [
"function",
"insertRight",
"(",
"parent",
",",
"node",
")",
"{",
"var",
"index",
"=",
"parent",
".",
"length",
"-",
"1",
";",
"parent",
"[",
"index",
"]",
"=",
"node",
";",
"parent",
".",
"sizes",
"[",
"index",
"]",
"=",
"(",
"0",
",",
"_util",
"... | Helperfunctions for _concat. Replaces a child node at the side of the parent. | [
"Helperfunctions",
"for",
"_concat",
".",
"Replaces",
"a",
"child",
"node",
"at",
"the",
"side",
"of",
"the",
"parent",
"."
] | 766c3c12f658cc251dce028460c4eca4e33d5254 | https://github.com/wshager/js-rrb-vector/blob/766c3c12f658cc251dce028460c4eca4e33d5254/lib/concat.js#L108-L112 |
52,405 | integreat-io/great-uri-template | lib/utils/splitTemplate.js | splitTemplate | function splitTemplate (template) {
if (!template) {
return []
}
return split(template).filter((seg) => seg !== '' && seg !== undefined)
} | javascript | function splitTemplate (template) {
if (!template) {
return []
}
return split(template).filter((seg) => seg !== '' && seg !== undefined)
} | [
"function",
"splitTemplate",
"(",
"template",
")",
"{",
"if",
"(",
"!",
"template",
")",
"{",
"return",
"[",
"]",
"}",
"return",
"split",
"(",
"template",
")",
".",
"filter",
"(",
"(",
"seg",
")",
"=>",
"seg",
"!==",
"''",
"&&",
"seg",
"!==",
"unde... | Split the given template into segments.
@param {string} template - The template to split
@returns {string[]} An array of string segments | [
"Split",
"the",
"given",
"template",
"into",
"segments",
"."
] | 0e896ead0567737cf31a4a8b76a26cfa6ce60759 | https://github.com/integreat-io/great-uri-template/blob/0e896ead0567737cf31a4a8b76a26cfa6ce60759/lib/utils/splitTemplate.js#L34-L39 |
52,406 | tjmehta/docker-frame | index.js | createHeader | function createHeader (type, size) {
var header = new Buffer(8);
header.writeUInt8(type, 0);
header.writeUInt32BE(size, 4);
return header;
} | javascript | function createHeader (type, size) {
var header = new Buffer(8);
header.writeUInt8(type, 0);
header.writeUInt32BE(size, 4);
return header;
} | [
"function",
"createHeader",
"(",
"type",
",",
"size",
")",
"{",
"var",
"header",
"=",
"new",
"Buffer",
"(",
"8",
")",
";",
"header",
".",
"writeUInt8",
"(",
"type",
",",
"0",
")",
";",
"header",
".",
"writeUInt32BE",
"(",
"size",
",",
"4",
")",
";"... | create a docker frame header
@param {number} ioConnectionType - 2=stderr, 1=stdout, 0=stdin
@param {string|buffer} payloadData
@returns {buffer} header - frame header (type, length) as buffer | [
"create",
"a",
"docker",
"frame",
"header"
] | 8d22ed6a1ab5ad9ca3c5f82dca4efd92aa53b42b | https://github.com/tjmehta/docker-frame/blob/8d22ed6a1ab5ad9ca3c5f82dca4efd92aa53b42b/index.js#L30-L35 |
52,407 | tjmehta/docker-frame | index.js | validateArgs | function validateArgs (type, payload) {
if (!type) {
return new Error('type is required');
}
if (!payload) {
return new Error('payload is required');
}
if (!isNumber(type)) {
return new Error('type must be a number');
}
if (!isBuffer(payload) && !isString(payload)) {
return new Error('payl... | javascript | function validateArgs (type, payload) {
if (!type) {
return new Error('type is required');
}
if (!payload) {
return new Error('payload is required');
}
if (!isNumber(type)) {
return new Error('type must be a number');
}
if (!isBuffer(payload) && !isString(payload)) {
return new Error('payl... | [
"function",
"validateArgs",
"(",
"type",
",",
"payload",
")",
"{",
"if",
"(",
"!",
"type",
")",
"{",
"return",
"new",
"Error",
"(",
"'type is required'",
")",
";",
"}",
"if",
"(",
"!",
"payload",
")",
"{",
"return",
"new",
"Error",
"(",
"'payload is re... | validates arguments for createFrame
@param {number} ioConnectionType - 2=stderr, 1=stdout, 0=stdin
@param {string|buffer} payloadData
@return {undefined|error} error - returns error if an argument is invalid | [
"validates",
"arguments",
"for",
"createFrame"
] | 8d22ed6a1ab5ad9ca3c5f82dca4efd92aa53b42b | https://github.com/tjmehta/docker-frame/blob/8d22ed6a1ab5ad9ca3c5f82dca4efd92aa53b42b/index.js#L43-L59 |
52,408 | hydrojs/co | index.js | sync | function sync(fn) {
return function(done) {
var res = isGenerator(fn) ? co(fn) : fn(done);
if (isPromise(res)) {
res.then(function(){ done(); }, done);
} else {
fn.length || done();
}
};
} | javascript | function sync(fn) {
return function(done) {
var res = isGenerator(fn) ? co(fn) : fn(done);
if (isPromise(res)) {
res.then(function(){ done(); }, done);
} else {
fn.length || done();
}
};
} | [
"function",
"sync",
"(",
"fn",
")",
"{",
"return",
"function",
"(",
"done",
")",
"{",
"var",
"res",
"=",
"isGenerator",
"(",
"fn",
")",
"?",
"co",
"(",
"fn",
")",
":",
"fn",
"(",
"done",
")",
";",
"if",
"(",
"isPromise",
"(",
"res",
")",
")",
... | Wrap `fn` to handle any attempts at asynchrony
@param {Function|GeneratorFunction} fn
@return {Function} | [
"Wrap",
"fn",
"to",
"handle",
"any",
"attempts",
"at",
"asynchrony"
] | 8c429a795a27e6ebcae83adc69f73b06d9aca607 | https://github.com/hydrojs/co/blob/8c429a795a27e6ebcae83adc69f73b06d9aca607/index.js#L36-L45 |
52,409 | williamkapke/consumer | consumer.js | function(regex){
//if it isn't global, `exec()` will not start at `lastIndex`
if(!regex.global)
regex.compile(regex.source, flags(regex));
regex.lastIndex = this.position;
var m = regex.exec(this.source);
//all matches must start at the current position.
if(m && m.index!=this.position){
return null;
... | javascript | function(regex){
//if it isn't global, `exec()` will not start at `lastIndex`
if(!regex.global)
regex.compile(regex.source, flags(regex));
regex.lastIndex = this.position;
var m = regex.exec(this.source);
//all matches must start at the current position.
if(m && m.index!=this.position){
return null;
... | [
"function",
"(",
"regex",
")",
"{",
"//if it isn't global, `exec()` will not start at `lastIndex`",
"if",
"(",
"!",
"regex",
".",
"global",
")",
"regex",
".",
"compile",
"(",
"regex",
".",
"source",
",",
"flags",
"(",
"regex",
")",
")",
";",
"regex",
".",
"l... | Consume the characters matched by the 'regex'.
@param {RegExp} regex | [
"Consume",
"the",
"characters",
"matched",
"by",
"the",
"regex",
"."
] | 03ad06f555447ba5dd626e3e94066452a3bc3f3f | https://github.com/williamkapke/consumer/blob/03ad06f555447ba5dd626e3e94066452a3bc3f3f/consumer.js#L40-L54 | |
52,410 | wshager/js-rrb-vector | lib/transient.js | get | function get(tree, i) {
if (i < 0 || i >= tree.size) {
return undefined;
}
var offset = (0, _util.tailOffset)(tree);
if (i >= offset) {
return tree.tail[i - offset];
}
return (0, _util.getRoot)(i, tree.root);
} | javascript | function get(tree, i) {
if (i < 0 || i >= tree.size) {
return undefined;
}
var offset = (0, _util.tailOffset)(tree);
if (i >= offset) {
return tree.tail[i - offset];
}
return (0, _util.getRoot)(i, tree.root);
} | [
"function",
"get",
"(",
"tree",
",",
"i",
")",
"{",
"if",
"(",
"i",
"<",
"0",
"||",
"i",
">=",
"tree",
".",
"size",
")",
"{",
"return",
"undefined",
";",
"}",
"var",
"offset",
"=",
"(",
"0",
",",
"_util",
".",
"tailOffset",
")",
"(",
"tree",
... | Gets the value at index i recursively. | [
"Gets",
"the",
"value",
"at",
"index",
"i",
"recursively",
"."
] | 766c3c12f658cc251dce028460c4eca4e33d5254 | https://github.com/wshager/js-rrb-vector/blob/766c3c12f658cc251dce028460c4eca4e33d5254/lib/transient.js#L64-L73 |
52,411 | wunderbyte/grunt-spiritual-edbml | tasks/things/assistant.js | formatjson | function formatjson(pis) {
return pis.map(function(pi) {
var newpi = {};
newpi[pi.tag] = pi.att;
return newpi;
});
} | javascript | function formatjson(pis) {
return pis.map(function(pi) {
var newpi = {};
newpi[pi.tag] = pi.att;
return newpi;
});
} | [
"function",
"formatjson",
"(",
"pis",
")",
"{",
"return",
"pis",
".",
"map",
"(",
"function",
"(",
"pi",
")",
"{",
"var",
"newpi",
"=",
"{",
"}",
";",
"newpi",
"[",
"pi",
".",
"tag",
"]",
"=",
"pi",
".",
"att",
";",
"return",
"newpi",
";",
"}",... | Format processing instructions
for slight improved readability.
@param {Array<Instruction>} pis
@returns {Array<object>} | [
"Format",
"processing",
"instructions",
"for",
"slight",
"improved",
"readability",
"."
] | 2ba0aa8042eceee917f1ee48c7881345df3bce46 | https://github.com/wunderbyte/grunt-spiritual-edbml/blob/2ba0aa8042eceee917f1ee48c7881345df3bce46/tasks/things/assistant.js#L71-L77 |
52,412 | LAJW/co-reduce-any | index.js | enumerate | function enumerate(collection) {
if (isObject(collection)) {
if (collection instanceof Map) {
return enumerateMap(collection)
} else if (isIterable(collection)) {
return enumerateIterable(collection)
} else {
return enumerateObject(collection)
}
... | javascript | function enumerate(collection) {
if (isObject(collection)) {
if (collection instanceof Map) {
return enumerateMap(collection)
} else if (isIterable(collection)) {
return enumerateIterable(collection)
} else {
return enumerateObject(collection)
}
... | [
"function",
"enumerate",
"(",
"collection",
")",
"{",
"if",
"(",
"isObject",
"(",
"collection",
")",
")",
"{",
"if",
"(",
"collection",
"instanceof",
"Map",
")",
"{",
"return",
"enumerateMap",
"(",
"collection",
")",
"}",
"else",
"if",
"(",
"isIterable",
... | Inspired by Python's enumerate | [
"Inspired",
"by",
"Python",
"s",
"enumerate"
] | 3b1b7c57c8f3f8fe0deb6aec40022022b1c62b4e | https://github.com/LAJW/co-reduce-any/blob/3b1b7c57c8f3f8fe0deb6aec40022022b1c62b4e/index.js#L48-L60 |
52,413 | andrewscwei/requiem | src/dom/sightread.js | sightread | function sightread(element, childRegistry) {
if (!element || element === document) element = window;
if (!childRegistry && !getChildRegistry(element)) return;
// Clear the child registry.
if (!childRegistry) {
element.__private__.childRegistry = {};
childRegistry = getChildRegistry(element);
}
ele... | javascript | function sightread(element, childRegistry) {
if (!element || element === document) element = window;
if (!childRegistry && !getChildRegistry(element)) return;
// Clear the child registry.
if (!childRegistry) {
element.__private__.childRegistry = {};
childRegistry = getChildRegistry(element);
}
ele... | [
"function",
"sightread",
"(",
"element",
",",
"childRegistry",
")",
"{",
"if",
"(",
"!",
"element",
"||",
"element",
"===",
"document",
")",
"element",
"=",
"window",
";",
"if",
"(",
"!",
"childRegistry",
"&&",
"!",
"getChildRegistry",
"(",
"element",
")",... | Crawls a DOM element, creates a child registry for the element and registers
all of its children into the child registry, recursively.
@param {Node} [element=document] - Target element for sightreading. By
default this will be the document.
@param {Object} [childRegistry] - Target child registry to register child
elem... | [
"Crawls",
"a",
"DOM",
"element",
"creates",
"a",
"child",
"registry",
"for",
"the",
"element",
"and",
"registers",
"all",
"of",
"its",
"children",
"into",
"the",
"child",
"registry",
"recursively",
"."
] | c4182bfffc9841c6de5718f689ad3c2060511777 | https://github.com/andrewscwei/requiem/blob/c4182bfffc9841c6de5718f689ad3c2060511777/src/dom/sightread.js#L23-L53 |
52,414 | inviqa/deck-task-registry | src/styles/lintStyles.js | lintStyles | function lintStyles(conf, undertaker) {
const sassSrc = path.join(conf.themeConfig.root, conf.themeConfig.sass.src, '**', '*.scss');
let stylelintConf = {
config: require('./stylelint.config'),
reporters: [{
formatter: 'string',
console: true
}],
failAfterError: conf.productionMode
}... | javascript | function lintStyles(conf, undertaker) {
const sassSrc = path.join(conf.themeConfig.root, conf.themeConfig.sass.src, '**', '*.scss');
let stylelintConf = {
config: require('./stylelint.config'),
reporters: [{
formatter: 'string',
console: true
}],
failAfterError: conf.productionMode
}... | [
"function",
"lintStyles",
"(",
"conf",
",",
"undertaker",
")",
"{",
"const",
"sassSrc",
"=",
"path",
".",
"join",
"(",
"conf",
".",
"themeConfig",
".",
"root",
",",
"conf",
".",
"themeConfig",
".",
"sass",
".",
"src",
",",
"'**'",
",",
"'*.scss'",
")",... | Lint project styles.
@param {ConfigParser} conf A configuration parser object.
@param {Undertaker} undertaker An Undertaker instance.
@returns {Stream} A stream of files. | [
"Lint",
"project",
"styles",
"."
] | 4c31787b978e9d99a47052e090d4589a50cd3015 | https://github.com/inviqa/deck-task-registry/blob/4c31787b978e9d99a47052e090d4589a50cd3015/src/styles/lintStyles.js#L15-L36 |
52,415 | chanoch/simple-react-router | src/SimpleReactRouter.js | render | function render(history, routes, store) {
const resolve = resolver(routes);
return function(location) {
resolve(location)
.then(config => {
renderPage(config.page(store, history), routes);
const actionParams = config.matchRoute(location.pathname).params;
c... | javascript | function render(history, routes, store) {
const resolve = resolver(routes);
return function(location) {
resolve(location)
.then(config => {
renderPage(config.page(store, history), routes);
const actionParams = config.matchRoute(location.pathname).params;
c... | [
"function",
"render",
"(",
"history",
",",
"routes",
",",
"store",
")",
"{",
"const",
"resolve",
"=",
"resolver",
"(",
"routes",
")",
";",
"return",
"function",
"(",
"location",
")",
"{",
"resolve",
"(",
"location",
")",
".",
"then",
"(",
"config",
"=>... | Render the new 'page' given by the route.
In order for this to work, each path or location in the application need to have
the root component for it defined. The page component will be passed the store
in the props to extract rendering data.
'page' here refers to the fact that
the user will perceive the new applicati... | [
"Render",
"the",
"new",
"page",
"given",
"by",
"the",
"route",
"."
] | 3c71feeeb039111f33c934257732e2ea6ddde9ff | https://github.com/chanoch/simple-react-router/blob/3c71feeeb039111f33c934257732e2ea6ddde9ff/src/SimpleReactRouter.js#L75-L89 |
52,416 | chanoch/simple-react-router | src/SimpleReactRouter.js | resolver | function resolver(routes) {
return async function(context) {
const uri = context.error ? '/error' : context.pathname;
return routes.find(route => route.matchRoute(uri));
}
} | javascript | function resolver(routes) {
return async function(context) {
const uri = context.error ? '/error' : context.pathname;
return routes.find(route => route.matchRoute(uri));
}
} | [
"function",
"resolver",
"(",
"routes",
")",
"{",
"return",
"async",
"function",
"(",
"context",
")",
"{",
"const",
"uri",
"=",
"context",
".",
"error",
"?",
"'/error'",
":",
"context",
".",
"pathname",
";",
"return",
"routes",
".",
"find",
"(",
"route",
... | Resolve the component to render based on the pathname given as the parameter's
property.
If the location cannot be resolved then throw an error. The resolver will resolve
the component configured against /error to render an error page
@param {Object} context - an object containing a pathname to resove or an error
TO... | [
"Resolve",
"the",
"component",
"to",
"render",
"based",
"on",
"the",
"pathname",
"given",
"as",
"the",
"parameter",
"s",
"property",
"."
] | 3c71feeeb039111f33c934257732e2ea6ddde9ff | https://github.com/chanoch/simple-react-router/blob/3c71feeeb039111f33c934257732e2ea6ddde9ff/src/SimpleReactRouter.js#L102-L107 |
52,417 | sendanor/nor-db | lib/core/Connection.js | Connection | function Connection(conn) {
if(!(this instanceof Connection)) {
return new Connection(conn);
}
var self = this;
if(!conn) { throw new TypeError("no connection set"); }
self._connection = conn;
} | javascript | function Connection(conn) {
if(!(this instanceof Connection)) {
return new Connection(conn);
}
var self = this;
if(!conn) { throw new TypeError("no connection set"); }
self._connection = conn;
} | [
"function",
"Connection",
"(",
"conn",
")",
"{",
"if",
"(",
"!",
"(",
"this",
"instanceof",
"Connection",
")",
")",
"{",
"return",
"new",
"Connection",
"(",
"conn",
")",
";",
"}",
"var",
"self",
"=",
"this",
";",
"if",
"(",
"!",
"conn",
")",
"{",
... | Base class `Connection` constructor | [
"Base",
"class",
"Connection",
"constructor"
] | db4b78691956a49370fc9d9a4eed27e7d3720aeb | https://github.com/sendanor/nor-db/blob/db4b78691956a49370fc9d9a4eed27e7d3720aeb/lib/core/Connection.js#L9-L16 |
52,418 | linyngfly/omelo-admin | lib/modules/monitorLog.js | function(opts) {
opts = opts || {};
this.root = opts.path;
this.interval = opts.interval || DEFAULT_INTERVAL;
} | javascript | function(opts) {
opts = opts || {};
this.root = opts.path;
this.interval = opts.interval || DEFAULT_INTERVAL;
} | [
"function",
"(",
"opts",
")",
"{",
"opts",
"=",
"opts",
"||",
"{",
"}",
";",
"this",
".",
"root",
"=",
"opts",
".",
"path",
";",
"this",
".",
"interval",
"=",
"opts",
".",
"interval",
"||",
"DEFAULT_INTERVAL",
";",
"}"
] | Initialize a new 'Module' with the given 'opts'
@class Module
@constructor
@param {object} opts
@api public | [
"Initialize",
"a",
"new",
"Module",
"with",
"the",
"given",
"opts"
] | 1cd692c16ab63b9c0d4009535f300f2ca584b691 | https://github.com/linyngfly/omelo-admin/blob/1cd692c16ab63b9c0d4009535f300f2ca584b691/lib/modules/monitorLog.js#L26-L30 | |
52,419 | derdesign/protos | drivers/mysql.js | MySQL | function MySQL(config) {
var self = this;
config = config || {};
config.host = config.host || 'localhost';
config.port = config.port || 3306;
this.className = this.constructor.name;
this.config = config;
// Set client
this.client = mysql.createConnection(config);
// Assign storage
if... | javascript | function MySQL(config) {
var self = this;
config = config || {};
config.host = config.host || 'localhost';
config.port = config.port || 3306;
this.className = this.constructor.name;
this.config = config;
// Set client
this.client = mysql.createConnection(config);
// Assign storage
if... | [
"function",
"MySQL",
"(",
"config",
")",
"{",
"var",
"self",
"=",
"this",
";",
"config",
"=",
"config",
"||",
"{",
"}",
";",
"config",
".",
"host",
"=",
"config",
".",
"host",
"||",
"'localhost'",
";",
"config",
".",
"port",
"=",
"config",
".",
"po... | MySQL Driver class
Driver configuration
config: {
host: 'localhost',
port: 3306,
user: 'db_user',
password: 'db_password',
database: 'db_name',
debug: false,
storage: 'redis'
}
@class MySQL
@extends Driver
@constructor
@param {object} app Application instance
@param {object} config Driver configuration | [
"MySQL",
"Driver",
"class"
] | 0b679b2a7581dfbb5d065fd4b0914436ef4ef2c9 | https://github.com/derdesign/protos/blob/0b679b2a7581dfbb5d065fd4b0914436ef4ef2c9/drivers/mysql.js#L32-L60 |
52,420 | arjunmehta/node-ansi-state | main.js | ANSIState | function ANSIState(legacy) {
var feed = '',
last_match = '',
stream_match = [],
_this = this;
PassThrough.call(this);
this.attrs = {};
this.reset();
this.is_reset = false;
this.setEncoding('utf8');
this.on('data', function(chunk) {
feed += chunk;
i... | javascript | function ANSIState(legacy) {
var feed = '',
last_match = '',
stream_match = [],
_this = this;
PassThrough.call(this);
this.attrs = {};
this.reset();
this.is_reset = false;
this.setEncoding('utf8');
this.on('data', function(chunk) {
feed += chunk;
i... | [
"function",
"ANSIState",
"(",
"legacy",
")",
"{",
"var",
"feed",
"=",
"''",
",",
"last_match",
"=",
"''",
",",
"stream_match",
"=",
"[",
"]",
",",
"_this",
"=",
"this",
";",
"PassThrough",
".",
"call",
"(",
"this",
")",
";",
"this",
".",
"attrs",
"... | ANSI state constructor | [
"ANSI",
"state",
"constructor"
] | f667315f5223717c25e4c13d4072c4a0b650e202 | https://github.com/arjunmehta/node-ansi-state/blob/f667315f5223717c25e4c13d4072c4a0b650e202/main.js#L26-L57 |
52,421 | vkiding/jud-vue-render | src/render/browser/extend/components/tabheader/index.js | initClickEvent | function initClickEvent (tabheader) {
const box = tabheader.box
box.addEventListener('click', function (evt) {
let target = evt.target
if (target.nodeName === 'UL') {
return
}
if (target.parentNode.nodeName === 'LI') {
target = target.parentNode
}
const floor = target.getAttri... | javascript | function initClickEvent (tabheader) {
const box = tabheader.box
box.addEventListener('click', function (evt) {
let target = evt.target
if (target.nodeName === 'UL') {
return
}
if (target.parentNode.nodeName === 'LI') {
target = target.parentNode
}
const floor = target.getAttri... | [
"function",
"initClickEvent",
"(",
"tabheader",
")",
"{",
"const",
"box",
"=",
"tabheader",
".",
"box",
"box",
".",
"addEventListener",
"(",
"'click'",
",",
"function",
"(",
"evt",
")",
"{",
"let",
"target",
"=",
"evt",
".",
"target",
"if",
"(",
"target"... | init events. | [
"init",
"events",
"."
] | 07d8ab08d0ef86cf2819e5f2bf1f4b06381f4d47 | https://github.com/vkiding/jud-vue-render/blob/07d8ab08d0ef86cf2819e5f2bf1f4b06381f4d47/src/render/browser/extend/components/tabheader/index.js#L101-L124 |
52,422 | vkiding/jud-vue-render | src/render/browser/extend/components/tabheader/index.js | doScroll | function doScroll (node, val, finish) {
if (!val) {
return
}
if (finish === undefined) {
finish = Math.abs(val)
}
if (finish <= 0) {
return
}
setTimeout(function () {
if (val > 0) {
node.scrollLeft += 2
}
else {
node.scrollLeft -= 2
}
finish -= 2
doScroll... | javascript | function doScroll (node, val, finish) {
if (!val) {
return
}
if (finish === undefined) {
finish = Math.abs(val)
}
if (finish <= 0) {
return
}
setTimeout(function () {
if (val > 0) {
node.scrollLeft += 2
}
else {
node.scrollLeft -= 2
}
finish -= 2
doScroll... | [
"function",
"doScroll",
"(",
"node",
",",
"val",
",",
"finish",
")",
"{",
"if",
"(",
"!",
"val",
")",
"{",
"return",
"}",
"if",
"(",
"finish",
"===",
"undefined",
")",
"{",
"finish",
"=",
"Math",
".",
"abs",
"(",
"val",
")",
"}",
"if",
"(",
"fi... | scroll the tabheader. positive val means to scroll right. negative val means to scroll left. | [
"scroll",
"the",
"tabheader",
".",
"positive",
"val",
"means",
"to",
"scroll",
"right",
".",
"negative",
"val",
"means",
"to",
"scroll",
"left",
"."
] | 07d8ab08d0ef86cf2819e5f2bf1f4b06381f4d47 | https://github.com/vkiding/jud-vue-render/blob/07d8ab08d0ef86cf2819e5f2bf1f4b06381f4d47/src/render/browser/extend/components/tabheader/index.js#L164-L187 |
52,423 | vkiding/jud-vue-render | src/render/browser/extend/components/tabheader/index.js | getScrollVal | function getScrollVal (rect, node) {
const left = node.previousSibling
const right = node.nextSibling
let scrollVal
// process left-side element first.
if (left) {
const leftRect = left.getBoundingClientRect()
// only need to compare the value of left.
if (leftRect.left < rect.left) {
scrol... | javascript | function getScrollVal (rect, node) {
const left = node.previousSibling
const right = node.nextSibling
let scrollVal
// process left-side element first.
if (left) {
const leftRect = left.getBoundingClientRect()
// only need to compare the value of left.
if (leftRect.left < rect.left) {
scrol... | [
"function",
"getScrollVal",
"(",
"rect",
",",
"node",
")",
"{",
"const",
"left",
"=",
"node",
".",
"previousSibling",
"const",
"right",
"=",
"node",
".",
"nextSibling",
"let",
"scrollVal",
"// process left-side element first.",
"if",
"(",
"left",
")",
"{",
"co... | get scroll distance. | [
"get",
"scroll",
"distance",
"."
] | 07d8ab08d0ef86cf2819e5f2bf1f4b06381f4d47 | https://github.com/vkiding/jud-vue-render/blob/07d8ab08d0ef86cf2819e5f2bf1f4b06381f4d47/src/render/browser/extend/components/tabheader/index.js#L190-L224 |
52,424 | vkiding/jud-vue-render | src/render/browser/extend/components/tabheader/index.js | fireEvent | function fireEvent (element, type, data) {
const evt = document.createEvent('Event')
evt.data = data
for (const k in data) {
if (data.hasOwnProperty(k)) {
evt[k] = data[k]
}
}
// need bubble.
evt.initEvent(type, true, true)
element.dispatchEvent(evt)
} | javascript | function fireEvent (element, type, data) {
const evt = document.createEvent('Event')
evt.data = data
for (const k in data) {
if (data.hasOwnProperty(k)) {
evt[k] = data[k]
}
}
// need bubble.
evt.initEvent(type, true, true)
element.dispatchEvent(evt)
} | [
"function",
"fireEvent",
"(",
"element",
",",
"type",
",",
"data",
")",
"{",
"const",
"evt",
"=",
"document",
".",
"createEvent",
"(",
"'Event'",
")",
"evt",
".",
"data",
"=",
"data",
"for",
"(",
"const",
"k",
"in",
"data",
")",
"{",
"if",
"(",
"da... | trigger and broadcast events. | [
"trigger",
"and",
"broadcast",
"events",
"."
] | 07d8ab08d0ef86cf2819e5f2bf1f4b06381f4d47 | https://github.com/vkiding/jud-vue-render/blob/07d8ab08d0ef86cf2819e5f2bf1f4b06381f4d47/src/render/browser/extend/components/tabheader/index.js#L227-L239 |
52,425 | gethuman/pancakes-angular | lib/transformers/ng.routing.transformer.js | getResolveHandlers | function getResolveHandlers(appName, routes, options) {
var resolveHandlers = {};
var me = this;
_.each(routes, function (route) {
// if no route name, don't do anything
if (!route.name) { return; }
// else generate the UI part based on the name
var uipart = me.getUIPart(a... | javascript | function getResolveHandlers(appName, routes, options) {
var resolveHandlers = {};
var me = this;
_.each(routes, function (route) {
// if no route name, don't do anything
if (!route.name) { return; }
// else generate the UI part based on the name
var uipart = me.getUIPart(a... | [
"function",
"getResolveHandlers",
"(",
"appName",
",",
"routes",
",",
"options",
")",
"{",
"var",
"resolveHandlers",
"=",
"{",
"}",
";",
"var",
"me",
"=",
"this",
";",
"_",
".",
"each",
"(",
"routes",
",",
"function",
"(",
"route",
")",
"{",
"// if no ... | Get resolve handlers for all the given routes
@param appName
@param routes
@param options | [
"Get",
"resolve",
"handlers",
"for",
"all",
"the",
"given",
"routes"
] | 9589b7ba09619843e271293088005c62ed23f355 | https://github.com/gethuman/pancakes-angular/blob/9589b7ba09619843e271293088005c62ed23f355/lib/transformers/ng.routing.transformer.js#L54-L82 |
52,426 | gethuman/pancakes-angular | lib/transformers/ng.routing.transformer.js | getUIPart | function getUIPart(appName, route) {
var rootDir = this.pancakes.getRootDir();
var filePath = path.join(rootDir, 'app', appName, 'pages', route.name + '.page.js');
return this.loadUIPart(appName, filePath);
} | javascript | function getUIPart(appName, route) {
var rootDir = this.pancakes.getRootDir();
var filePath = path.join(rootDir, 'app', appName, 'pages', route.name + '.page.js');
return this.loadUIPart(appName, filePath);
} | [
"function",
"getUIPart",
"(",
"appName",
",",
"route",
")",
"{",
"var",
"rootDir",
"=",
"this",
".",
"pancakes",
".",
"getRootDir",
"(",
")",
";",
"var",
"filePath",
"=",
"path",
".",
"join",
"(",
"rootDir",
",",
"'app'",
",",
"appName",
",",
"'pages'"... | Get the UI part module for a given app and route
@param appName
@param route
@returns {injector.require|*|require} | [
"Get",
"the",
"UI",
"part",
"module",
"for",
"a",
"given",
"app",
"and",
"route"
] | 9589b7ba09619843e271293088005c62ed23f355 | https://github.com/gethuman/pancakes-angular/blob/9589b7ba09619843e271293088005c62ed23f355/lib/transformers/ng.routing.transformer.js#L90-L94 |
52,427 | redisjs/jsr-server | lib/command/transaction/multi.js | execute | function execute(req, res) {
// setup the transaction
req.conn.transaction = new Transaction();
res.send(null, Constants.OK);
} | javascript | function execute(req, res) {
// setup the transaction
req.conn.transaction = new Transaction();
res.send(null, Constants.OK);
} | [
"function",
"execute",
"(",
"req",
",",
"res",
")",
"{",
"// setup the transaction",
"req",
".",
"conn",
".",
"transaction",
"=",
"new",
"Transaction",
"(",
")",
";",
"res",
".",
"send",
"(",
"null",
",",
"Constants",
".",
"OK",
")",
";",
"}"
] | Respond to the MULTI command. | [
"Respond",
"to",
"the",
"MULTI",
"command",
"."
] | 49413052d3039524fbdd2ade0ef9bae26cb4d647 | https://github.com/redisjs/jsr-server/blob/49413052d3039524fbdd2ade0ef9bae26cb4d647/lib/command/transaction/multi.js#L20-L24 |
52,428 | MakerCollider/node-red-contrib-smartnode-hook | html/scripts/RGraph/RGraph.pie.js | function ()
{
obj.set('exploded', currentExplode + (step * frame) );
RGraph.clear(obj.canvas);
RGraph.redrawCanvas(obj.canvas);
if (frame++ < frames) {
RGraph.Effects.updateCanvas(iterator);
} else {
... | javascript | function ()
{
obj.set('exploded', currentExplode + (step * frame) );
RGraph.clear(obj.canvas);
RGraph.redrawCanvas(obj.canvas);
if (frame++ < frames) {
RGraph.Effects.updateCanvas(iterator);
} else {
... | [
"function",
"(",
")",
"{",
"obj",
".",
"set",
"(",
"'exploded'",
",",
"currentExplode",
"+",
"(",
"step",
"*",
"frame",
")",
")",
";",
"RGraph",
".",
"clear",
"(",
"obj",
".",
"canvas",
")",
";",
"RGraph",
".",
"redrawCanvas",
"(",
"obj",
".",
"can... | chart.exploded | [
"chart",
".",
"exploded"
] | 245c267e832968bad880ca009929043e82c7bc25 | https://github.com/MakerCollider/node-red-contrib-smartnode-hook/blob/245c267e832968bad880ca009929043e82c7bc25/html/scripts/RGraph/RGraph.pie.js#L1540-L1552 | |
52,429 | Crafity/crafity-http | lib/Route.js | Route | function Route(path, options) {
options = options || {};
this.path = path;
this.method = 'GET';
this.regexp = pathtoRegexp(path
, this.keys = []
, options.sensitive
, options.strict);
} | javascript | function Route(path, options) {
options = options || {};
this.path = path;
this.method = 'GET';
this.regexp = pathtoRegexp(path
, this.keys = []
, options.sensitive
, options.strict);
} | [
"function",
"Route",
"(",
"path",
",",
"options",
")",
"{",
"options",
"=",
"options",
"||",
"{",
"}",
";",
"this",
".",
"path",
"=",
"path",
";",
"this",
".",
"method",
"=",
"'GET'",
";",
"this",
".",
"regexp",
"=",
"pathtoRegexp",
"(",
"path",
",... | Initialize `Route` with the given HTTP `path`,
and an array of `callbacks` and `options`.
Options:
- `sensitive` enable case-sensitive routes
- `strict` enable strict matching for trailing slashes
@param {String} path
@param {Object} options.
@api private | [
"Initialize",
"Route",
"with",
"the",
"given",
"HTTP",
"path",
"and",
"an",
"array",
"of",
"callbacks",
"and",
"options",
"."
] | f015eed86646e6b2ea82599c59b53a9f97fe92b4 | https://github.com/Crafity/crafity-http/blob/f015eed86646e6b2ea82599c59b53a9f97fe92b4/lib/Route.js#L62-L70 |
52,430 | RoboterHund/April1 | modules/templates/build.js | insert | function insert (builder, node) {
finishPending (builder);
appendNode (builder, spec.insertNode (node [1]));
} | javascript | function insert (builder, node) {
finishPending (builder);
appendNode (builder, spec.insertNode (node [1]));
} | [
"function",
"insert",
"(",
"builder",
",",
"node",
")",
"{",
"finishPending",
"(",
"builder",
")",
";",
"appendNode",
"(",
"builder",
",",
"spec",
".",
"insertNode",
"(",
"node",
"[",
"1",
"]",
")",
")",
";",
"}"
] | process 'insert' spec node
append 'insert' template node
@param builder template builder
@param node the spec node
should contain 1 item:
the key of the 'insert' template node | [
"process",
"insert",
"spec",
"node",
"append",
"insert",
"template",
"node"
] | f4fead4d8190d0b7bdc7b649f4c2c0e9728ef30b | https://github.com/RoboterHund/April1/blob/f4fead4d8190d0b7bdc7b649f4c2c0e9728ef30b/modules/templates/build.js#L92-L96 |
52,431 | RoboterHund/April1 | modules/templates/build.js | list | function list (builder, node) {
finishPending (builder);
var key = node [1];
var sub = subBuilder (builder);
dispatch.nodes (sub, builder.dispatch, node, 2, node.length);
var template = getTemplate (sub);
appendNode (builder, spec.listNode (key, template));
} | javascript | function list (builder, node) {
finishPending (builder);
var key = node [1];
var sub = subBuilder (builder);
dispatch.nodes (sub, builder.dispatch, node, 2, node.length);
var template = getTemplate (sub);
appendNode (builder, spec.listNode (key, template));
} | [
"function",
"list",
"(",
"builder",
",",
"node",
")",
"{",
"finishPending",
"(",
"builder",
")",
";",
"var",
"key",
"=",
"node",
"[",
"1",
"]",
";",
"var",
"sub",
"=",
"subBuilder",
"(",
"builder",
")",
";",
"dispatch",
".",
"nodes",
"(",
"sub",
",... | process 'list' spec node
append 'list' template node
@param builder template builder
@param node the spec node
should contain at least 2 items:
key of the list items
the spec nodes of the template used to render the list items | [
"process",
"list",
"spec",
"node",
"append",
"list",
"template",
"node"
] | f4fead4d8190d0b7bdc7b649f4c2c0e9728ef30b | https://github.com/RoboterHund/April1/blob/f4fead4d8190d0b7bdc7b649f4c2c0e9728ef30b/modules/templates/build.js#L107-L117 |
52,432 | ecs-jbariel/js-cfclient | lib/cfclient.js | CFClient | function CFClient(config) {
if (!(config instanceof CFConfig)) {
throw CFClientException(
new Error('Given tokens must be an instance of CFConfig'),
'tokens must be an instance of CFConfig that contains: "protocol", "host", "username", "password", "skipSslValidation');
}
... | javascript | function CFClient(config) {
if (!(config instanceof CFConfig)) {
throw CFClientException(
new Error('Given tokens must be an instance of CFConfig'),
'tokens must be an instance of CFConfig that contains: "protocol", "host", "username", "password", "skipSslValidation');
}
... | [
"function",
"CFClient",
"(",
"config",
")",
"{",
"if",
"(",
"!",
"(",
"config",
"instanceof",
"CFConfig",
")",
")",
"{",
"throw",
"CFClientException",
"(",
"new",
"Error",
"(",
"'Given tokens must be an instance of CFConfig'",
")",
",",
"'tokens must be an instance ... | Constructor for the CFClient.
@param {CFConfig} config - configuration as defined in the README.md | [
"Constructor",
"for",
"the",
"CFClient",
"."
] | e912724e2b6320746b4b4297e604b54580068edd | https://github.com/ecs-jbariel/js-cfclient/blob/e912724e2b6320746b4b4297e604b54580068edd/lib/cfclient.js#L87-L97 |
52,433 | ecs-jbariel/js-cfclient | lib/cfclient.js | CFConfig | function CFConfig(config) {
const cf = this;
extend(extend(cf, {
protocol: 'http',
host: 'api.bosh-lite.com',
//port : null, // omitted to let it be based on config or protocol
username: 'admin',
password: 'admin',
skipSslValidation: false
}), config)... | javascript | function CFConfig(config) {
const cf = this;
extend(extend(cf, {
protocol: 'http',
host: 'api.bosh-lite.com',
//port : null, // omitted to let it be based on config or protocol
username: 'admin',
password: 'admin',
skipSslValidation: false
}), config)... | [
"function",
"CFConfig",
"(",
"config",
")",
"{",
"const",
"cf",
"=",
"this",
";",
"extend",
"(",
"extend",
"(",
"cf",
",",
"{",
"protocol",
":",
"'http'",
",",
"host",
":",
"'api.bosh-lite.com'",
",",
"//port : null, // omitted to let it be based on config or prot... | Object that helps to manage the configuration options.
@param {Object} config values
properties are:
<ul>
<li><b>protocol</b> 'http' or 'https'</li>
<li><b>host</b> FQDN or IP (e.g. api.mydomain.com)</li>
<li><b>username</b> username for the CF API</li>
<li><b>password</b> password for the given username</li>
<li><b>s... | [
"Object",
"that",
"helps",
"to",
"manage",
"the",
"configuration",
"options",
"."
] | e912724e2b6320746b4b4297e604b54580068edd | https://github.com/ecs-jbariel/js-cfclient/blob/e912724e2b6320746b4b4297e604b54580068edd/lib/cfclient.js#L267-L282 |
52,434 | vidi-insights/vidi-metrics | srv/demo.js | demo_plugin | function demo_plugin (opts) {
// adds an emit plugin. Emit plugins are called on regular intervals and have
// the opertunity to add to the payload being sent to collectors. Data sent
// from emit plugins should not require tagging, and should be map ready.
this.add({role: 'metrics', hook: 'emit'}, emit)
//... | javascript | function demo_plugin (opts) {
// adds an emit plugin. Emit plugins are called on regular intervals and have
// the opertunity to add to the payload being sent to collectors. Data sent
// from emit plugins should not require tagging, and should be map ready.
this.add({role: 'metrics', hook: 'emit'}, emit)
//... | [
"function",
"demo_plugin",
"(",
"opts",
")",
"{",
"// adds an emit plugin. Emit plugins are called on regular intervals and have",
"// the opertunity to add to the payload being sent to collectors. Data sent",
"// from emit plugins should not require tagging, and should be map ready.",
"this",
"... | Vidi plugins are simple seneca plugins. | [
"Vidi",
"plugins",
"are",
"simple",
"seneca",
"plugins",
"."
] | 10737d1a2b12ca81affc5ea58e701040e1f59e77 | https://github.com/vidi-insights/vidi-metrics/blob/10737d1a2b12ca81affc5ea58e701040e1f59e77/srv/demo.js#L19-L91 |
52,435 | vidi-insights/vidi-metrics | srv/demo.js | tag | function tag (msg, done) {
var clean_data = {
source: 'demo-plugin',
payload: msg.payload
}
done(null, clean_data)
} | javascript | function tag (msg, done) {
var clean_data = {
source: 'demo-plugin',
payload: msg.payload
}
done(null, clean_data)
} | [
"function",
"tag",
"(",
"msg",
",",
"done",
")",
"{",
"var",
"clean_data",
"=",
"{",
"source",
":",
"'demo-plugin'",
",",
"payload",
":",
"msg",
".",
"payload",
"}",
"done",
"(",
"null",
",",
"clean_data",
")",
"}"
] | Tagging just means returning a source and payload, it allows plugins that understand the data to tag it for themselves. This means inbound data does not need to be modified at source | [
"Tagging",
"just",
"means",
"returning",
"a",
"source",
"and",
"payload",
"it",
"allows",
"plugins",
"that",
"understand",
"the",
"data",
"to",
"tag",
"it",
"for",
"themselves",
".",
"This",
"means",
"inbound",
"data",
"does",
"not",
"need",
"to",
"be",
"m... | 10737d1a2b12ca81affc5ea58e701040e1f59e77 | https://github.com/vidi-insights/vidi-metrics/blob/10737d1a2b12ca81affc5ea58e701040e1f59e77/srv/demo.js#L44-L51 |
52,436 | vidi-insights/vidi-metrics | srv/demo.js | map | function map (msg, done) {
var metric = {
source: msg.source,
name: 'my-metric',
values: {val: msg.payload.val},
tags: {tag: msg.payload.tag}
}
done(null, [metric])
} | javascript | function map (msg, done) {
var metric = {
source: msg.source,
name: 'my-metric',
values: {val: msg.payload.val},
tags: {tag: msg.payload.tag}
}
done(null, [metric])
} | [
"function",
"map",
"(",
"msg",
",",
"done",
")",
"{",
"var",
"metric",
"=",
"{",
"source",
":",
"msg",
".",
"source",
",",
"name",
":",
"'my-metric'",
",",
"values",
":",
"{",
"val",
":",
"msg",
".",
"payload",
".",
"val",
"}",
",",
"tags",
":",
... | Map plugins return arrays of metrics. The only required fields are source and name. All other fields depend on the sink you want to use. Note that the fields below represent our 'plugin' standard. | [
"Map",
"plugins",
"return",
"arrays",
"of",
"metrics",
".",
"The",
"only",
"required",
"fields",
"are",
"source",
"and",
"name",
".",
"All",
"other",
"fields",
"depend",
"on",
"the",
"sink",
"you",
"want",
"to",
"use",
".",
"Note",
"that",
"the",
"fields... | 10737d1a2b12ca81affc5ea58e701040e1f59e77 | https://github.com/vidi-insights/vidi-metrics/blob/10737d1a2b12ca81affc5ea58e701040e1f59e77/srv/demo.js#L56-L65 |
52,437 | vidi-insights/vidi-metrics | srv/demo.js | sink | function sink (msg, done) {
var metric = msg.metric
var as_text = JSON.stringify(metric, null, 1)
console.log(as_text)
done()
} | javascript | function sink (msg, done) {
var metric = msg.metric
var as_text = JSON.stringify(metric, null, 1)
console.log(as_text)
done()
} | [
"function",
"sink",
"(",
"msg",
",",
"done",
")",
"{",
"var",
"metric",
"=",
"msg",
".",
"metric",
"var",
"as_text",
"=",
"JSON",
".",
"stringify",
"(",
"metric",
",",
"null",
",",
"1",
")",
"console",
".",
"log",
"(",
"as_text",
")",
"done",
"(",
... | A sink simply does something with each metric it gets. In our case we are logging to the console but you can do anything you like with it. | [
"A",
"sink",
"simply",
"does",
"something",
"with",
"each",
"metric",
"it",
"gets",
".",
"In",
"our",
"case",
"we",
"are",
"logging",
"to",
"the",
"console",
"but",
"you",
"can",
"do",
"anything",
"you",
"like",
"with",
"it",
"."
] | 10737d1a2b12ca81affc5ea58e701040e1f59e77 | https://github.com/vidi-insights/vidi-metrics/blob/10737d1a2b12ca81affc5ea58e701040e1f59e77/srv/demo.js#L80-L87 |
52,438 | ottojs/otto-errors | lib/locked.error.js | ErrorLocked | function ErrorLocked (message) {
Error.call(this);
// Add Information
this.name = 'ErrorLocked';
this.type = 'client';
this.status = 423;
if (message) {
this.message = message;
}
} | javascript | function ErrorLocked (message) {
Error.call(this);
// Add Information
this.name = 'ErrorLocked';
this.type = 'client';
this.status = 423;
if (message) {
this.message = message;
}
} | [
"function",
"ErrorLocked",
"(",
"message",
")",
"{",
"Error",
".",
"call",
"(",
"this",
")",
";",
"// Add Information",
"this",
".",
"name",
"=",
"'ErrorLocked'",
";",
"this",
".",
"type",
"=",
"'client'",
";",
"this",
".",
"status",
"=",
"423",
";",
"... | Error - ErrorLocked | [
"Error",
"-",
"ErrorLocked"
] | a3c6d98fd5d35ce3c136ed7e1edd2f800af268d9 | https://github.com/ottojs/otto-errors/blob/a3c6d98fd5d35ce3c136ed7e1edd2f800af268d9/lib/locked.error.js#L8-L20 |
52,439 | jonschlinkert/engines | index.js | cache | function cache(options, compiled) {
// cachable
if (compiled && options.filename && options.cache) {
delete templates[options.filename];
cacheStore[options.filename] = compiled;
return compiled;
}
// check cache
if (options.filename && options.cache) {
return cacheStore[options.filename];
}
... | javascript | function cache(options, compiled) {
// cachable
if (compiled && options.filename && options.cache) {
delete templates[options.filename];
cacheStore[options.filename] = compiled;
return compiled;
}
// check cache
if (options.filename && options.cache) {
return cacheStore[options.filename];
}
... | [
"function",
"cache",
"(",
"options",
",",
"compiled",
")",
"{",
"// cachable",
"if",
"(",
"compiled",
"&&",
"options",
".",
"filename",
"&&",
"options",
".",
"cache",
")",
"{",
"delete",
"templates",
"[",
"options",
".",
"filename",
"]",
";",
"cacheStore",... | Conditionally cache `compiled` template based
on the `options` filename and `.cache` boolean.
@param {Object} options
@param {Function} compiled
@return {Function}
@api private | [
"Conditionally",
"cache",
"compiled",
"template",
"based",
"on",
"the",
"options",
"filename",
"and",
".",
"cache",
"boolean",
"."
] | 82c19e6013a3e6e77d8c8a8e976433bd322587fd | https://github.com/jonschlinkert/engines/blob/82c19e6013a3e6e77d8c8a8e976433bd322587fd/index.js#L68-L80 |
52,440 | jonschlinkert/engines | index.js | store | function store(path, options) {
var str = templates[path];
var cached = options.cache && str && typeof str === 'string';
// cached (only if cached is a string and not a compiled template function)
if (cached) return str;
// store
str = options.str;
// remove extraneous utf8 BOM marker
str = str.repla... | javascript | function store(path, options) {
var str = templates[path];
var cached = options.cache && str && typeof str === 'string';
// cached (only if cached is a string and not a compiled template function)
if (cached) return str;
// store
str = options.str;
// remove extraneous utf8 BOM marker
str = str.repla... | [
"function",
"store",
"(",
"path",
",",
"options",
")",
"{",
"var",
"str",
"=",
"templates",
"[",
"path",
"]",
";",
"var",
"cached",
"=",
"options",
".",
"cache",
"&&",
"str",
"&&",
"typeof",
"str",
"===",
"'string'",
";",
"// cached (only if cached is a st... | Read `path` with `options`
When `options.cache`
is true the template string will be cached.
@param {String} path
@param {String} options
@api private | [
"Read",
"path",
"with",
"options",
"When",
"options",
".",
"cache",
"is",
"true",
"the",
"template",
"string",
"will",
"be",
"cached",
"."
] | 82c19e6013a3e6e77d8c8a8e976433bd322587fd | https://github.com/jonschlinkert/engines/blob/82c19e6013a3e6e77d8c8a8e976433bd322587fd/index.js#L93-L109 |
52,441 | gethuman/pancakes-angular | lib/ngapp/storage.js | set | function set(name, value) {
// if no value then remove
if (!value) {
remove(name);
return;
}
if (localStorage) {
try {
localStorage.setItem(name, value);
}
catch (ex) {}
}
_.isFunction($cookies... | javascript | function set(name, value) {
// if no value then remove
if (!value) {
remove(name);
return;
}
if (localStorage) {
try {
localStorage.setItem(name, value);
}
catch (ex) {}
}
_.isFunction($cookies... | [
"function",
"set",
"(",
"name",
",",
"value",
")",
"{",
"// if no value then remove",
"if",
"(",
"!",
"value",
")",
"{",
"remove",
"(",
"name",
")",
";",
"return",
";",
"}",
"if",
"(",
"localStorage",
")",
"{",
"try",
"{",
"localStorage",
".",
"setItem... | Set a value in both localStorage and cookies
@param name
@param value | [
"Set",
"a",
"value",
"in",
"both",
"localStorage",
"and",
"cookies"
] | 9589b7ba09619843e271293088005c62ed23f355 | https://github.com/gethuman/pancakes-angular/blob/9589b7ba09619843e271293088005c62ed23f355/lib/ngapp/storage.js#L36-L55 |
52,442 | gethuman/pancakes-angular | lib/ngapp/storage.js | get | function get(name) {
var value = (_.isFunction($cookies.get) ? $cookies.get(name) : $cookies[name]);
if (!value && localStorage) {
try {
value = localStorage.getItem(name);
}
catch (ex) {}
if (value) {
set(name, value);
... | javascript | function get(name) {
var value = (_.isFunction($cookies.get) ? $cookies.get(name) : $cookies[name]);
if (!value && localStorage) {
try {
value = localStorage.getItem(name);
}
catch (ex) {}
if (value) {
set(name, value);
... | [
"function",
"get",
"(",
"name",
")",
"{",
"var",
"value",
"=",
"(",
"_",
".",
"isFunction",
"(",
"$cookies",
".",
"get",
")",
"?",
"$cookies",
".",
"get",
"(",
"name",
")",
":",
"$cookies",
"[",
"name",
"]",
")",
";",
"if",
"(",
"!",
"value",
"... | First check cookie; if not present, however, check local storage
@param name | [
"First",
"check",
"cookie",
";",
"if",
"not",
"present",
"however",
"check",
"local",
"storage"
] | 9589b7ba09619843e271293088005c62ed23f355 | https://github.com/gethuman/pancakes-angular/blob/9589b7ba09619843e271293088005c62ed23f355/lib/ngapp/storage.js#L61-L77 |
52,443 | origin1tech/chek | dist/modules/string.js | camelcase | function camelcase(val) {
if (!is_1.isValue(val))
return null;
var result = val.replace(/[^A-Za-z0-9]/g, ' ').replace(/^\w|[A-Z]|\b\w|\s+/g, function (m, i) {
if (+m === 0 || /(\.|-|_)/.test(m))
return '';
return i === 0 ? m.toLowerCase() : m.toUpperCase();
});
return... | javascript | function camelcase(val) {
if (!is_1.isValue(val))
return null;
var result = val.replace(/[^A-Za-z0-9]/g, ' ').replace(/^\w|[A-Z]|\b\w|\s+/g, function (m, i) {
if (+m === 0 || /(\.|-|_)/.test(m))
return '';
return i === 0 ? m.toLowerCase() : m.toUpperCase();
});
return... | [
"function",
"camelcase",
"(",
"val",
")",
"{",
"if",
"(",
"!",
"is_1",
".",
"isValue",
"(",
"val",
")",
")",
"return",
"null",
";",
"var",
"result",
"=",
"val",
".",
"replace",
"(",
"/",
"[^A-Za-z0-9]",
"/",
"g",
",",
"' '",
")",
".",
"replace",
... | Camelcase
Converts string to camelcase.
@param val the value to be transformed. | [
"Camelcase",
"Converts",
"string",
"to",
"camelcase",
"."
] | 6bc3ab0ac36126cc7918a244a606009749897b2e | https://github.com/origin1tech/chek/blob/6bc3ab0ac36126cc7918a244a606009749897b2e/dist/modules/string.js#L11-L20 |
52,444 | origin1tech/chek | dist/modules/string.js | capitalize | function capitalize(val) {
if (!is_1.isValue(val))
return null;
val = val.toLowerCase();
return "" + val.charAt(0).toUpperCase() + val.slice(1);
} | javascript | function capitalize(val) {
if (!is_1.isValue(val))
return null;
val = val.toLowerCase();
return "" + val.charAt(0).toUpperCase() + val.slice(1);
} | [
"function",
"capitalize",
"(",
"val",
")",
"{",
"if",
"(",
"!",
"is_1",
".",
"isValue",
"(",
"val",
")",
")",
"return",
"null",
";",
"val",
"=",
"val",
".",
"toLowerCase",
"(",
")",
";",
"return",
"\"\"",
"+",
"val",
".",
"charAt",
"(",
"0",
")",... | Capitalize
Converts string to capitalize.
@param val the value to be transformed. | [
"Capitalize",
"Converts",
"string",
"to",
"capitalize",
"."
] | 6bc3ab0ac36126cc7918a244a606009749897b2e | https://github.com/origin1tech/chek/blob/6bc3ab0ac36126cc7918a244a606009749897b2e/dist/modules/string.js#L44-L49 |
52,445 | origin1tech/chek | dist/modules/string.js | padLeft | function padLeft(val, len, offset, char) {
/* istanbul ignore if */
if (!is_1.isValue(val) || !is_1.isString(val))
return null;
// If offset is a string
// count its length.
if (is_1.isString(offset))
offset = offset.length;
char = char || ' ';
var pad = '';
while (len--)... | javascript | function padLeft(val, len, offset, char) {
/* istanbul ignore if */
if (!is_1.isValue(val) || !is_1.isString(val))
return null;
// If offset is a string
// count its length.
if (is_1.isString(offset))
offset = offset.length;
char = char || ' ';
var pad = '';
while (len--)... | [
"function",
"padLeft",
"(",
"val",
",",
"len",
",",
"offset",
",",
"char",
")",
"{",
"/* istanbul ignore if */",
"if",
"(",
"!",
"is_1",
".",
"isValue",
"(",
"val",
")",
"||",
"!",
"is_1",
".",
"isString",
"(",
"val",
")",
")",
"return",
"null",
";",... | Pad Left
Pads a string on the left.
@param val the string to be padded.
@param len the length to pad.
@param offset an offset number or string to be counted.
@param char the character to pad with. | [
"Pad",
"Left",
"Pads",
"a",
"string",
"on",
"the",
"left",
"."
] | 6bc3ab0ac36126cc7918a244a606009749897b2e | https://github.com/origin1tech/chek/blob/6bc3ab0ac36126cc7918a244a606009749897b2e/dist/modules/string.js#L72-L88 |
52,446 | origin1tech/chek | dist/modules/string.js | padRight | function padRight(val, len, offset, char) {
/* istanbul ignore if */
if (!is_1.isValue(val) || !is_1.isString(val))
return null;
// If offset is a string
// count its length.
if (is_1.isString(offset))
offset = offset.length;
char = char || ' ';
while (len--) {
val +=... | javascript | function padRight(val, len, offset, char) {
/* istanbul ignore if */
if (!is_1.isValue(val) || !is_1.isString(val))
return null;
// If offset is a string
// count its length.
if (is_1.isString(offset))
offset = offset.length;
char = char || ' ';
while (len--) {
val +=... | [
"function",
"padRight",
"(",
"val",
",",
"len",
",",
"offset",
",",
"char",
")",
"{",
"/* istanbul ignore if */",
"if",
"(",
"!",
"is_1",
".",
"isValue",
"(",
"val",
")",
"||",
"!",
"is_1",
".",
"isString",
"(",
"val",
")",
")",
"return",
"null",
";"... | Pad Right
Pads a string to the right.
@param val the string to be padded.
@param len the length to pad.
@param offset an offset value to add.
@param char the character to pad with. | [
"Pad",
"Right",
"Pads",
"a",
"string",
"to",
"the",
"right",
"."
] | 6bc3ab0ac36126cc7918a244a606009749897b2e | https://github.com/origin1tech/chek/blob/6bc3ab0ac36126cc7918a244a606009749897b2e/dist/modules/string.js#L99-L114 |
52,447 | origin1tech/chek | dist/modules/string.js | titlecase | function titlecase(val, conjunctions) {
if (!is_1.isValue(val))
return null;
// conjunctions
var conj = /^(a|an|and|as|at|but|by|en|for|if|in|nor|of|on|or|per|the|to|vs?\.?|via)$/i;
return val.replace(/[A-Za-z0-9\u00C0-\u00FF]+[^\s-]*/g, function (m, i, t) {
if (i > 0 && i + m.length !==... | javascript | function titlecase(val, conjunctions) {
if (!is_1.isValue(val))
return null;
// conjunctions
var conj = /^(a|an|and|as|at|but|by|en|for|if|in|nor|of|on|or|per|the|to|vs?\.?|via)$/i;
return val.replace(/[A-Za-z0-9\u00C0-\u00FF]+[^\s-]*/g, function (m, i, t) {
if (i > 0 && i + m.length !==... | [
"function",
"titlecase",
"(",
"val",
",",
"conjunctions",
")",
"{",
"if",
"(",
"!",
"is_1",
".",
"isValue",
"(",
"val",
")",
")",
"return",
"null",
";",
"// conjunctions",
"var",
"conj",
"=",
"/",
"^(a|an|and|as|at|but|by|en|for|if|in|nor|of|on|or|per|the|to|vs?\\... | Titlecase
Converts string to titlecase.
This fine script refactored from:
@see https://github.com/gouch/to-title-case
@param val the value to be transformed.
@param conjunctions when true words like and, a, but, for are also titlecased. | [
"Titlecase",
"Converts",
"string",
"to",
"titlecase",
"."
] | 6bc3ab0ac36126cc7918a244a606009749897b2e | https://github.com/origin1tech/chek/blob/6bc3ab0ac36126cc7918a244a606009749897b2e/dist/modules/string.js#L224-L243 |
52,448 | origin1tech/chek | dist/modules/string.js | uuid | function uuid() {
var d = Date.now();
// Use high perf timer if avail.
/* istanbul ignore next */
if (typeof performance !== 'undefined' && is_1.isFunction(performance.now))
d += performance.now();
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
var r = ... | javascript | function uuid() {
var d = Date.now();
// Use high perf timer if avail.
/* istanbul ignore next */
if (typeof performance !== 'undefined' && is_1.isFunction(performance.now))
d += performance.now();
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
var r = ... | [
"function",
"uuid",
"(",
")",
"{",
"var",
"d",
"=",
"Date",
".",
"now",
"(",
")",
";",
"// Use high perf timer if avail.",
"/* istanbul ignore next */",
"if",
"(",
"typeof",
"performance",
"!==",
"'undefined'",
"&&",
"is_1",
".",
"isFunction",
"(",
"performance"... | UUID
Generates a UUID. | [
"UUID",
"Generates",
"a",
"UUID",
"."
] | 6bc3ab0ac36126cc7918a244a606009749897b2e | https://github.com/origin1tech/chek/blob/6bc3ab0ac36126cc7918a244a606009749897b2e/dist/modules/string.js#L261-L272 |
52,449 | WebArtWork/derer | lib/swig.js | validateOptions | function validateOptions(options) {
if (!options) {
return;
}
utils.each(['varControls', 'tagControls', 'cmtControls'], function (key) {
if (!options.hasOwnProperty(key)) {
return;
}
if (!utils.isArray(options[key]) || options[key].length !== 2) {
throw new Error('Option "' + key + '"... | javascript | function validateOptions(options) {
if (!options) {
return;
}
utils.each(['varControls', 'tagControls', 'cmtControls'], function (key) {
if (!options.hasOwnProperty(key)) {
return;
}
if (!utils.isArray(options[key]) || options[key].length !== 2) {
throw new Error('Option "' + key + '"... | [
"function",
"validateOptions",
"(",
"options",
")",
"{",
"if",
"(",
"!",
"options",
")",
"{",
"return",
";",
"}",
"utils",
".",
"each",
"(",
"[",
"'varControls'",
",",
"'tagControls'",
",",
"'cmtControls'",
"]",
",",
"function",
"(",
"key",
")",
"{",
"... | Validate the Swig options object.
@param {?SwigOpts} options Swig options object.
@return {undefined} This method will throw errors if anything is wrong.
@private | [
"Validate",
"the",
"Swig",
"options",
"object",
"."
] | edf9f82c8042b543e6f291f605430fac84702b2d | https://github.com/WebArtWork/derer/blob/edf9f82c8042b543e6f291f605430fac84702b2d/lib/swig.js#L88-L125 |
52,450 | WebArtWork/derer | lib/swig.js | getLocals | function getLocals(options) {
if (!options || !options.locals) {
return self.options.locals;
}
return utils.extend({}, self.options.locals, options.locals);
} | javascript | function getLocals(options) {
if (!options || !options.locals) {
return self.options.locals;
}
return utils.extend({}, self.options.locals, options.locals);
} | [
"function",
"getLocals",
"(",
"options",
")",
"{",
"if",
"(",
"!",
"options",
"||",
"!",
"options",
".",
"locals",
")",
"{",
"return",
"self",
".",
"options",
".",
"locals",
";",
"}",
"return",
"utils",
".",
"extend",
"(",
"{",
"}",
",",
"self",
".... | Get combined locals context.
@param {?SwigOpts} [options] Swig options object.
@return {object} Locals context.
@private | [
"Get",
"combined",
"locals",
"context",
"."
] | edf9f82c8042b543e6f291f605430fac84702b2d | https://github.com/WebArtWork/derer/blob/edf9f82c8042b543e6f291f605430fac84702b2d/lib/swig.js#L186-L192 |
52,451 | WebArtWork/derer | lib/swig.js | cacheGet | function cacheGet(key, options) {
if (shouldCache(options)) {
return;
}
if (self.options.cache === 'memory') {
return self.cache[key];
}
return self.options.cache.get(key);
} | javascript | function cacheGet(key, options) {
if (shouldCache(options)) {
return;
}
if (self.options.cache === 'memory') {
return self.cache[key];
}
return self.options.cache.get(key);
} | [
"function",
"cacheGet",
"(",
"key",
",",
"options",
")",
"{",
"if",
"(",
"shouldCache",
"(",
"options",
")",
")",
"{",
"return",
";",
"}",
"if",
"(",
"self",
".",
"options",
".",
"cache",
"===",
"'memory'",
")",
"{",
"return",
"self",
".",
"cache",
... | Get compiled template from the cache.
@param {string} key Name of template.
@return {object|undefined} Template function and tokens.
@private | [
"Get",
"compiled",
"template",
"from",
"the",
"cache",
"."
] | edf9f82c8042b543e6f291f605430fac84702b2d | https://github.com/WebArtWork/derer/blob/edf9f82c8042b543e6f291f605430fac84702b2d/lib/swig.js#L211-L221 |
52,452 | WebArtWork/derer | lib/swig.js | cacheSet | function cacheSet(key, options, val) {
if (shouldCache(options)) {
return;
}
if (self.options.cache === 'memory') {
self.cache[key] = val;
return;
}
self.options.cache.set(key, val);
} | javascript | function cacheSet(key, options, val) {
if (shouldCache(options)) {
return;
}
if (self.options.cache === 'memory') {
self.cache[key] = val;
return;
}
self.options.cache.set(key, val);
} | [
"function",
"cacheSet",
"(",
"key",
",",
"options",
",",
"val",
")",
"{",
"if",
"(",
"shouldCache",
"(",
"options",
")",
")",
"{",
"return",
";",
"}",
"if",
"(",
"self",
".",
"options",
".",
"cache",
"===",
"'memory'",
")",
"{",
"self",
".",
"cache... | Store a template in the cache.
@param {string} key Name of template.
@param {object} val Template function and tokens.
@return {undefined}
@private | [
"Store",
"a",
"template",
"in",
"the",
"cache",
"."
] | edf9f82c8042b543e6f291f605430fac84702b2d | https://github.com/WebArtWork/derer/blob/edf9f82c8042b543e6f291f605430fac84702b2d/lib/swig.js#L230-L241 |
52,453 | WebArtWork/derer | lib/swig.js | remapBlocks | function remapBlocks(blocks, tokens) {
return utils.map(tokens, function (token) {
var args = token.args ? token.args.join('') : '';
if (token.name === 'block' && blocks[args]) {
token = blocks[args];
}
if (token.content && token.content.length) {
token.content = remapBlocks(... | javascript | function remapBlocks(blocks, tokens) {
return utils.map(tokens, function (token) {
var args = token.args ? token.args.join('') : '';
if (token.name === 'block' && blocks[args]) {
token = blocks[args];
}
if (token.content && token.content.length) {
token.content = remapBlocks(... | [
"function",
"remapBlocks",
"(",
"blocks",
",",
"tokens",
")",
"{",
"return",
"utils",
".",
"map",
"(",
"tokens",
",",
"function",
"(",
"token",
")",
"{",
"var",
"args",
"=",
"token",
".",
"args",
"?",
"token",
".",
"args",
".",
"join",
"(",
"''",
"... | Re-Map blocks within a list of tokens to the template's block objects.
@param {array} tokens List of tokens for the parent object.
@param {object} template Current template that needs to be mapped to the parent's block and token list.
@return {array}
@private | [
"Re",
"-",
"Map",
"blocks",
"within",
"a",
"list",
"of",
"tokens",
"to",
"the",
"template",
"s",
"block",
"objects",
"."
] | edf9f82c8042b543e6f291f605430fac84702b2d | https://github.com/WebArtWork/derer/blob/edf9f82c8042b543e6f291f605430fac84702b2d/lib/swig.js#L390-L401 |
52,454 | WebArtWork/derer | lib/swig.js | importNonBlocks | function importNonBlocks(blocks, tokens) {
var temp = [];
utils.each(blocks, function (block) { temp.push(block); });
utils.each(temp.reverse(), function (block) {
if (block.name !== 'block') {
tokens.unshift(block);
}
});
} | javascript | function importNonBlocks(blocks, tokens) {
var temp = [];
utils.each(blocks, function (block) { temp.push(block); });
utils.each(temp.reverse(), function (block) {
if (block.name !== 'block') {
tokens.unshift(block);
}
});
} | [
"function",
"importNonBlocks",
"(",
"blocks",
",",
"tokens",
")",
"{",
"var",
"temp",
"=",
"[",
"]",
";",
"utils",
".",
"each",
"(",
"blocks",
",",
"function",
"(",
"block",
")",
"{",
"temp",
".",
"push",
"(",
"block",
")",
";",
"}",
")",
";",
"u... | Import block-level tags to the token list that are not actual block tags.
@param {array} blocks List of block-level tags.
@param {array} tokens List of tokens to render.
@return {undefined}
@private | [
"Import",
"block",
"-",
"level",
"tags",
"to",
"the",
"token",
"list",
"that",
"are",
"not",
"actual",
"block",
"tags",
"."
] | edf9f82c8042b543e6f291f605430fac84702b2d | https://github.com/WebArtWork/derer/blob/edf9f82c8042b543e6f291f605430fac84702b2d/lib/swig.js#L410-L418 |
52,455 | WebArtWork/derer | lib/swig.js | getParents | function getParents(tokens, options) {
var parentName = tokens.parent,
parentFiles = [],
parents = [],
parentFile,
parent,
l;
while (parentName) {
if (!options || !options.filename) {
throw new Error('Cannot extend "' + parentName + '" because current template has no... | javascript | function getParents(tokens, options) {
var parentName = tokens.parent,
parentFiles = [],
parents = [],
parentFile,
parent,
l;
while (parentName) {
if (!options || !options.filename) {
throw new Error('Cannot extend "' + parentName + '" because current template has no... | [
"function",
"getParents",
"(",
"tokens",
",",
"options",
")",
"{",
"var",
"parentName",
"=",
"tokens",
".",
"parent",
",",
"parentFiles",
"=",
"[",
"]",
",",
"parents",
"=",
"[",
"]",
",",
"parentFile",
",",
"parent",
",",
"l",
";",
"while",
"(",
"pa... | Recursively compile and get parents of given parsed token object.
@param {object} tokens Parsed tokens from template.
@param {SwigOpts} [options={}] Swig options object.
@return {object} Parsed tokens from parent templates.
@private | [
"Recursively",
"compile",
"and",
"get",
"parents",
"of",
"given",
"parsed",
"token",
"object",
"."
] | edf9f82c8042b543e6f291f605430fac84702b2d | https://github.com/WebArtWork/derer/blob/edf9f82c8042b543e6f291f605430fac84702b2d/lib/swig.js#L428-L462 |
52,456 | base-apps/base-apps-router | dist/FrontRouter.js | FrontRouter | function FrontRouter() {
var opts = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
_classCallCheck(this, FrontRouter);
this.options = {
pageRoot: opts.pageRoot || process.cwd(),
overwrite: opts.overwrite || false
};
this.routes = [];
// Figure out what li... | javascript | function FrontRouter() {
var opts = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
_classCallCheck(this, FrontRouter);
this.options = {
pageRoot: opts.pageRoot || process.cwd(),
overwrite: opts.overwrite || false
};
this.routes = [];
// Figure out what li... | [
"function",
"FrontRouter",
"(",
")",
"{",
"var",
"opts",
"=",
"arguments",
".",
"length",
"<=",
"0",
"||",
"arguments",
"[",
"0",
"]",
"===",
"undefined",
"?",
"{",
"}",
":",
"arguments",
"[",
"0",
"]",
";",
"_classCallCheck",
"(",
"this",
",",
"Fron... | Creates a new instance of `FrontRouter`.
@prop {FrontRouterOptions} opts - Class options. | [
"Creates",
"a",
"new",
"instance",
"of",
"FrontRouter",
"."
] | bf5e99987003635fbac0144c0be35d5a863065d9 | https://github.com/base-apps/base-apps-router/blob/bf5e99987003635fbac0144c0be35d5a863065d9/dist/FrontRouter.js#L28-L70 |
52,457 | toajs/toa-morgan | index.js | compileToken | function compileToken (token, arg) {
let fn = tokens[token] || noOp
return function () {
return arg ? fn.call(this, arg) : fn.call(this)
}
} | javascript | function compileToken (token, arg) {
let fn = tokens[token] || noOp
return function () {
return arg ? fn.call(this, arg) : fn.call(this)
}
} | [
"function",
"compileToken",
"(",
"token",
",",
"arg",
")",
"{",
"let",
"fn",
"=",
"tokens",
"[",
"token",
"]",
"||",
"noOp",
"return",
"function",
"(",
")",
"{",
"return",
"arg",
"?",
"fn",
".",
"call",
"(",
"this",
",",
"arg",
")",
":",
"fn",
".... | Compile a token string into a function.
@param {string} token
@param {string} arg
@return {function}
@private | [
"Compile",
"a",
"token",
"string",
"into",
"a",
"function",
"."
] | 8308b474dff45a513c85ad90b0ddc5379bb5fb11 | https://github.com/toajs/toa-morgan/blob/8308b474dff45a513c85ad90b0ddc5379bb5fb11/index.js#L269-L275 |
52,458 | redisjs/jsr-server | lib/command/pubsub/punsubscribe.js | execute | function execute(req, res) {
this.state.pubsub.punsubscribe(req.conn, req.args);
} | javascript | function execute(req, res) {
this.state.pubsub.punsubscribe(req.conn, req.args);
} | [
"function",
"execute",
"(",
"req",
",",
"res",
")",
"{",
"this",
".",
"state",
".",
"pubsub",
".",
"punsubscribe",
"(",
"req",
".",
"conn",
",",
"req",
".",
"args",
")",
";",
"}"
] | Respond to the PUNSUBSCRIBE command. | [
"Respond",
"to",
"the",
"PUNSUBSCRIBE",
"command",
"."
] | 49413052d3039524fbdd2ade0ef9bae26cb4d647 | https://github.com/redisjs/jsr-server/blob/49413052d3039524fbdd2ade0ef9bae26cb4d647/lib/command/pubsub/punsubscribe.js#L17-L19 |
52,459 | emmetio/variable-resolver | index.js | createModel | function createModel(string) {
const reVariable = /\$\{([a-z][\w\-]*)\}/ig;
const escapeCharCode = 92; // `\` symbol
const variables = [];
// We have to replace unescaped (e.g. not preceded with `\`) tokens.
// Instead of writing a stream parser, we’ll cut some edges here:
// 1. Find all tokens... | javascript | function createModel(string) {
const reVariable = /\$\{([a-z][\w\-]*)\}/ig;
const escapeCharCode = 92; // `\` symbol
const variables = [];
// We have to replace unescaped (e.g. not preceded with `\`) tokens.
// Instead of writing a stream parser, we’ll cut some edges here:
// 1. Find all tokens... | [
"function",
"createModel",
"(",
"string",
")",
"{",
"const",
"reVariable",
"=",
"/",
"\\$\\{([a-z][\\w\\-]*)\\}",
"/",
"ig",
";",
"const",
"escapeCharCode",
"=",
"92",
";",
"// `\\` symbol",
"const",
"variables",
"=",
"[",
"]",
";",
"// We have to replace unescape... | Creates variable model from given string. The model contains a `string` with
all escaped variable tokens written without escape symbol and `variables`
property with all unescaped variables and their ranges
@param {String} string
@return {Object} | [
"Creates",
"variable",
"model",
"from",
"given",
"string",
".",
"The",
"model",
"contains",
"a",
"string",
"with",
"all",
"escaped",
"variable",
"tokens",
"written",
"without",
"escape",
"symbol",
"and",
"variables",
"property",
"with",
"all",
"unescaped",
"vari... | c6cf8ef476e731447418e718c8bd3f15fa518deb | https://github.com/emmetio/variable-resolver/blob/c6cf8ef476e731447418e718c8bd3f15fa518deb/index.js#L68-L115 |
52,460 | asavoy/grunt-requirejs-auto-bundles | lib/reduce.js | reduceBundles | function reduceBundles(bundles, dependencies, maxBundles) {
while (anyMainExceedsMaxBundles(bundles, maxBundles)) {
var merge = findLeastCostMerge(bundles, dependencies, maxBundles);
mergeBundles(merge.bundle1Name, merge.bundle2Name, bundles);
}
return bundles;
} | javascript | function reduceBundles(bundles, dependencies, maxBundles) {
while (anyMainExceedsMaxBundles(bundles, maxBundles)) {
var merge = findLeastCostMerge(bundles, dependencies, maxBundles);
mergeBundles(merge.bundle1Name, merge.bundle2Name, bundles);
}
return bundles;
} | [
"function",
"reduceBundles",
"(",
"bundles",
",",
"dependencies",
",",
"maxBundles",
")",
"{",
"while",
"(",
"anyMainExceedsMaxBundles",
"(",
"bundles",
",",
"maxBundles",
")",
")",
"{",
"var",
"merge",
"=",
"findLeastCostMerge",
"(",
"bundles",
",",
"dependenci... | Given a set of bundles, merge until no main module needs to fetch from more
than maxBundles number of bundles. | [
"Given",
"a",
"set",
"of",
"bundles",
"merge",
"until",
"no",
"main",
"module",
"needs",
"to",
"fetch",
"from",
"more",
"than",
"maxBundles",
"number",
"of",
"bundles",
"."
] | c0f587c9720943dd32098203d2c71ab1387f1700 | https://github.com/asavoy/grunt-requirejs-auto-bundles/blob/c0f587c9720943dd32098203d2c71ab1387f1700/lib/reduce.js#L10-L16 |
52,461 | jonschlinkert/resolve-up | index.js | resolve | function resolve(files, opts) {
var fn = opts.filter || function(fp) {
return true;
};
if (opts.realpath === true) {
return files.filter(fn);
}
var len = files.length;
var idx = -1;
var res = [];
while (++idx < len) {
var fp = path.resolve(opts.cwd, files[idx]);
if (!fn(fp) || ~res.in... | javascript | function resolve(files, opts) {
var fn = opts.filter || function(fp) {
return true;
};
if (opts.realpath === true) {
return files.filter(fn);
}
var len = files.length;
var idx = -1;
var res = [];
while (++idx < len) {
var fp = path.resolve(opts.cwd, files[idx]);
if (!fn(fp) || ~res.in... | [
"function",
"resolve",
"(",
"files",
",",
"opts",
")",
"{",
"var",
"fn",
"=",
"opts",
".",
"filter",
"||",
"function",
"(",
"fp",
")",
"{",
"return",
"true",
";",
"}",
";",
"if",
"(",
"opts",
".",
"realpath",
"===",
"true",
")",
"{",
"return",
"f... | Resolve the absolute path to a file using the given cwd. | [
"Resolve",
"the",
"absolute",
"path",
"to",
"a",
"file",
"using",
"the",
"given",
"cwd",
"."
] | d4c566630e85c3ab83af44df1bba46ff49ddaadc | https://github.com/jonschlinkert/resolve-up/blob/d4c566630e85c3ab83af44df1bba46ff49ddaadc/index.js#L64-L83 |
52,462 | halfblood369/monitor | lib/processMonitor.js | getPsInfo | function getPsInfo(param, callback) {
if (process.platform === 'windows') return;
var pid = param.pid;
var cmd = "ps auxw | grep " + pid + " | grep -v 'grep'";
//var cmd = "ps auxw | grep -E '.+?\\s+" + pid + "\\s+'" ;
exec(cmd, function(err, output) {
if (!!err) {
if (err.code === 1) {
console.... | javascript | function getPsInfo(param, callback) {
if (process.platform === 'windows') return;
var pid = param.pid;
var cmd = "ps auxw | grep " + pid + " | grep -v 'grep'";
//var cmd = "ps auxw | grep -E '.+?\\s+" + pid + "\\s+'" ;
exec(cmd, function(err, output) {
if (!!err) {
if (err.code === 1) {
console.... | [
"function",
"getPsInfo",
"(",
"param",
",",
"callback",
")",
"{",
"if",
"(",
"process",
".",
"platform",
"===",
"'windows'",
")",
"return",
";",
"var",
"pid",
"=",
"param",
".",
"pid",
";",
"var",
"cmd",
"=",
"\"ps auxw | grep \"",
"+",
"pid",
"+",
"\"... | get the process information by command 'ps auxw | grep serverId | grep pid'
@param {Object} param
@param {Function} callback
@api public | [
"get",
"the",
"process",
"information",
"by",
"command",
"ps",
"auxw",
"|",
"grep",
"serverId",
"|",
"grep",
"pid"
] | 900b5cadf59edcccac4754e5706a22719925ddb9 | https://github.com/halfblood369/monitor/blob/900b5cadf59edcccac4754e5706a22719925ddb9/lib/processMonitor.js#L23-L40 |
52,463 | arielschiavoni/commonjsify | src/commonjsify.js | browserifyTransform | function browserifyTransform(file) {
var chunks = [];
var write = function(buffer) {
chunks.push(buffer);
};
var end = function() {
var content = Buffer.concat(chunks).toString('utf8');
// convention fileName == key for shim options
var fileName = file.match(/([^\/]+)(?=\.\w+$)... | javascript | function browserifyTransform(file) {
var chunks = [];
var write = function(buffer) {
chunks.push(buffer);
};
var end = function() {
var content = Buffer.concat(chunks).toString('utf8');
// convention fileName == key for shim options
var fileName = file.match(/([^\/]+)(?=\.\w+$)... | [
"function",
"browserifyTransform",
"(",
"file",
")",
"{",
"var",
"chunks",
"=",
"[",
"]",
";",
"var",
"write",
"=",
"function",
"(",
"buffer",
")",
"{",
"chunks",
".",
"push",
"(",
"buffer",
")",
";",
"}",
";",
"var",
"end",
"=",
"function",
"(",
"... | The function Browserify will use to transform the input.
@param {string} file
@returns {stream} | [
"The",
"function",
"Browserify",
"will",
"use",
"to",
"transform",
"the",
"input",
"."
] | 544dff6bdf2f4aad8802cbfb60d2aa5852482c0f | https://github.com/arielschiavoni/commonjsify/blob/544dff6bdf2f4aad8802cbfb60d2aa5852482c0f/src/commonjsify.js#L25-L41 |
52,464 | nknapp/deep-aplus | .thought/helpers.js | function (cwd, filename, options, customizeEngine) {
var helpers = customizeEngine.engine.helpers
var code = helpers.example(path.join(cwd, filename), {
hash: {
snippet: true
}
})
var result = helpers.exec(`node ${filename}`, {
hash: {
cwd: cwd,
lang: 'raw'
... | javascript | function (cwd, filename, options, customizeEngine) {
var helpers = customizeEngine.engine.helpers
var code = helpers.example(path.join(cwd, filename), {
hash: {
snippet: true
}
})
var result = helpers.exec(`node ${filename}`, {
hash: {
cwd: cwd,
lang: 'raw'
... | [
"function",
"(",
"cwd",
",",
"filename",
",",
"options",
",",
"customizeEngine",
")",
"{",
"var",
"helpers",
"=",
"customizeEngine",
".",
"engine",
".",
"helpers",
"var",
"code",
"=",
"helpers",
".",
"example",
"(",
"path",
".",
"join",
"(",
"cwd",
",",
... | Merges the example output into the source code.
In the example, `console.log` must be wrapped so that `\u0001` is
inserted before each output.
`console.log` may not be called in loops. | [
"Merges",
"the",
"example",
"output",
"into",
"the",
"source",
"code",
".",
"In",
"the",
"example",
"console",
".",
"log",
"must",
"be",
"wrapped",
"so",
"that",
"\\",
"u0001",
"is",
"inserted",
"before",
"each",
"output",
".",
"console",
".",
"log",
"ma... | da8c5432e895c5087dc1f1a2234be4273ab0592c | https://github.com/nknapp/deep-aplus/blob/da8c5432e895c5087dc1f1a2234be4273ab0592c/.thought/helpers.js#L11-L34 | |
52,465 | redisjs/jsr-server | lib/network.js | NetworkServer | function NetworkServer(server) {
this.server = server;
function connection(socket) {
server.connection(socket, this);
}
this.on('connection', connection);
} | javascript | function NetworkServer(server) {
this.server = server;
function connection(socket) {
server.connection(socket, this);
}
this.on('connection', connection);
} | [
"function",
"NetworkServer",
"(",
"server",
")",
"{",
"this",
".",
"server",
"=",
"server",
";",
"function",
"connection",
"(",
"socket",
")",
"{",
"server",
".",
"connection",
"(",
"socket",
",",
"this",
")",
";",
"}",
"this",
".",
"on",
"(",
"'connec... | Abstract server class.
@param server The main server instance. | [
"Abstract",
"server",
"class",
"."
] | 49413052d3039524fbdd2ade0ef9bae26cb4d647 | https://github.com/redisjs/jsr-server/blob/49413052d3039524fbdd2ade0ef9bae26cb4d647/lib/network.js#L13-L19 |
52,466 | redisjs/jsr-server | lib/network.js | listen | function listen(file, perm) {
var args = [file]
, perm = perm || 0700
, server = this;
this.file = file;
this.name = path.basename(file);
if(this.name === file) {
file = path.join(process.cwd(), file);
}
function onListen() {
try {
fs.chmodSync(file, perm);
}catch(e){}
log.n... | javascript | function listen(file, perm) {
var args = [file]
, perm = perm || 0700
, server = this;
this.file = file;
this.name = path.basename(file);
if(this.name === file) {
file = path.join(process.cwd(), file);
}
function onListen() {
try {
fs.chmodSync(file, perm);
}catch(e){}
log.n... | [
"function",
"listen",
"(",
"file",
",",
"perm",
")",
"{",
"var",
"args",
"=",
"[",
"file",
"]",
",",
"perm",
"=",
"perm",
"||",
"0700",
",",
"server",
"=",
"this",
";",
"this",
".",
"file",
"=",
"file",
";",
"this",
".",
"name",
"=",
"path",
".... | Listen on a UNIX domain socket. | [
"Listen",
"on",
"a",
"UNIX",
"domain",
"socket",
"."
] | 49413052d3039524fbdd2ade0ef9bae26cb4d647 | https://github.com/redisjs/jsr-server/blob/49413052d3039524fbdd2ade0ef9bae26cb4d647/lib/network.js#L44-L83 |
52,467 | redisjs/jsr-server | lib/network.js | close | function close() {
log.notice('removing the unix socket file')
try {
fs.unlinkSync(file);
}catch(e){} // nothing to do at this point
Server.prototype.close.call(this);
} | javascript | function close() {
log.notice('removing the unix socket file')
try {
fs.unlinkSync(file);
}catch(e){} // nothing to do at this point
Server.prototype.close.call(this);
} | [
"function",
"close",
"(",
")",
"{",
"log",
".",
"notice",
"(",
"'removing the unix socket file'",
")",
"try",
"{",
"fs",
".",
"unlinkSync",
"(",
"file",
")",
";",
"}",
"catch",
"(",
"e",
")",
"{",
"}",
"// nothing to do at this point",
"Server",
".",
"prot... | Close the UNIX domain socket server. | [
"Close",
"the",
"UNIX",
"domain",
"socket",
"server",
"."
] | 49413052d3039524fbdd2ade0ef9bae26cb4d647 | https://github.com/redisjs/jsr-server/blob/49413052d3039524fbdd2ade0ef9bae26cb4d647/lib/network.js#L88-L95 |
52,468 | MoonHighway/mh-xmldown | index.js | function (next) {
request(url, function (err, res, body) {
if (err) {
return next(err);
}
next(null, body);
});
} | javascript | function (next) {
request(url, function (err, res, body) {
if (err) {
return next(err);
}
next(null, body);
});
} | [
"function",
"(",
"next",
")",
"{",
"request",
"(",
"url",
",",
"function",
"(",
"err",
",",
"res",
",",
"body",
")",
"{",
"if",
"(",
"err",
")",
"{",
"return",
"next",
"(",
"err",
")",
";",
"}",
"next",
"(",
"null",
",",
"body",
")",
";",
"}"... | 1 - Request the XML File | [
"1",
"-",
"Request",
"the",
"XML",
"File"
] | 373e0301810e7c7ec905378703201a6067d73565 | https://github.com/MoonHighway/mh-xmldown/blob/373e0301810e7c7ec905378703201a6067d73565/index.js#L31-L38 | |
52,469 | MoonHighway/mh-xmldown | index.js | function (body, next) {
fs.writeFile(out + "/" + path.basename(url), body, function (err) {
if (err) {
return next(err);
}
next(null, body);
});
} | javascript | function (body, next) {
fs.writeFile(out + "/" + path.basename(url), body, function (err) {
if (err) {
return next(err);
}
next(null, body);
});
} | [
"function",
"(",
"body",
",",
"next",
")",
"{",
"fs",
".",
"writeFile",
"(",
"out",
"+",
"\"/\"",
"+",
"path",
".",
"basename",
"(",
"url",
")",
",",
"body",
",",
"function",
"(",
"err",
")",
"{",
"if",
"(",
"err",
")",
"{",
"return",
"next",
"... | 2 - Save the XML File Locally | [
"2",
"-",
"Save",
"the",
"XML",
"File",
"Locally"
] | 373e0301810e7c7ec905378703201a6067d73565 | https://github.com/MoonHighway/mh-xmldown/blob/373e0301810e7c7ec905378703201a6067d73565/index.js#L41-L48 | |
52,470 | MoonHighway/mh-xmldown | index.js | function (body, next) {
parseString(body, function (err, json) {
if (err) {
return next(err);
}
next(null, json);
});
} | javascript | function (body, next) {
parseString(body, function (err, json) {
if (err) {
return next(err);
}
next(null, json);
});
} | [
"function",
"(",
"body",
",",
"next",
")",
"{",
"parseString",
"(",
"body",
",",
"function",
"(",
"err",
",",
"json",
")",
"{",
"if",
"(",
"err",
")",
"{",
"return",
"next",
"(",
"err",
")",
";",
"}",
"next",
"(",
"null",
",",
"json",
")",
";",... | 3 - Parse the XML File as JSON | [
"3",
"-",
"Parse",
"the",
"XML",
"File",
"as",
"JSON"
] | 373e0301810e7c7ec905378703201a6067d73565 | https://github.com/MoonHighway/mh-xmldown/blob/373e0301810e7c7ec905378703201a6067d73565/index.js#L51-L58 | |
52,471 | MoonHighway/mh-xmldown | index.js | function(json, next) {
fs.writeFile(out + "/" + path.basename(url).replace('.xml', '.json'), JSON.stringify(json), function (err) {
if (err) {
return next(err);
}
next(null, json);
});
} | javascript | function(json, next) {
fs.writeFile(out + "/" + path.basename(url).replace('.xml', '.json'), JSON.stringify(json), function (err) {
if (err) {
return next(err);
}
next(null, json);
});
} | [
"function",
"(",
"json",
",",
"next",
")",
"{",
"fs",
".",
"writeFile",
"(",
"out",
"+",
"\"/\"",
"+",
"path",
".",
"basename",
"(",
"url",
")",
".",
"replace",
"(",
"'.xml'",
",",
"'.json'",
")",
",",
"JSON",
".",
"stringify",
"(",
"json",
")",
... | 4 - Save the JSON file locally | [
"4",
"-",
"Save",
"the",
"JSON",
"file",
"locally"
] | 373e0301810e7c7ec905378703201a6067d73565 | https://github.com/MoonHighway/mh-xmldown/blob/373e0301810e7c7ec905378703201a6067d73565/index.js#L61-L68 | |
52,472 | zerobias/knack | index.js | Knack | function Knack({ concurrency = 5, interval = 500, onDone = () => {} }={}) {
const q = new Queue(concurrency, interval, onDone)
/**
* @func knack
* @template T
* @param {function(...args): Promise<T>} func
* @returns {function(...args): Promise<T>}
*/
const knack = function(func, {
priority = 50... | javascript | function Knack({ concurrency = 5, interval = 500, onDone = () => {} }={}) {
const q = new Queue(concurrency, interval, onDone)
/**
* @func knack
* @template T
* @param {function(...args): Promise<T>} func
* @returns {function(...args): Promise<T>}
*/
const knack = function(func, {
priority = 50... | [
"function",
"Knack",
"(",
"{",
"concurrency",
"=",
"5",
",",
"interval",
"=",
"500",
",",
"onDone",
"=",
"(",
")",
"=>",
"{",
"}",
"}",
"=",
"{",
"}",
")",
"{",
"const",
"q",
"=",
"new",
"Queue",
"(",
"concurrency",
",",
"interval",
",",
"onDone"... | Create Queue wrapper
@param {any} [{ concurrency = 5, interval = 500 }={}] options | [
"Create",
"Queue",
"wrapper"
] | 24a97f30edf0d06a0a6cd7d7a34d7a38f11c43dd | https://github.com/zerobias/knack/blob/24a97f30edf0d06a0a6cd7d7a34d7a38f11c43dd/index.js#L110-L149 |
52,473 | tuunanen/camelton | lib/util.js | function(file) {
var filePath = path.resolve(file);
if (filePath && fs.existsSync(filePath)) {
return filePath;
}
return false;
} | javascript | function(file) {
var filePath = path.resolve(file);
if (filePath && fs.existsSync(filePath)) {
return filePath;
}
return false;
} | [
"function",
"(",
"file",
")",
"{",
"var",
"filePath",
"=",
"path",
".",
"resolve",
"(",
"file",
")",
";",
"if",
"(",
"filePath",
"&&",
"fs",
".",
"existsSync",
"(",
"filePath",
")",
")",
"{",
"return",
"filePath",
";",
"}",
"return",
"false",
";",
... | Resolves file path.
@param {string} file - File path.
@returns {string|boolean} Resolved file path, or false if path does not
exist. | [
"Resolves",
"file",
"path",
"."
] | 2beee32431e1b2867396e25f560f8dbd53535041 | https://github.com/tuunanen/camelton/blob/2beee32431e1b2867396e25f560f8dbd53535041/lib/util.js#L42-L50 | |
52,474 | tuunanen/camelton | lib/util.js | function(file) {
var filePath = path.resolve(file);
if (filePath) {
if (!fs.existsSync(filePath)) {
fse.ensureFileSync(filePath);
}
return filePath;
}
return false;
} | javascript | function(file) {
var filePath = path.resolve(file);
if (filePath) {
if (!fs.existsSync(filePath)) {
fse.ensureFileSync(filePath);
}
return filePath;
}
return false;
} | [
"function",
"(",
"file",
")",
"{",
"var",
"filePath",
"=",
"path",
".",
"resolve",
"(",
"file",
")",
";",
"if",
"(",
"filePath",
")",
"{",
"if",
"(",
"!",
"fs",
".",
"existsSync",
"(",
"filePath",
")",
")",
"{",
"fse",
".",
"ensureFileSync",
"(",
... | Resolves file path, and ensures the file exist.
@param {string} file - File path.
@returns {string|boolean} Resolved file path, or false if path cannot be
created. | [
"Resolves",
"file",
"path",
"and",
"ensures",
"the",
"file",
"exist",
"."
] | 2beee32431e1b2867396e25f560f8dbd53535041 | https://github.com/tuunanen/camelton/blob/2beee32431e1b2867396e25f560f8dbd53535041/lib/util.js#L59-L70 | |
52,475 | Nazariglez/perenquen | lib/pixi/src/core/renderers/webgl/utils/Quad.js | Quad | function Quad(gl)
{
/*
* the current WebGL drawing context
*
* @member {WebGLRenderingContext}
*/
this.gl = gl;
// this.textures = new TextureUvs();
/**
* An array of vertices
*
* @member {Float32Array}
*/
this.vertices = new Float32Array([
0,0,
... | javascript | function Quad(gl)
{
/*
* the current WebGL drawing context
*
* @member {WebGLRenderingContext}
*/
this.gl = gl;
// this.textures = new TextureUvs();
/**
* An array of vertices
*
* @member {Float32Array}
*/
this.vertices = new Float32Array([
0,0,
... | [
"function",
"Quad",
"(",
"gl",
")",
"{",
"/*\n * the current WebGL drawing context\n *\n * @member {WebGLRenderingContext}\n */",
"this",
".",
"gl",
"=",
"gl",
";",
"// this.textures = new TextureUvs();",
"/**\n * An array of vertices\n *\n * @member {Float... | Helper class to create a quad
@class
@memberof PIXI
@param gl {WebGLRenderingContext} The gl context for this quad to use. | [
"Helper",
"class",
"to",
"create",
"a",
"quad"
] | e023964d05afeefebdcac4e2044819fdfa3899ae | https://github.com/Nazariglez/perenquen/blob/e023964d05afeefebdcac4e2044819fdfa3899ae/lib/pixi/src/core/renderers/webgl/utils/Quad.js#L7-L80 |
52,476 | selfcontained/browserify-dev-bundler | lib/bundler.js | function(moduleRegex) {
var self = this;
moduleRegex = moduleRegex || /^(.+)\.js$/;
return function(req, res, next) {
var match = req.url.match(moduleRegex);
if(!match) return next();
var module= match[1];
self.bundle(module, function(err, src)... | javascript | function(moduleRegex) {
var self = this;
moduleRegex = moduleRegex || /^(.+)\.js$/;
return function(req, res, next) {
var match = req.url.match(moduleRegex);
if(!match) return next();
var module= match[1];
self.bundle(module, function(err, src)... | [
"function",
"(",
"moduleRegex",
")",
"{",
"var",
"self",
"=",
"this",
";",
"moduleRegex",
"=",
"moduleRegex",
"||",
"/",
"^(.+)\\.js$",
"/",
";",
"return",
"function",
"(",
"req",
",",
"res",
",",
"next",
")",
"{",
"var",
"match",
"=",
"req",
".",
"u... | Generate a middeware function + moduleRegex - regex - used to match urls - requires the first capture group to be the module | [
"Generate",
"a",
"middeware",
"function",
"+",
"moduleRegex",
"-",
"regex",
"-",
"used",
"to",
"match",
"urls",
"-",
"requires",
"the",
"first",
"capture",
"group",
"to",
"be",
"the",
"module"
] | 7e3540ae9b42d0858495b0e99e9495b9ba14443d | https://github.com/selfcontained/browserify-dev-bundler/blob/7e3540ae9b42d0858495b0e99e9495b9ba14443d/lib/bundler.js#L46-L67 | |
52,477 | berkeleybop/bbopx-js | external/bbop.js | _same_set | function _same_set(set1, set2){
var h1 = {};
var h2 = {};
for( var h1i = 0; h1i < set1.length; h1i++ ){ h1[set1[h1i]] = 1; }
for( var h2i = 0; h2i < set2.length; h2i++ ){ h2[set2[h2i]] = 1; }
return _same_hash(h1, h2);
} | javascript | function _same_set(set1, set2){
var h1 = {};
var h2 = {};
for( var h1i = 0; h1i < set1.length; h1i++ ){ h1[set1[h1i]] = 1; }
for( var h2i = 0; h2i < set2.length; h2i++ ){ h2[set2[h2i]] = 1; }
return _same_hash(h1, h2);
} | [
"function",
"_same_set",
"(",
"set1",
",",
"set2",
")",
"{",
"var",
"h1",
"=",
"{",
"}",
";",
"var",
"h2",
"=",
"{",
"}",
";",
"for",
"(",
"var",
"h1i",
"=",
"0",
";",
"h1i",
"<",
"set1",
".",
"length",
";",
"h1i",
"++",
")",
"{",
"h1",
"["... | Looking at array as sets of...something. DEPRECATED | [
"Looking",
"at",
"array",
"as",
"sets",
"of",
"...",
"something",
".",
"DEPRECATED"
] | 847d87f5980f144c19c4caef3786044930fe51db | https://github.com/berkeleybop/bbopx-js/blob/847d87f5980f144c19c4caef3786044930fe51db/external/bbop.js#L1341-L1347 |
52,478 | berkeleybop/bbopx-js | external/bbop.js | _is_same | function _is_same(a, b){
//bark('typeof(a, b): ' + typeof(a) + ',' + typeof(b));
var ret = false;
if( a == b ){ // atoms, incl. null and 'string'
//bark('true on equal atoms: ' + a + '<>' + b);
ret = true;
}else{ // is list or obj (ignore func)
if( typeof(a) === 'object' && typeof(b) === 'object' ){... | javascript | function _is_same(a, b){
//bark('typeof(a, b): ' + typeof(a) + ',' + typeof(b));
var ret = false;
if( a == b ){ // atoms, incl. null and 'string'
//bark('true on equal atoms: ' + a + '<>' + b);
ret = true;
}else{ // is list or obj (ignore func)
if( typeof(a) === 'object' && typeof(b) === 'object' ){... | [
"function",
"_is_same",
"(",
"a",
",",
"b",
")",
"{",
"//bark('typeof(a, b): ' + typeof(a) + ',' + typeof(b));",
"var",
"ret",
"=",
"false",
";",
"if",
"(",
"a",
"==",
"b",
")",
"{",
"// atoms, incl. null and 'string'",
"//bark('true on equal atoms: ' + a + '<>' + b);",
... | Better general comparison function. | [
"Better",
"general",
"comparison",
"function",
"."
] | 847d87f5980f144c19c4caef3786044930fe51db | https://github.com/berkeleybop/bbopx-js/blob/847d87f5980f144c19c4caef3786044930fe51db/external/bbop.js#L1382-L1442 |
52,479 | berkeleybop/bbopx-js | external/bbop.js | _in_list | function _in_list(in_item, list, comparator){
var retval = false;
for(var li = 0; li < list.length; li++ ){
var list_item = list[li];
if( comparator ){
var comp_op = comparator(in_item, list_item);
if( comp_op && comp_op == true ){
retval = true;
}
}else{
if( in_item == list_item ){
... | javascript | function _in_list(in_item, list, comparator){
var retval = false;
for(var li = 0; li < list.length; li++ ){
var list_item = list[li];
if( comparator ){
var comp_op = comparator(in_item, list_item);
if( comp_op && comp_op == true ){
retval = true;
}
}else{
if( in_item == list_item ){
... | [
"function",
"_in_list",
"(",
"in_item",
",",
"list",
",",
"comparator",
")",
"{",
"var",
"retval",
"=",
"false",
";",
"for",
"(",
"var",
"li",
"=",
"0",
";",
"li",
"<",
"list",
".",
"length",
";",
"li",
"++",
")",
"{",
"var",
"list_item",
"=",
"l... | Walk through the list and see if it's there. If compareator is not defined, just to atom comparison. | [
"Walk",
"through",
"the",
"list",
"and",
"see",
"if",
"it",
"s",
"there",
".",
"If",
"compareator",
"is",
"not",
"defined",
"just",
"to",
"atom",
"comparison",
"."
] | 847d87f5980f144c19c4caef3786044930fe51db | https://github.com/berkeleybop/bbopx-js/blob/847d87f5980f144c19c4caef3786044930fe51db/external/bbop.js#L1486-L1505 |
52,480 | berkeleybop/bbopx-js | external/bbop.js | _is_string_embedded | function _is_string_embedded(target_str, base_str, add_str){
// Walk through all of ways of splitting base_str and add
// add_str in there to see if we get the target_str.
var retval = false;
for(var si = 0; si <= base_str.length; si++ ){
var car = base_str.substr(0, si);
var cdr = base_str.substr(... | javascript | function _is_string_embedded(target_str, base_str, add_str){
// Walk through all of ways of splitting base_str and add
// add_str in there to see if we get the target_str.
var retval = false;
for(var si = 0; si <= base_str.length; si++ ){
var car = base_str.substr(0, si);
var cdr = base_str.substr(... | [
"function",
"_is_string_embedded",
"(",
"target_str",
",",
"base_str",
",",
"add_str",
")",
"{",
"// Walk through all of ways of splitting base_str and add",
"// add_str in there to see if we get the target_str.",
"var",
"retval",
"=",
"false",
";",
"for",
"(",
"var",
"si",
... | Basically asking if you can make the target string from the base string with the add_str added into it somewhere. Strange, but another way of looking at URL creation in some cases. | [
"Basically",
"asking",
"if",
"you",
"can",
"make",
"the",
"target",
"string",
"from",
"the",
"base",
"string",
"with",
"the",
"add_str",
"added",
"into",
"it",
"somewhere",
".",
"Strange",
"but",
"another",
"way",
"of",
"looking",
"at",
"URL",
"creation",
... | 847d87f5980f144c19c4caef3786044930fe51db | https://github.com/berkeleybop/bbopx-js/blob/847d87f5980f144c19c4caef3786044930fe51db/external/bbop.js#L1510-L1526 |
52,481 | berkeleybop/bbopx-js | external/bbop.js | rec_up | function rec_up(nid){
//print('rec_up on: ' + nid);
var results = new Array();
var new_parent_edges = anchor.get_parent_edges(nid, pid);
// Capture edge list for later adding.
for( var e = 0; e < new_parent_edges.length; e++ ){
seen_edge_list.push(new_parent_edges[e]);
}
// Pull extant nodes fro... | javascript | function rec_up(nid){
//print('rec_up on: ' + nid);
var results = new Array();
var new_parent_edges = anchor.get_parent_edges(nid, pid);
// Capture edge list for later adding.
for( var e = 0; e < new_parent_edges.length; e++ ){
seen_edge_list.push(new_parent_edges[e]);
}
// Pull extant nodes fro... | [
"function",
"rec_up",
"(",
"nid",
")",
"{",
"//print('rec_up on: ' + nid);",
"var",
"results",
"=",
"new",
"Array",
"(",
")",
";",
"var",
"new_parent_edges",
"=",
"anchor",
".",
"get_parent_edges",
"(",
"nid",
",",
"pid",
")",
";",
"// Capture edge list for late... | Define recursive ascent. | [
"Define",
"recursive",
"ascent",
"."
] | 847d87f5980f144c19c4caef3786044930fe51db | https://github.com/berkeleybop/bbopx-js/blob/847d87f5980f144c19c4caef3786044930fe51db/external/bbop.js#L5738-L5784 |
52,482 | berkeleybop/bbopx-js | external/bbop.js | order_cohort | function order_cohort(in_brackets){
// Push into global cohort list list.
for( var i = 0; i < in_brackets.length; i++ ){
var bracket_item = in_brackets[i];
//
//_kvetch(' order_cohort: i: ' + i);
//_kvetch(' order_cohort: lvl: ' + bracket_item.level);
cohort_list[bracket_item.level - 1].push(br... | javascript | function order_cohort(in_brackets){
// Push into global cohort list list.
for( var i = 0; i < in_brackets.length; i++ ){
var bracket_item = in_brackets[i];
//
//_kvetch(' order_cohort: i: ' + i);
//_kvetch(' order_cohort: lvl: ' + bracket_item.level);
cohort_list[bracket_item.level - 1].push(br... | [
"function",
"order_cohort",
"(",
"in_brackets",
")",
"{",
"// Push into global cohort list list.",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"in_brackets",
".",
"length",
";",
"i",
"++",
")",
"{",
"var",
"bracket_item",
"=",
"in_brackets",
"[",
"i",
... | Walk down and stack up. | [
"Walk",
"down",
"and",
"stack",
"up",
"."
] | 847d87f5980f144c19c4caef3786044930fe51db | https://github.com/berkeleybop/bbopx-js/blob/847d87f5980f144c19c4caef3786044930fe51db/external/bbop.js#L6273-L6288 |
52,483 | berkeleybop/bbopx-js | external/bbop.js | _new_node_at | function _new_node_at(bnode, level){
ll("adding " + bnode.id() + " at level " + level + "!");
// Create new vertex and add to set.
var new_vertex = new bbop.layout.sugiyama.simple_vertex(bnode.id());
new_vertex.level = level;
vertex_set[ new_vertex.id() ] = new_vertex;
// Check the node in to the 'seen' refer... | javascript | function _new_node_at(bnode, level){
ll("adding " + bnode.id() + " at level " + level + "!");
// Create new vertex and add to set.
var new_vertex = new bbop.layout.sugiyama.simple_vertex(bnode.id());
new_vertex.level = level;
vertex_set[ new_vertex.id() ] = new_vertex;
// Check the node in to the 'seen' refer... | [
"function",
"_new_node_at",
"(",
"bnode",
",",
"level",
")",
"{",
"ll",
"(",
"\"adding \"",
"+",
"bnode",
".",
"id",
"(",
")",
"+",
"\" at level \"",
"+",
"level",
"+",
"\"!\"",
")",
";",
"// Create new vertex and add to set.",
"var",
"new_vertex",
"=",
"new... | Add a new node to the global variables. | [
"Add",
"a",
"new",
"node",
"to",
"the",
"global",
"variables",
"."
] | 847d87f5980f144c19c4caef3786044930fe51db | https://github.com/berkeleybop/bbopx-js/blob/847d87f5980f144c19c4caef3786044930fe51db/external/bbop.js#L7183-L7195 |
52,484 | berkeleybop/bbopx-js | external/bbop.js | getSubjectBarycenter | function getSubjectBarycenter(subject){
var weighted_number_of_edges = 0;
var number_of_edges = 0;
for( var o = 1; o <= object_vector.length; o++ ){
if( relation_matrix[object_vector[o -1].id()] &&
relation_matrix[object_vector[o -1].id()][subject.id()]){
weighted_number_of_edges += o;
number_of_edges++;... | javascript | function getSubjectBarycenter(subject){
var weighted_number_of_edges = 0;
var number_of_edges = 0;
for( var o = 1; o <= object_vector.length; o++ ){
if( relation_matrix[object_vector[o -1].id()] &&
relation_matrix[object_vector[o -1].id()][subject.id()]){
weighted_number_of_edges += o;
number_of_edges++;... | [
"function",
"getSubjectBarycenter",
"(",
"subject",
")",
"{",
"var",
"weighted_number_of_edges",
"=",
"0",
";",
"var",
"number_of_edges",
"=",
"0",
";",
"for",
"(",
"var",
"o",
"=",
"1",
";",
"o",
"<=",
"object_vector",
".",
"length",
";",
"o",
"++",
")"... | Gets barycenter for column s. | [
"Gets",
"barycenter",
"for",
"column",
"s",
"."
] | 847d87f5980f144c19c4caef3786044930fe51db | https://github.com/berkeleybop/bbopx-js/blob/847d87f5980f144c19c4caef3786044930fe51db/external/bbop.js#L7465-L7478 |
52,485 | berkeleybop/bbopx-js | external/bbop.js | on_error | function on_error(e) {
console.log('problem with request: ' + e.message);
var response = new anchor._response_handler(null);
response.okay(false);
response.message(e.message);
response.message_type('error');
anchor.apply_callbacks('error', [response, anchor]);
} | javascript | function on_error(e) {
console.log('problem with request: ' + e.message);
var response = new anchor._response_handler(null);
response.okay(false);
response.message(e.message);
response.message_type('error');
anchor.apply_callbacks('error', [response, anchor]);
} | [
"function",
"on_error",
"(",
"e",
")",
"{",
"console",
".",
"log",
"(",
"'problem with request: '",
"+",
"e",
".",
"message",
")",
";",
"var",
"response",
"=",
"new",
"anchor",
".",
"_response_handler",
"(",
"null",
")",
";",
"response",
".",
"okay",
"("... | What to do if an error is triggered. | [
"What",
"to",
"do",
"if",
"an",
"error",
"is",
"triggered",
"."
] | 847d87f5980f144c19c4caef3786044930fe51db | https://github.com/berkeleybop/bbopx-js/blob/847d87f5980f144c19c4caef3786044930fe51db/external/bbop.js#L8782-L8789 |
52,486 | berkeleybop/bbopx-js | external/bbop.js | on_error | function on_error(xhr, status, error) {
var response = new anchor._response_handler(null);
response.okay(false);
response.message(error);
response.message_type(status);
anchor.apply_callbacks('error', [response, anchor]);
} | javascript | function on_error(xhr, status, error) {
var response = new anchor._response_handler(null);
response.okay(false);
response.message(error);
response.message_type(status);
anchor.apply_callbacks('error', [response, anchor]);
} | [
"function",
"on_error",
"(",
"xhr",
",",
"status",
",",
"error",
")",
"{",
"var",
"response",
"=",
"new",
"anchor",
".",
"_response_handler",
"(",
"null",
")",
";",
"response",
".",
"okay",
"(",
"false",
")",
";",
"response",
".",
"message",
"(",
"erro... | What to do if an error is triggered. Remember that with jQuery, when using JSONP, there is no error. | [
"What",
"to",
"do",
"if",
"an",
"error",
"is",
"triggered",
".",
"Remember",
"that",
"with",
"jQuery",
"when",
"using",
"JSONP",
"there",
"is",
"no",
"error",
"."
] | 847d87f5980f144c19c4caef3786044930fe51db | https://github.com/berkeleybop/bbopx-js/blob/847d87f5980f144c19c4caef3786044930fe51db/external/bbop.js#L9041-L9047 |
52,487 | berkeleybop/bbopx-js | external/bbop.js | _full_delete | function _full_delete(hash, key1, key2){
if( key1 && key2 && hash &&
hash[key1] && hash[key1][key2] ){
delete hash[key1][key2];
}
if( bbop.core.is_empty(hash[key1]) ){
delete hash[key1];
}
} | javascript | function _full_delete(hash, key1, key2){
if( key1 && key2 && hash &&
hash[key1] && hash[key1][key2] ){
delete hash[key1][key2];
}
if( bbop.core.is_empty(hash[key1]) ){
delete hash[key1];
}
} | [
"function",
"_full_delete",
"(",
"hash",
",",
"key1",
",",
"key2",
")",
"{",
"if",
"(",
"key1",
"&&",
"key2",
"&&",
"hash",
"&&",
"hash",
"[",
"key1",
"]",
"&&",
"hash",
"[",
"key1",
"]",
"[",
"key2",
"]",
")",
"{",
"delete",
"hash",
"[",
"key1",... | Internal helper to delete a low level key, and then if the top-level is empty, get that one too. | [
"Internal",
"helper",
"to",
"delete",
"a",
"low",
"level",
"key",
"and",
"then",
"if",
"the",
"top",
"-",
"level",
"is",
"empty",
"get",
"that",
"one",
"too",
"."
] | 847d87f5980f144c19c4caef3786044930fe51db | https://github.com/berkeleybop/bbopx-js/blob/847d87f5980f144c19c4caef3786044930fe51db/external/bbop.js#L11109-L11117 |
52,488 | berkeleybop/bbopx-js | external/bbop.js | _lock_map | function _lock_map(field, id_list){
var fixed_list = [];
bbop.core.each(id_list,
function(item){
fixed_list.push(bbop.core.ensure(item, '"'));
});
var base_id_list = '(' + fixed_list.join(' OR ') + ')';
var ret_query = field + ':' + base_id_list;
return ret_query;
} | javascript | function _lock_map(field, id_list){
var fixed_list = [];
bbop.core.each(id_list,
function(item){
fixed_list.push(bbop.core.ensure(item, '"'));
});
var base_id_list = '(' + fixed_list.join(' OR ') + ')';
var ret_query = field + ':' + base_id_list;
return ret_query;
} | [
"function",
"_lock_map",
"(",
"field",
",",
"id_list",
")",
"{",
"var",
"fixed_list",
"=",
"[",
"]",
";",
"bbop",
".",
"core",
".",
"each",
"(",
"id_list",
",",
"function",
"(",
"item",
")",
"{",
"fixed_list",
".",
"push",
"(",
"bbop",
".",
"core",
... | Function to unwind and lock a list if identifiers onto a field. | [
"Function",
"to",
"unwind",
"and",
"lock",
"a",
"list",
"if",
"identifiers",
"onto",
"a",
"field",
"."
] | 847d87f5980f144c19c4caef3786044930fe51db | https://github.com/berkeleybop/bbopx-js/blob/847d87f5980f144c19c4caef3786044930fe51db/external/bbop.js#L11960-L11972 |
52,489 | berkeleybop/bbopx-js | external/bbop.js | _create_select_box | function _create_select_box(val, id, name){
if( ! is_defined(name) ){
name = select_item_name;
}
var input_attrs = {
'value': val,
'name': name,
'type': 'checkbox'
};
if( is_defined(id) ){
input_attrs['id'] = id;
}
var input = new bbop.html.input(input_attrs);
return input;
} | javascript | function _create_select_box(val, id, name){
if( ! is_defined(name) ){
name = select_item_name;
}
var input_attrs = {
'value': val,
'name': name,
'type': 'checkbox'
};
if( is_defined(id) ){
input_attrs['id'] = id;
}
var input = new bbop.html.input(input_attrs);
return input;
} | [
"function",
"_create_select_box",
"(",
"val",
",",
"id",
",",
"name",
")",
"{",
"if",
"(",
"!",
"is_defined",
"(",
"name",
")",
")",
"{",
"name",
"=",
"select_item_name",
";",
"}",
"var",
"input_attrs",
"=",
"{",
"'value'",
":",
"val",
",",
"'name'",
... | Create a locally mangled checkbox. | [
"Create",
"a",
"locally",
"mangled",
"checkbox",
"."
] | 847d87f5980f144c19c4caef3786044930fe51db | https://github.com/berkeleybop/bbopx-js/blob/847d87f5980f144c19c4caef3786044930fe51db/external/bbop.js#L14702-L14717 |
52,490 | berkeleybop/bbopx-js | external/bbop.js | _ignorable_event | function _ignorable_event(event){
var retval = false;
if( event ){
var kc = event.keyCode;
if( kc ){
if( kc == 39 || // right
kc == 37 || // left
kc == 32 || // space
kc == 20 || // ctl?
kc == 17 || // ctl?
... | javascript | function _ignorable_event(event){
var retval = false;
if( event ){
var kc = event.keyCode;
if( kc ){
if( kc == 39 || // right
kc == 37 || // left
kc == 32 || // space
kc == 20 || // ctl?
kc == 17 || // ctl?
... | [
"function",
"_ignorable_event",
"(",
"event",
")",
"{",
"var",
"retval",
"=",
"false",
";",
"if",
"(",
"event",
")",
"{",
"var",
"kc",
"=",
"event",
".",
"keyCode",
";",
"if",
"(",
"kc",
")",
"{",
"if",
"(",
"kc",
"==",
"39",
"||",
"// right",
"k... | Detect whether or not a keyboard event is ignorable. | [
"Detect",
"whether",
"or",
"not",
"a",
"keyboard",
"event",
"is",
"ignorable",
"."
] | 847d87f5980f144c19c4caef3786044930fe51db | https://github.com/berkeleybop/bbopx-js/blob/847d87f5980f144c19c4caef3786044930fe51db/external/bbop.js#L16505-L16526 |
52,491 | berkeleybop/bbopx-js | external/bbop.js | _nothing_to_see_here | function _nothing_to_see_here(in_field){
var section_id = filter_accordion_widget.get_section_id(in_field);
jQuery('#' + section_id).empty();
jQuery('#' + section_id).append('Nothing to filter.');
} | javascript | function _nothing_to_see_here(in_field){
var section_id = filter_accordion_widget.get_section_id(in_field);
jQuery('#' + section_id).empty();
jQuery('#' + section_id).append('Nothing to filter.');
} | [
"function",
"_nothing_to_see_here",
"(",
"in_field",
")",
"{",
"var",
"section_id",
"=",
"filter_accordion_widget",
".",
"get_section_id",
"(",
"in_field",
")",
";",
"jQuery",
"(",
"'#'",
"+",
"section_id",
")",
".",
"empty",
"(",
")",
";",
"jQuery",
"(",
"'... | A helper function for when no filters are displayed. | [
"A",
"helper",
"function",
"for",
"when",
"no",
"filters",
"are",
"displayed",
"."
] | 847d87f5980f144c19c4caef3786044930fe51db | https://github.com/berkeleybop/bbopx-js/blob/847d87f5980f144c19c4caef3786044930fe51db/external/bbop.js#L16851-L16855 |
52,492 | berkeleybop/bbopx-js | external/bbop.js | draw_shield | function draw_shield(resp){
// ll("shield what: " + bbop.core.what_is(resp));
// ll("shield resp: " + bbop.core.dump(resp));
// First, extract the fields from the
// minimal response.
var fina = call_time_field_name;
var flist = resp.facet_field(call_time_field_name);
... | javascript | function draw_shield(resp){
// ll("shield what: " + bbop.core.what_is(resp));
// ll("shield resp: " + bbop.core.dump(resp));
// First, extract the fields from the
// minimal response.
var fina = call_time_field_name;
var flist = resp.facet_field(call_time_field_name);
... | [
"function",
"draw_shield",
"(",
"resp",
")",
"{",
"// ll(\"shield what: \" + bbop.core.what_is(resp));",
"// ll(\"shield resp: \" + bbop.core.dump(resp));",
"// First, extract the fields from the",
"// minimal response.",
"var",
"fina",
"=",
"call_time_field_name",
";",
"var",
"flist... | Open the populated shield. | [
"Open",
"the",
"populated",
"shield",
"."
] | 847d87f5980f144c19c4caef3786044930fe51db | https://github.com/berkeleybop/bbopx-js/blob/847d87f5980f144c19c4caef3786044930fe51db/external/bbop.js#L17104-L17116 |
52,493 | berkeleybop/bbopx-js | external/bbop.js | function(layout_level){
loop(layout_level, // for every item at this level
function(level_item){
var nid = level_item[0];
var lbl = level_item[1];
var rel = level_item[2];
// For various sections, decide to run image
// (img) or text code depending on whether
// or n... | javascript | function(layout_level){
loop(layout_level, // for every item at this level
function(level_item){
var nid = level_item[0];
var lbl = level_item[1];
var rel = level_item[2];
// For various sections, decide to run image
// (img) or text code depending on whether
// or n... | [
"function",
"(",
"layout_level",
")",
"{",
"loop",
"(",
"layout_level",
",",
"// for every item at this level",
"function",
"(",
"level_item",
")",
"{",
"var",
"nid",
"=",
"level_item",
"[",
"0",
"]",
";",
"var",
"lbl",
"=",
"level_item",
"[",
"1",
"]",
";... | for every level | [
"for",
"every",
"level"
] | 847d87f5980f144c19c4caef3786044930fe51db | https://github.com/berkeleybop/bbopx-js/blob/847d87f5980f144c19c4caef3786044930fe51db/external/bbop.js#L17811-L17908 | |
52,494 | berkeleybop/bbopx-js | external/bbop.js | function(request_data, response_hook) {
anchor.jq_vars['success'] = function(json_data){
var retlist = [];
var resp = new bbop.golr.response(json_data);
// Reset the last return; remember: tri-state.
result_count = null;
return_count = null;
if( resp.success() ){
// Get best shot at document c... | javascript | function(request_data, response_hook) {
anchor.jq_vars['success'] = function(json_data){
var retlist = [];
var resp = new bbop.golr.response(json_data);
// Reset the last return; remember: tri-state.
result_count = null;
return_count = null;
if( resp.success() ){
// Get best shot at document c... | [
"function",
"(",
"request_data",
",",
"response_hook",
")",
"{",
"anchor",
".",
"jq_vars",
"[",
"'success'",
"]",
"=",
"function",
"(",
"json_data",
")",
"{",
"var",
"retlist",
"=",
"[",
"]",
";",
"var",
"resp",
"=",
"new",
"bbop",
".",
"golr",
".",
... | Function for a successful data hit. The data getter, which is making it all more complicated than it needs to be...we need to close around those callback hooks so we have to do it inplace here. | [
"Function",
"for",
"a",
"successful",
"data",
"hit",
".",
"The",
"data",
"getter",
"which",
"is",
"making",
"it",
"all",
"more",
"complicated",
"than",
"it",
"needs",
"to",
"be",
"...",
"we",
"need",
"to",
"close",
"around",
"those",
"callback",
"hooks",
... | 847d87f5980f144c19c4caef3786044930fe51db | https://github.com/berkeleybop/bbopx-js/blob/847d87f5980f144c19c4caef3786044930fe51db/external/bbop.js#L18069-L18110 | |
52,495 | berkeleybop/bbopx-js | external/bbop.js | function(event, ui){
// Prevent default selection input filling action (from
// jQuery UI) when non-default marked.
if( ! anchor._fill_p ){
event.preventDefault();
}
var doc_to_apply = null;
if( ui.item ){
doc_to_apply = ui.item.document;
}
// Only do the callback if it ... | javascript | function(event, ui){
// Prevent default selection input filling action (from
// jQuery UI) when non-default marked.
if( ! anchor._fill_p ){
event.preventDefault();
}
var doc_to_apply = null;
if( ui.item ){
doc_to_apply = ui.item.document;
}
// Only do the callback if it ... | [
"function",
"(",
"event",
",",
"ui",
")",
"{",
"// Prevent default selection input filling action (from",
"// jQuery UI) when non-default marked.",
"if",
"(",
"!",
"anchor",
".",
"_fill_p",
")",
"{",
"event",
".",
"preventDefault",
"(",
")",
";",
"}",
"var",
"doc_to... | What to do when an element is selected. | [
"What",
"to",
"do",
"when",
"an",
"element",
"is",
"selected",
"."
] | 847d87f5980f144c19c4caef3786044930fe51db | https://github.com/berkeleybop/bbopx-js/blob/847d87f5980f144c19c4caef3786044930fe51db/external/bbop.js#L18112-L18130 | |
52,496 | berkeleybop/bbopx-js | external/bbop.js | _draw_local_doc | function _draw_local_doc(doc){
//ll(doc['id']);
var personality = anchor.get_personality();
var cclass = golr_conf_obj.get_class(personality);
var txt = 'Nothing here...';
if( doc && cclass ){
var tbl = new bbop.html.table();
var results_order = cclass.field_order_by_weight('result');
var each ... | javascript | function _draw_local_doc(doc){
//ll(doc['id']);
var personality = anchor.get_personality();
var cclass = golr_conf_obj.get_class(personality);
var txt = 'Nothing here...';
if( doc && cclass ){
var tbl = new bbop.html.table();
var results_order = cclass.field_order_by_weight('result');
var each ... | [
"function",
"_draw_local_doc",
"(",
"doc",
")",
"{",
"//ll(doc['id']);",
"var",
"personality",
"=",
"anchor",
".",
"get_personality",
"(",
")",
";",
"var",
"cclass",
"=",
"golr_conf_obj",
".",
"get_class",
"(",
"personality",
")",
";",
"var",
"txt",
"=",
"'N... | Draw a locally help Solr response doc. | [
"Draw",
"a",
"locally",
"help",
"Solr",
"response",
"doc",
"."
] | 847d87f5980f144c19c4caef3786044930fe51db | https://github.com/berkeleybop/bbopx-js/blob/847d87f5980f144c19c4caef3786044930fe51db/external/bbop.js#L18352-L18423 |
52,497 | berkeleybop/bbopx-js | external/bbop.js | _get_selected | function _get_selected(){
var ret_list = [];
var selected_strings =
jQuery('#'+ sul_id).sortable('toArray', {'attribute': 'value'});
each(selected_strings,
function(in_thing){
if( in_thing && in_thing != '' ){
ret_list.push(in_thing);
}
});
return ret_list;
} | javascript | function _get_selected(){
var ret_list = [];
var selected_strings =
jQuery('#'+ sul_id).sortable('toArray', {'attribute': 'value'});
each(selected_strings,
function(in_thing){
if( in_thing && in_thing != '' ){
ret_list.push(in_thing);
}
});
return ret_list;
} | [
"function",
"_get_selected",
"(",
")",
"{",
"var",
"ret_list",
"=",
"[",
"]",
";",
"var",
"selected_strings",
"=",
"jQuery",
"(",
"'#'",
"+",
"sul_id",
")",
".",
"sortable",
"(",
"'toArray'",
",",
"{",
"'attribute'",
":",
"'value'",
"}",
")",
";",
"eac... | Helper function to pull the values. Currently, JQuery adds a lot of extra non-attributes li tags when it creates the DnD, so filter those out to get just the fields ids. | [
"Helper",
"function",
"to",
"pull",
"the",
"values",
".",
"Currently",
"JQuery",
"adds",
"a",
"lot",
"of",
"extra",
"non",
"-",
"attributes",
"li",
"tags",
"when",
"it",
"creates",
"the",
"DnD",
"so",
"filter",
"those",
"out",
"to",
"get",
"just",
"the",... | 847d87f5980f144c19c4caef3786044930fe51db | https://github.com/berkeleybop/bbopx-js/blob/847d87f5980f144c19c4caef3786044930fe51db/external/bbop.js#L18852-L18863 |
52,498 | berkeleybop/bbopx-js | external/bbop.js | _button_wrapper | function _button_wrapper(str, title){
var b = new bbop.widget.display.text_button_sim(str, title, '');
return b.to_string();
} | javascript | function _button_wrapper(str, title){
var b = new bbop.widget.display.text_button_sim(str, title, '');
return b.to_string();
} | [
"function",
"_button_wrapper",
"(",
"str",
",",
"title",
")",
"{",
"var",
"b",
"=",
"new",
"bbop",
".",
"widget",
".",
"display",
".",
"text_button_sim",
"(",
"str",
",",
"title",
",",
"''",
")",
";",
"return",
"b",
".",
"to_string",
"(",
")",
";",
... | Our argument default hash. | [
"Our",
"argument",
"default",
"hash",
"."
] | 847d87f5980f144c19c4caef3786044930fe51db | https://github.com/berkeleybop/bbopx-js/blob/847d87f5980f144c19c4caef3786044930fe51db/external/bbop.js#L18998-L19001 |
52,499 | berkeleybop/bbopx-js | external/bbop.js | _initial_runner | function _initial_runner(response, manager){
// I can't just remove the callback from the register
// after the first run because it would be reconstituted
// every time it was reset (established).
if( anchor.initial_reset_p ){
anchor.initial_reset_p = false;
anchor.initial_reset_callback(respon... | javascript | function _initial_runner(response, manager){
// I can't just remove the callback from the register
// after the first run because it would be reconstituted
// every time it was reset (established).
if( anchor.initial_reset_p ){
anchor.initial_reset_p = false;
anchor.initial_reset_callback(respon... | [
"function",
"_initial_runner",
"(",
"response",
",",
"manager",
")",
"{",
"// I can't just remove the callback from the register",
"// after the first run because it would be reconstituted",
"// every time it was reset (established).",
"if",
"(",
"anchor",
".",
"initial_reset_p",
")"... | Finally, we're going to add a first run behavior here. We'll wrap the user-defined function into a | [
"Finally",
"we",
"re",
"going",
"to",
"add",
"a",
"first",
"run",
"behavior",
"here",
".",
"We",
"ll",
"wrap",
"the",
"user",
"-",
"defined",
"function",
"into",
"a"
] | 847d87f5980f144c19c4caef3786044930fe51db | https://github.com/berkeleybop/bbopx-js/blob/847d87f5980f144c19c4caef3786044930fe51db/external/bbop.js#L19123-L19132 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.