id int32 0 58k | repo stringlengths 5 67 | path stringlengths 4 116 | func_name stringlengths 0 58 | original_string stringlengths 52 373k | language stringclasses 1
value | code stringlengths 52 373k | code_tokens list | docstring stringlengths 4 11.8k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 86 226 |
|---|---|---|---|---|---|---|---|---|---|---|---|
57,300 | AndreasMadsen/immortal | lib/module.js | checkPath | function checkPath(name, path) {
helpers.exists(path, function (exist) {
if (!exist) {
callback(new Error(name + ' was not found (' + path + ')')); return;
}
progress.set(name);
});
} | javascript | function checkPath(name, path) {
helpers.exists(path, function (exist) {
if (!exist) {
callback(new Error(name + ' was not found (' + path + ')')); return;
}
progress.set(name);
});
} | [
"function",
"checkPath",
"(",
"name",
",",
"path",
")",
"{",
"helpers",
".",
"exists",
"(",
"path",
",",
"function",
"(",
"exist",
")",
"{",
"if",
"(",
"!",
"exist",
")",
"{",
"callback",
"(",
"new",
"Error",
"(",
"name",
"+",
"' was not found ('",
"... | check file paths | [
"check",
"file",
"paths"
] | c1ab5a4287a543fdfd980604a9e9927d663a9ef2 | https://github.com/AndreasMadsen/immortal/blob/c1ab5a4287a543fdfd980604a9e9927d663a9ef2/lib/module.js#L104-L111 |
57,301 | AndreasMadsen/immortal | lib/module.js | execFile | function execFile() {
var child;
if (options.strategy === 'development') {
child = core.spawnPump(options, false, false);
if (options.relay) child.pump(process);
} else if (options.strategy === 'unattached') {
child = core.spawnPump(options, true, false);
} else if (opti... | javascript | function execFile() {
var child;
if (options.strategy === 'development') {
child = core.spawnPump(options, false, false);
if (options.relay) child.pump(process);
} else if (options.strategy === 'unattached') {
child = core.spawnPump(options, true, false);
} else if (opti... | [
"function",
"execFile",
"(",
")",
"{",
"var",
"child",
";",
"if",
"(",
"options",
".",
"strategy",
"===",
"'development'",
")",
"{",
"child",
"=",
"core",
".",
"spawnPump",
"(",
"options",
",",
"false",
",",
"false",
")",
";",
"if",
"(",
"options",
"... | this will execute when all tests are made | [
"this",
"will",
"execute",
"when",
"all",
"tests",
"are",
"made"
] | c1ab5a4287a543fdfd980604a9e9927d663a9ef2 | https://github.com/AndreasMadsen/immortal/blob/c1ab5a4287a543fdfd980604a9e9927d663a9ef2/lib/module.js#L140-L158 |
57,302 | sreenaths/em-tgraph | addon/utils/graph-view.js | function (mx, my, q1x1, q1y1, q1x, q1y, q2x1, q2y1, q2x, q2y ) {
return `M ${mx} ${my} Q ${q1x1} ${q1y1} ${q1x} ${q1y} Q ${q2x1} ${q2y1} ${q2x} ${q2y}`;
} | javascript | function (mx, my, q1x1, q1y1, q1x, q1y, q2x1, q2y1, q2x, q2y ) {
return `M ${mx} ${my} Q ${q1x1} ${q1y1} ${q1x} ${q1y} Q ${q2x1} ${q2y1} ${q2x} ${q2y}`;
} | [
"function",
"(",
"mx",
",",
"my",
",",
"q1x1",
",",
"q1y1",
",",
"q1x",
",",
"q1y",
",",
"q2x1",
",",
"q2y1",
",",
"q2x",
",",
"q2y",
")",
"{",
"return",
"`",
"${",
"mx",
"}",
"${",
"my",
"}",
"${",
"q1x1",
"}",
"${",
"q1y1",
"}",
"${",
"q1... | Defines how path between nodes are drawn | [
"Defines",
"how",
"path",
"between",
"nodes",
"are",
"drawn"
] | 8d6a8f46b911a165ac16561731735ab762954996 | https://github.com/sreenaths/em-tgraph/blob/8d6a8f46b911a165ac16561731735ab762954996/addon/utils/graph-view.js#L86-L88 | |
57,303 | sreenaths/em-tgraph | addon/utils/graph-view.js | _addTaskBubble | function _addTaskBubble(node, d) {
var group = node.append('g');
group.attr('class', 'task-bubble');
group.append('use').attr('xlink:href', '#task-bubble');
translateIfIE(group.append('text')
.text(_trimText(d.get('data.totalTasks') || 0, 3)), 0, 4);
translateIfIE(group, 38, -15);
} | javascript | function _addTaskBubble(node, d) {
var group = node.append('g');
group.attr('class', 'task-bubble');
group.append('use').attr('xlink:href', '#task-bubble');
translateIfIE(group.append('text')
.text(_trimText(d.get('data.totalTasks') || 0, 3)), 0, 4);
translateIfIE(group, 38, -15);
} | [
"function",
"_addTaskBubble",
"(",
"node",
",",
"d",
")",
"{",
"var",
"group",
"=",
"node",
".",
"append",
"(",
"'g'",
")",
";",
"group",
".",
"attr",
"(",
"'class'",
",",
"'task-bubble'",
")",
";",
"group",
".",
"append",
"(",
"'use'",
")",
".",
"... | Add task bubble to a vertex node
@param node {SVG DOM element} Vertex node
@param d {VertexDataNode} | [
"Add",
"task",
"bubble",
"to",
"a",
"vertex",
"node"
] | 8d6a8f46b911a165ac16561731735ab762954996 | https://github.com/sreenaths/em-tgraph/blob/8d6a8f46b911a165ac16561731735ab762954996/addon/utils/graph-view.js#L171-L179 |
57,304 | sreenaths/em-tgraph | addon/utils/graph-view.js | _addVertexGroupBubble | function _addVertexGroupBubble(node, d) {
var group;
if(d.vertexGroup) {
group = node.append('g');
group.attr('class', 'group-bubble');
group.append('use').attr('xlink:href', '#group-bubble');
translateIfIE(group.append('text')
.text(_trimText(d.get('vertexGroup.groupMembers.length'), 2)), ... | javascript | function _addVertexGroupBubble(node, d) {
var group;
if(d.vertexGroup) {
group = node.append('g');
group.attr('class', 'group-bubble');
group.append('use').attr('xlink:href', '#group-bubble');
translateIfIE(group.append('text')
.text(_trimText(d.get('vertexGroup.groupMembers.length'), 2)), ... | [
"function",
"_addVertexGroupBubble",
"(",
"node",
",",
"d",
")",
"{",
"var",
"group",
";",
"if",
"(",
"d",
".",
"vertexGroup",
")",
"{",
"group",
"=",
"node",
".",
"append",
"(",
"'g'",
")",
";",
"group",
".",
"attr",
"(",
"'class'",
",",
"'group-bub... | Add vertex group bubble to a vertex node
@param node {SVG DOM element} Vertex node
@param d {VertexDataNode} | [
"Add",
"vertex",
"group",
"bubble",
"to",
"a",
"vertex",
"node"
] | 8d6a8f46b911a165ac16561731735ab762954996 | https://github.com/sreenaths/em-tgraph/blob/8d6a8f46b911a165ac16561731735ab762954996/addon/utils/graph-view.js#L205-L217 |
57,305 | sreenaths/em-tgraph | addon/utils/graph-view.js | _addStatusBar | function _addStatusBar(node, d) {
var group = node.append('g');
group.attr('class', 'status-bar');
group.append('foreignObject')
.attr("class", "status")
.attr("width", 70)
.attr("height", 15)
.html('<span class="msg-container">' +
d.get('data.status') +
'</span>'
... | javascript | function _addStatusBar(node, d) {
var group = node.append('g');
group.attr('class', 'status-bar');
group.append('foreignObject')
.attr("class", "status")
.attr("width", 70)
.attr("height", 15)
.html('<span class="msg-container">' +
d.get('data.status') +
'</span>'
... | [
"function",
"_addStatusBar",
"(",
"node",
",",
"d",
")",
"{",
"var",
"group",
"=",
"node",
".",
"append",
"(",
"'g'",
")",
";",
"group",
".",
"attr",
"(",
"'class'",
",",
"'status-bar'",
")",
";",
"group",
".",
"append",
"(",
"'foreignObject'",
")",
... | Add status bar to a vertex node
@param node {SVG DOM element} Vertex node
@param d {VertexDataNode} | [
"Add",
"status",
"bar",
"to",
"a",
"vertex",
"node"
] | 8d6a8f46b911a165ac16561731735ab762954996 | https://github.com/sreenaths/em-tgraph/blob/8d6a8f46b911a165ac16561731735ab762954996/addon/utils/graph-view.js#L223-L235 |
57,306 | sreenaths/em-tgraph | addon/utils/graph-view.js | _addBasicContents | function _addBasicContents(node, d, titleProperty, maxTitleLength) {
var className = d.type;
node.attr('class', `node ${className}`);
node.append('use').attr('xlink:href', `#${className}-bg`);
translateIfIE(node.append('text')
.attr('class', 'title')
.text(_trimText(d.get(titleProperty || 'name'), ... | javascript | function _addBasicContents(node, d, titleProperty, maxTitleLength) {
var className = d.type;
node.attr('class', `node ${className}`);
node.append('use').attr('xlink:href', `#${className}-bg`);
translateIfIE(node.append('text')
.attr('class', 'title')
.text(_trimText(d.get(titleProperty || 'name'), ... | [
"function",
"_addBasicContents",
"(",
"node",
",",
"d",
",",
"titleProperty",
",",
"maxTitleLength",
")",
"{",
"var",
"className",
"=",
"d",
".",
"type",
";",
"node",
".",
"attr",
"(",
"'class'",
",",
"`",
"${",
"className",
"}",
"`",
")",
";",
"node",... | Creates a base SVG DOM node, with bg and title based on the type of DataNode
@param node {SVG DOM element} Vertex node
@param d {DataNode}
@param titleProperty {String} d's property who's value is the title to be displayed.
By default 'name'.
@param maxTitleLength {Number} Title would be trimmed beyond maxTitleLength. ... | [
"Creates",
"a",
"base",
"SVG",
"DOM",
"node",
"with",
"bg",
"and",
"title",
"based",
"on",
"the",
"type",
"of",
"DataNode"
] | 8d6a8f46b911a165ac16561731735ab762954996 | https://github.com/sreenaths/em-tgraph/blob/8d6a8f46b911a165ac16561731735ab762954996/addon/utils/graph-view.js#L244-L252 |
57,307 | sreenaths/em-tgraph | addon/utils/graph-view.js | _addContent | function _addContent(d) {
var node = d3.select(this);
switch(d.type) {
case 'vertex':
_addBasicContents(node, d, 'vertexName');
_addStatusBar(node, d);
_addTaskBubble(node, d);
_addIOBubble(node, d);
_addVertexGroupBubble(node, d);
break;
case 'input':
case 'output':
... | javascript | function _addContent(d) {
var node = d3.select(this);
switch(d.type) {
case 'vertex':
_addBasicContents(node, d, 'vertexName');
_addStatusBar(node, d);
_addTaskBubble(node, d);
_addIOBubble(node, d);
_addVertexGroupBubble(node, d);
break;
case 'input':
case 'output':
... | [
"function",
"_addContent",
"(",
"d",
")",
"{",
"var",
"node",
"=",
"d3",
".",
"select",
"(",
"this",
")",
";",
"switch",
"(",
"d",
".",
"type",
")",
"{",
"case",
"'vertex'",
":",
"_addBasicContents",
"(",
"node",
",",
"d",
",",
"'vertexName'",
")",
... | Populates the calling node with the required content.
@param s {DataNode} | [
"Populates",
"the",
"calling",
"node",
"with",
"the",
"required",
"content",
"."
] | 8d6a8f46b911a165ac16561731735ab762954996 | https://github.com/sreenaths/em-tgraph/blob/8d6a8f46b911a165ac16561731735ab762954996/addon/utils/graph-view.js#L257-L273 |
57,308 | sreenaths/em-tgraph | addon/utils/graph-view.js | _getLinks | function _getLinks(nodes) {
var links = [],
nodeHash;
nodeHash = nodes.reduce(function (obj, node) {
obj[node.id] = node;
return obj;
}, {});
_data.links.forEach(function (link) {
var source = nodeHash[link.sourceId],
target = nodeHash[link.targetId];
if(source && target) {
... | javascript | function _getLinks(nodes) {
var links = [],
nodeHash;
nodeHash = nodes.reduce(function (obj, node) {
obj[node.id] = node;
return obj;
}, {});
_data.links.forEach(function (link) {
var source = nodeHash[link.sourceId],
target = nodeHash[link.targetId];
if(source && target) {
... | [
"function",
"_getLinks",
"(",
"nodes",
")",
"{",
"var",
"links",
"=",
"[",
"]",
",",
"nodeHash",
";",
"nodeHash",
"=",
"nodes",
".",
"reduce",
"(",
"function",
"(",
"obj",
",",
"node",
")",
"{",
"obj",
"[",
"node",
".",
"id",
"]",
"=",
"node",
";... | Create a list of all links connecting nodes in the given array.
@param nodes {Array} A list of d3 nodes created by tree layout
@return links {Array} All links between nodes in the current DAG | [
"Create",
"a",
"list",
"of",
"all",
"links",
"connecting",
"nodes",
"in",
"the",
"given",
"array",
"."
] | 8d6a8f46b911a165ac16561731735ab762954996 | https://github.com/sreenaths/em-tgraph/blob/8d6a8f46b911a165ac16561731735ab762954996/addon/utils/graph-view.js#L280-L303 |
57,309 | sreenaths/em-tgraph | addon/utils/graph-view.js | _normalize | function _normalize(nodes) {
// Set layout
var farthestY = 0;
nodes.forEach(function (d) {
d.y = d.depth * -_layout.depthSpacing;
if(d.y < farthestY) {
farthestY = d.y;
}
});
farthestY -= PADDING;
nodes.forEach(function (d) {
d.y -= farthestY;
});
//Remove space occupied by dummy... | javascript | function _normalize(nodes) {
// Set layout
var farthestY = 0;
nodes.forEach(function (d) {
d.y = d.depth * -_layout.depthSpacing;
if(d.y < farthestY) {
farthestY = d.y;
}
});
farthestY -= PADDING;
nodes.forEach(function (d) {
d.y -= farthestY;
});
//Remove space occupied by dummy... | [
"function",
"_normalize",
"(",
"nodes",
")",
"{",
"// Set layout",
"var",
"farthestY",
"=",
"0",
";",
"nodes",
".",
"forEach",
"(",
"function",
"(",
"d",
")",
"{",
"d",
".",
"y",
"=",
"d",
".",
"depth",
"*",
"-",
"_layout",
".",
"depthSpacing",
";",
... | Apply proper depth spacing and remove the space occupied by dummy node
if the number of other nodes are odd.
@param nodes {Array} A list of d3 nodes created by tree layout | [
"Apply",
"proper",
"depth",
"spacing",
"and",
"remove",
"the",
"space",
"occupied",
"by",
"dummy",
"node",
"if",
"the",
"number",
"of",
"other",
"nodes",
"are",
"odd",
"."
] | 8d6a8f46b911a165ac16561731735ab762954996 | https://github.com/sreenaths/em-tgraph/blob/8d6a8f46b911a165ac16561731735ab762954996/addon/utils/graph-view.js#L310-L358 |
57,310 | sreenaths/em-tgraph | addon/utils/graph-view.js | _scheduledClick | function _scheduledClick(d, node) {
node = node.correspondingUseElement || node;
_component.sendAction('entityClicked', {
type: _getType(node),
d: d
});
_tip.hide();
_scheduledClickId = 0;
} | javascript | function _scheduledClick(d, node) {
node = node.correspondingUseElement || node;
_component.sendAction('entityClicked', {
type: _getType(node),
d: d
});
_tip.hide();
_scheduledClickId = 0;
} | [
"function",
"_scheduledClick",
"(",
"d",
",",
"node",
")",
"{",
"node",
"=",
"node",
".",
"correspondingUseElement",
"||",
"node",
";",
"_component",
".",
"sendAction",
"(",
"'entityClicked'",
",",
"{",
"type",
":",
"_getType",
"(",
"node",
")",
",",
"d",
... | onclick handler scheduled using setTimeout
@params d {DataNode} data of the clicked element
@param node {D3 element} Element that was clicked | [
"onclick",
"handler",
"scheduled",
"using",
"setTimeout"
] | 8d6a8f46b911a165ac16561731735ab762954996 | https://github.com/sreenaths/em-tgraph/blob/8d6a8f46b911a165ac16561731735ab762954996/addon/utils/graph-view.js#L518-L528 |
57,311 | sreenaths/em-tgraph | addon/utils/graph-view.js | _onClick | function _onClick(d) {
if(!_scheduledClickId) {
_scheduledClickId = setTimeout(_scheduledClick.bind(this, d, d3.event.target), 200);
}
} | javascript | function _onClick(d) {
if(!_scheduledClickId) {
_scheduledClickId = setTimeout(_scheduledClick.bind(this, d, d3.event.target), 200);
}
} | [
"function",
"_onClick",
"(",
"d",
")",
"{",
"if",
"(",
"!",
"_scheduledClickId",
")",
"{",
"_scheduledClickId",
"=",
"setTimeout",
"(",
"_scheduledClick",
".",
"bind",
"(",
"this",
",",
"d",
",",
"d3",
".",
"event",
".",
"target",
")",
",",
"200",
")",... | Schedules an onclick handler. If double click event is not triggered the handler
will be called in 200ms.
@param d {DataNode} Data of the clicked element | [
"Schedules",
"an",
"onclick",
"handler",
".",
"If",
"double",
"click",
"event",
"is",
"not",
"triggered",
"the",
"handler",
"will",
"be",
"called",
"in",
"200ms",
"."
] | 8d6a8f46b911a165ac16561731735ab762954996 | https://github.com/sreenaths/em-tgraph/blob/8d6a8f46b911a165ac16561731735ab762954996/addon/utils/graph-view.js#L535-L539 |
57,312 | sreenaths/em-tgraph | addon/utils/graph-view.js | _onDblclick | function _onDblclick(d) {
var event = d3.event,
node = event.target;
node = node.correspondingUseElement || node;
if(_scheduledClickId) {
clearTimeout(_scheduledClickId);
_scheduledClickId = 0;
}
switch(_getType(node)) {
case "io":
d.toggleAdditionalInclusion();
_update();
... | javascript | function _onDblclick(d) {
var event = d3.event,
node = event.target;
node = node.correspondingUseElement || node;
if(_scheduledClickId) {
clearTimeout(_scheduledClickId);
_scheduledClickId = 0;
}
switch(_getType(node)) {
case "io":
d.toggleAdditionalInclusion();
_update();
... | [
"function",
"_onDblclick",
"(",
"d",
")",
"{",
"var",
"event",
"=",
"d3",
".",
"event",
",",
"node",
"=",
"event",
".",
"target",
";",
"node",
"=",
"node",
".",
"correspondingUseElement",
"||",
"node",
";",
"if",
"(",
"_scheduledClickId",
")",
"{",
"cl... | Double click event handler.
@param d {DataNode} Data of the clicked element | [
"Double",
"click",
"event",
"handler",
"."
] | 8d6a8f46b911a165ac16561731735ab762954996 | https://github.com/sreenaths/em-tgraph/blob/8d6a8f46b911a165ac16561731735ab762954996/addon/utils/graph-view.js#L553-L570 |
57,313 | sreenaths/em-tgraph | addon/utils/graph-view.js | _createPathData | function _createPathData(d) {
var sX = d.source.y,
sY = d.source.x,
tX = d.target.y,
tY = d.target.x,
mX = (sX + tX)/2,
mY = (sY + tY)/2,
sH = Math.abs(sX - tX) * 0.35,
sV = 0; // strength
if(d.isBackwardLink) {
if(sY === tY) {
sV = 45;
mY -= 50;
if(... | javascript | function _createPathData(d) {
var sX = d.source.y,
sY = d.source.x,
tX = d.target.y,
tY = d.target.x,
mX = (sX + tX)/2,
mY = (sY + tY)/2,
sH = Math.abs(sX - tX) * 0.35,
sV = 0; // strength
if(d.isBackwardLink) {
if(sY === tY) {
sV = 45;
mY -= 50;
if(... | [
"function",
"_createPathData",
"(",
"d",
")",
"{",
"var",
"sX",
"=",
"d",
".",
"source",
".",
"y",
",",
"sY",
"=",
"d",
".",
"source",
".",
"x",
",",
"tX",
"=",
"d",
".",
"target",
".",
"y",
",",
"tY",
"=",
"d",
".",
"target",
".",
"x",
","... | Creates a path data string for the given link. Google SVG path data to learn what it is.
@param d {Object} Must contain source and target properties with the start and end positions.
@return pathData {String} Path data string based on the current layout | [
"Creates",
"a",
"path",
"data",
"string",
"for",
"the",
"given",
"link",
".",
"Google",
"SVG",
"path",
"data",
"to",
"learn",
"what",
"it",
"is",
"."
] | 8d6a8f46b911a165ac16561731735ab762954996 | https://github.com/sreenaths/em-tgraph/blob/8d6a8f46b911a165ac16561731735ab762954996/addon/utils/graph-view.js#L577-L609 |
57,314 | sreenaths/em-tgraph | addon/utils/graph-view.js | _updateNodes | function _updateNodes(nodes, source) {
// Enter any new nodes at the parent's previous position.
nodes.enter().append('g')
.attr('transform', function(d) {
var node = _getVertexNode(d, "x0") || source;
node = _layout.projector(node.x0, node.y0);
return 'translate(' + node.x + ',' + node.y + ')... | javascript | function _updateNodes(nodes, source) {
// Enter any new nodes at the parent's previous position.
nodes.enter().append('g')
.attr('transform', function(d) {
var node = _getVertexNode(d, "x0") || source;
node = _layout.projector(node.x0, node.y0);
return 'translate(' + node.x + ',' + node.y + ')... | [
"function",
"_updateNodes",
"(",
"nodes",
",",
"source",
")",
"{",
"// Enter any new nodes at the parent's previous position.",
"nodes",
".",
"enter",
"(",
")",
".",
"append",
"(",
"'g'",
")",
".",
"attr",
"(",
"'transform'",
",",
"function",
"(",
"d",
")",
"{... | Update position of all nodes in the list and preform required transitions.
@param nodes {Array} Nodes to be updated
@param source {d3 element} Node that trigged the update, in first update source will be root. | [
"Update",
"position",
"of",
"all",
"nodes",
"in",
"the",
"list",
"and",
"preform",
"required",
"transitions",
"."
] | 8d6a8f46b911a165ac16561731735ab762954996 | https://github.com/sreenaths/em-tgraph/blob/8d6a8f46b911a165ac16561731735ab762954996/addon/utils/graph-view.js#L627-L664 |
57,315 | sreenaths/em-tgraph | addon/utils/graph-view.js | _updateLinks | function _updateLinks(links, source) {
// Enter any new links at the parent's previous position.
links.enter().insert('path', 'g')
.attr('class', function (d) {
var type = d.get('dataMovementType') || "";
return 'link ' + type.toLowerCase();
})
/**
* IE11 rendering does not work for svg... | javascript | function _updateLinks(links, source) {
// Enter any new links at the parent's previous position.
links.enter().insert('path', 'g')
.attr('class', function (d) {
var type = d.get('dataMovementType') || "";
return 'link ' + type.toLowerCase();
})
/**
* IE11 rendering does not work for svg... | [
"function",
"_updateLinks",
"(",
"links",
",",
"source",
")",
"{",
"// Enter any new links at the parent's previous position.",
"links",
".",
"enter",
"(",
")",
".",
"insert",
"(",
"'path'",
",",
"'g'",
")",
".",
"attr",
"(",
"'class'",
",",
"function",
"(",
"... | Update position of all links in the list and preform required transitions.
@param links {Array} Links to be updated
@param source {d3 element} Node that trigged the update, in first update source will be root. | [
"Update",
"position",
"of",
"all",
"links",
"in",
"the",
"list",
"and",
"preform",
"required",
"transitions",
"."
] | 8d6a8f46b911a165ac16561731735ab762954996 | https://github.com/sreenaths/em-tgraph/blob/8d6a8f46b911a165ac16561731735ab762954996/addon/utils/graph-view.js#L685-L722 |
57,316 | sreenaths/em-tgraph | addon/utils/graph-view.js | _update | function _update() {
var nodesData = _treeLayout.nodes(_treeData),
linksData = _getLinks(nodesData);
_normalize(nodesData);
var nodes = _g.selectAll('g.node')
.data(nodesData, _getNodeId);
_updateNodes(nodes, _treeData);
var links = _g.selectAll('path.link')
.data(linksData, _getLinkId);
... | javascript | function _update() {
var nodesData = _treeLayout.nodes(_treeData),
linksData = _getLinks(nodesData);
_normalize(nodesData);
var nodes = _g.selectAll('g.node')
.data(nodesData, _getNodeId);
_updateNodes(nodes, _treeData);
var links = _g.selectAll('path.link')
.data(linksData, _getLinkId);
... | [
"function",
"_update",
"(",
")",
"{",
"var",
"nodesData",
"=",
"_treeLayout",
".",
"nodes",
"(",
"_treeData",
")",
",",
"linksData",
"=",
"_getLinks",
"(",
"nodesData",
")",
";",
"_normalize",
"(",
"nodesData",
")",
";",
"var",
"nodes",
"=",
"_g",
".",
... | Updates position of nodes and links based on changes in _treeData. | [
"Updates",
"position",
"of",
"nodes",
"and",
"links",
"based",
"on",
"changes",
"in",
"_treeData",
"."
] | 8d6a8f46b911a165ac16561731735ab762954996 | https://github.com/sreenaths/em-tgraph/blob/8d6a8f46b911a165ac16561731735ab762954996/addon/utils/graph-view.js#L738-L753 |
57,317 | sreenaths/em-tgraph | addon/utils/graph-view.js | transform | function transform(animate) {
var base = animate ? g.transition().duration(DURATION) : g;
base.attr('transform', `translate(${panX}, ${panY}) scale(${scale})`);
} | javascript | function transform(animate) {
var base = animate ? g.transition().duration(DURATION) : g;
base.attr('transform', `translate(${panX}, ${panY}) scale(${scale})`);
} | [
"function",
"transform",
"(",
"animate",
")",
"{",
"var",
"base",
"=",
"animate",
"?",
"g",
".",
"transition",
"(",
")",
".",
"duration",
"(",
"DURATION",
")",
":",
"g",
";",
"base",
".",
"attr",
"(",
"'transform'",
",",
"`",
"${",
"panX",
"}",
"${... | Transform g to current panX, panY and scale.
@param animate {Boolean} Animate the transformation in DURATION time. | [
"Transform",
"g",
"to",
"current",
"panX",
"panY",
"and",
"scale",
"."
] | 8d6a8f46b911a165ac16561731735ab762954996 | https://github.com/sreenaths/em-tgraph/blob/8d6a8f46b911a165ac16561731735ab762954996/addon/utils/graph-view.js#L778-L781 |
57,318 | sreenaths/em-tgraph | addon/utils/graph-view.js | visibilityCheck | function visibilityCheck() {
var graphBound = g.node().getBoundingClientRect(),
containerBound = container[0].getBoundingClientRect();
if(graphBound.right < containerBound.left ||
graphBound.bottom < containerBound.top ||
graphBound.left > containerBound.right ||
graphBound.top > cont... | javascript | function visibilityCheck() {
var graphBound = g.node().getBoundingClientRect(),
containerBound = container[0].getBoundingClientRect();
if(graphBound.right < containerBound.left ||
graphBound.bottom < containerBound.top ||
graphBound.left > containerBound.right ||
graphBound.top > cont... | [
"function",
"visibilityCheck",
"(",
")",
"{",
"var",
"graphBound",
"=",
"g",
".",
"node",
"(",
")",
".",
"getBoundingClientRect",
"(",
")",
",",
"containerBound",
"=",
"container",
"[",
"0",
"]",
".",
"getBoundingClientRect",
"(",
")",
";",
"if",
"(",
"g... | Check if the item have moved out of the visible area, and reset if required | [
"Check",
"if",
"the",
"item",
"have",
"moved",
"out",
"of",
"the",
"visible",
"area",
"and",
"reset",
"if",
"required"
] | 8d6a8f46b911a165ac16561731735ab762954996 | https://github.com/sreenaths/em-tgraph/blob/8d6a8f46b911a165ac16561731735ab762954996/addon/utils/graph-view.js#L786-L799 |
57,319 | sreenaths/em-tgraph | addon/utils/graph-view.js | onMouseMove | function onMouseMove(event) {
panX += event.pageX - prevX;
panY += event.pageY - prevY;
transform();
prevX = event.pageX;
prevY = event.pageY;
} | javascript | function onMouseMove(event) {
panX += event.pageX - prevX;
panY += event.pageY - prevY;
transform();
prevX = event.pageX;
prevY = event.pageY;
} | [
"function",
"onMouseMove",
"(",
"event",
")",
"{",
"panX",
"+=",
"event",
".",
"pageX",
"-",
"prevX",
";",
"panY",
"+=",
"event",
".",
"pageY",
"-",
"prevY",
";",
"transform",
"(",
")",
";",
"prevX",
"=",
"event",
".",
"pageX",
";",
"prevY",
"=",
"... | Set pan values | [
"Set",
"pan",
"values"
] | 8d6a8f46b911a165ac16561731735ab762954996 | https://github.com/sreenaths/em-tgraph/blob/8d6a8f46b911a165ac16561731735ab762954996/addon/utils/graph-view.js#L815-L823 |
57,320 | sreenaths/em-tgraph | addon/utils/graph-view.js | onWheel | function onWheel(event) {
var prevScale = scale,
offset = container.offset(),
mouseX = event.pageX - offset.left,
mouseY = event.pageY - offset.top,
factor = 0;
scale += event.deltaY * SCALE_TUNER;
if(scale < MIN_SCALE) {
scale = MIN_SCALE;
}
else if(scale > M... | javascript | function onWheel(event) {
var prevScale = scale,
offset = container.offset(),
mouseX = event.pageX - offset.left,
mouseY = event.pageY - offset.top,
factor = 0;
scale += event.deltaY * SCALE_TUNER;
if(scale < MIN_SCALE) {
scale = MIN_SCALE;
}
else if(scale > M... | [
"function",
"onWheel",
"(",
"event",
")",
"{",
"var",
"prevScale",
"=",
"scale",
",",
"offset",
"=",
"container",
".",
"offset",
"(",
")",
",",
"mouseX",
"=",
"event",
".",
"pageX",
"-",
"offset",
".",
"left",
",",
"mouseY",
"=",
"event",
".",
"pageY... | Set zoom values, pan also would change as we are zooming with mouse position as pivote. | [
"Set",
"zoom",
"values",
"pan",
"also",
"would",
"change",
"as",
"we",
"are",
"zooming",
"with",
"mouse",
"position",
"as",
"pivote",
"."
] | 8d6a8f46b911a165ac16561731735ab762954996 | https://github.com/sreenaths/em-tgraph/blob/8d6a8f46b911a165ac16561731735ab762954996/addon/utils/graph-view.js#L827-L852 |
57,321 | sreenaths/em-tgraph | addon/utils/graph-view.js | _setLayout | function _setLayout(layout) {
var leafCount = _data.leafCount,
dimention;
// If count is even dummy will be replaced by output, so output would no more be leaf
if(_data.tree.get('children.length') % 2 === 0) {
leafCount--;
}
dimention = layout.projector(leafCount, _data.maxDepth - 1);
_layout = ... | javascript | function _setLayout(layout) {
var leafCount = _data.leafCount,
dimention;
// If count is even dummy will be replaced by output, so output would no more be leaf
if(_data.tree.get('children.length') % 2 === 0) {
leafCount--;
}
dimention = layout.projector(leafCount, _data.maxDepth - 1);
_layout = ... | [
"function",
"_setLayout",
"(",
"layout",
")",
"{",
"var",
"leafCount",
"=",
"_data",
".",
"leafCount",
",",
"dimention",
";",
"// If count is even dummy will be replaced by output, so output would no more be leaf",
"if",
"(",
"_data",
".",
"tree",
".",
"get",
"(",
"'c... | Sets the layout and update the display.
@param layout {Object} One of the values defined in LAYOUTS object | [
"Sets",
"the",
"layout",
"and",
"update",
"the",
"display",
"."
] | 8d6a8f46b911a165ac16561731735ab762954996 | https://github.com/sreenaths/em-tgraph/blob/8d6a8f46b911a165ac16561731735ab762954996/addon/utils/graph-view.js#L898-L917 |
57,322 | sreenaths/em-tgraph | addon/utils/graph-view.js | function (component, element, data) {
var svg = d3.select(element).select('svg');
_component = component;
_data = data;
_g = svg.append('g').attr('transform', `translate(${PADDING},${PADDING})`);
_svg = Ember.$(svg.node());
_tip = Tip;
_tip.init(Ember.$(element).find('.tool-tip'), _svg);
... | javascript | function (component, element, data) {
var svg = d3.select(element).select('svg');
_component = component;
_data = data;
_g = svg.append('g').attr('transform', `translate(${PADDING},${PADDING})`);
_svg = Ember.$(svg.node());
_tip = Tip;
_tip.init(Ember.$(element).find('.tool-tip'), _svg);
... | [
"function",
"(",
"component",
",",
"element",
",",
"data",
")",
"{",
"var",
"svg",
"=",
"d3",
".",
"select",
"(",
"element",
")",
".",
"select",
"(",
"'svg'",
")",
";",
"_component",
"=",
"component",
";",
"_data",
"=",
"data",
";",
"_g",
"=",
"svg... | Creates a DAG view in the given element based on the data
@param component {DagViewComponent} Parent ember component, to sendAction
@param element {HTML DOM Element} HTML element in which the view will be created
@param data {Object} Created by data processor | [
"Creates",
"a",
"DAG",
"view",
"in",
"the",
"given",
"element",
"based",
"on",
"the",
"data"
] | 8d6a8f46b911a165ac16561731735ab762954996 | https://github.com/sreenaths/em-tgraph/blob/8d6a8f46b911a165ac16561731735ab762954996/addon/utils/graph-view.js#L926-L944 | |
57,323 | sreenaths/em-tgraph | addon/utils/graph-view.js | function (){
var scale = Math.min(
(_svg.width() - PADDING * 2) / _width,
(_svg.height() - PADDING * 2) / _height
),
panZoomValues = _panZoom();
if(
panZoomValues.panX !== PADDING ||
panZoomValues.panY !== PADDING ||
panZoomValues.scale !== scale
) {
_panZoomValu... | javascript | function (){
var scale = Math.min(
(_svg.width() - PADDING * 2) / _width,
(_svg.height() - PADDING * 2) / _height
),
panZoomValues = _panZoom();
if(
panZoomValues.panX !== PADDING ||
panZoomValues.panY !== PADDING ||
panZoomValues.scale !== scale
) {
_panZoomValu... | [
"function",
"(",
")",
"{",
"var",
"scale",
"=",
"Math",
".",
"min",
"(",
"(",
"_svg",
".",
"width",
"(",
")",
"-",
"PADDING",
"*",
"2",
")",
"/",
"_width",
",",
"(",
"_svg",
".",
"height",
"(",
")",
"-",
"PADDING",
"*",
"2",
")",
"/",
"_heigh... | Calling this function would fit the graph to the available space. | [
"Calling",
"this",
"function",
"would",
"fit",
"the",
"graph",
"to",
"the",
"available",
"space",
"."
] | 8d6a8f46b911a165ac16561731735ab762954996 | https://github.com/sreenaths/em-tgraph/blob/8d6a8f46b911a165ac16561731735ab762954996/addon/utils/graph-view.js#L949-L969 | |
57,324 | sreenaths/em-tgraph | addon/utils/graph-view.js | function (hide) {
if(hide) {
_g.attr('class', 'hide-io');
_treeData.recursivelyCall('excludeAdditionals');
}
else {
_treeData.recursivelyCall('includeAdditionals');
_g.attr('class', null);
}
_update();
} | javascript | function (hide) {
if(hide) {
_g.attr('class', 'hide-io');
_treeData.recursivelyCall('excludeAdditionals');
}
else {
_treeData.recursivelyCall('includeAdditionals');
_g.attr('class', null);
}
_update();
} | [
"function",
"(",
"hide",
")",
"{",
"if",
"(",
"hide",
")",
"{",
"_g",
".",
"attr",
"(",
"'class'",
",",
"'hide-io'",
")",
";",
"_treeData",
".",
"recursivelyCall",
"(",
"'excludeAdditionals'",
")",
";",
"}",
"else",
"{",
"_treeData",
".",
"recursivelyCal... | Control display of additionals or sources and sinks.
@param hide {Boolean} If true the additionals will be excluded, else included in the display | [
"Control",
"display",
"of",
"additionals",
"or",
"sources",
"and",
"sinks",
"."
] | 8d6a8f46b911a165ac16561731735ab762954996 | https://github.com/sreenaths/em-tgraph/blob/8d6a8f46b911a165ac16561731735ab762954996/addon/utils/graph-view.js#L975-L985 | |
57,325 | sreenaths/em-tgraph | addon/utils/graph-view.js | function () {
_setLayout(_layout === LAYOUTS.topToBottom ?
LAYOUTS.leftToRight :
LAYOUTS.topToBottom);
return _layout === LAYOUTS.topToBottom;
} | javascript | function () {
_setLayout(_layout === LAYOUTS.topToBottom ?
LAYOUTS.leftToRight :
LAYOUTS.topToBottom);
return _layout === LAYOUTS.topToBottom;
} | [
"function",
"(",
")",
"{",
"_setLayout",
"(",
"_layout",
"===",
"LAYOUTS",
".",
"topToBottom",
"?",
"LAYOUTS",
".",
"leftToRight",
":",
"LAYOUTS",
".",
"topToBottom",
")",
";",
"return",
"_layout",
"===",
"LAYOUTS",
".",
"topToBottom",
";",
"}"
] | Toggle graph layouts between the available options | [
"Toggle",
"graph",
"layouts",
"between",
"the",
"available",
"options"
] | 8d6a8f46b911a165ac16561731735ab762954996 | https://github.com/sreenaths/em-tgraph/blob/8d6a8f46b911a165ac16561731735ab762954996/addon/utils/graph-view.js#L990-L995 | |
57,326 | timkuijsten/node-mongo-bcrypt-user | index.js | User | function User(coll, username, opts) {
if (typeof coll !== 'object') { throw new TypeError('coll must be an object'); }
if (typeof username !== 'string') { throw new TypeError('username must be a string'); }
// setup a resolver
var db = {
find: coll.findOne.bind(coll),
insert: coll.insert.bind(coll),
... | javascript | function User(coll, username, opts) {
if (typeof coll !== 'object') { throw new TypeError('coll must be an object'); }
if (typeof username !== 'string') { throw new TypeError('username must be a string'); }
// setup a resolver
var db = {
find: coll.findOne.bind(coll),
insert: coll.insert.bind(coll),
... | [
"function",
"User",
"(",
"coll",
",",
"username",
",",
"opts",
")",
"{",
"if",
"(",
"typeof",
"coll",
"!==",
"'object'",
")",
"{",
"throw",
"new",
"TypeError",
"(",
"'coll must be an object'",
")",
";",
"}",
"if",
"(",
"typeof",
"username",
"!==",
"'stri... | Store and verify users with bcrypt passwords located in a mongodb collection.
@param {Object} coll the database that contains all user accounts
@param {String} username the name of the user to bind this instance to
@param {Object} [opts] object containing optional parameters
opts:
realm {String, default "_default"... | [
"Store",
"and",
"verify",
"users",
"with",
"bcrypt",
"passwords",
"located",
"in",
"a",
"mongodb",
"collection",
"."
] | 2a110a07cf474bca486bf70350c828b47decae52 | https://github.com/timkuijsten/node-mongo-bcrypt-user/blob/2a110a07cf474bca486bf70350c828b47decae52/index.js#L34-L54 |
57,327 | airbrite/muni | model.js | function(options) {
return function(err, resp) {
if (err) {
options.error(err);
} else {
options.success(resp);
}
};
} | javascript | function(options) {
return function(err, resp) {
if (err) {
options.error(err);
} else {
options.success(resp);
}
};
} | [
"function",
"(",
"options",
")",
"{",
"return",
"function",
"(",
"err",
",",
"resp",
")",
"{",
"if",
"(",
"err",
")",
"{",
"options",
".",
"error",
"(",
"err",
")",
";",
"}",
"else",
"{",
"options",
".",
"success",
"(",
"resp",
")",
";",
"}",
"... | Responsible for setting attributes after a database call
Takes the mongodb response and calls the Backbone success method
@param {Object} options
@return {Function} | [
"Responsible",
"for",
"setting",
"attributes",
"after",
"a",
"database",
"call",
"Takes",
"the",
"mongodb",
"response",
"and",
"calls",
"the",
"Backbone",
"success",
"method"
] | ea8b26aa94836514374907c325a0d79f28838e2e | https://github.com/airbrite/muni/blob/ea8b26aa94836514374907c325a0d79f28838e2e/model.js#L52-L60 | |
57,328 | airbrite/muni | model.js | function(attrs, attrsToRemove) {
_.forEach(attrs, function(val, key) {
// shouldRemove is either an object or a boolean
var shouldRemove = attrsToRemove[key];
if (_.isUndefined(shouldRemove)) {
return;
}
// Support nested object
if (_.isPlainObject(val) && !_.isArray(val... | javascript | function(attrs, attrsToRemove) {
_.forEach(attrs, function(val, key) {
// shouldRemove is either an object or a boolean
var shouldRemove = attrsToRemove[key];
if (_.isUndefined(shouldRemove)) {
return;
}
// Support nested object
if (_.isPlainObject(val) && !_.isArray(val... | [
"function",
"(",
"attrs",
",",
"attrsToRemove",
")",
"{",
"_",
".",
"forEach",
"(",
"attrs",
",",
"function",
"(",
"val",
",",
"key",
")",
"{",
"// shouldRemove is either an object or a boolean",
"var",
"shouldRemove",
"=",
"attrsToRemove",
"[",
"key",
"]",
";... | Remove expandable attributes
Does not work for objects embedded inside arrays
@param {Object} attrs
@param {Object} attrsToRemove | [
"Remove",
"expandable",
"attributes"
] | ea8b26aa94836514374907c325a0d79f28838e2e | https://github.com/airbrite/muni/blob/ea8b26aa94836514374907c325a0d79f28838e2e/model.js#L99-L118 | |
57,329 | airbrite/muni | model.js | function(schemaType, schemaDefault) {
if (!_.isUndefined(schemaDefault)) {
return schemaDefault;
}
switch (schemaType) {
case 'integer':
case 'uinteger':
case 'float':
case 'ufloat':
return 0;
case 'boolean':
return false;
case 'timestamp':
r... | javascript | function(schemaType, schemaDefault) {
if (!_.isUndefined(schemaDefault)) {
return schemaDefault;
}
switch (schemaType) {
case 'integer':
case 'uinteger':
case 'float':
case 'ufloat':
return 0;
case 'boolean':
return false;
case 'timestamp':
r... | [
"function",
"(",
"schemaType",
",",
"schemaDefault",
")",
"{",
"if",
"(",
"!",
"_",
".",
"isUndefined",
"(",
"schemaDefault",
")",
")",
"{",
"return",
"schemaDefault",
";",
"}",
"switch",
"(",
"schemaType",
")",
"{",
"case",
"'integer'",
":",
"case",
"'u... | Return the default value for a schema type
@param {string} schemaType
@param {*} schemaDefault
@return {*} | [
"Return",
"the",
"default",
"value",
"for",
"a",
"schema",
"type"
] | ea8b26aa94836514374907c325a0d79f28838e2e | https://github.com/airbrite/muni/blob/ea8b26aa94836514374907c325a0d79f28838e2e/model.js#L311-L330 | |
57,330 | airbrite/muni | model.js | function(def, withArray) {
def = def ? def : _.result(this, 'definition');
return _.reduce(def, function(defaults, attr, key) {
if (attr.computed) {
return defaults;
}
if (attr.default !== undefined) {
defaults[key] = _.result(attr, 'default');
} else if (attr.type === '... | javascript | function(def, withArray) {
def = def ? def : _.result(this, 'definition');
return _.reduce(def, function(defaults, attr, key) {
if (attr.computed) {
return defaults;
}
if (attr.default !== undefined) {
defaults[key] = _.result(attr, 'default');
} else if (attr.type === '... | [
"function",
"(",
"def",
",",
"withArray",
")",
"{",
"def",
"=",
"def",
"?",
"def",
":",
"_",
".",
"result",
"(",
"this",
",",
"'definition'",
")",
";",
"return",
"_",
".",
"reduce",
"(",
"def",
",",
"function",
"(",
"defaults",
",",
"attr",
",",
... | Get the default attribute values for your model.
When creating an instance of the model,
any unspecified attributes will be set to their default value.
Define defaults as a function.
@param {Object} def
@param {boolean} withArray
@return {Object} | [
"Get",
"the",
"default",
"attribute",
"values",
"for",
"your",
"model",
".",
"When",
"creating",
"an",
"instance",
"of",
"the",
"model",
"any",
"unspecified",
"attributes",
"will",
"be",
"set",
"to",
"their",
"default",
"value",
"."
] | ea8b26aa94836514374907c325a0d79f28838e2e | https://github.com/airbrite/muni/blob/ea8b26aa94836514374907c325a0d79f28838e2e/model.js#L344-L363 | |
57,331 | airbrite/muni | model.js | function(def) {
def = def ? def : _.result(this, 'definition');
return _.reduce(def, function(schema, attr, key) {
if (attr.type === 'object') {
schema[key] = this.schema(attr.fields || {});
} else if (attr.type === 'array') {
if (attr.value_type === 'object') {
schema[key... | javascript | function(def) {
def = def ? def : _.result(this, 'definition');
return _.reduce(def, function(schema, attr, key) {
if (attr.type === 'object') {
schema[key] = this.schema(attr.fields || {});
} else if (attr.type === 'array') {
if (attr.value_type === 'object') {
schema[key... | [
"function",
"(",
"def",
")",
"{",
"def",
"=",
"def",
"?",
"def",
":",
"_",
".",
"result",
"(",
"this",
",",
"'definition'",
")",
";",
"return",
"_",
".",
"reduce",
"(",
"def",
",",
"function",
"(",
"schema",
",",
"attr",
",",
"key",
")",
"{",
"... | Get the types of each attribute.
Define schema as a function.
See `model.spec.js` for how to use
@param {Object} def
@return {Object} | [
"Get",
"the",
"types",
"of",
"each",
"attribute",
"."
] | ea8b26aa94836514374907c325a0d79f28838e2e | https://github.com/airbrite/muni/blob/ea8b26aa94836514374907c325a0d79f28838e2e/model.js#L376-L395 | |
57,332 | airbrite/muni | model.js | function(prop, def) {
def = def ? def : _.result(this, 'definition');
return _.reduce(def, function(attrs, attr, key) {
if (attr.type === 'object') {
var nested = this.findAttributes(prop, attr.fields || {});
if (!_.isEmpty(nested)) {
attrs[key] = nested;
}
} if (a... | javascript | function(prop, def) {
def = def ? def : _.result(this, 'definition');
return _.reduce(def, function(attrs, attr, key) {
if (attr.type === 'object') {
var nested = this.findAttributes(prop, attr.fields || {});
if (!_.isEmpty(nested)) {
attrs[key] = nested;
}
} if (a... | [
"function",
"(",
"prop",
",",
"def",
")",
"{",
"def",
"=",
"def",
"?",
"def",
":",
"_",
".",
"result",
"(",
"this",
",",
"'definition'",
")",
";",
"return",
"_",
".",
"reduce",
"(",
"def",
",",
"function",
"(",
"attrs",
",",
"attr",
",",
"key",
... | Define attributes that are not settable from the request
@param {String} prop
@param {Object} def
@return {Object} | [
"Define",
"attributes",
"that",
"are",
"not",
"settable",
"from",
"the",
"request"
] | ea8b26aa94836514374907c325a0d79f28838e2e | https://github.com/airbrite/muni/blob/ea8b26aa94836514374907c325a0d79f28838e2e/model.js#L404-L418 | |
57,333 | airbrite/muni | model.js | function(resp, options) {
// Mongodb sometimes returns an array of one document
if (_.isArray(resp)) {
resp = resp[0];
}
resp = _.defaultsDeep({}, resp, this.defaults());
return resp;
} | javascript | function(resp, options) {
// Mongodb sometimes returns an array of one document
if (_.isArray(resp)) {
resp = resp[0];
}
resp = _.defaultsDeep({}, resp, this.defaults());
return resp;
} | [
"function",
"(",
"resp",
",",
"options",
")",
"{",
"// Mongodb sometimes returns an array of one document",
"if",
"(",
"_",
".",
"isArray",
"(",
"resp",
")",
")",
"{",
"resp",
"=",
"resp",
"[",
"0",
"]",
";",
"}",
"resp",
"=",
"_",
".",
"defaultsDeep",
"... | Backbone `parse` extended with support for defaults
@param {Object|Array} resp
@param {Object} options
@return {Object} | [
"Backbone",
"parse",
"extended",
"with",
"support",
"for",
"defaults"
] | ea8b26aa94836514374907c325a0d79f28838e2e | https://github.com/airbrite/muni/blob/ea8b26aa94836514374907c325a0d79f28838e2e/model.js#L472-L479 | |
57,334 | airbrite/muni | model.js | function(key, val, options) {
var attrs;
if (key === null) return this;
if (typeof key === 'object') {
attrs = key;
options = val;
} else {
(attrs = {})[key] = val;
}
options || (options = {});
// Don't override unset
if (options.unset) {
return Backbone.Model.... | javascript | function(key, val, options) {
var attrs;
if (key === null) return this;
if (typeof key === 'object') {
attrs = key;
options = val;
} else {
(attrs = {})[key] = val;
}
options || (options = {});
// Don't override unset
if (options.unset) {
return Backbone.Model.... | [
"function",
"(",
"key",
",",
"val",
",",
"options",
")",
"{",
"var",
"attrs",
";",
"if",
"(",
"key",
"===",
"null",
")",
"return",
"this",
";",
"if",
"(",
"typeof",
"key",
"===",
"'object'",
")",
"{",
"attrs",
"=",
"key",
";",
"options",
"=",
"va... | Backbone `set` extended with support for schema
TODO @ptshih Extend with lodash `set` (nested/deep)
@return {*} | [
"Backbone",
"set",
"extended",
"with",
"support",
"for",
"schema"
] | ea8b26aa94836514374907c325a0d79f28838e2e | https://github.com/airbrite/muni/blob/ea8b26aa94836514374907c325a0d79f28838e2e/model.js#L489-L511 | |
57,335 | airbrite/muni | model.js | function(attrs, attr) {
if (!_.isString(attr)) {
return undefined;
}
var keys = attr.split('.');
var key;
var val = attrs;
var context = this;
for (var i = 0, n = keys.length; i < n; i++) {
// get key
key = keys[i];
// Hold reference to the context when diving deep... | javascript | function(attrs, attr) {
if (!_.isString(attr)) {
return undefined;
}
var keys = attr.split('.');
var key;
var val = attrs;
var context = this;
for (var i = 0, n = keys.length; i < n; i++) {
// get key
key = keys[i];
// Hold reference to the context when diving deep... | [
"function",
"(",
"attrs",
",",
"attr",
")",
"{",
"if",
"(",
"!",
"_",
".",
"isString",
"(",
"attr",
")",
")",
"{",
"return",
"undefined",
";",
"}",
"var",
"keys",
"=",
"attr",
".",
"split",
"(",
"'.'",
")",
";",
"var",
"key",
";",
"var",
"val",... | DEPRECATED 2015-05-08 Soon `get` will use lodash `get` instead of `getDeep` | [
"DEPRECATED",
"2015",
"-",
"05",
"-",
"08",
"Soon",
"get",
"will",
"use",
"lodash",
"get",
"instead",
"of",
"getDeep"
] | ea8b26aa94836514374907c325a0d79f28838e2e | https://github.com/airbrite/muni/blob/ea8b26aa94836514374907c325a0d79f28838e2e/model.js#L540-L576 | |
57,336 | stadt-bielefeld/wms-capabilities-tools | index.js | determineVersion | function determineVersion(json) {
var version = 'unknown';
if (json) {
if (json.WMS_Capabilities) {
if (json.WMS_Capabilities.$) {
if (json.WMS_Capabilities.$.version) {
version = json.WMS_Capabilities.$.version;
}
}
} else {
if (json.WMT_MS_Capabilities) {
if (json.WMT_MS_Capabilities.$... | javascript | function determineVersion(json) {
var version = 'unknown';
if (json) {
if (json.WMS_Capabilities) {
if (json.WMS_Capabilities.$) {
if (json.WMS_Capabilities.$.version) {
version = json.WMS_Capabilities.$.version;
}
}
} else {
if (json.WMT_MS_Capabilities) {
if (json.WMT_MS_Capabilities.$... | [
"function",
"determineVersion",
"(",
"json",
")",
"{",
"var",
"version",
"=",
"'unknown'",
";",
"if",
"(",
"json",
")",
"{",
"if",
"(",
"json",
".",
"WMS_Capabilities",
")",
"{",
"if",
"(",
"json",
".",
"WMS_Capabilities",
".",
"$",
")",
"{",
"if",
"... | It determines the version of GetCapabilities document.
@param json
{object} GetCapabilities document as JSON.
@returns {String} Version of GetCapabilities document. If the version can't
determined, it will return 'unknown'. | [
"It",
"determines",
"the",
"version",
"of",
"GetCapabilities",
"document",
"."
] | 647321bc7fb9a50a5fdc6c3424ede3d9c0fd1cb1 | https://github.com/stadt-bielefeld/wms-capabilities-tools/blob/647321bc7fb9a50a5fdc6c3424ede3d9c0fd1cb1/index.js#L43-L63 |
57,337 | stadt-bielefeld/wms-capabilities-tools | index.js | determineJSON | function determineJSON(xml) {
var json = null;
parseString(xml, function(err, result) {
if (err) {
// TODO
console.log(err);
} else {
json = result;
}
});
return json;
} | javascript | function determineJSON(xml) {
var json = null;
parseString(xml, function(err, result) {
if (err) {
// TODO
console.log(err);
} else {
json = result;
}
});
return json;
} | [
"function",
"determineJSON",
"(",
"xml",
")",
"{",
"var",
"json",
"=",
"null",
";",
"parseString",
"(",
"xml",
",",
"function",
"(",
"err",
",",
"result",
")",
"{",
"if",
"(",
"err",
")",
"{",
"// TODO",
"console",
".",
"log",
"(",
"err",
")",
";",... | It determines the JSON object from XML.
@param xml
{string} GetCapabilities document as XML.
@returns {object} GetCapabilities document as JSON. | [
"It",
"determines",
"the",
"JSON",
"object",
"from",
"XML",
"."
] | 647321bc7fb9a50a5fdc6c3424ede3d9c0fd1cb1 | https://github.com/stadt-bielefeld/wms-capabilities-tools/blob/647321bc7fb9a50a5fdc6c3424ede3d9c0fd1cb1/index.js#L72-L83 |
57,338 | stadt-bielefeld/wms-capabilities-tools | index.js | determineLayers | function determineLayers(json, version) {
var layers = [];
if (version == '1.3.0') {
if (json.WMS_Capabilities.Capability) {
if (json.WMS_Capabilities.Capability[0]) {
if (json.WMS_Capabilities.Capability[0].Layer) {
layers = buildLayers(json.WMS_Capabilities.Capability[0].Layer);
}
}
}
} els... | javascript | function determineLayers(json, version) {
var layers = [];
if (version == '1.3.0') {
if (json.WMS_Capabilities.Capability) {
if (json.WMS_Capabilities.Capability[0]) {
if (json.WMS_Capabilities.Capability[0].Layer) {
layers = buildLayers(json.WMS_Capabilities.Capability[0].Layer);
}
}
}
} els... | [
"function",
"determineLayers",
"(",
"json",
",",
"version",
")",
"{",
"var",
"layers",
"=",
"[",
"]",
";",
"if",
"(",
"version",
"==",
"'1.3.0'",
")",
"{",
"if",
"(",
"json",
".",
"WMS_Capabilities",
".",
"Capability",
")",
"{",
"if",
"(",
"json",
".... | It determines the layer JSON from original XML GetCapabilities document.
@param json
{object} GetCapabilities document as JSON.
@param version
{string} Version of GetCapabilities document.
@returns {object} JSON object with layers from original XML GetCapabilities. | [
"It",
"determines",
"the",
"layer",
"JSON",
"from",
"original",
"XML",
"GetCapabilities",
"document",
"."
] | 647321bc7fb9a50a5fdc6c3424ede3d9c0fd1cb1 | https://github.com/stadt-bielefeld/wms-capabilities-tools/blob/647321bc7fb9a50a5fdc6c3424ede3d9c0fd1cb1/index.js#L94-L117 |
57,339 | stadt-bielefeld/wms-capabilities-tools | index.js | determineLayerName | function determineLayerName(layer) {
var name = '';
// Layer name available
if (layer.Name) {
return layer.Name;
} else {
// Layer name not available
// Layer name will be building from sublayers
for (var int = 0; int < layer.Layer.length; int++) {
name += determineLayerName(layer.Layer[int]) + ',';
}... | javascript | function determineLayerName(layer) {
var name = '';
// Layer name available
if (layer.Name) {
return layer.Name;
} else {
// Layer name not available
// Layer name will be building from sublayers
for (var int = 0; int < layer.Layer.length; int++) {
name += determineLayerName(layer.Layer[int]) + ',';
}... | [
"function",
"determineLayerName",
"(",
"layer",
")",
"{",
"var",
"name",
"=",
"''",
";",
"// Layer name available",
"if",
"(",
"layer",
".",
"Name",
")",
"{",
"return",
"layer",
".",
"Name",
";",
"}",
"else",
"{",
"// Layer name not available",
"// Layer name ... | It determines the name of a layer. If the layer name is not set, it will
generate from the sublayers.
@param {object}
layer Layer object like {"Name": "LayerName", "Layer": [{"Name":
"SubLayerName1"},{"Name": "SubLayerName2"}]}
@returns {string} Name of layer | [
"It",
"determines",
"the",
"name",
"of",
"a",
"layer",
".",
"If",
"the",
"layer",
"name",
"is",
"not",
"set",
"it",
"will",
"generate",
"from",
"the",
"sublayers",
"."
] | 647321bc7fb9a50a5fdc6c3424ede3d9c0fd1cb1 | https://github.com/stadt-bielefeld/wms-capabilities-tools/blob/647321bc7fb9a50a5fdc6c3424ede3d9c0fd1cb1/index.js#L128-L148 |
57,340 | stadt-bielefeld/wms-capabilities-tools | index.js | buildLayers | function buildLayers(layersObject) {
// Array of layers
var layers = [];
if (layersObject) {
// Iterate over all layers
for (var int = 0; int < layersObject.length; int++) {
// One layer
var singleLayer = layersObject[int];
// Build a new layer object
var layer = {};
// Determine name from GetC... | javascript | function buildLayers(layersObject) {
// Array of layers
var layers = [];
if (layersObject) {
// Iterate over all layers
for (var int = 0; int < layersObject.length; int++) {
// One layer
var singleLayer = layersObject[int];
// Build a new layer object
var layer = {};
// Determine name from GetC... | [
"function",
"buildLayers",
"(",
"layersObject",
")",
"{",
"// Array of layers",
"var",
"layers",
"=",
"[",
"]",
";",
"if",
"(",
"layersObject",
")",
"{",
"// Iterate over all layers",
"for",
"(",
"var",
"int",
"=",
"0",
";",
"int",
"<",
"layersObject",
".",
... | It builds a simple array with layer information.
@param {object}
layersObject Object with layers from JSON. That JSON have to
converted by the original XML GetCapabilities document.
@returns {array} Array with layers and sublayers | [
"It",
"builds",
"a",
"simple",
"array",
"with",
"layer",
"information",
"."
] | 647321bc7fb9a50a5fdc6c3424ede3d9c0fd1cb1 | https://github.com/stadt-bielefeld/wms-capabilities-tools/blob/647321bc7fb9a50a5fdc6c3424ede3d9c0fd1cb1/index.js#L158-L208 |
57,341 | stadt-bielefeld/wms-capabilities-tools | index.js | determineMaxWidth | function determineMaxWidth(json, version) {
var maxWidth = 0;
// Only available in WMS 1.3.0
if (version == '1.3.0') {
if (json.WMS_Capabilities.Service) {
if (json.WMS_Capabilities.Service[0]) {
if (json.WMS_Capabilities.Service[0].MaxWidth) {
if (json.WMS_Capabilities.Service[0].MaxWidth[0]) {
... | javascript | function determineMaxWidth(json, version) {
var maxWidth = 0;
// Only available in WMS 1.3.0
if (version == '1.3.0') {
if (json.WMS_Capabilities.Service) {
if (json.WMS_Capabilities.Service[0]) {
if (json.WMS_Capabilities.Service[0].MaxWidth) {
if (json.WMS_Capabilities.Service[0].MaxWidth[0]) {
... | [
"function",
"determineMaxWidth",
"(",
"json",
",",
"version",
")",
"{",
"var",
"maxWidth",
"=",
"0",
";",
"// Only available in WMS 1.3.0",
"if",
"(",
"version",
"==",
"'1.3.0'",
")",
"{",
"if",
"(",
"json",
".",
"WMS_Capabilities",
".",
"Service",
")",
"{",... | It determines the max width of a GetMap request in pixels.
@param json
{object} GetCapabilities document as JSON.
@param version
{string} Version of GetCapabilities document.
@returns {integer} Max width of a GetMap request in pixels. It returns 0, if
no value is available. | [
"It",
"determines",
"the",
"max",
"width",
"of",
"a",
"GetMap",
"request",
"in",
"pixels",
"."
] | 647321bc7fb9a50a5fdc6c3424ede3d9c0fd1cb1 | https://github.com/stadt-bielefeld/wms-capabilities-tools/blob/647321bc7fb9a50a5fdc6c3424ede3d9c0fd1cb1/index.js#L220-L237 |
57,342 | stadt-bielefeld/wms-capabilities-tools | index.js | determineMaxHeight | function determineMaxHeight(json, version) {
var maxHeight = 0;
// Only available in WMS 1.3.0
if (version == '1.3.0') {
if (json.WMS_Capabilities.Service) {
if (json.WMS_Capabilities.Service[0]) {
if (json.WMS_Capabilities.Service[0].MaxHeight) {
if (json.WMS_Capabilities.Service[0].MaxHeight[0]) {
... | javascript | function determineMaxHeight(json, version) {
var maxHeight = 0;
// Only available in WMS 1.3.0
if (version == '1.3.0') {
if (json.WMS_Capabilities.Service) {
if (json.WMS_Capabilities.Service[0]) {
if (json.WMS_Capabilities.Service[0].MaxHeight) {
if (json.WMS_Capabilities.Service[0].MaxHeight[0]) {
... | [
"function",
"determineMaxHeight",
"(",
"json",
",",
"version",
")",
"{",
"var",
"maxHeight",
"=",
"0",
";",
"// Only available in WMS 1.3.0",
"if",
"(",
"version",
"==",
"'1.3.0'",
")",
"{",
"if",
"(",
"json",
".",
"WMS_Capabilities",
".",
"Service",
")",
"{... | It determines the max height of a GetMap request in pixels.
@param json
{object} GetCapabilities document as JSON.
@param version
{string} Version of GetCapabilities document.
@returns {integer} Max height of a GetMap request in pixels. It returns 0, if
no value is available. | [
"It",
"determines",
"the",
"max",
"height",
"of",
"a",
"GetMap",
"request",
"in",
"pixels",
"."
] | 647321bc7fb9a50a5fdc6c3424ede3d9c0fd1cb1 | https://github.com/stadt-bielefeld/wms-capabilities-tools/blob/647321bc7fb9a50a5fdc6c3424ede3d9c0fd1cb1/index.js#L249-L266 |
57,343 | stadt-bielefeld/wms-capabilities-tools | index.js | determineWMSTitle | function determineWMSTitle(json, version) {
var ret = '';
if (version == '1.3.0') {
if (json.WMS_Capabilities.Service) {
if (json.WMS_Capabilities.Service[0]) {
if (json.WMS_Capabilities.Service[0].Title) {
if (json.WMS_Capabilities.Service[0].Title[0]) {
ret = json.WMS_Capabilities.Service[0].Ti... | javascript | function determineWMSTitle(json, version) {
var ret = '';
if (version == '1.3.0') {
if (json.WMS_Capabilities.Service) {
if (json.WMS_Capabilities.Service[0]) {
if (json.WMS_Capabilities.Service[0].Title) {
if (json.WMS_Capabilities.Service[0].Title[0]) {
ret = json.WMS_Capabilities.Service[0].Ti... | [
"function",
"determineWMSTitle",
"(",
"json",
",",
"version",
")",
"{",
"var",
"ret",
"=",
"''",
";",
"if",
"(",
"version",
"==",
"'1.3.0'",
")",
"{",
"if",
"(",
"json",
".",
"WMS_Capabilities",
".",
"Service",
")",
"{",
"if",
"(",
"json",
".",
"WMS_... | It determines the WMS title.
@param {object}
json GetCapabilities document as JSON.
@param {string}
version Version of GetCapabilities document.
@returns {string} WMS title. | [
"It",
"determines",
"the",
"WMS",
"title",
"."
] | 647321bc7fb9a50a5fdc6c3424ede3d9c0fd1cb1 | https://github.com/stadt-bielefeld/wms-capabilities-tools/blob/647321bc7fb9a50a5fdc6c3424ede3d9c0fd1cb1/index.js#L399-L427 |
57,344 | stadt-bielefeld/wms-capabilities-tools | index.js | determineWMSAbstract | function determineWMSAbstract(json, version) {
var ret = '';
if (version == '1.3.0') {
if (json.WMS_Capabilities.Service) {
if (json.WMS_Capabilities.Service[0]) {
if (json.WMS_Capabilities.Service[0].Abstract) {
if (json.WMS_Capabilities.Service[0].Abstract[0]) {
ret = json.WMS_Capabilities.Serv... | javascript | function determineWMSAbstract(json, version) {
var ret = '';
if (version == '1.3.0') {
if (json.WMS_Capabilities.Service) {
if (json.WMS_Capabilities.Service[0]) {
if (json.WMS_Capabilities.Service[0].Abstract) {
if (json.WMS_Capabilities.Service[0].Abstract[0]) {
ret = json.WMS_Capabilities.Serv... | [
"function",
"determineWMSAbstract",
"(",
"json",
",",
"version",
")",
"{",
"var",
"ret",
"=",
"''",
";",
"if",
"(",
"version",
"==",
"'1.3.0'",
")",
"{",
"if",
"(",
"json",
".",
"WMS_Capabilities",
".",
"Service",
")",
"{",
"if",
"(",
"json",
".",
"W... | It determines the WMS abstract.
@param {object}
json GetCapabilities document as JSON.
@param {string}
version Version of GetCapabilities document.
@returns {string} WMS abstract. | [
"It",
"determines",
"the",
"WMS",
"abstract",
"."
] | 647321bc7fb9a50a5fdc6c3424ede3d9c0fd1cb1 | https://github.com/stadt-bielefeld/wms-capabilities-tools/blob/647321bc7fb9a50a5fdc6c3424ede3d9c0fd1cb1/index.js#L438-L466 |
57,345 | sazze/node-thrift | lib/_thriftHttpClient.js | Client | function Client(host, port, path, service, transport, protocol) {
if (!service.hasOwnProperty('Client')) {
throw new Error('Thrift Service must have a Client');
}
/**
* The host of the thrift server
*
* @type {string}
*/
this.host = host;
/**
* The port of the thrift server
*
* @typ... | javascript | function Client(host, port, path, service, transport, protocol) {
if (!service.hasOwnProperty('Client')) {
throw new Error('Thrift Service must have a Client');
}
/**
* The host of the thrift server
*
* @type {string}
*/
this.host = host;
/**
* The port of the thrift server
*
* @typ... | [
"function",
"Client",
"(",
"host",
",",
"port",
",",
"path",
",",
"service",
",",
"transport",
",",
"protocol",
")",
"{",
"if",
"(",
"!",
"service",
".",
"hasOwnProperty",
"(",
"'Client'",
")",
")",
"{",
"throw",
"new",
"Error",
"(",
"'Thrift Service mus... | Create a new thrift client
@param {string} host
@param {int} port
@param {string} path
@param {Object} service
@param {Transport} transport
@param {Protocol} protocol
@throws {Error} error If thrift service does not have a Client property
@constructor | [
"Create",
"a",
"new",
"thrift",
"client"
] | 458d1829813cbd2d50dae610bc7210b75140e58f | https://github.com/sazze/node-thrift/blob/458d1829813cbd2d50dae610bc7210b75140e58f/lib/_thriftHttpClient.js#L31-L130 |
57,346 | llamadeus/data-to-png | es/png.js | createChunk | function createChunk(type, data) {
const length = typeof data != 'undefined' ? data.length : 0;
const chunk = Buffer.alloc(4 + 4 + length + 4);
chunk.writeUInt32BE(length, 0);
chunk.fill(type, 4, 8, 'utf8');
if (typeof data != 'undefined') {
chunk.fill(data, 8, chunk.length - 4);
}
chunk.writeUInt32BE(crc32(c... | javascript | function createChunk(type, data) {
const length = typeof data != 'undefined' ? data.length : 0;
const chunk = Buffer.alloc(4 + 4 + length + 4);
chunk.writeUInt32BE(length, 0);
chunk.fill(type, 4, 8, 'utf8');
if (typeof data != 'undefined') {
chunk.fill(data, 8, chunk.length - 4);
}
chunk.writeUInt32BE(crc32(c... | [
"function",
"createChunk",
"(",
"type",
",",
"data",
")",
"{",
"const",
"length",
"=",
"typeof",
"data",
"!=",
"'undefined'",
"?",
"data",
".",
"length",
":",
"0",
";",
"const",
"chunk",
"=",
"Buffer",
".",
"alloc",
"(",
"4",
"+",
"4",
"+",
"length",... | Create a chunk of the given type with the given data.
@param type
@param data
@returns {Buffer} | [
"Create",
"a",
"chunk",
"of",
"the",
"given",
"type",
"with",
"the",
"given",
"data",
"."
] | 8170197b4213d86a56c7b0cc4952f80a1e840766 | https://github.com/llamadeus/data-to-png/blob/8170197b4213d86a56c7b0cc4952f80a1e840766/es/png.js#L27-L39 |
57,347 | rootslab/shashi | lib/shashi.js | function ( n, buffer, bytes ) {
var s = ( n % k ) * slen
// how many bytes to read/consume from the input buffer [1 to 4]
, rbytes = bytes >>> 0 ? abs( bytes ) % 5 : ibytes
, blen = buffer.length - rbytes
, bruint = null
... | javascript | function ( n, buffer, bytes ) {
var s = ( n % k ) * slen
// how many bytes to read/consume from the input buffer [1 to 4]
, rbytes = bytes >>> 0 ? abs( bytes ) % 5 : ibytes
, blen = buffer.length - rbytes
, bruint = null
... | [
"function",
"(",
"n",
",",
"buffer",
",",
"bytes",
")",
"{",
"var",
"s",
"=",
"(",
"n",
"%",
"k",
")",
"*",
"slen",
"// how many bytes to read/consume from the input buffer [1 to 4]",
",",
"rbytes",
"=",
"bytes",
">>>",
"0",
"?",
"abs",
"(",
"bytes",
")",
... | generate random seed sequence for requested range | [
"generate",
"random",
"seed",
"sequence",
"for",
"requested",
"range"
] | 24a52dfe45035a387937de210a93411ecbac0bfc | https://github.com/rootslab/shashi/blob/24a52dfe45035a387937de210a93411ecbac0bfc/lib/shashi.js#L42-L77 | |
57,348 | daliwali/promise-middleware | lib/index.js | promiseMiddleware | function promiseMiddleware (request, response, middleware) {
return new promiseMiddleware.Promise(function (resolve, reject) {
middleware(request, response, function next (error) {
return error ? reject(error) : resolve()
})
})
} | javascript | function promiseMiddleware (request, response, middleware) {
return new promiseMiddleware.Promise(function (resolve, reject) {
middleware(request, response, function next (error) {
return error ? reject(error) : resolve()
})
})
} | [
"function",
"promiseMiddleware",
"(",
"request",
",",
"response",
",",
"middleware",
")",
"{",
"return",
"new",
"promiseMiddleware",
".",
"Promise",
"(",
"function",
"(",
"resolve",
",",
"reject",
")",
"{",
"middleware",
"(",
"request",
",",
"response",
",",
... | Use callback middleware functions as promises.
@param {Object} request
@param {Object} response
@param {Function} middleware | [
"Use",
"callback",
"middleware",
"functions",
"as",
"promises",
"."
] | 5dc63fc74e12fbd7804577b4694c2941f607ba64 | https://github.com/daliwali/promise-middleware/blob/5dc63fc74e12fbd7804577b4694c2941f607ba64/lib/index.js#L14-L20 |
57,349 | SimonSchick/esprintf | index.js | paddLeft | function paddLeft(str, length, what) {
if (length <= str.length) {
return str.substring(0, length);
}
what = what || ' ';
return what.repeat(length - str.length) + str;
} | javascript | function paddLeft(str, length, what) {
if (length <= str.length) {
return str.substring(0, length);
}
what = what || ' ';
return what.repeat(length - str.length) + str;
} | [
"function",
"paddLeft",
"(",
"str",
",",
"length",
",",
"what",
")",
"{",
"if",
"(",
"length",
"<=",
"str",
".",
"length",
")",
"{",
"return",
"str",
".",
"substring",
"(",
"0",
",",
"length",
")",
";",
"}",
"what",
"=",
"what",
"||",
"' '",
";",... | Padds or truncates a string left.
@param {String} str The string to be modified
@param {Number} length Length of the final string
@param {String} what The padding string(should be one character)
@return {String} | [
"Padds",
"or",
"truncates",
"a",
"string",
"left",
"."
] | 0aedf87a2c55a7daaa17a24d77625f5af86eea41 | https://github.com/SimonSchick/esprintf/blob/0aedf87a2c55a7daaa17a24d77625f5af86eea41/index.js#L10-L16 |
57,350 | SimonSchick/esprintf | index.js | paddRight | function paddRight(str, length, what) {
if (length <= str.length) {
return str.substring(0, length);
}
what = what || ' ';
return str + what.repeat(length - str.length);
} | javascript | function paddRight(str, length, what) {
if (length <= str.length) {
return str.substring(0, length);
}
what = what || ' ';
return str + what.repeat(length - str.length);
} | [
"function",
"paddRight",
"(",
"str",
",",
"length",
",",
"what",
")",
"{",
"if",
"(",
"length",
"<=",
"str",
".",
"length",
")",
"{",
"return",
"str",
".",
"substring",
"(",
"0",
",",
"length",
")",
";",
"}",
"what",
"=",
"what",
"||",
"' '",
";"... | Padds or truncates a string right.
@param {String} str The string to be modified
@param {Number} length Length of the final string
@param {String} what The padding string(should be one character)
@return {String} | [
"Padds",
"or",
"truncates",
"a",
"string",
"right",
"."
] | 0aedf87a2c55a7daaa17a24d77625f5af86eea41 | https://github.com/SimonSchick/esprintf/blob/0aedf87a2c55a7daaa17a24d77625f5af86eea41/index.js#L25-L31 |
57,351 | SimonSchick/esprintf | index.js | precBase | function precBase(base, value, precision) {
const val = value.toString(base);
const floatingPoint = val.indexOf('.');
if (precision === 0 && floatingPoint > -1) {
return val.substring(0, floatingPoint);//Node version > 0.10.*
}
if (floatingPoint === -1) {
return val;
}
if (val.length - floatingPoint > precis... | javascript | function precBase(base, value, precision) {
const val = value.toString(base);
const floatingPoint = val.indexOf('.');
if (precision === 0 && floatingPoint > -1) {
return val.substring(0, floatingPoint);//Node version > 0.10.*
}
if (floatingPoint === -1) {
return val;
}
if (val.length - floatingPoint > precis... | [
"function",
"precBase",
"(",
"base",
",",
"value",
",",
"precision",
")",
"{",
"const",
"val",
"=",
"value",
".",
"toString",
"(",
"base",
")",
";",
"const",
"floatingPoint",
"=",
"val",
".",
"indexOf",
"(",
"'.'",
")",
";",
"if",
"(",
"precision",
"... | Converts the given value to the new numeric base and truncates the precision to the given value.
@param {Number} base Should follow the restrictions of Number.prototype.toString()
@param {Number} value
@param {Number} precision
@return {String} | [
"Converts",
"the",
"given",
"value",
"to",
"the",
"new",
"numeric",
"base",
"and",
"truncates",
"the",
"precision",
"to",
"the",
"given",
"value",
"."
] | 0aedf87a2c55a7daaa17a24d77625f5af86eea41 | https://github.com/SimonSchick/esprintf/blob/0aedf87a2c55a7daaa17a24d77625f5af86eea41/index.js#L45-L57 |
57,352 | pierrec/node-atok-parser | examples/simple_CSV.js | ParserContent | function ParserContent () {
// Parser reference
var self = this
// Current row
var data = []
// Define the parser rules
var eol = ['\n','\r\n']
var sep = options.separator || ','
// Handlers are used instead of events
atok
// Ignore comments
.ignore(true) // On rule match, do not do anything, skip t... | javascript | function ParserContent () {
// Parser reference
var self = this
// Current row
var data = []
// Define the parser rules
var eol = ['\n','\r\n']
var sep = options.separator || ','
// Handlers are used instead of events
atok
// Ignore comments
.ignore(true) // On rule match, do not do anything, skip t... | [
"function",
"ParserContent",
"(",
")",
"{",
"// Parser reference",
"var",
"self",
"=",
"this",
"// Current row",
"var",
"data",
"=",
"[",
"]",
"// Define the parser rules",
"var",
"eol",
"=",
"[",
"'\\n'",
",",
"'\\r\\n'",
"]",
"var",
"sep",
"=",
"options",
... | This is a rudimentary CSV parser
In this simple version, the data must not contain any coma
and double quotes are not processed. | [
"This",
"is",
"a",
"rudimentary",
"CSV",
"parser",
"In",
"this",
"simple",
"version",
"the",
"data",
"must",
"not",
"contain",
"any",
"coma",
"and",
"double",
"quotes",
"are",
"not",
"processed",
"."
] | 414d39904dff73ffdde049212076c14ca40aa20b | https://github.com/pierrec/node-atok-parser/blob/414d39904dff73ffdde049212076c14ca40aa20b/examples/simple_CSV.js#L6-L42 |
57,353 | Asw20/session-data | lib/sessionData.js | _sessionData | function _sessionData(variable, value, parameter) {
if (this.session === undefined) throw Error('req.sessionData() requires sessions');
var values = this.session.sessionData = this.session.sessionData || {};
if (variable && value) {
// Special handling for configuration
if (parameter=='setup') {
d... | javascript | function _sessionData(variable, value, parameter) {
if (this.session === undefined) throw Error('req.sessionData() requires sessions');
var values = this.session.sessionData = this.session.sessionData || {};
if (variable && value) {
// Special handling for configuration
if (parameter=='setup') {
d... | [
"function",
"_sessionData",
"(",
"variable",
",",
"value",
",",
"parameter",
")",
"{",
"if",
"(",
"this",
".",
"session",
"===",
"undefined",
")",
"throw",
"Error",
"(",
"'req.sessionData() requires sessions'",
")",
";",
"var",
"values",
"=",
"this",
".",
"s... | Queue sessionData `value` of the given `Variable`.
Examples:
Regular behavior:
req.sessionData('var01', 'value01');
req.sessionData('var01', 'value02');
req.sessionData('var01', 'value03');
req.sessionData('var02', 'value20');
req.sessionData('var02', 'value21');
// req.sessionData('var01') => value01,value02,value03... | [
"Queue",
"sessionData",
"value",
"of",
"the",
"given",
"Variable",
"."
] | 3e3c645951661556354d387ebc4b8732c7c55331 | https://github.com/Asw20/session-data/blob/3e3c645951661556354d387ebc4b8732c7c55331/lib/sessionData.js#L78-L130 |
57,354 | Athaphian/grunt-websocket | tasks/websocket.js | function (server) {
// Retrieve the configured handler.
if (handler) {
handler = require(require('path').resolve() + '/' + handler);
} else {
console.log('No handler defined for websocket server, not starting websocket.');
return;
}
// Attach websockets server to ... | javascript | function (server) {
// Retrieve the configured handler.
if (handler) {
handler = require(require('path').resolve() + '/' + handler);
} else {
console.log('No handler defined for websocket server, not starting websocket.');
return;
}
// Attach websockets server to ... | [
"function",
"(",
"server",
")",
"{",
"// Retrieve the configured handler.",
"if",
"(",
"handler",
")",
"{",
"handler",
"=",
"require",
"(",
"require",
"(",
"'path'",
")",
".",
"resolve",
"(",
")",
"+",
"'/'",
"+",
"handler",
")",
";",
"}",
"else",
"{",
... | Attaches a websocket server to the specified http server. | [
"Attaches",
"a",
"websocket",
"server",
"to",
"the",
"specified",
"http",
"server",
"."
] | 5fad7f1a568f290f9ec7ac5597b49d588de7c2ec | https://github.com/Athaphian/grunt-websocket/blob/5fad7f1a568f290f9ec7ac5597b49d588de7c2ec/tasks/websocket.js#L26-L44 | |
57,355 | nopnop/docflux | lib/transform.js | transform | function transform() {
var stack = [];
var inside = false;
var out = false;
var writable = combiner(split(), through2(function(line, encoding, done) {
line = line.toString();
if(out) {
// Comment with a white space below are ignored
if(line.trim() != '') {
readable.write(p... | javascript | function transform() {
var stack = [];
var inside = false;
var out = false;
var writable = combiner(split(), through2(function(line, encoding, done) {
line = line.toString();
if(out) {
// Comment with a white space below are ignored
if(line.trim() != '') {
readable.write(p... | [
"function",
"transform",
"(",
")",
"{",
"var",
"stack",
"=",
"[",
"]",
";",
"var",
"inside",
"=",
"false",
";",
"var",
"out",
"=",
"false",
";",
"var",
"writable",
"=",
"combiner",
"(",
"split",
"(",
")",
",",
"through2",
"(",
"function",
"(",
"lin... | Create a doc-block extractor stream
This function take a buffer stream as input and output a object stream
of docflux object (objectified documentation block)
Example:
```javascript
var docflux = require('docflux');
process.stdin(docflux())
.on('data', function(jsdoc) {
console.log(JSON.stringify(jsdoc, null, 2))
})... | [
"Create",
"a",
"doc",
"-",
"block",
"extractor",
"stream"
] | 3929fdac9d1e959946fb48f3e8a269d338841902 | https://github.com/nopnop/docflux/blob/3929fdac9d1e959946fb48f3e8a269d338841902/lib/transform.js#L29-L66 |
57,356 | seanmpuckett/sai | lib/saigrammar.js | TaskClauseFormatter | function TaskClauseFormatter(o) {
var params=[];
if (!o.nodefaultparam) {
params.push('p');
}
var expects='',locals=[];//$unused=this';
if (o.expects && o.as) fail("SAI compile: cannot have both EXPECTS and AS in a function declaration");
if (o.expects && o.expe... | javascript | function TaskClauseFormatter(o) {
var params=[];
if (!o.nodefaultparam) {
params.push('p');
}
var expects='',locals=[];//$unused=this';
if (o.expects && o.as) fail("SAI compile: cannot have both EXPECTS and AS in a function declaration");
if (o.expects && o.expe... | [
"function",
"TaskClauseFormatter",
"(",
"o",
")",
"{",
"var",
"params",
"=",
"[",
"]",
";",
"if",
"(",
"!",
"o",
".",
"nodefaultparam",
")",
"{",
"params",
".",
"push",
"(",
"'p'",
")",
";",
"}",
"var",
"expects",
"=",
"''",
",",
"locals",
"=",
"... | expects as kind body preface appendix | [
"expects",
"as",
"kind",
"body",
"preface",
"appendix"
] | 759274a3078bef6939e634f2761656dc8db547d2 | https://github.com/seanmpuckett/sai/blob/759274a3078bef6939e634f2761656dc8db547d2/lib/saigrammar.js#L2352-L2378 |
57,357 | skerit/alchemy-styleboost | public/ckeditor/4.4dev/plugins/dialog/plugin.js | handleFieldValidated | function handleFieldValidated( isValid, msg ) {
var input = this.getInputElement();
if ( input )
isValid ? input.removeAttribute( 'aria-invalid' ) : input.setAttribute( 'aria-invalid', true );
if ( !isValid ) {
if ( this.select )
this.select();
else
this.focus();
}
msg && alert(... | javascript | function handleFieldValidated( isValid, msg ) {
var input = this.getInputElement();
if ( input )
isValid ? input.removeAttribute( 'aria-invalid' ) : input.setAttribute( 'aria-invalid', true );
if ( !isValid ) {
if ( this.select )
this.select();
else
this.focus();
}
msg && alert(... | [
"function",
"handleFieldValidated",
"(",
"isValid",
",",
"msg",
")",
"{",
"var",
"input",
"=",
"this",
".",
"getInputElement",
"(",
")",
";",
"if",
"(",
"input",
")",
"isValid",
"?",
"input",
".",
"removeAttribute",
"(",
"'aria-invalid'",
")",
":",
"input"... | Handle dialog element validation state UI changes. | [
"Handle",
"dialog",
"element",
"validation",
"state",
"UI",
"changes",
"."
] | 2b90b8a6afc9f065f785651292fb193940021d90 | https://github.com/skerit/alchemy-styleboost/blob/2b90b8a6afc9f065f785651292fb193940021d90/public/ckeditor/4.4dev/plugins/dialog/plugin.js#L98-L113 |
57,358 | skerit/alchemy-styleboost | public/ckeditor/4.4dev/plugins/dialog/plugin.js | function( func ) {
var contents = me._.contents,
stop = false;
for ( var i in contents ) {
for ( var j in contents[ i ] ) {
stop = func.call( this, contents[ i ][ j ] );
if ( stop )
return;
}
}
} | javascript | function( func ) {
var contents = me._.contents,
stop = false;
for ( var i in contents ) {
for ( var j in contents[ i ] ) {
stop = func.call( this, contents[ i ][ j ] );
if ( stop )
return;
}
}
} | [
"function",
"(",
"func",
")",
"{",
"var",
"contents",
"=",
"me",
".",
"_",
".",
"contents",
",",
"stop",
"=",
"false",
";",
"for",
"(",
"var",
"i",
"in",
"contents",
")",
"{",
"for",
"(",
"var",
"j",
"in",
"contents",
"[",
"i",
"]",
")",
"{",
... | Iterates over all items inside all content in the dialog, calling a function for each of them. | [
"Iterates",
"over",
"all",
"items",
"inside",
"all",
"content",
"in",
"the",
"dialog",
"calling",
"a",
"function",
"for",
"each",
"of",
"them",
"."
] | 2b90b8a6afc9f065f785651292fb193940021d90 | https://github.com/skerit/alchemy-styleboost/blob/2b90b8a6afc9f065f785651292fb193940021d90/public/ckeditor/4.4dev/plugins/dialog/plugin.js#L339-L350 | |
57,359 | skerit/alchemy-styleboost | public/ckeditor/4.4dev/plugins/dialog/plugin.js | setupFocus | function setupFocus() {
var focusList = me._.focusList;
focusList.sort( function( a, b ) {
// Mimics browser tab order logics;
if ( a.tabIndex != b.tabIndex )
return b.tabIndex - a.tabIndex;
// Sort is not stable in some browsers,
// fall-back the comparator to 'focusIndex';
else... | javascript | function setupFocus() {
var focusList = me._.focusList;
focusList.sort( function( a, b ) {
// Mimics browser tab order logics;
if ( a.tabIndex != b.tabIndex )
return b.tabIndex - a.tabIndex;
// Sort is not stable in some browsers,
// fall-back the comparator to 'focusIndex';
else... | [
"function",
"setupFocus",
"(",
")",
"{",
"var",
"focusList",
"=",
"me",
".",
"_",
".",
"focusList",
";",
"focusList",
".",
"sort",
"(",
"function",
"(",
"a",
",",
"b",
")",
"{",
"// Mimics browser tab order logics;\r",
"if",
"(",
"a",
".",
"tabIndex",
"!... | Sort focus list according to tab order definitions. | [
"Sort",
"focus",
"list",
"according",
"to",
"tab",
"order",
"definitions",
"."
] | 2b90b8a6afc9f065f785651292fb193940021d90 | https://github.com/skerit/alchemy-styleboost/blob/2b90b8a6afc9f065f785651292fb193940021d90/public/ckeditor/4.4dev/plugins/dialog/plugin.js#L386-L401 |
57,360 | skerit/alchemy-styleboost | public/ckeditor/4.4dev/plugins/dialog/plugin.js | Focusable | function Focusable( dialog, element, index ) {
this.element = element;
this.focusIndex = index;
// TODO: support tabIndex for focusables.
this.tabIndex = 0;
this.isFocusable = function() {
return !element.getAttribute( 'disabled' ) && element.isVisible();
};
this.focus = function() {
dialog... | javascript | function Focusable( dialog, element, index ) {
this.element = element;
this.focusIndex = index;
// TODO: support tabIndex for focusables.
this.tabIndex = 0;
this.isFocusable = function() {
return !element.getAttribute( 'disabled' ) && element.isVisible();
};
this.focus = function() {
dialog... | [
"function",
"Focusable",
"(",
"dialog",
",",
"element",
",",
"index",
")",
"{",
"this",
".",
"element",
"=",
"element",
";",
"this",
".",
"focusIndex",
"=",
"index",
";",
"// TODO: support tabIndex for focusables.\r",
"this",
".",
"tabIndex",
"=",
"0",
";",
... | Focusable interface. Use it via dialog.addFocusable. | [
"Focusable",
"interface",
".",
"Use",
"it",
"via",
"dialog",
".",
"addFocusable",
"."
] | 2b90b8a6afc9f065f785651292fb193940021d90 | https://github.com/skerit/alchemy-styleboost/blob/2b90b8a6afc9f065f785651292fb193940021d90/public/ckeditor/4.4dev/plugins/dialog/plugin.js#L622-L645 |
57,361 | skerit/alchemy-styleboost | public/ckeditor/4.4dev/plugins/dialog/plugin.js | resizeWithWindow | function resizeWithWindow( dialog ) {
var win = CKEDITOR.document.getWindow();
function resizeHandler() { dialog.layout(); }
win.on( 'resize', resizeHandler );
dialog.on( 'hide', function() { win.removeListener( 'resize', resizeHandler ); } );
} | javascript | function resizeWithWindow( dialog ) {
var win = CKEDITOR.document.getWindow();
function resizeHandler() { dialog.layout(); }
win.on( 'resize', resizeHandler );
dialog.on( 'hide', function() { win.removeListener( 'resize', resizeHandler ); } );
} | [
"function",
"resizeWithWindow",
"(",
"dialog",
")",
"{",
"var",
"win",
"=",
"CKEDITOR",
".",
"document",
".",
"getWindow",
"(",
")",
";",
"function",
"resizeHandler",
"(",
")",
"{",
"dialog",
".",
"layout",
"(",
")",
";",
"}",
"win",
".",
"on",
"(",
... | Re-layout the dialog on window resize. | [
"Re",
"-",
"layout",
"the",
"dialog",
"on",
"window",
"resize",
"."
] | 2b90b8a6afc9f065f785651292fb193940021d90 | https://github.com/skerit/alchemy-styleboost/blob/2b90b8a6afc9f065f785651292fb193940021d90/public/ckeditor/4.4dev/plugins/dialog/plugin.js#L648-L653 |
57,362 | skerit/alchemy-styleboost | public/ckeditor/4.4dev/plugins/dialog/plugin.js | function() {
var element = this._.element.getFirst();
return { width: element.$.offsetWidth || 0, height: element.$.offsetHeight || 0 };
} | javascript | function() {
var element = this._.element.getFirst();
return { width: element.$.offsetWidth || 0, height: element.$.offsetHeight || 0 };
} | [
"function",
"(",
")",
"{",
"var",
"element",
"=",
"this",
".",
"_",
".",
"element",
".",
"getFirst",
"(",
")",
";",
"return",
"{",
"width",
":",
"element",
".",
"$",
".",
"offsetWidth",
"||",
"0",
",",
"height",
":",
"element",
".",
"$",
".",
"of... | Gets the current size of the dialog in pixels.
var width = dialogObj.getSize().width;
@returns {Object}
@returns {Number} return.width
@returns {Number} return.height | [
"Gets",
"the",
"current",
"size",
"of",
"the",
"dialog",
"in",
"pixels",
"."
] | 2b90b8a6afc9f065f785651292fb193940021d90 | https://github.com/skerit/alchemy-styleboost/blob/2b90b8a6afc9f065f785651292fb193940021d90/public/ckeditor/4.4dev/plugins/dialog/plugin.js#L709-L712 | |
57,363 | skerit/alchemy-styleboost | public/ckeditor/4.4dev/plugins/dialog/plugin.js | function() {
var el = this.parts.dialog;
var dialogSize = this.getSize();
var win = CKEDITOR.document.getWindow(),
viewSize = win.getViewPaneSize();
var posX = ( viewSize.width - dialogSize.width ) / 2,
posY = ( viewSize.height - dialogSize.height ) / 2;
// Switch to absolute position... | javascript | function() {
var el = this.parts.dialog;
var dialogSize = this.getSize();
var win = CKEDITOR.document.getWindow(),
viewSize = win.getViewPaneSize();
var posX = ( viewSize.width - dialogSize.width ) / 2,
posY = ( viewSize.height - dialogSize.height ) / 2;
// Switch to absolute position... | [
"function",
"(",
")",
"{",
"var",
"el",
"=",
"this",
".",
"parts",
".",
"dialog",
";",
"var",
"dialogSize",
"=",
"this",
".",
"getSize",
"(",
")",
";",
"var",
"win",
"=",
"CKEDITOR",
".",
"document",
".",
"getWindow",
"(",
")",
",",
"viewSize",
"="... | Rearrange the dialog to its previous position or the middle of the window.
@since 3.5 | [
"Rearrange",
"the",
"dialog",
"to",
"its",
"previous",
"position",
"or",
"the",
"middle",
"of",
"the",
"window",
"."
] | 2b90b8a6afc9f065f785651292fb193940021d90 | https://github.com/skerit/alchemy-styleboost/blob/2b90b8a6afc9f065f785651292fb193940021d90/public/ckeditor/4.4dev/plugins/dialog/plugin.js#L890-L910 | |
57,364 | skerit/alchemy-styleboost | public/ckeditor/4.4dev/plugins/dialog/plugin.js | function( fn ) {
for ( var i in this._.contents ) {
for ( var j in this._.contents[ i ] )
fn.call( this, this._.contents[ i ][ j ] );
}
return this;
} | javascript | function( fn ) {
for ( var i in this._.contents ) {
for ( var j in this._.contents[ i ] )
fn.call( this, this._.contents[ i ][ j ] );
}
return this;
} | [
"function",
"(",
"fn",
")",
"{",
"for",
"(",
"var",
"i",
"in",
"this",
".",
"_",
".",
"contents",
")",
"{",
"for",
"(",
"var",
"j",
"in",
"this",
".",
"_",
".",
"contents",
"[",
"i",
"]",
")",
"fn",
".",
"call",
"(",
"this",
",",
"this",
".... | Executes a function for each UI element.
@param {Function} fn Function to execute for each UI element.
@returns {CKEDITOR.dialog} The current dialog object. | [
"Executes",
"a",
"function",
"for",
"each",
"UI",
"element",
"."
] | 2b90b8a6afc9f065f785651292fb193940021d90 | https://github.com/skerit/alchemy-styleboost/blob/2b90b8a6afc9f065f785651292fb193940021d90/public/ckeditor/4.4dev/plugins/dialog/plugin.js#L918-L924 | |
57,365 | skerit/alchemy-styleboost | public/ckeditor/4.4dev/plugins/dialog/plugin.js | function() {
if ( !this.parts.dialog.isVisible() )
return;
this.fire( 'hide', {} );
this._.editor.fire( 'dialogHide', this );
// Reset the tab page.
this.selectPage( this._.tabIdList[ 0 ] );
var element = this._.element;
element.setStyle( 'display', 'none' );
this.parts.dialog.set... | javascript | function() {
if ( !this.parts.dialog.isVisible() )
return;
this.fire( 'hide', {} );
this._.editor.fire( 'dialogHide', this );
// Reset the tab page.
this.selectPage( this._.tabIdList[ 0 ] );
var element = this._.element;
element.setStyle( 'display', 'none' );
this.parts.dialog.set... | [
"function",
"(",
")",
"{",
"if",
"(",
"!",
"this",
".",
"parts",
".",
"dialog",
".",
"isVisible",
"(",
")",
")",
"return",
";",
"this",
".",
"fire",
"(",
"'hide'",
",",
"{",
"}",
")",
";",
"this",
".",
"_",
".",
"editor",
".",
"fire",
"(",
"'... | Hides the dialog box.
dialogObj.hide(); | [
"Hides",
"the",
"dialog",
"box",
"."
] | 2b90b8a6afc9f065f785651292fb193940021d90 | https://github.com/skerit/alchemy-styleboost/blob/2b90b8a6afc9f065f785651292fb193940021d90/public/ckeditor/4.4dev/plugins/dialog/plugin.js#L991-L1048 | |
57,366 | skerit/alchemy-styleboost | public/ckeditor/4.4dev/plugins/dialog/plugin.js | function( id ) {
if ( this._.currentTabId == id )
return;
if ( this._.tabs[ id ][ 0 ].hasClass( 'cke_dialog_tab_disabled' ) )
return;
// If event was canceled - do nothing.
if ( this.fire( 'selectPage', { page: id, currentPage: this._.currentTabId } ) === false )
return;
// Hide... | javascript | function( id ) {
if ( this._.currentTabId == id )
return;
if ( this._.tabs[ id ][ 0 ].hasClass( 'cke_dialog_tab_disabled' ) )
return;
// If event was canceled - do nothing.
if ( this.fire( 'selectPage', { page: id, currentPage: this._.currentTabId } ) === false )
return;
// Hide... | [
"function",
"(",
"id",
")",
"{",
"if",
"(",
"this",
".",
"_",
".",
"currentTabId",
"==",
"id",
")",
"return",
";",
"if",
"(",
"this",
".",
"_",
".",
"tabs",
"[",
"id",
"]",
"[",
"0",
"]",
".",
"hasClass",
"(",
"'cke_dialog_tab_disabled'",
")",
")... | Activates a tab page in the dialog by its id.
dialogObj.selectPage( 'tab_1' );
@param {String} id The id of the dialog tab to be activated. | [
"Activates",
"a",
"tab",
"page",
"in",
"the",
"dialog",
"by",
"its",
"id",
"."
] | 2b90b8a6afc9f065f785651292fb193940021d90 | https://github.com/skerit/alchemy-styleboost/blob/2b90b8a6afc9f065f785651292fb193940021d90/public/ckeditor/4.4dev/plugins/dialog/plugin.js#L1141-L1180 | |
57,367 | skerit/alchemy-styleboost | public/ckeditor/4.4dev/plugins/dialog/plugin.js | function( id ) {
var tab = this._.tabs[ id ] && this._.tabs[ id ][ 0 ];
if ( !tab || this._.pageCount == 1 || !tab.isVisible() )
return;
// Switch to other tab first when we're hiding the active tab.
else if ( id == this._.currentTabId )
this.selectPage( getPreviousVisibleTab.call( this ) );
... | javascript | function( id ) {
var tab = this._.tabs[ id ] && this._.tabs[ id ][ 0 ];
if ( !tab || this._.pageCount == 1 || !tab.isVisible() )
return;
// Switch to other tab first when we're hiding the active tab.
else if ( id == this._.currentTabId )
this.selectPage( getPreviousVisibleTab.call( this ) );
... | [
"function",
"(",
"id",
")",
"{",
"var",
"tab",
"=",
"this",
".",
"_",
".",
"tabs",
"[",
"id",
"]",
"&&",
"this",
".",
"_",
".",
"tabs",
"[",
"id",
"]",
"[",
"0",
"]",
";",
"if",
"(",
"!",
"tab",
"||",
"this",
".",
"_",
".",
"pageCount",
"... | Hides a page's tab away from the dialog.
dialog.hidePage( 'tab_3' );
@param {String} id The page's Id. | [
"Hides",
"a",
"page",
"s",
"tab",
"away",
"from",
"the",
"dialog",
"."
] | 2b90b8a6afc9f065f785651292fb193940021d90 | https://github.com/skerit/alchemy-styleboost/blob/2b90b8a6afc9f065f785651292fb193940021d90/public/ckeditor/4.4dev/plugins/dialog/plugin.js#L1197-L1208 | |
57,368 | skerit/alchemy-styleboost | public/ckeditor/4.4dev/plugins/dialog/plugin.js | function( id ) {
var tab = this._.tabs[ id ] && this._.tabs[ id ][ 0 ];
if ( !tab )
return;
tab.show();
this._.pageCount++;
this.updateStyle();
} | javascript | function( id ) {
var tab = this._.tabs[ id ] && this._.tabs[ id ][ 0 ];
if ( !tab )
return;
tab.show();
this._.pageCount++;
this.updateStyle();
} | [
"function",
"(",
"id",
")",
"{",
"var",
"tab",
"=",
"this",
".",
"_",
".",
"tabs",
"[",
"id",
"]",
"&&",
"this",
".",
"_",
".",
"tabs",
"[",
"id",
"]",
"[",
"0",
"]",
";",
"if",
"(",
"!",
"tab",
")",
"return",
";",
"tab",
".",
"show",
"("... | Unhides a page's tab.
dialog.showPage( 'tab_2' );
@param {String} id The page's Id. | [
"Unhides",
"a",
"page",
"s",
"tab",
"."
] | 2b90b8a6afc9f065f785651292fb193940021d90 | https://github.com/skerit/alchemy-styleboost/blob/2b90b8a6afc9f065f785651292fb193940021d90/public/ckeditor/4.4dev/plugins/dialog/plugin.js#L1217-L1224 | |
57,369 | skerit/alchemy-styleboost | public/ckeditor/4.4dev/plugins/dialog/plugin.js | function( element, index ) {
if ( typeof index == 'undefined' ) {
index = this._.focusList.length;
this._.focusList.push( new Focusable( this, element, index ) );
} else {
this._.focusList.splice( index, 0, new Focusable( this, element, index ) );
for ( var i = index + 1; i < this._.focusLis... | javascript | function( element, index ) {
if ( typeof index == 'undefined' ) {
index = this._.focusList.length;
this._.focusList.push( new Focusable( this, element, index ) );
} else {
this._.focusList.splice( index, 0, new Focusable( this, element, index ) );
for ( var i = index + 1; i < this._.focusLis... | [
"function",
"(",
"element",
",",
"index",
")",
"{",
"if",
"(",
"typeof",
"index",
"==",
"'undefined'",
")",
"{",
"index",
"=",
"this",
".",
"_",
".",
"focusList",
".",
"length",
";",
"this",
".",
"_",
".",
"focusList",
".",
"push",
"(",
"new",
"Foc... | Adds element to dialog's focusable list.
@param {CKEDITOR.dom.element} element
@param {Number} [index] | [
"Adds",
"element",
"to",
"dialog",
"s",
"focusable",
"list",
"."
] | 2b90b8a6afc9f065f785651292fb193940021d90 | https://github.com/skerit/alchemy-styleboost/blob/2b90b8a6afc9f065f785651292fb193940021d90/public/ckeditor/4.4dev/plugins/dialog/plugin.js#L1362-L1371 | |
57,370 | skerit/alchemy-styleboost | public/ckeditor/4.4dev/plugins/dialog/plugin.js | function( name, dialogDefinition ) {
// Avoid path registration from multiple instances override definition.
if ( !this._.dialogDefinitions[ name ] || typeof dialogDefinition == 'function' )
this._.dialogDefinitions[ name ] = dialogDefinition;
} | javascript | function( name, dialogDefinition ) {
// Avoid path registration from multiple instances override definition.
if ( !this._.dialogDefinitions[ name ] || typeof dialogDefinition == 'function' )
this._.dialogDefinitions[ name ] = dialogDefinition;
} | [
"function",
"(",
"name",
",",
"dialogDefinition",
")",
"{",
"// Avoid path registration from multiple instances override definition.\r",
"if",
"(",
"!",
"this",
".",
"_",
".",
"dialogDefinitions",
"[",
"name",
"]",
"||",
"typeof",
"dialogDefinition",
"==",
"'function'",... | Registers a dialog.
// Full sample plugin, which does not only register a dialog window but also adds an item to the context menu.
// To open the dialog window, choose "Open dialog" in the context menu.
CKEDITOR.plugins.add( 'myplugin', {
init: function( editor ) {
editor.addCommand( 'mydialog',new CKEDITOR.dialogComm... | [
"Registers",
"a",
"dialog",
"."
] | 2b90b8a6afc9f065f785651292fb193940021d90 | https://github.com/skerit/alchemy-styleboost/blob/2b90b8a6afc9f065f785651292fb193940021d90/public/ckeditor/4.4dev/plugins/dialog/plugin.js#L1447-L1451 | |
57,371 | skerit/alchemy-styleboost | public/ckeditor/4.4dev/plugins/dialog/plugin.js | function( array, id, recurse ) {
for ( var i = 0, item;
( item = array[ i ] ); i++ ) {
if ( item.id == id )
return item;
if ( recurse && item[ recurse ] ) {
var retval = getById( item[ recurse ], id, recurse );
if ( retval )
return retval;
}
}
return null;
} | javascript | function( array, id, recurse ) {
for ( var i = 0, item;
( item = array[ i ] ); i++ ) {
if ( item.id == id )
return item;
if ( recurse && item[ recurse ] ) {
var retval = getById( item[ recurse ], id, recurse );
if ( retval )
return retval;
}
}
return null;
} | [
"function",
"(",
"array",
",",
"id",
",",
"recurse",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"item",
";",
"(",
"item",
"=",
"array",
"[",
"i",
"]",
")",
";",
"i",
"++",
")",
"{",
"if",
"(",
"item",
".",
"id",
"==",
"id",
")",
"re... | Tool function used to return an item from an array based on its id property. | [
"Tool",
"function",
"used",
"to",
"return",
"an",
"item",
"from",
"an",
"array",
"based",
"on",
"its",
"id",
"property",
"."
] | 2b90b8a6afc9f065f785651292fb193940021d90 | https://github.com/skerit/alchemy-styleboost/blob/2b90b8a6afc9f065f785651292fb193940021d90/public/ckeditor/4.4dev/plugins/dialog/plugin.js#L1581-L1593 | |
57,372 | skerit/alchemy-styleboost | public/ckeditor/4.4dev/plugins/dialog/plugin.js | function( array, newItem, nextSiblingId, recurse, nullIfNotFound ) {
if ( nextSiblingId ) {
for ( var i = 0, item;
( item = array[ i ] ); i++ ) {
if ( item.id == nextSiblingId ) {
array.splice( i, 0, newItem );
return newItem;
}
if ( recurse && item[ recurse ] ) {
... | javascript | function( array, newItem, nextSiblingId, recurse, nullIfNotFound ) {
if ( nextSiblingId ) {
for ( var i = 0, item;
( item = array[ i ] ); i++ ) {
if ( item.id == nextSiblingId ) {
array.splice( i, 0, newItem );
return newItem;
}
if ( recurse && item[ recurse ] ) {
... | [
"function",
"(",
"array",
",",
"newItem",
",",
"nextSiblingId",
",",
"recurse",
",",
"nullIfNotFound",
")",
"{",
"if",
"(",
"nextSiblingId",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"item",
";",
"(",
"item",
"=",
"array",
"[",
"i",
"]",
")"... | Tool function used to add an item into an array. | [
"Tool",
"function",
"used",
"to",
"add",
"an",
"item",
"into",
"an",
"array",
"."
] | 2b90b8a6afc9f065f785651292fb193940021d90 | https://github.com/skerit/alchemy-styleboost/blob/2b90b8a6afc9f065f785651292fb193940021d90/public/ckeditor/4.4dev/plugins/dialog/plugin.js#L1596-L1618 | |
57,373 | skerit/alchemy-styleboost | public/ckeditor/4.4dev/plugins/dialog/plugin.js | function( array, id, recurse ) {
for ( var i = 0, item;
( item = array[ i ] ); i++ ) {
if ( item.id == id )
return array.splice( i, 1 );
if ( recurse && item[ recurse ] ) {
var retval = removeById( item[ recurse ], id, recurse );
if ( retval )
return retval;
}
}
r... | javascript | function( array, id, recurse ) {
for ( var i = 0, item;
( item = array[ i ] ); i++ ) {
if ( item.id == id )
return array.splice( i, 1 );
if ( recurse && item[ recurse ] ) {
var retval = removeById( item[ recurse ], id, recurse );
if ( retval )
return retval;
}
}
r... | [
"function",
"(",
"array",
",",
"id",
",",
"recurse",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"item",
";",
"(",
"item",
"=",
"array",
"[",
"i",
"]",
")",
";",
"i",
"++",
")",
"{",
"if",
"(",
"item",
".",
"id",
"==",
"id",
")",
"re... | Tool function used to remove an item from an array based on its id. | [
"Tool",
"function",
"used",
"to",
"remove",
"an",
"item",
"from",
"an",
"array",
"based",
"on",
"its",
"id",
"."
] | 2b90b8a6afc9f065f785651292fb193940021d90 | https://github.com/skerit/alchemy-styleboost/blob/2b90b8a6afc9f065f785651292fb193940021d90/public/ckeditor/4.4dev/plugins/dialog/plugin.js#L1621-L1633 | |
57,374 | skerit/alchemy-styleboost | public/ckeditor/4.4dev/plugins/dialog/plugin.js | function( dialog, dialogDefinition ) {
// TODO : Check if needed.
this.dialog = dialog;
// Transform the contents entries in contentObjects.
var contents = dialogDefinition.contents;
for ( var i = 0, content;
( content = contents[ i ] ); i++ )
contents[ i ] = content && new contentObject(... | javascript | function( dialog, dialogDefinition ) {
// TODO : Check if needed.
this.dialog = dialog;
// Transform the contents entries in contentObjects.
var contents = dialogDefinition.contents;
for ( var i = 0, content;
( content = contents[ i ] ); i++ )
contents[ i ] = content && new contentObject(... | [
"function",
"(",
"dialog",
",",
"dialogDefinition",
")",
"{",
"// TODO : Check if needed.\r",
"this",
".",
"dialog",
"=",
"dialog",
";",
"// Transform the contents entries in contentObjects.\r",
"var",
"contents",
"=",
"dialogDefinition",
".",
"contents",
";",
"for",
"(... | This class is not really part of the API. It is the `definition` property value
passed to `dialogDefinition` event handlers.
CKEDITOR.on( 'dialogDefinition', function( evt ) {
var definition = evt.data.definition;
var content = definition.getContents( 'page1' );
// ...
} );
@private
@class CKEDITOR.dialog.definitionO... | [
"This",
"class",
"is",
"not",
"really",
"part",
"of",
"the",
"API",
".",
"It",
"is",
"the",
"definition",
"property",
"value",
"passed",
"to",
"dialogDefinition",
"event",
"handlers",
"."
] | 2b90b8a6afc9f065f785651292fb193940021d90 | https://github.com/skerit/alchemy-styleboost/blob/2b90b8a6afc9f065f785651292fb193940021d90/public/ckeditor/4.4dev/plugins/dialog/plugin.js#L1650-L1661 | |
57,375 | skerit/alchemy-styleboost | public/ckeditor/4.4dev/plugins/dialog/plugin.js | contentObject | function contentObject( dialog, contentDefinition ) {
this._ = {
dialog: dialog
};
CKEDITOR.tools.extend( this, contentDefinition );
} | javascript | function contentObject( dialog, contentDefinition ) {
this._ = {
dialog: dialog
};
CKEDITOR.tools.extend( this, contentDefinition );
} | [
"function",
"contentObject",
"(",
"dialog",
",",
"contentDefinition",
")",
"{",
"this",
".",
"_",
"=",
"{",
"dialog",
":",
"dialog",
"}",
";",
"CKEDITOR",
".",
"tools",
".",
"extend",
"(",
"this",
",",
"contentDefinition",
")",
";",
"}"
] | This class is not really part of the API. It is the template of the
objects representing content pages inside the
CKEDITOR.dialog.definitionObject.
CKEDITOR.on( 'dialogDefinition', function( evt ) {
var definition = evt.data.definition;
var content = definition.getContents( 'page1' );
content.remove( 'textInput1' );
/... | [
"This",
"class",
"is",
"not",
"really",
"part",
"of",
"the",
"API",
".",
"It",
"is",
"the",
"template",
"of",
"the",
"objects",
"representing",
"content",
"pages",
"inside",
"the",
"CKEDITOR",
".",
"dialog",
".",
"definitionObject",
"."
] | 2b90b8a6afc9f065f785651292fb193940021d90 | https://github.com/skerit/alchemy-styleboost/blob/2b90b8a6afc9f065f785651292fb193940021d90/public/ckeditor/4.4dev/plugins/dialog/plugin.js#L1751-L1757 |
57,376 | skerit/alchemy-styleboost | public/ckeditor/4.4dev/plugins/dialog/plugin.js | function( dialog, childObjList, childHtmlList, htmlList, elementDefinition ) {
if ( arguments.length < 4 )
return;
this._ || ( this._ = {} );
var children = this._.children = childObjList,
widths = elementDefinition && elementDefinition.widths || null,
height = elementDefinition && ... | javascript | function( dialog, childObjList, childHtmlList, htmlList, elementDefinition ) {
if ( arguments.length < 4 )
return;
this._ || ( this._ = {} );
var children = this._.children = childObjList,
widths = elementDefinition && elementDefinition.widths || null,
height = elementDefinition && ... | [
"function",
"(",
"dialog",
",",
"childObjList",
",",
"childHtmlList",
",",
"htmlList",
",",
"elementDefinition",
")",
"{",
"if",
"(",
"arguments",
".",
"length",
"<",
"4",
")",
"return",
";",
"this",
".",
"_",
"||",
"(",
"this",
".",
"_",
"=",
"{",
"... | Horizontal layout box for dialog UI elements, auto-expends to available width of container.
@class CKEDITOR.ui.dialog.hbox
@extends CKEDITOR.ui.dialog.uiElement
@constructor Creates a hbox class instance.
@param {CKEDITOR.dialog} dialog Parent dialog object.
@param {Array} childObjList
Array of {@link CKEDITOR.ui.dial... | [
"Horizontal",
"layout",
"box",
"for",
"dialog",
"UI",
"elements",
"auto",
"-",
"expends",
"to",
"available",
"width",
"of",
"container",
"."
] | 2b90b8a6afc9f065f785651292fb193940021d90 | https://github.com/skerit/alchemy-styleboost/blob/2b90b8a6afc9f065f785651292fb193940021d90/public/ckeditor/4.4dev/plugins/dialog/plugin.js#L2407-L2453 | |
57,377 | skerit/alchemy-styleboost | public/ckeditor/4.4dev/plugins/dialog/plugin.js | function( dialog, childObjList, childHtmlList, htmlList, elementDefinition ) {
if ( arguments.length < 3 )
return;
this._ || ( this._ = {} );
var children = this._.children = childObjList,
width = elementDefinition && elementDefinition.width || null,
heights = elementDefinition && e... | javascript | function( dialog, childObjList, childHtmlList, htmlList, elementDefinition ) {
if ( arguments.length < 3 )
return;
this._ || ( this._ = {} );
var children = this._.children = childObjList,
width = elementDefinition && elementDefinition.width || null,
heights = elementDefinition && e... | [
"function",
"(",
"dialog",
",",
"childObjList",
",",
"childHtmlList",
",",
"htmlList",
",",
"elementDefinition",
")",
"{",
"if",
"(",
"arguments",
".",
"length",
"<",
"3",
")",
"return",
";",
"this",
".",
"_",
"||",
"(",
"this",
".",
"_",
"=",
"{",
"... | Vertical layout box for dialog UI elements.
@class CKEDITOR.ui.dialog.vbox
@extends CKEDITOR.ui.dialog.hbox
@constructor Creates a vbox class instance.
@param {CKEDITOR.dialog} dialog Parent dialog object.
@param {Array} childObjList
Array of {@link CKEDITOR.ui.dialog.uiElement} objects inside this container.
@param {... | [
"Vertical",
"layout",
"box",
"for",
"dialog",
"UI",
"elements",
"."
] | 2b90b8a6afc9f065f785651292fb193940021d90 | https://github.com/skerit/alchemy-styleboost/blob/2b90b8a6afc9f065f785651292fb193940021d90/public/ckeditor/4.4dev/plugins/dialog/plugin.js#L2478-L2526 | |
57,378 | skerit/alchemy-styleboost | public/ckeditor/4.4dev/plugins/dialog/plugin.js | function( indices ) {
// If no arguments, return a clone of the children array.
if ( arguments.length < 1 )
return this._.children.concat();
// If indices isn't array, make it one.
if ( !indices.splice )
indices = [ indices ];
// Retrieve the child element according to tree position.
... | javascript | function( indices ) {
// If no arguments, return a clone of the children array.
if ( arguments.length < 1 )
return this._.children.concat();
// If indices isn't array, make it one.
if ( !indices.splice )
indices = [ indices ];
// Retrieve the child element according to tree position.
... | [
"function",
"(",
"indices",
")",
"{",
"// If no arguments, return a clone of the children array.\r",
"if",
"(",
"arguments",
".",
"length",
"<",
"1",
")",
"return",
"this",
".",
"_",
".",
"children",
".",
"concat",
"(",
")",
";",
"// If indices isn't array, make it ... | Gets a child UI element inside this container.
var checkbox = hbox.getChild( [0,1] );
checkbox.setValue( true );
@param {Array/Number} indices An array or a single number to indicate the child's
position in the container's descendant tree. Omit to get all the children in an array.
@returns {Array/CKEDITOR.ui.dialog.u... | [
"Gets",
"a",
"child",
"UI",
"element",
"inside",
"this",
"container",
"."
] | 2b90b8a6afc9f065f785651292fb193940021d90 | https://github.com/skerit/alchemy-styleboost/blob/2b90b8a6afc9f065f785651292fb193940021d90/public/ckeditor/4.4dev/plugins/dialog/plugin.js#L2817-L2831 | |
57,379 | skerit/alchemy-styleboost | public/ckeditor/4.4dev/plugins/dialog/plugin.js | function( dialogName, callback ) {
var dialog = null, dialogDefinitions = CKEDITOR.dialog._.dialogDefinitions[ dialogName ];
if ( CKEDITOR.dialog._.currentTop === null )
showCover( this );
// If the dialogDefinition is already loaded, open it immediately.
if ( typeof dialogDefinitions == 'funct... | javascript | function( dialogName, callback ) {
var dialog = null, dialogDefinitions = CKEDITOR.dialog._.dialogDefinitions[ dialogName ];
if ( CKEDITOR.dialog._.currentTop === null )
showCover( this );
// If the dialogDefinition is already loaded, open it immediately.
if ( typeof dialogDefinitions == 'funct... | [
"function",
"(",
"dialogName",
",",
"callback",
")",
"{",
"var",
"dialog",
"=",
"null",
",",
"dialogDefinitions",
"=",
"CKEDITOR",
".",
"dialog",
".",
"_",
".",
"dialogDefinitions",
"[",
"dialogName",
"]",
";",
"if",
"(",
"CKEDITOR",
".",
"dialog",
".",
... | Loads and opens a registered dialog.
CKEDITOR.instances.editor1.openDialog( 'smiley' );
@member CKEDITOR.editor
@param {String} dialogName The registered name of the dialog.
@param {Function} callback The function to be invoked after dialog instance created.
@returns {CKEDITOR.dialog} The dialog object corresponding ... | [
"Loads",
"and",
"opens",
"a",
"registered",
"dialog",
"."
] | 2b90b8a6afc9f065f785651292fb193940021d90 | https://github.com/skerit/alchemy-styleboost/blob/2b90b8a6afc9f065f785651292fb193940021d90/public/ckeditor/4.4dev/plugins/dialog/plugin.js#L3027-L3061 | |
57,380 | open-nata/nata-device | src/utils.js | getWidgetsFromXml | async function getWidgetsFromXml(target) {
const $ = await parseFile(target)
const widgets = []
let widget
$('node').each((i, elem) => {
const node = $(elem)
widget = new Widget()
widget.text = node.attr('text')
widget.resourceId = node.attr('resource-id')
widget.className = node.attr('clas... | javascript | async function getWidgetsFromXml(target) {
const $ = await parseFile(target)
const widgets = []
let widget
$('node').each((i, elem) => {
const node = $(elem)
widget = new Widget()
widget.text = node.attr('text')
widget.resourceId = node.attr('resource-id')
widget.className = node.attr('clas... | [
"async",
"function",
"getWidgetsFromXml",
"(",
"target",
")",
"{",
"const",
"$",
"=",
"await",
"parseFile",
"(",
"target",
")",
"const",
"widgets",
"=",
"[",
"]",
"let",
"widget",
"$",
"(",
"'node'",
")",
".",
"each",
"(",
"(",
"i",
",",
"elem",
")",... | get widgets from dumpfile.xml
@param {String} target the local path of dumpfile.xml
@return {[Widget]} Array of avaliable widgets | [
"get",
"widgets",
"from",
"dumpfile",
".",
"xml"
] | c2c1292fb0f634eab72e6770ee5b835b67186405 | https://github.com/open-nata/nata-device/blob/c2c1292fb0f634eab72e6770ee5b835b67186405/src/utils.js#L26-L54 |
57,381 | jeremenichelli/threshold | src/threshold.js | threshold | function threshold(element) {
var rects = element.getBoundingClientRect();
var upperThreshold = (threshold._viewport.height - rects.top) / rects.height;
var bottomThreshold = rects.bottom / rects.height;
var leftThreshold = (threshold._viewport.width - rects.left) / rects.width;
var rightThreshold = rects.r... | javascript | function threshold(element) {
var rects = element.getBoundingClientRect();
var upperThreshold = (threshold._viewport.height - rects.top) / rects.height;
var bottomThreshold = rects.bottom / rects.height;
var leftThreshold = (threshold._viewport.width - rects.left) / rects.width;
var rightThreshold = rects.r... | [
"function",
"threshold",
"(",
"element",
")",
"{",
"var",
"rects",
"=",
"element",
".",
"getBoundingClientRect",
"(",
")",
";",
"var",
"upperThreshold",
"=",
"(",
"threshold",
".",
"_viewport",
".",
"height",
"-",
"rects",
".",
"top",
")",
"/",
"rects",
... | Returns metrics regarding an element's position in the viewport
@method threshold
@param {Node} element
@returns {Object} | [
"Returns",
"metrics",
"regarding",
"an",
"element",
"s",
"position",
"in",
"the",
"viewport"
] | 17793f53eacaf34a398075266eeb5e1a2c020881 | https://github.com/jeremenichelli/threshold/blob/17793f53eacaf34a398075266eeb5e1a2c020881/src/threshold.js#L7-L55 |
57,382 | jeremenichelli/threshold | src/threshold.js | updateViewport | function updateViewport() {
threshold._viewport.height = window.innerHeight;
threshold._viewport.width = window.innerWidth;
} | javascript | function updateViewport() {
threshold._viewport.height = window.innerHeight;
threshold._viewport.width = window.innerWidth;
} | [
"function",
"updateViewport",
"(",
")",
"{",
"threshold",
".",
"_viewport",
".",
"height",
"=",
"window",
".",
"innerHeight",
";",
"threshold",
".",
"_viewport",
".",
"width",
"=",
"window",
".",
"innerWidth",
";",
"}"
] | Updates memoized viewport metrics
@method updateViewport | [
"Updates",
"memoized",
"viewport",
"metrics"
] | 17793f53eacaf34a398075266eeb5e1a2c020881 | https://github.com/jeremenichelli/threshold/blob/17793f53eacaf34a398075266eeb5e1a2c020881/src/threshold.js#L67-L70 |
57,383 | bbusschots-mu/mu-qunit-util | dist/index.es.js | all | function all(func) {
return function() {
var params = getParams(arguments);
var length = params.length;
for (var i = 0; i < length; i++) {
if (!func.call(null, params[i])) {
return false;
}
}
return t... | javascript | function all(func) {
return function() {
var params = getParams(arguments);
var length = params.length;
for (var i = 0; i < length; i++) {
if (!func.call(null, params[i])) {
return false;
}
}
return t... | [
"function",
"all",
"(",
"func",
")",
"{",
"return",
"function",
"(",
")",
"{",
"var",
"params",
"=",
"getParams",
"(",
"arguments",
")",
";",
"var",
"length",
"=",
"params",
".",
"length",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"le... | helper function which call predicate function per parameter and return true if all pass | [
"helper",
"function",
"which",
"call",
"predicate",
"function",
"per",
"parameter",
"and",
"return",
"true",
"if",
"all",
"pass"
] | 1ed4414e8b307cf6452918496ff48cf373ccb654 | https://github.com/bbusschots-mu/mu-qunit-util/blob/1ed4414e8b307cf6452918496ff48cf373ccb654/dist/index.es.js#L42-L53 |
57,384 | bbusschots-mu/mu-qunit-util | dist/index.es.js | compareVersion | function compareVersion(version, range) {
var string = (range + '');
var n = +(string.match(/\d+/) || NaN);
var op = string.match(/^[<>]=?|/)[0];
return comparator[op] ? comparator[op](version, n) : (version == n || n !== n);
} | javascript | function compareVersion(version, range) {
var string = (range + '');
var n = +(string.match(/\d+/) || NaN);
var op = string.match(/^[<>]=?|/)[0];
return comparator[op] ? comparator[op](version, n) : (version == n || n !== n);
} | [
"function",
"compareVersion",
"(",
"version",
",",
"range",
")",
"{",
"var",
"string",
"=",
"(",
"range",
"+",
"''",
")",
";",
"var",
"n",
"=",
"+",
"(",
"string",
".",
"match",
"(",
"/",
"\\d+",
"/",
")",
"||",
"NaN",
")",
";",
"var",
"op",
"=... | helper function which compares a version to a range | [
"helper",
"function",
"which",
"compares",
"a",
"version",
"to",
"a",
"range"
] | 1ed4414e8b307cf6452918496ff48cf373ccb654 | https://github.com/bbusschots-mu/mu-qunit-util/blob/1ed4414e8b307cf6452918496ff48cf373ccb654/dist/index.es.js#L78-L83 |
57,385 | bbusschots-mu/mu-qunit-util | dist/index.es.js | getParams | function getParams(args) {
var params = slice.call(args);
var length = params.length;
if (length === 1 && is.array(params[0])) { // support array
params = params[0];
}
return params;
} | javascript | function getParams(args) {
var params = slice.call(args);
var length = params.length;
if (length === 1 && is.array(params[0])) { // support array
params = params[0];
}
return params;
} | [
"function",
"getParams",
"(",
"args",
")",
"{",
"var",
"params",
"=",
"slice",
".",
"call",
"(",
"args",
")",
";",
"var",
"length",
"=",
"params",
".",
"length",
";",
"if",
"(",
"length",
"===",
"1",
"&&",
"is",
".",
"array",
"(",
"params",
"[",
... | helper function which extracts params from arguments | [
"helper",
"function",
"which",
"extracts",
"params",
"from",
"arguments"
] | 1ed4414e8b307cf6452918496ff48cf373ccb654 | https://github.com/bbusschots-mu/mu-qunit-util/blob/1ed4414e8b307cf6452918496ff48cf373ccb654/dist/index.es.js#L86-L93 |
57,386 | dominictarr/header-stream | index.js | merge | function merge (a, b) {
for (var k in b)
a[k] = a[k] || b[k]
} | javascript | function merge (a, b) {
for (var k in b)
a[k] = a[k] || b[k]
} | [
"function",
"merge",
"(",
"a",
",",
"b",
")",
"{",
"for",
"(",
"var",
"k",
"in",
"b",
")",
"a",
"[",
"k",
"]",
"=",
"a",
"[",
"k",
"]",
"||",
"b",
"[",
"k",
"]",
"}"
] | the first line is header, in JSON format, with no whitespace. | [
"the",
"first",
"line",
"is",
"header",
"in",
"JSON",
"format",
"with",
"no",
"whitespace",
"."
] | 1d784d589edd11c94601ca8db93d8befd4878326 | https://github.com/dominictarr/header-stream/blob/1d784d589edd11c94601ca8db93d8befd4878326/index.js#L4-L7 |
57,387 | IonicaBizau/cross-style.js | lib/index.js | CrossStyle | function CrossStyle(input) {
var uInput = UFirst(input);
return [
"webkit" + uInput
, "moz" + uInput
, "ms" + uInput
, "o" + uInput
, input
]
} | javascript | function CrossStyle(input) {
var uInput = UFirst(input);
return [
"webkit" + uInput
, "moz" + uInput
, "ms" + uInput
, "o" + uInput
, input
]
} | [
"function",
"CrossStyle",
"(",
"input",
")",
"{",
"var",
"uInput",
"=",
"UFirst",
"(",
"input",
")",
";",
"return",
"[",
"\"webkit\"",
"+",
"uInput",
",",
"\"moz\"",
"+",
"uInput",
",",
"\"ms\"",
"+",
"uInput",
",",
"\"o\"",
"+",
"uInput",
",",
"input"... | CrossStyle
Returns an array of cross-browser CSS properties for given input.
@name CrossStyle
@function
@param {String} input The CSS property (e.g. `"transform"` or `"transformOrigin"`).
@return {Array} An array of strings representing the cross-browser CSS properties for the given input. | [
"CrossStyle",
"Returns",
"an",
"array",
"of",
"cross",
"-",
"browser",
"CSS",
"properties",
"for",
"given",
"input",
"."
] | f3bc8b153710168a6fd5346c35d0851bd1b02f25 | https://github.com/IonicaBizau/cross-style.js/blob/f3bc8b153710168a6fd5346c35d0851bd1b02f25/lib/index.js#L13-L22 |
57,388 | brettz9/imf | dist/index-cjs.js | IMFClass | function IMFClass(opts) {
if (!(this instanceof IMFClass)) {
return new IMFClass(opts);
}
opts = opts || {};
this.defaultNamespace = opts.defaultNamespace || '';
this.defaultSeparator = opts.defaultSeparator === undefined ? '.' : opts.defaultSeparator;
this.basePath = opts.basePath || 'locales/';
thi... | javascript | function IMFClass(opts) {
if (!(this instanceof IMFClass)) {
return new IMFClass(opts);
}
opts = opts || {};
this.defaultNamespace = opts.defaultNamespace || '';
this.defaultSeparator = opts.defaultSeparator === undefined ? '.' : opts.defaultSeparator;
this.basePath = opts.basePath || 'locales/';
thi... | [
"function",
"IMFClass",
"(",
"opts",
")",
"{",
"if",
"(",
"!",
"(",
"this",
"instanceof",
"IMFClass",
")",
")",
"{",
"return",
"new",
"IMFClass",
"(",
"opts",
")",
";",
"}",
"opts",
"=",
"opts",
"||",
"{",
"}",
";",
"this",
".",
"defaultNamespace",
... | If strawman approved, this would only be | [
"If",
"strawman",
"approved",
"this",
"would",
"only",
"be"
] | 7c701afb770517887d937f334c240964086bf86d | https://github.com/brettz9/imf/blob/7c701afb770517887d937f334c240964086bf86d/dist/index-cjs.js#L10-L58 |
57,389 | Nichejs/Seminarjs | private/lib/core/users.js | users | function users() {
var seminarjs = this;
var exports = {};
exports.list = [];
/**
* Add a user
* @param {string} name User name
* @param {Object} attributes List of attributes to be added to the user
*/
exports.add = function (name, attributes) {
if (exports.find(name)) {
return false;
} e... | javascript | function users() {
var seminarjs = this;
var exports = {};
exports.list = [];
/**
* Add a user
* @param {string} name User name
* @param {Object} attributes List of attributes to be added to the user
*/
exports.add = function (name, attributes) {
if (exports.find(name)) {
return false;
} e... | [
"function",
"users",
"(",
")",
"{",
"var",
"seminarjs",
"=",
"this",
";",
"var",
"exports",
"=",
"{",
"}",
";",
"exports",
".",
"list",
"=",
"[",
"]",
";",
"/**\n\t * Add a user\n\t * @param {string} name User name\n\t * @param {Object} attributes List of attribut... | User handling for Seminarjs, this should hold the logged in users
at any moment, and should be shared by the contest, the chat... etc | [
"User",
"handling",
"for",
"Seminarjs",
"this",
"should",
"hold",
"the",
"logged",
"in",
"users",
"at",
"any",
"moment",
"and",
"should",
"be",
"shared",
"by",
"the",
"contest",
"the",
"chat",
"...",
"etc"
] | 53c4c1d5c33ffbf6320b10f25679bf181cbf853e | https://github.com/Nichejs/Seminarjs/blob/53c4c1d5c33ffbf6320b10f25679bf181cbf853e/private/lib/core/users.js#L8-L94 |
57,390 | getstacker/stacker-args | lib/help/formatter.js | function (parts, indent, prefix) {
var lines = [];
var line = [];
var lineLength = !!prefix ? prefix.length - 1: indent.length - 1;
parts.forEach(function (part) {
if (lineLength + 1 + part.length > textWidth) {
lines.push(indent + line.join(' '));
lin... | javascript | function (parts, indent, prefix) {
var lines = [];
var line = [];
var lineLength = !!prefix ? prefix.length - 1: indent.length - 1;
parts.forEach(function (part) {
if (lineLength + 1 + part.length > textWidth) {
lines.push(indent + line.join(' '));
lin... | [
"function",
"(",
"parts",
",",
"indent",
",",
"prefix",
")",
"{",
"var",
"lines",
"=",
"[",
"]",
";",
"var",
"line",
"=",
"[",
"]",
";",
"var",
"lineLength",
"=",
"!",
"!",
"prefix",
"?",
"prefix",
".",
"length",
"-",
"1",
":",
"indent",
".",
"... | helper for wrapping lines | [
"helper",
"for",
"wrapping",
"lines"
] | 38282619b67274c0524507abc992ab03a37f8dcb | https://github.com/getstacker/stacker-args/blob/38282619b67274c0524507abc992ab03a37f8dcb/lib/help/formatter.js#L372-L395 | |
57,391 | phun-ky/patsy | lib/proxy/index.js | function(cfg){
var self = this;
var route_opts;
patsy.scripture.print('[Patsy]'.yellow + ': Here\'s the proxy my King!\n');
var _getHeaders = function(path, local_headers){
var global_headers = {};
if(typeof cfg.proxy.options.headers !== 'undefined' && typeof cfg.proxy.opti... | javascript | function(cfg){
var self = this;
var route_opts;
patsy.scripture.print('[Patsy]'.yellow + ': Here\'s the proxy my King!\n');
var _getHeaders = function(path, local_headers){
var global_headers = {};
if(typeof cfg.proxy.options.headers !== 'undefined' && typeof cfg.proxy.opti... | [
"function",
"(",
"cfg",
")",
"{",
"var",
"self",
"=",
"this",
";",
"var",
"route_opts",
";",
"patsy",
".",
"scripture",
".",
"print",
"(",
"'[Patsy]'",
".",
"yellow",
"+",
"': Here\\'s the proxy my King!\\n'",
")",
";",
"var",
"_getHeaders",
"=",
"function",... | The purpose of this method is to start the proxy server and route API urls from the patsy config.proxy.resources object | [
"The",
"purpose",
"of",
"this",
"method",
"is",
"to",
"start",
"the",
"proxy",
"server",
"and",
"route",
"API",
"urls",
"from",
"the",
"patsy",
"config",
".",
"proxy",
".",
"resources",
"object"
] | b2bf3e6c72e17c38d9b2cf2fa4306478fc3858a5 | https://github.com/phun-ky/patsy/blob/b2bf3e6c72e17c38d9b2cf2fa4306478fc3858a5/lib/proxy/index.js#L111-L379 | |
57,392 | melvincarvalho/rdf-shell | lib/put.js | put | function put(argv, callback) {
if (!argv[2]) {
console.error("url is required");
console.error("Usage : put <url> <data>");
process.exit(-1);
}
if (!argv[3]) {
console.error("data is required");
console.error("Usage : put <url> <data>");
process.exit(-1);
}
util.put(argv[2], argv[3], f... | javascript | function put(argv, callback) {
if (!argv[2]) {
console.error("url is required");
console.error("Usage : put <url> <data>");
process.exit(-1);
}
if (!argv[3]) {
console.error("data is required");
console.error("Usage : put <url> <data>");
process.exit(-1);
}
util.put(argv[2], argv[3], f... | [
"function",
"put",
"(",
"argv",
",",
"callback",
")",
"{",
"if",
"(",
"!",
"argv",
"[",
"2",
"]",
")",
"{",
"console",
".",
"error",
"(",
"\"url is required\"",
")",
";",
"console",
".",
"error",
"(",
"\"Usage : put <url> <data>\"",
")",
";",
"process",
... | put gets list of files for a given container
@param {String} argv[2] url
@param {String} argv[3] data
@callback {bin~cb} callback | [
"put",
"gets",
"list",
"of",
"files",
"for",
"a",
"given",
"container"
] | bf2015f6f333855e69a18ce3ec9e917bbddfb425 | https://github.com/melvincarvalho/rdf-shell/blob/bf2015f6f333855e69a18ce3ec9e917bbddfb425/lib/put.js#L12-L28 |
57,393 | MomsFriendlyDevCo/mfdc-email | index.js | init | function init() {
// Locate config if we dont have one {{{
if (_.isUndefined(appConfig)) {
appConfigLocations.forEach(function(key) {
if (_.has(global, key)) {
appConfig = _.get(global, key);
return false;
}
});
if (_.isUndefined(appConfig)) throw new Error('Cannot find email config in', appConfig... | javascript | function init() {
// Locate config if we dont have one {{{
if (_.isUndefined(appConfig)) {
appConfigLocations.forEach(function(key) {
if (_.has(global, key)) {
appConfig = _.get(global, key);
return false;
}
});
if (_.isUndefined(appConfig)) throw new Error('Cannot find email config in', appConfig... | [
"function",
"init",
"(",
")",
"{",
"// Locate config if we dont have one {{{",
"if",
"(",
"_",
".",
"isUndefined",
"(",
"appConfig",
")",
")",
"{",
"appConfigLocations",
".",
"forEach",
"(",
"function",
"(",
"key",
")",
"{",
"if",
"(",
"_",
".",
"has",
"("... | Array of places to look for config Is expected to contain at least a 'email' object and possibly 'mailgun'
Initalize the emailer
If this is called multiple times it restarts the mail transport
@return {Object} This chainable object | [
"Array",
"of",
"places",
"to",
"look",
"for",
"config",
"Is",
"expected",
"to",
"contain",
"at",
"least",
"a",
"email",
"object",
"and",
"possibly",
"mailgun",
"Initalize",
"the",
"emailer",
"If",
"this",
"is",
"called",
"multiple",
"times",
"it",
"restarts"... | 95cfc411d4f42cd5ddd446979b7c443ded87b93f | https://github.com/MomsFriendlyDevCo/mfdc-email/blob/95cfc411d4f42cd5ddd446979b7c443ded87b93f/index.js#L26-L73 |
57,394 | widgetworks/nopt-grunt-fix | index.js | parseOptions | function parseOptions(nopt, optlist){
var params = getParams(optlist);
var parsedOptions = nopt(params.known, params.aliases, process.argv, 2);
initArrays(optlist, parsedOptions);
return parsedOptions;
} | javascript | function parseOptions(nopt, optlist){
var params = getParams(optlist);
var parsedOptions = nopt(params.known, params.aliases, process.argv, 2);
initArrays(optlist, parsedOptions);
return parsedOptions;
} | [
"function",
"parseOptions",
"(",
"nopt",
",",
"optlist",
")",
"{",
"var",
"params",
"=",
"getParams",
"(",
"optlist",
")",
";",
"var",
"parsedOptions",
"=",
"nopt",
"(",
"params",
".",
"known",
",",
"params",
".",
"aliases",
",",
"process",
".",
"argv",
... | Normalise the parameters and then parse them. | [
"Normalise",
"the",
"parameters",
"and",
"then",
"parse",
"them",
"."
] | 44017cb96567763124d42ab5819e71bd98d98465 | https://github.com/widgetworks/nopt-grunt-fix/blob/44017cb96567763124d42ab5819e71bd98d98465/index.js#L23-L29 |
57,395 | widgetworks/nopt-grunt-fix | index.js | resetOptions | function resetOptions(grunt, parsedOptions){
for (var i in parsedOptions){
if (parsedOptions.hasOwnProperty(i) && i != 'argv'){
grunt.option(i, parsedOptions[i]);
}
}
} | javascript | function resetOptions(grunt, parsedOptions){
for (var i in parsedOptions){
if (parsedOptions.hasOwnProperty(i) && i != 'argv'){
grunt.option(i, parsedOptions[i]);
}
}
} | [
"function",
"resetOptions",
"(",
"grunt",
",",
"parsedOptions",
")",
"{",
"for",
"(",
"var",
"i",
"in",
"parsedOptions",
")",
"{",
"if",
"(",
"parsedOptions",
".",
"hasOwnProperty",
"(",
"i",
")",
"&&",
"i",
"!=",
"'argv'",
")",
"{",
"grunt",
".",
"opt... | Reassign the options on the Grunt instance. | [
"Reassign",
"the",
"options",
"on",
"the",
"Grunt",
"instance",
"."
] | 44017cb96567763124d42ab5819e71bd98d98465 | https://github.com/widgetworks/nopt-grunt-fix/blob/44017cb96567763124d42ab5819e71bd98d98465/index.js#L33-L39 |
57,396 | widgetworks/nopt-grunt-fix | index.js | getParams | function getParams(optlist){
var aliases = {};
var known = {};
Object.keys(optlist).forEach(function(key) {
var short = optlist[key].short;
if (short) {
aliases[short] = '--' + key;
}
known[key] = optlist[key].type;
});
return {
known: known,
aliases: aliases
}
} | javascript | function getParams(optlist){
var aliases = {};
var known = {};
Object.keys(optlist).forEach(function(key) {
var short = optlist[key].short;
if (short) {
aliases[short] = '--' + key;
}
known[key] = optlist[key].type;
});
return {
known: known,
aliases: aliases
}
} | [
"function",
"getParams",
"(",
"optlist",
")",
"{",
"var",
"aliases",
"=",
"{",
"}",
";",
"var",
"known",
"=",
"{",
"}",
";",
"Object",
".",
"keys",
"(",
"optlist",
")",
".",
"forEach",
"(",
"function",
"(",
"key",
")",
"{",
"var",
"short",
"=",
"... | Parse `optlist` into a form that nopt can handle. | [
"Parse",
"optlist",
"into",
"a",
"form",
"that",
"nopt",
"can",
"handle",
"."
] | 44017cb96567763124d42ab5819e71bd98d98465 | https://github.com/widgetworks/nopt-grunt-fix/blob/44017cb96567763124d42ab5819e71bd98d98465/index.js#L43-L59 |
57,397 | widgetworks/nopt-grunt-fix | index.js | initArrays | function initArrays(optlist, parsedOptions){
Object.keys(optlist).forEach(function(key) {
if (optlist[key].type === Array && !(key in parsedOptions)) {
parsedOptions[key] = [];
}
});
} | javascript | function initArrays(optlist, parsedOptions){
Object.keys(optlist).forEach(function(key) {
if (optlist[key].type === Array && !(key in parsedOptions)) {
parsedOptions[key] = [];
}
});
} | [
"function",
"initArrays",
"(",
"optlist",
",",
"parsedOptions",
")",
"{",
"Object",
".",
"keys",
"(",
"optlist",
")",
".",
"forEach",
"(",
"function",
"(",
"key",
")",
"{",
"if",
"(",
"optlist",
"[",
"key",
"]",
".",
"type",
"===",
"Array",
"&&",
"!"... | Initialize any Array options that weren't initialized. | [
"Initialize",
"any",
"Array",
"options",
"that",
"weren",
"t",
"initialized",
"."
] | 44017cb96567763124d42ab5819e71bd98d98465 | https://github.com/widgetworks/nopt-grunt-fix/blob/44017cb96567763124d42ab5819e71bd98d98465/index.js#L63-L69 |
57,398 | sagiegurari/funcs-js | funcs.js | function (fn) {
/**
* Chain function.
*
* @function
* @memberof! funcs
* @alias funcs.maxTimesChain
* @private
* @param {Number} times - The max times the provided function will be invoked
* @returns {function} The new wrapper function
... | javascript | function (fn) {
/**
* Chain function.
*
* @function
* @memberof! funcs
* @alias funcs.maxTimesChain
* @private
* @param {Number} times - The max times the provided function will be invoked
* @returns {function} The new wrapper function
... | [
"function",
"(",
"fn",
")",
"{",
"/**\n * Chain function.\n *\n * @function\n * @memberof! funcs\n * @alias funcs.maxTimesChain\n * @private\n * @param {Number} times - The max times the provided function will be invoked\n * @returns {functio... | Adds chaining support for the provided function.
@function
@memberof! funcs
@alias funcs.addChaining
@private
@param {function} fn - Adds the funcs APIs to the provided function with this function as a context | [
"Adds",
"chaining",
"support",
"for",
"the",
"provided",
"function",
"."
] | 8ddd8b04b703d8c424818ba9d2adc0281427864c | https://github.com/sagiegurari/funcs-js/blob/8ddd8b04b703d8c424818ba9d2adc0281427864c/funcs.js#L68-L122 | |
57,399 | skerit/alchemy-styleboost | public/ckeditor/4.4dev/plugins/find/dialogs/find.js | nonCharactersBoundary | function nonCharactersBoundary( node ) {
return !( node.type == CKEDITOR.NODE_ELEMENT && node.isBlockBoundary( CKEDITOR.tools.extend( {}, CKEDITOR.dtd.$empty, CKEDITOR.dtd.$nonEditable ) ) );
} | javascript | function nonCharactersBoundary( node ) {
return !( node.type == CKEDITOR.NODE_ELEMENT && node.isBlockBoundary( CKEDITOR.tools.extend( {}, CKEDITOR.dtd.$empty, CKEDITOR.dtd.$nonEditable ) ) );
} | [
"function",
"nonCharactersBoundary",
"(",
"node",
")",
"{",
"return",
"!",
"(",
"node",
".",
"type",
"==",
"CKEDITOR",
".",
"NODE_ELEMENT",
"&&",
"node",
".",
"isBlockBoundary",
"(",
"CKEDITOR",
".",
"tools",
".",
"extend",
"(",
"{",
"}",
",",
"CKEDITOR",
... | Elements which break characters been considered as sequence. | [
"Elements",
"which",
"break",
"characters",
"been",
"considered",
"as",
"sequence",
"."
] | 2b90b8a6afc9f065f785651292fb193940021d90 | https://github.com/skerit/alchemy-styleboost/blob/2b90b8a6afc9f065f785651292fb193940021d90/public/ckeditor/4.4dev/plugins/find/dialogs/find.js#L14-L16 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.