repo
stringlengths
5
67
path
stringlengths
4
116
func_name
stringlengths
0
58
original_string
stringlengths
52
373k
language
stringclasses
1 value
code
stringlengths
52
373k
code_tokens
list
docstring
stringlengths
4
11.8k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
86
226
partition
stringclasses
1 value
floridoo/scarab
lib/routing.js
addStaticRoute
function addStaticRoute(routePath, targets) { if (!Object.isArray(targets)) { targets = [targets]; } targets.forEach(function(target) { if (target) app.use(routePath, app.middleware.static(path.resolve(config.rootDir, target))); }); }
javascript
function addStaticRoute(routePath, targets) { if (!Object.isArray(targets)) { targets = [targets]; } targets.forEach(function(target) { if (target) app.use(routePath, app.middleware.static(path.resolve(config.rootDir, target))); }); }
[ "function", "addStaticRoute", "(", "routePath", ",", "targets", ")", "{", "if", "(", "!", "Object", ".", "isArray", "(", "targets", ")", ")", "{", "targets", "=", "[", "targets", "]", ";", "}", "targets", ".", "forEach", "(", "function", "(", "target",...
add a static route @param {String} routePath route path @param {String} target target path (relative to the scarab root)
[ "add", "a", "static", "route" ]
377ebd79563b8fa654bb18324aed00d72500e7f6
https://github.com/floridoo/scarab/blob/377ebd79563b8fa654bb18324aed00d72500e7f6/lib/routing.js#L122-L130
train
floridoo/scarab
lib/routing.js
parseRoute
function parseRoute(route, target) { var verbs, routePath, routeParts; routeParts = route.split(' '); if (routeParts.length === 1) { verbs = ['all']; routePath = routeParts[0]; } else { verbs = routeParts[0].split(','); verbs.map(function (verb) { return verb.trim().toLowerCase(); }); rou...
javascript
function parseRoute(route, target) { var verbs, routePath, routeParts; routeParts = route.split(' '); if (routeParts.length === 1) { verbs = ['all']; routePath = routeParts[0]; } else { verbs = routeParts[0].split(','); verbs.map(function (verb) { return verb.trim().toLowerCase(); }); rou...
[ "function", "parseRoute", "(", "route", ",", "target", ")", "{", "var", "verbs", ",", "routePath", ",", "routeParts", ";", "routeParts", "=", "route", ".", "split", "(", "' '", ")", ";", "if", "(", "routeParts", ".", "length", "===", "1", ")", "{", "...
parse a route @param {String} route a route definition @param {Object} target target definition @return {Object} route parsed into verbs, path and target
[ "parse", "a", "route" ]
377ebd79563b8fa654bb18324aed00d72500e7f6
https://github.com/floridoo/scarab/blob/377ebd79563b8fa654bb18324aed00d72500e7f6/lib/routing.js#L169-L184
train
vega/vega-runtime
src/parameters.js
parseParameter
function parseParameter(spec, ctx, params) { if (!spec || !isObject(spec)) return spec; for (var i=0, n=PARSERS.length, p; i<n; ++i) { p = PARSERS[i]; if (spec.hasOwnProperty(p.key)) { return p.parse(spec, ctx, params); } } return spec; }
javascript
function parseParameter(spec, ctx, params) { if (!spec || !isObject(spec)) return spec; for (var i=0, n=PARSERS.length, p; i<n; ++i) { p = PARSERS[i]; if (spec.hasOwnProperty(p.key)) { return p.parse(spec, ctx, params); } } return spec; }
[ "function", "parseParameter", "(", "spec", ",", "ctx", ",", "params", ")", "{", "if", "(", "!", "spec", "||", "!", "isObject", "(", "spec", ")", ")", "return", "spec", ";", "for", "(", "var", "i", "=", "0", ",", "n", "=", "PARSERS", ".", "length"...
Parse a single parameter.
[ "Parse", "a", "single", "parameter", "." ]
05491b95035b70d5bafb05c5eebef9fa0c06c509
https://github.com/vega/vega-runtime/blob/05491b95035b70d5bafb05c5eebef9fa0c06c509/src/parameters.js#L26-L36
train
vega/vega-runtime
src/parameters.js
getExpression
function getExpression(_, ctx, params) { if (_.$params) { // parse expression parameters parseParameters(_.$params, ctx, params); } var k = 'e:' + _.$expr + '_' + _.$name; return ctx.fn[k] || (ctx.fn[k] = accessor(parameterExpression(_.$expr, ctx), _.$fields, _.$name)); }
javascript
function getExpression(_, ctx, params) { if (_.$params) { // parse expression parameters parseParameters(_.$params, ctx, params); } var k = 'e:' + _.$expr + '_' + _.$name; return ctx.fn[k] || (ctx.fn[k] = accessor(parameterExpression(_.$expr, ctx), _.$fields, _.$name)); }
[ "function", "getExpression", "(", "_", ",", "ctx", ",", "params", ")", "{", "if", "(", "_", ".", "$params", ")", "{", "// parse expression parameters", "parseParameters", "(", "_", ".", "$params", ",", "ctx", ",", "params", ")", ";", "}", "var", "k", "...
Resolve an expression reference.
[ "Resolve", "an", "expression", "reference", "." ]
05491b95035b70d5bafb05c5eebef9fa0c06c509
https://github.com/vega/vega-runtime/blob/05491b95035b70d5bafb05c5eebef9fa0c06c509/src/parameters.js#L61-L68
train
vega/vega-runtime
src/parameters.js
getKey
function getKey(_, ctx) { var k = 'k:' + _.$key + '_' + (!!_.$flat); return ctx.fn[k] || (ctx.fn[k] = key(_.$key, _.$flat)); }
javascript
function getKey(_, ctx) { var k = 'k:' + _.$key + '_' + (!!_.$flat); return ctx.fn[k] || (ctx.fn[k] = key(_.$key, _.$flat)); }
[ "function", "getKey", "(", "_", ",", "ctx", ")", "{", "var", "k", "=", "'k:'", "+", "_", ".", "$key", "+", "'_'", "+", "(", "!", "!", "_", ".", "$flat", ")", ";", "return", "ctx", ".", "fn", "[", "k", "]", "||", "(", "ctx", ".", "fn", "["...
Resolve a key accessor reference.
[ "Resolve", "a", "key", "accessor", "reference", "." ]
05491b95035b70d5bafb05c5eebef9fa0c06c509
https://github.com/vega/vega-runtime/blob/05491b95035b70d5bafb05c5eebef9fa0c06c509/src/parameters.js#L73-L76
train
vega/vega-runtime
src/parameters.js
getField
function getField(_, ctx) { if (!_.$field) return null; var k = 'f:' + _.$field + '_' + _.$name; return ctx.fn[k] || (ctx.fn[k] = field(_.$field, _.$name)); }
javascript
function getField(_, ctx) { if (!_.$field) return null; var k = 'f:' + _.$field + '_' + _.$name; return ctx.fn[k] || (ctx.fn[k] = field(_.$field, _.$name)); }
[ "function", "getField", "(", "_", ",", "ctx", ")", "{", "if", "(", "!", "_", ".", "$field", ")", "return", "null", ";", "var", "k", "=", "'f:'", "+", "_", ".", "$field", "+", "'_'", "+", "_", ".", "$name", ";", "return", "ctx", ".", "fn", "["...
Resolve a field accessor reference.
[ "Resolve", "a", "field", "accessor", "reference", "." ]
05491b95035b70d5bafb05c5eebef9fa0c06c509
https://github.com/vega/vega-runtime/blob/05491b95035b70d5bafb05c5eebef9fa0c06c509/src/parameters.js#L81-L85
train
vega/vega-runtime
src/parameters.js
getCompare
function getCompare(_, ctx) { var k = 'c:' + _.$compare + '_' + _.$order, c = array(_.$compare).map(function(_) { return (_ && _.$tupleid) ? tupleid : _; }); return ctx.fn[k] || (ctx.fn[k] = compare(c, _.$order)); }
javascript
function getCompare(_, ctx) { var k = 'c:' + _.$compare + '_' + _.$order, c = array(_.$compare).map(function(_) { return (_ && _.$tupleid) ? tupleid : _; }); return ctx.fn[k] || (ctx.fn[k] = compare(c, _.$order)); }
[ "function", "getCompare", "(", "_", ",", "ctx", ")", "{", "var", "k", "=", "'c:'", "+", "_", ".", "$compare", "+", "'_'", "+", "_", ".", "$order", ",", "c", "=", "array", "(", "_", ".", "$compare", ")", ".", "map", "(", "function", "(", "_", ...
Resolve a comparator function reference.
[ "Resolve", "a", "comparator", "function", "reference", "." ]
05491b95035b70d5bafb05c5eebef9fa0c06c509
https://github.com/vega/vega-runtime/blob/05491b95035b70d5bafb05c5eebef9fa0c06c509/src/parameters.js#L90-L96
train
vega/vega-runtime
src/parameters.js
getEncode
function getEncode(_, ctx) { var spec = _.$encode, encode = {}, name, enc; for (name in spec) { enc = spec[name]; encode[name] = accessor(encodeExpression(enc.$expr, ctx), enc.$fields); encode[name].output = enc.$output; } return encode; }
javascript
function getEncode(_, ctx) { var spec = _.$encode, encode = {}, name, enc; for (name in spec) { enc = spec[name]; encode[name] = accessor(encodeExpression(enc.$expr, ctx), enc.$fields); encode[name].output = enc.$output; } return encode; }
[ "function", "getEncode", "(", "_", ",", "ctx", ")", "{", "var", "spec", "=", "_", ".", "$encode", ",", "encode", "=", "{", "}", ",", "name", ",", "enc", ";", "for", "(", "name", "in", "spec", ")", "{", "enc", "=", "spec", "[", "name", "]", ";...
Resolve an encode operator reference.
[ "Resolve", "an", "encode", "operator", "reference", "." ]
05491b95035b70d5bafb05c5eebef9fa0c06c509
https://github.com/vega/vega-runtime/blob/05491b95035b70d5bafb05c5eebef9fa0c06c509/src/parameters.js#L101-L111
train
vega/vega-runtime
src/parameters.js
getSubflow
function getSubflow(_, ctx) { var spec = _.$subflow; return function(dataflow, key, parent) { var subctx = parseDataflow(spec, ctx.fork()), op = subctx.get(spec.operators[0].id), p = subctx.signals.parent; if (p) p.set(parent); return op; }; }
javascript
function getSubflow(_, ctx) { var spec = _.$subflow; return function(dataflow, key, parent) { var subctx = parseDataflow(spec, ctx.fork()), op = subctx.get(spec.operators[0].id), p = subctx.signals.parent; if (p) p.set(parent); return op; }; }
[ "function", "getSubflow", "(", "_", ",", "ctx", ")", "{", "var", "spec", "=", "_", ".", "$subflow", ";", "return", "function", "(", "dataflow", ",", "key", ",", "parent", ")", "{", "var", "subctx", "=", "parseDataflow", "(", "spec", ",", "ctx", ".", ...
Resolve a recursive subflow specification.
[ "Resolve", "a", "recursive", "subflow", "specification", "." ]
05491b95035b70d5bafb05c5eebef9fa0c06c509
https://github.com/vega/vega-runtime/blob/05491b95035b70d5bafb05c5eebef9fa0c06c509/src/parameters.js#L123-L132
train
vutran/hot-reload-server
lib/index.js
start
function start() { // Listen to the port app.listen(hrsConfigs.port, function (err) { if (err) { info(err); } info('Running on http://%s:%s', hrsConfigs.address, hrsConfigs.port); }); }
javascript
function start() { // Listen to the port app.listen(hrsConfigs.port, function (err) { if (err) { info(err); } info('Running on http://%s:%s', hrsConfigs.address, hrsConfigs.port); }); }
[ "function", "start", "(", ")", "{", "// Listen to the port", "app", ".", "listen", "(", "hrsConfigs", ".", "port", ",", "function", "(", "err", ")", "{", "if", "(", "err", ")", "{", "info", "(", "err", ")", ";", "}", "info", "(", "'Running on http://%s...
Starts the hot-reload-server
[ "Starts", "the", "hot", "-", "reload", "-", "server" ]
c02a838350b8f98975900c4a0486d39cb3b13ce4
https://github.com/vutran/hot-reload-server/blob/c02a838350b8f98975900c4a0486d39cb3b13ce4/lib/index.js#L35-L43
train
franck34/qjobs
examples/simple.js
function(args,next) { // do nothing now but in 1 sec setTimeout(function() { // if i'm job id 10 or 20, let's add // another job dynamicaly in the queue. // It can be usefull for network operation (retry on timeout) if (args._jobId==10||args._jobId==20) { myQueueJ...
javascript
function(args,next) { // do nothing now but in 1 sec setTimeout(function() { // if i'm job id 10 or 20, let's add // another job dynamicaly in the queue. // It can be usefull for network operation (retry on timeout) if (args._jobId==10||args._jobId==20) { myQueueJ...
[ "function", "(", "args", ",", "next", ")", "{", "// do nothing now but in 1 sec", "setTimeout", "(", "function", "(", ")", "{", "// if i'm job id 10 or 20, let's add", "// another job dynamicaly in the queue.", "// It can be usefull for network operation (retry on timeout)", "if", ...
My non blocking main job
[ "My", "non", "blocking", "main", "job" ]
e065459d6cbfcadaa20c0aadc1d0a6c836b39aa1
https://github.com/franck34/qjobs/blob/e065459d6cbfcadaa20c0aadc1d0a6c836b39aa1/examples/simple.js#L3-L18
train
ariatemplates/hashspace
hsp/compiler/treebuilder/syntaxTree.js
isVoidElement
function isVoidElement(elName) { var result = false; if (elName && elName.toLowerCase) { result = VOID_HTML_ELEMENTS.hasOwnProperty(elName.toLowerCase()); } return result; }
javascript
function isVoidElement(elName) { var result = false; if (elName && elName.toLowerCase) { result = VOID_HTML_ELEMENTS.hasOwnProperty(elName.toLowerCase()); } return result; }
[ "function", "isVoidElement", "(", "elName", ")", "{", "var", "result", "=", "false", ";", "if", "(", "elName", "&&", "elName", ".", "toLowerCase", ")", "{", "result", "=", "VOID_HTML_ELEMENTS", ".", "hasOwnProperty", "(", "elName", ".", "toLowerCase", "(", ...
Checks if an element is a void one. @param {String} the element name. @return {Boolean} true if the element is a void one.
[ "Checks", "if", "an", "element", "is", "a", "void", "one", "." ]
24cb510288566eba0e33ff55949adb54c0a89fac
https://github.com/ariatemplates/hashspace/blob/24cb510288566eba0e33ff55949adb54c0a89fac/hsp/compiler/treebuilder/syntaxTree.js#L30-L36
train
ariatemplates/hashspace
hsp/compiler/treebuilder/syntaxTree.js
function (blockList) { this.errors = []; this.tree = new Node("file", null); this.tree.content = []; this._advance(blockList, 0, this.tree.content); this._postProcessTree(); }
javascript
function (blockList) { this.errors = []; this.tree = new Node("file", null); this.tree.content = []; this._advance(blockList, 0, this.tree.content); this._postProcessTree(); }
[ "function", "(", "blockList", ")", "{", "this", ".", "errors", "=", "[", "]", ";", "this", ".", "tree", "=", "new", "Node", "(", "\"file\"", ",", "null", ")", ";", "this", ".", "tree", ".", "content", "=", "[", "]", ";", "this", ".", "_advance", ...
Generate the syntax tree from the root block list. @param {Object} blockList the block list.
[ "Generate", "the", "syntax", "tree", "from", "the", "root", "block", "list", "." ]
24cb510288566eba0e33ff55949adb54c0a89fac
https://github.com/ariatemplates/hashspace/blob/24cb510288566eba0e33ff55949adb54c0a89fac/hsp/compiler/treebuilder/syntaxTree.js#L69-L77
train
ariatemplates/hashspace
hsp/compiler/treebuilder/syntaxTree.js
function (description, errdesc) { //TODO: errdesc is a bit vague var desc = { description : description }; if (errdesc) { if (errdesc.line) { // Integers desc.line = errdesc.line; desc.column = errdesc.column; } ...
javascript
function (description, errdesc) { //TODO: errdesc is a bit vague var desc = { description : description }; if (errdesc) { if (errdesc.line) { // Integers desc.line = errdesc.line; desc.column = errdesc.column; } ...
[ "function", "(", "description", ",", "errdesc", ")", "{", "//TODO: errdesc is a bit vague", "var", "desc", "=", "{", "description", ":", "description", "}", ";", "if", "(", "errdesc", ")", "{", "if", "(", "errdesc", ".", "line", ")", "{", "// Integers", "d...
Adds an error to the current error list. @param {String} description the error description @param {Object} errdesc additional object (block, node, ...) which can contain additional info about the error (line/column number, code).
[ "Adds", "an", "error", "to", "the", "current", "error", "list", "." ]
24cb510288566eba0e33ff55949adb54c0a89fac
https://github.com/ariatemplates/hashspace/blob/24cb510288566eba0e33ff55949adb54c0a89fac/hsp/compiler/treebuilder/syntaxTree.js#L84-L103
train
ariatemplates/hashspace
hsp/compiler/treebuilder/syntaxTree.js
function(expAst, attribute) { //verify that an event handler is a function call if (expAst && isEventHandlerAttr(attribute.name) && expAst.v !== '(') { this._logError("Event handler attribute only support function expressions", attribute.value[0]); } }
javascript
function(expAst, attribute) { //verify that an event handler is a function call if (expAst && isEventHandlerAttr(attribute.name) && expAst.v !== '(') { this._logError("Event handler attribute only support function expressions", attribute.value[0]); } }
[ "function", "(", "expAst", ",", "attribute", ")", "{", "//verify that an event handler is a function call", "if", "(", "expAst", "&&", "isEventHandlerAttr", "(", "attribute", ".", "name", ")", "&&", "expAst", ".", "v", "!==", "'('", ")", "{", "this", ".", "_lo...
Logs an error if the value of an event handler attribute is not a function expression.
[ "Logs", "an", "error", "if", "the", "value", "of", "an", "event", "handler", "attribute", "is", "not", "a", "function", "expression", "." ]
24cb510288566eba0e33ff55949adb54c0a89fac
https://github.com/ariatemplates/hashspace/blob/24cb510288566eba0e33ff55949adb54c0a89fac/hsp/compiler/treebuilder/syntaxTree.js#L123-L128
train
ariatemplates/hashspace
hsp/compiler/treebuilder/syntaxTree.js
function (blocks, startIndex, out, optEndFn) { var block, type; if (blocks) { for (var i = startIndex; i < blocks.length; i++) { block = blocks[i]; type = block.type; if (optEndFn && optEndFn(type, block.name)) { // we stop...
javascript
function (blocks, startIndex, out, optEndFn) { var block, type; if (blocks) { for (var i = startIndex; i < blocks.length; i++) { block = blocks[i]; type = block.type; if (optEndFn && optEndFn(type, block.name)) { // we stop...
[ "function", "(", "blocks", ",", "startIndex", ",", "out", ",", "optEndFn", ")", "{", "var", "block", ",", "type", ";", "if", "(", "blocks", ")", "{", "for", "(", "var", "i", "=", "startIndex", ";", "i", "<", "blocks", ".", "length", ";", "i", "++...
Process a list of blocks and advance the cursor index that scans the collection. @param {Array} blocks the full list of blocks. @param {Integer} startIndex the index from which the process has to start. @param {Array} out the output as an array of Node. @param {Function} optEndFn an optional end function that takes a n...
[ "Process", "a", "list", "of", "blocks", "and", "advance", "the", "cursor", "index", "that", "scans", "the", "collection", "." ]
24cb510288566eba0e33ff55949adb54c0a89fac
https://github.com/ariatemplates/hashspace/blob/24cb510288566eba0e33ff55949adb54c0a89fac/hsp/compiler/treebuilder/syntaxTree.js#L138-L158
train
ariatemplates/hashspace
hsp/compiler/treebuilder/syntaxTree.js
function() { var nodes = this.tree.content; for (var i = 0; i < nodes.length; i++) { if (nodes[i].type === "template") { this._processNodeContent(nodes[i].content,nodes[i]); } } }
javascript
function() { var nodes = this.tree.content; for (var i = 0; i < nodes.length; i++) { if (nodes[i].type === "template") { this._processNodeContent(nodes[i].content,nodes[i]); } } }
[ "function", "(", ")", "{", "var", "nodes", "=", "this", ".", "tree", ".", "content", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "nodes", ".", "length", ";", "i", "++", ")", "{", "if", "(", "nodes", "[", "i", "]", ".", "type", "==...
Post validation once the tree is properly parsed.
[ "Post", "validation", "once", "the", "tree", "is", "properly", "parsed", "." ]
24cb510288566eba0e33ff55949adb54c0a89fac
https://github.com/ariatemplates/hashspace/blob/24cb510288566eba0e33ff55949adb54c0a89fac/hsp/compiler/treebuilder/syntaxTree.js#L163-L170
train
ariatemplates/hashspace
hsp/compiler/treebuilder/syntaxTree.js
function(nodeList, parent) { // Ensure that {let} nodes are always at the beginning of a containter element var node, contentFound = false; // true when a node different from let is found for (var i = 0; i < nodeList.length; i++) { node = nodeList[i]; //console.log(i+":"+...
javascript
function(nodeList, parent) { // Ensure that {let} nodes are always at the beginning of a containter element var node, contentFound = false; // true when a node different from let is found for (var i = 0; i < nodeList.length; i++) { node = nodeList[i]; //console.log(i+":"+...
[ "function", "(", "nodeList", ",", "parent", ")", "{", "// Ensure that {let} nodes are always at the beginning of a containter element", "var", "node", ",", "contentFound", "=", "false", ";", "// true when a node different from let is found", "for", "(", "var", "i", "=", "0"...
Validates the content of a container node. @param {Array} nodeList the content of a container node @param {Node} parent the parent node
[ "Validates", "the", "content", "of", "a", "container", "node", "." ]
24cb510288566eba0e33ff55949adb54c0a89fac
https://github.com/ariatemplates/hashspace/blob/24cb510288566eba0e33ff55949adb54c0a89fac/hsp/compiler/treebuilder/syntaxTree.js#L177-L212
train
ariatemplates/hashspace
hsp/compiler/treebuilder/syntaxTree.js
function (index, blocks, out) { var node = new Node("template"); var block = blocks[index]; var validationResults = this._processTemplateStart(block.attributes, block.closingBrace); if (validationResults.errors.length > 0) { this._logError("Invalid template declaration", { ...
javascript
function (index, blocks, out) { var node = new Node("template"); var block = blocks[index]; var validationResults = this._processTemplateStart(block.attributes, block.closingBrace); if (validationResults.errors.length > 0) { this._logError("Invalid template declaration", { ...
[ "function", "(", "index", ",", "blocks", ",", "out", ")", "{", "var", "node", "=", "new", "Node", "(", "\"template\"", ")", ";", "var", "block", "=", "blocks", "[", "index", "]", ";", "var", "validationResults", "=", "this", ".", "_processTemplateStart",...
Manages a template block. @param {Array} blocks the full list of blocks. @param {Integer} index the index of the block to manage. @param {Array} out the output as an array of Node. @return {Integer} the index of the block where the function stopped or -1 if all blocks have been handled.
[ "Manages", "a", "template", "block", "." ]
24cb510288566eba0e33ff55949adb54c0a89fac
https://github.com/ariatemplates/hashspace/blob/24cb510288566eba0e33ff55949adb54c0a89fac/hsp/compiler/treebuilder/syntaxTree.js#L363-L404
train
ariatemplates/hashspace
hsp/compiler/treebuilder/syntaxTree.js
function (index, blocks, out) { var node = new Node("plaintext"), block = blocks[index]; node.value = block.value; out.push(node); return index; }
javascript
function (index, blocks, out) { var node = new Node("plaintext"), block = blocks[index]; node.value = block.value; out.push(node); return index; }
[ "function", "(", "index", ",", "blocks", ",", "out", ")", "{", "var", "node", "=", "new", "Node", "(", "\"plaintext\"", ")", ",", "block", "=", "blocks", "[", "index", "]", ";", "node", ".", "value", "=", "block", ".", "value", ";", "out", ".", "...
Manages a text block. @param {Array} blocks the full list of blocks. @param {Integer} index the index of the block to manage. @param {Array} out the output as an array of Node. @return {Integer} the index of the block where the function stopped or -1 if all blocks have been handled.
[ "Manages", "a", "text", "block", "." ]
24cb510288566eba0e33ff55949adb54c0a89fac
https://github.com/ariatemplates/hashspace/blob/24cb510288566eba0e33ff55949adb54c0a89fac/hsp/compiler/treebuilder/syntaxTree.js#L413-L418
train
ariatemplates/hashspace
hsp/compiler/treebuilder/syntaxTree.js
function (index, blocks, out) { var node = new Node("log"), block = blocks[index]; node.line = block.line; node.column = block.column; node.exprs = block.exprs; out.push(node); return index; }
javascript
function (index, blocks, out) { var node = new Node("log"), block = blocks[index]; node.line = block.line; node.column = block.column; node.exprs = block.exprs; out.push(node); return index; }
[ "function", "(", "index", ",", "blocks", ",", "out", ")", "{", "var", "node", "=", "new", "Node", "(", "\"log\"", ")", ",", "block", "=", "blocks", "[", "index", "]", ";", "node", ".", "line", "=", "block", ".", "line", ";", "node", ".", "column"...
Manages a log statement. @param {Array} blocks the full list of blocks. @param {Integer} index the index of the block to manage. @param {Array} out the output as an array of Node. @return {Integer} the index of the block where the function stopped or -1 if all blocks have been handled.
[ "Manages", "a", "log", "statement", "." ]
24cb510288566eba0e33ff55949adb54c0a89fac
https://github.com/ariatemplates/hashspace/blob/24cb510288566eba0e33ff55949adb54c0a89fac/hsp/compiler/treebuilder/syntaxTree.js#L443-L450
train
ariatemplates/hashspace
hsp/compiler/treebuilder/syntaxTree.js
function (index, blocks, out) { //creates the if node var node = new Node("if"), block = blocks[index], lastValidIndex = index; node.condition = { "category": block.condition.category, "value": block.condition.value, "line": block.condition.line, "...
javascript
function (index, blocks, out) { //creates the if node var node = new Node("if"), block = blocks[index], lastValidIndex = index; node.condition = { "category": block.condition.category, "value": block.condition.value, "line": block.condition.line, "...
[ "function", "(", "index", ",", "blocks", ",", "out", ")", "{", "//creates the if node", "var", "node", "=", "new", "Node", "(", "\"if\"", ")", ",", "block", "=", "blocks", "[", "index", "]", ",", "lastValidIndex", "=", "index", ";", "node", ".", "condi...
Manages an if block. @param {Array} blocks the full list of blocks. @param {Integer} index the index of the block to manage. @param {Array} out the output as an array of Node. @return {Integer} the index of the block where the function stopped or -1 if all blocks have been handled.
[ "Manages", "an", "if", "block", "." ]
24cb510288566eba0e33ff55949adb54c0a89fac
https://github.com/ariatemplates/hashspace/blob/24cb510288566eba0e33ff55949adb54c0a89fac/hsp/compiler/treebuilder/syntaxTree.js#L562-L606
train
ariatemplates/hashspace
hsp/compiler/treebuilder/syntaxTree.js
function (index, blocks, out) { //creates the foreach node var node = new Node("foreach"), block = blocks[index]; node.item = block.item; node.key = block.key; node.collection = block.colref; node.content = []; out.push(node); //fills node.content with t...
javascript
function (index, blocks, out) { //creates the foreach node var node = new Node("foreach"), block = blocks[index]; node.item = block.item; node.key = block.key; node.collection = block.colref; node.content = []; out.push(node); //fills node.content with t...
[ "function", "(", "index", ",", "blocks", ",", "out", ")", "{", "//creates the foreach node", "var", "node", "=", "new", "Node", "(", "\"foreach\"", ")", ",", "block", "=", "blocks", "[", "index", "]", ";", "node", ".", "item", "=", "block", ".", "item"...
Manages a foreach block. @param {Array} blocks the full list of blocks. @param {Integer} index the index of the block to manage. @param {Array} out the output as an array of Node. @return {Integer} the index of the block where the function stopped or -1 if all blocks have been handled.
[ "Manages", "a", "foreach", "block", "." ]
24cb510288566eba0e33ff55949adb54c0a89fac
https://github.com/ariatemplates/hashspace/blob/24cb510288566eba0e33ff55949adb54c0a89fac/hsp/compiler/treebuilder/syntaxTree.js#L666-L683
train
ariatemplates/hashspace
hsp/compiler/treebuilder/syntaxTree.js
function (index, blocks, out) { var block = blocks[index]; if (isVoidElement(block.name)) { block.closed=true; } return this._elementOrComponent("element", index, blocks, out); }
javascript
function (index, blocks, out) { var block = blocks[index]; if (isVoidElement(block.name)) { block.closed=true; } return this._elementOrComponent("element", index, blocks, out); }
[ "function", "(", "index", ",", "blocks", ",", "out", ")", "{", "var", "block", "=", "blocks", "[", "index", "]", ";", "if", "(", "isVoidElement", "(", "block", ".", "name", ")", ")", "{", "block", ".", "closed", "=", "true", ";", "}", "return", "...
Manages an element block. @param {Array} blocks the full list of blocks. @param {Integer} index the index of the block to manage. @param {Array} out the output as an array of Node. @return {Integer} the index of the block where the function stopped or -1 if all blocks have been handled.
[ "Manages", "an", "element", "block", "." ]
24cb510288566eba0e33ff55949adb54c0a89fac
https://github.com/ariatemplates/hashspace/blob/24cb510288566eba0e33ff55949adb54c0a89fac/hsp/compiler/treebuilder/syntaxTree.js#L715-L721
train
ariatemplates/hashspace
hsp/compiler/treebuilder/syntaxTree.js
function (blockType, index, blocks, out) { var node = new Node(blockType), block = blocks[index], blockValue, expAst; node.name = block.name; node.closed = block.closed; if (block.ref) { // only for components node.ref = block.ref; } // Handle att...
javascript
function (blockType, index, blocks, out) { var node = new Node(blockType), block = blocks[index], blockValue, expAst; node.name = block.name; node.closed = block.closed; if (block.ref) { // only for components node.ref = block.ref; } // Handle att...
[ "function", "(", "blockType", ",", "index", ",", "blocks", ",", "out", ")", "{", "var", "node", "=", "new", "Node", "(", "blockType", ")", ",", "block", "=", "blocks", "[", "index", "]", ",", "blockValue", ",", "expAst", ";", "node", ".", "name", "...
Processing function for elements, components and component attributes @arg blockType {String} "element", "component" or "cptattribute". @param {Array} blocks the full list of blocks. @param {Integer} index the index of the block to manage. @param {Array} out the output as an array of Node. @return {Integer} the index o...
[ "Processing", "function", "for", "elements", "components", "and", "component", "attributes" ]
24cb510288566eba0e33ff55949adb54c0a89fac
https://github.com/ariatemplates/hashspace/blob/24cb510288566eba0e33ff55949adb54c0a89fac/hsp/compiler/treebuilder/syntaxTree.js#L753-L912
train
ariatemplates/hashspace
hsp/compiler/treebuilder/syntaxTree.js
function(ref) { if (ref.category !== "objectref" || !ref.path || !ref.path.length || !ref.path.join) { return null; } return ref.path.join("."); }
javascript
function(ref) { if (ref.category !== "objectref" || !ref.path || !ref.path.length || !ref.path.join) { return null; } return ref.path.join("."); }
[ "function", "(", "ref", ")", "{", "if", "(", "ref", ".", "category", "!==", "\"objectref\"", "||", "!", "ref", ".", "path", "||", "!", "ref", ".", "path", ".", "length", "||", "!", "ref", ".", "path", ".", "join", ")", "{", "return", "null", ";",...
Transform a component path into a string - useful for error checking If path is invalid null is returned @param {Object} ref the ref structure returned by the PEG parser for components and endcomponents @retrun {String} the path as a string
[ "Transform", "a", "component", "path", "into", "a", "string", "-", "useful", "for", "error", "checking", "If", "path", "is", "invalid", "null", "is", "returned" ]
24cb510288566eba0e33ff55949adb54c0a89fac
https://github.com/ariatemplates/hashspace/blob/24cb510288566eba0e33ff55949adb54c0a89fac/hsp/compiler/treebuilder/syntaxTree.js#L920-L925
train
ariatemplates/hashspace
hsp/compiler/treebuilder/syntaxTree.js
function (index, blocks, out) { // only called in case of error var block = blocks[index]; var msg = "Invalid HTML element syntax"; if (block.code && block.code.match(/^<\/?@/)) { //when it starts with <@ or </@ msg = "Invalid component attribute syntax"; ...
javascript
function (index, blocks, out) { // only called in case of error var block = blocks[index]; var msg = "Invalid HTML element syntax"; if (block.code && block.code.match(/^<\/?@/)) { //when it starts with <@ or </@ msg = "Invalid component attribute syntax"; ...
[ "function", "(", "index", ",", "blocks", ",", "out", ")", "{", "// only called in case of error", "var", "block", "=", "blocks", "[", "index", "]", ";", "var", "msg", "=", "\"Invalid HTML element syntax\"", ";", "if", "(", "block", ".", "code", "&&", "block"...
Catches invalid element errors. @param {Array} blocks the full list of blocks. @param {Integer} index the index of the block to manage. @param {Array} out the output as an array of Node. @return {Integer} the index of the block where the function stopped or -1 if all blocks have been handled.
[ "Catches", "invalid", "element", "errors", "." ]
24cb510288566eba0e33ff55949adb54c0a89fac
https://github.com/ariatemplates/hashspace/blob/24cb510288566eba0e33ff55949adb54c0a89fac/hsp/compiler/treebuilder/syntaxTree.js#L934-L944
train
ariatemplates/hashspace
hsp/compiler/treebuilder/syntaxTree.js
function (index, blocks, out) { // only called in case of error, i.e not digested by _elementOrComponent var block = blocks[index], name = block.name; if (isVoidElement(name)) { this._logError("The end element </" + name + "> was rejected as <" + name + "> is a void HTML element and ca...
javascript
function (index, blocks, out) { // only called in case of error, i.e not digested by _elementOrComponent var block = blocks[index], name = block.name; if (isVoidElement(name)) { this._logError("The end element </" + name + "> was rejected as <" + name + "> is a void HTML element and ca...
[ "function", "(", "index", ",", "blocks", ",", "out", ")", "{", "// only called in case of error, i.e not digested by _elementOrComponent", "var", "block", "=", "blocks", "[", "index", "]", ",", "name", "=", "block", ".", "name", ";", "if", "(", "isVoidElement", ...
Captures isolated end elements to raise an error. @param {Array} blocks the full list of blocks. @param {Integer} index the index of the block to manage. @param {Array} out the output as an array of Node. @return {Integer} the index of the block where the function stopped or -1 if all blocks have been handled.
[ "Captures", "isolated", "end", "elements", "to", "raise", "an", "error", "." ]
24cb510288566eba0e33ff55949adb54c0a89fac
https://github.com/ariatemplates/hashspace/blob/24cb510288566eba0e33ff55949adb54c0a89fac/hsp/compiler/treebuilder/syntaxTree.js#L964-L973
train
ariatemplates/hashspace
hsp/compiler/treebuilder/syntaxTree.js
function (index, blocks, out) { // only called in case of error, i.e not digested by _elementOrComponent var block = blocks[index], path = this._getComponentPathAsString(block.ref) ; this._logError("End component </#" + path + "> does not match any <#" + path + "> component", block); ret...
javascript
function (index, blocks, out) { // only called in case of error, i.e not digested by _elementOrComponent var block = blocks[index], path = this._getComponentPathAsString(block.ref) ; this._logError("End component </#" + path + "> does not match any <#" + path + "> component", block); ret...
[ "function", "(", "index", ",", "blocks", ",", "out", ")", "{", "// only called in case of error, i.e not digested by _elementOrComponent", "var", "block", "=", "blocks", "[", "index", "]", ",", "path", "=", "this", ".", "_getComponentPathAsString", "(", "block", "."...
Captures isolated end components to raise an error. @param {Array} blocks the full list of blocks. @param {Integer} index the index of the block to manage. @param {Array} out the output as an array of Node. @return {Integer} the index of the block where the function stopped or -1 if all blocks have been handled.
[ "Captures", "isolated", "end", "components", "to", "raise", "an", "error", "." ]
24cb510288566eba0e33ff55949adb54c0a89fac
https://github.com/ariatemplates/hashspace/blob/24cb510288566eba0e33ff55949adb54c0a89fac/hsp/compiler/treebuilder/syntaxTree.js#L982-L987
train
mbouclas/loopback-connector-mailgun
lib/mailgun.js
Connector
function Connector(settings) { this.mailgun = Mailgun({apiKey: settings.apikey, domain: settings.domain}); }
javascript
function Connector(settings) { this.mailgun = Mailgun({apiKey: settings.apikey, domain: settings.domain}); }
[ "function", "Connector", "(", "settings", ")", "{", "this", ".", "mailgun", "=", "Mailgun", "(", "{", "apiKey", ":", "settings", ".", "apikey", ",", "domain", ":", "settings", ".", "domain", "}", ")", ";", "}" ]
Configure and create an instance of the connector
[ "Configure", "and", "create", "an", "instance", "of", "the", "connector" ]
9ab78b861da4f568a6b2be1af7f27e3ad11e006d
https://github.com/mbouclas/loopback-connector-mailgun/blob/9ab78b861da4f568a6b2be1af7f27e3ad11e006d/lib/mailgun.js#L15-L17
train
ariatemplates/hashspace
hsp/json.js
callObservers
function callObservers(object, chgeset) { var ln = object[OBSERVER_PROPERTY]; if (ln) { var elt; for (var i = 0, sz = ln.length; sz > i; i++) { elt = ln[i]; if (elt.constructor === Function) { elt(chgeset); } } } }
javascript
function callObservers(object, chgeset) { var ln = object[OBSERVER_PROPERTY]; if (ln) { var elt; for (var i = 0, sz = ln.length; sz > i; i++) { elt = ln[i]; if (elt.constructor === Function) { elt(chgeset); } } } }
[ "function", "callObservers", "(", "object", ",", "chgeset", ")", "{", "var", "ln", "=", "object", "[", "OBSERVER_PROPERTY", "]", ";", "if", "(", "ln", ")", "{", "var", "elt", ";", "for", "(", "var", "i", "=", "0", ",", "sz", "=", "ln", ".", "leng...
Call all observers for a givent object @param {Object} object reference to the object that is being observed @param {Array} chgeset an array of change descriptors (cf. changeDesc())
[ "Call", "all", "observers", "for", "a", "givent", "object" ]
24cb510288566eba0e33ff55949adb54c0a89fac
https://github.com/ariatemplates/hashspace/blob/24cb510288566eba0e33ff55949adb54c0a89fac/hsp/json.js#L222-L233
train
ariatemplates/hashspace
hsp/json.js
function (object, property, value) { if (object[OBSERVER_PROPERTY]) { var existed = ownProperty.call(object, property), oldVal = object[property]; delete object[property]; if (existed) { var chgset=[changeDesc(object, property, object[property], oldVal, "dele...
javascript
function (object, property, value) { if (object[OBSERVER_PROPERTY]) { var existed = ownProperty.call(object, property), oldVal = object[property]; delete object[property]; if (existed) { var chgset=[changeDesc(object, property, object[property], oldVal, "dele...
[ "function", "(", "object", ",", "property", ",", "value", ")", "{", "if", "(", "object", "[", "OBSERVER_PROPERTY", "]", ")", "{", "var", "existed", "=", "ownProperty", ".", "call", "(", "object", ",", "property", ")", ",", "oldVal", "=", "object", "[",...
Delete a property in a JSON object and automatically notifies all observers of the change
[ "Delete", "a", "property", "in", "a", "JSON", "object", "and", "automatically", "notifies", "all", "observers", "of", "the", "change" ]
24cb510288566eba0e33ff55949adb54c0a89fac
https://github.com/ariatemplates/hashspace/blob/24cb510288566eba0e33ff55949adb54c0a89fac/hsp/json.js#L275-L287
train
ariatemplates/hashspace
hsp/rt.js
function (tplctxt, scopevars, ctlWrapper, ctlInitArgs, rootscope) { var vs = rootscope ? Object.create(rootscope) : {}, nm, argNames = []; // array of argument names if (scopevars) { for (var i = 0, sz = scopevars.length; sz > i; i += 2) { nm = scopevars[i]; v...
javascript
function (tplctxt, scopevars, ctlWrapper, ctlInitArgs, rootscope) { var vs = rootscope ? Object.create(rootscope) : {}, nm, argNames = []; // array of argument names if (scopevars) { for (var i = 0, sz = scopevars.length; sz > i; i += 2) { nm = scopevars[i]; v...
[ "function", "(", "tplctxt", ",", "scopevars", ",", "ctlWrapper", ",", "ctlInitArgs", ",", "rootscope", ")", "{", "var", "vs", "=", "rootscope", "?", "Object", ".", "create", "(", "rootscope", ")", ":", "{", "}", ",", "nm", ",", "argNames", "=", "[", ...
Main method called to generate the document fragment associated to a template for a given set of arguments This creates a new set of node instances from the node definitions passed in the ng constructor @param {Array} scopevars the list of the scope variables (actually the template arguments) - e.g. ["person",person] o...
[ "Main", "method", "called", "to", "generate", "the", "document", "fragment", "associated", "to", "a", "template", "for", "a", "given", "set", "of", "arguments", "This", "creates", "a", "new", "set", "of", "node", "instances", "from", "the", "node", "definiti...
24cb510288566eba0e33ff55949adb54c0a89fac
https://github.com/ariatemplates/hashspace/blob/24cb510288566eba0e33ff55949adb54c0a89fac/hsp/rt.js#L49-L70
train
ariatemplates/hashspace
hsp/rt.js
getGlobalRef
function getGlobalRef(name) { var r=global[name]; if (r===undefined) { r=null; } return r; }
javascript
function getGlobalRef(name) { var r=global[name]; if (r===undefined) { r=null; } return r; }
[ "function", "getGlobalRef", "(", "name", ")", "{", "var", "r", "=", "global", "[", "name", "]", ";", "if", "(", "r", "===", "undefined", ")", "{", "r", "=", "null", ";", "}", "return", "r", ";", "}" ]
Return the global reference corresponding to a given name This function is used by template to retrieve global references that are first searched in the template module scope, then in the hashspace global object. Null is returned if no reference is found @param {String} name the name of the reference to look for @param...
[ "Return", "the", "global", "reference", "corresponding", "to", "a", "given", "name", "This", "function", "is", "used", "by", "template", "to", "retrieve", "global", "references", "that", "are", "first", "searched", "in", "the", "template", "module", "scope", "...
24cb510288566eba0e33ff55949adb54c0a89fac
https://github.com/ariatemplates/hashspace/blob/24cb510288566eba0e33ff55949adb54c0a89fac/hsp/rt.js#L106-L112
train
ariatemplates/hashspace
hsp/compiler/jsgenerator/index.js
_validate
function _validate (code, lineMap) { var validationResult = jsv.validate(code); var result = {isValid: validationResult.isValid}; if (!validationResult.isValid) { // translate error line numbers var error, lineNumber; for (var i = 0; i < validationResult.errors.length; i++) { ...
javascript
function _validate (code, lineMap) { var validationResult = jsv.validate(code); var result = {isValid: validationResult.isValid}; if (!validationResult.isValid) { // translate error line numbers var error, lineNumber; for (var i = 0; i < validationResult.errors.length; i++) { ...
[ "function", "_validate", "(", "code", ",", "lineMap", ")", "{", "var", "validationResult", "=", "jsv", ".", "validate", "(", "code", ")", ";", "var", "result", "=", "{", "isValid", ":", "validationResult", ".", "isValid", "}", ";", "if", "(", "!", "val...
Validates a javascript string using the jsvalidator module, and generates an error report if not valid. @param {String} code the javascript string. @param {Object} lineMap the line mapping between the source template and the compiled one @return {Object} a result map
[ "Validates", "a", "javascript", "string", "using", "the", "jsvalidator", "module", "and", "generates", "an", "error", "report", "if", "not", "valid", "." ]
24cb510288566eba0e33ff55949adb54c0a89fac
https://github.com/ariatemplates/hashspace/blob/24cb510288566eba0e33ff55949adb54c0a89fac/hsp/compiler/jsgenerator/index.js#L102-L123
train
ariatemplates/hashspace
hsp/compiler/jsgenerator/index.js
_getErrorScript
function _getErrorScript (errors, fileName) { var result = ''; if (errors && errors.length) { var err=errors[0]; var ctxt={ type:"error", file:fileName, code:err.code, line:err.line, column:err.column }; var suberrors = ...
javascript
function _getErrorScript (errors, fileName) { var result = ''; if (errors && errors.length) { var err=errors[0]; var ctxt={ type:"error", file:fileName, code:err.code, line:err.line, column:err.column }; var suberrors = ...
[ "function", "_getErrorScript", "(", "errors", ",", "fileName", ")", "{", "var", "result", "=", "''", ";", "if", "(", "errors", "&&", "errors", ".", "length", ")", "{", "var", "err", "=", "errors", "[", "0", "]", ";", "var", "ctxt", "=", "{", "type"...
Generate an error script to include in the template compiled script in order to show errors in the browser when the script is loaded @param {Array} errors the errror list @param {String} fileName the name of the file being compiled @return {String} the javascript snippet to be included
[ "Generate", "an", "error", "script", "to", "include", "in", "the", "template", "compiled", "script", "in", "order", "to", "show", "errors", "in", "the", "browser", "when", "the", "script", "is", "loaded" ]
24cb510288566eba0e33ff55949adb54c0a89fac
https://github.com/ariatemplates/hashspace/blob/24cb510288566eba0e33ff55949adb54c0a89fac/hsp/compiler/jsgenerator/index.js#L131-L156
train
ariatemplates/hashspace
hsp/compiler/jsgenerator/index.js
_generateLineMap
function _generateLineMap (res, file) { if (res.errors && res.errors.length) { return; } var syntaxTree = res.syntaxTree, templates = []; // identify the templates in the syntax tree for (var i = 0; i < syntaxTree.length; i++) { if (syntaxTree[i].type === 'template') { te...
javascript
function _generateLineMap (res, file) { if (res.errors && res.errors.length) { return; } var syntaxTree = res.syntaxTree, templates = []; // identify the templates in the syntax tree for (var i = 0; i < syntaxTree.length; i++) { if (syntaxTree[i].type === 'template') { te...
[ "function", "_generateLineMap", "(", "res", ",", "file", ")", "{", "if", "(", "res", ".", "errors", "&&", "res", ".", "errors", ".", "length", ")", "{", "return", ";", "}", "var", "syntaxTree", "=", "res", ".", "syntaxTree", ",", "templates", "=", "[...
Generate the line map of a compilatin result @param {JSON} res the result object of a compilation - cf. compile function @param {String} file the template file (before compilation)
[ "Generate", "the", "line", "map", "of", "a", "compilatin", "result" ]
24cb510288566eba0e33ff55949adb54c0a89fac
https://github.com/ariatemplates/hashspace/blob/24cb510288566eba0e33ff55949adb54c0a89fac/hsp/compiler/jsgenerator/index.js#L173-L223
train
ariatemplates/hashspace
hsp/propobserver.js
function () { json.unobserve(this.target, this.callback); this.props=null; this.callback=null; this.target=null; }
javascript
function () { json.unobserve(this.target, this.callback); this.props=null; this.callback=null; this.target=null; }
[ "function", "(", ")", "{", "json", ".", "unobserve", "(", "this", ".", "target", ",", "this", ".", "callback", ")", ";", "this", ".", "props", "=", "null", ";", "this", ".", "callback", "=", "null", ";", "this", ".", "target", "=", "null", ";", "...
Safely delete all internal dependencies Must be called before deleting the object
[ "Safely", "delete", "all", "internal", "dependencies", "Must", "be", "called", "before", "deleting", "the", "object" ]
24cb510288566eba0e33ff55949adb54c0a89fac
https://github.com/ariatemplates/hashspace/blob/24cb510288566eba0e33ff55949adb54c0a89fac/hsp/propobserver.js#L40-L45
train
ariatemplates/hashspace
hsp/propobserver.js
function (observer, property) { if (!property) property = ALL; var arr = this.props[property]; if (!arr) { // property is not observed yet arr = []; this.props[property] = arr; } arr.push(observer); }
javascript
function (observer, property) { if (!property) property = ALL; var arr = this.props[property]; if (!arr) { // property is not observed yet arr = []; this.props[property] = arr; } arr.push(observer); }
[ "function", "(", "observer", ",", "property", ")", "{", "if", "(", "!", "property", ")", "property", "=", "ALL", ";", "var", "arr", "=", "this", ".", "props", "[", "property", "]", ";", "if", "(", "!", "arr", ")", "{", "// property is not observed yet"...
Add a new observer for a given property @param {object} observer object with a onPropChange() method @param {string} property the property name to observe (optional)
[ "Add", "a", "new", "observer", "for", "a", "given", "property" ]
24cb510288566eba0e33ff55949adb54c0a89fac
https://github.com/ariatemplates/hashspace/blob/24cb510288566eba0e33ff55949adb54c0a89fac/hsp/propobserver.js#L51-L61
train
ariatemplates/hashspace
hsp/propobserver.js
PropObserver_notifyChanges
function PropObserver_notifyChanges (chglist) { var c; for (var i = 0, sz = chglist.length; sz > i; i++) { c = chglist[i]; if (!c) continue; // check if we listen to this property if (this.props[c.name]) { PropObserver_notifyChange(this, c, c.name); ...
javascript
function PropObserver_notifyChanges (chglist) { var c; for (var i = 0, sz = chglist.length; sz > i; i++) { c = chglist[i]; if (!c) continue; // check if we listen to this property if (this.props[c.name]) { PropObserver_notifyChange(this, c, c.name); ...
[ "function", "PropObserver_notifyChanges", "(", "chglist", ")", "{", "var", "c", ";", "for", "(", "var", "i", "=", "0", ",", "sz", "=", "chglist", ".", "length", ";", "sz", ">", "i", ";", "i", "++", ")", "{", "c", "=", "chglist", "[", "i", "]", ...
Notify the change to the registered observers i.e. call their onPropChange method with the change description as parameter @private
[ "Notify", "the", "change", "to", "the", "registered", "observers", "i", ".", "e", ".", "call", "their", "onPropChange", "method", "with", "the", "change", "description", "as", "parameter" ]
24cb510288566eba0e33ff55949adb54c0a89fac
https://github.com/ariatemplates/hashspace/blob/24cb510288566eba0e33ff55949adb54c0a89fac/hsp/propobserver.js#L91-L105
train
Wozacosta/classificator
lib/classificator.js
Naivebayes
function Naivebayes(options) { // set options object this.options = {}; if (typeof options !== 'undefined') { if (!options || typeof options !== 'object' || Array.isArray(options)) { throw TypeError( `NaiveBayes got invalid 'options': ${options}'. Pass in an object.` ); } this.opti...
javascript
function Naivebayes(options) { // set options object this.options = {}; if (typeof options !== 'undefined') { if (!options || typeof options !== 'object' || Array.isArray(options)) { throw TypeError( `NaiveBayes got invalid 'options': ${options}'. Pass in an object.` ); } this.opti...
[ "function", "Naivebayes", "(", "options", ")", "{", "// set options object", "this", ".", "options", "=", "{", "}", ";", "if", "(", "typeof", "options", "!==", "'undefined'", ")", "{", "if", "(", "!", "options", "||", "typeof", "options", "!==", "'object'"...
Naive-Bayes Classifier This is a naive-bayes classifier that uses Laplace Smoothing. Takes an (optional) options object containing: - `tokenizer` => custom tokenization function
[ "Naive", "-", "Bayes", "Classifier" ]
39cc8883dd18474c72e161bc6698888ba8b867e4
https://github.com/Wozacosta/classificator/blob/39cc8883dd18474c72e161bc6698888ba8b867e4/lib/classificator.js#L97-L132
train
rcasto/adaptive-html
turndown/adaptivecard-rules.js
function (listItemContainers, node) { var isOrdered = node.nodeName === 'OL'; var startIndex = parseInt(node.getAttribute('start'), 10) || 1; // only applicable to ordered lists var blocks = (listItemContainers || []).map((listItemContainer, listItemIndex) => { var listItemElems = un...
javascript
function (listItemContainers, node) { var isOrdered = node.nodeName === 'OL'; var startIndex = parseInt(node.getAttribute('start'), 10) || 1; // only applicable to ordered lists var blocks = (listItemContainers || []).map((listItemContainer, listItemIndex) => { var listItemElems = un...
[ "function", "(", "listItemContainers", ",", "node", ")", "{", "var", "isOrdered", "=", "node", ".", "nodeName", "===", "'OL'", ";", "var", "startIndex", "=", "parseInt", "(", "node", ".", "getAttribute", "(", "'start'", ")", ",", "10", ")", "||", "1", ...
content = array of listitem containers
[ "content", "=", "array", "of", "listitem", "containers" ]
79586cebfd0e34f31418c9cbd186ad568652c3ca
https://github.com/rcasto/adaptive-html/blob/79586cebfd0e34f31418c9cbd186ad568652c3ca/turndown/adaptivecard-rules.js#L77-L92
train
jsguy/mithril.bindings
dist/version/mithril.bindings-0.0.1.js
function(name, eve){ // Bi-directional binding of value m.addBinding(name, function(prop) { if (typeof prop == "function") { this.value = prop(); this[eve] = m.withAttr("value", prop); } else { this.value = prop; } }, true); }
javascript
function(name, eve){ // Bi-directional binding of value m.addBinding(name, function(prop) { if (typeof prop == "function") { this.value = prop(); this[eve] = m.withAttr("value", prop); } else { this.value = prop; } }, true); }
[ "function", "(", "name", ",", "eve", ")", "{", "//\tBi-directional binding of value", "m", ".", "addBinding", "(", "name", ",", "function", "(", "prop", ")", "{", "if", "(", "typeof", "prop", "==", "\"function\"", ")", "{", "this", ".", "value", "=", "pr...
Add value bindings for various event types
[ "Add", "value", "bindings", "for", "various", "event", "types" ]
4ba83da49cea2309929058fd31866df2651ec6a1
https://github.com/jsguy/mithril.bindings/blob/4ba83da49cea2309929058fd31866df2651ec6a1/dist/version/mithril.bindings-0.0.1.js#L165-L175
train
kmalakoff/knockback-navigators
examples/vendor/xui-2.3.2.js
getTag
function getTag(el) { return (el.firstChild === null) ? {'UL':'LI','DL':'DT','TR':'TD'}[el.tagName] || el.tagName : el.firstChild.tagName; }
javascript
function getTag(el) { return (el.firstChild === null) ? {'UL':'LI','DL':'DT','TR':'TD'}[el.tagName] || el.tagName : el.firstChild.tagName; }
[ "function", "getTag", "(", "el", ")", "{", "return", "(", "el", ".", "firstChild", "===", "null", ")", "?", "{", "'UL'", ":", "'LI'", ",", "'DL'", ":", "'DT'", ",", "'TR'", ":", "'TD'", "}", "[", "el", ".", "tagName", "]", "||", "el", ".", "tag...
private method for finding a dom element
[ "private", "method", "for", "finding", "a", "dom", "element" ]
6dd5344f2d1f8b95e91b31aa29a3dc56b5a36125
https://github.com/kmalakoff/knockback-navigators/blob/6dd5344f2d1f8b95e91b31aa29a3dc56b5a36125/examples/vendor/xui-2.3.2.js#L578-L580
train
kmalakoff/knockback-navigators
examples/vendor/xui-2.3.2.js
wrap
function wrap(xhtml, tag) { var e = document.createElement('div'); e.innerHTML = xhtml; return e; }
javascript
function wrap(xhtml, tag) { var e = document.createElement('div'); e.innerHTML = xhtml; return e; }
[ "function", "wrap", "(", "xhtml", ",", "tag", ")", "{", "var", "e", "=", "document", ".", "createElement", "(", "'div'", ")", ";", "e", ".", "innerHTML", "=", "xhtml", ";", "return", "e", ";", "}" ]
private method Wraps the HTML in a TAG, Tag is optional If the html starts with a Tag, it will wrap the context in that tag.
[ "private", "method", "Wraps", "the", "HTML", "in", "a", "TAG", "Tag", "is", "optional", "If", "the", "html", "starts", "with", "a", "Tag", "it", "will", "wrap", "the", "context", "in", "that", "tag", "." ]
6dd5344f2d1f8b95e91b31aa29a3dc56b5a36125
https://github.com/kmalakoff/knockback-navigators/blob/6dd5344f2d1f8b95e91b31aa29a3dc56b5a36125/examples/vendor/xui-2.3.2.js#L590-L594
train
kmalakoff/knockback-navigators
examples/vendor/xui-2.3.2.js
function(o) { var options = {}; "duration after easing".split(' ').forEach( function(p) { if (props[p]) { options[p] = props[p]; delete props[p]; } }); return options; }
javascript
function(o) { var options = {}; "duration after easing".split(' ').forEach( function(p) { if (props[p]) { options[p] = props[p]; delete props[p]; } }); return options; }
[ "function", "(", "o", ")", "{", "var", "options", "=", "{", "}", ";", "\"duration after easing\"", ".", "split", "(", "' '", ")", ".", "forEach", "(", "function", "(", "p", ")", "{", "if", "(", "props", "[", "p", "]", ")", "{", "options", "[", "p...
creates an options obj for emile
[ "creates", "an", "options", "obj", "for", "emile" ]
6dd5344f2d1f8b95e91b31aa29a3dc56b5a36125
https://github.com/kmalakoff/knockback-navigators/blob/6dd5344f2d1f8b95e91b31aa29a3dc56b5a36125/examples/vendor/xui-2.3.2.js#L934-L943
train
kmalakoff/knockback-navigators
examples/vendor/xui-2.3.2.js
function(props) { var serialisedProps = [], key; if (typeof props != string) { for (key in props) { serialisedProps.push(cssstyle(key) + ':' + props[key]); } serialisedProps = serialisedProps.join(';'); } else { serialisedProps = props; } return se...
javascript
function(props) { var serialisedProps = [], key; if (typeof props != string) { for (key in props) { serialisedProps.push(cssstyle(key) + ':' + props[key]); } serialisedProps = serialisedProps.join(';'); } else { serialisedProps = props; } return se...
[ "function", "(", "props", ")", "{", "var", "serialisedProps", "=", "[", "]", ",", "key", ";", "if", "(", "typeof", "props", "!=", "string", ")", "{", "for", "(", "key", "in", "props", ")", "{", "serialisedProps", ".", "push", "(", "cssstyle", "(", ...
serialize the properties into a string for emile
[ "serialize", "the", "properties", "into", "a", "string", "for", "emile" ]
6dd5344f2d1f8b95e91b31aa29a3dc56b5a36125
https://github.com/kmalakoff/knockback-navigators/blob/6dd5344f2d1f8b95e91b31aa29a3dc56b5a36125/examples/vendor/xui-2.3.2.js#L946-L957
train
royaltm/kafka-tools
lib/config.js
checkMax
function checkMax(value, max) { if (max) { if (max.charAt(0) === '-') { if (value.charAt(0) !== '-') return false; return checkMax(max.substr(1), value.substr(1)); } else { if (value.charAt(0) === '-') return true; } var len = Math.max(value.length, max.length); m...
javascript
function checkMax(value, max) { if (max) { if (max.charAt(0) === '-') { if (value.charAt(0) !== '-') return false; return checkMax(max.substr(1), value.substr(1)); } else { if (value.charAt(0) === '-') return true; } var len = Math.max(value.length, max.length); m...
[ "function", "checkMax", "(", "value", ",", "max", ")", "{", "if", "(", "max", ")", "{", "if", "(", "max", ".", "charAt", "(", "0", ")", "===", "'-'", ")", "{", "if", "(", "value", ".", "charAt", "(", "0", ")", "!==", "'-'", ")", "return", "fa...
max must be a 0 or positive number string
[ "max", "must", "be", "a", "0", "or", "positive", "number", "string" ]
a8718fcc3cc5bc06e9974665344a815b7a9e2a56
https://github.com/royaltm/kafka-tools/blob/a8718fcc3cc5bc06e9974665344a815b7a9e2a56/lib/config.js#L59-L75
train
royaltm/kafka-tools
lib/zookeeper.js
writeTopicConfig
function writeTopicConfig(client, topic, configs, callback) { debug('writeTopicConfig: "%s", %j', topic, configs); updateEntityConfig(client, getTopicConfigPath(topic), configs, callback); }
javascript
function writeTopicConfig(client, topic, configs, callback) { debug('writeTopicConfig: "%s", %j', topic, configs); updateEntityConfig(client, getTopicConfigPath(topic), configs, callback); }
[ "function", "writeTopicConfig", "(", "client", ",", "topic", ",", "configs", ",", "callback", ")", "{", "debug", "(", "'writeTopicConfig: \"%s\", %j'", ",", "topic", ",", "configs", ")", ";", "updateEntityConfig", "(", "client", ",", "getTopicConfigPath", "(", "...
Write out the topic config to zk, if there is any @param {ZkClient} client @param {String} topic @param {Object} configs @param {Function} callback
[ "Write", "out", "the", "topic", "config", "to", "zk", "if", "there", "is", "any" ]
a8718fcc3cc5bc06e9974665344a815b7a9e2a56
https://github.com/royaltm/kafka-tools/blob/a8718fcc3cc5bc06e9974665344a815b7a9e2a56/lib/zookeeper.js#L356-L359
train
royaltm/kafka-tools
lib/zookeeper.js
writeClientConfig
function writeClientConfig(client, clientId, configs, callback) { debug('writeClientConfig: "%s", %j', clientId, configs); updateEntityConfig(client, getClientConfigPath(clientId), configs, callback); }
javascript
function writeClientConfig(client, clientId, configs, callback) { debug('writeClientConfig: "%s", %j', clientId, configs); updateEntityConfig(client, getClientConfigPath(clientId), configs, callback); }
[ "function", "writeClientConfig", "(", "client", ",", "clientId", ",", "configs", ",", "callback", ")", "{", "debug", "(", "'writeClientConfig: \"%s\", %j'", ",", "clientId", ",", "configs", ")", ";", "updateEntityConfig", "(", "client", ",", "getClientConfigPath", ...
Write out the client config to zk, if there is any @param {ZkClient} client @param {String} clientId @param {Object} configs @param {Function} callback
[ "Write", "out", "the", "client", "config", "to", "zk", "if", "there", "is", "any" ]
a8718fcc3cc5bc06e9974665344a815b7a9e2a56
https://github.com/royaltm/kafka-tools/blob/a8718fcc3cc5bc06e9974665344a815b7a9e2a56/lib/zookeeper.js#L369-L372
train
royaltm/kafka-tools
lib/zookeeper.js
createParentPath
function createParentPath(client, path, callback) { var parentDir = path.substring(0, path.lastIndexOf('/')); debug('createParentPath: "%s"', parentDir); if (parentDir.length != 0) { client.create(parentDir, function(err) { if (err) { if (err.code === NO_NODE) { return createParentPa...
javascript
function createParentPath(client, path, callback) { var parentDir = path.substring(0, path.lastIndexOf('/')); debug('createParentPath: "%s"', parentDir); if (parentDir.length != 0) { client.create(parentDir, function(err) { if (err) { if (err.code === NO_NODE) { return createParentPa...
[ "function", "createParentPath", "(", "client", ",", "path", ",", "callback", ")", "{", "var", "parentDir", "=", "path", ".", "substring", "(", "0", ",", "path", ".", "lastIndexOf", "(", "'/'", ")", ")", ";", "debug", "(", "'createParentPath: \"%s\"'", ",",...
Create the parent path @param {ZkClient} client @param {String} path @param {Function} callback
[ "Create", "the", "parent", "path" ]
a8718fcc3cc5bc06e9974665344a815b7a9e2a56
https://github.com/royaltm/kafka-tools/blob/a8718fcc3cc5bc06e9974665344a815b7a9e2a56/lib/zookeeper.js#L387-L408
train
royaltm/kafka-tools
lib/zookeeper.js
createPersistentPath
function createPersistentPath(client, path, data, callback) { debug('createPersistentPath: "%s" "%s"', path, data); data = ensureBuffer(data); client.create(path, data, function(err) { if (err) { if (err.code !== NO_NODE) return callback(err); createParentPath(client, path, function(err...
javascript
function createPersistentPath(client, path, data, callback) { debug('createPersistentPath: "%s" "%s"', path, data); data = ensureBuffer(data); client.create(path, data, function(err) { if (err) { if (err.code !== NO_NODE) return callback(err); createParentPath(client, path, function(err...
[ "function", "createPersistentPath", "(", "client", ",", "path", ",", "data", ",", "callback", ")", "{", "debug", "(", "'createPersistentPath: \"%s\" \"%s\"'", ",", "path", ",", "data", ")", ";", "data", "=", "ensureBuffer", "(", "data", ")", ";", "client", "...
Create an persistent node with the given path and data. Create parents if necessary. @param {ZkClient} client @param {String} path @param {String|Buffer} data @param {Function} callback
[ "Create", "an", "persistent", "node", "with", "the", "given", "path", "and", "data", ".", "Create", "parents", "if", "necessary", "." ]
a8718fcc3cc5bc06e9974665344a815b7a9e2a56
https://github.com/royaltm/kafka-tools/blob/a8718fcc3cc5bc06e9974665344a815b7a9e2a56/lib/zookeeper.js#L418-L436
train
royaltm/kafka-tools
lib/zookeeper.js
updatePersistentPath
function updatePersistentPath(client, path, data, callback) { debug('updatePersistentPath: "%s" "%s"', path, data); data = ensureBuffer(data); client.setData(path, data, function (err) { if (err) { if (err.code !== NO_NODE) return callback(err); createParentPath(client, path, function(e...
javascript
function updatePersistentPath(client, path, data, callback) { debug('updatePersistentPath: "%s" "%s"', path, data); data = ensureBuffer(data); client.setData(path, data, function (err) { if (err) { if (err.code !== NO_NODE) return callback(err); createParentPath(client, path, function(e...
[ "function", "updatePersistentPath", "(", "client", ",", "path", ",", "data", ",", "callback", ")", "{", "debug", "(", "'updatePersistentPath: \"%s\" \"%s\"'", ",", "path", ",", "data", ")", ";", "data", "=", "ensureBuffer", "(", "data", ")", ";", "client", "...
Update the value of a persistent node with the given path and data. create parrent directory if necessary. Never return NO_NODE error. @param {ZkClient} client @param {String} path @param {String|Buffer} data @param {Function} callback
[ "Update", "the", "value", "of", "a", "persistent", "node", "with", "the", "given", "path", "and", "data", ".", "create", "parrent", "directory", "if", "necessary", ".", "Never", "return", "NO_NODE", "error", "." ]
a8718fcc3cc5bc06e9974665344a815b7a9e2a56
https://github.com/royaltm/kafka-tools/blob/a8718fcc3cc5bc06e9974665344a815b7a9e2a56/lib/zookeeper.js#L446-L471
train
arqex/fluxify
src/xDispatcher.js
function( id, callback ){ var ID = id; // If the callback is the first parameter if( typeof id == 'function' ){ ID = 'ID_' + this._ID; callback = id; } this._callbacks[ID] = callback; this._ID++; return ID; }
javascript
function( id, callback ){ var ID = id; // If the callback is the first parameter if( typeof id == 'function' ){ ID = 'ID_' + this._ID; callback = id; } this._callbacks[ID] = callback; this._ID++; return ID; }
[ "function", "(", "id", ",", "callback", ")", "{", "var", "ID", "=", "id", ";", "// If the callback is the first parameter", "if", "(", "typeof", "id", "==", "'function'", ")", "{", "ID", "=", "'ID_'", "+", "this", ".", "_ID", ";", "callback", "=", "id", ...
Register a callback that will be called when an action is dispatched. @param {String | Function} id If a string is passed, it will be the id of the callback. If a function is passed, it will be used as callback, and id is generated automatically. @param {Function} callback If an id is passed as a first argument, ...
[ "Register", "a", "callback", "that", "will", "be", "called", "when", "an", "action", "is", "dispatched", "." ]
8915033a150ce86f851efdf114886e9adcbb5eed
https://github.com/arqex/fluxify/blob/8915033a150ce86f851efdf114886e9adcbb5eed/src/xDispatcher.js#L34-L47
train
arqex/fluxify
src/xDispatcher.js
function( id, xStore ){ Object.defineProperty(xStore, '_dispatcher', { value: this }); return this.register( id, xStore.callback ); }
javascript
function( id, xStore ){ Object.defineProperty(xStore, '_dispatcher', { value: this }); return this.register( id, xStore.callback ); }
[ "function", "(", "id", ",", "xStore", ")", "{", "Object", ".", "defineProperty", "(", "xStore", ",", "'_dispatcher'", ",", "{", "value", ":", "this", "}", ")", ";", "return", "this", ".", "register", "(", "id", ",", "xStore", ".", "callback", ")", ";...
Register a XStore in the dispacher. XStores has a method called callback. The dispatcher register that function as a regular callback. @param {String} id The id for the store to be used in the waitFor method. @param {XStore} xStore Store to register in the dispatcher @return {String} The id of the callbac...
[ "Register", "a", "XStore", "in", "the", "dispacher", ".", "XStores", "has", "a", "method", "called", "callback", ".", "The", "dispatcher", "register", "that", "function", "as", "a", "regular", "callback", "." ]
8915033a150ce86f851efdf114886e9adcbb5eed
https://github.com/arqex/fluxify/blob/8915033a150ce86f851efdf114886e9adcbb5eed/src/xDispatcher.js#L57-L64
train
arqex/fluxify
src/xDispatcher.js
function( ids ) { var promises = [], i = 0 ; if( !Array.isArray( ids ) ) ids = [ ids ]; for(; i<ids.length; i++ ){ if( this._promises[ ids[i] ] ) promises.push( this._promises[ ids[i] ] ); } if( !promises.length ) return this._Promise.resolve(); return this._Promise.all( promises ); }
javascript
function( ids ) { var promises = [], i = 0 ; if( !Array.isArray( ids ) ) ids = [ ids ]; for(; i<ids.length; i++ ){ if( this._promises[ ids[i] ] ) promises.push( this._promises[ ids[i] ] ); } if( !promises.length ) return this._Promise.resolve(); return this._Promise.all( promises ); }
[ "function", "(", "ids", ")", "{", "var", "promises", "=", "[", "]", ",", "i", "=", "0", ";", "if", "(", "!", "Array", ".", "isArray", "(", "ids", ")", ")", "ids", "=", "[", "ids", "]", ";", "for", "(", ";", "i", "<", "ids", ".", "length", ...
Creates a promise and waits for the callbacks specified to complete before resolve it. If it is used by an actionCallback, the promise should be resolved to let other callbacks wait for it if needed. Be careful of not to wait by a callback that is waiting by the current callback, or the promises will never fulfill. @...
[ "Creates", "a", "promise", "and", "waits", "for", "the", "callbacks", "specified", "to", "complete", "before", "resolve", "it", ".", "If", "it", "is", "used", "by", "an", "actionCallback", "the", "promise", "should", "be", "resolved", "to", "let", "other", ...
8915033a150ce86f851efdf114886e9adcbb5eed
https://github.com/arqex/fluxify/blob/8915033a150ce86f851efdf114886e9adcbb5eed/src/xDispatcher.js#L87-L104
train
arqex/fluxify
src/xDispatcher.js
function(){ var me = this, dispatchArguments = arguments, promises = [] ; this._promises = []; // A closure is needed for the callback id Object.keys( this._callbacks ).forEach( function( id ){ // All the promises must be set in me._promises before trying to resolve // in order to make waitFor ...
javascript
function(){ var me = this, dispatchArguments = arguments, promises = [] ; this._promises = []; // A closure is needed for the callback id Object.keys( this._callbacks ).forEach( function( id ){ // All the promises must be set in me._promises before trying to resolve // in order to make waitFor ...
[ "function", "(", ")", "{", "var", "me", "=", "this", ",", "dispatchArguments", "=", "arguments", ",", "promises", "=", "[", "]", ";", "this", ".", "_promises", "=", "[", "]", ";", "// A closure is needed for the callback id", "Object", ".", "keys", "(", "t...
Dispatches an action inmediatelly. @return {Promise} A promise to be resolved when all the callbacks have finised.
[ "Dispatches", "an", "action", "inmediatelly", "." ]
8915033a150ce86f851efdf114886e9adcbb5eed
https://github.com/arqex/fluxify/blob/8915033a150ce86f851efdf114886e9adcbb5eed/src/xDispatcher.js#L144-L179
train
sasaplus1/ipc-promise
ipc-promise.js
commonEventHandler
function commonEventHandler(event, arg) { // NOTE: send from renderer process always. var successEventName = getSuccessEventName(arg.eventName, arg.id); var failureEventName = getFailureEventName(arg.eventName, arg.id); var onSuccess = function(result) { // send success to ipc for renderer proces...
javascript
function commonEventHandler(event, arg) { // NOTE: send from renderer process always. var successEventName = getSuccessEventName(arg.eventName, arg.id); var failureEventName = getFailureEventName(arg.eventName, arg.id); var onSuccess = function(result) { // send success to ipc for renderer proces...
[ "function", "commonEventHandler", "(", "event", ",", "arg", ")", "{", "// NOTE: send from renderer process always.", "var", "successEventName", "=", "getSuccessEventName", "(", "arg", ".", "eventName", ",", "arg", ".", "id", ")", ";", "var", "failureEventName", "=",...
common event handler for ipc. @private @param {Event} event event object. @param {Object} arg argument object.
[ "common", "event", "handler", "for", "ipc", "." ]
6b20756bc604a2fc2ca0f4bcfd1267621d216176
https://github.com/sasaplus1/ipc-promise/blob/6b20756bc604a2fc2ca0f4bcfd1267621d216176/ipc-promise.js#L56-L88
train
sasaplus1/ipc-promise
ipc-promise.js
on
function on(event, listener) { // call from main process always. // add listener to common event emitter for main process. cee.on(event, function(id, data, ipcEvent) { listener(data, ipcEvent) .then(function(result) { cee.emit(getSuccessEventName(event, id), result); }) ...
javascript
function on(event, listener) { // call from main process always. // add listener to common event emitter for main process. cee.on(event, function(id, data, ipcEvent) { listener(data, ipcEvent) .then(function(result) { cee.emit(getSuccessEventName(event, id), result); }) ...
[ "function", "on", "(", "event", ",", "listener", ")", "{", "// call from main process always.", "// add listener to common event emitter for main process.", "cee", ".", "on", "(", "event", ",", "function", "(", "id", ",", "data", ",", "ipcEvent", ")", "{", "listener...
listen event. @param {String} event event name. @param {Function} listener listener function.
[ "listen", "event", "." ]
6b20756bc604a2fc2ca0f4bcfd1267621d216176
https://github.com/sasaplus1/ipc-promise/blob/6b20756bc604a2fc2ca0f4bcfd1267621d216176/ipc-promise.js#L144-L157
train
egoist/install-packages
lib/index.js
installPeerDependencies
async function installPeerDependencies(cwd, installDir, options) { const { data: pkg } = await joycon.load({ files: ['package.json'], cwd }) const peers = pkg.peerDependencies || {} const packages = [] for (const peer in peers) { if (!options.peerFilter || options.peerFilter(peer, peers[peer])) { ...
javascript
async function installPeerDependencies(cwd, installDir, options) { const { data: pkg } = await joycon.load({ files: ['package.json'], cwd }) const peers = pkg.peerDependencies || {} const packages = [] for (const peer in peers) { if (!options.peerFilter || options.peerFilter(peer, peers[peer])) { ...
[ "async", "function", "installPeerDependencies", "(", "cwd", ",", "installDir", ",", "options", ")", "{", "const", "{", "data", ":", "pkg", "}", "=", "await", "joycon", ".", "load", "(", "{", "files", ":", "[", "'package.json'", "]", ",", "cwd", "}", ")...
Install peer dependencies @param {string} cwd The directory to find package.json @param {string} installDir The directory to install peer dependencies @param {*} options
[ "Install", "peer", "dependencies" ]
b69a44f15452027b4c2ad0d12c9df5dcb9295603
https://github.com/egoist/install-packages/blob/b69a44f15452027b4c2ad0d12c9df5dcb9295603/lib/index.js#L97-L119
train
dtex/tharp
index.js
Robot
function Robot(opts) { if (!(this instanceof Robot)) { return new Robot(opts); } this.chains = opts.chains; this.offset = opts.offset || [0, 0, 0]; if (!opts.orientation) { opts.orientation = {}; } this.orientation = { pitch: opts.orientation.pitch || 0, yaw: opts.orientation.yaw || 0...
javascript
function Robot(opts) { if (!(this instanceof Robot)) { return new Robot(opts); } this.chains = opts.chains; this.offset = opts.offset || [0, 0, 0]; if (!opts.orientation) { opts.orientation = {}; } this.orientation = { pitch: opts.orientation.pitch || 0, yaw: opts.orientation.yaw || 0...
[ "function", "Robot", "(", "opts", ")", "{", "if", "(", "!", "(", "this", "instanceof", "Robot", ")", ")", "{", "return", "new", "Robot", "(", "opts", ")", ";", "}", "this", ".", "chains", "=", "opts", ".", "chains", ";", "this", ".", "offset", "=...
Wrap our chains into a single object we can control @param {Object} opts Options: {chains, offset, orientation} - opts.chains {Array} An array of chains that makeup this robot - opts.robotType {String} One of the predefined robot types. - opts.offset {Array} A three element array describing an offset for the robot's o...
[ "Wrap", "our", "chains", "into", "a", "single", "object", "we", "can", "control" ]
87c0b54544e9e9f4e35275247ea551ccd29cda66
https://github.com/dtex/tharp/blob/87c0b54544e9e9f4e35275247ea551ccd29cda66/index.js#L21-L41
train
dtex/tharp
index.js
Chain
function Chain(opts) { if (!(this instanceof Chain)) { return new Chain(opts); } if (opts.constructor) { this.devices = new opts.constructor(opts.actuators); } else { this.devices = opts.actuators; } this.chainType = opts.chainType; this.links = opts.links; this.origin = opts.origin || ...
javascript
function Chain(opts) { if (!(this instanceof Chain)) { return new Chain(opts); } if (opts.constructor) { this.devices = new opts.constructor(opts.actuators); } else { this.devices = opts.actuators; } this.chainType = opts.chainType; this.links = opts.links; this.origin = opts.origin || ...
[ "function", "Chain", "(", "opts", ")", "{", "if", "(", "!", "(", "this", "instanceof", "Chain", ")", ")", "{", "return", "new", "Chain", "(", "opts", ")", ";", "}", "if", "(", "opts", ".", "constructor", ")", "{", "this", ".", "devices", "=", "ne...
Wrap our servos object so that we have all the info and methods we need to define and solve our the kinematic system @param {Object} opts Options: {actuators, systemType, origin, bones } - opts.actuators {Servos}: The Servos() object that contains the chain's actuators - opts.chainType {String}: One of the pre-defined...
[ "Wrap", "our", "servos", "object", "so", "that", "we", "have", "all", "the", "info", "and", "methods", "we", "need", "to", "define", "and", "solve", "our", "the", "kinematic", "system" ]
87c0b54544e9e9f4e35275247ea551ccd29cda66
https://github.com/dtex/tharp/blob/87c0b54544e9e9f4e35275247ea551ccd29cda66/index.js#L90-L111
train
sadams/lite-url
dist/lite-url.js
splitOnFirst
function splitOnFirst(str, splitter, callback) { var parts = str.split(splitter); var first = parts.shift(); return callback(first, parts.join(splitter)); }
javascript
function splitOnFirst(str, splitter, callback) { var parts = str.split(splitter); var first = parts.shift(); return callback(first, parts.join(splitter)); }
[ "function", "splitOnFirst", "(", "str", ",", "splitter", ",", "callback", ")", "{", "var", "parts", "=", "str", ".", "split", "(", "splitter", ")", ";", "var", "first", "=", "parts", ".", "shift", "(", ")", ";", "return", "callback", "(", "first", ",...
splits a string on the first occurrence of 'splitter' and calls back with the two entries. @param {string} str @param {string} splitter @param {function} callback @return *
[ "splits", "a", "string", "on", "the", "first", "occurrence", "of", "splitter", "and", "calls", "back", "with", "the", "two", "entries", "." ]
10cb29a1b38b747629bc0f1739ea4bf60d758f8a
https://github.com/sadams/lite-url/blob/10cb29a1b38b747629bc0f1739ea4bf60d758f8a/dist/lite-url.js#L28-L32
train
sadams/lite-url
dist/lite-url.js
liteURL
function liteURL(str) { // We first check if we have parsed this URL before, to avoid running the // monster regex over and over (which is expensive!) var uri = memo[str]; if (typeof uri !== 'undefined') { return uri; } //parsed url uri = uriParser(s...
javascript
function liteURL(str) { // We first check if we have parsed this URL before, to avoid running the // monster regex over and over (which is expensive!) var uri = memo[str]; if (typeof uri !== 'undefined') { return uri; } //parsed url uri = uriParser(s...
[ "function", "liteURL", "(", "str", ")", "{", "// We first check if we have parsed this URL before, to avoid running the", "// monster regex over and over (which is expensive!)", "var", "uri", "=", "memo", "[", "str", "]", ";", "if", "(", "typeof", "uri", "!==", "'undefined'...
Uri parsing method. @param {string} str @returns {{ href:string, origin:string, protocol:string, username:string, password:string, host:string, hostname:string, port:string, path:string, search:string, hash:string, params:{} }}
[ "Uri", "parsing", "method", "." ]
10cb29a1b38b747629bc0f1739ea4bf60d758f8a
https://github.com/sadams/lite-url/blob/10cb29a1b38b747629bc0f1739ea4bf60d758f8a/dist/lite-url.js#L165-L183
train
uttesh/ngu-utility
dist/ngu-utility.esm.js
dateGetter
function dateGetter(name, size, offset, trim, negWrap) { if (offset === void 0) { offset = 0; } if (trim === void 0) { trim = false; } if (negWrap === void 0) { negWrap = false; } return function (date, locale) { var /** @type {?} */ part = getDatePart(name, date, size); if (offset > 0 |...
javascript
function dateGetter(name, size, offset, trim, negWrap) { if (offset === void 0) { offset = 0; } if (trim === void 0) { trim = false; } if (negWrap === void 0) { negWrap = false; } return function (date, locale) { var /** @type {?} */ part = getDatePart(name, date, size); if (offset > 0 |...
[ "function", "dateGetter", "(", "name", ",", "size", ",", "offset", ",", "trim", ",", "negWrap", ")", "{", "if", "(", "offset", "===", "void", "0", ")", "{", "offset", "=", "0", ";", "}", "if", "(", "trim", "===", "void", "0", ")", "{", "trim", ...
Returns a date formatter that transforms a date into its locale digit representation @param {?} name @param {?} size @param {?=} offset @param {?=} trim @param {?=} negWrap @return {?}
[ "Returns", "a", "date", "formatter", "that", "transforms", "a", "date", "into", "its", "locale", "digit", "representation" ]
8a9bd6eef91f4862b6e9ca1c6dd2bee8aa79ecca
https://github.com/uttesh/ngu-utility/blob/8a9bd6eef91f4862b6e9ca1c6dd2bee8aa79ecca/dist/ngu-utility.esm.js#L3340-L3354
train
uttesh/ngu-utility
dist/ngu-utility.esm.js
getDateTranslation
function getDateTranslation(date, locale, name, width, form, extended) { switch (name) { case TranslationType.Months: return getLocaleMonthNames(locale, form, width)[date.getMonth()]; case TranslationType.Days: return getLocaleDayNames(locale, form, width)[date.getDay()]; ...
javascript
function getDateTranslation(date, locale, name, width, form, extended) { switch (name) { case TranslationType.Months: return getLocaleMonthNames(locale, form, width)[date.getMonth()]; case TranslationType.Days: return getLocaleDayNames(locale, form, width)[date.getDay()]; ...
[ "function", "getDateTranslation", "(", "date", ",", "locale", ",", "name", ",", "width", ",", "form", ",", "extended", ")", "{", "switch", "(", "name", ")", "{", "case", "TranslationType", ".", "Months", ":", "return", "getLocaleMonthNames", "(", "locale", ...
Returns the locale translation of a date for a given form, type and width @param {?} date @param {?} locale @param {?} name @param {?} width @param {?} form @param {?} extended @return {?}
[ "Returns", "the", "locale", "translation", "of", "a", "date", "for", "a", "given", "form", "type", "and", "width" ]
8a9bd6eef91f4862b6e9ca1c6dd2bee8aa79ecca
https://github.com/uttesh/ngu-utility/blob/8a9bd6eef91f4862b6e9ca1c6dd2bee8aa79ecca/dist/ngu-utility.esm.js#L3409-L3450
train
uttesh/ngu-utility
dist/ngu-utility.esm.js
getRandomColors
function getRandomColors() { var letters = '0123456789ABCDEF'.split(''); var _color = '#'; for (var i = 0; i < 6; i++) { _color += letters[Math.floor(Math.random() * 16)]; } return _color; }
javascript
function getRandomColors() { var letters = '0123456789ABCDEF'.split(''); var _color = '#'; for (var i = 0; i < 6; i++) { _color += letters[Math.floor(Math.random() * 16)]; } return _color; }
[ "function", "getRandomColors", "(", ")", "{", "var", "letters", "=", "'0123456789ABCDEF'", ".", "split", "(", "''", ")", ";", "var", "_color", "=", "'#'", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "6", ";", "i", "++", ")", "{", "_colo...
Get the random colors @returns {String}
[ "Get", "the", "random", "colors" ]
8a9bd6eef91f4862b6e9ca1c6dd2bee8aa79ecca
https://github.com/uttesh/ngu-utility/blob/8a9bd6eef91f4862b6e9ca1c6dd2bee8aa79ecca/dist/ngu-utility.esm.js#L5799-L5806
train
uttesh/ngu-utility
dist/ngu-utility.esm.js
getFirstAndLastName
function getFirstAndLastName(data) { var names = data.split(" "); if (names && names.length >= 2) { var firstName = names[0]; var lastName = names[1]; if (firstName && lastName) { var text = firstName.substr(0, 1) + lastName.substr(0, 1); return text; } ...
javascript
function getFirstAndLastName(data) { var names = data.split(" "); if (names && names.length >= 2) { var firstName = names[0]; var lastName = names[1]; if (firstName && lastName) { var text = firstName.substr(0, 1) + lastName.substr(0, 1); return text; } ...
[ "function", "getFirstAndLastName", "(", "data", ")", "{", "var", "names", "=", "data", ".", "split", "(", "\" \"", ")", ";", "if", "(", "names", "&&", "names", ".", "length", ">=", "2", ")", "{", "var", "firstName", "=", "names", "[", "0", "]", ";"...
get the first name and last name first letters and combined and form the letter avatar @param {type} data @returns {unresolved}
[ "get", "the", "first", "name", "and", "last", "name", "first", "letters", "and", "combined", "and", "form", "the", "letter", "avatar" ]
8a9bd6eef91f4862b6e9ca1c6dd2bee8aa79ecca
https://github.com/uttesh/ngu-utility/blob/8a9bd6eef91f4862b6e9ca1c6dd2bee8aa79ecca/dist/ngu-utility.esm.js#L5812-L5825
train
rcasto/adaptive-html
dist/adaptive-html.es.js
wrap
function wrap(elements, options) { elements = toArray(elements); /* Don't wrap only a container in a container */ if (elements.length === 1 && isContainer(elements[0])) { return elements[0]; } var container = { type: cardTypes.container, items: elements }; setOptions(...
javascript
function wrap(elements, options) { elements = toArray(elements); /* Don't wrap only a container in a container */ if (elements.length === 1 && isContainer(elements[0])) { return elements[0]; } var container = { type: cardTypes.container, items: elements }; setOptions(...
[ "function", "wrap", "(", "elements", ",", "options", ")", "{", "elements", "=", "toArray", "(", "elements", ")", ";", "/* Don't wrap only a container in a container */", "if", "(", "elements", ".", "length", "===", "1", "&&", "isContainer", "(", "elements", "[",...
Wrap adaptive card elements in a container
[ "Wrap", "adaptive", "card", "elements", "in", "a", "container" ]
79586cebfd0e34f31418c9cbd186ad568652c3ca
https://github.com/rcasto/adaptive-html/blob/79586cebfd0e34f31418c9cbd186ad568652c3ca/dist/adaptive-html.es.js#L157-L169
train
rcasto/adaptive-html
dist/adaptive-html.es.js
turndown
function turndown(input) { if (!canConvert(input)) { throw new TypeError(input + ' is not a string, or an element/document/fragment node.'); } var cardElems = process.call(this, new RootNode(input)); return createCard(cardElems); }
javascript
function turndown(input) { if (!canConvert(input)) { throw new TypeError(input + ' is not a string, or an element/document/fragment node.'); } var cardElems = process.call(this, new RootNode(input)); return createCard(cardElems); }
[ "function", "turndown", "(", "input", ")", "{", "if", "(", "!", "canConvert", "(", "input", ")", ")", "{", "throw", "new", "TypeError", "(", "input", "+", "' is not a string, or an element/document/fragment node.'", ")", ";", "}", "var", "cardElems", "=", "pro...
The entry point for converting a string or DOM node to JSON @public @param {String|HTMLElement} input The string or DOM node to convert @returns A Markdown representation of the input @type String
[ "The", "entry", "point", "for", "converting", "a", "string", "or", "DOM", "node", "to", "JSON" ]
79586cebfd0e34f31418c9cbd186ad568652c3ca
https://github.com/rcasto/adaptive-html/blob/79586cebfd0e34f31418c9cbd186ad568652c3ca/dist/adaptive-html.es.js#L605-L611
train
rcasto/adaptive-html
dist/adaptive-html.es.js
replacementForNode
function replacementForNode(node) { var rule = this.rules.forNode(node); var content = process.call(this, node); // get's internal content of node return rule.replacement(content, node); }
javascript
function replacementForNode(node) { var rule = this.rules.forNode(node); var content = process.call(this, node); // get's internal content of node return rule.replacement(content, node); }
[ "function", "replacementForNode", "(", "node", ")", "{", "var", "rule", "=", "this", ".", "rules", ".", "forNode", "(", "node", ")", ";", "var", "content", "=", "process", ".", "call", "(", "this", ",", "node", ")", ";", "// get's internal content of node"...
Converts an element node to its Adaptive Card equivalent @private @param {HTMLElement} node The node to convert @returns An Adaptive Card representation of the node @type String
[ "Converts", "an", "element", "node", "to", "its", "Adaptive", "Card", "equivalent" ]
79586cebfd0e34f31418c9cbd186ad568652c3ca
https://github.com/rcasto/adaptive-html/blob/79586cebfd0e34f31418c9cbd186ad568652c3ca/dist/adaptive-html.es.js#L661-L665
train
rcasto/adaptive-html
dist/adaptive-html.es.js
canConvert
function canConvert(input) { return input != null && (typeof input === 'string' || input.nodeType && (input.nodeType === 1 || input.nodeType === 9 || input.nodeType === 11)); }
javascript
function canConvert(input) { return input != null && (typeof input === 'string' || input.nodeType && (input.nodeType === 1 || input.nodeType === 9 || input.nodeType === 11)); }
[ "function", "canConvert", "(", "input", ")", "{", "return", "input", "!=", "null", "&&", "(", "typeof", "input", "===", "'string'", "||", "input", ".", "nodeType", "&&", "(", "input", ".", "nodeType", "===", "1", "||", "input", ".", "nodeType", "===", ...
Determines whether an input can be converted @private @param {String|HTMLElement} input Describe this parameter @returns Describe what it returns @type String|Object|Array|Boolean|Number
[ "Determines", "whether", "an", "input", "can", "be", "converted" ]
79586cebfd0e34f31418c9cbd186ad568652c3ca
https://github.com/rcasto/adaptive-html/blob/79586cebfd0e34f31418c9cbd186ad568652c3ca/dist/adaptive-html.es.js#L674-L676
train
thlorenz/prange
prange.js
prange
function prange(s) { const set = new Set() const subs = s // correct things like AJs -A9s to AJs-A9s .replace( /([A,K,Q,J,T,2-9]{2}[o,s]?)\s*-\s*([A,K,Q,J,T,2-9]{2}[o,s]?)/g , '$1-$2' ) // correct AK + to AK+ .replace( /([A,K,Q,J,T,2-9]{2}[o,s]?)\s\+/g , '$1+' ) ...
javascript
function prange(s) { const set = new Set() const subs = s // correct things like AJs -A9s to AJs-A9s .replace( /([A,K,Q,J,T,2-9]{2}[o,s]?)\s*-\s*([A,K,Q,J,T,2-9]{2}[o,s]?)/g , '$1-$2' ) // correct AK + to AK+ .replace( /([A,K,Q,J,T,2-9]{2}[o,s]?)\s\+/g , '$1+' ) ...
[ "function", "prange", "(", "s", ")", "{", "const", "set", "=", "new", "Set", "(", ")", "const", "subs", "=", "s", "// correct things like AJs -A9s to AJs-A9s", ".", "replace", "(", "/", "([A,K,Q,J,T,2-9]{2}[o,s]?)\\s*-\\s*([A,K,Q,J,T,2-9]{2}[o,s]?)", "/", "g", ",", ...
Converts a short notation for poker hand ranges into an array filled with the matching combos. Each range specifier is separated by a comma. The following notations are supported: - single combos `KK, AK, ATs` - plus notation - `QQ+` = `[ AA, KK, QQ ]` - `KTs+` = `[ KQs, KJs, KTs ]` - `KTo+` = `[ KQo, KJo, KTo ]` - ...
[ "Converts", "a", "short", "notation", "for", "poker", "hand", "ranges", "into", "an", "array", "filled", "with", "the", "matching", "combos", "." ]
6cbf10c3594970a1e1a0de9400ae1ef9dadfdb4c
https://github.com/thlorenz/prange/blob/6cbf10c3594970a1e1a0de9400ae1ef9dadfdb4c/prange.js#L164-L184
train
jotak/mipod
javascript/Library.js
organizer
function organizer(flat, tags, treeDescriptor, leafDescriptor) { var tree = {}; flat.forEach(function (song) { var treePtr = tree; var depth = 1; // strPossibleKeys can be like "albumArtist|artist", or just "album" for instance treeDescriptor.forEach(function (strPossibleKeys) {...
javascript
function organizer(flat, tags, treeDescriptor, leafDescriptor) { var tree = {}; flat.forEach(function (song) { var treePtr = tree; var depth = 1; // strPossibleKeys can be like "albumArtist|artist", or just "album" for instance treeDescriptor.forEach(function (strPossibleKeys) {...
[ "function", "organizer", "(", "flat", ",", "tags", ",", "treeDescriptor", ",", "leafDescriptor", ")", "{", "var", "tree", "=", "{", "}", ";", "flat", ".", "forEach", "(", "function", "(", "song", ")", "{", "var", "treePtr", "=", "tree", ";", "var", "...
Returns a custom object tree corresponding to the descriptor
[ "Returns", "a", "custom", "object", "tree", "corresponding", "to", "the", "descriptor" ]
42e37f1ca0813d402ec27663b228340a8c2f3c0e
https://github.com/jotak/mipod/blob/42e37f1ca0813d402ec27663b228340a8c2f3c0e/javascript/Library.js#L480-L527
train
erikhagreis/fb-sdk-wrapper
lib/load.js
load
function load() { var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; params = (0, _lodash.defaults)({}, params, { locale: 'en_US' }); return new Promise(function (resolve, reject) { if (window.FB) { return resolve(window.FB); } var src = '//connect.faceb...
javascript
function load() { var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; params = (0, _lodash.defaults)({}, params, { locale: 'en_US' }); return new Promise(function (resolve, reject) { if (window.FB) { return resolve(window.FB); } var src = '//connect.faceb...
[ "function", "load", "(", ")", "{", "var", "params", "=", "arguments", ".", "length", ">", "0", "&&", "arguments", "[", "0", "]", "!==", "undefined", "?", "arguments", "[", "0", "]", ":", "{", "}", ";", "params", "=", "(", "0", ",", "_lodash", "."...
Injects the script for the FB JS SDK into the page. @param {Object} params containing optional settings @return {Promise} for the global window.FB object
[ "Injects", "the", "script", "for", "the", "FB", "JS", "SDK", "into", "the", "page", "." ]
dfaf53de1c11191c73ea9e8438a0542276996acf
https://github.com/erikhagreis/fb-sdk-wrapper/blob/dfaf53de1c11191c73ea9e8438a0542276996acf/lib/load.js#L17-L43
train
thlorenz/prange
prange.reverse.js
reverse
function reverse(combos) { const { offsuit, suited, pairs } = sortOut(combos) const ps = reversePairs(pairs) const os = reverseNonPairs(offsuit, 'o') const su = reverseNonPairs(suited, 's') const nonpairs = unsuitWhenPossible(new Set(os), new Set(su)) return ps.concat(nonpairs).join(', ') }
javascript
function reverse(combos) { const { offsuit, suited, pairs } = sortOut(combos) const ps = reversePairs(pairs) const os = reverseNonPairs(offsuit, 'o') const su = reverseNonPairs(suited, 's') const nonpairs = unsuitWhenPossible(new Set(os), new Set(su)) return ps.concat(nonpairs).join(', ') }
[ "function", "reverse", "(", "combos", ")", "{", "const", "{", "offsuit", ",", "suited", ",", "pairs", "}", "=", "sortOut", "(", "combos", ")", "const", "ps", "=", "reversePairs", "(", "pairs", ")", "const", "os", "=", "reverseNonPairs", "(", "offsuit", ...
Converts a poker hand range to short notation. It's the opposite of `prange`. @name prange.reverse @function @param {Array.<String>} combos hand combos to be converted to short notation @param {String} the short notation for the range
[ "Converts", "a", "poker", "hand", "range", "to", "short", "notation", ".", "It", "s", "the", "opposite", "of", "prange", "." ]
6cbf10c3594970a1e1a0de9400ae1ef9dadfdb4c
https://github.com/thlorenz/prange/blob/6cbf10c3594970a1e1a0de9400ae1ef9dadfdb4c/prange.reverse.js#L54-L63
train
prettier/prettier-linter-helpers
index.js
showInvisibles
function showInvisibles(str) { let ret = ''; for (let i = 0; i < str.length; i++) { switch (str[i]) { case ' ': ret += '·'; // Middle Dot, \u00B7 break; case '\n': ret += '⏎'; // Return Symbol, \u23ce break; case '\t': ret += '↹'; // Left Arrow To Bar Ov...
javascript
function showInvisibles(str) { let ret = ''; for (let i = 0; i < str.length; i++) { switch (str[i]) { case ' ': ret += '·'; // Middle Dot, \u00B7 break; case '\n': ret += '⏎'; // Return Symbol, \u23ce break; case '\t': ret += '↹'; // Left Arrow To Bar Ov...
[ "function", "showInvisibles", "(", "str", ")", "{", "let", "ret", "=", "''", ";", "for", "(", "let", "i", "=", "0", ";", "i", "<", "str", ".", "length", ";", "i", "++", ")", "{", "switch", "(", "str", "[", "i", "]", ")", "{", "case", "' '", ...
Converts invisible characters to a commonly recognizable visible form. @param {string} str - The string with invisibles to convert. @returns {string} The converted string.
[ "Converts", "invisible", "characters", "to", "a", "commonly", "recognizable", "visible", "form", "." ]
0c45ee13356f4d178def1c27ba22731bd93c563b
https://github.com/prettier/prettier-linter-helpers/blob/0c45ee13356f4d178def1c27ba22731bd93c563b/index.js#L10-L32
train
prettier/prettier-linter-helpers
index.js
generateDifferences
function generateDifferences(source, prettierSource) { // fast-diff returns the differences between two texts as a series of // INSERT, DELETE or EQUAL operations. The results occur only in these // sequences: // /-> INSERT -> EQUAL // EQUAL | /-> EQUAL // \-> DELETE | // ...
javascript
function generateDifferences(source, prettierSource) { // fast-diff returns the differences between two texts as a series of // INSERT, DELETE or EQUAL operations. The results occur only in these // sequences: // /-> INSERT -> EQUAL // EQUAL | /-> EQUAL // \-> DELETE | // ...
[ "function", "generateDifferences", "(", "source", ",", "prettierSource", ")", "{", "// fast-diff returns the differences between two texts as a series of", "// INSERT, DELETE or EQUAL operations. The results occur only in these", "// sequences:", "// /-> INSERT -> EQUAL", "// EQ...
Generate results for differences between source code and formatted version. @param {string} source - The original source. @param {string} prettierSource - The Prettier formatted source. @returns {Array} - An array containing { operation, offset, insertText, deleteText }
[ "Generate", "results", "for", "differences", "between", "source", "code", "and", "formatted", "version", "." ]
0c45ee13356f4d178def1c27ba22731bd93c563b
https://github.com/prettier/prettier-linter-helpers/blob/0c45ee13356f4d178def1c27ba22731bd93c563b/index.js#L41-L136
train
goliatone/influx-line-protocol-parser
lib/index.js
cast
function cast(value){ if(value === undefined) return undefined; /* * Integers: 344i */ if(value.match(/^\d+i$/m)){ value = value.slice(0, -1); return parseInt(value); } /* boolean true * t, T, true, True, or TRUE */ if(value.match(/^t$|^true$/im)){ re...
javascript
function cast(value){ if(value === undefined) return undefined; /* * Integers: 344i */ if(value.match(/^\d+i$/m)){ value = value.slice(0, -1); return parseInt(value); } /* boolean true * t, T, true, True, or TRUE */ if(value.match(/^t$|^true$/im)){ re...
[ "function", "cast", "(", "value", ")", "{", "if", "(", "value", "===", "undefined", ")", "return", "undefined", ";", "/*\n * Integers: 344i\n */", "if", "(", "value", ".", "match", "(", "/", "^\\d+i$", "/", "m", ")", ")", "{", "value", "=", "valu...
Cast each element in it's equivalent JS type. Note that for fields, without knowing the type it was stored as in InfluxDB we have to guess it's type. This can be an issue in cases where we have fields that are alphanumeric with a chance of having a instance being all digits. Tags are all strings. @param {Mixed} va...
[ "Cast", "each", "element", "in", "it", "s", "equivalent", "JS", "type", "." ]
f8c3c75ced9aaa7a39623449cd454bdb7e4c83df
https://github.com/goliatone/influx-line-protocol-parser/blob/f8c3c75ced9aaa7a39623449cd454bdb7e4c83df/lib/index.js#L151-L189
train
erikhagreis/fb-sdk-wrapper
lib/loadEnforcer.js
loadEnforcer
function loadEnforcer(method) { return function () { for (var _len = arguments.length, rest = Array(_len), _key = 0; _key < _len; _key++) { rest[_key] = arguments[_key]; } var FB = (0, _getGlobalFB2.default)(); if (!FB) { throw new Error('FB SDK Wrapper cannot call method ' + method.name ...
javascript
function loadEnforcer(method) { return function () { for (var _len = arguments.length, rest = Array(_len), _key = 0; _key < _len; _key++) { rest[_key] = arguments[_key]; } var FB = (0, _getGlobalFB2.default)(); if (!FB) { throw new Error('FB SDK Wrapper cannot call method ' + method.name ...
[ "function", "loadEnforcer", "(", "method", ")", "{", "return", "function", "(", ")", "{", "for", "(", "var", "_len", "=", "arguments", ".", "length", ",", "rest", "=", "Array", "(", "_len", ")", ",", "_key", "=", "0", ";", "_key", "<", "_len", ";",...
Injects the global FB SDK object into all methods in this package which depend on it. Throws an error if FB has not been loaded yet. @param {Function} method
[ "Injects", "the", "global", "FB", "SDK", "object", "into", "all", "methods", "in", "this", "package", "which", "depend", "on", "it", ".", "Throws", "an", "error", "if", "FB", "has", "not", "been", "loaded", "yet", "." ]
dfaf53de1c11191c73ea9e8438a0542276996acf
https://github.com/erikhagreis/fb-sdk-wrapper/blob/dfaf53de1c11191c73ea9e8438a0542276996acf/lib/loadEnforcer.js#L21-L34
train
hildjj/node-abnf
lib/abnf.js
rule
function rule() { var ret = this.seq(rulename, defined_as, elements, c_nl); var da = ret[2]; if (da === "=") { return this.rules.addRule(ret[1], ret[3]); } if (da === "=/") { return this.rules.addAlternate(ret[1], ret[3]); } return this.fail(); }
javascript
function rule() { var ret = this.seq(rulename, defined_as, elements, c_nl); var da = ret[2]; if (da === "=") { return this.rules.addRule(ret[1], ret[3]); } if (da === "=/") { return this.rules.addAlternate(ret[1], ret[3]); } return this.fail(); }
[ "function", "rule", "(", ")", "{", "var", "ret", "=", "this", ".", "seq", "(", "rulename", ",", "defined_as", ",", "elements", ",", "c_nl", ")", ";", "var", "da", "=", "ret", "[", "2", "]", ";", "if", "(", "da", "===", "\"=\"", ")", "{", "retur...
rule = rulename defined-as elements c-nl ; continues if next line starts ; with white space
[ "rule", "=", "rulename", "defined", "-", "as", "elements", "c", "-", "nl", ";", "continues", "if", "next", "line", "starts", ";", "with", "white", "space" ]
5c7046478f0965b54ab13057e33a65d780a83bc9
https://github.com/hildjj/node-abnf/blob/5c7046478f0965b54ab13057e33a65d780a83bc9/lib/abnf.js#L181-L192
train
kmalakoff/knockback-navigators
examples/vendor/knockback-core-stack-0.16.7.js
function(bindingsString, bindingContext) { try { var viewModel = bindingContext['$data'], scopes = (typeof viewModel == 'object' && viewModel != null) ? [viewModel, bindingContext] : [bindingContext], bindingFunction = createBindingsStringEvaluatorViaC...
javascript
function(bindingsString, bindingContext) { try { var viewModel = bindingContext['$data'], scopes = (typeof viewModel == 'object' && viewModel != null) ? [viewModel, bindingContext] : [bindingContext], bindingFunction = createBindingsStringEvaluatorViaC...
[ "function", "(", "bindingsString", ",", "bindingContext", ")", "{", "try", "{", "var", "viewModel", "=", "bindingContext", "[", "'$data'", "]", ",", "scopes", "=", "(", "typeof", "viewModel", "==", "'object'", "&&", "viewModel", "!=", "null", ")", "?", "["...
The following function is only used internally by this default provider. It's not part of the interface definition for a general binding provider.
[ "The", "following", "function", "is", "only", "used", "internally", "by", "this", "default", "provider", ".", "It", "s", "not", "part", "of", "the", "interface", "definition", "for", "a", "general", "binding", "provider", "." ]
6dd5344f2d1f8b95e91b31aa29a3dc56b5a36125
https://github.com/kmalakoff/knockback-navigators/blob/6dd5344f2d1f8b95e91b31aa29a3dc56b5a36125/examples/vendor/knockback-core-stack-0.16.7.js#L4333-L4342
train
kmalakoff/knockback-navigators
examples/vendor/knockback-core-stack-0.16.7.js
calculateEditDistanceMatrix
function calculateEditDistanceMatrix(oldArray, newArray, maxAllowedDistance) { var distances = []; for (var i = 0; i <= newArray.length; i++) distances[i] = []; // Top row - transform old array into empty array via deletions for (var i = 0, j = Math.min(oldArray.length, maxA...
javascript
function calculateEditDistanceMatrix(oldArray, newArray, maxAllowedDistance) { var distances = []; for (var i = 0; i <= newArray.length; i++) distances[i] = []; // Top row - transform old array into empty array via deletions for (var i = 0, j = Math.min(oldArray.length, maxA...
[ "function", "calculateEditDistanceMatrix", "(", "oldArray", ",", "newArray", ",", "maxAllowedDistance", ")", "{", "var", "distances", "=", "[", "]", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<=", "newArray", ".", "length", ";", "i", "++", ")", ...
Simple calculation based on Levenshtein distance.
[ "Simple", "calculation", "based", "on", "Levenshtein", "distance", "." ]
6dd5344f2d1f8b95e91b31aa29a3dc56b5a36125
https://github.com/kmalakoff/knockback-navigators/blob/6dd5344f2d1f8b95e91b31aa29a3dc56b5a36125/examples/vendor/knockback-core-stack-0.16.7.js#L5588-L5620
train
lambtron/medium-cli
lib/logger.js
log
function log(type, args, color){ pad(); var msg = format.apply(format, args); if (color) msg = chalk[color](msg); var pre = prefix(); console[type](pre, msg); }
javascript
function log(type, args, color){ pad(); var msg = format.apply(format, args); if (color) msg = chalk[color](msg); var pre = prefix(); console[type](pre, msg); }
[ "function", "log", "(", "type", ",", "args", ",", "color", ")", "{", "pad", "(", ")", ";", "var", "msg", "=", "format", ".", "apply", "(", "format", ",", "args", ")", ";", "if", "(", "color", ")", "msg", "=", "chalk", "[", "color", "]", "(", ...
Log by `type` with `args`. @param {String} type @param {Arguments} args @param {String} color
[ "Log", "by", "type", "with", "args", "." ]
a2d4baea4f5665e42dedd72b5ed7ae97f6de79eb
https://github.com/lambtron/medium-cli/blob/a2d4baea4f5665e42dedd72b5ed7ae97f6de79eb/lib/logger.js#L41-L47
train
kchapelier/decode-dxt
index.js
decode
function decode (imageDataView, width, height, format) { var result; format = format ? format.toLowerCase() : 'dxt1'; if (format === decode.dxt1) { result = decodeBC1(imageDataView, width, height); } else if(format === decode.dxt2) { result = decodeBC2(imageDataView, width, height, tru...
javascript
function decode (imageDataView, width, height, format) { var result; format = format ? format.toLowerCase() : 'dxt1'; if (format === decode.dxt1) { result = decodeBC1(imageDataView, width, height); } else if(format === decode.dxt2) { result = decodeBC2(imageDataView, width, height, tru...
[ "function", "decode", "(", "imageDataView", ",", "width", ",", "height", ",", "format", ")", "{", "var", "result", ";", "format", "=", "format", "?", "format", ".", "toLowerCase", "(", ")", ":", "'dxt1'", ";", "if", "(", "format", "===", "decode", ".",...
Decode a DXT image to RGBA data. @param {DataView} imageDataView A DataView pointing directly to the data of the DXT image @param {int} width Width of the image @param {int} height Height of the image @param {string} [format='dxt1'] Format of the image (dxt1, dxt2, dxt3, dxt4 or dxt5) @returns {Uint8Array} Decoded RGBA...
[ "Decode", "a", "DXT", "image", "to", "RGBA", "data", "." ]
254dfb0348b3fdc8b1e4df3bb7b74620dbddd2a4
https://github.com/kchapelier/decode-dxt/blob/254dfb0348b3fdc8b1e4df3bb7b74620dbddd2a4/index.js#L16-L36
train
doowb/async-helpers
examples/example.js
lower
function lower(str, options, cb) { // handle Handlebars or Lodash templates if (typeof options === 'function') { cb = options; options = {}; } cb(null, str.toLowerCase()); }
javascript
function lower(str, options, cb) { // handle Handlebars or Lodash templates if (typeof options === 'function') { cb = options; options = {}; } cb(null, str.toLowerCase()); }
[ "function", "lower", "(", "str", ",", "options", ",", "cb", ")", "{", "// handle Handlebars or Lodash templates", "if", "(", "typeof", "options", "===", "'function'", ")", "{", "cb", "=", "options", ";", "options", "=", "{", "}", ";", "}", "cb", "(", "nu...
some simple async helpers
[ "some", "simple", "async", "helpers" ]
ea33b6e2062ec49a9b4780f847f6f24eb52fd43e
https://github.com/doowb/async-helpers/blob/ea33b6e2062ec49a9b4780f847f6f24eb52fd43e/examples/example.js#L14-L21
train
dutchenkoOleg/node-w3c-validator
lib/render-html.js
extractParts
function extractParts (str, indexA, indexB) { let part = str.substr(indexA, indexB); part = part.replace(/</g, '&lt;').replace(/>/g, '&gt;'); part = part.replace(/\n/g, '<span class="invisible"> \u21A9</span>\n'); part = part.replace(/\t/g, '<span class="invisible tab">\u2192</span>'); return part; }
javascript
function extractParts (str, indexA, indexB) { let part = str.substr(indexA, indexB); part = part.replace(/</g, '&lt;').replace(/>/g, '&gt;'); part = part.replace(/\n/g, '<span class="invisible"> \u21A9</span>\n'); part = part.replace(/\t/g, '<span class="invisible tab">\u2192</span>'); return part; }
[ "function", "extractParts", "(", "str", ",", "indexA", ",", "indexB", ")", "{", "let", "part", "=", "str", ".", "substr", "(", "indexA", ",", "indexB", ")", ";", "part", "=", "part", ".", "replace", "(", "/", "<", "/", "g", ",", "'&lt;'", ")", "....
Get part of string and replace special symbols there @param {string} str @param {number} indexA @param {number} [indexB] @returns {string} @private @sourceCode
[ "Get", "part", "of", "string", "and", "replace", "special", "symbols", "there" ]
79bc6ee63bdfad0208c6c6d8dcd5e25a629b006e
https://github.com/dutchenkoOleg/node-w3c-validator/blob/79bc6ee63bdfad0208c6c6d8dcd5e25a629b006e/lib/render-html.js#L38-L45
train
Raynos/discovery-network
example/direct/static/index.js
handleStream
function handleStream(remotePeerId, stream) { if (opened[remotePeerId] !== true) { stream.write("hello!") stream.on("data", log) } function log(data) { console.log("[PEER2]", remotePeerId, data) } }
javascript
function handleStream(remotePeerId, stream) { if (opened[remotePeerId] !== true) { stream.write("hello!") stream.on("data", log) } function log(data) { console.log("[PEER2]", remotePeerId, data) } }
[ "function", "handleStream", "(", "remotePeerId", ",", "stream", ")", "{", "if", "(", "opened", "[", "remotePeerId", "]", "!==", "true", ")", "{", "stream", ".", "write", "(", "\"hello!\"", ")", "stream", ".", "on", "(", "\"data\"", ",", "log", ")", "}"...
When the relay emits a stream handle it
[ "When", "the", "relay", "emits", "a", "stream", "handle", "it" ]
fa61c50b2baf188be7abb7d1c684a01a9fc43690
https://github.com/Raynos/discovery-network/blob/fa61c50b2baf188be7abb7d1c684a01a9fc43690/example/direct/static/index.js#L34-L44
train
fullstackers/socket.io-logger
lib/index.js
Logger
function Logger (options) { if (!(this instanceof Logger)) return new Logger(options); options = options || {}; debug('new logger v%s', pkg.version); var router = Router(); router.on(function (sock, args, cb) { debug('logger args.length %s', arguments.length); try { // "this" is the "socket" ...
javascript
function Logger (options) { if (!(this instanceof Logger)) return new Logger(options); options = options || {}; debug('new logger v%s', pkg.version); var router = Router(); router.on(function (sock, args, cb) { debug('logger args.length %s', arguments.length); try { // "this" is the "socket" ...
[ "function", "Logger", "(", "options", ")", "{", "if", "(", "!", "(", "this", "instanceof", "Logger", ")", ")", "return", "new", "Logger", "(", "options", ")", ";", "options", "=", "options", "||", "{", "}", ";", "debug", "(", "'new logger v%s'", ",", ...
A very simple middleware for socket.io that will record the events and log them to a stream. @return Logger
[ "A", "very", "simple", "middleware", "for", "socket", ".", "io", "that", "will", "record", "the", "events", "and", "log", "them", "to", "a", "stream", "." ]
94e49139a84d804d46e8b2f1de350e73416b56ad
https://github.com/fullstackers/socket.io-logger/blob/94e49139a84d804d46e8b2f1de350e73416b56ad/lib/index.js#L16-L54
train
infusionsoft/bower-locker
bower-locker-unlock.js
unlock
function unlock(isVerbose) { if (isVerbose) { console.log('Start unlocking ...'); } // Load bower.json and make sure it is a locked bower.json file var bowerConfigStr = fs.readFileSync('bower.json', {encoding: 'utf8'}); var bowerConfig = JSON.parse(bowerConfigStr); if (!bowerConfig.bowe...
javascript
function unlock(isVerbose) { if (isVerbose) { console.log('Start unlocking ...'); } // Load bower.json and make sure it is a locked bower.json file var bowerConfigStr = fs.readFileSync('bower.json', {encoding: 'utf8'}); var bowerConfig = JSON.parse(bowerConfigStr); if (!bowerConfig.bowe...
[ "function", "unlock", "(", "isVerbose", ")", "{", "if", "(", "isVerbose", ")", "{", "console", ".", "log", "(", "'Start unlocking ...'", ")", ";", "}", "// Load bower.json and make sure it is a locked bower.json file", "var", "bowerConfigStr", "=", "fs", ".", "readF...
Function to unlock the `bower.json` file by returning it to its unlocked version The unlocked version is stored at `bower-locker.bower.json` @param {Boolean} isVerbose Flag to indicate whether we should log verbosely or not
[ "Function", "to", "unlock", "the", "bower", ".", "json", "file", "by", "returning", "it", "to", "its", "unlocked", "version", "The", "unlocked", "version", "is", "stored", "at", "bower", "-", "locker", ".", "bower", ".", "json" ]
9da98159684015ca872b4c35a1a72eb17ee93b37
https://github.com/infusionsoft/bower-locker/blob/9da98159684015ca872b4c35a1a72eb17ee93b37/bower-locker-unlock.js#L11-L31
train
andreypopp/rrouter
src/descriptors.js
Route
function Route(props) { props = props ? merge({}, props) : {}; var path = props.path; if (typeof path === 'string') { path = path.replace(slashes, ''); } delete props.path; var view = props.view; delete props.view; var viewPromise = props.viewPromise; delete props.viewPromise; var name = p...
javascript
function Route(props) { props = props ? merge({}, props) : {}; var path = props.path; if (typeof path === 'string') { path = path.replace(slashes, ''); } delete props.path; var view = props.view; delete props.view; var viewPromise = props.viewPromise; delete props.viewPromise; var name = p...
[ "function", "Route", "(", "props", ")", "{", "props", "=", "props", "?", "merge", "(", "{", "}", ",", "props", ")", ":", "{", "}", ";", "var", "path", "=", "props", ".", "path", ";", "if", "(", "typeof", "path", "===", "'string'", ")", "{", "pa...
Route desriptor constructor @param {Object} props @param {Object...} children @returns {Route}
[ "Route", "desriptor", "constructor" ]
4287dc666254af61f1d169c12fb61a1bfd7e2623
https://github.com/andreypopp/rrouter/blob/4287dc666254af61f1d169c12fb61a1bfd7e2623/src/descriptors.js#L17-L56
train
jay-hodgson/markdown-it-center-text
index.js
postProcess
function postProcess(state) { var i, foundStart = false, foundEnd = false, delim, token, delimiters = state.delimiters, max = state.delimiters.length; for (i = 0; i < max; i++) { delim = delimiters[i]; if (delim.marker === '->') { foundStart =...
javascript
function postProcess(state) { var i, foundStart = false, foundEnd = false, delim, token, delimiters = state.delimiters, max = state.delimiters.length; for (i = 0; i < max; i++) { delim = delimiters[i]; if (delim.marker === '->') { foundStart =...
[ "function", "postProcess", "(", "state", ")", "{", "var", "i", ",", "foundStart", "=", "false", ",", "foundEnd", "=", "false", ",", "delim", ",", "token", ",", "delimiters", "=", "state", ".", "delimiters", ",", "max", "=", "state", ".", "delimiters", ...
Walk through delimiter list and replace text tokens with tags
[ "Walk", "through", "delimiter", "list", "and", "replace", "text", "tokens", "with", "tags" ]
843d6cdda10699d045b0ba2dfe8fb6e7e06511ef
https://github.com/jay-hodgson/markdown-it-center-text/blob/843d6cdda10699d045b0ba2dfe8fb6e7e06511ef/index.js#L59-L101
train
zeljkoX/react-native-pseudo-localization
src/PseudoText.js
procesArray
function procesArray(array) { if (!array || !Array.isArray(array)) { return array; } return array.map((item, index) => { if (typeof item === "string") { return localizeString(item); } return item; }); }
javascript
function procesArray(array) { if (!array || !Array.isArray(array)) { return array; } return array.map((item, index) => { if (typeof item === "string") { return localizeString(item); } return item; }); }
[ "function", "procesArray", "(", "array", ")", "{", "if", "(", "!", "array", "||", "!", "Array", ".", "isArray", "(", "array", ")", ")", "{", "return", "array", ";", "}", "return", "array", ".", "map", "(", "(", "item", ",", "index", ")", "=>", "{...
flag to check if render is already overwritten process children array and localize strings
[ "flag", "to", "check", "if", "render", "is", "already", "overwritten", "process", "children", "array", "and", "localize", "strings" ]
96bae9ff62765a397ade9254ebd38e16396fba5f
https://github.com/zeljkoX/react-native-pseudo-localization/blob/96bae9ff62765a397ade9254ebd38e16396fba5f/src/PseudoText.js#L19-L29
train
zeljkoX/react-native-pseudo-localization
src/PseudoText.js
renderText
function renderText(args, that) { if (isNewTextVersion) { args[0] = { ...args[0], children: pseudoText(args[0].children) }; return defaultTextRender.apply(that, args); } else { const element = defaultTextRender.apply(that, args); return React.cloneElement(element, { children: pseudoText(elemen...
javascript
function renderText(args, that) { if (isNewTextVersion) { args[0] = { ...args[0], children: pseudoText(args[0].children) }; return defaultTextRender.apply(that, args); } else { const element = defaultTextRender.apply(that, args); return React.cloneElement(element, { children: pseudoText(elemen...
[ "function", "renderText", "(", "args", ",", "that", ")", "{", "if", "(", "isNewTextVersion", ")", "{", "args", "[", "0", "]", "=", "{", "...", "args", "[", "0", "]", ",", "children", ":", "pseudoText", "(", "args", "[", "0", "]", ".", "children", ...
React native text render logic
[ "React", "native", "text", "render", "logic" ]
96bae9ff62765a397ade9254ebd38e16396fba5f
https://github.com/zeljkoX/react-native-pseudo-localization/blob/96bae9ff62765a397ade9254ebd38e16396fba5f/src/PseudoText.js#L38-L48
train
zeljkoX/react-native-pseudo-localization
src/PseudoText.js
render
function render() { return function(...args) { return ( <PseudoContext.Consumer> {value => { if (!value) { return defaultTextRender.apply(this, args); } return renderText(args, this); }} </PseudoContext.Consumer> ); }; }
javascript
function render() { return function(...args) { return ( <PseudoContext.Consumer> {value => { if (!value) { return defaultTextRender.apply(this, args); } return renderText(args, this); }} </PseudoContext.Consumer> ); }; }
[ "function", "render", "(", ")", "{", "return", "function", "(", "...", "args", ")", "{", "return", "(", "<", "PseudoContext", ".", "Consumer", ">", "\n ", "{", "value", "=>", "{", "if", "(", "!", "value", ")", "{", "return", "defaultTextRender", ...
main render function that is connected to PseudoContext
[ "main", "render", "function", "that", "is", "connected", "to", "PseudoContext" ]
96bae9ff62765a397ade9254ebd38e16396fba5f
https://github.com/zeljkoX/react-native-pseudo-localization/blob/96bae9ff62765a397ade9254ebd38e16396fba5f/src/PseudoText.js#L51-L64
train
lambtron/medium-cli
lib/medium.js
clean
function clean(post) { return reject({ title: post.title, contentFormat: post.contentFormat, content: post.content, tags: post.tags, canonicalUrl: post.canonicalUrl, publishStatus: post.publishStatus, license: post.license }); }
javascript
function clean(post) { return reject({ title: post.title, contentFormat: post.contentFormat, content: post.content, tags: post.tags, canonicalUrl: post.canonicalUrl, publishStatus: post.publishStatus, license: post.license }); }
[ "function", "clean", "(", "post", ")", "{", "return", "reject", "(", "{", "title", ":", "post", ".", "title", ",", "contentFormat", ":", "post", ".", "contentFormat", ",", "content", ":", "post", ".", "content", ",", "tags", ":", "post", ".", "tags", ...
Remove unneeded attributes from `post`.
[ "Remove", "unneeded", "attributes", "from", "post", "." ]
a2d4baea4f5665e42dedd72b5ed7ae97f6de79eb
https://github.com/lambtron/medium-cli/blob/a2d4baea4f5665e42dedd72b5ed7ae97f6de79eb/lib/medium.js#L52-L62
train
andreypopp/rrouter
src/fetchViews.js
fetchViews
function fetchViews(match) { var activeTrace = match.activeTrace.map(fetchViewsStep); return activeTrace.some(Promise.is) ? Promise.all(activeTrace).then((activeTrace) => merge(match, {activeTrace})) : Promise.resolve(merge(match, {activeTrace})); }
javascript
function fetchViews(match) { var activeTrace = match.activeTrace.map(fetchViewsStep); return activeTrace.some(Promise.is) ? Promise.all(activeTrace).then((activeTrace) => merge(match, {activeTrace})) : Promise.resolve(merge(match, {activeTrace})); }
[ "function", "fetchViews", "(", "match", ")", "{", "var", "activeTrace", "=", "match", ".", "activeTrace", ".", "map", "(", "fetchViewsStep", ")", ";", "return", "activeTrace", ".", "some", "(", "Promise", ".", "is", ")", "?", "Promise", ".", "all", "(", ...
Fetch views for match @param {Match} match @returns {Match}
[ "Fetch", "views", "for", "match" ]
4287dc666254af61f1d169c12fb61a1bfd7e2623
https://github.com/andreypopp/rrouter/blob/4287dc666254af61f1d169c12fb61a1bfd7e2623/src/fetchViews.js#L22-L28
train
jacksonrayhamilton/tern-jsx
jsx.js
function (node) { var key = node.property || node.key; if (!node.computed && key.type === 'JSXIdentifier') { return key.name; } // Delegate to original method. return infer.propName.apply(infer, arguments); }
javascript
function (node) { var key = node.property || node.key; if (!node.computed && key.type === 'JSXIdentifier') { return key.name; } // Delegate to original method. return infer.propName.apply(infer, arguments); }
[ "function", "(", "node", ")", "{", "var", "key", "=", "node", ".", "property", "||", "node", ".", "key", ";", "if", "(", "!", "node", ".", "computed", "&&", "key", ".", "type", "===", "'JSXIdentifier'", ")", "{", "return", "key", ".", "name", ";", ...
infer.propName, but treat JSXIdentifier like Identifier.
[ "infer", ".", "propName", "but", "treat", "JSXIdentifier", "like", "Identifier", "." ]
6988e4c20363645ccc757b34d432c25a8340bd9c
https://github.com/jacksonrayhamilton/tern-jsx/blob/6988e4c20363645ccc757b34d432c25a8340bd9c/jsx.js#L55-L62
train
jacksonrayhamilton/tern-jsx
jsx.js
function (node, scope) { var finder = infer.typeFinder[node.type]; return finder ? finder(node, scope) : infer.ANull; }
javascript
function (node, scope) { var finder = infer.typeFinder[node.type]; return finder ? finder(node, scope) : infer.ANull; }
[ "function", "(", "node", ",", "scope", ")", "{", "var", "finder", "=", "infer", ".", "typeFinder", "[", "node", ".", "type", "]", ";", "return", "finder", "?", "finder", "(", "node", ",", "scope", ")", ":", "infer", ".", "ANull", ";", "}" ]
Re-implement Tern's internal findType.
[ "Re", "-", "implement", "Tern", "s", "internal", "findType", "." ]
6988e4c20363645ccc757b34d432c25a8340bd9c
https://github.com/jacksonrayhamilton/tern-jsx/blob/6988e4c20363645ccc757b34d432c25a8340bd9c/jsx.js#L65-L68
train
infusionsoft/bower-locker
bower-locker-status.js
status
function status(isVerbose) { // Load bower.json and make sure it is a locked bower.json file var bowerConfigStr = fs.readFileSync('bower.json', {encoding: 'utf8'}); var bowerConfig = JSON.parse(bowerConfigStr); var locked = bowerConfig.bowerLocker; if (locked) { var timeDiff = (new Date()).g...
javascript
function status(isVerbose) { // Load bower.json and make sure it is a locked bower.json file var bowerConfigStr = fs.readFileSync('bower.json', {encoding: 'utf8'}); var bowerConfig = JSON.parse(bowerConfigStr); var locked = bowerConfig.bowerLocker; if (locked) { var timeDiff = (new Date()).g...
[ "function", "status", "(", "isVerbose", ")", "{", "// Load bower.json and make sure it is a locked bower.json file", "var", "bowerConfigStr", "=", "fs", ".", "readFileSync", "(", "'bower.json'", ",", "{", "encoding", ":", "'utf8'", "}", ")", ";", "var", "bowerConfig",...
Function to output the current status of the `bower.json` file. Indicates whether it is locked, when it was locked, and if verbose the locked version of the dependencies. @param {Boolean} isVerbose Flag to indicate whether we should log verbosely or not
[ "Function", "to", "output", "the", "current", "status", "of", "the", "bower", ".", "json", "file", ".", "Indicates", "whether", "it", "is", "locked", "when", "it", "was", "locked", "and", "if", "verbose", "the", "locked", "version", "of", "the", "dependenc...
9da98159684015ca872b4c35a1a72eb17ee93b37
https://github.com/infusionsoft/bower-locker/blob/9da98159684015ca872b4c35a1a72eb17ee93b37/bower-locker-status.js#L35-L52
train