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 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
glennjones/microformat-shiv | microformat-shiv.js | function(rootNode, filters) {
if(modules.utils.isString(filters)){
filters = [filters];
}
var newRootNode = modules.domUtils.createNode('div'),
items = this.findRootNodes(rootNode, true),
i = 0,
x = 0,
y = 0;
// add v1 names
y = filters... | javascript | function(rootNode, filters) {
if(modules.utils.isString(filters)){
filters = [filters];
}
var newRootNode = modules.domUtils.createNode('div'),
items = this.findRootNodes(rootNode, true),
i = 0,
x = 0,
y = 0;
// add v1 names
y = filters... | [
"function",
"(",
"rootNode",
",",
"filters",
")",
"{",
"if",
"(",
"modules",
".",
"utils",
".",
"isString",
"(",
"filters",
")",
")",
"{",
"filters",
"=",
"[",
"filters",
"]",
";",
"}",
"var",
"newRootNode",
"=",
"modules",
".",
"domUtils",
".",
"cre... | find microformats of a given type and return node structures | [
"find",
"microformats",
"of",
"a",
"given",
"type",
"and",
"return",
"node",
"structures"
] | 90c5ea5e43ae95fc460aef79f8c19832c6f1dc26 | https://github.com/glennjones/microformat-shiv/blob/90c5ea5e43ae95fc460aef79f8c19832c6f1dc26/microformat-shiv.js#L403-L439 | train | |
glennjones/microformat-shiv | microformat-shiv.js | function(name, count, out){
if(out[name]){
out[name] = out[name] + count;
}else{
out[name] = count;
}
} | javascript | function(name, count, out){
if(out[name]){
out[name] = out[name] + count;
}else{
out[name] = count;
}
} | [
"function",
"(",
"name",
",",
"count",
",",
"out",
")",
"{",
"if",
"(",
"out",
"[",
"name",
"]",
")",
"{",
"out",
"[",
"name",
"]",
"=",
"out",
"[",
"name",
"]",
"+",
"count",
";",
"}",
"else",
"{",
"out",
"[",
"name",
"]",
"=",
"count",
";... | appends data to output object for count
@param {string} name
@param {Int} count
@param {Object} | [
"appends",
"data",
"to",
"output",
"object",
"for",
"count"
] | 90c5ea5e43ae95fc460aef79f8c19832c6f1dc26 | https://github.com/glennjones/microformat-shiv/blob/90c5ea5e43ae95fc460aef79f8c19832c6f1dc26/microformat-shiv.js#L449-L455 | train | |
glennjones/microformat-shiv | microformat-shiv.js | function(uf, filters) {
var i;
if(modules.utils.isArray(filters) && filters.length > 0) {
i = filters.length;
while(i--) {
if(uf.type[0] === filters[i]) {
return true;
}
}
return false;
} else {
return true;
}
} | javascript | function(uf, filters) {
var i;
if(modules.utils.isArray(filters) && filters.length > 0) {
i = filters.length;
while(i--) {
if(uf.type[0] === filters[i]) {
return true;
}
}
return false;
} else {
return true;
}
} | [
"function",
"(",
"uf",
",",
"filters",
")",
"{",
"var",
"i",
";",
"if",
"(",
"modules",
".",
"utils",
".",
"isArray",
"(",
"filters",
")",
"&&",
"filters",
".",
"length",
">",
"0",
")",
"{",
"i",
"=",
"filters",
".",
"length",
";",
"while",
"(",
... | is the microformats type in the filter list
@param {Object} uf
@param {Array} filters
@return {Boolean} | [
"is",
"the",
"microformats",
"type",
"in",
"the",
"filter",
"list"
] | 90c5ea5e43ae95fc460aef79f8c19832c6f1dc26 | https://github.com/glennjones/microformat-shiv/blob/90c5ea5e43ae95fc460aef79f8c19832c6f1dc26/microformat-shiv.js#L465-L479 | train | |
glennjones/microformat-shiv | microformat-shiv.js | function(rootNode, includeRoot) {
var arr = null,
out = [],
classList = [],
items,
x,
i,
y,
key;
// build an array of v1 root names
for(key in modules.maps) {
if (modules.maps.hasOwnProperty(key)) {
classList.push(modules.maps[key].root);
}
}
// get all element... | javascript | function(rootNode, includeRoot) {
var arr = null,
out = [],
classList = [],
items,
x,
i,
y,
key;
// build an array of v1 root names
for(key in modules.maps) {
if (modules.maps.hasOwnProperty(key)) {
classList.push(modules.maps[key].root);
}
}
// get all element... | [
"function",
"(",
"rootNode",
",",
"includeRoot",
")",
"{",
"var",
"arr",
"=",
"null",
",",
"out",
"=",
"[",
"]",
",",
"classList",
"=",
"[",
"]",
",",
"items",
",",
"x",
",",
"i",
",",
"y",
",",
"key",
";",
"// build an array of v1 root names",
"for"... | finds all microformat roots in a rootNode
@param {DOM Node} rootNode
@param {Boolean} includeRoot
@return {Array} | [
"finds",
"all",
"microformat",
"roots",
"in",
"a",
"rootNode"
] | 90c5ea5e43ae95fc460aef79f8c19832c6f1dc26 | https://github.com/glennjones/microformat-shiv/blob/90c5ea5e43ae95fc460aef79f8c19832c6f1dc26/microformat-shiv.js#L489-L541 | train | |
glennjones/microformat-shiv | microformat-shiv.js | function(node){
var context = this,
children = [],
child,
classes,
items = [],
out = [];
classes = this.getUfClassNames(node);
// if it is a root microformat node
if(classes && classes.root.length > 0){
items = this.walkTree(node);
if(items.length > 0){
out = out.concat(it... | javascript | function(node){
var context = this,
children = [],
child,
classes,
items = [],
out = [];
classes = this.getUfClassNames(node);
// if it is a root microformat node
if(classes && classes.root.length > 0){
items = this.walkTree(node);
if(items.length > 0){
out = out.concat(it... | [
"function",
"(",
"node",
")",
"{",
"var",
"context",
"=",
"this",
",",
"children",
"=",
"[",
"]",
",",
"child",
",",
"classes",
",",
"items",
"=",
"[",
"]",
",",
"out",
"=",
"[",
"]",
";",
"classes",
"=",
"this",
".",
"getUfClassNames",
"(",
"nod... | starts the tree walk to find microformats
@param {DOM Node} node
@return {Array} | [
"starts",
"the",
"tree",
"walk",
"to",
"find",
"microformats"
] | 90c5ea5e43ae95fc460aef79f8c19832c6f1dc26 | https://github.com/glennjones/microformat-shiv/blob/90c5ea5e43ae95fc460aef79f8c19832c6f1dc26/microformat-shiv.js#L550-L580 | train | |
glennjones/microformat-shiv | microformat-shiv.js | function(node) {
var classes,
out = [],
obj,
itemRootID;
// loop roots found on one element
classes = this.getUfClassNames(node);
if(classes && classes.root.length && classes.root.length > 0){
this.rootID++;
itemRootID = this.rootID;
obj = this.createUfObject(classes.root, classes.... | javascript | function(node) {
var classes,
out = [],
obj,
itemRootID;
// loop roots found on one element
classes = this.getUfClassNames(node);
if(classes && classes.root.length && classes.root.length > 0){
this.rootID++;
itemRootID = this.rootID;
obj = this.createUfObject(classes.root, classes.... | [
"function",
"(",
"node",
")",
"{",
"var",
"classes",
",",
"out",
"=",
"[",
"]",
",",
"obj",
",",
"itemRootID",
";",
"// loop roots found on one element",
"classes",
"=",
"this",
".",
"getUfClassNames",
"(",
"node",
")",
";",
"if",
"(",
"classes",
"&&",
"... | starts the tree walking for a single microformat
@param {DOM Node} node
@return {Array} | [
"starts",
"the",
"tree",
"walking",
"for",
"a",
"single",
"microformat"
] | 90c5ea5e43ae95fc460aef79f8c19832c6f1dc26 | https://github.com/glennjones/microformat-shiv/blob/90c5ea5e43ae95fc460aef79f8c19832c6f1dc26/microformat-shiv.js#L589-L619 | train | |
glennjones/microformat-shiv | microformat-shiv.js | function(node, className, uf) {
var value = '';
if(modules.utils.startWith(className, 'p-')) {
value = this.getPValue(node, true);
}
if(modules.utils.startWith(className, 'e-')) {
value = this.getEValue(node);
}
if(modules.utils.startWith(className, 'u-')) {
value = this.getUValue(node,... | javascript | function(node, className, uf) {
var value = '';
if(modules.utils.startWith(className, 'p-')) {
value = this.getPValue(node, true);
}
if(modules.utils.startWith(className, 'e-')) {
value = this.getEValue(node);
}
if(modules.utils.startWith(className, 'u-')) {
value = this.getUValue(node,... | [
"function",
"(",
"node",
",",
"className",
",",
"uf",
")",
"{",
"var",
"value",
"=",
"''",
";",
"if",
"(",
"modules",
".",
"utils",
".",
"startWith",
"(",
"className",
",",
"'p-'",
")",
")",
"{",
"value",
"=",
"this",
".",
"getPValue",
"(",
"node",... | gets the value of a property from a node
@param {DOM Node} node
@param {String} className
@param {Object} uf
@return {String || Object} | [
"gets",
"the",
"value",
"of",
"a",
"property",
"from",
"a",
"node"
] | 90c5ea5e43ae95fc460aef79f8c19832c6f1dc26 | https://github.com/glennjones/microformat-shiv/blob/90c5ea5e43ae95fc460aef79f8c19832c6f1dc26/microformat-shiv.js#L796-L815 | train | |
glennjones/microformat-shiv | microformat-shiv.js | function(node, valueParse) {
var out = '';
if(valueParse) {
out = this.getValueClass(node, 'p');
}
if(!out && valueParse) {
out = this.getValueTitle(node);
}
if(!out) {
out = modules.domUtils.getAttrValFromTagList(node, ['abbr'], 'title');
}
if(!out) {
out = modules.domUtils.g... | javascript | function(node, valueParse) {
var out = '';
if(valueParse) {
out = this.getValueClass(node, 'p');
}
if(!out && valueParse) {
out = this.getValueTitle(node);
}
if(!out) {
out = modules.domUtils.getAttrValFromTagList(node, ['abbr'], 'title');
}
if(!out) {
out = modules.domUtils.g... | [
"function",
"(",
"node",
",",
"valueParse",
")",
"{",
"var",
"out",
"=",
"''",
";",
"if",
"(",
"valueParse",
")",
"{",
"out",
"=",
"this",
".",
"getValueClass",
"(",
"node",
",",
"'p'",
")",
";",
"}",
"if",
"(",
"!",
"out",
"&&",
"valueParse",
")... | gets the value of a node which contains a 'p-' property
@param {DOM Node} node
@param {Boolean} valueParse
@return {String} | [
"gets",
"the",
"value",
"of",
"a",
"node",
"which",
"contains",
"a",
"p",
"-",
"property"
] | 90c5ea5e43ae95fc460aef79f8c19832c6f1dc26 | https://github.com/glennjones/microformat-shiv/blob/90c5ea5e43ae95fc460aef79f8c19832c6f1dc26/microformat-shiv.js#L825-L856 | train | |
glennjones/microformat-shiv | microformat-shiv.js | function(node) {
var out = {value: '', html: ''};
this.expandURLs(node, 'src', this.options.baseUrl);
this.expandURLs(node, 'href', this.options.baseUrl);
out.value = modules.text.parse(this.document, node, this.options.textFormat);
out.html = modules.html.parse(node);
if(this.options.lang === tru... | javascript | function(node) {
var out = {value: '', html: ''};
this.expandURLs(node, 'src', this.options.baseUrl);
this.expandURLs(node, 'href', this.options.baseUrl);
out.value = modules.text.parse(this.document, node, this.options.textFormat);
out.html = modules.html.parse(node);
if(this.options.lang === tru... | [
"function",
"(",
"node",
")",
"{",
"var",
"out",
"=",
"{",
"value",
":",
"''",
",",
"html",
":",
"''",
"}",
";",
"this",
".",
"expandURLs",
"(",
"node",
",",
"'src'",
",",
"this",
".",
"options",
".",
"baseUrl",
")",
";",
"this",
".",
"expandURLs... | gets the value of a node which contains the 'e-' property
@param {DOM Node} node
@return {Object} | [
"gets",
"the",
"value",
"of",
"a",
"node",
"which",
"contains",
"the",
"e",
"-",
"property"
] | 90c5ea5e43ae95fc460aef79f8c19832c6f1dc26 | https://github.com/glennjones/microformat-shiv/blob/90c5ea5e43ae95fc460aef79f8c19832c6f1dc26/microformat-shiv.js#L865-L883 | train | |
glennjones/microformat-shiv | microformat-shiv.js | function(node, valueParse) {
var out = '';
if(valueParse) {
out = this.getValueClass(node, 'u');
}
if(!out && valueParse) {
out = this.getValueTitle(node);
}
if(!out) {
out = modules.domUtils.getAttrValFromTagList(node, ['a', 'area'], 'href');
}
if(!out) {
out = modules.domUti... | javascript | function(node, valueParse) {
var out = '';
if(valueParse) {
out = this.getValueClass(node, 'u');
}
if(!out && valueParse) {
out = this.getValueTitle(node);
}
if(!out) {
out = modules.domUtils.getAttrValFromTagList(node, ['a', 'area'], 'href');
}
if(!out) {
out = modules.domUti... | [
"function",
"(",
"node",
",",
"valueParse",
")",
"{",
"var",
"out",
"=",
"''",
";",
"if",
"(",
"valueParse",
")",
"{",
"out",
"=",
"this",
".",
"getValueClass",
"(",
"node",
",",
"'u'",
")",
";",
"}",
"if",
"(",
"!",
"out",
"&&",
"valueParse",
")... | gets the value of a node which contains the 'u-' property
@param {DOM Node} node
@param {Boolean} valueParse
@return {String} | [
"gets",
"the",
"value",
"of",
"a",
"node",
"which",
"contains",
"the",
"u",
"-",
"property"
] | 90c5ea5e43ae95fc460aef79f8c19832c6f1dc26 | https://github.com/glennjones/microformat-shiv/blob/90c5ea5e43ae95fc460aef79f8c19832c6f1dc26/microformat-shiv.js#L893-L937 | train | |
glennjones/microformat-shiv | microformat-shiv.js | function(node, className, uf, valueParse) {
var out = '',
fromValue = false;
if(valueParse) {
out = this.getValueClass(node, 'dt');
if(out){
fromValue = true;
}
}
if(!out && valueParse) {
out = this.getValueTitle(node);
}
if(!out) {
out = modules.domUtils.getAttrValFrom... | javascript | function(node, className, uf, valueParse) {
var out = '',
fromValue = false;
if(valueParse) {
out = this.getValueClass(node, 'dt');
if(out){
fromValue = true;
}
}
if(!out && valueParse) {
out = this.getValueTitle(node);
}
if(!out) {
out = modules.domUtils.getAttrValFrom... | [
"function",
"(",
"node",
",",
"className",
",",
"uf",
",",
"valueParse",
")",
"{",
"var",
"out",
"=",
"''",
",",
"fromValue",
"=",
"false",
";",
"if",
"(",
"valueParse",
")",
"{",
"out",
"=",
"this",
".",
"getValueClass",
"(",
"node",
",",
"'dt'",
... | gets the value of a node which contains the 'dt-' property
@param {DOM Node} node
@param {String} className
@param {Object} uf
@param {Boolean} valueParse
@return {String} | [
"gets",
"the",
"value",
"of",
"a",
"node",
"which",
"contains",
"the",
"dt",
"-",
"property"
] | 90c5ea5e43ae95fc460aef79f8c19832c6f1dc26 | https://github.com/glennjones/microformat-shiv/blob/90c5ea5e43ae95fc460aef79f8c19832c6f1dc26/microformat-shiv.js#L949-L1001 | train | |
glennjones/microformat-shiv | microformat-shiv.js | function(node, id, propertyName) {
if(this.hasRootID(node, id, propertyName) === false){
var rootids = [];
if(modules.domUtils.hasAttribute(node,'rootids')){
rootids = modules.domUtils.getAttributeList(node,'rootids');
}
rootids.push('id' + id + '-' + propertyName);
modules.domUtils.setAttri... | javascript | function(node, id, propertyName) {
if(this.hasRootID(node, id, propertyName) === false){
var rootids = [];
if(modules.domUtils.hasAttribute(node,'rootids')){
rootids = modules.domUtils.getAttributeList(node,'rootids');
}
rootids.push('id' + id + '-' + propertyName);
modules.domUtils.setAttri... | [
"function",
"(",
"node",
",",
"id",
",",
"propertyName",
")",
"{",
"if",
"(",
"this",
".",
"hasRootID",
"(",
"node",
",",
"id",
",",
"propertyName",
")",
"===",
"false",
")",
"{",
"var",
"rootids",
"=",
"[",
"]",
";",
"if",
"(",
"modules",
".",
"... | appends a new rootid to a given node
@param {DOM Node} node
@param {String} id
@param {String} propertyName | [
"appends",
"a",
"new",
"rootid",
"to",
"a",
"given",
"node"
] | 90c5ea5e43ae95fc460aef79f8c19832c6f1dc26 | https://github.com/glennjones/microformat-shiv/blob/90c5ea5e43ae95fc460aef79f8c19832c6f1dc26/microformat-shiv.js#L1011-L1020 | train | |
glennjones/microformat-shiv | microformat-shiv.js | function(node, id, propertyName) {
var rootids = [];
if(!modules.domUtils.hasAttribute(node,'rootids')){
return false;
} else {
rootids = modules.domUtils.getAttributeList(node, 'rootids');
return (rootids.indexOf('id' + id + '-' + propertyName) > -1);
}
} | javascript | function(node, id, propertyName) {
var rootids = [];
if(!modules.domUtils.hasAttribute(node,'rootids')){
return false;
} else {
rootids = modules.domUtils.getAttributeList(node, 'rootids');
return (rootids.indexOf('id' + id + '-' + propertyName) > -1);
}
} | [
"function",
"(",
"node",
",",
"id",
",",
"propertyName",
")",
"{",
"var",
"rootids",
"=",
"[",
"]",
";",
"if",
"(",
"!",
"modules",
".",
"domUtils",
".",
"hasAttribute",
"(",
"node",
",",
"'rootids'",
")",
")",
"{",
"return",
"false",
";",
"}",
"el... | does a given node already have a rootid
@param {DOM Node} node
@param {String} id
@param {String} propertyName
@return {Boolean} | [
"does",
"a",
"given",
"node",
"already",
"have",
"a",
"rootid"
] | 90c5ea5e43ae95fc460aef79f8c19832c6f1dc26 | https://github.com/glennjones/microformat-shiv/blob/90c5ea5e43ae95fc460aef79f8c19832c6f1dc26/microformat-shiv.js#L1031-L1039 | train | |
glennjones/microformat-shiv | microformat-shiv.js | function(node, propertyType) {
var context = this,
children = [],
out = [],
child,
x,
i;
children = modules.domUtils.getChildren( node );
x = 0;
i = children.length;
while(x < i) {
child = children[x];
var value = null;
if(modules.domUtils.hasAttributeValue(child, 'class... | javascript | function(node, propertyType) {
var context = this,
children = [],
out = [],
child,
x,
i;
children = modules.domUtils.getChildren( node );
x = 0;
i = children.length;
while(x < i) {
child = children[x];
var value = null;
if(modules.domUtils.hasAttributeValue(child, 'class... | [
"function",
"(",
"node",
",",
"propertyType",
")",
"{",
"var",
"context",
"=",
"this",
",",
"children",
"=",
"[",
"]",
",",
"out",
"=",
"[",
"]",
",",
"child",
",",
"x",
",",
"i",
";",
"children",
"=",
"modules",
".",
"domUtils",
".",
"getChildren"... | gets the text of any child nodes with a class value
@param {DOM Node} node
@param {String} propertyName
@return {String || null} | [
"gets",
"the",
"text",
"of",
"any",
"child",
"nodes",
"with",
"a",
"class",
"value"
] | 90c5ea5e43ae95fc460aef79f8c19832c6f1dc26 | https://github.com/glennjones/microformat-shiv/blob/90c5ea5e43ae95fc460aef79f8c19832c6f1dc26/microformat-shiv.js#L1050-L1097 | train | |
glennjones/microformat-shiv | microformat-shiv.js | function(node) {
var out = [],
items,
i,
x;
items = modules.domUtils.getNodesByAttributeValue(node, 'class', 'value-title');
x = 0;
i = items.length;
while(x < i) {
if(modules.domUtils.hasAttribute(items[x], 'title')) {
out.push(modules.domUtils.getAttribute(items[x], 'title'));
... | javascript | function(node) {
var out = [],
items,
i,
x;
items = modules.domUtils.getNodesByAttributeValue(node, 'class', 'value-title');
x = 0;
i = items.length;
while(x < i) {
if(modules.domUtils.hasAttribute(items[x], 'title')) {
out.push(modules.domUtils.getAttribute(items[x], 'title'));
... | [
"function",
"(",
"node",
")",
"{",
"var",
"out",
"=",
"[",
"]",
",",
"items",
",",
"i",
",",
"x",
";",
"items",
"=",
"modules",
".",
"domUtils",
".",
"getNodesByAttributeValue",
"(",
"node",
",",
"'class'",
",",
"'value-title'",
")",
";",
"x",
"=",
... | returns a single string of the 'title' attr from all
the child nodes with the class 'value-title'
@param {DOM Node} node
@return {String} | [
"returns",
"a",
"single",
"string",
"of",
"the",
"title",
"attr",
"from",
"all",
"the",
"child",
"nodes",
"with",
"the",
"class",
"value",
"-",
"title"
] | 90c5ea5e43ae95fc460aef79f8c19832c6f1dc26 | https://github.com/glennjones/microformat-shiv/blob/90c5ea5e43ae95fc460aef79f8c19832c6f1dc26/microformat-shiv.js#L1107-L1123 | train | |
glennjones/microformat-shiv | microformat-shiv.js | function(name) {
var key;
for(key in modules.maps) {
if(modules.maps[key].root === name || key === name) {
return modules.maps[key];
}
}
return null;
} | javascript | function(name) {
var key;
for(key in modules.maps) {
if(modules.maps[key].root === name || key === name) {
return modules.maps[key];
}
}
return null;
} | [
"function",
"(",
"name",
")",
"{",
"var",
"key",
";",
"for",
"(",
"key",
"in",
"modules",
".",
"maps",
")",
"{",
"if",
"(",
"modules",
".",
"maps",
"[",
"key",
"]",
".",
"root",
"===",
"name",
"||",
"key",
"===",
"name",
")",
"{",
"return",
"mo... | given a v1 or v2 root name, return mapping object
@param {String} name
@return {Object || null} | [
"given",
"a",
"v1",
"or",
"v2",
"root",
"name",
"return",
"mapping",
"object"
] | 90c5ea5e43ae95fc460aef79f8c19832c6f1dc26 | https://github.com/glennjones/microformat-shiv/blob/90c5ea5e43ae95fc460aef79f8c19832c6f1dc26/microformat-shiv.js#L1300-L1308 | train | |
glennjones/microformat-shiv | microformat-shiv.js | function(names, typeVersion, value) {
var out = {};
// is more than just whitespace
if(value && modules.utils.isOnlyWhiteSpace(value) === false) {
out.value = value;
}
// add type i.e. ["h-card", "h-org"]
if(modules.utils.isArray(names)) {
out.type = names;
} else {
out.type = [names];... | javascript | function(names, typeVersion, value) {
var out = {};
// is more than just whitespace
if(value && modules.utils.isOnlyWhiteSpace(value) === false) {
out.value = value;
}
// add type i.e. ["h-card", "h-org"]
if(modules.utils.isArray(names)) {
out.type = names;
} else {
out.type = [names];... | [
"function",
"(",
"names",
",",
"typeVersion",
",",
"value",
")",
"{",
"var",
"out",
"=",
"{",
"}",
";",
"// is more than just whitespace",
"if",
"(",
"value",
"&&",
"modules",
".",
"utils",
".",
"isOnlyWhiteSpace",
"(",
"value",
")",
"===",
"false",
")",
... | creates a blank microformats object
@param {String} name
@param {String} value
@return {Object} | [
"creates",
"a",
"blank",
"microformats",
"object"
] | 90c5ea5e43ae95fc460aef79f8c19832c6f1dc26 | https://github.com/glennjones/microformat-shiv/blob/90c5ea5e43ae95fc460aef79f8c19832c6f1dc26/microformat-shiv.js#L1351-L1372 | train | |
glennjones/microformat-shiv | microformat-shiv.js | function( microformat ) {
delete microformat.times;
delete microformat.dates;
delete microformat.typeVersion;
delete microformat.altValue;
return microformat;
} | javascript | function( microformat ) {
delete microformat.times;
delete microformat.dates;
delete microformat.typeVersion;
delete microformat.altValue;
return microformat;
} | [
"function",
"(",
"microformat",
")",
"{",
"delete",
"microformat",
".",
"times",
";",
"delete",
"microformat",
".",
"dates",
";",
"delete",
"microformat",
".",
"typeVersion",
";",
"delete",
"microformat",
".",
"altValue",
";",
"return",
"microformat",
";",
"}"... | removes unwanted microformats property before output
@param {Object} microformat | [
"removes",
"unwanted",
"microformats",
"property",
"before",
"output"
] | 90c5ea5e43ae95fc460aef79f8c19832c6f1dc26 | https://github.com/glennjones/microformat-shiv/blob/90c5ea5e43ae95fc460aef79f8c19832c6f1dc26/microformat-shiv.js#L1380-L1386 | train | |
glennjones/microformat-shiv | microformat-shiv.js | function(text) {
var i;
i = this.propertyPrefixes.length;
while(i--) {
var prefix = this.propertyPrefixes[i];
if(modules.utils.startWith(text, prefix) && modules.utils.isLowerCase(text)) {
text = text.substr(prefix.length);
}
}
return text;
} | javascript | function(text) {
var i;
i = this.propertyPrefixes.length;
while(i--) {
var prefix = this.propertyPrefixes[i];
if(modules.utils.startWith(text, prefix) && modules.utils.isLowerCase(text)) {
text = text.substr(prefix.length);
}
}
return text;
} | [
"function",
"(",
"text",
")",
"{",
"var",
"i",
";",
"i",
"=",
"this",
".",
"propertyPrefixes",
".",
"length",
";",
"while",
"(",
"i",
"--",
")",
"{",
"var",
"prefix",
"=",
"this",
".",
"propertyPrefixes",
"[",
"i",
"]",
";",
"if",
"(",
"modules",
... | removes microformat property prefixes from text
@param {String} text
@return {String} | [
"removes",
"microformat",
"property",
"prefixes",
"from",
"text"
] | 90c5ea5e43ae95fc460aef79f8c19832c6f1dc26 | https://github.com/glennjones/microformat-shiv/blob/90c5ea5e43ae95fc460aef79f8c19832c6f1dc26/microformat-shiv.js#L1396-L1407 | train | |
glennjones/microformat-shiv | microformat-shiv.js | function(node, attrName, baseUrl){
var i,
nodes,
attr;
nodes = modules.domUtils.getNodesByAttribute(node, attrName);
i = nodes.length;
while (i--) {
try{
// the url parser can blow up if the format is not right
attr = modules.domUtils.getAttribute(nodes[i], attrName);
if(attr && ... | javascript | function(node, attrName, baseUrl){
var i,
nodes,
attr;
nodes = modules.domUtils.getNodesByAttribute(node, attrName);
i = nodes.length;
while (i--) {
try{
// the url parser can blow up if the format is not right
attr = modules.domUtils.getAttribute(nodes[i], attrName);
if(attr && ... | [
"function",
"(",
"node",
",",
"attrName",
",",
"baseUrl",
")",
"{",
"var",
"i",
",",
"nodes",
",",
"attr",
";",
"nodes",
"=",
"modules",
".",
"domUtils",
".",
"getNodesByAttribute",
"(",
"node",
",",
"attrName",
")",
";",
"i",
"=",
"nodes",
".",
"len... | expands all relative URLs to absolute ones where it can
@param {DOM Node} node
@param {String} attrName
@param {String} baseUrl | [
"expands",
"all",
"relative",
"URLs",
"to",
"absolute",
"ones",
"where",
"it",
"can"
] | 90c5ea5e43ae95fc460aef79f8c19832c6f1dc26 | https://github.com/glennjones/microformat-shiv/blob/90c5ea5e43ae95fc460aef79f8c19832c6f1dc26/microformat-shiv.js#L1417-L1437 | train | |
glennjones/microformat-shiv | microformat-shiv.js | function(options) {
var key;
for(key in options) {
if(options.hasOwnProperty(key)) {
this.options[key] = options[key];
}
}
} | javascript | function(options) {
var key;
for(key in options) {
if(options.hasOwnProperty(key)) {
this.options[key] = options[key];
}
}
} | [
"function",
"(",
"options",
")",
"{",
"var",
"key",
";",
"for",
"(",
"key",
"in",
"options",
")",
"{",
"if",
"(",
"options",
".",
"hasOwnProperty",
"(",
"key",
")",
")",
"{",
"this",
".",
"options",
"[",
"key",
"]",
"=",
"options",
"[",
"key",
"]... | merges passed and default options -single level clone of properties
@param {Object} options | [
"merges",
"passed",
"and",
"default",
"options",
"-",
"single",
"level",
"clone",
"of",
"properties"
] | 90c5ea5e43ae95fc460aef79f8c19832c6f1dc26 | https://github.com/glennjones/microformat-shiv/blob/90c5ea5e43ae95fc460aef79f8c19832c6f1dc26/microformat-shiv.js#L1446-L1453 | train | |
glennjones/microformat-shiv | microformat-shiv.js | function(rootNode){
var arr,
i;
arr = modules.domUtils.getNodesByAttribute(rootNode, 'rootids');
i = arr.length;
while(i--) {
modules.domUtils.removeAttribute(arr[i],'rootids');
}
} | javascript | function(rootNode){
var arr,
i;
arr = modules.domUtils.getNodesByAttribute(rootNode, 'rootids');
i = arr.length;
while(i--) {
modules.domUtils.removeAttribute(arr[i],'rootids');
}
} | [
"function",
"(",
"rootNode",
")",
"{",
"var",
"arr",
",",
"i",
";",
"arr",
"=",
"modules",
".",
"domUtils",
".",
"getNodesByAttribute",
"(",
"rootNode",
",",
"'rootids'",
")",
";",
"i",
"=",
"arr",
".",
"length",
";",
"while",
"(",
"i",
"--",
")",
... | removes all rootid attributes
@param {DOM Node} rootNode | [
"removes",
"all",
"rootid",
"attributes"
] | 90c5ea5e43ae95fc460aef79f8c19832c6f1dc26 | https://github.com/glennjones/microformat-shiv/blob/90c5ea5e43ae95fc460aef79f8c19832c6f1dc26/microformat-shiv.js#L1461-L1470 | train | |
glennjones/microformat-shiv | microformat-shiv.js | function( text ) {
if(text && this.isString(text)){
return (text.trim())? text.trim() : text.replace(/^\s+|\s+$/g, '');
}else{
return '';
}
} | javascript | function( text ) {
if(text && this.isString(text)){
return (text.trim())? text.trim() : text.replace(/^\s+|\s+$/g, '');
}else{
return '';
}
} | [
"function",
"(",
"text",
")",
"{",
"if",
"(",
"text",
"&&",
"this",
".",
"isString",
"(",
"text",
")",
")",
"{",
"return",
"(",
"text",
".",
"trim",
"(",
")",
")",
"?",
"text",
".",
"trim",
"(",
")",
":",
"text",
".",
"replace",
"(",
"/",
"^\... | removes spaces at front and back of text
@param {String} text
@return {String} | [
"removes",
"spaces",
"at",
"front",
"and",
"back",
"of",
"text"
] | 90c5ea5e43ae95fc460aef79f8c19832c6f1dc26 | https://github.com/glennjones/microformat-shiv/blob/90c5ea5e43ae95fc460aef79f8c19832c6f1dc26/microformat-shiv.js#L2321-L2327 | train | |
glennjones/microformat-shiv | microformat-shiv.js | function( text, index, character ) {
if(text && text.length > index){
return text.substr(0, index) + character + text.substr(index+character.length);
}else{
return text;
}
} | javascript | function( text, index, character ) {
if(text && text.length > index){
return text.substr(0, index) + character + text.substr(index+character.length);
}else{
return text;
}
} | [
"function",
"(",
"text",
",",
"index",
",",
"character",
")",
"{",
"if",
"(",
"text",
"&&",
"text",
".",
"length",
">",
"index",
")",
"{",
"return",
"text",
".",
"substr",
"(",
"0",
",",
"index",
")",
"+",
"character",
"+",
"text",
".",
"substr",
... | replaces a character in text
@param {String} text
@param {Int} index
@param {String} character
@return {String} | [
"replaces",
"a",
"character",
"in",
"text"
] | 90c5ea5e43ae95fc460aef79f8c19832c6f1dc26 | https://github.com/glennjones/microformat-shiv/blob/90c5ea5e43ae95fc460aef79f8c19832c6f1dc26/microformat-shiv.js#L2338-L2344 | train | |
glennjones/microformat-shiv | microformat-shiv.js | function( text ){
if(text && text.length){
var i = text.length,
x = 0;
// turn all whitespace chars at end into spaces
while (i--) {
if(this.isOnlyWhiteSpace(text[i])){
text = this.replaceCharAt( text, i, ' ' );
}else{
break;
}
}
// turn all whitespace chars at s... | javascript | function( text ){
if(text && text.length){
var i = text.length,
x = 0;
// turn all whitespace chars at end into spaces
while (i--) {
if(this.isOnlyWhiteSpace(text[i])){
text = this.replaceCharAt( text, i, ' ' );
}else{
break;
}
}
// turn all whitespace chars at s... | [
"function",
"(",
"text",
")",
"{",
"if",
"(",
"text",
"&&",
"text",
".",
"length",
")",
"{",
"var",
"i",
"=",
"text",
".",
"length",
",",
"x",
"=",
"0",
";",
"// turn all whitespace chars at end into spaces",
"while",
"(",
"i",
"--",
")",
"{",
"if",
... | removes whitespace, tabs and returns from start and end of text
@param {String} text
@return {String} | [
"removes",
"whitespace",
"tabs",
"and",
"returns",
"from",
"start",
"and",
"end",
"of",
"text"
] | 90c5ea5e43ae95fc460aef79f8c19832c6f1dc26 | https://github.com/glennjones/microformat-shiv/blob/90c5ea5e43ae95fc460aef79f8c19832c6f1dc26/microformat-shiv.js#L2353-L2379 | train | |
glennjones/microformat-shiv | microformat-shiv.js | function(property, reverse) {
reverse = (reverse) ? -1 : 1;
return function (a, b) {
a = a[property];
b = b[property];
if (a < b) {
return reverse * -1;
}
if (a > b) {
return reverse * 1;
}
return 0;
};
} | javascript | function(property, reverse) {
reverse = (reverse) ? -1 : 1;
return function (a, b) {
a = a[property];
b = b[property];
if (a < b) {
return reverse * -1;
}
if (a > b) {
return reverse * 1;
}
return 0;
};
} | [
"function",
"(",
"property",
",",
"reverse",
")",
"{",
"reverse",
"=",
"(",
"reverse",
")",
"?",
"-",
"1",
":",
"1",
";",
"return",
"function",
"(",
"a",
",",
"b",
")",
"{",
"a",
"=",
"a",
"[",
"property",
"]",
";",
"b",
"=",
"b",
"[",
"prope... | a sort function - to sort objects in an array by a given property
@param {String} property
@param {Boolean} reverse
@return {Int} | [
"a",
"sort",
"function",
"-",
"to",
"sort",
"objects",
"in",
"an",
"array",
"by",
"a",
"given",
"property"
] | 90c5ea5e43ae95fc460aef79f8c19832c6f1dc26 | https://github.com/glennjones/microformat-shiv/blob/90c5ea5e43ae95fc460aef79f8c19832c6f1dc26/microformat-shiv.js#L2428-L2441 | train | |
glennjones/microformat-shiv | microformat-shiv.js | function () {
if (typeof DOMParser === undefined) {
try {
return Components.classes["@mozilla.org/xmlextras/domparser;1"]
.createInstance(Components.interfaces.nsIDOMParser);
} catch (e) {
return;
... | javascript | function () {
if (typeof DOMParser === undefined) {
try {
return Components.classes["@mozilla.org/xmlextras/domparser;1"]
.createInstance(Components.interfaces.nsIDOMParser);
} catch (e) {
return;
... | [
"function",
"(",
")",
"{",
"if",
"(",
"typeof",
"DOMParser",
"===",
"undefined",
")",
"{",
"try",
"{",
"return",
"Components",
".",
"classes",
"[",
"\"@mozilla.org/xmlextras/domparser;1\"",
"]",
".",
"createInstance",
"(",
"Components",
".",
"interfaces",
".",
... | gets DOMParser object
@return {Object || undefined} | [
"gets",
"DOMParser",
"object"
] | 90c5ea5e43ae95fc460aef79f8c19832c6f1dc26 | https://github.com/glennjones/microformat-shiv/blob/90c5ea5e43ae95fc460aef79f8c19832c6f1dc26/microformat-shiv.js#L2458-L2469 | train | |
glennjones/microformat-shiv | microformat-shiv.js | function(node, attributeName) {
var out = [],
attList;
attList = node.getAttribute(attributeName);
if(attList && attList !== '') {
if(attList.indexOf(' ') > -1) {
out = attList.split(' ');
} else {
out.push(attList);
}
}
return out;
} | javascript | function(node, attributeName) {
var out = [],
attList;
attList = node.getAttribute(attributeName);
if(attList && attList !== '') {
if(attList.indexOf(' ') > -1) {
out = attList.split(' ');
} else {
out.push(attList);
}
}
return out;
} | [
"function",
"(",
"node",
",",
"attributeName",
")",
"{",
"var",
"out",
"=",
"[",
"]",
",",
"attList",
";",
"attList",
"=",
"node",
".",
"getAttribute",
"(",
"attributeName",
")",
";",
"if",
"(",
"attList",
"&&",
"attList",
"!==",
"''",
")",
"{",
"if"... | get value of a Node attribute as an array
@param {DOM Node} node
@param {String} attributeName
@return {Array} | [
"get",
"value",
"of",
"a",
"Node",
"attribute",
"as",
"an",
"array"
] | 90c5ea5e43ae95fc460aef79f8c19832c6f1dc26 | https://github.com/glennjones/microformat-shiv/blob/90c5ea5e43ae95fc460aef79f8c19832c6f1dc26/microformat-shiv.js#L2671-L2684 | train | |
glennjones/microformat-shiv | microformat-shiv.js | function(rootNode, name, value) {
var arr = [],
x = 0,
i,
out = [];
arr = this.getNodesByAttribute(rootNode, name);
if(arr) {
i = arr.length;
while(x < i) {
if(this.hasAttributeValue(arr[x], name, value)) {
out.push(arr[x]);
}
x++;
}
}
return out;
} | javascript | function(rootNode, name, value) {
var arr = [],
x = 0,
i,
out = [];
arr = this.getNodesByAttribute(rootNode, name);
if(arr) {
i = arr.length;
while(x < i) {
if(this.hasAttributeValue(arr[x], name, value)) {
out.push(arr[x]);
}
x++;
}
}
return out;
} | [
"function",
"(",
"rootNode",
",",
"name",
",",
"value",
")",
"{",
"var",
"arr",
"=",
"[",
"]",
",",
"x",
"=",
"0",
",",
"i",
",",
"out",
"=",
"[",
"]",
";",
"arr",
"=",
"this",
".",
"getNodesByAttribute",
"(",
"rootNode",
",",
"name",
")",
";",... | gets all child nodes with a given attribute containing a given value
@param {DOM Node} node
@param {String} attributeName
@return {DOM NodeList} | [
"gets",
"all",
"child",
"nodes",
"with",
"a",
"given",
"attribute",
"containing",
"a",
"given",
"value"
] | 90c5ea5e43ae95fc460aef79f8c19832c6f1dc26 | https://github.com/glennjones/microformat-shiv/blob/90c5ea5e43ae95fc460aef79f8c19832c6f1dc26/microformat-shiv.js#L2707-L2724 | train | |
glennjones/microformat-shiv | microformat-shiv.js | function(node, tagNames, attributeName) {
var i = tagNames.length;
while(i--) {
if(node.tagName.toLowerCase() === tagNames[i]) {
var attrValue = this.getAttribute(node, attributeName);
if(attrValue && attrValue !== '') {
return attrValue;
}
}
}
return null;
} | javascript | function(node, tagNames, attributeName) {
var i = tagNames.length;
while(i--) {
if(node.tagName.toLowerCase() === tagNames[i]) {
var attrValue = this.getAttribute(node, attributeName);
if(attrValue && attrValue !== '') {
return attrValue;
}
}
}
return null;
} | [
"function",
"(",
"node",
",",
"tagNames",
",",
"attributeName",
")",
"{",
"var",
"i",
"=",
"tagNames",
".",
"length",
";",
"while",
"(",
"i",
"--",
")",
"{",
"if",
"(",
"node",
".",
"tagName",
".",
"toLowerCase",
"(",
")",
"===",
"tagNames",
"[",
"... | gets attribute value from controlled list of tags
@param {Array} tagNames
@param {String} attributeName
@return {String || null} | [
"gets",
"attribute",
"value",
"from",
"controlled",
"list",
"of",
"tags"
] | 90c5ea5e43ae95fc460aef79f8c19832c6f1dc26 | https://github.com/glennjones/microformat-shiv/blob/90c5ea5e43ae95fc460aef79f8c19832c6f1dc26/microformat-shiv.js#L2734-L2746 | train | |
glennjones/microformat-shiv | microformat-shiv.js | function(node, tagNames){
var i = tagNames.length;
while(i--) {
if(node.tagName.toLowerCase() === tagNames[i]) {
return true;
}
}
return false;
} | javascript | function(node, tagNames){
var i = tagNames.length;
while(i--) {
if(node.tagName.toLowerCase() === tagNames[i]) {
return true;
}
}
return false;
} | [
"function",
"(",
"node",
",",
"tagNames",
")",
"{",
"var",
"i",
"=",
"tagNames",
".",
"length",
";",
"while",
"(",
"i",
"--",
")",
"{",
"if",
"(",
"node",
".",
"tagName",
".",
"toLowerCase",
"(",
")",
"===",
"tagNames",
"[",
"i",
"]",
")",
"{",
... | is a node one of a list of tags
@param {DOM Node} rootNode
@param {Array} tagNames
@return {Boolean} | [
"is",
"a",
"node",
"one",
"of",
"a",
"list",
"of",
"tags"
] | 90c5ea5e43ae95fc460aef79f8c19832c6f1dc26 | https://github.com/glennjones/microformat-shiv/blob/90c5ea5e43ae95fc460aef79f8c19832c6f1dc26/microformat-shiv.js#L2818-L2826 | train | |
glennjones/microformat-shiv | microformat-shiv.js | function(node) {
var newNode = node.cloneNode(true);
if(this.hasAttribute(node, 'id')){
this.removeAttribute(node, 'id')
}
return newNode;
} | javascript | function(node) {
var newNode = node.cloneNode(true);
if(this.hasAttribute(node, 'id')){
this.removeAttribute(node, 'id')
}
return newNode;
} | [
"function",
"(",
"node",
")",
"{",
"var",
"newNode",
"=",
"node",
".",
"cloneNode",
"(",
"true",
")",
";",
"if",
"(",
"this",
".",
"hasAttribute",
"(",
"node",
",",
"'id'",
")",
")",
"{",
"this",
".",
"removeAttribute",
"(",
"node",
",",
"'id'",
")... | abstracts DOM cloneNode
@param {DOM Node} node
@return {DOM Node} | [
"abstracts",
"DOM",
"cloneNode"
] | 90c5ea5e43ae95fc460aef79f8c19832c6f1dc26 | https://github.com/glennjones/microformat-shiv/blob/90c5ea5e43ae95fc460aef79f8c19832c6f1dc26/microformat-shiv.js#L2862-L2868 | train | |
glennjones/microformat-shiv | microformat-shiv.js | function(node, tagNames) {
for (var i = 0; i < tagNames.length; i++) {
if(node.getElementsByTagName){
var elements = node.getElementsByTagName(tagNames[i]);
while (elements[0]) {
elements[0].parentNode.removeChild(elements[0])
}
}
}
return node;
} | javascript | function(node, tagNames) {
for (var i = 0; i < tagNames.length; i++) {
if(node.getElementsByTagName){
var elements = node.getElementsByTagName(tagNames[i]);
while (elements[0]) {
elements[0].parentNode.removeChild(elements[0])
}
}
}
return node;
} | [
"function",
"(",
"node",
",",
"tagNames",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"tagNames",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"node",
".",
"getElementsByTagName",
")",
"{",
"var",
"elements",
"=",
"node",
".... | removes all the descendant tags by name
@param {DOM Node} node
@param {Array} tagNames
@return {DOM Node} | [
"removes",
"all",
"the",
"descendant",
"tags",
"by",
"name"
] | 90c5ea5e43ae95fc460aef79f8c19832c6f1dc26 | https://github.com/glennjones/microformat-shiv/blob/90c5ea5e43ae95fc460aef79f8c19832c6f1dc26/microformat-shiv.js#L2878-L2888 | train | |
glennjones/microformat-shiv | microformat-shiv.js | function( node ){
var nodeStr = node.outerHTML,
attrs = [];
for (var i = 0; i < node.attributes.length; i++) {
var attr = node.attributes[i];
attr.indexNum = nodeStr.indexOf(attr.name);
attrs.push( attr );
}
return attrs.sort( modules.utils.sortObjects( 'indexNum' ) );
} | javascript | function( node ){
var nodeStr = node.outerHTML,
attrs = [];
for (var i = 0; i < node.attributes.length; i++) {
var attr = node.attributes[i];
attr.indexNum = nodeStr.indexOf(attr.name);
attrs.push( attr );
}
return attrs.sort( modules.utils.sortObjects( 'indexNum' ) );
} | [
"function",
"(",
"node",
")",
"{",
"var",
"nodeStr",
"=",
"node",
".",
"outerHTML",
",",
"attrs",
"=",
"[",
"]",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"node",
".",
"attributes",
".",
"length",
";",
"i",
"++",
")",
"{",
"var",
... | gets the attributes of a node - ordered by sequence in html
@param {DOM Node} node
@return {Array} | [
"gets",
"the",
"attributes",
"of",
"a",
"node",
"-",
"ordered",
"by",
"sequence",
"in",
"html"
] | 90c5ea5e43ae95fc460aef79f8c19832c6f1dc26 | https://github.com/glennjones/microformat-shiv/blob/90c5ea5e43ae95fc460aef79f8c19832c6f1dc26/microformat-shiv.js#L2912-L2923 | train | |
glennjones/microformat-shiv | microformat-shiv.js | function( document ){
var newNode,
newDocument = null;
if( this.canCloneDocument( document )){
newDocument = document.implementation.createHTMLDocument('');
newNode = newDocument.importNode( document.documentElement, true );
newDocument.replaceChild(newNode, newDocument.querySelector('html'));
... | javascript | function( document ){
var newNode,
newDocument = null;
if( this.canCloneDocument( document )){
newDocument = document.implementation.createHTMLDocument('');
newNode = newDocument.importNode( document.documentElement, true );
newDocument.replaceChild(newNode, newDocument.querySelector('html'));
... | [
"function",
"(",
"document",
")",
"{",
"var",
"newNode",
",",
"newDocument",
"=",
"null",
";",
"if",
"(",
"this",
".",
"canCloneDocument",
"(",
"document",
")",
")",
"{",
"newDocument",
"=",
"document",
".",
"implementation",
".",
"createHTMLDocument",
"(",
... | clones a DOM document
@param {DOM Document} document
@return {DOM Document} | [
"clones",
"a",
"DOM",
"document"
] | 90c5ea5e43ae95fc460aef79f8c19832c6f1dc26 | https://github.com/glennjones/microformat-shiv/blob/90c5ea5e43ae95fc460aef79f8c19832c6f1dc26/microformat-shiv.js#L2945-L2955 | train | |
glennjones/microformat-shiv | microformat-shiv.js | function (node) {
var parent = node.parentNode,
i = -1,
child;
while (parent && (child = parent.childNodes[++i])){
if (child === node){
return i;
}
}
return -1;
} | javascript | function (node) {
var parent = node.parentNode,
i = -1,
child;
while (parent && (child = parent.childNodes[++i])){
if (child === node){
return i;
}
}
return -1;
} | [
"function",
"(",
"node",
")",
"{",
"var",
"parent",
"=",
"node",
".",
"parentNode",
",",
"i",
"=",
"-",
"1",
",",
"child",
";",
"while",
"(",
"parent",
"&&",
"(",
"child",
"=",
"parent",
".",
"childNodes",
"[",
"++",
"i",
"]",
")",
")",
"{",
"i... | get the child index of a node. Used to create a node path
@param {DOM Node} node
@return {Int} | [
"get",
"the",
"child",
"index",
"of",
"a",
"node",
".",
"Used",
"to",
"create",
"a",
"node",
"path"
] | 90c5ea5e43ae95fc460aef79f8c19832c6f1dc26 | https://github.com/glennjones/microformat-shiv/blob/90c5ea5e43ae95fc460aef79f8c19832c6f1dc26/microformat-shiv.js#L2975-L2985 | train | |
glennjones/microformat-shiv | microformat-shiv.js | function (document, path) {
var node = document.documentElement,
i = 0,
index;
while ((index = path[++i]) > -1){
node = node.childNodes[index];
}
return node;
} | javascript | function (document, path) {
var node = document.documentElement,
i = 0,
index;
while ((index = path[++i]) > -1){
node = node.childNodes[index];
}
return node;
} | [
"function",
"(",
"document",
",",
"path",
")",
"{",
"var",
"node",
"=",
"document",
".",
"documentElement",
",",
"i",
"=",
"0",
",",
"index",
";",
"while",
"(",
"(",
"index",
"=",
"path",
"[",
"++",
"i",
"]",
")",
">",
"-",
"1",
")",
"{",
"node... | get a node from a path.
@param {DOM document} document
@param {Array} path
@return {DOM Node} | [
"get",
"a",
"node",
"from",
"a",
"path",
"."
] | 90c5ea5e43ae95fc460aef79f8c19832c6f1dc26 | https://github.com/glennjones/microformat-shiv/blob/90c5ea5e43ae95fc460aef79f8c19832c6f1dc26/microformat-shiv.js#L3039-L3047 | train | |
glennjones/microformat-shiv | microformat-shiv.js | function( tagName, text ){
var node = this.document.createElement(tagName);
node.innerHTML = text;
return node;
} | javascript | function( tagName, text ){
var node = this.document.createElement(tagName);
node.innerHTML = text;
return node;
} | [
"function",
"(",
"tagName",
",",
"text",
")",
"{",
"var",
"node",
"=",
"this",
".",
"document",
".",
"createElement",
"(",
"tagName",
")",
";",
"node",
".",
"innerHTML",
"=",
"text",
";",
"return",
"node",
";",
"}"
] | create a node with text content
@param {String} tagName
@param {String} text
@return {DOM node} | [
"create",
"a",
"node",
"with",
"text",
"content"
] | 90c5ea5e43ae95fc460aef79f8c19832c6f1dc26 | https://github.com/glennjones/microformat-shiv/blob/90c5ea5e43ae95fc460aef79f8c19832c6f1dc26/microformat-shiv.js#L3079-L3083 | train | |
glennjones/microformat-shiv | microformat-shiv.js | function(){
//this._domParser = new DOMParser();
this._domParser = modules.domUtils.getDOMParser();
// do not use a head tag it does not work with IE9
this._html = '<base id="base" href=""></base><a id="link" href=""></a>';
this._nodes = this._domParser.parseF... | javascript | function(){
//this._domParser = new DOMParser();
this._domParser = modules.domUtils.getDOMParser();
// do not use a head tag it does not work with IE9
this._html = '<base id="base" href=""></base><a id="link" href=""></a>';
this._nodes = this._domParser.parseF... | [
"function",
"(",
")",
"{",
"//this._domParser = new DOMParser();",
"this",
".",
"_domParser",
"=",
"modules",
".",
"domUtils",
".",
"getDOMParser",
"(",
")",
";",
"// do not use a head tag it does not work with IE9",
"this",
".",
"_html",
"=",
"'<base id=\"base\" href=\"\... | creates DOM objects needed to resolve URLs | [
"creates",
"DOM",
"objects",
"needed",
"to",
"resolve",
"URLs"
] | 90c5ea5e43ae95fc460aef79f8c19832c6f1dc26 | https://github.com/glennjones/microformat-shiv/blob/90c5ea5e43ae95fc460aef79f8c19832c6f1dc26/microformat-shiv.js#L3096-L3104 | train | |
glennjones/microformat-shiv | microformat-shiv.js | function(url, baseUrl) {
// use modern URL web API where we can
if(modules.utils.isString(url) && modules.utils.isString(baseUrl) && url.indexOf('://') === -1){
// this try catch is required as IE has an URL object but no constuctor support
// http://glennjones.net/articles/the-problem-with-window-url
... | javascript | function(url, baseUrl) {
// use modern URL web API where we can
if(modules.utils.isString(url) && modules.utils.isString(baseUrl) && url.indexOf('://') === -1){
// this try catch is required as IE has an URL object but no constuctor support
// http://glennjones.net/articles/the-problem-with-window-url
... | [
"function",
"(",
"url",
",",
"baseUrl",
")",
"{",
"// use modern URL web API where we can",
"if",
"(",
"modules",
".",
"utils",
".",
"isString",
"(",
"url",
")",
"&&",
"modules",
".",
"utils",
".",
"isString",
"(",
"baseUrl",
")",
"&&",
"url",
".",
"indexO... | resolves url to absolute version using baseUrl
@param {String} url
@param {String} baseUrl
@return {String} | [
"resolves",
"url",
"to",
"absolute",
"version",
"using",
"baseUrl"
] | 90c5ea5e43ae95fc460aef79f8c19832c6f1dc26 | https://github.com/glennjones/microformat-shiv/blob/90c5ea5e43ae95fc460aef79f8c19832c6f1dc26/microformat-shiv.js#L3114-L3145 | train | |
glennjones/microformat-shiv | microformat-shiv.js | function() {
switch( this.format.toLowerCase() ) {
case 'microformat2':
this.sep = ' ';
this.dsep = '-';
this.tsep = ':';
this.tzsep = '';
this.tzZulu = 'Z';
break;
case 'rfc3339':
this.sep = 'T';
this.dsep = '';
this.tsep = '';
this.tzsep = '';
this.tzZ... | javascript | function() {
switch( this.format.toLowerCase() ) {
case 'microformat2':
this.sep = ' ';
this.dsep = '-';
this.tsep = ':';
this.tzsep = '';
this.tzZulu = 'Z';
break;
case 'rfc3339':
this.sep = 'T';
this.dsep = '';
this.tsep = '';
this.tzsep = '';
this.tzZ... | [
"function",
"(",
")",
"{",
"switch",
"(",
"this",
".",
"format",
".",
"toLowerCase",
"(",
")",
")",
"{",
"case",
"'microformat2'",
":",
"this",
".",
"sep",
"=",
"' '",
";",
"this",
".",
"dsep",
"=",
"'-'",
";",
"this",
".",
"tsep",
"=",
"':'",
";... | set the current profile to W3C Note, RFC 3339, HTML5, or auto profile | [
"set",
"the",
"current",
"profile",
"to",
"W3C",
"Note",
"RFC",
"3339",
"HTML5",
"or",
"auto",
"profile"
] | 90c5ea5e43ae95fc460aef79f8c19832c6f1dc26 | https://github.com/glennjones/microformat-shiv/blob/90c5ea5e43ae95fc460aef79f8c19832c6f1dc26/microformat-shiv.js#L3544-L3582 | train | |
glennjones/microformat-shiv | microformat-shiv.js | function( text ) {
if(modules.utils.isString( text )){
text = text.toLowerCase();
if(modules.utils.startWith(text, 'p') ){
return true;
}
}
return false;
} | javascript | function( text ) {
if(modules.utils.isString( text )){
text = text.toLowerCase();
if(modules.utils.startWith(text, 'p') ){
return true;
}
}
return false;
} | [
"function",
"(",
"text",
")",
"{",
"if",
"(",
"modules",
".",
"utils",
".",
"isString",
"(",
"text",
")",
")",
"{",
"text",
"=",
"text",
".",
"toLowerCase",
"(",
")",
";",
"if",
"(",
"modules",
".",
"utils",
".",
"startWith",
"(",
"text",
",",
"'... | simple test of whether ISO date string is a duration i.e. PY17M or PW12
@param {String} text
@return {Boolean} | [
"simple",
"test",
"of",
"whether",
"ISO",
"date",
"string",
"is",
"a",
"duration",
"i",
".",
"e",
".",
"PY17M",
"or",
"PW12"
] | 90c5ea5e43ae95fc460aef79f8c19832c6f1dc26 | https://github.com/glennjones/microformat-shiv/blob/90c5ea5e43ae95fc460aef79f8c19832c6f1dc26/microformat-shiv.js#L3672-L3680 | train | |
glennjones/microformat-shiv | microformat-shiv.js | function(date, time, format) {
var isodate = new modules.ISODate(date, format),
isotime = new modules.ISODate();
isotime.parseTime(this.parseAmPmTime(time), format);
if(isodate.hasFullDate() && isotime.hasTime()) {
isodate.tH = isotime.tH;
isodate.tM = isotime.tM;
isodate.tS = isotime.tS;
... | javascript | function(date, time, format) {
var isodate = new modules.ISODate(date, format),
isotime = new modules.ISODate();
isotime.parseTime(this.parseAmPmTime(time), format);
if(isodate.hasFullDate() && isotime.hasTime()) {
isodate.tH = isotime.tH;
isodate.tM = isotime.tM;
isodate.tS = isotime.tS;
... | [
"function",
"(",
"date",
",",
"time",
",",
"format",
")",
"{",
"var",
"isodate",
"=",
"new",
"modules",
".",
"ISODate",
"(",
"date",
",",
"format",
")",
",",
"isotime",
"=",
"new",
"modules",
".",
"ISODate",
"(",
")",
";",
"isotime",
".",
"parseTime"... | overlays a time on a date to return the union of the two
@param {String} date
@param {String} time
@param {String} format ( Modules.ISODate profile format )
@return {Object} Modules.ISODate | [
"overlays",
"a",
"time",
"on",
"a",
"date",
"to",
"return",
"the",
"union",
"of",
"the",
"two"
] | 90c5ea5e43ae95fc460aef79f8c19832c6f1dc26 | https://github.com/glennjones/microformat-shiv/blob/90c5ea5e43ae95fc460aef79f8c19832c6f1dc26/microformat-shiv.js#L3777-L3794 | train | |
glennjones/microformat-shiv | microformat-shiv.js | function (arr, format) {
var out = new modules.ISODate(),
i = 0,
value = '';
// if the fragment already contains a full date just return it once
if(arr[0].toUpperCase().match('T')) {
return new modules.ISODate(arr[0], format);
}else{
for(i = 0; i < arr.length; i++) {
value = arr[i];
... | javascript | function (arr, format) {
var out = new modules.ISODate(),
i = 0,
value = '';
// if the fragment already contains a full date just return it once
if(arr[0].toUpperCase().match('T')) {
return new modules.ISODate(arr[0], format);
}else{
for(i = 0; i < arr.length; i++) {
value = arr[i];
... | [
"function",
"(",
"arr",
",",
"format",
")",
"{",
"var",
"out",
"=",
"new",
"modules",
".",
"ISODate",
"(",
")",
",",
"i",
"=",
"0",
",",
"value",
"=",
"''",
";",
"// if the fragment already contains a full date just return it once",
"if",
"(",
"arr",
"[",
... | concatenate an array of date and time text fragments to create an ISODate object
used for microformat value and value-title rules
@param {Array} arr ( Array of Strings )
@param {String} format ( Modules.ISODate profile format )
@return {Object} Modules.ISODate | [
"concatenate",
"an",
"array",
"of",
"date",
"and",
"time",
"text",
"fragments",
"to",
"create",
"an",
"ISODate",
"object",
"used",
"for",
"microformat",
"value",
"and",
"value",
"-",
"title",
"rules"
] | 90c5ea5e43ae95fc460aef79f8c19832c6f1dc26 | https://github.com/glennjones/microformat-shiv/blob/90c5ea5e43ae95fc460aef79f8c19832c6f1dc26/microformat-shiv.js#L3805-L3852 | train | |
glennjones/microformat-shiv | microformat-shiv.js | function ( text ){
var out = [text],
chars = ['-','+','z','Z'],
i = chars.length;
while (i--) {
if(text.indexOf(chars[i]) > -1){
out[0] = text.slice( 0, text.indexOf(chars[i]) );
out.push( text.slice( text.indexOf(chars[i]) ) );
break;
}
}
return out;
} | javascript | function ( text ){
var out = [text],
chars = ['-','+','z','Z'],
i = chars.length;
while (i--) {
if(text.indexOf(chars[i]) > -1){
out[0] = text.slice( 0, text.indexOf(chars[i]) );
out.push( text.slice( text.indexOf(chars[i]) ) );
break;
}
}
return out;
} | [
"function",
"(",
"text",
")",
"{",
"var",
"out",
"=",
"[",
"text",
"]",
",",
"chars",
"=",
"[",
"'-'",
",",
"'+'",
",",
"'z'",
",",
"'Z'",
"]",
",",
"i",
"=",
"chars",
".",
"length",
";",
"while",
"(",
"i",
"--",
")",
"{",
"if",
"(",
"text"... | parses text by splitting it into an array of time and timezone strings
@param {String} text
@return {Array} Modules.ISODate | [
"parses",
"text",
"by",
"splitting",
"it",
"into",
"an",
"array",
"of",
"time",
"and",
"timezone",
"strings"
] | 90c5ea5e43ae95fc460aef79f8c19832c6f1dc26 | https://github.com/glennjones/microformat-shiv/blob/90c5ea5e43ae95fc460aef79f8c19832c6f1dc26/microformat-shiv.js#L3861-L3874 | train | |
glennjones/microformat-shiv | microformat-shiv.js | function(doc, node, textFormat){
var out;
this.textFormat = (textFormat)? textFormat : this.textFormat;
if(this.textFormat === 'normalised'){
out = this.walkTreeForText( node );
if(out !== undefined){
return this.normalise( doc, out );
}else{
return '';
}
}else{
var clonedNode ... | javascript | function(doc, node, textFormat){
var out;
this.textFormat = (textFormat)? textFormat : this.textFormat;
if(this.textFormat === 'normalised'){
out = this.walkTreeForText( node );
if(out !== undefined){
return this.normalise( doc, out );
}else{
return '';
}
}else{
var clonedNode ... | [
"function",
"(",
"doc",
",",
"node",
",",
"textFormat",
")",
"{",
"var",
"out",
";",
"this",
".",
"textFormat",
"=",
"(",
"textFormat",
")",
"?",
"textFormat",
":",
"this",
".",
"textFormat",
";",
"if",
"(",
"this",
".",
"textFormat",
"===",
"'normalis... | parses the text from the DOM Node
@param {DOM Node} node
@param {String} textFormat
@return {String} | [
"parses",
"the",
"text",
"from",
"the",
"DOM",
"Node"
] | 90c5ea5e43ae95fc460aef79f8c19832c6f1dc26 | https://github.com/glennjones/microformat-shiv/blob/90c5ea5e43ae95fc460aef79f8c19832c6f1dc26/microformat-shiv.js#L3902-L3918 | train | |
glennjones/microformat-shiv | microformat-shiv.js | function( doc, text, textFormat ){
var node = modules.domUtils.createNodeWithText( 'div', text );
return this.parse( doc, node, textFormat );
} | javascript | function( doc, text, textFormat ){
var node = modules.domUtils.createNodeWithText( 'div', text );
return this.parse( doc, node, textFormat );
} | [
"function",
"(",
"doc",
",",
"text",
",",
"textFormat",
")",
"{",
"var",
"node",
"=",
"modules",
".",
"domUtils",
".",
"createNodeWithText",
"(",
"'div'",
",",
"text",
")",
";",
"return",
"this",
".",
"parse",
"(",
"doc",
",",
"node",
",",
"textFormat"... | parses the text from a html string
@param {DOM Document} doc
@param {String} text
@param {String} textFormat
@return {String} | [
"parses",
"the",
"text",
"from",
"a",
"html",
"string"
] | 90c5ea5e43ae95fc460aef79f8c19832c6f1dc26 | https://github.com/glennjones/microformat-shiv/blob/90c5ea5e43ae95fc460aef79f8c19832c6f1dc26/microformat-shiv.js#L3929-L3932 | train | |
glennjones/microformat-shiv | microformat-shiv.js | function( doc, text, textFormat ){
this.textFormat = (textFormat)? textFormat : this.textFormat;
if(text){
var out = text
if(this.textFormat === 'whitespacetrimmed') {
out = modules.utils.trimWhitespace( out );
}
return out;
}else{
return '';
}
} | javascript | function( doc, text, textFormat ){
this.textFormat = (textFormat)? textFormat : this.textFormat;
if(text){
var out = text
if(this.textFormat === 'whitespacetrimmed') {
out = modules.utils.trimWhitespace( out );
}
return out;
}else{
return '';
}
} | [
"function",
"(",
"doc",
",",
"text",
",",
"textFormat",
")",
"{",
"this",
".",
"textFormat",
"=",
"(",
"textFormat",
")",
"?",
"textFormat",
":",
"this",
".",
"textFormat",
";",
"if",
"(",
"text",
")",
"{",
"var",
"out",
"=",
"text",
"if",
"(",
"th... | parses the text from a html string - only for whitespace or whitespacetrimmed formats
@param {String} text
@param {String} textFormat
@return {String} | [
"parses",
"the",
"text",
"from",
"a",
"html",
"string",
"-",
"only",
"for",
"whitespace",
"or",
"whitespacetrimmed",
"formats"
] | 90c5ea5e43ae95fc460aef79f8c19832c6f1dc26 | https://github.com/glennjones/microformat-shiv/blob/90c5ea5e43ae95fc460aef79f8c19832c6f1dc26/microformat-shiv.js#L3942-L3953 | train | |
glennjones/microformat-shiv | microformat-shiv.js | function( doc, text ){
text = text.replace( / /g, ' ') ; // exchanges html entity for space into space char
text = modules.utils.collapseWhiteSpace( text ); // removes linefeeds, tabs and addtional spaces
text = modules.domUtils.decodeEntities( doc, text ); // decode HTML entities
text = text.r... | javascript | function( doc, text ){
text = text.replace( / /g, ' ') ; // exchanges html entity for space into space char
text = modules.utils.collapseWhiteSpace( text ); // removes linefeeds, tabs and addtional spaces
text = modules.domUtils.decodeEntities( doc, text ); // decode HTML entities
text = text.r... | [
"function",
"(",
"doc",
",",
"text",
")",
"{",
"text",
"=",
"text",
".",
"replace",
"(",
"/",
" ",
"/",
"g",
",",
"' '",
")",
";",
"// exchanges html entity for space into space char",
"text",
"=",
"modules",
".",
"utils",
".",
"collapseWhiteSpace",
"("... | normalises whitespace in given text
@param {String} text
@return {String} | [
"normalises",
"whitespace",
"in",
"given",
"text"
] | 90c5ea5e43ae95fc460aef79f8c19832c6f1dc26 | https://github.com/glennjones/microformat-shiv/blob/90c5ea5e43ae95fc460aef79f8c19832c6f1dc26/microformat-shiv.js#L3962-L3968 | train | |
glennjones/microformat-shiv | microformat-shiv.js | function( node ) {
var out = '',
j = 0;
if(node.tagName && this.excludeTags.indexOf( node.tagName.toLowerCase() ) > -1){
return out;
}
// if node is a text node get its text
if(node.nodeType && node.nodeType === 3){
out += modules.domUtils.getElementText( node );
}
// get the text of... | javascript | function( node ) {
var out = '',
j = 0;
if(node.tagName && this.excludeTags.indexOf( node.tagName.toLowerCase() ) > -1){
return out;
}
// if node is a text node get its text
if(node.nodeType && node.nodeType === 3){
out += modules.domUtils.getElementText( node );
}
// get the text of... | [
"function",
"(",
"node",
")",
"{",
"var",
"out",
"=",
"''",
",",
"j",
"=",
"0",
";",
"if",
"(",
"node",
".",
"tagName",
"&&",
"this",
".",
"excludeTags",
".",
"indexOf",
"(",
"node",
".",
"tagName",
".",
"toLowerCase",
"(",
")",
")",
">",
"-",
... | walks DOM tree parsing the text from DOM Nodes
@param {DOM Node} node
@return {String} | [
"walks",
"DOM",
"tree",
"parsing",
"the",
"text",
"from",
"DOM",
"Nodes"
] | 90c5ea5e43ae95fc460aef79f8c19832c6f1dc26 | https://github.com/glennjones/microformat-shiv/blob/90c5ea5e43ae95fc460aef79f8c19832c6f1dc26/microformat-shiv.js#L3977-L4006 | train | |
glennjones/microformat-shiv | microformat-shiv.js | function( node ){
var out = '',
j = 0;
// we do not want the outer container
if(node.childNodes && node.childNodes.length > 0){
for (j = 0; j < node.childNodes.length; j++) {
var text = this.walkTreeForHtml( node.childNodes[j] );
if(text !== undefined){
out += text;
}
}
}
... | javascript | function( node ){
var out = '',
j = 0;
// we do not want the outer container
if(node.childNodes && node.childNodes.length > 0){
for (j = 0; j < node.childNodes.length; j++) {
var text = this.walkTreeForHtml( node.childNodes[j] );
if(text !== undefined){
out += text;
}
}
}
... | [
"function",
"(",
"node",
")",
"{",
"var",
"out",
"=",
"''",
",",
"j",
"=",
"0",
";",
"// we do not want the outer container",
"if",
"(",
"node",
".",
"childNodes",
"&&",
"node",
".",
"childNodes",
".",
"length",
">",
"0",
")",
"{",
"for",
"(",
"j",
"... | parse the html string from DOM Node
@param {DOM Node} node
@return {String} | [
"parse",
"the",
"html",
"string",
"from",
"DOM",
"Node"
] | 90c5ea5e43ae95fc460aef79f8c19832c6f1dc26 | https://github.com/glennjones/microformat-shiv/blob/90c5ea5e43ae95fc460aef79f8c19832c6f1dc26/microformat-shiv.js#L4023-L4038 | train | |
glennjones/microformat-shiv | microformat-shiv.js | function( node ) {
var out = '',
j = 0;
// if node is a text node get its text
if(node.nodeType && node.nodeType === 3){
//out += modules.domUtils.getElementText( node );
var containerNode = modules.domUtils.createNode('div');
modules.domUtils.appendChild(containerNode, modules.domUtils.clone(... | javascript | function( node ) {
var out = '',
j = 0;
// if node is a text node get its text
if(node.nodeType && node.nodeType === 3){
//out += modules.domUtils.getElementText( node );
var containerNode = modules.domUtils.createNode('div');
modules.domUtils.appendChild(containerNode, modules.domUtils.clone(... | [
"function",
"(",
"node",
")",
"{",
"var",
"out",
"=",
"''",
",",
"j",
"=",
"0",
";",
"// if node is a text node get its text",
"if",
"(",
"node",
".",
"nodeType",
"&&",
"node",
".",
"nodeType",
"===",
"3",
")",
"{",
"//out += modules.domUtils.getElementText( n... | walks the DOM tree parsing the html string from the nodes
@param {DOM Document} doc
@param {DOM Node} node
@return {String} | [
"walks",
"the",
"DOM",
"tree",
"parsing",
"the",
"html",
"string",
"from",
"the",
"nodes"
] | 90c5ea5e43ae95fc460aef79f8c19832c6f1dc26 | https://github.com/glennjones/microformat-shiv/blob/90c5ea5e43ae95fc460aef79f8c19832c6f1dc26/microformat-shiv.js#L4048-L4097 | train | |
seandmurray/aws_athena_client | lib/request.js | validateQuery | function validateQuery(query) {
Assert.ok(((query) && ((typeof query) === 'object')),
'The Query object was not set?');
Assert.ok(((query.QueryString) && ((typeof query.QueryString) === 'string')),
'The query string was not set?');
Assert.ok(((query.ResultConfiguration) && ((typeof query.ResultConfiguration... | javascript | function validateQuery(query) {
Assert.ok(((query) && ((typeof query) === 'object')),
'The Query object was not set?');
Assert.ok(((query.QueryString) && ((typeof query.QueryString) === 'string')),
'The query string was not set?');
Assert.ok(((query.ResultConfiguration) && ((typeof query.ResultConfiguration... | [
"function",
"validateQuery",
"(",
"query",
")",
"{",
"Assert",
".",
"ok",
"(",
"(",
"(",
"query",
")",
"&&",
"(",
"(",
"typeof",
"query",
")",
"===",
"'object'",
")",
")",
",",
"'The Query object was not set?'",
")",
";",
"Assert",
".",
"ok",
"(",
"(",... | Fails if the minium set of values are not in a request. | [
"Fails",
"if",
"the",
"minium",
"set",
"of",
"values",
"are",
"not",
"in",
"a",
"request",
"."
] | 31a33755748fed78d8e15fa90dd723bd6f441f74 | https://github.com/seandmurray/aws_athena_client/blob/31a33755748fed78d8e15fa90dd723bd6f441f74/lib/request.js#L82-L92 | train |
christophermina/connect-couchbase | lib/connect-couchbase.js | CouchbaseStore | function CouchbaseStore(options) {
var self = this;
options = options || {};
Store.call(this, options);
this.prefix = null == options.prefix
? 'sess:'
: options.prefix;
var connectOptions = {};
if (options.hasOwnProperty("host")) {
co... | javascript | function CouchbaseStore(options) {
var self = this;
options = options || {};
Store.call(this, options);
this.prefix = null == options.prefix
? 'sess:'
: options.prefix;
var connectOptions = {};
if (options.hasOwnProperty("host")) {
co... | [
"function",
"CouchbaseStore",
"(",
"options",
")",
"{",
"var",
"self",
"=",
"this",
";",
"options",
"=",
"options",
"||",
"{",
"}",
";",
"Store",
".",
"call",
"(",
"this",
",",
"options",
")",
";",
"this",
".",
"prefix",
"=",
"null",
"==",
"options",... | Initialize CouchbaseStore with the given `options`.
@param {Object} options
{
host: 127.0.0.1:8091 (default) -- Can be one or more address:ports, separated by semi-colon, or an array
username: '', -- Should be same as bucket name, if provided
password: '',
bucket: 'default' (default)
cachefile: ''
ttl: 86400,
prefix... | [
"Initialize",
"CouchbaseStore",
"with",
"the",
"given",
"options",
"."
] | fe011702ec8fa72fdf088556324dc46ed879518b | https://github.com/christophermina/connect-couchbase/blob/fe011702ec8fa72fdf088556324dc46ed879518b/lib/connect-couchbase.js#L64-L139 | train |
lhkbob/eve-swagger-js | dist/util/type-generator/namespace.js | getRouteNamespaces | function getRouteNamespaces(spec) {
let names = new Map();
for (let id of spec.routeIDs) {
let [namespace, explicit] = Namespace.forRoute(spec.route(id));
namespace.log.push(`Route ${id} maps to ${namespace.fullName} (explicit = ${explicit})`);
names.set(id, [namespace, explicit]);
}... | javascript | function getRouteNamespaces(spec) {
let names = new Map();
for (let id of spec.routeIDs) {
let [namespace, explicit] = Namespace.forRoute(spec.route(id));
namespace.log.push(`Route ${id} maps to ${namespace.fullName} (explicit = ${explicit})`);
names.set(id, [namespace, explicit]);
}... | [
"function",
"getRouteNamespaces",
"(",
"spec",
")",
"{",
"let",
"names",
"=",
"new",
"Map",
"(",
")",
";",
"for",
"(",
"let",
"id",
"of",
"spec",
".",
"routeIDs",
")",
"{",
"let",
"[",
"namespace",
",",
"explicit",
"]",
"=",
"Namespace",
".",
"forRou... | Generate the names for all route ids in the specification | [
"Generate",
"the",
"names",
"for",
"all",
"route",
"ids",
"in",
"the",
"specification"
] | 1353126546b988dd4811fc4256c94f4d96f26c37 | https://github.com/lhkbob/eve-swagger-js/blob/1353126546b988dd4811fc4256c94f4d96f26c37/dist/util/type-generator/namespace.js#L302-L310 | train |
pubfood/pubfood | src/provider/bidprovider.js | BidProvider | function BidProvider(bidDelegate) {
if (this.init_) {
this.init_();
}
var delegate = bidDelegate || {};
this.name = delegate.name || '';
this.bidDelegate = delegate;
this.enabled_ = true;
this.timeout_ = delegate && delegate.timeout ? delegate.timeout : 0;
} | javascript | function BidProvider(bidDelegate) {
if (this.init_) {
this.init_();
}
var delegate = bidDelegate || {};
this.name = delegate.name || '';
this.bidDelegate = delegate;
this.enabled_ = true;
this.timeout_ = delegate && delegate.timeout ? delegate.timeout : 0;
} | [
"function",
"BidProvider",
"(",
"bidDelegate",
")",
"{",
"if",
"(",
"this",
".",
"init_",
")",
"{",
"this",
".",
"init_",
"(",
")",
";",
"}",
"var",
"delegate",
"=",
"bidDelegate",
"||",
"{",
"}",
";",
"this",
".",
"name",
"=",
"delegate",
".",
"na... | BidProvider implements bidding partner requests.
@class
@param {BidDelegate} delegate the delegate object that implements [libUri()]{@link pubfood#provider.BidProvider#libUri}, [init()]{@link pubfood#provider.BidProvider#init} and [refresh()]{@link pubfood#provider.BidProvider#refresh}
@property {string} name the name... | [
"BidProvider",
"implements",
"bidding",
"partner",
"requests",
"."
] | be666e922d92f86fd1542e7c43f81126a9301771 | https://github.com/pubfood/pubfood/blob/be666e922d92f86fd1542e7c43f81126a9301771/src/provider/bidprovider.js#L22-L31 | train |
tim-evans/ember-pop-over | addon/mixins/scroll_sandbox.js | mouseWheel | function mouseWheel(evt) {
let oevt = evt.originalEvent;
let delta = 0;
let deltaY = 0;
let deltaX = 0;
if (oevt.wheelDelta) {
delta = oevt.wheelDelta / 120;
}
if (oevt.detail) {
delta = oevt.detail / -3;
}
deltaY = delta;
if (oevt.hasOwnProperty) {
// Gecko
if (oevt.hasOwnPropert... | javascript | function mouseWheel(evt) {
let oevt = evt.originalEvent;
let delta = 0;
let deltaY = 0;
let deltaX = 0;
if (oevt.wheelDelta) {
delta = oevt.wheelDelta / 120;
}
if (oevt.detail) {
delta = oevt.detail / -3;
}
deltaY = delta;
if (oevt.hasOwnProperty) {
// Gecko
if (oevt.hasOwnPropert... | [
"function",
"mouseWheel",
"(",
"evt",
")",
"{",
"let",
"oevt",
"=",
"evt",
".",
"originalEvent",
";",
"let",
"delta",
"=",
"0",
";",
"let",
"deltaY",
"=",
"0",
";",
"let",
"deltaX",
"=",
"0",
";",
"if",
"(",
"oevt",
".",
"wheelDelta",
")",
"{",
"... | Normalize mouseWheel events | [
"Normalize",
"mouseWheel",
"events"
] | 79b4b59a9d81c4929cfd38d83ee6b01c36184eef | https://github.com/tim-evans/ember-pop-over/blob/79b4b59a9d81c4929cfd38d83ee6b01c36184eef/addon/mixins/scroll_sandbox.js#L7-L42 | train |
pubfood/pubfood | src/mediator/auctionmediator.js | AuctionMediator | function AuctionMediator(config) {
if (this.init_) {
this.init_();
}
/** @property {boolean} prefix if false, do not add bid provider name to bid targeting key. Default: true */
this.prefix = config && config.hasOwnProperty('prefix') ? config.prefix : true;
// store slots by name for easy lookup
this.s... | javascript | function AuctionMediator(config) {
if (this.init_) {
this.init_();
}
/** @property {boolean} prefix if false, do not add bid provider name to bid targeting key. Default: true */
this.prefix = config && config.hasOwnProperty('prefix') ? config.prefix : true;
// store slots by name for easy lookup
this.s... | [
"function",
"AuctionMediator",
"(",
"config",
")",
"{",
"if",
"(",
"this",
".",
"init_",
")",
"{",
"this",
".",
"init_",
"(",
")",
";",
"}",
"/** @property {boolean} prefix if false, do not add bid provider name to bid targeting key. Default: true */",
"this",
".",
"pre... | AuctionMediator coordiates requests to Publisher Ad Servers.
@class
@memberof pubfood#mediator
@private | [
"AuctionMediator",
"coordiates",
"requests",
"to",
"Publisher",
"Ad",
"Servers",
"."
] | be666e922d92f86fd1542e7c43f81126a9301771 | https://github.com/pubfood/pubfood/blob/be666e922d92f86fd1542e7c43f81126a9301771/src/mediator/auctionmediator.js#L25-L46 | train |
glennjones/microformat-shiv | examples/firefox/lib/main.js | getTabData | function getTabData(url){
var key,
data;
key = urlToKey(url);
obj = tabData[key];
return (obj)? obj : {data: {}, url: url};
} | javascript | function getTabData(url){
var key,
data;
key = urlToKey(url);
obj = tabData[key];
return (obj)? obj : {data: {}, url: url};
} | [
"function",
"getTabData",
"(",
"url",
")",
"{",
"var",
"key",
",",
"data",
";",
"key",
"=",
"urlToKey",
"(",
"url",
")",
";",
"obj",
"=",
"tabData",
"[",
"key",
"]",
";",
"return",
"(",
"obj",
")",
"?",
"obj",
":",
"{",
"data",
":",
"{",
"}",
... | get data from object store | [
"get",
"data",
"from",
"object",
"store"
] | 90c5ea5e43ae95fc460aef79f8c19832c6f1dc26 | https://github.com/glennjones/microformat-shiv/blob/90c5ea5e43ae95fc460aef79f8c19832c6f1dc26/examples/firefox/lib/main.js#L91-L98 | train |
glennjones/microformat-shiv | examples/firefox/lib/main.js | appendTabData | function appendTabData(json){
var key;
if(!getTabData(json.url).data.items){
key = urlToKey(json.url);
tabData[key] = json;
}
} | javascript | function appendTabData(json){
var key;
if(!getTabData(json.url).data.items){
key = urlToKey(json.url);
tabData[key] = json;
}
} | [
"function",
"appendTabData",
"(",
"json",
")",
"{",
"var",
"key",
";",
"if",
"(",
"!",
"getTabData",
"(",
"json",
".",
"url",
")",
".",
"data",
".",
"items",
")",
"{",
"key",
"=",
"urlToKey",
"(",
"json",
".",
"url",
")",
";",
"tabData",
"[",
"ke... | append data to the object store | [
"append",
"data",
"to",
"the",
"object",
"store"
] | 90c5ea5e43ae95fc460aef79f8c19832c6f1dc26 | https://github.com/glennjones/microformat-shiv/blob/90c5ea5e43ae95fc460aef79f8c19832c6f1dc26/examples/firefox/lib/main.js#L101-L108 | train |
deitch/smtp-tester | lib/index.js | buildEmail | function buildEmail(envelope, data) {
return simpleParser(data)
.then(function(parsedEmail) {
const sender = envelope.mailFrom.address;
const receivers = envelope.rcptTo
.map(recipient => [ recipient.address, true ])
.reduce(tupleToObject, {});
const headers = [ ... parsedE... | javascript | function buildEmail(envelope, data) {
return simpleParser(data)
.then(function(parsedEmail) {
const sender = envelope.mailFrom.address;
const receivers = envelope.rcptTo
.map(recipient => [ recipient.address, true ])
.reduce(tupleToObject, {});
const headers = [ ... parsedE... | [
"function",
"buildEmail",
"(",
"envelope",
",",
"data",
")",
"{",
"return",
"simpleParser",
"(",
"data",
")",
".",
"then",
"(",
"function",
"(",
"parsedEmail",
")",
"{",
"const",
"sender",
"=",
"envelope",
".",
"mailFrom",
".",
"address",
";",
"const",
"... | Resolves to the email object handlers receive. | [
"Resolves",
"to",
"the",
"email",
"object",
"handlers",
"receive",
"."
] | 02a150809efda61127344d56a332780b8f830d18 | https://github.com/deitch/smtp-tester/blob/02a150809efda61127344d56a332780b8f830d18/lib/index.js#L113-L137 | train |
hegemonic/catharsis | catharsis.js | prepareFrozenObject | function prepareFrozenObject(obj, expr, {jsdoc}) {
Object.defineProperty(obj, 'jsdoc', {
value: jsdoc === true ? jsdoc : false
});
if (expr) {
Object.defineProperty(obj, 'typeExpression', {
value: expr
});
}
return Object.freeze(obj);
} | javascript | function prepareFrozenObject(obj, expr, {jsdoc}) {
Object.defineProperty(obj, 'jsdoc', {
value: jsdoc === true ? jsdoc : false
});
if (expr) {
Object.defineProperty(obj, 'typeExpression', {
value: expr
});
}
return Object.freeze(obj);
} | [
"function",
"prepareFrozenObject",
"(",
"obj",
",",
"expr",
",",
"{",
"jsdoc",
"}",
")",
"{",
"Object",
".",
"defineProperty",
"(",
"obj",
",",
"'jsdoc'",
",",
"{",
"value",
":",
"jsdoc",
"===",
"true",
"?",
"jsdoc",
":",
"false",
"}",
")",
";",
"if"... | Add non-enumerable properties to a result object, then freeze it. | [
"Add",
"non",
"-",
"enumerable",
"properties",
"to",
"a",
"result",
"object",
"then",
"freeze",
"it",
"."
] | b4a29feee5bbeffa512eaf997f8e5480c0d2476f | https://github.com/hegemonic/catharsis/blob/b4a29feee5bbeffa512eaf997f8e5480c0d2476f/catharsis.js#L67-L79 | train |
lhkbob/eve-swagger-js | dist/util/type-generator/exportable-type.js | isSchema | function isSchema(blob) {
// A schema will have one of these
return blob.properties !== undefined || blob.enum !== undefined || blob.items
!== undefined || blob.type !== undefined;
} | javascript | function isSchema(blob) {
// A schema will have one of these
return blob.properties !== undefined || blob.enum !== undefined || blob.items
!== undefined || blob.type !== undefined;
} | [
"function",
"isSchema",
"(",
"blob",
")",
"{",
"// A schema will have one of these",
"return",
"blob",
".",
"properties",
"!==",
"undefined",
"||",
"blob",
".",
"enum",
"!==",
"undefined",
"||",
"blob",
".",
"items",
"!==",
"undefined",
"||",
"blob",
".",
"typ... | The official swagger type spec makes it a little bit of a pain to work with the wrappers around type definitions. | [
"The",
"official",
"swagger",
"type",
"spec",
"makes",
"it",
"a",
"little",
"bit",
"of",
"a",
"pain",
"to",
"work",
"with",
"the",
"wrappers",
"around",
"type",
"definitions",
"."
] | 1353126546b988dd4811fc4256c94f4d96f26c37 | https://github.com/lhkbob/eve-swagger-js/blob/1353126546b988dd4811fc4256c94f4d96f26c37/dist/util/type-generator/exportable-type.js#L876-L880 | train |
groupon/nlm | lib/git/ensure-tag.js | ensureTag | function ensureTag(cwd, tag) {
if (tag === 'v0.0.0') {
// There is no such thing (most likely)
return null;
}
const tagFile = path.join(cwd, '.git', 'refs', 'tags', tag);
try {
return fs.readFileSync(tagFile);
} catch (error) {
if (error.code !== 'ENOENT') {
throw error;
}
retur... | javascript | function ensureTag(cwd, tag) {
if (tag === 'v0.0.0') {
// There is no such thing (most likely)
return null;
}
const tagFile = path.join(cwd, '.git', 'refs', 'tags', tag);
try {
return fs.readFileSync(tagFile);
} catch (error) {
if (error.code !== 'ENOENT') {
throw error;
}
retur... | [
"function",
"ensureTag",
"(",
"cwd",
",",
"tag",
")",
"{",
"if",
"(",
"tag",
"===",
"'v0.0.0'",
")",
"{",
"// There is no such thing (most likely)",
"return",
"null",
";",
"}",
"const",
"tagFile",
"=",
"path",
".",
"join",
"(",
"cwd",
",",
"'.git'",
",",
... | Ensure that a tag was fetched from the remote
DotCI only fetches the ref that is currently being built.
We need the last version tag to determine the changes.
This checks if a tag exists locally. If it doesn't, it will
fetch the tag from `origin`. | [
"Ensure",
"that",
"a",
"tag",
"was",
"fetched",
"from",
"the",
"remote"
] | f9bf02954b5d27b83d26c37a07312d922843b892 | https://github.com/groupon/nlm/blob/f9bf02954b5d27b83d26c37a07312d922843b892/lib/git/ensure-tag.js#L52-L67 | train |
reklatsmasters/saslprep | generate-code-points.js | traverse | function traverse(bits, src) {
for (const code of src.keys()) {
bits.set(code, true);
}
const buffer = bits.toBuffer();
return Buffer.concat([createSize(buffer), buffer]);
} | javascript | function traverse(bits, src) {
for (const code of src.keys()) {
bits.set(code, true);
}
const buffer = bits.toBuffer();
return Buffer.concat([createSize(buffer), buffer]);
} | [
"function",
"traverse",
"(",
"bits",
",",
"src",
")",
"{",
"for",
"(",
"const",
"code",
"of",
"src",
".",
"keys",
"(",
")",
")",
"{",
"bits",
".",
"set",
"(",
"code",
",",
"true",
")",
";",
"}",
"const",
"buffer",
"=",
"bits",
".",
"toBuffer",
... | Iterare over code points and
convert it into an buffer.
@param {bitfield} bits
@param {Array} src
@returns {Buffer} | [
"Iterare",
"over",
"code",
"points",
"and",
"convert",
"it",
"into",
"an",
"buffer",
"."
] | 4ad8884b461a6a8e496d6e648ad5da0a1b43cb42 | https://github.com/reklatsmasters/saslprep/blob/4ad8884b461a6a8e496d6e648ad5da0a1b43cb42/generate-code-points.js#L20-L27 | train |
pubfood/pubfood | src/pubfood.js | function(pfo) {
var bidProviders = pfo.getBidProviders();
// check for core api method calls
for (var apiMethod in pfo.requiredApiCalls) {
if (pfo.requiredApiCalls[apiMethod] === 0) {
pfo.configErrors.push('"' + apiMethod + '" was not called');
}
}
// validate through all the s... | javascript | function(pfo) {
var bidProviders = pfo.getBidProviders();
// check for core api method calls
for (var apiMethod in pfo.requiredApiCalls) {
if (pfo.requiredApiCalls[apiMethod] === 0) {
pfo.configErrors.push('"' + apiMethod + '" was not called');
}
}
// validate through all the s... | [
"function",
"(",
"pfo",
")",
"{",
"var",
"bidProviders",
"=",
"pfo",
".",
"getBidProviders",
"(",
")",
";",
"// check for core api method calls",
"for",
"(",
"var",
"apiMethod",
"in",
"pfo",
".",
"requiredApiCalls",
")",
"{",
"if",
"(",
"pfo",
".",
"required... | validate the api configurations
@param {object} pfo a the pubfood object
@private
@return {{hasError: boolean, details: string[]}} | [
"validate",
"the",
"api",
"configurations"
] | be666e922d92f86fd1542e7c43f81126a9301771 | https://github.com/pubfood/pubfood/blob/be666e922d92f86fd1542e7c43f81126a9301771/src/pubfood.js#L44-L70 | train | |
pubfood/pubfood | src/model/slot.js | Slot | function Slot(name, elementId) {
if (this.init_) {
this.init_();
}
this.name = name;
this.elementId = elementId;
this.bidProviders = [];
this.sizes = [];
} | javascript | function Slot(name, elementId) {
if (this.init_) {
this.init_();
}
this.name = name;
this.elementId = elementId;
this.bidProviders = [];
this.sizes = [];
} | [
"function",
"Slot",
"(",
"name",
",",
"elementId",
")",
"{",
"if",
"(",
"this",
".",
"init_",
")",
"{",
"this",
".",
"init_",
"(",
")",
";",
"}",
"this",
".",
"name",
"=",
"name",
";",
"this",
".",
"elementId",
"=",
"elementId",
";",
"this",
".",... | Slot contains a definition of a publisher ad unit.
@class
@param {string} name the slot name
@param {string} elementId target DOM element id for the slot
@augments PubfoodObject
@memberof pubfood#model | [
"Slot",
"contains",
"a",
"definition",
"of",
"a",
"publisher",
"ad",
"unit",
"."
] | be666e922d92f86fd1542e7c43f81126a9301771 | https://github.com/pubfood/pubfood/blob/be666e922d92f86fd1542e7c43f81126a9301771/src/model/slot.js#L20-L28 | train |
strongloop/strong-mq | lib/adapters/stomp.js | encode | function encode(body) {
// Handles 3 cases
// - body is utf8 string
// - body is instance of Buffer
// - body is an object and its JSON representation is sent
// Does not handle the case for streaming bodies.
// Returns buffer.
if (typeof(body) == 'string') {
return [new Buffer(body, 'utf8')];
} els... | javascript | function encode(body) {
// Handles 3 cases
// - body is utf8 string
// - body is instance of Buffer
// - body is an object and its JSON representation is sent
// Does not handle the case for streaming bodies.
// Returns buffer.
if (typeof(body) == 'string') {
return [new Buffer(body, 'utf8')];
} els... | [
"function",
"encode",
"(",
"body",
")",
"{",
"// Handles 3 cases",
"// - body is utf8 string",
"// - body is instance of Buffer",
"// - body is an object and its JSON representation is sent",
"// Does not handle the case for streaming bodies.",
"// Returns buffer.",
"if",
"(",
"typeof",
... | either encode msg as json, and return encoded msg and content-type value, or use string value and return null content-type @return [contentType, buffer] Note: implementation ripped out of node-amqp XXX should this be merged to STOMP? if so, could be optional, triggered only if body is not a string/buffer, and if heade... | [
"either",
"encode",
"msg",
"as",
"json",
"and",
"return",
"encoded",
"msg",
"and",
"content",
"-",
"type",
"value",
"or",
"use",
"string",
"value",
"and",
"return",
"null",
"content",
"-",
"type"
] | f46709850ce218168a2b45e2006e5ae55cf8e01b | https://github.com/strongloop/strong-mq/blob/f46709850ce218168a2b45e2006e5ae55cf8e01b/lib/adapters/stomp.js#L191-L206 | train |
lhkbob/eve-swagger-js | dist/util/esi-api.js | buildSimpleExample | function buildSimpleExample(type, example) {
// The values in schemaOrType refer to the type names of Swagger types
if (type === 'string') {
return typeof example === 'string' ? example : '';
}
else if (type === 'integer' || type === 'float' || type === 'number') {
return typeof example ... | javascript | function buildSimpleExample(type, example) {
// The values in schemaOrType refer to the type names of Swagger types
if (type === 'string') {
return typeof example === 'string' ? example : '';
}
else if (type === 'integer' || type === 'float' || type === 'number') {
return typeof example ... | [
"function",
"buildSimpleExample",
"(",
"type",
",",
"example",
")",
"{",
"// The values in schemaOrType refer to the type names of Swagger types",
"if",
"(",
"type",
"===",
"'string'",
")",
"{",
"return",
"typeof",
"example",
"===",
"'string'",
"?",
"example",
":",
"'... | Implementation functions for constructing and validating dynamic objects with the types defined in the spec. | [
"Implementation",
"functions",
"for",
"constructing",
"and",
"validating",
"dynamic",
"objects",
"with",
"the",
"types",
"defined",
"in",
"the",
"spec",
"."
] | 1353126546b988dd4811fc4256c94f4d96f26c37 | https://github.com/lhkbob/eve-swagger-js/blob/1353126546b988dd4811fc4256c94f4d96f26c37/dist/util/esi-api.js#L19-L39 | train |
lhkbob/eve-swagger-js | dist/util/type-generator/get-type-name.js | getTypeName | function getTypeName(namespace, type) {
let namespaceName = namespace.fullName;
let finalName;
for (let title of type.titles) {
let name = titleToTypeName(namespaceName, title);
if (finalName) {
if (name[1]) {
// An explicit type name, so make sure it isn't maskin... | javascript | function getTypeName(namespace, type) {
let namespaceName = namespace.fullName;
let finalName;
for (let title of type.titles) {
let name = titleToTypeName(namespaceName, title);
if (finalName) {
if (name[1]) {
// An explicit type name, so make sure it isn't maskin... | [
"function",
"getTypeName",
"(",
"namespace",
",",
"type",
")",
"{",
"let",
"namespaceName",
"=",
"namespace",
".",
"fullName",
";",
"let",
"finalName",
";",
"for",
"(",
"let",
"title",
"of",
"type",
".",
"titles",
")",
"{",
"let",
"name",
"=",
"titleToTy... | No typings associated | [
"No",
"typings",
"associated"
] | 1353126546b988dd4811fc4256c94f4d96f26c37 | https://github.com/lhkbob/eve-swagger-js/blob/1353126546b988dd4811fc4256c94f4d96f26c37/dist/util/type-generator/get-type-name.js#L5-L38 | train |
reklatsmasters/saslprep | lib/memory-code-points.js | read | function read() {
const size = memory.readUInt32BE(offset);
offset += 4;
const codepoints = memory.slice(offset, offset + size);
offset += size;
return bitfield({ buffer: codepoints });
} | javascript | function read() {
const size = memory.readUInt32BE(offset);
offset += 4;
const codepoints = memory.slice(offset, offset + size);
offset += size;
return bitfield({ buffer: codepoints });
} | [
"function",
"read",
"(",
")",
"{",
"const",
"size",
"=",
"memory",
".",
"readUInt32BE",
"(",
"offset",
")",
";",
"offset",
"+=",
"4",
";",
"const",
"codepoints",
"=",
"memory",
".",
"slice",
"(",
"offset",
",",
"offset",
"+",
"size",
")",
";",
"offse... | Loads each code points sequence from buffer.
@returns {bitfield} | [
"Loads",
"each",
"code",
"points",
"sequence",
"from",
"buffer",
"."
] | 4ad8884b461a6a8e496d6e648ad5da0a1b43cb42 | https://github.com/reklatsmasters/saslprep/blob/4ad8884b461a6a8e496d6e648ad5da0a1b43cb42/lib/memory-code-points.js#L15-L23 | train |
mbanting/metalsmith-prismic | lib/index.js | processRetrievedContent | function processRetrievedContent(content, filePrismicMetadata, queryKey, ctx) {
if (content.results != null && content.results.length > 0) {
var queryMetadata = filePrismicMetadata[queryKey];
for (var i = 0; i < content.results.length; i++) {
var result = ... | javascript | function processRetrievedContent(content, filePrismicMetadata, queryKey, ctx) {
if (content.results != null && content.results.length > 0) {
var queryMetadata = filePrismicMetadata[queryKey];
for (var i = 0; i < content.results.length; i++) {
var result = ... | [
"function",
"processRetrievedContent",
"(",
"content",
",",
"filePrismicMetadata",
",",
"queryKey",
",",
"ctx",
")",
"{",
"if",
"(",
"content",
".",
"results",
"!=",
"null",
"&&",
"content",
".",
"results",
".",
"length",
">",
"0",
")",
"{",
"var",
"queryM... | processes the retrieved content and adds it to the metadata | [
"processes",
"the",
"retrieved",
"content",
"and",
"adds",
"it",
"to",
"the",
"metadata"
] | f5b55568f68ee11975b36ddeaee3e55f9c8e4740 | https://github.com/mbanting/metalsmith-prismic/blob/f5b55568f68ee11975b36ddeaee3e55f9c8e4740/lib/index.js#L192-L200 | train |
mbanting/metalsmith-prismic | lib/index.js | processRetrievedDocument | function processRetrievedDocument(document, filePrismicMetadata, queryKey, ctx) {
// add the complete result except for the data fragments
var result = _.omit(document, 'fragments');
result.data = {};
// process the data fragments, invoking helpers to make the data more ... | javascript | function processRetrievedDocument(document, filePrismicMetadata, queryKey, ctx) {
// add the complete result except for the data fragments
var result = _.omit(document, 'fragments');
result.data = {};
// process the data fragments, invoking helpers to make the data more ... | [
"function",
"processRetrievedDocument",
"(",
"document",
",",
"filePrismicMetadata",
",",
"queryKey",
",",
"ctx",
")",
"{",
"// add the complete result except for the data fragments",
"var",
"result",
"=",
"_",
".",
"omit",
"(",
"document",
",",
"'fragments'",
")",
";... | processes and return single retrieved document | [
"processes",
"and",
"return",
"single",
"retrieved",
"document"
] | f5b55568f68ee11975b36ddeaee3e55f9c8e4740 | https://github.com/mbanting/metalsmith-prismic/blob/f5b55568f68ee11975b36ddeaee3e55f9c8e4740/lib/index.js#L203-L221 | train |
mbanting/metalsmith-prismic | lib/index.js | generateCollectionFiles | function generateCollectionFiles(fileName, collectionQuery, callback, ctx) {
if (collectionQuery != null) {
var file = files[fileName];
var newFiles = {};
var fileExtension = file.prismic[collectionQuery].collection.fileExtension;
var fileSuffi... | javascript | function generateCollectionFiles(fileName, collectionQuery, callback, ctx) {
if (collectionQuery != null) {
var file = files[fileName];
var newFiles = {};
var fileExtension = file.prismic[collectionQuery].collection.fileExtension;
var fileSuffi... | [
"function",
"generateCollectionFiles",
"(",
"fileName",
",",
"collectionQuery",
",",
"callback",
",",
"ctx",
")",
"{",
"if",
"(",
"collectionQuery",
"!=",
"null",
")",
"{",
"var",
"file",
"=",
"files",
"[",
"fileName",
"]",
";",
"var",
"newFiles",
"=",
"{"... | if any of the queries are designated the collection query, then generate a file for each of the results | [
"if",
"any",
"of",
"the",
"queries",
"are",
"designated",
"the",
"collection",
"query",
"then",
"generate",
"a",
"file",
"for",
"each",
"of",
"the",
"results"
] | f5b55568f68ee11975b36ddeaee3e55f9c8e4740 | https://github.com/mbanting/metalsmith-prismic/blob/f5b55568f68ee11975b36ddeaee3e55f9c8e4740/lib/index.js#L310-L335 | train |
strongloop/strong-mq | lib/adapters/native/broker.js | _final | function _final() {
var self = this;
cluster.removeListener('fork', self._onFork);
cluster.removeListener('disconnect', self._onDisconnect);
} | javascript | function _final() {
var self = this;
cluster.removeListener('fork', self._onFork);
cluster.removeListener('disconnect', self._onDisconnect);
} | [
"function",
"_final",
"(",
")",
"{",
"var",
"self",
"=",
"this",
";",
"cluster",
".",
"removeListener",
"(",
"'fork'",
",",
"self",
".",
"_onFork",
")",
";",
"cluster",
".",
"removeListener",
"(",
"'disconnect'",
",",
"self",
".",
"_onDisconnect",
")",
"... | Not normally called, but we might need something like it in tests to reset state back to initial. | [
"Not",
"normally",
"called",
"but",
"we",
"might",
"need",
"something",
"like",
"it",
"in",
"tests",
"to",
"reset",
"state",
"back",
"to",
"initial",
"."
] | f46709850ce218168a2b45e2006e5ae55cf8e01b | https://github.com/strongloop/strong-mq/blob/f46709850ce218168a2b45e2006e5ae55cf8e01b/lib/adapters/native/broker.js#L74-L79 | train |
Nicklason/node-bptf-listings | index.js | Listings | function Listings (options) {
options = options || {};
EventEmitter.call(this);
this.accessToken = options.accessToken;
this.steamid64 = options.steamid64;
this.waitTime = options.waitTime || 1000;
this.cap = -1;
this.promotes = -1;
this.listings = [];
this.actions = {
c... | javascript | function Listings (options) {
options = options || {};
EventEmitter.call(this);
this.accessToken = options.accessToken;
this.steamid64 = options.steamid64;
this.waitTime = options.waitTime || 1000;
this.cap = -1;
this.promotes = -1;
this.listings = [];
this.actions = {
c... | [
"function",
"Listings",
"(",
"options",
")",
"{",
"options",
"=",
"options",
"||",
"{",
"}",
";",
"EventEmitter",
".",
"call",
"(",
"this",
")",
";",
"this",
".",
"accessToken",
"=",
"options",
".",
"accessToken",
";",
"this",
".",
"steamid64",
"=",
"o... | Creates a new instance of bptf-listings
@class
@param {object} options Optional settings | [
"Creates",
"a",
"new",
"instance",
"of",
"bptf",
"-",
"listings"
] | 8ed38a4e2457603ec2941991e8af924531e8389b | https://github.com/Nicklason/node-bptf-listings/blob/8ed38a4e2457603ec2941991e8af924531e8389b/index.js#L19-L41 | train |
polygonplanet/Chiffon | chiffon.js | function() {
switch (this.type) {
case _Numeric:
case _String:
case _RegularExpression:
case _Boolean:
case _Null:
return this.parseLiteral();
case _Identifier:
return this.parseIdentifier();
case _Keyword:
return this.parsePrim... | javascript | function() {
switch (this.type) {
case _Numeric:
case _String:
case _RegularExpression:
case _Boolean:
case _Null:
return this.parseLiteral();
case _Identifier:
return this.parseIdentifier();
case _Keyword:
return this.parsePrim... | [
"function",
"(",
")",
"{",
"switch",
"(",
"this",
".",
"type",
")",
"{",
"case",
"_Numeric",
":",
"case",
"_String",
":",
"case",
"_RegularExpression",
":",
"case",
"_Boolean",
":",
"case",
"_Null",
":",
"return",
"this",
".",
"parseLiteral",
"(",
")",
... | ECMA-262 12.2 Primary Expression | [
"ECMA",
"-",
"262",
"12",
".",
"2",
"Primary",
"Expression"
] | 4adb7066aff6b58b60b1b72995a216b334421b84 | https://github.com/polygonplanet/Chiffon/blob/4adb7066aff6b58b60b1b72995a216b334421b84/chiffon.js#L1267-L1286 | train | |
polygonplanet/Chiffon | chiffon.js | function(allowIn) {
var node = this.startNode(_SequenceExpression);
var expr = this.parseAssignmentExpression(allowIn);
if (this.value !== ',') {
return expr;
}
var exprs = [expr];
do {
this.next();
exprs[exprs.length] = this.parseAssignmentExpression(allowI... | javascript | function(allowIn) {
var node = this.startNode(_SequenceExpression);
var expr = this.parseAssignmentExpression(allowIn);
if (this.value !== ',') {
return expr;
}
var exprs = [expr];
do {
this.next();
exprs[exprs.length] = this.parseAssignmentExpression(allowI... | [
"function",
"(",
"allowIn",
")",
"{",
"var",
"node",
"=",
"this",
".",
"startNode",
"(",
"_SequenceExpression",
")",
";",
"var",
"expr",
"=",
"this",
".",
"parseAssignmentExpression",
"(",
"allowIn",
")",
";",
"if",
"(",
"this",
".",
"value",
"!==",
"','... | ECMA-262 A.2 Expressions | [
"ECMA",
"-",
"262",
"A",
".",
"2",
"Expressions"
] | 4adb7066aff6b58b60b1b72995a216b334421b84 | https://github.com/polygonplanet/Chiffon/blob/4adb7066aff6b58b60b1b72995a216b334421b84/chiffon.js#L1520-L1536 | train | |
polygonplanet/Chiffon | chiffon.js | function() {
var node = this.startNode(_IfStatement);
this.expect('if');
this.expect('(');
var expr = this.parseExpression(true);
this.expect(')');
var consequent = this.parseStatement();
var alternate = null;
if (this.value === 'else') {
this.next();
al... | javascript | function() {
var node = this.startNode(_IfStatement);
this.expect('if');
this.expect('(');
var expr = this.parseExpression(true);
this.expect(')');
var consequent = this.parseStatement();
var alternate = null;
if (this.value === 'else') {
this.next();
al... | [
"function",
"(",
")",
"{",
"var",
"node",
"=",
"this",
".",
"startNode",
"(",
"_IfStatement",
")",
";",
"this",
".",
"expect",
"(",
"'if'",
")",
";",
"this",
".",
"expect",
"(",
"'('",
")",
";",
"var",
"expr",
"=",
"this",
".",
"parseExpression",
"... | ECMA-262 13 Statements and Declarations | [
"ECMA",
"-",
"262",
"13",
"Statements",
"and",
"Declarations"
] | 4adb7066aff6b58b60b1b72995a216b334421b84 | https://github.com/polygonplanet/Chiffon/blob/4adb7066aff6b58b60b1b72995a216b334421b84/chiffon.js#L2198-L2217 | train | |
lhkbob/eve-swagger-js | dist/src/internal/names.js | getNames | function getNames(agent, category, ids) {
return _getNames(agent, category, ids).then(array => {
let map = new Map();
for (let n of array) {
map.set(n.id, n.name);
}
return map;
});
} | javascript | function getNames(agent, category, ids) {
return _getNames(agent, category, ids).then(array => {
let map = new Map();
for (let n of array) {
map.set(n.id, n.name);
}
return map;
});
} | [
"function",
"getNames",
"(",
"agent",
",",
"category",
",",
"ids",
")",
"{",
"return",
"_getNames",
"(",
"agent",
",",
"category",
",",
"ids",
")",
".",
"then",
"(",
"array",
"=>",
"{",
"let",
"map",
"=",
"new",
"Map",
"(",
")",
";",
"for",
"(",
... | Look up the names of a set of ids, restricted to a particular name category.
This utility function automatically splits large arrays of ids into lists of
500 elements and then recombines the results. It also maps the response data
from the internal ESI representation into a more useful Map from id to name.
@param agen... | [
"Look",
"up",
"the",
"names",
"of",
"a",
"set",
"of",
"ids",
"restricted",
"to",
"a",
"particular",
"name",
"category",
".",
"This",
"utility",
"function",
"automatically",
"splits",
"large",
"arrays",
"of",
"ids",
"into",
"lists",
"of",
"500",
"elements",
... | 1353126546b988dd4811fc4256c94f4d96f26c37 | https://github.com/lhkbob/eve-swagger-js/blob/1353126546b988dd4811fc4256c94f4d96f26c37/dist/src/internal/names.js#L14-L22 | train |
nathanhammond/ember-route-alias | addon/initializers/route-alias.js | createAlias | function createAlias() {
Ember.RouterDSL.prototype.alias = function(aliasRoute, aliasPath, aliasTarget) {
Ember.assert('You must create a route prior to creating an alias.', this.handlers || this.intercepting);
Ember.assert('The alias target must exist before attempting to alias it.', this.handlers[aliasTarge... | javascript | function createAlias() {
Ember.RouterDSL.prototype.alias = function(aliasRoute, aliasPath, aliasTarget) {
Ember.assert('You must create a route prior to creating an alias.', this.handlers || this.intercepting);
Ember.assert('The alias target must exist before attempting to alias it.', this.handlers[aliasTarge... | [
"function",
"createAlias",
"(",
")",
"{",
"Ember",
".",
"RouterDSL",
".",
"prototype",
".",
"alias",
"=",
"function",
"(",
"aliasRoute",
",",
"aliasPath",
",",
"aliasTarget",
")",
"{",
"Ember",
".",
"assert",
"(",
"'You must create a route prior to creating an ali... | Sets up our magic alias function. | [
"Sets",
"up",
"our",
"magic",
"alias",
"function",
"."
] | e1f39cd775662b6e5dbae1654b8584902f8f44e2 | https://github.com/nathanhammond/ember-route-alias/blob/e1f39cd775662b6e5dbae1654b8584902f8f44e2/addon/initializers/route-alias.js#L16-L29 | train |
nathanhammond/ember-route-alias | addon/initializers/route-alias.js | patchRoute | function patchRoute(lookup) {
// Save off the original method in scope of the prototype modifications.
let originalRouteMethod = Ember.RouterDSL.prototype.route;
// We need to do a few things before and after the original route function.
Ember.RouterDSL.prototype.route = function(name, options, callback) {
... | javascript | function patchRoute(lookup) {
// Save off the original method in scope of the prototype modifications.
let originalRouteMethod = Ember.RouterDSL.prototype.route;
// We need to do a few things before and after the original route function.
Ember.RouterDSL.prototype.route = function(name, options, callback) {
... | [
"function",
"patchRoute",
"(",
"lookup",
")",
"{",
"// Save off the original method in scope of the prototype modifications.",
"let",
"originalRouteMethod",
"=",
"Ember",
".",
"RouterDSL",
".",
"prototype",
".",
"route",
";",
"// We need to do a few things before and after the or... | Patches the RouterDSL route function to work with aliases. | [
"Patches",
"the",
"RouterDSL",
"route",
"function",
"to",
"work",
"with",
"aliases",
"."
] | e1f39cd775662b6e5dbae1654b8584902f8f44e2 | https://github.com/nathanhammond/ember-route-alias/blob/e1f39cd775662b6e5dbae1654b8584902f8f44e2/addon/initializers/route-alias.js#L32-L98 | train |
ethjs/ethjs-account | src/index.js | getAddress | function getAddress(addressInput) {
var address = addressInput; // eslint-disable-line
var result = null; // eslint-disable-line
if (typeof(address) !== 'string') { throw new Error(`[ethjs-account] invalid address value ${JSON.stringify(address)} not a valid hex string`); }
// Missing the 0x prefix
if (addr... | javascript | function getAddress(addressInput) {
var address = addressInput; // eslint-disable-line
var result = null; // eslint-disable-line
if (typeof(address) !== 'string') { throw new Error(`[ethjs-account] invalid address value ${JSON.stringify(address)} not a valid hex string`); }
// Missing the 0x prefix
if (addr... | [
"function",
"getAddress",
"(",
"addressInput",
")",
"{",
"var",
"address",
"=",
"addressInput",
";",
"// eslint-disable-line",
"var",
"result",
"=",
"null",
";",
"// eslint-disable-line",
"if",
"(",
"typeof",
"(",
"address",
")",
"!==",
"'string'",
")",
"{",
"... | Get the address from a public key
@method getAddress
@param {String} addressInput
@returns {String} output the string is a hex string | [
"Get",
"the",
"address",
"from",
"a",
"public",
"key"
] | 7cbdd667a8c21c8546436650d17bcc9735d7d6bb | https://github.com/ethjs/ethjs-account/blob/7cbdd667a8c21c8546436650d17bcc9735d7d6bb/src/index.js#L25-L62 | train |
ethjs/ethjs-account | src/index.js | privateToPublic | function privateToPublic(privateKey) {
if (typeof privateKey !== 'string') { throw new Error(`[ethjs-account] private key must be type String, got ${typeof(privateKey)}`); }
if (!privateKey.match(/^(0x)?[0-9a-fA-F]{64}$/)) { throw new Error('[ethjs-account] private key must be an alphanumeric hex string that is 32 ... | javascript | function privateToPublic(privateKey) {
if (typeof privateKey !== 'string') { throw new Error(`[ethjs-account] private key must be type String, got ${typeof(privateKey)}`); }
if (!privateKey.match(/^(0x)?[0-9a-fA-F]{64}$/)) { throw new Error('[ethjs-account] private key must be an alphanumeric hex string that is 32 ... | [
"function",
"privateToPublic",
"(",
"privateKey",
")",
"{",
"if",
"(",
"typeof",
"privateKey",
"!==",
"'string'",
")",
"{",
"throw",
"new",
"Error",
"(",
"`",
"${",
"typeof",
"(",
"privateKey",
")",
"}",
"`",
")",
";",
"}",
"if",
"(",
"!",
"privateKey"... | Returns the public key for this private key.
@method privateToPublic
@param {String} privateKey a valid private key hex
@returns {Object} publicKey the sepk 160 byte public key for this private key | [
"Returns",
"the",
"public",
"key",
"for",
"this",
"private",
"key",
"."
] | 7cbdd667a8c21c8546436650d17bcc9735d7d6bb | https://github.com/ethjs/ethjs-account/blob/7cbdd667a8c21c8546436650d17bcc9735d7d6bb/src/index.js#L72-L78 | train |
ethjs/ethjs-account | src/index.js | publicToAddress | function publicToAddress(publicKey) {
if (!Buffer.isBuffer(publicKey)) { throw new Error('[ethjs-account] public key must be a buffer object in order to get public key address'); }
return getAddress(sha3(publicKey, true).slice(12).toString('hex'));
} | javascript | function publicToAddress(publicKey) {
if (!Buffer.isBuffer(publicKey)) { throw new Error('[ethjs-account] public key must be a buffer object in order to get public key address'); }
return getAddress(sha3(publicKey, true).slice(12).toString('hex'));
} | [
"function",
"publicToAddress",
"(",
"publicKey",
")",
"{",
"if",
"(",
"!",
"Buffer",
".",
"isBuffer",
"(",
"publicKey",
")",
")",
"{",
"throw",
"new",
"Error",
"(",
"'[ethjs-account] public key must be a buffer object in order to get public key address'",
")",
";",
"}... | Returns the Ethereum standard address of a public sepk key.
@method publicToAddress
@param {Object} publicKey a single public key Buffer object
@returns {String} address the 20 byte Ethereum address | [
"Returns",
"the",
"Ethereum",
"standard",
"address",
"of",
"a",
"public",
"sepk",
"key",
"."
] | 7cbdd667a8c21c8546436650d17bcc9735d7d6bb | https://github.com/ethjs/ethjs-account/blob/7cbdd667a8c21c8546436650d17bcc9735d7d6bb/src/index.js#L88-L92 | train |
ethjs/ethjs-account | src/index.js | privateToAccount | function privateToAccount(privateKey) {
const publicKey = privateToPublic(privateKey, true);
return {
privateKey: `0x${stripHexPrefix(privateKey)}`,
publicKey: `0x${publicKey.toString('hex')}`,
address: publicToAddress(publicKey),
};
} | javascript | function privateToAccount(privateKey) {
const publicKey = privateToPublic(privateKey, true);
return {
privateKey: `0x${stripHexPrefix(privateKey)}`,
publicKey: `0x${publicKey.toString('hex')}`,
address: publicToAddress(publicKey),
};
} | [
"function",
"privateToAccount",
"(",
"privateKey",
")",
"{",
"const",
"publicKey",
"=",
"privateToPublic",
"(",
"privateKey",
",",
"true",
")",
";",
"return",
"{",
"privateKey",
":",
"`",
"${",
"stripHexPrefix",
"(",
"privateKey",
")",
"}",
"`",
",",
"public... | Returns an Ethereum account address, private and public key based on the public key.
@method privateToAccount
@param {String} privateKey a single string of entropy longer than 32 chars
@returns {Object} output the Ethereum account address, and keys as hex strings | [
"Returns",
"an",
"Ethereum",
"account",
"address",
"private",
"and",
"public",
"key",
"based",
"on",
"the",
"public",
"key",
"."
] | 7cbdd667a8c21c8546436650d17bcc9735d7d6bb | https://github.com/ethjs/ethjs-account/blob/7cbdd667a8c21c8546436650d17bcc9735d7d6bb/src/index.js#L102-L110 | train |
ethjs/ethjs-account | src/index.js | generate | function generate(entropy) {
if (typeof entropy !== 'string') { throw new Error(`[ethjs-account] while generating account, invalid input type: '${typeof(entropy)}' should be type 'String'.`); }
if (entropy.length < 32) { throw new Error(`[ethjs-account] while generating account, entropy value not random and long en... | javascript | function generate(entropy) {
if (typeof entropy !== 'string') { throw new Error(`[ethjs-account] while generating account, invalid input type: '${typeof(entropy)}' should be type 'String'.`); }
if (entropy.length < 32) { throw new Error(`[ethjs-account] while generating account, entropy value not random and long en... | [
"function",
"generate",
"(",
"entropy",
")",
"{",
"if",
"(",
"typeof",
"entropy",
"!==",
"'string'",
")",
"{",
"throw",
"new",
"Error",
"(",
"`",
"${",
"typeof",
"(",
"entropy",
")",
"}",
"`",
")",
";",
"}",
"if",
"(",
"entropy",
".",
"length",
"<"... | Create a single Ethereum account address, private and public key.
@method generate
@param {String} entropy a single string of entropy longer than 32 chars
@returns {Object} output the Ethereum account address, and keys | [
"Create",
"a",
"single",
"Ethereum",
"account",
"address",
"private",
"and",
"public",
"key",
"."
] | 7cbdd667a8c21c8546436650d17bcc9735d7d6bb | https://github.com/ethjs/ethjs-account/blob/7cbdd667a8c21c8546436650d17bcc9735d7d6bb/src/index.js#L120-L125 | train |
doggan/diablo-file-formats | lib/dun.js | DunFile | function DunFile(startCoord, rawPillarData, dunName) {
this.startCol = startCoord[0];
this.startRow = startCoord[1];
this.fileName = dunName;
this.rawPillarData = rawPillarData;
this.rawColCount = this.rawPillarData.length;
this.rawRowCount = (this.rawColCount > 0) ? this.rawPillarData[0].lengt... | javascript | function DunFile(startCoord, rawPillarData, dunName) {
this.startCol = startCoord[0];
this.startRow = startCoord[1];
this.fileName = dunName;
this.rawPillarData = rawPillarData;
this.rawColCount = this.rawPillarData.length;
this.rawRowCount = (this.rawColCount > 0) ? this.rawPillarData[0].lengt... | [
"function",
"DunFile",
"(",
"startCoord",
",",
"rawPillarData",
",",
"dunName",
")",
"{",
"this",
".",
"startCol",
"=",
"startCoord",
"[",
"0",
"]",
";",
"this",
".",
"startRow",
"=",
"startCoord",
"[",
"1",
"]",
";",
"this",
".",
"fileName",
"=",
"dun... | DUN files contain information for arranging the squares of a TIL file.
Multiple DUN files can be pieced together to form entire levels.
For example, the 'town' level is a combination of 4 DUN files.
In addition, DUN files also provide information regarding dungeon
monsters and object ids. | [
"DUN",
"files",
"contain",
"information",
"for",
"arranging",
"the",
"squares",
"of",
"a",
"TIL",
"file",
".",
"Multiple",
"DUN",
"files",
"can",
"be",
"pieced",
"together",
"to",
"form",
"entire",
"levels",
".",
"For",
"example",
"the",
"town",
"level",
"... | 1c468868361752b01a1164d6135939621e18dab5 | https://github.com/doggan/diablo-file-formats/blob/1c468868361752b01a1164d6135939621e18dab5/lib/dun.js#L15-L27 | train |
simoami/mimik | runner/reporters/html/base/js/vendor/magnific-popup/jquery.magnific-popup.js | function(isLarge) {
var el;
if(isLarge) {
el = mfp.currItem.img;
} else {
el = mfp.st.zoom.opener(mfp.currItem.el || mfp.currItem);
}
var offset = el.offset();
var paddingTop = parseInt(el.css('padding-top'),10);
var paddingBottom = parseInt(el.css('padding-bottom'),10);
offset.top -= (... | javascript | function(isLarge) {
var el;
if(isLarge) {
el = mfp.currItem.img;
} else {
el = mfp.st.zoom.opener(mfp.currItem.el || mfp.currItem);
}
var offset = el.offset();
var paddingTop = parseInt(el.css('padding-top'),10);
var paddingBottom = parseInt(el.css('padding-bottom'),10);
offset.top -= (... | [
"function",
"(",
"isLarge",
")",
"{",
"var",
"el",
";",
"if",
"(",
"isLarge",
")",
"{",
"el",
"=",
"mfp",
".",
"currItem",
".",
"img",
";",
"}",
"else",
"{",
"el",
"=",
"mfp",
".",
"st",
".",
"zoom",
".",
"opener",
"(",
"mfp",
".",
"currItem",
... | Get element postion relative to viewport | [
"Get",
"element",
"postion",
"relative",
"to",
"viewport"
] | 464a4679bba671d43aea6660485d8db9fa767b1b | https://github.com/simoami/mimik/blob/464a4679bba671d43aea6660485d8db9fa767b1b/runner/reporters/html/base/js/vendor/magnific-popup/jquery.magnific-popup.js#L1531-L1564 | train | |
quorrajs/Ouch | handler/JsonResponseHandler.js | JsonResponseHandler | function JsonResponseHandler(onlyForAjaxOrJsonRequests, returnFrames, sendResponse) {
JsonResponseHandler.super_.call(this);
/**
* Should Ouch push output directly to the client?
* If this is false, output will be passed to the callback
* provided to the handle method.
*
* @type {boole... | javascript | function JsonResponseHandler(onlyForAjaxOrJsonRequests, returnFrames, sendResponse) {
JsonResponseHandler.super_.call(this);
/**
* Should Ouch push output directly to the client?
* If this is false, output will be passed to the callback
* provided to the handle method.
*
* @type {boole... | [
"function",
"JsonResponseHandler",
"(",
"onlyForAjaxOrJsonRequests",
",",
"returnFrames",
",",
"sendResponse",
")",
"{",
"JsonResponseHandler",
".",
"super_",
".",
"call",
"(",
"this",
")",
";",
"/**\n * Should Ouch push output directly to the client?\n * If this is fal... | Catches an exception and converts it to a JSON
response. Additionally can also return exception
frames for consumption by an API. | [
"Catches",
"an",
"exception",
"and",
"converts",
"it",
"to",
"a",
"JSON",
"response",
".",
"Additionally",
"can",
"also",
"return",
"exception",
"frames",
"for",
"consumption",
"by",
"an",
"API",
"."
] | cbadf54eaa78633761e295c8566a36bb1567d130 | https://github.com/quorrajs/Ouch/blob/cbadf54eaa78633761e295c8566a36bb1567d130/handler/JsonResponseHandler.js#L20-L47 | train |
quorrajs/Ouch | handler/Handler.js | Handler | function Handler() {
if (this.constructor === Handler) {
throw new Error("Can't instantiate abstract class!");
}
/**
* @var {Object}
* @protected
*/
this.__inspector;
/**
* @var {Object}
* @protected
*/
this.__run;
/**
* @var {Object}
* @pro... | javascript | function Handler() {
if (this.constructor === Handler) {
throw new Error("Can't instantiate abstract class!");
}
/**
* @var {Object}
* @protected
*/
this.__inspector;
/**
* @var {Object}
* @protected
*/
this.__run;
/**
* @var {Object}
* @pro... | [
"function",
"Handler",
"(",
")",
"{",
"if",
"(",
"this",
".",
"constructor",
"===",
"Handler",
")",
"{",
"throw",
"new",
"Error",
"(",
"\"Can't instantiate abstract class!\"",
")",
";",
"}",
"/**\n * @var {Object}\n * @protected\n */",
"this",
".",
"__in... | Abstract implementation of a error handler.
@class
@abstract
@author: Harish Anchu <harishanchu@gmail.com>
@copyright 2015, Harish Anchu. All rights reserved.
@license Licensed under MIT (https://github.com/quorrajs/Ouch/blob/master/LICENSE) | [
"Abstract",
"implementation",
"of",
"a",
"error",
"handler",
"."
] | cbadf54eaa78633761e295c8566a36bb1567d130 | https://github.com/quorrajs/Ouch/blob/cbadf54eaa78633761e295c8566a36bb1567d130/handler/Handler.js#L11-L39 | train |
Planeshifter/node-wordnet-magic | lib/morphy.js | morphyPromise | function morphyPromise( str, pos ) {
/* jshint: -WO40 */
var substitutions;
var query;
var i;
if ( !pos ) {
var resArray = [];
for ( i = 0; i < POS_TAGS.length; i++ ){
resArray.push( morphyPromise( str, POS_TAGS[i] ) );
}
return Promise.all( resArray ).then( function onDone( data ) {
var reducedArray... | javascript | function morphyPromise( str, pos ) {
/* jshint: -WO40 */
var substitutions;
var query;
var i;
if ( !pos ) {
var resArray = [];
for ( i = 0; i < POS_TAGS.length; i++ ){
resArray.push( morphyPromise( str, POS_TAGS[i] ) );
}
return Promise.all( resArray ).then( function onDone( data ) {
var reducedArray... | [
"function",
"morphyPromise",
"(",
"str",
",",
"pos",
")",
"{",
"/* jshint: -WO40 */",
"var",
"substitutions",
";",
"var",
"query",
";",
"var",
"i",
";",
"if",
"(",
"!",
"pos",
")",
"{",
"var",
"resArray",
"=",
"[",
"]",
";",
"for",
"(",
"i",
"=",
"... | Extract base form of supplied word using Morphy algorithm.
@param {string} str - input string
@param {string} pos - part of speech
@returns {Promise} results promise | [
"Extract",
"base",
"form",
"of",
"supplied",
"word",
"using",
"Morphy",
"algorithm",
"."
] | a7c6000bd63c79562ebb1e9a85820809a9a17058 | https://github.com/Planeshifter/node-wordnet-magic/blob/a7c6000bd63c79562ebb1e9a85820809a9a17058/lib/morphy.js#L23-L94 | train |
Streampunk/kelvinadon | util/meta.js | function (type, name) {
if (metaDictByName[type][name]) {
return metaDictByName[type][name];
} else if (name.endsWith('Type')) {
return metaDictByName[type][name.slice(0, -4)];
}
return undefined;
} | javascript | function (type, name) {
if (metaDictByName[type][name]) {
return metaDictByName[type][name];
} else if (name.endsWith('Type')) {
return metaDictByName[type][name.slice(0, -4)];
}
return undefined;
} | [
"function",
"(",
"type",
",",
"name",
")",
"{",
"if",
"(",
"metaDictByName",
"[",
"type",
"]",
"[",
"name",
"]",
")",
"{",
"return",
"metaDictByName",
"[",
"type",
"]",
"[",
"name",
"]",
";",
"}",
"else",
"if",
"(",
"name",
".",
"endsWith",
"(",
... | For use when already inside a promise | [
"For",
"use",
"when",
"already",
"inside",
"a",
"promise"
] | 75dc0a22428fd57073806e7de0bf1364883958e4 | https://github.com/Streampunk/kelvinadon/blob/75dc0a22428fd57073806e7de0bf1364883958e4/util/meta.js#L649-L656 | train | |
richardeoin/nodejs-fft-windowing | windowing.js | window | function window(data_array, windowing_function, alpha) {
var datapoints = data_array.length;
/* For each item in the array */
for (var n=0; n<datapoints; ++n) {
/* Apply the windowing function */
data_array[n] *= windowing_function(n, datapoints, alpha);
}
return data_array;
} | javascript | function window(data_array, windowing_function, alpha) {
var datapoints = data_array.length;
/* For each item in the array */
for (var n=0; n<datapoints; ++n) {
/* Apply the windowing function */
data_array[n] *= windowing_function(n, datapoints, alpha);
}
return data_array;
} | [
"function",
"window",
"(",
"data_array",
",",
"windowing_function",
",",
"alpha",
")",
"{",
"var",
"datapoints",
"=",
"data_array",
".",
"length",
";",
"/* For each item in the array */",
"for",
"(",
"var",
"n",
"=",
"0",
";",
"n",
"<",
"datapoints",
";",
"+... | Applies a Windowing Function to an array. | [
"Applies",
"a",
"Windowing",
"Function",
"to",
"an",
"array",
"."
] | 9762d07570046b7f2d255791cee5772ce1865a22 | https://github.com/richardeoin/nodejs-fft-windowing/blob/9762d07570046b7f2d255791cee5772ce1865a22/windowing.js#L81-L91 | train |
marchah/node-countries | index.js | getCountryByName | function getCountryByName(name, useAlias) {
if (!_.isString(name)) return undefined;
return _.find(countries, (country) => {
if (useAlias) {
return country.name.toUpperCase() === name.toUpperCase()
|| _.find(country.alias, (alias) => (alias.toUpperCase() === name.toUpperCase()));
}
retur... | javascript | function getCountryByName(name, useAlias) {
if (!_.isString(name)) return undefined;
return _.find(countries, (country) => {
if (useAlias) {
return country.name.toUpperCase() === name.toUpperCase()
|| _.find(country.alias, (alias) => (alias.toUpperCase() === name.toUpperCase()));
}
retur... | [
"function",
"getCountryByName",
"(",
"name",
",",
"useAlias",
")",
"{",
"if",
"(",
"!",
"_",
".",
"isString",
"(",
"name",
")",
")",
"return",
"undefined",
";",
"return",
"_",
".",
"find",
"(",
"countries",
",",
"(",
"country",
")",
"=>",
"{",
"if",
... | Find the country object of the given country name
@param {String} name country name
@param {Boolean} [useAlias] use alias flag, default `false`
@return {Object} country country object | [
"Find",
"the",
"country",
"object",
"of",
"the",
"given",
"country",
"name"
] | 4ec36f37adbf8293c9a9d4872136750b78291e8d | https://github.com/marchah/node-countries/blob/4ec36f37adbf8293c9a9d4872136750b78291e8d/index.js#L19-L29 | train |
marchah/node-countries | index.js | getCountryByNameOrShortName | function getCountryByNameOrShortName(name, useAlias) {
if (!_.isString(name)) return undefined;
return _.find(countries, (country) => {
if (useAlias) {
return country.name.toUpperCase() === name.toUpperCase()
|| country.alpha2.toUpperCase() === name.toUpperCase()
|| _.find(country.alias,... | javascript | function getCountryByNameOrShortName(name, useAlias) {
if (!_.isString(name)) return undefined;
return _.find(countries, (country) => {
if (useAlias) {
return country.name.toUpperCase() === name.toUpperCase()
|| country.alpha2.toUpperCase() === name.toUpperCase()
|| _.find(country.alias,... | [
"function",
"getCountryByNameOrShortName",
"(",
"name",
",",
"useAlias",
")",
"{",
"if",
"(",
"!",
"_",
".",
"isString",
"(",
"name",
")",
")",
"return",
"undefined",
";",
"return",
"_",
".",
"find",
"(",
"countries",
",",
"(",
"country",
")",
"=>",
"{... | Find the country object of the given country name or short name
@param {String} name country name or short name (alpha2)
@param {Boolean} [useAlias] use alias flag, default `false`
@return {Object} country country object | [
"Find",
"the",
"country",
"object",
"of",
"the",
"given",
"country",
"name",
"or",
"short",
"name"
] | 4ec36f37adbf8293c9a9d4872136750b78291e8d | https://github.com/marchah/node-countries/blob/4ec36f37adbf8293c9a9d4872136750b78291e8d/index.js#L38-L49 | train |
marchah/node-countries | index.js | getProvinceByName | function getProvinceByName(name, useAlias) {
if (!_.isString(name) || !_.isArray(this.provinces)) return undefined;
return _.find(this.provinces, (province) => {
if (useAlias) {
return province.name.toUpperCase() === name.toUpperCase()
|| _.find(province.alias, (alias) => (alias.toUpperCase() ==... | javascript | function getProvinceByName(name, useAlias) {
if (!_.isString(name) || !_.isArray(this.provinces)) return undefined;
return _.find(this.provinces, (province) => {
if (useAlias) {
return province.name.toUpperCase() === name.toUpperCase()
|| _.find(province.alias, (alias) => (alias.toUpperCase() ==... | [
"function",
"getProvinceByName",
"(",
"name",
",",
"useAlias",
")",
"{",
"if",
"(",
"!",
"_",
".",
"isString",
"(",
"name",
")",
"||",
"!",
"_",
".",
"isArray",
"(",
"this",
".",
"provinces",
")",
")",
"return",
"undefined",
";",
"return",
"_",
".",
... | Find the province object of the given province name
@param {String} name english province name
@param {Boolean} [useAlias] use alias flag, default `false`
@return {Object} province province object | [
"Find",
"the",
"province",
"object",
"of",
"the",
"given",
"province",
"name"
] | 4ec36f37adbf8293c9a9d4872136750b78291e8d | https://github.com/marchah/node-countries/blob/4ec36f37adbf8293c9a9d4872136750b78291e8d/index.js#L64-L74 | train |
marchah/node-countries | index.js | getProvinceByNameOrShortName | function getProvinceByNameOrShortName(name, useAlias) {
if (!_.isString(name) || !_.isArray(this.provinces)) return undefined;
return _.find(this.provinces, (province) => {
if (useAlias) {
return province.name.toUpperCase() === name.toUpperCase()
|| (province.short && province.short.toUpperCase()... | javascript | function getProvinceByNameOrShortName(name, useAlias) {
if (!_.isString(name) || !_.isArray(this.provinces)) return undefined;
return _.find(this.provinces, (province) => {
if (useAlias) {
return province.name.toUpperCase() === name.toUpperCase()
|| (province.short && province.short.toUpperCase()... | [
"function",
"getProvinceByNameOrShortName",
"(",
"name",
",",
"useAlias",
")",
"{",
"if",
"(",
"!",
"_",
".",
"isString",
"(",
"name",
")",
"||",
"!",
"_",
".",
"isArray",
"(",
"this",
".",
"provinces",
")",
")",
"return",
"undefined",
";",
"return",
"... | Find the province object of the given province name or short name
@param {String} name english province name or short name
@param {Boolean} [useAlias] use alias flag, default `false`
@return {Object} province province object | [
"Find",
"the",
"province",
"object",
"of",
"the",
"given",
"province",
"name",
"or",
"short",
"name"
] | 4ec36f37adbf8293c9a9d4872136750b78291e8d | https://github.com/marchah/node-countries/blob/4ec36f37adbf8293c9a9d4872136750b78291e8d/index.js#L83-L94 | train |
doggan/diablo-file-formats | lib/sol.js | SolFile | function SolFile(data, path) {
this.data = data;
this.path = path;
// levels/towndata/town.sol -> town
this.name = pathLib.basename(path, '.sol');
} | javascript | function SolFile(data, path) {
this.data = data;
this.path = path;
// levels/towndata/town.sol -> town
this.name = pathLib.basename(path, '.sol');
} | [
"function",
"SolFile",
"(",
"data",
",",
"path",
")",
"{",
"this",
".",
"data",
"=",
"data",
";",
"this",
".",
"path",
"=",
"path",
";",
"// levels/towndata/town.sol -> town",
"this",
".",
"name",
"=",
"pathLib",
".",
"basename",
"(",
"path",
",",
"'.sol... | SOL files contain meta information about pillars, such as
collision and transparency properties.
The usage of some of the bits are currently unknown. | [
"SOL",
"files",
"contain",
"meta",
"information",
"about",
"pillars",
"such",
"as",
"collision",
"and",
"transparency",
"properties",
"."
] | 1c468868361752b01a1164d6135939621e18dab5 | https://github.com/doggan/diablo-file-formats/blob/1c468868361752b01a1164d6135939621e18dab5/lib/sol.js#L11-L17 | train |
neyric/aws-swf | lib/workflow-execution.js | function (config, cb) {
var o = {}, k;
for (k in this.baseConfig) {
if (this.baseConfig.hasOwnProperty(k)) {
o[k] = this.baseConfig[k];
}
}
for (k in config) {
if (config.hasOwnProperty(k)) {
o[k] = config[k];
... | javascript | function (config, cb) {
var o = {}, k;
for (k in this.baseConfig) {
if (this.baseConfig.hasOwnProperty(k)) {
o[k] = this.baseConfig[k];
}
}
for (k in config) {
if (config.hasOwnProperty(k)) {
o[k] = config[k];
... | [
"function",
"(",
"config",
",",
"cb",
")",
"{",
"var",
"o",
"=",
"{",
"}",
",",
"k",
";",
"for",
"(",
"k",
"in",
"this",
".",
"baseConfig",
")",
"{",
"if",
"(",
"this",
".",
"baseConfig",
".",
"hasOwnProperty",
"(",
"k",
")",
")",
"{",
"o",
"... | Start a worfklow
@param {Object} config
@param {Function} cb | [
"Start",
"a",
"worfklow"
] | 31b96c9eef313199465b40204a92909996a85c3d | https://github.com/neyric/aws-swf/blob/31b96c9eef313199465b40204a92909996a85c3d/lib/workflow-execution.js#L20-L45 | train |
Subsets and Splits
SQL Console for semeru/code-text-javascript
Retrieves 20,000 non-null code samples labeled as JavaScript, providing a basic overview of the dataset.