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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
iamisti/mdDataTable | dist/md-data-table.js | _processData | function _processData(){
if(_.isEmpty($scope.mdtRow)) {
return;
}
//local search/filter
if (angular.isUndefined($scope.mdtRowPaginator)) {
$scope.$watch('mdtRow', function (mdtRow) {
... | javascript | function _processData(){
if(_.isEmpty($scope.mdtRow)) {
return;
}
//local search/filter
if (angular.isUndefined($scope.mdtRowPaginator)) {
$scope.$watch('mdtRow', function (mdtRow) {
... | [
"function",
"_processData",
"(",
")",
"{",
"if",
"(",
"_",
".",
"isEmpty",
"(",
"$scope",
".",
"mdtRow",
")",
")",
"{",
"return",
";",
"}",
"//local search/filter",
"if",
"(",
"angular",
".",
"isUndefined",
"(",
"$scope",
".",
"mdtRowPaginator",
")",
")"... | fill storage with values if set | [
"fill",
"storage",
"with",
"values",
"if",
"set"
] | 85f0902f81912208514d5d9b334e90a7cec510fc | https://github.com/iamisti/mdDataTable/blob/85f0902f81912208514d5d9b334e90a7cec510fc/dist/md-data-table.js#L288-L303 | train |
iamisti/mdDataTable | demo/developmentArea.js | nutritionNameFilterCallback | function nutritionNameFilterCallback(names){
var arr = _.filter(nutritionList, function(item){
return item.fields.item_name.toLowerCase().indexOf(names.toLowerCase()) !== -1;
});
return $q.resolve(arr);
} | javascript | function nutritionNameFilterCallback(names){
var arr = _.filter(nutritionList, function(item){
return item.fields.item_name.toLowerCase().indexOf(names.toLowerCase()) !== -1;
});
return $q.resolve(arr);
} | [
"function",
"nutritionNameFilterCallback",
"(",
"names",
")",
"{",
"var",
"arr",
"=",
"_",
".",
"filter",
"(",
"nutritionList",
",",
"function",
"(",
"item",
")",
"{",
"return",
"item",
".",
"fields",
".",
"item_name",
".",
"toLowerCase",
"(",
")",
".",
... | name column filter functions | [
"name",
"column",
"filter",
"functions"
] | 85f0902f81912208514d5d9b334e90a7cec510fc | https://github.com/iamisti/mdDataTable/blob/85f0902f81912208514d5d9b334e90a7cec510fc/demo/developmentArea.js#L28-L34 | train |
iamisti/mdDataTable | demo/developmentArea.js | serviceUnitsFilterCallback | function serviceUnitsFilterCallback(){
var arr = _.filter(nutritionList, function(item){
return item.fields.nf_serving_size_unit && item.fields.nf_serving_size_unit.toLowerCase();
});
arr = _.uniq(arr, function(item){ return item.fields.nf_serving_size_unit;});
... | javascript | function serviceUnitsFilterCallback(){
var arr = _.filter(nutritionList, function(item){
return item.fields.nf_serving_size_unit && item.fields.nf_serving_size_unit.toLowerCase();
});
arr = _.uniq(arr, function(item){ return item.fields.nf_serving_size_unit;});
... | [
"function",
"serviceUnitsFilterCallback",
"(",
")",
"{",
"var",
"arr",
"=",
"_",
".",
"filter",
"(",
"nutritionList",
",",
"function",
"(",
"item",
")",
"{",
"return",
"item",
".",
"fields",
".",
"nf_serving_size_unit",
"&&",
"item",
".",
"fields",
".",
"n... | service units filter | [
"service",
"units",
"filter"
] | 85f0902f81912208514d5d9b334e90a7cec510fc | https://github.com/iamisti/mdDataTable/blob/85f0902f81912208514d5d9b334e90a7cec510fc/demo/developmentArea.js#L41-L49 | train |
iamisti/mdDataTable | demo/developmentArea.js | fatValuesCallback | function fatValuesCallback(){
return $q.resolve([
{
name: '> 50%',
comparator: function(val){ return val > 50;}
}, {
name: '<= 50%',
comparator: function(val){ return val <= 50;}
}... | javascript | function fatValuesCallback(){
return $q.resolve([
{
name: '> 50%',
comparator: function(val){ return val > 50;}
}, {
name: '<= 50%',
comparator: function(val){ return val <= 50;}
}... | [
"function",
"fatValuesCallback",
"(",
")",
"{",
"return",
"$q",
".",
"resolve",
"(",
"[",
"{",
"name",
":",
"'> 50%'",
",",
"comparator",
":",
"function",
"(",
"val",
")",
"{",
"return",
"val",
">",
"50",
";",
"}",
"}",
",",
"{",
"name",
":",
"'<= ... | fat values filter | [
"fat",
"values",
"filter"
] | 85f0902f81912208514d5d9b334e90a7cec510fc | https://github.com/iamisti/mdDataTable/blob/85f0902f81912208514d5d9b334e90a7cec510fc/demo/developmentArea.js#L56-L65 | train |
iamisti/mdDataTable | demo/developmentArea.js | paginatorCallback | function paginatorCallback(page, pageSize, options){
console.log(options);
var filtersApplied = options.columnFilter;
var offset = (page-1) * pageSize;
var result = nutritionList;
if(filtersApplied[0].length) {
result = _.filter(nutritionList... | javascript | function paginatorCallback(page, pageSize, options){
console.log(options);
var filtersApplied = options.columnFilter;
var offset = (page-1) * pageSize;
var result = nutritionList;
if(filtersApplied[0].length) {
result = _.filter(nutritionList... | [
"function",
"paginatorCallback",
"(",
"page",
",",
"pageSize",
",",
"options",
")",
"{",
"console",
".",
"log",
"(",
"options",
")",
";",
"var",
"filtersApplied",
"=",
"options",
".",
"columnFilter",
";",
"var",
"offset",
"=",
"(",
"page",
"-",
"1",
")",... | table search endpoint Don't look carefully the implementation details of this method, since it's just emulates an API call which increases the complexity of it. What happens here is just simply playing with the values passed with `filtersApplied` parameter, and trying to filter the array of nutritions. | [
"table",
"search",
"endpoint",
"Don",
"t",
"look",
"carefully",
"the",
"implementation",
"details",
"of",
"this",
"method",
"since",
"it",
"s",
"just",
"emulates",
"an",
"API",
"call",
"which",
"increases",
"the",
"complexity",
"of",
"it",
".",
"What",
"happ... | 85f0902f81912208514d5d9b334e90a7cec510fc | https://github.com/iamisti/mdDataTable/blob/85f0902f81912208514d5d9b334e90a7cec510fc/demo/developmentArea.js#L74-L137 | train |
wso2/carbon-dashboards | components/dashboards-web-component/src/utils/WidgetClassRegistry.js | extendsFromDeprecatedWidgetClassVersion | function extendsFromDeprecatedWidgetClassVersion(widgetClass) {
return Object.getPrototypeOf(widgetClass.prototype).constructor.version !== Widget.version;
} | javascript | function extendsFromDeprecatedWidgetClassVersion(widgetClass) {
return Object.getPrototypeOf(widgetClass.prototype).constructor.version !== Widget.version;
} | [
"function",
"extendsFromDeprecatedWidgetClassVersion",
"(",
"widgetClass",
")",
"{",
"return",
"Object",
".",
"getPrototypeOf",
"(",
"widgetClass",
".",
"prototype",
")",
".",
"constructor",
".",
"version",
"!==",
"Widget",
".",
"version",
";",
"}"
] | Following is to maintain backward compatibility with SP-4.0.0, SP-4.1.0
Checks whether given widget class extends from a deprecated version of @wso2-dashboards/widget class.
@param {class} widgetClass class to be checked
@returns {boolean} true if extend from a deprecated version of the Widget class, otherwise false
@... | [
"Following",
"is",
"to",
"maintain",
"backward",
"compatibility",
"with",
"SP",
"-",
"4",
".",
"0",
".",
"0",
"SP",
"-",
"4",
".",
"1",
".",
"0",
"Checks",
"whether",
"given",
"widget",
"class",
"extends",
"from",
"a",
"deprecated",
"version",
"of"
] | 9bbfd52d237f38dd3ade3455f78c9859ae506d20 | https://github.com/wso2/carbon-dashboards/blob/9bbfd52d237f38dd3ade3455f78c9859ae506d20/components/dashboards-web-component/src/utils/WidgetClassRegistry.js#L78-L80 | train |
wso2/carbon-dashboards | components/dashboards-web-component/src/utils/WidgetClassRegistry.js | patchWidgetClass | function patchWidgetClass(widgetClass) {
const superWidgetClassPrototype = Object.getPrototypeOf(widgetClass.prototype);
// Patch subscribe method.
superWidgetClassPrototype.subscribe = Widget.prototype.subscribe;
// Patch publish method.
superWidgetClassPrototype.publish = Widget.prototype.publish;... | javascript | function patchWidgetClass(widgetClass) {
const superWidgetClassPrototype = Object.getPrototypeOf(widgetClass.prototype);
// Patch subscribe method.
superWidgetClassPrototype.subscribe = Widget.prototype.subscribe;
// Patch publish method.
superWidgetClassPrototype.publish = Widget.prototype.publish;... | [
"function",
"patchWidgetClass",
"(",
"widgetClass",
")",
"{",
"const",
"superWidgetClassPrototype",
"=",
"Object",
".",
"getPrototypeOf",
"(",
"widgetClass",
".",
"prototype",
")",
";",
"// Patch subscribe method.",
"superWidgetClassPrototype",
".",
"subscribe",
"=",
"W... | Patches given widget class which extends from a deprecated version of @wso2-dashboards/widget class, to be
compatible with newer versions.
@param {class} widgetClass widget class to be patched
@private | [
"Patches",
"given",
"widget",
"class",
"which",
"extends",
"from",
"a",
"deprecated",
"version",
"of"
] | 9bbfd52d237f38dd3ade3455f78c9859ae506d20 | https://github.com/wso2/carbon-dashboards/blob/9bbfd52d237f38dd3ade3455f78c9859ae506d20/components/dashboards-web-component/src/utils/WidgetClassRegistry.js#L88-L94 | train |
mapbox/eslint-plugin-react-filenames | lib/rules/filename-matches-component.js | reportNonMatchingComponentName | function reportNonMatchingComponentName(node, rawName, name, filename) {
context.report(
node,
'Component name ' + rawName + ' (' + name + ') does not match filename ' + filename
);
} | javascript | function reportNonMatchingComponentName(node, rawName, name, filename) {
context.report(
node,
'Component name ' + rawName + ' (' + name + ') does not match filename ' + filename
);
} | [
"function",
"reportNonMatchingComponentName",
"(",
"node",
",",
"rawName",
",",
"name",
",",
"filename",
")",
"{",
"context",
".",
"report",
"(",
"node",
",",
"'Component name '",
"+",
"rawName",
"+",
"' ('",
"+",
"name",
"+",
"') does not match filename '",
"+"... | Reports missing display name for a given component
@param {Object} component The component to process | [
"Reports",
"missing",
"display",
"name",
"for",
"a",
"given",
"component"
] | d25030b865124f2f0555ba17b8f73a99c2111af0 | https://github.com/mapbox/eslint-plugin-react-filenames/blob/d25030b865124f2f0555ba17b8f73a99c2111af0/lib/rules/filename-matches-component.js#L69-L74 | train |
mapbox/watchbot-progress | lib/progress.js | client | function client(table) {
table = table || process.env.ProgressTable;
if (!table) throw new Error('ProgressTable environment variable is not set');
var dyno = module.exports.Dyno({
table: table.split(':')[5].split('/')[1],
region: table.split(':')[3],
endpoint: process.env.DynamoDbEndpoint
});
/*... | javascript | function client(table) {
table = table || process.env.ProgressTable;
if (!table) throw new Error('ProgressTable environment variable is not set');
var dyno = module.exports.Dyno({
table: table.split(':')[5].split('/')[1],
region: table.split(':')[3],
endpoint: process.env.DynamoDbEndpoint
});
/*... | [
"function",
"client",
"(",
"table",
")",
"{",
"table",
"=",
"table",
"||",
"process",
".",
"env",
".",
"ProgressTable",
";",
"if",
"(",
"!",
"table",
")",
"throw",
"new",
"Error",
"(",
"'ProgressTable environment variable is not set'",
")",
";",
"var",
"dyno... | mockable
Create a progress-tracking client
@param {string} [table] - the ARN for the DynamoDB table used to track progress.
If not provided, it will look for `$ProgessTable` environment variable, and
fail if neither is provided.
@returns {object} a progress client
@example
var progress = require('watchbot-progress').... | [
"mockable",
"Create",
"a",
"progress",
"-",
"tracking",
"client"
] | 34306c917e839b2c32999a39152402524599c5ad | https://github.com/mapbox/watchbot-progress/blob/34306c917e839b2c32999a39152402524599c5ad/lib/progress.js#L14-L117 | train |
mapbox/eslint-plugin-react-filenames | lib/util/Components.js | function(node) {
if (utils.isExplicitComponent(node)) {
return true;
}
if (!node.superClass) {
return false;
}
return new RegExp('^(' + pragma + '\\.)?(Pure)?Component$').test(sourceCode.getText(node.superClass));
} | javascript | function(node) {
if (utils.isExplicitComponent(node)) {
return true;
}
if (!node.superClass) {
return false;
}
return new RegExp('^(' + pragma + '\\.)?(Pure)?Component$').test(sourceCode.getText(node.superClass));
} | [
"function",
"(",
"node",
")",
"{",
"if",
"(",
"utils",
".",
"isExplicitComponent",
"(",
"node",
")",
")",
"{",
"return",
"true",
";",
"}",
"if",
"(",
"!",
"node",
".",
"superClass",
")",
"{",
"return",
"false",
";",
"}",
"return",
"new",
"RegExp",
... | Check if the node is a React ES6 component
@param {ASTNode} node The AST node being checked.
@returns {Boolean} True if the node is a React ES6 component, false if not | [
"Check",
"if",
"the",
"node",
"is",
"a",
"React",
"ES6",
"component"
] | d25030b865124f2f0555ba17b8f73a99c2111af0 | https://github.com/mapbox/eslint-plugin-react-filenames/blob/d25030b865124f2f0555ba17b8f73a99c2111af0/lib/util/Components.js#L166-L175 | train | |
mapbox/eslint-plugin-react-filenames | lib/util/Components.js | function(node) {
var comment = sourceCode.getJSDocComment(node);
if (comment === null) {
return false;
}
var commentAst = doctrine.parse(comment.value, {
unwrap: true,
tags: ['extends', 'augments']
});
var relevantTags = commentAst.tags.filter(function(tag)... | javascript | function(node) {
var comment = sourceCode.getJSDocComment(node);
if (comment === null) {
return false;
}
var commentAst = doctrine.parse(comment.value, {
unwrap: true,
tags: ['extends', 'augments']
});
var relevantTags = commentAst.tags.filter(function(tag)... | [
"function",
"(",
"node",
")",
"{",
"var",
"comment",
"=",
"sourceCode",
".",
"getJSDocComment",
"(",
"node",
")",
";",
"if",
"(",
"comment",
"===",
"null",
")",
"{",
"return",
"false",
";",
"}",
"var",
"commentAst",
"=",
"doctrine",
".",
"parse",
"(",
... | Check if the node is explicitly declared as a descendant of a React Component
@param {ASTNode} node The AST node being checked (can be a ReturnStatement or an ArrowFunctionExpression).
@returns {Boolean} True if the node is explicitly declared as a descendant of a React Component, false if not | [
"Check",
"if",
"the",
"node",
"is",
"explicitly",
"declared",
"as",
"a",
"descendant",
"of",
"a",
"React",
"Component"
] | d25030b865124f2f0555ba17b8f73a99c2111af0 | https://github.com/mapbox/eslint-plugin-react-filenames/blob/d25030b865124f2f0555ba17b8f73a99c2111af0/lib/util/Components.js#L183-L200 | train | |
mapbox/eslint-plugin-react-filenames | lib/util/Components.js | function (node) {
if (node.superClass) {
return new RegExp('^(' + pragma + '\\.)?PureComponent$').test(sourceCode.getText(node.superClass));
}
return false;
} | javascript | function (node) {
if (node.superClass) {
return new RegExp('^(' + pragma + '\\.)?PureComponent$').test(sourceCode.getText(node.superClass));
}
return false;
} | [
"function",
"(",
"node",
")",
"{",
"if",
"(",
"node",
".",
"superClass",
")",
"{",
"return",
"new",
"RegExp",
"(",
"'^('",
"+",
"pragma",
"+",
"'\\\\.)?PureComponent$'",
")",
".",
"test",
"(",
"sourceCode",
".",
"getText",
"(",
"node",
".",
"superClass",... | Checks to see if our component extends React.PureComponent
@param {ASTNode} node The AST node being checked.
@returns {Boolean} True if node extends React.PureComponent, false if not | [
"Checks",
"to",
"see",
"if",
"our",
"component",
"extends",
"React",
".",
"PureComponent"
] | d25030b865124f2f0555ba17b8f73a99c2111af0 | https://github.com/mapbox/eslint-plugin-react-filenames/blob/d25030b865124f2f0555ba17b8f73a99c2111af0/lib/util/Components.js#L208-L213 | train | |
mapbox/eslint-plugin-react-filenames | lib/util/Components.js | function(node) {
if (!node.value || !node.value.body || !node.value.body.body) {
return false;
}
var i = node.value.body.body.length - 1;
for (; i >= 0; i--) {
if (node.value.body.body[i].type === 'ReturnStatement') {
return node.value.body.body[i];
}
}
... | javascript | function(node) {
if (!node.value || !node.value.body || !node.value.body.body) {
return false;
}
var i = node.value.body.body.length - 1;
for (; i >= 0; i--) {
if (node.value.body.body[i].type === 'ReturnStatement') {
return node.value.body.body[i];
}
}
... | [
"function",
"(",
"node",
")",
"{",
"if",
"(",
"!",
"node",
".",
"value",
"||",
"!",
"node",
".",
"value",
".",
"body",
"||",
"!",
"node",
".",
"value",
".",
"body",
".",
"body",
")",
"{",
"return",
"false",
";",
"}",
"var",
"i",
"=",
"node",
... | Find a return statment in the current node
@param {ASTNode} ASTnode The AST node being checked | [
"Find",
"a",
"return",
"statment",
"in",
"the",
"current",
"node"
] | d25030b865124f2f0555ba17b8f73a99c2111af0 | https://github.com/mapbox/eslint-plugin-react-filenames/blob/d25030b865124f2f0555ba17b8f73a99c2111af0/lib/util/Components.js#L277-L288 | train | |
mapbox/eslint-plugin-react-filenames | lib/util/getTokenBeforeClosingBracket.js | getTokenBeforeClosingBracket | function getTokenBeforeClosingBracket(node) {
var attributes = node.attributes;
if (attributes.length === 0) {
return node.name;
}
return attributes[attributes.length - 1];
} | javascript | function getTokenBeforeClosingBracket(node) {
var attributes = node.attributes;
if (attributes.length === 0) {
return node.name;
}
return attributes[attributes.length - 1];
} | [
"function",
"getTokenBeforeClosingBracket",
"(",
"node",
")",
"{",
"var",
"attributes",
"=",
"node",
".",
"attributes",
";",
"if",
"(",
"attributes",
".",
"length",
"===",
"0",
")",
"{",
"return",
"node",
".",
"name",
";",
"}",
"return",
"attributes",
"[",... | Find the token before the closing bracket.
@param {ASTNode} node - The JSX element node.
@returns {Token} The token before the closing bracket. | [
"Find",
"the",
"token",
"before",
"the",
"closing",
"bracket",
"."
] | d25030b865124f2f0555ba17b8f73a99c2111af0 | https://github.com/mapbox/eslint-plugin-react-filenames/blob/d25030b865124f2f0555ba17b8f73a99c2111af0/lib/util/getTokenBeforeClosingBracket.js#L8-L14 | train |
espruino/EspruinoTools | libs/targz.js | function (chunks, start, end) {
var soff=0, eoff=0, i=0, j=0;
for (i=0; i<chunks.length; i++) {
if (soff + chunks[i].length > start)
break;
soff += chunks[i].length;
}
var strs = [];
eoff = soff;
for (j=i; j<chunks.length; j++) {
strs.push(chunks[j]);
if (eoff + c... | javascript | function (chunks, start, end) {
var soff=0, eoff=0, i=0, j=0;
for (i=0; i<chunks.length; i++) {
if (soff + chunks[i].length > start)
break;
soff += chunks[i].length;
}
var strs = [];
eoff = soff;
for (j=i; j<chunks.length; j++) {
strs.push(chunks[j]);
if (eoff + c... | [
"function",
"(",
"chunks",
",",
"start",
",",
"end",
")",
"{",
"var",
"soff",
"=",
"0",
",",
"eoff",
"=",
"0",
",",
"i",
"=",
"0",
",",
"j",
"=",
"0",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"chunks",
".",
"length",
";",
"i",
"++",... | extract substring from an array of strings | [
"extract",
"substring",
"from",
"an",
"array",
"of",
"strings"
] | e31e564ebf302c53c8a73aa7f58f5f42a33fe26e | https://github.com/espruino/EspruinoTools/blob/e31e564ebf302c53c8a73aa7f58f5f42a33fe26e/libs/targz.js#L113-L130 | train | |
espruino/EspruinoTools | plugins/minify.js | minifyCodeEsprima | function minifyCodeEsprima(code,callback,description) {
if ((typeof esprima == "undefined") ||
(typeof esmangle == "undefined") ||
(typeof escodegen == "undefined")) {
console.warn("esprima/esmangle/escodegen not defined - not minifying")
return callback(code);
}
var code, synta... | javascript | function minifyCodeEsprima(code,callback,description) {
if ((typeof esprima == "undefined") ||
(typeof esmangle == "undefined") ||
(typeof escodegen == "undefined")) {
console.warn("esprima/esmangle/escodegen not defined - not minifying")
return callback(code);
}
var code, synta... | [
"function",
"minifyCodeEsprima",
"(",
"code",
",",
"callback",
",",
"description",
")",
"{",
"if",
"(",
"(",
"typeof",
"esprima",
"==",
"\"undefined\"",
")",
"||",
"(",
"typeof",
"esmangle",
"==",
"\"undefined\"",
")",
"||",
"(",
"typeof",
"escodegen",
"==",... | Use the 'offline' Esprima compile | [
"Use",
"the",
"offline",
"Esprima",
"compile"
] | e31e564ebf302c53c8a73aa7f58f5f42a33fe26e | https://github.com/espruino/EspruinoTools/blob/e31e564ebf302c53c8a73aa7f58f5f42a33fe26e/plugins/minify.js#L118-L152 | train |
espruino/EspruinoTools | plugins/minify.js | minifyCodeGoogle | function minifyCodeGoogle(code, callback, minificationLevel, description){
for (var i in minifyCache) {
var item = minifyCache[i];
if (item.code==code && item.level==minificationLevel) {
console.log("Found code in minification cache - using that"+description);
// move to front of cache
... | javascript | function minifyCodeGoogle(code, callback, minificationLevel, description){
for (var i in minifyCache) {
var item = minifyCache[i];
if (item.code==code && item.level==minificationLevel) {
console.log("Found code in minification cache - using that"+description);
// move to front of cache
... | [
"function",
"minifyCodeGoogle",
"(",
"code",
",",
"callback",
",",
"minificationLevel",
",",
"description",
")",
"{",
"for",
"(",
"var",
"i",
"in",
"minifyCache",
")",
"{",
"var",
"item",
"=",
"minifyCache",
"[",
"i",
"]",
";",
"if",
"(",
"item",
".",
... | Use the 'online' Closure compiler | [
"Use",
"the",
"online",
"Closure",
"compiler"
] | e31e564ebf302c53c8a73aa7f58f5f42a33fe26e | https://github.com/espruino/EspruinoTools/blob/e31e564ebf302c53c8a73aa7f58f5f42a33fe26e/plugins/minify.js#L209-L241 | train |
espruino/EspruinoTools | espruino.js | initModule | function initModule(modName, mod) {
console.log("Initialising "+modName);
if (mod.init !== undefined)
mod.init();
} | javascript | function initModule(modName, mod) {
console.log("Initialising "+modName);
if (mod.init !== undefined)
mod.init();
} | [
"function",
"initModule",
"(",
"modName",
",",
"mod",
")",
"{",
"console",
".",
"log",
"(",
"\"Initialising \"",
"+",
"modName",
")",
";",
"if",
"(",
"mod",
".",
"init",
"!==",
"undefined",
")",
"mod",
".",
"init",
"(",
")",
";",
"}"
] | Initialise all modules | [
"Initialise",
"all",
"modules"
] | e31e564ebf302c53c8a73aa7f58f5f42a33fe26e | https://github.com/espruino/EspruinoTools/blob/e31e564ebf302c53c8a73aa7f58f5f42a33fe26e/espruino.js#L45-L49 | train |
espruino/EspruinoTools | espruino.js | callProcessor | function callProcessor(eventType, data, callback) {
var p = processors[eventType];
// no processors
if (p===undefined || p.length==0) {
if (callback!==undefined) callback(data);
return;
}
// now go through all processors
var n = 0;
var cbCalled = false;
var cb = function(inDa... | javascript | function callProcessor(eventType, data, callback) {
var p = processors[eventType];
// no processors
if (p===undefined || p.length==0) {
if (callback!==undefined) callback(data);
return;
}
// now go through all processors
var n = 0;
var cbCalled = false;
var cb = function(inDa... | [
"function",
"callProcessor",
"(",
"eventType",
",",
"data",
",",
"callback",
")",
"{",
"var",
"p",
"=",
"processors",
"[",
"eventType",
"]",
";",
"// no processors",
"if",
"(",
"p",
"===",
"undefined",
"||",
"p",
".",
"length",
"==",
"0",
")",
"{",
"if... | Call a processor function | [
"Call",
"a",
"processor",
"function"
] | e31e564ebf302c53c8a73aa7f58f5f42a33fe26e | https://github.com/espruino/EspruinoTools/blob/e31e564ebf302c53c8a73aa7f58f5f42a33fe26e/espruino.js#L80-L101 | train |
espruino/EspruinoTools | core/config.js | getSections | function getSections() {
var sections = [];
// add sections we know about
for (var name in builtinSections)
sections.push(builtinSections[name]);
// add other sections
for (var i in Espruino.Core.Config.data) {
var c = Espruino.Core.Config.data[i];
var found = false;
f... | javascript | function getSections() {
var sections = [];
// add sections we know about
for (var name in builtinSections)
sections.push(builtinSections[name]);
// add other sections
for (var i in Espruino.Core.Config.data) {
var c = Espruino.Core.Config.data[i];
var found = false;
f... | [
"function",
"getSections",
"(",
")",
"{",
"var",
"sections",
"=",
"[",
"]",
";",
"// add sections we know about",
"for",
"(",
"var",
"name",
"in",
"builtinSections",
")",
"sections",
".",
"push",
"(",
"builtinSections",
"[",
"name",
"]",
")",
";",
"// add ot... | Get an object containing information on all 'sections' used in all the configs | [
"Get",
"an",
"object",
"containing",
"information",
"on",
"all",
"sections",
"used",
"in",
"all",
"the",
"configs"
] | e31e564ebf302c53c8a73aa7f58f5f42a33fe26e | https://github.com/espruino/EspruinoTools/blob/e31e564ebf302c53c8a73aa7f58f5f42a33fe26e/core/config.js#L122-L148 | train |
espruino/EspruinoTools | core/utils.js | countBrackets | function countBrackets(str) {
var lex = getLexer(str);
var brackets = 0;
var tok = lex.next();
while (tok!==undefined) {
if (tok.str=="(" || tok.str=="{" || tok.str=="[") brackets++;
if (tok.str==")" || tok.str=="}" || tok.str=="]") brackets--;
tok = lex.next();
}
return bracke... | javascript | function countBrackets(str) {
var lex = getLexer(str);
var brackets = 0;
var tok = lex.next();
while (tok!==undefined) {
if (tok.str=="(" || tok.str=="{" || tok.str=="[") brackets++;
if (tok.str==")" || tok.str=="}" || tok.str=="]") brackets--;
tok = lex.next();
}
return bracke... | [
"function",
"countBrackets",
"(",
"str",
")",
"{",
"var",
"lex",
"=",
"getLexer",
"(",
"str",
")",
";",
"var",
"brackets",
"=",
"0",
";",
"var",
"tok",
"=",
"lex",
".",
"next",
"(",
")",
";",
"while",
"(",
"tok",
"!==",
"undefined",
")",
"{",
"if... | Count brackets in a string - will be 0 if all are closed | [
"Count",
"brackets",
"in",
"a",
"string",
"-",
"will",
"be",
"0",
"if",
"all",
"are",
"closed"
] | e31e564ebf302c53c8a73aa7f58f5f42a33fe26e | https://github.com/espruino/EspruinoTools/blob/e31e564ebf302c53c8a73aa7f58f5f42a33fe26e/core/utils.js#L171-L181 | train |
espruino/EspruinoTools | core/utils.js | getEspruinoPrompt | function getEspruinoPrompt(callback) {
if (Espruino.Core.Terminal!==undefined &&
Espruino.Core.Terminal.getTerminalLine()==">") {
console.log("Found a prompt... great!");
return callback();
}
var receivedData = "";
var prevReader = Espruino.Core.Serial.startListening(function (readD... | javascript | function getEspruinoPrompt(callback) {
if (Espruino.Core.Terminal!==undefined &&
Espruino.Core.Terminal.getTerminalLine()==">") {
console.log("Found a prompt... great!");
return callback();
}
var receivedData = "";
var prevReader = Espruino.Core.Serial.startListening(function (readD... | [
"function",
"getEspruinoPrompt",
"(",
"callback",
")",
"{",
"if",
"(",
"Espruino",
".",
"Core",
".",
"Terminal",
"!==",
"undefined",
"&&",
"Espruino",
".",
"Core",
".",
"Terminal",
".",
"getTerminalLine",
"(",
")",
"==",
"\">\"",
")",
"{",
"console",
".",
... | Try and get a prompt from Espruino - if we don't see one, issue Ctrl-C
and hope it comes back. Calls callback with first argument true if it
had to Ctrl-C out | [
"Try",
"and",
"get",
"a",
"prompt",
"from",
"Espruino",
"-",
"if",
"we",
"don",
"t",
"see",
"one",
"issue",
"Ctrl",
"-",
"C",
"and",
"hope",
"it",
"comes",
"back",
".",
"Calls",
"callback",
"with",
"first",
"argument",
"true",
"if",
"it",
"had",
"to"... | e31e564ebf302c53c8a73aa7f58f5f42a33fe26e | https://github.com/espruino/EspruinoTools/blob/e31e564ebf302c53c8a73aa7f58f5f42a33fe26e/core/utils.js#L186-L239 | train |
espruino/EspruinoTools | core/utils.js | executeExpression | function executeExpression(expressionToExecute, callback) {
var receivedData = "";
var hadDataSinceTimeout = false;
function getProcessInfo(expressionToExecute, callback) {
var prevReader = Espruino.Core.Serial.startListening(function (readData) {
var bufView = new Uint8Array(readData);
... | javascript | function executeExpression(expressionToExecute, callback) {
var receivedData = "";
var hadDataSinceTimeout = false;
function getProcessInfo(expressionToExecute, callback) {
var prevReader = Espruino.Core.Serial.startListening(function (readData) {
var bufView = new Uint8Array(readData);
... | [
"function",
"executeExpression",
"(",
"expressionToExecute",
",",
"callback",
")",
"{",
"var",
"receivedData",
"=",
"\"\"",
";",
"var",
"hadDataSinceTimeout",
"=",
"false",
";",
"function",
"getProcessInfo",
"(",
"expressionToExecute",
",",
"callback",
")",
"{",
"... | Return the value of executing an expression on the board | [
"Return",
"the",
"value",
"of",
"executing",
"an",
"expression",
"on",
"the",
"board"
] | e31e564ebf302c53c8a73aa7f58f5f42a33fe26e | https://github.com/espruino/EspruinoTools/blob/e31e564ebf302c53c8a73aa7f58f5f42a33fe26e/core/utils.js#L242-L316 | train |
espruino/EspruinoTools | core/utils.js | isRecognisedBluetoothDevice | function isRecognisedBluetoothDevice(name) {
if (!name) return false;
var devs = recognisedBluetoothDevices();
for (var i=0;i<devs.length;i++)
if (name.substr(0, devs[i].length) == devs[i])
return true;
return false;
} | javascript | function isRecognisedBluetoothDevice(name) {
if (!name) return false;
var devs = recognisedBluetoothDevices();
for (var i=0;i<devs.length;i++)
if (name.substr(0, devs[i].length) == devs[i])
return true;
return false;
} | [
"function",
"isRecognisedBluetoothDevice",
"(",
"name",
")",
"{",
"if",
"(",
"!",
"name",
")",
"return",
"false",
";",
"var",
"devs",
"=",
"recognisedBluetoothDevices",
"(",
")",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"devs",
".",
"lengt... | If we can't find service info, add devices
based only on their name | [
"If",
"we",
"can",
"t",
"find",
"service",
"info",
"add",
"devices",
"based",
"only",
"on",
"their",
"name"
] | e31e564ebf302c53c8a73aa7f58f5f42a33fe26e | https://github.com/espruino/EspruinoTools/blob/e31e564ebf302c53c8a73aa7f58f5f42a33fe26e/core/utils.js#L482-L489 | train |
espruino/EspruinoTools | core/utils.js | stringToArrayBuffer | function stringToArrayBuffer(str) {
var buf=new Uint8Array(str.length);
for (var i=0; i<str.length; i++) {
var ch = str.charCodeAt(i);
if (ch>=256) {
console.warn("stringToArrayBuffer got non-8 bit character - code "+ch);
ch = "?".charCodeAt(0);
}
buf[i] = ch;
}
r... | javascript | function stringToArrayBuffer(str) {
var buf=new Uint8Array(str.length);
for (var i=0; i<str.length; i++) {
var ch = str.charCodeAt(i);
if (ch>=256) {
console.warn("stringToArrayBuffer got non-8 bit character - code "+ch);
ch = "?".charCodeAt(0);
}
buf[i] = ch;
}
r... | [
"function",
"stringToArrayBuffer",
"(",
"str",
")",
"{",
"var",
"buf",
"=",
"new",
"Uint8Array",
"(",
"str",
".",
"length",
")",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"str",
".",
"length",
";",
"i",
"++",
")",
"{",
"var",
"ch",
... | Converts a string to an ArrayBuffer | [
"Converts",
"a",
"string",
"to",
"an",
"ArrayBuffer"
] | e31e564ebf302c53c8a73aa7f58f5f42a33fe26e | https://github.com/espruino/EspruinoTools/blob/e31e564ebf302c53c8a73aa7f58f5f42a33fe26e/core/utils.js#L515-L526 | train |
espruino/EspruinoTools | core/utils.js | stringToBuffer | function stringToBuffer(str) {
var buf = new Buffer(str.length);
for (var i = 0; i < buf.length; i++) {
buf.writeUInt8(str.charCodeAt(i), i);
}
return buf;
} | javascript | function stringToBuffer(str) {
var buf = new Buffer(str.length);
for (var i = 0; i < buf.length; i++) {
buf.writeUInt8(str.charCodeAt(i), i);
}
return buf;
} | [
"function",
"stringToBuffer",
"(",
"str",
")",
"{",
"var",
"buf",
"=",
"new",
"Buffer",
"(",
"str",
".",
"length",
")",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"buf",
".",
"length",
";",
"i",
"++",
")",
"{",
"buf",
".",
"writeUInt... | Converts a string to a Buffer | [
"Converts",
"a",
"string",
"to",
"a",
"Buffer"
] | e31e564ebf302c53c8a73aa7f58f5f42a33fe26e | https://github.com/espruino/EspruinoTools/blob/e31e564ebf302c53c8a73aa7f58f5f42a33fe26e/core/utils.js#L529-L535 | train |
espruino/EspruinoTools | core/utils.js | dataViewToArrayBuffer | function dataViewToArrayBuffer(str) {
var bufView = new Uint8Array(dv.byteLength);
for (var i = 0; i < bufView.length; i++) {
bufView[i] = dv.getUint8(i);
}
return bufView.buffer;
} | javascript | function dataViewToArrayBuffer(str) {
var bufView = new Uint8Array(dv.byteLength);
for (var i = 0; i < bufView.length; i++) {
bufView[i] = dv.getUint8(i);
}
return bufView.buffer;
} | [
"function",
"dataViewToArrayBuffer",
"(",
"str",
")",
"{",
"var",
"bufView",
"=",
"new",
"Uint8Array",
"(",
"dv",
".",
"byteLength",
")",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"bufView",
".",
"length",
";",
"i",
"++",
")",
"{",
"buf... | Converts a DataView to an ArrayBuffer | [
"Converts",
"a",
"DataView",
"to",
"an",
"ArrayBuffer"
] | e31e564ebf302c53c8a73aa7f58f5f42a33fe26e | https://github.com/espruino/EspruinoTools/blob/e31e564ebf302c53c8a73aa7f58f5f42a33fe26e/core/utils.js#L538-L544 | train |
espruino/EspruinoTools | core/modules.js | moduleLoaded | function moduleLoaded(resolve, requires, modName, data, loadedModuleData, alreadyMinified){
// Check for any modules used from this module that we don't already have
var newRequires = getModulesRequired(data);
console.log(" - "+modName+" requires "+JSON.stringify(newRequires));
// if we need new modules... | javascript | function moduleLoaded(resolve, requires, modName, data, loadedModuleData, alreadyMinified){
// Check for any modules used from this module that we don't already have
var newRequires = getModulesRequired(data);
console.log(" - "+modName+" requires "+JSON.stringify(newRequires));
// if we need new modules... | [
"function",
"moduleLoaded",
"(",
"resolve",
",",
"requires",
",",
"modName",
",",
"data",
",",
"loadedModuleData",
",",
"alreadyMinified",
")",
"{",
"// Check for any modules used from this module that we don't already have",
"var",
"newRequires",
"=",
"getModulesRequired",
... | Called from loadModule when a module is loaded. Parse it for other modules it might use
and resolve dfd after all submodules have been loaded | [
"Called",
"from",
"loadModule",
"when",
"a",
"module",
"is",
"loaded",
".",
"Parse",
"it",
"for",
"other",
"modules",
"it",
"might",
"use",
"and",
"resolve",
"dfd",
"after",
"all",
"submodules",
"have",
"been",
"loaded"
] | e31e564ebf302c53c8a73aa7f58f5f42a33fe26e | https://github.com/espruino/EspruinoTools/blob/e31e564ebf302c53c8a73aa7f58f5f42a33fe26e/core/modules.js#L170-L199 | train |
espruino/EspruinoTools | core/modules.js | loadModules | function loadModules(code, callback){
var loadedModuleData = [];
var requires = getModulesRequired(code);
if (requires.length == 0) {
// no modules needed - just return
callback(code);
} else {
Espruino.Core.Status.setStatus("Loading modules");
// Kick off the module loading (eac... | javascript | function loadModules(code, callback){
var loadedModuleData = [];
var requires = getModulesRequired(code);
if (requires.length == 0) {
// no modules needed - just return
callback(code);
} else {
Espruino.Core.Status.setStatus("Loading modules");
// Kick off the module loading (eac... | [
"function",
"loadModules",
"(",
"code",
",",
"callback",
")",
"{",
"var",
"loadedModuleData",
"=",
"[",
"]",
";",
"var",
"requires",
"=",
"getModulesRequired",
"(",
"code",
")",
";",
"if",
"(",
"requires",
".",
"length",
"==",
"0",
")",
"{",
"// no modul... | Finds instances of 'require' and then ensures that
those modules are loaded into the module cache beforehand
(by inserting the relevant 'addCached' commands into 'code' | [
"Finds",
"instances",
"of",
"require",
"and",
"then",
"ensures",
"that",
"those",
"modules",
"are",
"loaded",
"into",
"the",
"module",
"cache",
"beforehand",
"(",
"by",
"inserting",
"the",
"relevant",
"addCached",
"commands",
"into",
"code"
] | e31e564ebf302c53c8a73aa7f58f5f42a33fe26e | https://github.com/espruino/EspruinoTools/blob/e31e564ebf302c53c8a73aa7f58f5f42a33fe26e/core/modules.js#L223-L240 | train |
espruino/EspruinoTools | bin/espruino-cli.js | makeJobFile | function makeJobFile(config) {
var job = {"espruino":{}};
// assign commandline values
for (var key in args) {
switch (key) {
case 'job': // remove job itself, and others set internally from the results
case 'espruinoPrefix':
case 'espruinoPostfix':
break;
default: job[key] = a... | javascript | function makeJobFile(config) {
var job = {"espruino":{}};
// assign commandline values
for (var key in args) {
switch (key) {
case 'job': // remove job itself, and others set internally from the results
case 'espruinoPrefix':
case 'espruinoPostfix':
break;
default: job[key] = a... | [
"function",
"makeJobFile",
"(",
"config",
")",
"{",
"var",
"job",
"=",
"{",
"\"espruino\"",
":",
"{",
"}",
"}",
";",
"// assign commandline values",
"for",
"(",
"var",
"key",
"in",
"args",
")",
"{",
"switch",
"(",
"key",
")",
"{",
"case",
"'job'",
":",... | create a job file from commandline settings | [
"create",
"a",
"job",
"file",
"from",
"commandline",
"settings"
] | e31e564ebf302c53c8a73aa7f58f5f42a33fe26e | https://github.com/espruino/EspruinoTools/blob/e31e564ebf302c53c8a73aa7f58f5f42a33fe26e/bin/espruino-cli.js#L366-L388 | train |
espruino/EspruinoTools | core/env.js | getBoardList | function getBoardList(callback) {
var jsonDir = Espruino.Config.BOARD_JSON_URL;
// ensure jsonDir ends with slash
if (jsonDir.indexOf('/', jsonDir.length - 1) === -1) {
jsonDir += '/';
}
Espruino.Core.Utils.getJSONURL(jsonDir + "boards.json", function(boards){
// now load all the indiv... | javascript | function getBoardList(callback) {
var jsonDir = Espruino.Config.BOARD_JSON_URL;
// ensure jsonDir ends with slash
if (jsonDir.indexOf('/', jsonDir.length - 1) === -1) {
jsonDir += '/';
}
Espruino.Core.Utils.getJSONURL(jsonDir + "boards.json", function(boards){
// now load all the indiv... | [
"function",
"getBoardList",
"(",
"callback",
")",
"{",
"var",
"jsonDir",
"=",
"Espruino",
".",
"Config",
".",
"BOARD_JSON_URL",
";",
"// ensure jsonDir ends with slash",
"if",
"(",
"jsonDir",
".",
"indexOf",
"(",
"'/'",
",",
"jsonDir",
".",
"length",
"-",
"1",... | Get a list of boards that we know about | [
"Get",
"a",
"list",
"of",
"boards",
"that",
"we",
"know",
"about"
] | e31e564ebf302c53c8a73aa7f58f5f42a33fe26e | https://github.com/espruino/EspruinoTools/blob/e31e564ebf302c53c8a73aa7f58f5f42a33fe26e/core/env.js#L99-L127 | train |
moleculerjs/moleculer-cli | src/alias-template/index.js | handler | function handler(opts) {
Object.assign(values, opts);
const configPath = path.join(os.homedir(), ".moleculer-templates.json");
return (
Promise.resolve()
//check for existing template alias config file
.then(() => {
return new Promise((resolve, reject) => {
fs.exists(configPath, exists => {
i... | javascript | function handler(opts) {
Object.assign(values, opts);
const configPath = path.join(os.homedir(), ".moleculer-templates.json");
return (
Promise.resolve()
//check for existing template alias config file
.then(() => {
return new Promise((resolve, reject) => {
fs.exists(configPath, exists => {
i... | [
"function",
"handler",
"(",
"opts",
")",
"{",
"Object",
".",
"assign",
"(",
"values",
",",
"opts",
")",
";",
"const",
"configPath",
"=",
"path",
".",
"join",
"(",
"os",
".",
"homedir",
"(",
")",
",",
"\".moleculer-templates.json\"",
")",
";",
"return",
... | Handler for yards command
@param {any} opts | [
"Handler",
"for",
"yards",
"command"
] | 0a607efbc929e3e2bb2b50ebee413e7a5ecd6d30 | https://github.com/moleculerjs/moleculer-cli/blob/0a607efbc929e3e2bb2b50ebee413e7a5ecd6d30/src/alias-template/index.js#L27-L75 | train |
moleculerjs/moleculer-cli | src/init/index.js | renderTemplate | function renderTemplate(skipInterpolation) {
skipInterpolation = typeof skipInterpolation === "string" ? [skipInterpolation] : skipInterpolation;
const handlebarsMatcher = /{{([^{}]+)}}/;
return function (files, metalsmith, done) {
const keys = Object.keys(files);
const metadata = metalsmith.metadata();
asyn... | javascript | function renderTemplate(skipInterpolation) {
skipInterpolation = typeof skipInterpolation === "string" ? [skipInterpolation] : skipInterpolation;
const handlebarsMatcher = /{{([^{}]+)}}/;
return function (files, metalsmith, done) {
const keys = Object.keys(files);
const metadata = metalsmith.metadata();
asyn... | [
"function",
"renderTemplate",
"(",
"skipInterpolation",
")",
"{",
"skipInterpolation",
"=",
"typeof",
"skipInterpolation",
"===",
"\"string\"",
"?",
"[",
"skipInterpolation",
"]",
":",
"skipInterpolation",
";",
"const",
"handlebarsMatcher",
"=",
"/",
"{{([^{}]+)}}",
"... | Render a template file with handlebars | [
"Render",
"a",
"template",
"file",
"with",
"handlebars"
] | 0a607efbc929e3e2bb2b50ebee413e7a5ecd6d30 | https://github.com/moleculerjs/moleculer-cli/blob/0a607efbc929e3e2bb2b50ebee413e7a5ecd6d30/src/init/index.js#L295-L353 | train |
moleculerjs/moleculer-cli | src/init/index.js | function (callback) {
const str = files[file].contents.toString();
if (!handlebarsMatcher.test(str)) {
return callback();
}
render(str, metadata, function (err, res) {
if (err) return callback(err);
files[file].contents = Buffer.from(res);
callback();
});
} | javascript | function (callback) {
const str = files[file].contents.toString();
if (!handlebarsMatcher.test(str)) {
return callback();
}
render(str, metadata, function (err, res) {
if (err) return callback(err);
files[file].contents = Buffer.from(res);
callback();
});
} | [
"function",
"(",
"callback",
")",
"{",
"const",
"str",
"=",
"files",
"[",
"file",
"]",
".",
"contents",
".",
"toString",
"(",
")",
";",
"if",
"(",
"!",
"handlebarsMatcher",
".",
"test",
"(",
"str",
")",
")",
"{",
"return",
"callback",
"(",
")",
";"... | interpolate the file contents | [
"interpolate",
"the",
"file",
"contents"
] | 0a607efbc929e3e2bb2b50ebee413e7a5ecd6d30 | https://github.com/moleculerjs/moleculer-cli/blob/0a607efbc929e3e2bb2b50ebee413e7a5ecd6d30/src/init/index.js#L313-L324 | train | |
moleculerjs/moleculer-cli | src/init/index.js | function (callback) {
if (!handlebarsMatcher.test(file)) {
return callback();
}
render(file, metadata, function (err, res) {
if (err) return callback(err);
// safety check to prevent file deletion in case filename doesn't change
if (file === res) return callback();
// safet... | javascript | function (callback) {
if (!handlebarsMatcher.test(file)) {
return callback();
}
render(file, metadata, function (err, res) {
if (err) return callback(err);
// safety check to prevent file deletion in case filename doesn't change
if (file === res) return callback();
// safet... | [
"function",
"(",
"callback",
")",
"{",
"if",
"(",
"!",
"handlebarsMatcher",
".",
"test",
"(",
"file",
")",
")",
"{",
"return",
"callback",
"(",
")",
";",
"}",
"render",
"(",
"file",
",",
"metadata",
",",
"function",
"(",
"err",
",",
"res",
")",
"{"... | interpolate the file name | [
"interpolate",
"the",
"file",
"name"
] | 0a607efbc929e3e2bb2b50ebee413e7a5ecd6d30 | https://github.com/moleculerjs/moleculer-cli/blob/0a607efbc929e3e2bb2b50ebee413e7a5ecd6d30/src/init/index.js#L327-L345 | train | |
bitshares/bitsharesjs-ws | lib/src/ChainConfig.js | function(chain_id) {
let i, len, network, network_name, ref;
ref = Object.keys(_this.networks);
for (i = 0, len = ref.length; i < len; i++) {
network_name = ref[i];
network = _this.networks[network_name];
if (network.chain_id === chain_id) {
... | javascript | function(chain_id) {
let i, len, network, network_name, ref;
ref = Object.keys(_this.networks);
for (i = 0, len = ref.length; i < len; i++) {
network_name = ref[i];
network = _this.networks[network_name];
if (network.chain_id === chain_id) {
... | [
"function",
"(",
"chain_id",
")",
"{",
"let",
"i",
",",
"len",
",",
"network",
",",
"network_name",
",",
"ref",
";",
"ref",
"=",
"Object",
".",
"keys",
"(",
"_this",
".",
"networks",
")",
";",
"for",
"(",
"i",
"=",
"0",
",",
"len",
"=",
"ref",
... | Set a few properties for known chain IDs. | [
"Set",
"a",
"few",
"properties",
"for",
"known",
"chain",
"IDs",
"."
] | 074b043f04725950e6ecd9e48f3d280d28822138 | https://github.com/bitshares/bitsharesjs-ws/blob/074b043f04725950e6ecd9e48f3d280d28822138/lib/src/ChainConfig.js#L37-L69 | train | |
rapid7/le_js | src/le.js | function(msg) {
var event = _getEvent.apply(this, arguments);
var data = {event: event};
// Add agent info if required
if (_pageInfo !== 'never') {
if (!_sentPageInfo || _pageInfo === 'per-entry') {
_sentPageInfo = true;
... | javascript | function(msg) {
var event = _getEvent.apply(this, arguments);
var data = {event: event};
// Add agent info if required
if (_pageInfo !== 'never') {
if (!_sentPageInfo || _pageInfo === 'per-entry') {
_sentPageInfo = true;
... | [
"function",
"(",
"msg",
")",
"{",
"var",
"event",
"=",
"_getEvent",
".",
"apply",
"(",
"this",
",",
"arguments",
")",
";",
"var",
"data",
"=",
"{",
"event",
":",
"event",
"}",
";",
"// Add agent info if required",
"if",
"(",
"_pageInfo",
"!==",
"'never'"... | Single arg stops the compiler arity warning | [
"Single",
"arg",
"stops",
"the",
"compiler",
"arity",
"warning"
] | f5f07b4a20e9d376734bb08e5b9a9def3a50687d | https://github.com/rapid7/le_js/blob/f5f07b4a20e9d376734bb08e5b9a9def3a50687d/src/le.js#L158-L220 | train | |
rapid7/le_js | src/le.js | Logger | function Logger(options) {
var logger;
// Default values
var dict = {
ssl: true,
catchall: false,
trace: true,
page_info: 'never',
print: false,
endpoint: null,
token: null
};
if (typeof options... | javascript | function Logger(options) {
var logger;
// Default values
var dict = {
ssl: true,
catchall: false,
trace: true,
page_info: 'never',
print: false,
endpoint: null,
token: null
};
if (typeof options... | [
"function",
"Logger",
"(",
"options",
")",
"{",
"var",
"logger",
";",
"// Default values",
"var",
"dict",
"=",
"{",
"ssl",
":",
"true",
",",
"catchall",
":",
"false",
",",
"trace",
":",
"true",
",",
"page_info",
":",
"'never'",
",",
"print",
":",
"fals... | A single log object
@constructor
@param {Object} options | [
"A",
"single",
"log",
"object"
] | f5f07b4a20e9d376734bb08e5b9a9def3a50687d | https://github.com/rapid7/le_js/blob/f5f07b4a20e9d376734bb08e5b9a9def3a50687d/src/le.js#L289-L337 | train |
dschnelldavis/angular2-json-schema-form | build.js | _copyPackageJson | function _copyPackageJson(from, to) {
return new Promise((resolve, reject) => {
const origin = path.join(from, 'package.json');
const destination = path.join(to, 'package.json');
let data = JSON.parse(fs.readFileSync(origin, 'utf-8'));
delete data.engines;
delete data.scripts;
delete data.devD... | javascript | function _copyPackageJson(from, to) {
return new Promise((resolve, reject) => {
const origin = path.join(from, 'package.json');
const destination = path.join(to, 'package.json');
let data = JSON.parse(fs.readFileSync(origin, 'utf-8'));
delete data.engines;
delete data.scripts;
delete data.devD... | [
"function",
"_copyPackageJson",
"(",
"from",
",",
"to",
")",
"{",
"return",
"new",
"Promise",
"(",
"(",
"resolve",
",",
"reject",
")",
"=>",
"{",
"const",
"origin",
"=",
"path",
".",
"join",
"(",
"from",
",",
"'package.json'",
")",
";",
"const",
"desti... | Copy and update package.json file. | [
"Copy",
"and",
"update",
"package",
".",
"json",
"file",
"."
] | 1a5bfee8744666d8504369ec9e6dfeb1c27f8ce1 | https://github.com/dschnelldavis/angular2-json-schema-form/blob/1a5bfee8744666d8504369ec9e6dfeb1c27f8ce1/build.js#L190-L201 | train |
actionably/dashbot | examples/google-example-api-ai.js | getRandomNumber | function getRandomNumber(min, max) {
return Math.round(Math.random() * (max - min) + min);
} | javascript | function getRandomNumber(min, max) {
return Math.round(Math.random() * (max - min) + min);
} | [
"function",
"getRandomNumber",
"(",
"min",
",",
"max",
")",
"{",
"return",
"Math",
".",
"round",
"(",
"Math",
".",
"random",
"(",
")",
"*",
"(",
"max",
"-",
"min",
")",
"+",
"min",
")",
";",
"}"
] | Generate the random number | [
"Generate",
"the",
"random",
"number"
] | 1e26498a806f28697975a5df257e156a952e7677 | https://github.com/actionably/dashbot/blob/1e26498a806f28697975a5df257e156a952e7677/examples/google-example-api-ai.js#L35-L37 | train |
nodeshift/nodeshift | lib/resource-enrichers/labels-enricher.js | addLabelsToResource | async function addLabelsToResource (config, resourceList) {
return resourceList.map((resource) => {
const baseLabel = {
project: config.projectName,
version: config.projectVersion,
provider: 'nodeshift'
};
resource.metadata.labels = _.merge({}, baseLabel, resource.metadata.labels);
... | javascript | async function addLabelsToResource (config, resourceList) {
return resourceList.map((resource) => {
const baseLabel = {
project: config.projectName,
version: config.projectVersion,
provider: 'nodeshift'
};
resource.metadata.labels = _.merge({}, baseLabel, resource.metadata.labels);
... | [
"async",
"function",
"addLabelsToResource",
"(",
"config",
",",
"resourceList",
")",
"{",
"return",
"resourceList",
".",
"map",
"(",
"(",
"resource",
")",
"=>",
"{",
"const",
"baseLabel",
"=",
"{",
"project",
":",
"config",
".",
"projectName",
",",
"version"... | Add labels to the metadata of a resource | [
"Add",
"labels",
"to",
"the",
"metadata",
"of",
"a",
"resource"
] | 22f8ae1e4f90b1325faf95939eb71226f8aa61f0 | https://github.com/nodeshift/nodeshift/blob/22f8ae1e4f90b1325faf95939eb71226f8aa61f0/lib/resource-enrichers/labels-enricher.js#L24-L43 | train |
nodeshift/nodeshift | lib/load-enrichers.js | loadEnrichers | function loadEnrichers () {
// find all the js files in the resource-enrichers directory
const enrichers = fs.readdirSync(`${__dirname}/resource-enrichers`).reduce((loaded, file) => {
const filesSplit = file.split('.');
if (filesSplit[1] === 'js') {
const mod = require(`./resource-enrichers/${file}`);... | javascript | function loadEnrichers () {
// find all the js files in the resource-enrichers directory
const enrichers = fs.readdirSync(`${__dirname}/resource-enrichers`).reduce((loaded, file) => {
const filesSplit = file.split('.');
if (filesSplit[1] === 'js') {
const mod = require(`./resource-enrichers/${file}`);... | [
"function",
"loadEnrichers",
"(",
")",
"{",
"// find all the js files in the resource-enrichers directory",
"const",
"enrichers",
"=",
"fs",
".",
"readdirSync",
"(",
"`",
"${",
"__dirname",
"}",
"`",
")",
".",
"reduce",
"(",
"(",
"loaded",
",",
"file",
")",
"=>"... | Returns an object with the enrichers The key property will be the name prop from the enricher The value will be the enrich function from the enricher | [
"Returns",
"an",
"object",
"with",
"the",
"enrichers",
"The",
"key",
"property",
"will",
"be",
"the",
"name",
"prop",
"from",
"the",
"enricher",
"The",
"value",
"will",
"be",
"the",
"enrich",
"function",
"from",
"the",
"enricher"
] | 22f8ae1e4f90b1325faf95939eb71226f8aa61f0 | https://github.com/nodeshift/nodeshift/blob/22f8ae1e4f90b1325faf95939eb71226f8aa61f0/lib/load-enrichers.js#L26-L41 | train |
nodeshift/nodeshift | lib/resource-enrichers/service-enricher.js | defaultService | function defaultService (config) {
const serviceConfig = _.merge({}, baseServiceConfig);
// Apply MetaData
serviceConfig.metadata = objectMetadata({
name: config.projectName,
namespace: config.namespace.name
});
serviceConfig.spec.selector = {
project: config.projectName,
provider: 'nodeshif... | javascript | function defaultService (config) {
const serviceConfig = _.merge({}, baseServiceConfig);
// Apply MetaData
serviceConfig.metadata = objectMetadata({
name: config.projectName,
namespace: config.namespace.name
});
serviceConfig.spec.selector = {
project: config.projectName,
provider: 'nodeshif... | [
"function",
"defaultService",
"(",
"config",
")",
"{",
"const",
"serviceConfig",
"=",
"_",
".",
"merge",
"(",
"{",
"}",
",",
"baseServiceConfig",
")",
";",
"// Apply MetaData",
"serviceConfig",
".",
"metadata",
"=",
"objectMetadata",
"(",
"{",
"name",
":",
"... | Returns a default service config. need to figure out a better way to do those port mappings | [
"Returns",
"a",
"default",
"service",
"config",
".",
"need",
"to",
"figure",
"out",
"a",
"better",
"way",
"to",
"do",
"those",
"port",
"mappings"
] | 22f8ae1e4f90b1325faf95939eb71226f8aa61f0 | https://github.com/nodeshift/nodeshift/blob/22f8ae1e4f90b1325faf95939eb71226f8aa61f0/lib/resource-enrichers/service-enricher.js#L33-L59 | train |
godong9/solr-node | lib/client.js | Client | function Client(options) {
this.options = {
host: options.host || '127.0.0.1',
port: options.port || '8983',
core: options.core || '',
rootPath: options.rootPath || 'solr',
protocol: options.protocol || 'http'
};
// Optional Authentication
if (options.user && options.password) {
this.opt... | javascript | function Client(options) {
this.options = {
host: options.host || '127.0.0.1',
port: options.port || '8983',
core: options.core || '',
rootPath: options.rootPath || 'solr',
protocol: options.protocol || 'http'
};
// Optional Authentication
if (options.user && options.password) {
this.opt... | [
"function",
"Client",
"(",
"options",
")",
"{",
"this",
".",
"options",
"=",
"{",
"host",
":",
"options",
".",
"host",
"||",
"'127.0.0.1'",
",",
"port",
":",
"options",
".",
"port",
"||",
"'8983'",
",",
"core",
":",
"options",
".",
"core",
"||",
"''"... | Solr Node Client
@constructor
@param {Object} options
@param {String} [options.host] - host address of Solr server
@param {Number|String} [options.port] - port number of Solr server
@param {String} [options.core] - client core name
@param {String} [options.user] - client user name
@param {String} [options.password] -... | [
"Solr",
"Node",
"Client"
] | 4db8c34e1bd4d4cf13f5fa7c4d1298a52efa62b1 | https://github.com/godong9/solr-node/blob/4db8c34e1bd4d4cf13f5fa7c4d1298a52efa62b1/lib/client.js#L28-L51 | train |
infusion/Quaternion.js | quaternion.js | function() {
// Q* := Q / |Q|
// unrolled Q.scale(1 / Q.norm())
var w = this['w'];
var x = this['x'];
var y = this['y'];
var z = this['z'];
var norm = Math.sqrt(w * w + x * x + y * y + z * z);
if (norm < Quaternion['EPSILON']) {
return Quaternion['ZERO'];
... | javascript | function() {
// Q* := Q / |Q|
// unrolled Q.scale(1 / Q.norm())
var w = this['w'];
var x = this['x'];
var y = this['y'];
var z = this['z'];
var norm = Math.sqrt(w * w + x * x + y * y + z * z);
if (norm < Quaternion['EPSILON']) {
return Quaternion['ZERO'];
... | [
"function",
"(",
")",
"{",
"// Q* := Q / |Q|",
"// unrolled Q.scale(1 / Q.norm())",
"var",
"w",
"=",
"this",
"[",
"'w'",
"]",
";",
"var",
"x",
"=",
"this",
"[",
"'x'",
"]",
";",
"var",
"y",
"=",
"this",
"[",
"'y'",
"]",
";",
"var",
"z",
"=",
"this",
... | Normalizes the quaternion to have |Q| = 1 as long as the norm is not zero
Alternative names are the signum, unit or versor
@returns {Quaternion} | [
"Normalizes",
"the",
"quaternion",
"to",
"have",
"|Q|",
"=",
"1",
"as",
"long",
"as",
"the",
"norm",
"is",
"not",
"zero",
"Alternative",
"names",
"are",
"the",
"signum",
"unit",
"or",
"versor"
] | 3c6ef625b2d1ea5274b62eae8dacd564ec917ea4 | https://github.com/infusion/Quaternion.js/blob/3c6ef625b2d1ea5274b62eae8dacd564ec917ea4/quaternion.js#L342-L362 | train | |
infusion/Quaternion.js | quaternion.js | function(w, x, y, z) {
parse(P, w, x, y, z);
// Q1 * Q2 = [w1 * w2 - dot(v1, v2), w1 * v2 + w2 * v1 + cross(v1, v2)]
// Not commutative because cross(v1, v2) != cross(v2, v1)!
var w1 = this['w'];
var x1 = this['x'];
var y1 = this['y'];
var z1 = this['z'];
var w2 = P[... | javascript | function(w, x, y, z) {
parse(P, w, x, y, z);
// Q1 * Q2 = [w1 * w2 - dot(v1, v2), w1 * v2 + w2 * v1 + cross(v1, v2)]
// Not commutative because cross(v1, v2) != cross(v2, v1)!
var w1 = this['w'];
var x1 = this['x'];
var y1 = this['y'];
var z1 = this['z'];
var w2 = P[... | [
"function",
"(",
"w",
",",
"x",
",",
"y",
",",
"z",
")",
"{",
"parse",
"(",
"P",
",",
"w",
",",
"x",
",",
"y",
",",
"z",
")",
";",
"// Q1 * Q2 = [w1 * w2 - dot(v1, v2), w1 * v2 + w2 * v1 + cross(v1, v2)]",
"// Not commutative because cross(v1, v2) != cross(v2, v1)!"... | Calculates the Hamilton product of two quaternions
Leaving out the imaginary part results in just scaling the quat
@param {number|Object|string} w real
@param {number=} x imag
@param {number=} y imag
@param {number=} z imag
@returns {Quaternion} | [
"Calculates",
"the",
"Hamilton",
"product",
"of",
"two",
"quaternions",
"Leaving",
"out",
"the",
"imaginary",
"part",
"results",
"in",
"just",
"scaling",
"the",
"quat"
] | 3c6ef625b2d1ea5274b62eae8dacd564ec917ea4 | https://github.com/infusion/Quaternion.js/blob/3c6ef625b2d1ea5274b62eae8dacd564ec917ea4/quaternion.js#L373-L396 | train | |
infusion/Quaternion.js | quaternion.js | function(w, x, y, z) {
parse(P, w, x, y, z);
// dot(Q1, Q2) := w1 * w2 + dot(v1, v2)
return this['w'] * P['w'] + this['x'] * P['x'] + this['y'] * P['y'] + this['z'] * P['z'];
} | javascript | function(w, x, y, z) {
parse(P, w, x, y, z);
// dot(Q1, Q2) := w1 * w2 + dot(v1, v2)
return this['w'] * P['w'] + this['x'] * P['x'] + this['y'] * P['y'] + this['z'] * P['z'];
} | [
"function",
"(",
"w",
",",
"x",
",",
"y",
",",
"z",
")",
"{",
"parse",
"(",
"P",
",",
"w",
",",
"x",
",",
"y",
",",
"z",
")",
";",
"// dot(Q1, Q2) := w1 * w2 + dot(v1, v2)",
"return",
"this",
"[",
"'w'",
"]",
"*",
"P",
"[",
"'w'",
"]",
"+",
"th... | Calculates the dot product of two quaternions
@param {number|Object|string} w real
@param {number=} x imag
@param {number=} y imag
@param {number=} z imag
@returns {number} | [
"Calculates",
"the",
"dot",
"product",
"of",
"two",
"quaternions"
] | 3c6ef625b2d1ea5274b62eae8dacd564ec917ea4 | https://github.com/infusion/Quaternion.js/blob/3c6ef625b2d1ea5274b62eae8dacd564ec917ea4/quaternion.js#L420-L427 | train | |
infusion/Quaternion.js | quaternion.js | function() {
var w = this['w'];
var x = this['x'];
var y = this['y'];
var z = this['z'];
var vNorm = Math.sqrt(x * x + y * y + z * z);
var wExp = Math.exp(w);
var scale = wExp / vNorm * Math.sin(vNorm);
if (vNorm === 0) {
//return new Quaternion(wExp * Math.cos... | javascript | function() {
var w = this['w'];
var x = this['x'];
var y = this['y'];
var z = this['z'];
var vNorm = Math.sqrt(x * x + y * y + z * z);
var wExp = Math.exp(w);
var scale = wExp / vNorm * Math.sin(vNorm);
if (vNorm === 0) {
//return new Quaternion(wExp * Math.cos... | [
"function",
"(",
")",
"{",
"var",
"w",
"=",
"this",
"[",
"'w'",
"]",
";",
"var",
"x",
"=",
"this",
"[",
"'x'",
"]",
";",
"var",
"y",
"=",
"this",
"[",
"'y'",
"]",
";",
"var",
"z",
"=",
"this",
"[",
"'z'",
"]",
";",
"var",
"vNorm",
"=",
"M... | Calculates the natural exponentiation of the quaternion
@returns {Quaternion} | [
"Calculates",
"the",
"natural",
"exponentiation",
"of",
"the",
"quaternion"
] | 3c6ef625b2d1ea5274b62eae8dacd564ec917ea4 | https://github.com/infusion/Quaternion.js/blob/3c6ef625b2d1ea5274b62eae8dacd564ec917ea4/quaternion.js#L525-L546 | train | |
infusion/Quaternion.js | quaternion.js | function() {
var w = this['w'];
var x = this['x'];
var y = this['y'];
var z = this['z'];
if (y === 0 && z === 0) {
return new Quaternion(
logHypot(w, x),
Math.atan2(x, w), 0, 0);
}
var qNorm2 = x * x + y * y + z * z + w * w;
var ... | javascript | function() {
var w = this['w'];
var x = this['x'];
var y = this['y'];
var z = this['z'];
if (y === 0 && z === 0) {
return new Quaternion(
logHypot(w, x),
Math.atan2(x, w), 0, 0);
}
var qNorm2 = x * x + y * y + z * z + w * w;
var ... | [
"function",
"(",
")",
"{",
"var",
"w",
"=",
"this",
"[",
"'w'",
"]",
";",
"var",
"x",
"=",
"this",
"[",
"'x'",
"]",
";",
"var",
"y",
"=",
"this",
"[",
"'y'",
"]",
";",
"var",
"z",
"=",
"this",
"[",
"'z'",
"]",
";",
"if",
"(",
"y",
"===",
... | Calculates the natural logarithm of the quaternion
@returns {Quaternion} | [
"Calculates",
"the",
"natural",
"logarithm",
"of",
"the",
"quaternion"
] | 3c6ef625b2d1ea5274b62eae8dacd564ec917ea4 | https://github.com/infusion/Quaternion.js/blob/3c6ef625b2d1ea5274b62eae8dacd564ec917ea4/quaternion.js#L552-L575 | train | |
infusion/Quaternion.js | quaternion.js | function(w, x, y, z) {
parse(P, w, x, y, z);
if (P['y'] === 0 && P['z'] === 0) {
if (P['w'] === 1 && P['x'] === 0) {
return this;
}
if (P['w'] === 0 && P['x'] === 0) {
return Quaternion['ONE'];
}
// Check if we can operate in C
// Borr... | javascript | function(w, x, y, z) {
parse(P, w, x, y, z);
if (P['y'] === 0 && P['z'] === 0) {
if (P['w'] === 1 && P['x'] === 0) {
return this;
}
if (P['w'] === 0 && P['x'] === 0) {
return Quaternion['ONE'];
}
// Check if we can operate in C
// Borr... | [
"function",
"(",
"w",
",",
"x",
",",
"y",
",",
"z",
")",
"{",
"parse",
"(",
"P",
",",
"w",
",",
"x",
",",
"y",
",",
"z",
")",
";",
"if",
"(",
"P",
"[",
"'y'",
"]",
"===",
"0",
"&&",
"P",
"[",
"'z'",
"]",
"===",
"0",
")",
"{",
"if",
... | Calculates the power of a quaternion raised to a real number or another quaternion
@param {number|Object|string} w real
@param {number=} x imag
@param {number=} y imag
@param {number=} z imag
@returns {Quaternion} | [
"Calculates",
"the",
"power",
"of",
"a",
"quaternion",
"raised",
"to",
"a",
"real",
"number",
"or",
"another",
"quaternion"
] | 3c6ef625b2d1ea5274b62eae8dacd564ec917ea4 | https://github.com/infusion/Quaternion.js/blob/3c6ef625b2d1ea5274b62eae8dacd564ec917ea4/quaternion.js#L585-L645 | train | |
infusion/Quaternion.js | quaternion.js | function(w, x, y, z) {
parse(P, w, x, y, z);
var eps = Quaternion['EPSILON'];
// maybe check for NaN's here?
return Math.abs(P['w'] - this['w']) < eps
&& Math.abs(P['x'] - this['x']) < eps
&& Math.abs(P['y'] - this['y']) < eps
&& Math.abs(P['z'] - thi... | javascript | function(w, x, y, z) {
parse(P, w, x, y, z);
var eps = Quaternion['EPSILON'];
// maybe check for NaN's here?
return Math.abs(P['w'] - this['w']) < eps
&& Math.abs(P['x'] - this['x']) < eps
&& Math.abs(P['y'] - this['y']) < eps
&& Math.abs(P['z'] - thi... | [
"function",
"(",
"w",
",",
"x",
",",
"y",
",",
"z",
")",
"{",
"parse",
"(",
"P",
",",
"w",
",",
"x",
",",
"y",
",",
"z",
")",
";",
"var",
"eps",
"=",
"Quaternion",
"[",
"'EPSILON'",
"]",
";",
"// maybe check for NaN's here?",
"return",
"Math",
".... | Checks if two quats are the same
@param {number|Object|string} w real
@param {number=} x imag
@param {number=} y imag
@param {number=} z imag
@returns {boolean} | [
"Checks",
"if",
"two",
"quats",
"are",
"the",
"same"
] | 3c6ef625b2d1ea5274b62eae8dacd564ec917ea4 | https://github.com/infusion/Quaternion.js/blob/3c6ef625b2d1ea5274b62eae8dacd564ec917ea4/quaternion.js#L655-L666 | train | |
infusion/Quaternion.js | quaternion.js | function() {
var w = this['w'];
var x = this['x'];
var y = this['y'];
var z = this['z'];
var ret = '';
if (isNaN(w) || isNaN(x) || isNaN(y) || isNaN(z)) {
return 'NaN';
}
// Alternative design?
// '(%f, [%f %f %f])'
ret = numToStr(w, '', ret);
... | javascript | function() {
var w = this['w'];
var x = this['x'];
var y = this['y'];
var z = this['z'];
var ret = '';
if (isNaN(w) || isNaN(x) || isNaN(y) || isNaN(z)) {
return 'NaN';
}
// Alternative design?
// '(%f, [%f %f %f])'
ret = numToStr(w, '', ret);
... | [
"function",
"(",
")",
"{",
"var",
"w",
"=",
"this",
"[",
"'w'",
"]",
";",
"var",
"x",
"=",
"this",
"[",
"'x'",
"]",
";",
"var",
"y",
"=",
"this",
"[",
"'y'",
"]",
";",
"var",
"z",
"=",
"this",
"[",
"'z'",
"]",
";",
"var",
"ret",
"=",
"''"... | Gets the Quaternion as a well formatted string
@returns {string} | [
"Gets",
"the",
"Quaternion",
"as",
"a",
"well",
"formatted",
"string"
] | 3c6ef625b2d1ea5274b62eae8dacd564ec917ea4 | https://github.com/infusion/Quaternion.js/blob/3c6ef625b2d1ea5274b62eae8dacd564ec917ea4/quaternion.js#L690-L714 | train | |
infusion/Quaternion.js | quaternion.js | function(d2) {
var w = this['w'];
var x = this['x'];
var y = this['y'];
var z = this['z'];
var n = w * w + x * x + y * y + z * z;
var s = n === 0 ? 0 : 2 / n;
var wx = s * w * x, wy = s * w * y, wz = s * w * z;
var xx = s * x * x, xy = s * x * y, xz = s * x * z;
v... | javascript | function(d2) {
var w = this['w'];
var x = this['x'];
var y = this['y'];
var z = this['z'];
var n = w * w + x * x + y * y + z * z;
var s = n === 0 ? 0 : 2 / n;
var wx = s * w * x, wy = s * w * y, wz = s * w * z;
var xx = s * x * x, xy = s * x * y, xz = s * x * z;
v... | [
"function",
"(",
"d2",
")",
"{",
"var",
"w",
"=",
"this",
"[",
"'w'",
"]",
";",
"var",
"x",
"=",
"this",
"[",
"'x'",
"]",
";",
"var",
"y",
"=",
"this",
"[",
"'y'",
"]",
";",
"var",
"z",
"=",
"this",
"[",
"'z'",
"]",
";",
"var",
"n",
"=",
... | Calculates the 3x3 rotation matrix for the current quat
@param {boolean=} d2
@see https://en.wikipedia.org/wiki/Rotation_matrix#Quaternion
@returns {Array} | [
"Calculates",
"the",
"3x3",
"rotation",
"matrix",
"for",
"the",
"current",
"quat"
] | 3c6ef625b2d1ea5274b62eae8dacd564ec917ea4 | https://github.com/infusion/Quaternion.js/blob/3c6ef625b2d1ea5274b62eae8dacd564ec917ea4/quaternion.js#L749-L773 | train | |
infusion/Quaternion.js | quaternion.js | function(v) {
// [0, v'] = Q * [0, v] * Q'
// Q
var w1 = this['w'];
var x1 = this['x'];
var y1 = this['y'];
var z1 = this['z'];
// [0, v]
var w2 = 0;
var x2 = v[0];
var y2 = v[1];
var z2 = v[2];
// Q * [0, v]
var w3 = /*w1 * w2*/ -x1 * x2... | javascript | function(v) {
// [0, v'] = Q * [0, v] * Q'
// Q
var w1 = this['w'];
var x1 = this['x'];
var y1 = this['y'];
var z1 = this['z'];
// [0, v]
var w2 = 0;
var x2 = v[0];
var y2 = v[1];
var z2 = v[2];
// Q * [0, v]
var w3 = /*w1 * w2*/ -x1 * x2... | [
"function",
"(",
"v",
")",
"{",
"// [0, v'] = Q * [0, v] * Q'",
"// Q",
"var",
"w1",
"=",
"this",
"[",
"'w'",
"]",
";",
"var",
"x1",
"=",
"this",
"[",
"'x'",
"]",
";",
"var",
"y1",
"=",
"this",
"[",
"'y'",
"]",
";",
"var",
"z1",
"=",
"this",
"[",... | Rotates a vector according to the current quaternion
@param {Array} v The vector to be rotated
@returns {Array} | [
"Rotates",
"a",
"vector",
"according",
"to",
"the",
"current",
"quaternion"
] | 3c6ef625b2d1ea5274b62eae8dacd564ec917ea4 | https://github.com/infusion/Quaternion.js/blob/3c6ef625b2d1ea5274b62eae8dacd564ec917ea4/quaternion.js#L822-L850 | train | |
josdejong/ducktype | ducktype.js | createPrototype | function createPrototype (type, options) {
return new DuckType({
name: options && options.name || null,
test: function test (object) {
return (object instanceof type);
}
});
} | javascript | function createPrototype (type, options) {
return new DuckType({
name: options && options.name || null,
test: function test (object) {
return (object instanceof type);
}
});
} | [
"function",
"createPrototype",
"(",
"type",
",",
"options",
")",
"{",
"return",
"new",
"DuckType",
"(",
"{",
"name",
":",
"options",
"&&",
"options",
".",
"name",
"||",
"null",
",",
"test",
":",
"function",
"test",
"(",
"object",
")",
"{",
"return",
"(... | Create a ducktype handling a prototype
@param {Object} type A prototype function
@param {{name: String}} [options]
@returns {*} | [
"Create",
"a",
"ducktype",
"handling",
"a",
"prototype"
] | 7a0f60ef6b02e777669a86301fa642e24e53ccb8 | https://github.com/josdejong/ducktype/blob/7a0f60ef6b02e777669a86301fa642e24e53ccb8/ducktype.js#L310-L317 | train |
josdejong/ducktype | ducktype.js | createCombi | function createCombi (types, options) {
var tests = types.map(function (type) {
return ducktype(type).test;
});
return new DuckType({
name: options && options.name || null,
test: function test (object) {
for (var i = 0, ii = tests.length; i < ii; i++) {
if (tests[i](obje... | javascript | function createCombi (types, options) {
var tests = types.map(function (type) {
return ducktype(type).test;
});
return new DuckType({
name: options && options.name || null,
test: function test (object) {
for (var i = 0, ii = tests.length; i < ii; i++) {
if (tests[i](obje... | [
"function",
"createCombi",
"(",
"types",
",",
"options",
")",
"{",
"var",
"tests",
"=",
"types",
".",
"map",
"(",
"function",
"(",
"type",
")",
"{",
"return",
"ducktype",
"(",
"type",
")",
".",
"test",
";",
"}",
")",
";",
"return",
"new",
"DuckType",... | Create a ducktype handling a combination of types
@param {Array} types
@param {{name: String}} [options]
@returns {*} | [
"Create",
"a",
"ducktype",
"handling",
"a",
"combination",
"of",
"types"
] | 7a0f60ef6b02e777669a86301fa642e24e53ccb8 | https://github.com/josdejong/ducktype/blob/7a0f60ef6b02e777669a86301fa642e24e53ccb8/ducktype.js#L325-L341 | train |
josdejong/ducktype | ducktype.js | createFunction | function createFunction (test, options) {
return new DuckType({
name: options && options.name || null,
test: test
});
} | javascript | function createFunction (test, options) {
return new DuckType({
name: options && options.name || null,
test: test
});
} | [
"function",
"createFunction",
"(",
"test",
",",
"options",
")",
"{",
"return",
"new",
"DuckType",
"(",
"{",
"name",
":",
"options",
"&&",
"options",
".",
"name",
"||",
"null",
",",
"test",
":",
"test",
"}",
")",
";",
"}"
] | Create a ducktype from a test function
@param {Function} test A test function, returning true when a provided
object matches, or else returns false.
@param {{name: String}} [options]
@returns {*} | [
"Create",
"a",
"ducktype",
"from",
"a",
"test",
"function"
] | 7a0f60ef6b02e777669a86301fa642e24e53ccb8 | https://github.com/josdejong/ducktype/blob/7a0f60ef6b02e777669a86301fa642e24e53ccb8/ducktype.js#L350-L355 | train |
josdejong/ducktype | ducktype.js | createRegExp | function createRegExp (regexp, options) {
return new DuckType({
name: options && options.name || null,
test: function (object) {
return ((object instanceof String) || typeof(object) === 'string') && regexp.test(object);
}
});
} | javascript | function createRegExp (regexp, options) {
return new DuckType({
name: options && options.name || null,
test: function (object) {
return ((object instanceof String) || typeof(object) === 'string') && regexp.test(object);
}
});
} | [
"function",
"createRegExp",
"(",
"regexp",
",",
"options",
")",
"{",
"return",
"new",
"DuckType",
"(",
"{",
"name",
":",
"options",
"&&",
"options",
".",
"name",
"||",
"null",
",",
"test",
":",
"function",
"(",
"object",
")",
"{",
"return",
"(",
"(",
... | Create a ducktype from a regular expression. The created ducktype
will check whether the provided object is a String,
and matches with the regular expression
@param {RegExp} regexp A regular expression
@param {{name: String}} [options]
@returns {*} | [
"Create",
"a",
"ducktype",
"from",
"a",
"regular",
"expression",
".",
"The",
"created",
"ducktype",
"will",
"check",
"whether",
"the",
"provided",
"object",
"is",
"a",
"String",
"and",
"matches",
"with",
"the",
"regular",
"expression"
] | 7a0f60ef6b02e777669a86301fa642e24e53ccb8 | https://github.com/josdejong/ducktype/blob/7a0f60ef6b02e777669a86301fa642e24e53ccb8/ducktype.js#L365-L372 | train |
josdejong/ducktype | ducktype.js | isUrl | function isUrl(string){
if (typeof string !== 'string') {
return false;
}
var match = string.match(protocolAndDomainRE);
if (!match) {
return false;
}
var everythingAfterProtocol = match[1];
if (!everythingAfterProtocol) {
return false;
}
return localhostDomainRE... | javascript | function isUrl(string){
if (typeof string !== 'string') {
return false;
}
var match = string.match(protocolAndDomainRE);
if (!match) {
return false;
}
var everythingAfterProtocol = match[1];
if (!everythingAfterProtocol) {
return false;
}
return localhostDomainRE... | [
"function",
"isUrl",
"(",
"string",
")",
"{",
"if",
"(",
"typeof",
"string",
"!==",
"'string'",
")",
"{",
"return",
"false",
";",
"}",
"var",
"match",
"=",
"string",
".",
"match",
"(",
"protocolAndDomainRE",
")",
";",
"if",
"(",
"!",
"match",
")",
"{... | Loosely validate a URL `string`.
Source: https://github.com/segmentio/is-url
@param {String} string
@return {Boolean} | [
"Loosely",
"validate",
"a",
"URL",
"string",
"."
] | 7a0f60ef6b02e777669a86301fa642e24e53ccb8 | https://github.com/josdejong/ducktype/blob/7a0f60ef6b02e777669a86301fa642e24e53ccb8/ducktype.js#L609-L626 | train |
jshttp/media-typer | index.js | MediaType | function MediaType (type, subtype, suffix) {
this.type = type
this.subtype = subtype
this.suffix = suffix
} | javascript | function MediaType (type, subtype, suffix) {
this.type = type
this.subtype = subtype
this.suffix = suffix
} | [
"function",
"MediaType",
"(",
"type",
",",
"subtype",
",",
"suffix",
")",
"{",
"this",
".",
"type",
"=",
"type",
"this",
".",
"subtype",
"=",
"subtype",
"this",
".",
"suffix",
"=",
"suffix",
"}"
] | Class for MediaType object.
@public | [
"Class",
"for",
"MediaType",
"object",
"."
] | 1332b73ed8584b7b25d556c55b6de9d64fa3ce2c | https://github.com/jshttp/media-typer/blob/1332b73ed8584b7b25d556c55b6de9d64fa3ce2c/index.js#L139-L143 | train |
Kurento/kurento-client-core-js | lib/complexTypes/AudioCodec.js | checkAudioCodec | function checkAudioCodec(key, value)
{
if(typeof value != 'string')
throw SyntaxError(key+' param should be a String, not '+typeof value);
if(!value.match('OPUS|PCMU|RAW'))
throw SyntaxError(key+' param is not one of [OPUS|PCMU|RAW] ('+value+')');
} | javascript | function checkAudioCodec(key, value)
{
if(typeof value != 'string')
throw SyntaxError(key+' param should be a String, not '+typeof value);
if(!value.match('OPUS|PCMU|RAW'))
throw SyntaxError(key+' param is not one of [OPUS|PCMU|RAW] ('+value+')');
} | [
"function",
"checkAudioCodec",
"(",
"key",
",",
"value",
")",
"{",
"if",
"(",
"typeof",
"value",
"!=",
"'string'",
")",
"throw",
"SyntaxError",
"(",
"key",
"+",
"' param should be a String, not '",
"+",
"typeof",
"value",
")",
";",
"if",
"(",
"!",
"value",
... | Codec used for transmission of audio.
@typedef core/complexTypes.AudioCodec
@type {(OPUS|PCMU|RAW)}
Checker for {@link module:core/complexTypes.AudioCodec}
@memberof module:core/complexTypes
@param {external:String} key
@param {module:core/complexTypes.AudioCodec} value | [
"Codec",
"used",
"for",
"transmission",
"of",
"audio",
"."
] | 20f31e902790e28f14d9a9334b58cdcc848c10f5 | https://github.com/Kurento/kurento-client-core-js/blob/20f31e902790e28f14d9a9334b58cdcc848c10f5/lib/complexTypes/AudioCodec.js#L39-L46 | train |
Kurento/kurento-client-core-js | lib/complexTypes/RTCStatsIceCandidatePairState.js | checkRTCStatsIceCandidatePairState | function checkRTCStatsIceCandidatePairState(key, value)
{
if(typeof value != 'string')
throw SyntaxError(key+' param should be a String, not '+typeof value);
if(!value.match('frozen|waiting|inprogress|failed|succeeded|cancelled'))
throw SyntaxError(key+' param is not one of [frozen|waiting|inprogress|faile... | javascript | function checkRTCStatsIceCandidatePairState(key, value)
{
if(typeof value != 'string')
throw SyntaxError(key+' param should be a String, not '+typeof value);
if(!value.match('frozen|waiting|inprogress|failed|succeeded|cancelled'))
throw SyntaxError(key+' param is not one of [frozen|waiting|inprogress|faile... | [
"function",
"checkRTCStatsIceCandidatePairState",
"(",
"key",
",",
"value",
")",
"{",
"if",
"(",
"typeof",
"value",
"!=",
"'string'",
")",
"throw",
"SyntaxError",
"(",
"key",
"+",
"' param should be a String, not '",
"+",
"typeof",
"value",
")",
";",
"if",
"(",
... | Represents the state of the checklist for the local and remote candidates in
a pair.
@typedef core/complexTypes.RTCStatsIceCandidatePairState
@type {(frozen|waiting|inprogress|failed|succeeded|cancelled)}
Checker for {@link module:core/complexTypes.RTCStatsIceCandidatePairState}
@memberof module:core/complexTypes
... | [
"Represents",
"the",
"state",
"of",
"the",
"checklist",
"for",
"the",
"local",
"and",
"remote",
"candidates",
"in",
"a",
"pair",
"."
] | 20f31e902790e28f14d9a9334b58cdcc848c10f5 | https://github.com/Kurento/kurento-client-core-js/blob/20f31e902790e28f14d9a9334b58cdcc848c10f5/lib/complexTypes/RTCStatsIceCandidatePairState.js#L40-L47 | train |
Kurento/kurento-client-core-js | lib/complexTypes/GstreamerDotDetails.js | checkGstreamerDotDetails | function checkGstreamerDotDetails(key, value)
{
if(typeof value != 'string')
throw SyntaxError(key+' param should be a String, not '+typeof value);
if(!value.match('SHOW_MEDIA_TYPE|SHOW_CAPS_DETAILS|SHOW_NON_DEFAULT_PARAMS|SHOW_STATES|SHOW_FULL_PARAMS|SHOW_ALL|SHOW_VERBOSE'))
throw SyntaxError(key+' param ... | javascript | function checkGstreamerDotDetails(key, value)
{
if(typeof value != 'string')
throw SyntaxError(key+' param should be a String, not '+typeof value);
if(!value.match('SHOW_MEDIA_TYPE|SHOW_CAPS_DETAILS|SHOW_NON_DEFAULT_PARAMS|SHOW_STATES|SHOW_FULL_PARAMS|SHOW_ALL|SHOW_VERBOSE'))
throw SyntaxError(key+' param ... | [
"function",
"checkGstreamerDotDetails",
"(",
"key",
",",
"value",
")",
"{",
"if",
"(",
"typeof",
"value",
"!=",
"'string'",
")",
"throw",
"SyntaxError",
"(",
"key",
"+",
"' param should be a String, not '",
"+",
"typeof",
"value",
")",
";",
"if",
"(",
"!",
"... | Details of gstreamer dot graphs
@typedef core/complexTypes.GstreamerDotDetails
@type {(SHOW_MEDIA_TYPE|SHOW_CAPS_DETAILS|SHOW_NON_DEFAULT_PARAMS|SHOW_STATES|SHOW_FULL_PARAMS|SHOW_ALL|SHOW_VERBOSE)}
Checker for {@link module:core/complexTypes.GstreamerDotDetails}
@memberof module:core/complexTypes
@param {external... | [
"Details",
"of",
"gstreamer",
"dot",
"graphs"
] | 20f31e902790e28f14d9a9334b58cdcc848c10f5 | https://github.com/Kurento/kurento-client-core-js/blob/20f31e902790e28f14d9a9334b58cdcc848c10f5/lib/complexTypes/GstreamerDotDetails.js#L39-L46 | train |
Kurento/kurento-client-core-js | lib/complexTypes/RTCStatsIceCandidateType.js | checkRTCStatsIceCandidateType | function checkRTCStatsIceCandidateType(key, value)
{
if(typeof value != 'string')
throw SyntaxError(key+' param should be a String, not '+typeof value);
if(!value.match('host|serverreflexive|peerreflexive|relayed'))
throw SyntaxError(key+' param is not one of [host|serverreflexive|peerreflexive|relayed] ('... | javascript | function checkRTCStatsIceCandidateType(key, value)
{
if(typeof value != 'string')
throw SyntaxError(key+' param should be a String, not '+typeof value);
if(!value.match('host|serverreflexive|peerreflexive|relayed'))
throw SyntaxError(key+' param is not one of [host|serverreflexive|peerreflexive|relayed] ('... | [
"function",
"checkRTCStatsIceCandidateType",
"(",
"key",
",",
"value",
")",
"{",
"if",
"(",
"typeof",
"value",
"!=",
"'string'",
")",
"throw",
"SyntaxError",
"(",
"key",
"+",
"' param should be a String, not '",
"+",
"typeof",
"value",
")",
";",
"if",
"(",
"!"... | Types of candidates
@typedef core/complexTypes.RTCStatsIceCandidateType
@type {(host|serverreflexive|peerreflexive|relayed)}
Checker for {@link module:core/complexTypes.RTCStatsIceCandidateType}
@memberof module:core/complexTypes
@param {external:String} key
@param {module:core/complexTypes.RTCStatsIceCandidateTy... | [
"Types",
"of",
"candidates"
] | 20f31e902790e28f14d9a9334b58cdcc848c10f5 | https://github.com/Kurento/kurento-client-core-js/blob/20f31e902790e28f14d9a9334b58cdcc848c10f5/lib/complexTypes/RTCStatsIceCandidateType.js#L39-L46 | train |
Kurento/kurento-client-core-js | lib/complexTypes/ConnectionState.js | checkConnectionState | function checkConnectionState(key, value)
{
if(typeof value != 'string')
throw SyntaxError(key+' param should be a String, not '+typeof value);
if(!value.match('DISCONNECTED|CONNECTED'))
throw SyntaxError(key+' param is not one of [DISCONNECTED|CONNECTED] ('+value+')');
} | javascript | function checkConnectionState(key, value)
{
if(typeof value != 'string')
throw SyntaxError(key+' param should be a String, not '+typeof value);
if(!value.match('DISCONNECTED|CONNECTED'))
throw SyntaxError(key+' param is not one of [DISCONNECTED|CONNECTED] ('+value+')');
} | [
"function",
"checkConnectionState",
"(",
"key",
",",
"value",
")",
"{",
"if",
"(",
"typeof",
"value",
"!=",
"'string'",
")",
"throw",
"SyntaxError",
"(",
"key",
"+",
"' param should be a String, not '",
"+",
"typeof",
"value",
")",
";",
"if",
"(",
"!",
"valu... | State of the connection.
@typedef core/complexTypes.ConnectionState
@type {(DISCONNECTED|CONNECTED)}
Checker for {@link module:core/complexTypes.ConnectionState}
@memberof module:core/complexTypes
@param {external:String} key
@param {module:core/complexTypes.ConnectionState} value | [
"State",
"of",
"the",
"connection",
"."
] | 20f31e902790e28f14d9a9334b58cdcc848c10f5 | https://github.com/Kurento/kurento-client-core-js/blob/20f31e902790e28f14d9a9334b58cdcc848c10f5/lib/complexTypes/ConnectionState.js#L39-L46 | train |
Kurento/kurento-client-core-js | lib/complexTypes/RTCDataChannelState.js | checkRTCDataChannelState | function checkRTCDataChannelState(key, value)
{
if(typeof value != 'string')
throw SyntaxError(key+' param should be a String, not '+typeof value);
if(!value.match('connecting|open|closing|closed'))
throw SyntaxError(key+' param is not one of [connecting|open|closing|closed] ('+value+')');
} | javascript | function checkRTCDataChannelState(key, value)
{
if(typeof value != 'string')
throw SyntaxError(key+' param should be a String, not '+typeof value);
if(!value.match('connecting|open|closing|closed'))
throw SyntaxError(key+' param is not one of [connecting|open|closing|closed] ('+value+')');
} | [
"function",
"checkRTCDataChannelState",
"(",
"key",
",",
"value",
")",
"{",
"if",
"(",
"typeof",
"value",
"!=",
"'string'",
")",
"throw",
"SyntaxError",
"(",
"key",
"+",
"' param should be a String, not '",
"+",
"typeof",
"value",
")",
";",
"if",
"(",
"!",
"... | Represents the state of the RTCDataChannel
@typedef core/complexTypes.RTCDataChannelState
@type {(connecting|open|closing|closed)}
Checker for {@link module:core/complexTypes.RTCDataChannelState}
@memberof module:core/complexTypes
@param {external:String} key
@param {module:core/complexTypes.RTCDataChannelState} ... | [
"Represents",
"the",
"state",
"of",
"the",
"RTCDataChannel"
] | 20f31e902790e28f14d9a9334b58cdcc848c10f5 | https://github.com/Kurento/kurento-client-core-js/blob/20f31e902790e28f14d9a9334b58cdcc848c10f5/lib/complexTypes/RTCDataChannelState.js#L39-L46 | train |
Kurento/kurento-client-core-js | lib/complexTypes/MediaState.js | checkMediaState | function checkMediaState(key, value)
{
if(typeof value != 'string')
throw SyntaxError(key+' param should be a String, not '+typeof value);
if(!value.match('DISCONNECTED|CONNECTED'))
throw SyntaxError(key+' param is not one of [DISCONNECTED|CONNECTED] ('+value+')');
} | javascript | function checkMediaState(key, value)
{
if(typeof value != 'string')
throw SyntaxError(key+' param should be a String, not '+typeof value);
if(!value.match('DISCONNECTED|CONNECTED'))
throw SyntaxError(key+' param is not one of [DISCONNECTED|CONNECTED] ('+value+')');
} | [
"function",
"checkMediaState",
"(",
"key",
",",
"value",
")",
"{",
"if",
"(",
"typeof",
"value",
"!=",
"'string'",
")",
"throw",
"SyntaxError",
"(",
"key",
"+",
"' param should be a String, not '",
"+",
"typeof",
"value",
")",
";",
"if",
"(",
"!",
"value",
... | State of the media.
@typedef core/complexTypes.MediaState
@type {(DISCONNECTED|CONNECTED)}
Checker for {@link module:core/complexTypes.MediaState}
@memberof module:core/complexTypes
@param {external:String} key
@param {module:core/complexTypes.MediaState} value | [
"State",
"of",
"the",
"media",
"."
] | 20f31e902790e28f14d9a9334b58cdcc848c10f5 | https://github.com/Kurento/kurento-client-core-js/blob/20f31e902790e28f14d9a9334b58cdcc848c10f5/lib/complexTypes/MediaState.js#L39-L46 | train |
Kurento/kurento-client-core-js | lib/complexTypes/MediaFlowState.js | checkMediaFlowState | function checkMediaFlowState(key, value)
{
if(typeof value != 'string')
throw SyntaxError(key+' param should be a String, not '+typeof value);
if(!value.match('FLOWING|NOT_FLOWING'))
throw SyntaxError(key+' param is not one of [FLOWING|NOT_FLOWING] ('+value+')');
} | javascript | function checkMediaFlowState(key, value)
{
if(typeof value != 'string')
throw SyntaxError(key+' param should be a String, not '+typeof value);
if(!value.match('FLOWING|NOT_FLOWING'))
throw SyntaxError(key+' param is not one of [FLOWING|NOT_FLOWING] ('+value+')');
} | [
"function",
"checkMediaFlowState",
"(",
"key",
",",
"value",
")",
"{",
"if",
"(",
"typeof",
"value",
"!=",
"'string'",
")",
"throw",
"SyntaxError",
"(",
"key",
"+",
"' param should be a String, not '",
"+",
"typeof",
"value",
")",
";",
"if",
"(",
"!",
"value... | Flowing state of the media.
@typedef core/complexTypes.MediaFlowState
@type {(FLOWING|NOT_FLOWING)}
Checker for {@link module:core/complexTypes.MediaFlowState}
@memberof module:core/complexTypes
@param {external:String} key
@param {module:core/complexTypes.MediaFlowState} value | [
"Flowing",
"state",
"of",
"the",
"media",
"."
] | 20f31e902790e28f14d9a9334b58cdcc848c10f5 | https://github.com/Kurento/kurento-client-core-js/blob/20f31e902790e28f14d9a9334b58cdcc848c10f5/lib/complexTypes/MediaFlowState.js#L39-L46 | train |
Kurento/kurento-client-core-js | lib/complexTypes/AudioCaps.js | AudioCaps | function AudioCaps(audioCapsDict){
if(!(this instanceof AudioCaps))
return new AudioCaps(audioCapsDict)
audioCapsDict = audioCapsDict || {}
// Check audioCapsDict has the required fields
//
// checkType('AudioCodec', 'audioCapsDict.codec', audioCapsDict.codec, {required: true});
//
// checkType('... | javascript | function AudioCaps(audioCapsDict){
if(!(this instanceof AudioCaps))
return new AudioCaps(audioCapsDict)
audioCapsDict = audioCapsDict || {}
// Check audioCapsDict has the required fields
//
// checkType('AudioCodec', 'audioCapsDict.codec', audioCapsDict.codec, {required: true});
//
// checkType('... | [
"function",
"AudioCaps",
"(",
"audioCapsDict",
")",
"{",
"if",
"(",
"!",
"(",
"this",
"instanceof",
"AudioCaps",
")",
")",
"return",
"new",
"AudioCaps",
"(",
"audioCapsDict",
")",
"audioCapsDict",
"=",
"audioCapsDict",
"||",
"{",
"}",
"// Check audioCapsDict has... | Format for audio media
@constructor module:core/complexTypes.AudioCaps
@property {module:core/complexTypes.AudioCodec} codec
Audio codec
@property {external:Integer} bitrate
Bitrate | [
"Format",
"for",
"audio",
"media"
] | 20f31e902790e28f14d9a9334b58cdcc848c10f5 | https://github.com/Kurento/kurento-client-core-js/blob/20f31e902790e28f14d9a9334b58cdcc848c10f5/lib/complexTypes/AudioCaps.js#L39-L68 | train |
Kurento/kurento-client-core-js | lib/complexTypes/RTCPeerConnectionStats.js | RTCPeerConnectionStats | function RTCPeerConnectionStats(rTCPeerConnectionStatsDict){
if(!(this instanceof RTCPeerConnectionStats))
return new RTCPeerConnectionStats(rTCPeerConnectionStatsDict)
rTCPeerConnectionStatsDict = rTCPeerConnectionStatsDict || {}
// Check rTCPeerConnectionStatsDict has the required fields
//
// checkT... | javascript | function RTCPeerConnectionStats(rTCPeerConnectionStatsDict){
if(!(this instanceof RTCPeerConnectionStats))
return new RTCPeerConnectionStats(rTCPeerConnectionStatsDict)
rTCPeerConnectionStatsDict = rTCPeerConnectionStatsDict || {}
// Check rTCPeerConnectionStatsDict has the required fields
//
// checkT... | [
"function",
"RTCPeerConnectionStats",
"(",
"rTCPeerConnectionStatsDict",
")",
"{",
"if",
"(",
"!",
"(",
"this",
"instanceof",
"RTCPeerConnectionStats",
")",
")",
"return",
"new",
"RTCPeerConnectionStats",
"(",
"rTCPeerConnectionStatsDict",
")",
"rTCPeerConnectionStatsDict",... | Statistics related to the peer connection.
@constructor module:core/complexTypes.RTCPeerConnectionStats
@property {external:int64} dataChannelsOpened
Represents the number of unique datachannels opened.
@property {external:int64} dataChannelsClosed
Represents the number of unique datachannels closed.
@extends module... | [
"Statistics",
"related",
"to",
"the",
"peer",
"connection",
"."
] | 20f31e902790e28f14d9a9334b58cdcc848c10f5 | https://github.com/Kurento/kurento-client-core-js/blob/20f31e902790e28f14d9a9334b58cdcc848c10f5/lib/complexTypes/RTCPeerConnectionStats.js#L41-L70 | train |
Kurento/kurento-client-core-js | lib/complexTypes/VideoCaps.js | VideoCaps | function VideoCaps(videoCapsDict){
if(!(this instanceof VideoCaps))
return new VideoCaps(videoCapsDict)
videoCapsDict = videoCapsDict || {}
// Check videoCapsDict has the required fields
//
// checkType('VideoCodec', 'videoCapsDict.codec', videoCapsDict.codec, {required: true});
//
// checkType('... | javascript | function VideoCaps(videoCapsDict){
if(!(this instanceof VideoCaps))
return new VideoCaps(videoCapsDict)
videoCapsDict = videoCapsDict || {}
// Check videoCapsDict has the required fields
//
// checkType('VideoCodec', 'videoCapsDict.codec', videoCapsDict.codec, {required: true});
//
// checkType('... | [
"function",
"VideoCaps",
"(",
"videoCapsDict",
")",
"{",
"if",
"(",
"!",
"(",
"this",
"instanceof",
"VideoCaps",
")",
")",
"return",
"new",
"VideoCaps",
"(",
"videoCapsDict",
")",
"videoCapsDict",
"=",
"videoCapsDict",
"||",
"{",
"}",
"// Check videoCapsDict has... | Format for video media
@constructor module:core/complexTypes.VideoCaps
@property {module:core/complexTypes.VideoCodec} codec
Video codec
@property {module:core/complexTypes.Fraction} framerate
Framerate | [
"Format",
"for",
"video",
"media"
] | 20f31e902790e28f14d9a9334b58cdcc848c10f5 | https://github.com/Kurento/kurento-client-core-js/blob/20f31e902790e28f14d9a9334b58cdcc848c10f5/lib/complexTypes/VideoCaps.js#L39-L68 | train |
Kurento/kurento-client-core-js | lib/complexTypes/VideoCodec.js | checkVideoCodec | function checkVideoCodec(key, value)
{
if(typeof value != 'string')
throw SyntaxError(key+' param should be a String, not '+typeof value);
if(!value.match('VP8|H264|RAW'))
throw SyntaxError(key+' param is not one of [VP8|H264|RAW] ('+value+')');
} | javascript | function checkVideoCodec(key, value)
{
if(typeof value != 'string')
throw SyntaxError(key+' param should be a String, not '+typeof value);
if(!value.match('VP8|H264|RAW'))
throw SyntaxError(key+' param is not one of [VP8|H264|RAW] ('+value+')');
} | [
"function",
"checkVideoCodec",
"(",
"key",
",",
"value",
")",
"{",
"if",
"(",
"typeof",
"value",
"!=",
"'string'",
")",
"throw",
"SyntaxError",
"(",
"key",
"+",
"' param should be a String, not '",
"+",
"typeof",
"value",
")",
";",
"if",
"(",
"!",
"value",
... | Codec used for transmission of video.
@typedef core/complexTypes.VideoCodec
@type {(VP8|H264|RAW)}
Checker for {@link module:core/complexTypes.VideoCodec}
@memberof module:core/complexTypes
@param {external:String} key
@param {module:core/complexTypes.VideoCodec} value | [
"Codec",
"used",
"for",
"transmission",
"of",
"video",
"."
] | 20f31e902790e28f14d9a9334b58cdcc848c10f5 | https://github.com/Kurento/kurento-client-core-js/blob/20f31e902790e28f14d9a9334b58cdcc848c10f5/lib/complexTypes/VideoCodec.js#L39-L46 | train |
Kurento/kurento-client-core-js | lib/complexTypes/FilterType.js | checkFilterType | function checkFilterType(key, value)
{
if(typeof value != 'string')
throw SyntaxError(key+' param should be a String, not '+typeof value);
if(!value.match('AUDIO|AUTODETECT|VIDEO'))
throw SyntaxError(key+' param is not one of [AUDIO|AUTODETECT|VIDEO] ('+value+')');
} | javascript | function checkFilterType(key, value)
{
if(typeof value != 'string')
throw SyntaxError(key+' param should be a String, not '+typeof value);
if(!value.match('AUDIO|AUTODETECT|VIDEO'))
throw SyntaxError(key+' param is not one of [AUDIO|AUTODETECT|VIDEO] ('+value+')');
} | [
"function",
"checkFilterType",
"(",
"key",
",",
"value",
")",
"{",
"if",
"(",
"typeof",
"value",
"!=",
"'string'",
")",
"throw",
"SyntaxError",
"(",
"key",
"+",
"' param should be a String, not '",
"+",
"typeof",
"value",
")",
";",
"if",
"(",
"!",
"value",
... | Type of filter to be created.
Can take the values AUDIO, VIDEO or AUTODETECT.
@typedef core/complexTypes.FilterType
@type {(AUDIO|AUTODETECT|VIDEO)}
Checker for {@link module:core/complexTypes.FilterType}
@memberof module:core/complexTypes
@param {external:String} key
@param {module:core/complexTypes.FilterType} ... | [
"Type",
"of",
"filter",
"to",
"be",
"created",
".",
"Can",
"take",
"the",
"values",
"AUDIO",
"VIDEO",
"or",
"AUTODETECT",
"."
] | 20f31e902790e28f14d9a9334b58cdcc848c10f5 | https://github.com/Kurento/kurento-client-core-js/blob/20f31e902790e28f14d9a9334b58cdcc848c10f5/lib/complexTypes/FilterType.js#L40-L47 | train |
Kurento/kurento-client-core-js | lib/complexTypes/MediaType.js | checkMediaType | function checkMediaType(key, value)
{
if(typeof value != 'string')
throw SyntaxError(key+' param should be a String, not '+typeof value);
if(!value.match('AUDIO|DATA|VIDEO'))
throw SyntaxError(key+' param is not one of [AUDIO|DATA|VIDEO] ('+value+')');
} | javascript | function checkMediaType(key, value)
{
if(typeof value != 'string')
throw SyntaxError(key+' param should be a String, not '+typeof value);
if(!value.match('AUDIO|DATA|VIDEO'))
throw SyntaxError(key+' param is not one of [AUDIO|DATA|VIDEO] ('+value+')');
} | [
"function",
"checkMediaType",
"(",
"key",
",",
"value",
")",
"{",
"if",
"(",
"typeof",
"value",
"!=",
"'string'",
")",
"throw",
"SyntaxError",
"(",
"key",
"+",
"' param should be a String, not '",
"+",
"typeof",
"value",
")",
";",
"if",
"(",
"!",
"value",
... | Type of media stream to be exchanged.
Can take the values AUDIO, DATA or VIDEO.
@typedef core/complexTypes.MediaType
@type {(AUDIO|DATA|VIDEO)}
Checker for {@link module:core/complexTypes.MediaType}
@memberof module:core/complexTypes
@param {external:String} key
@param {module:core/complexTypes.MediaType} value | [
"Type",
"of",
"media",
"stream",
"to",
"be",
"exchanged",
".",
"Can",
"take",
"the",
"values",
"AUDIO",
"DATA",
"or",
"VIDEO",
"."
] | 20f31e902790e28f14d9a9334b58cdcc848c10f5 | https://github.com/Kurento/kurento-client-core-js/blob/20f31e902790e28f14d9a9334b58cdcc848c10f5/lib/complexTypes/MediaType.js#L40-L47 | train |
Kurento/kurento-client-core-js | lib/complexTypes/EndpointStats.js | EndpointStats | function EndpointStats(endpointStatsDict){
if(!(this instanceof EndpointStats))
return new EndpointStats(endpointStatsDict)
endpointStatsDict = endpointStatsDict || {}
// Check endpointStatsDict has the required fields
//
// checkType('double', 'endpointStatsDict.audioE2ELatency', endpointStatsDict.aud... | javascript | function EndpointStats(endpointStatsDict){
if(!(this instanceof EndpointStats))
return new EndpointStats(endpointStatsDict)
endpointStatsDict = endpointStatsDict || {}
// Check endpointStatsDict has the required fields
//
// checkType('double', 'endpointStatsDict.audioE2ELatency', endpointStatsDict.aud... | [
"function",
"EndpointStats",
"(",
"endpointStatsDict",
")",
"{",
"if",
"(",
"!",
"(",
"this",
"instanceof",
"EndpointStats",
")",
")",
"return",
"new",
"EndpointStats",
"(",
"endpointStatsDict",
")",
"endpointStatsDict",
"=",
"endpointStatsDict",
"||",
"{",
"}",
... | A dictionary that represents the stats gathered in the endpoint element.
@constructor module:core/complexTypes.EndpointStats
@property {external:double} audioE2ELatency
@deprecated
End-to-end audio latency measured in nano seconds
@property {external:double} videoE2ELatency
@deprecated
End-to-end video latency measur... | [
"A",
"dictionary",
"that",
"represents",
"the",
"stats",
"gathered",
"in",
"the",
"endpoint",
"element",
"."
] | 20f31e902790e28f14d9a9334b58cdcc848c10f5 | https://github.com/Kurento/kurento-client-core-js/blob/20f31e902790e28f14d9a9334b58cdcc848c10f5/lib/complexTypes/EndpointStats.js#L46-L82 | train |
Kurento/kurento-client-core-js | lib/complexTypes/Fraction.js | Fraction | function Fraction(fractionDict){
if(!(this instanceof Fraction))
return new Fraction(fractionDict)
fractionDict = fractionDict || {}
// Check fractionDict has the required fields
//
// checkType('int', 'fractionDict.numerator', fractionDict.numerator, {required: true});
//
// checkType('int', 'fr... | javascript | function Fraction(fractionDict){
if(!(this instanceof Fraction))
return new Fraction(fractionDict)
fractionDict = fractionDict || {}
// Check fractionDict has the required fields
//
// checkType('int', 'fractionDict.numerator', fractionDict.numerator, {required: true});
//
// checkType('int', 'fr... | [
"function",
"Fraction",
"(",
"fractionDict",
")",
"{",
"if",
"(",
"!",
"(",
"this",
"instanceof",
"Fraction",
")",
")",
"return",
"new",
"Fraction",
"(",
"fractionDict",
")",
"fractionDict",
"=",
"fractionDict",
"||",
"{",
"}",
"// Check fractionDict has the req... | Type that represents a fraction of an integer numerator over an integer
denominator
@constructor module:core/complexTypes.Fraction
@property {external:Integer} numerator
the numerator of the fraction
@property {external:Integer} denominator
the denominator of the fraction | [
"Type",
"that",
"represents",
"a",
"fraction",
"of",
"an",
"integer",
"numerator",
"over",
"an",
"integer",
"denominator"
] | 20f31e902790e28f14d9a9334b58cdcc848c10f5 | https://github.com/Kurento/kurento-client-core-js/blob/20f31e902790e28f14d9a9334b58cdcc848c10f5/lib/complexTypes/Fraction.js#L40-L69 | train |
Kurento/kurento-client-core-js | lib/complexTypes/MediaTranscodingState.js | checkMediaTranscodingState | function checkMediaTranscodingState(key, value)
{
if(typeof value != 'string')
throw SyntaxError(key+' param should be a String, not '+typeof value);
if(!value.match('TRANSCODING|NOT_TRANSCODING'))
throw SyntaxError(key+' param is not one of [TRANSCODING|NOT_TRANSCODING] ('+value+')');
} | javascript | function checkMediaTranscodingState(key, value)
{
if(typeof value != 'string')
throw SyntaxError(key+' param should be a String, not '+typeof value);
if(!value.match('TRANSCODING|NOT_TRANSCODING'))
throw SyntaxError(key+' param is not one of [TRANSCODING|NOT_TRANSCODING] ('+value+')');
} | [
"function",
"checkMediaTranscodingState",
"(",
"key",
",",
"value",
")",
"{",
"if",
"(",
"typeof",
"value",
"!=",
"'string'",
")",
"throw",
"SyntaxError",
"(",
"key",
"+",
"' param should be a String, not '",
"+",
"typeof",
"value",
")",
";",
"if",
"(",
"!",
... | Transcoding state for a media.
@typedef core/complexTypes.MediaTranscodingState
@type {(TRANSCODING|NOT_TRANSCODING)}
Checker for {@link module:core/complexTypes.MediaTranscodingState}
@memberof module:core/complexTypes
@param {external:String} key
@param {module:core/complexTypes.MediaTranscodingState} value | [
"Transcoding",
"state",
"for",
"a",
"media",
"."
] | 20f31e902790e28f14d9a9334b58cdcc848c10f5 | https://github.com/Kurento/kurento-client-core-js/blob/20f31e902790e28f14d9a9334b58cdcc848c10f5/lib/complexTypes/MediaTranscodingState.js#L39-L46 | train |
Kurento/kurento-client-core-js | lib/complexTypes/ServerType.js | checkServerType | function checkServerType(key, value)
{
if(typeof value != 'string')
throw SyntaxError(key+' param should be a String, not '+typeof value);
if(!value.match('KMS|KCS'))
throw SyntaxError(key+' param is not one of [KMS|KCS] ('+value+')');
} | javascript | function checkServerType(key, value)
{
if(typeof value != 'string')
throw SyntaxError(key+' param should be a String, not '+typeof value);
if(!value.match('KMS|KCS'))
throw SyntaxError(key+' param is not one of [KMS|KCS] ('+value+')');
} | [
"function",
"checkServerType",
"(",
"key",
",",
"value",
")",
"{",
"if",
"(",
"typeof",
"value",
"!=",
"'string'",
")",
"throw",
"SyntaxError",
"(",
"key",
"+",
"' param should be a String, not '",
"+",
"typeof",
"value",
")",
";",
"if",
"(",
"!",
"value",
... | Indicates if the server is a real media server or a proxy
@typedef core/complexTypes.ServerType
@type {(KMS|KCS)}
Checker for {@link module:core/complexTypes.ServerType}
@memberof module:core/complexTypes
@param {external:String} key
@param {module:core/complexTypes.ServerType} value | [
"Indicates",
"if",
"the",
"server",
"is",
"a",
"real",
"media",
"server",
"or",
"a",
"proxy"
] | 20f31e902790e28f14d9a9334b58cdcc848c10f5 | https://github.com/Kurento/kurento-client-core-js/blob/20f31e902790e28f14d9a9334b58cdcc848c10f5/lib/complexTypes/ServerType.js#L39-L46 | train |
Kurento/kurento-client-core-js | lib/complexTypes/ElementStats.js | ElementStats | function ElementStats(elementStatsDict){
if(!(this instanceof ElementStats))
return new ElementStats(elementStatsDict)
elementStatsDict = elementStatsDict || {}
// Check elementStatsDict has the required fields
//
// checkType('double', 'elementStatsDict.inputAudioLatency', elementStatsDict.inputAudioL... | javascript | function ElementStats(elementStatsDict){
if(!(this instanceof ElementStats))
return new ElementStats(elementStatsDict)
elementStatsDict = elementStatsDict || {}
// Check elementStatsDict has the required fields
//
// checkType('double', 'elementStatsDict.inputAudioLatency', elementStatsDict.inputAudioL... | [
"function",
"ElementStats",
"(",
"elementStatsDict",
")",
"{",
"if",
"(",
"!",
"(",
"this",
"instanceof",
"ElementStats",
")",
")",
"return",
"new",
"ElementStats",
"(",
"elementStatsDict",
")",
"elementStatsDict",
"=",
"elementStatsDict",
"||",
"{",
"}",
"// Ch... | A dictionary that represents the stats gathered in the media element.
@constructor module:core/complexTypes.ElementStats
@property {external:double} inputAudioLatency
@deprecated
Audio average measured on the sink pad in nano seconds
@property {external:double} inputVideoLatency
@deprecated
Video average measured on ... | [
"A",
"dictionary",
"that",
"represents",
"the",
"stats",
"gathered",
"in",
"the",
"media",
"element",
"."
] | 20f31e902790e28f14d9a9334b58cdcc848c10f5 | https://github.com/Kurento/kurento-client-core-js/blob/20f31e902790e28f14d9a9334b58cdcc848c10f5/lib/complexTypes/ElementStats.js#L46-L82 | train |
Kurento/kurento-client-core-js | lib/complexTypes/UriEndpointState.js | checkUriEndpointState | function checkUriEndpointState(key, value)
{
if(typeof value != 'string')
throw SyntaxError(key+' param should be a String, not '+typeof value);
if(!value.match('STOP|START|PAUSE'))
throw SyntaxError(key+' param is not one of [STOP|START|PAUSE] ('+value+')');
} | javascript | function checkUriEndpointState(key, value)
{
if(typeof value != 'string')
throw SyntaxError(key+' param should be a String, not '+typeof value);
if(!value.match('STOP|START|PAUSE'))
throw SyntaxError(key+' param is not one of [STOP|START|PAUSE] ('+value+')');
} | [
"function",
"checkUriEndpointState",
"(",
"key",
",",
"value",
")",
"{",
"if",
"(",
"typeof",
"value",
"!=",
"'string'",
")",
"throw",
"SyntaxError",
"(",
"key",
"+",
"' param should be a String, not '",
"+",
"typeof",
"value",
")",
";",
"if",
"(",
"!",
"val... | State of the endpoint
@typedef core/complexTypes.UriEndpointState
@type {(STOP|START|PAUSE)}
Checker for {@link module:core/complexTypes.UriEndpointState}
@memberof module:core/complexTypes
@param {external:String} key
@param {module:core/complexTypes.UriEndpointState} value | [
"State",
"of",
"the",
"endpoint"
] | 20f31e902790e28f14d9a9334b58cdcc848c10f5 | https://github.com/Kurento/kurento-client-core-js/blob/20f31e902790e28f14d9a9334b58cdcc848c10f5/lib/complexTypes/UriEndpointState.js#L39-L46 | train |
Kurento/kurento-client-core-js | lib/complexTypes/RembParams.js | RembParams | function RembParams(rembParamsDict){
if(!(this instanceof RembParams))
return new RembParams(rembParamsDict)
rembParamsDict = rembParamsDict || {}
// Check rembParamsDict has the required fields
//
// checkType('int', 'rembParamsDict.packetsRecvIntervalTop', rembParamsDict.packetsRecvIntervalTop);
//... | javascript | function RembParams(rembParamsDict){
if(!(this instanceof RembParams))
return new RembParams(rembParamsDict)
rembParamsDict = rembParamsDict || {}
// Check rembParamsDict has the required fields
//
// checkType('int', 'rembParamsDict.packetsRecvIntervalTop', rembParamsDict.packetsRecvIntervalTop);
//... | [
"function",
"RembParams",
"(",
"rembParamsDict",
")",
"{",
"if",
"(",
"!",
"(",
"this",
"instanceof",
"RembParams",
")",
")",
"return",
"new",
"RembParams",
"(",
"rembParamsDict",
")",
"rembParamsDict",
"=",
"rembParamsDict",
"||",
"{",
"}",
"// Check rembParams... | Defines values for parameters of congestion control
@constructor module:core/complexTypes.RembParams
@property {external:Integer} packetsRecvIntervalTop
Size of the RTP packets history to smooth fraction-lost.
Units: num of packets
@property {external:Number} exponentialFactor
Factor used to increase exponentially th... | [
"Defines",
"values",
"for",
"parameters",
"of",
"congestion",
"control"
] | 20f31e902790e28f14d9a9334b58cdcc848c10f5 | https://github.com/Kurento/kurento-client-core-js/blob/20f31e902790e28f14d9a9334b58cdcc848c10f5/lib/complexTypes/RembParams.js#L65-L136 | train |
gitbook-plugins/gitbook-plugin-search-pro | index.js | function(page) {
if (this.output.name != 'website' || page.search === false) {
return page;
}
var text;
this.log.debug.ln('index page', page.path);
text = page.content;
// Decode HTML
text = Html.decode(tex... | javascript | function(page) {
if (this.output.name != 'website' || page.search === false) {
return page;
}
var text;
this.log.debug.ln('index page', page.path);
text = page.content;
// Decode HTML
text = Html.decode(tex... | [
"function",
"(",
"page",
")",
"{",
"if",
"(",
"this",
".",
"output",
".",
"name",
"!=",
"'website'",
"||",
"page",
".",
"search",
"===",
"false",
")",
"{",
"return",
"page",
";",
"}",
"var",
"text",
";",
"this",
".",
"log",
".",
"debug",
".",
"ln... | Index each page | [
"Index",
"each",
"page"
] | 9e9e86c1b54c8363d75d309713d3d502a36bcdcf | https://github.com/gitbook-plugins/gitbook-plugin-search-pro/blob/9e9e86c1b54c8363d75d309713d3d502a36bcdcf/index.js#L22-L54 | train | |
gitbook-plugins/gitbook-plugin-search-pro | index.js | function() {
if (this.output.name != 'website') return;
this.log.debug.ln('write search index');
return this.output.writeFile('search_plus_index.json', JSON.stringify(documentsStore));
} | javascript | function() {
if (this.output.name != 'website') return;
this.log.debug.ln('write search index');
return this.output.writeFile('search_plus_index.json', JSON.stringify(documentsStore));
} | [
"function",
"(",
")",
"{",
"if",
"(",
"this",
".",
"output",
".",
"name",
"!=",
"'website'",
")",
"return",
";",
"this",
".",
"log",
".",
"debug",
".",
"ln",
"(",
"'write search index'",
")",
";",
"return",
"this",
".",
"output",
".",
"writeFile",
"(... | Write index to disk | [
"Write",
"index",
"to",
"disk"
] | 9e9e86c1b54c8363d75d309713d3d502a36bcdcf | https://github.com/gitbook-plugins/gitbook-plugin-search-pro/blob/9e9e86c1b54c8363d75d309713d3d502a36bcdcf/index.js#L57-L62 | train | |
mapbox/to-color | index.js | toColor | function toColor(str, opacity) {
var rgb = [0, 0, 0, opacity || 0.75];
try {
for (var i = 0; i < str.length; i++) {
var v = str.charCodeAt(i);
var idx = v % 3;
rgb[idx] = (rgb[i % 3] + (13 * (v % 13))) % 20;
}
} finally {
return 'rgba(' +
rgb.map(function(c, idx) {
return idx... | javascript | function toColor(str, opacity) {
var rgb = [0, 0, 0, opacity || 0.75];
try {
for (var i = 0; i < str.length; i++) {
var v = str.charCodeAt(i);
var idx = v % 3;
rgb[idx] = (rgb[i % 3] + (13 * (v % 13))) % 20;
}
} finally {
return 'rgba(' +
rgb.map(function(c, idx) {
return idx... | [
"function",
"toColor",
"(",
"str",
",",
"opacity",
")",
"{",
"var",
"rgb",
"=",
"[",
"0",
",",
"0",
",",
"0",
",",
"opacity",
"||",
"0.75",
"]",
";",
"try",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"str",
".",
"length",
";",
"i... | Given an arbitrary string, create a rgba color
of a specified opacity to identify it visually.
@param {string} str any arbitrary string
@param {number} opacity an opacity value from 0 to 1
@returns {string} output color
@example
toColor('tom') //= 'rgba(187,153,68,0.75)'
toColor() //= 'rgba(0,0,0,0.74)' | [
"Given",
"an",
"arbitrary",
"string",
"create",
"a",
"rgba",
"color",
"of",
"a",
"specified",
"opacity",
"to",
"identify",
"it",
"visually",
"."
] | 05befd89d423dbade569d1e3d3e8542a1897a59f | https://github.com/mapbox/to-color/blob/05befd89d423dbade569d1e3d3e8542a1897a59f/index.js#L11-L25 | train |
ostdotcom/cache | index.js | function(configStrategy) {
if (!configStrategy.hasOwnProperty('cache') || !configStrategy.cache.hasOwnProperty('engine')) {
throw 'CACHING_ENGINE parameter is missing.';
}
if (configStrategy.cache.engine === undefined) {
throw 'CACHING_ENGINE parameter is empty.';
}
// Grab the required details from ... | javascript | function(configStrategy) {
if (!configStrategy.hasOwnProperty('cache') || !configStrategy.cache.hasOwnProperty('engine')) {
throw 'CACHING_ENGINE parameter is missing.';
}
if (configStrategy.cache.engine === undefined) {
throw 'CACHING_ENGINE parameter is empty.';
}
// Grab the required details from ... | [
"function",
"(",
"configStrategy",
")",
"{",
"if",
"(",
"!",
"configStrategy",
".",
"hasOwnProperty",
"(",
"'cache'",
")",
"||",
"!",
"configStrategy",
".",
"cache",
".",
"hasOwnProperty",
"(",
"'engine'",
")",
")",
"{",
"throw",
"'CACHING_ENGINE parameter is mi... | Creates the key for the instanceMap.
@returns {string} | [
"Creates",
"the",
"key",
"for",
"the",
"instanceMap",
"."
] | 5fd550e262fdf25479d3d0c417364c4dc7c45530 | https://github.com/ostdotcom/cache/blob/5fd550e262fdf25479d3d0c417364c4dc7c45530/index.js#L48-L99 | train | |
ostdotcom/cache | lib/cache/implementer/InMemory.js | function(lifetimeInSec) {
lifetimeInSec = Number(lifetimeInSec);
if (isNaN(lifetimeInSec)) {
lifetimeInSec = 0;
}
let lifetime = lifetimeInSec * 1000;
if (lifetime <= 0) {
this.expires = Date.now();
} else {
this.expires = Date.now() + lifetime;
}
} | javascript | function(lifetimeInSec) {
lifetimeInSec = Number(lifetimeInSec);
if (isNaN(lifetimeInSec)) {
lifetimeInSec = 0;
}
let lifetime = lifetimeInSec * 1000;
if (lifetime <= 0) {
this.expires = Date.now();
} else {
this.expires = Date.now() + lifetime;
}
} | [
"function",
"(",
"lifetimeInSec",
")",
"{",
"lifetimeInSec",
"=",
"Number",
"(",
"lifetimeInSec",
")",
";",
"if",
"(",
"isNaN",
"(",
"lifetimeInSec",
")",
")",
"{",
"lifetimeInSec",
"=",
"0",
";",
"}",
"let",
"lifetime",
"=",
"lifetimeInSec",
"*",
"1000",
... | Sets the expiry timestamp of the record.
@param {number} lifetimeInSec life-time is seconds after which record is considered expired. | [
"Sets",
"the",
"expiry",
"timestamp",
"of",
"the",
"record",
"."
] | 5fd550e262fdf25479d3d0c417364c4dc7c45530 | https://github.com/ostdotcom/cache/blob/5fd550e262fdf25479d3d0c417364c4dc7c45530/lib/cache/implementer/InMemory.js#L591-L603 | train | |
stellar/js-xdr | src/config.js | createTypedef | function createTypedef(context, typeName, value) {
if (value instanceof Reference) {
value = value.resolve(context);
}
context.results[typeName] = value;
return value;
} | javascript | function createTypedef(context, typeName, value) {
if (value instanceof Reference) {
value = value.resolve(context);
}
context.results[typeName] = value;
return value;
} | [
"function",
"createTypedef",
"(",
"context",
",",
"typeName",
",",
"value",
")",
"{",
"if",
"(",
"value",
"instanceof",
"Reference",
")",
"{",
"value",
"=",
"value",
".",
"resolve",
"(",
"context",
")",
";",
"}",
"context",
".",
"results",
"[",
"typeName... | let the reference resoltion system do it's thing the "constructor" for a typedef just returns the resolved value | [
"let",
"the",
"reference",
"resoltion",
"system",
"do",
"it",
"s",
"thing",
"the",
"constructor",
"for",
"a",
"typedef",
"just",
"returns",
"the",
"resolved",
"value"
] | 8a7e48e0eda432a33d0f68af00c5642f5706ac0a | https://github.com/stellar/js-xdr/blob/8a7e48e0eda432a33d0f68af00c5642f5706ac0a/src/config.js#L119-L125 | train |
blackbaud/skyux-builder | config/webpack/alias-builder.js | setSpaAlias | function setSpaAlias(alias, moduleName, path) {
let resolvedPath = spaPath(path);
if (!fs.existsSync(resolvedPath)) {
resolvedPath = outPath(path);
}
alias['sky-pages-internal/' + moduleName] = resolvedPath;
} | javascript | function setSpaAlias(alias, moduleName, path) {
let resolvedPath = spaPath(path);
if (!fs.existsSync(resolvedPath)) {
resolvedPath = outPath(path);
}
alias['sky-pages-internal/' + moduleName] = resolvedPath;
} | [
"function",
"setSpaAlias",
"(",
"alias",
",",
"moduleName",
",",
"path",
")",
"{",
"let",
"resolvedPath",
"=",
"spaPath",
"(",
"path",
")",
";",
"if",
"(",
"!",
"fs",
".",
"existsSync",
"(",
"resolvedPath",
")",
")",
"{",
"resolvedPath",
"=",
"outPath",
... | Sets an alias to the specified module using the SPA path if the file exists in the SPA;
otherwise it sets the alias to the file in SKY UX Builder.
@name setSpaAlias
@param {Object} alias
@param {String} moduleName
@param {String} path | [
"Sets",
"an",
"alias",
"to",
"the",
"specified",
"module",
"using",
"the",
"SPA",
"path",
"if",
"the",
"file",
"exists",
"in",
"the",
"SPA",
";",
"otherwise",
"it",
"sets",
"the",
"alias",
"to",
"the",
"file",
"in",
"SKY",
"UX",
"Builder",
"."
] | fe8c622f12817552f85940abe194ddcb262e7b44 | https://github.com/blackbaud/skyux-builder/blob/fe8c622f12817552f85940abe194ddcb262e7b44/config/webpack/alias-builder.js#L24-L32 | train |
blackbaud/skyux-builder | utils/host-utils.js | resolve | function resolve(url, localUrl, chunks, skyPagesConfig) {
let host = skyPagesConfig.skyux.host.url;
let config = {
scripts: getScripts(chunks),
localUrl: localUrl
};
if (skyPagesConfig.skyux.app && skyPagesConfig.skyux.app.externals) {
config.externals = skyPagesConfig.skyux.app.externals;
}
/... | javascript | function resolve(url, localUrl, chunks, skyPagesConfig) {
let host = skyPagesConfig.skyux.host.url;
let config = {
scripts: getScripts(chunks),
localUrl: localUrl
};
if (skyPagesConfig.skyux.app && skyPagesConfig.skyux.app.externals) {
config.externals = skyPagesConfig.skyux.app.externals;
}
/... | [
"function",
"resolve",
"(",
"url",
",",
"localUrl",
",",
"chunks",
",",
"skyPagesConfig",
")",
"{",
"let",
"host",
"=",
"skyPagesConfig",
".",
"skyux",
".",
"host",
".",
"url",
";",
"let",
"config",
"=",
"{",
"scripts",
":",
"getScripts",
"(",
"chunks",
... | Creates a resolved host url.
@param {string} url
@param {string} localUrl
@param {Array} chunks
@param {Object} skyPagesConfig | [
"Creates",
"a",
"resolved",
"host",
"url",
"."
] | fe8c622f12817552f85940abe194ddcb262e7b44 | https://github.com/blackbaud/skyux-builder/blob/fe8c622f12817552f85940abe194ddcb262e7b44/utils/host-utils.js#L14-L41 | train |
blackbaud/skyux-builder | utils/host-utils.js | getScripts | function getScripts(chunks) {
let scripts = [];
// Used when skipping the build, short-circuit to return metadata
if (chunks.metadata) {
return chunks.metadata;
}
sorter.dependency(chunks).forEach((chunk) => {
scripts.push({
name: chunk.files[0]
});
});
return scripts;
} | javascript | function getScripts(chunks) {
let scripts = [];
// Used when skipping the build, short-circuit to return metadata
if (chunks.metadata) {
return chunks.metadata;
}
sorter.dependency(chunks).forEach((chunk) => {
scripts.push({
name: chunk.files[0]
});
});
return scripts;
} | [
"function",
"getScripts",
"(",
"chunks",
")",
"{",
"let",
"scripts",
"=",
"[",
"]",
";",
"// Used when skipping the build, short-circuit to return metadata",
"if",
"(",
"chunks",
".",
"metadata",
")",
"{",
"return",
"chunks",
".",
"metadata",
";",
"}",
"sorter",
... | Sorts chunks into array of scripts.
@param {Array} chunks | [
"Sorts",
"chunks",
"into",
"array",
"of",
"scripts",
"."
] | fe8c622f12817552f85940abe194ddcb262e7b44 | https://github.com/blackbaud/skyux-builder/blob/fe8c622f12817552f85940abe194ddcb262e7b44/utils/host-utils.js#L47-L62 | train |
blackbaud/skyux-builder | config/webpack/serve.webpack.config.js | WebpackPluginDone | function WebpackPluginDone() {
let launched = false;
this.plugin('done', (stats) => {
if (!launched) {
launched = true;
browser(argv, skyPagesConfig, stats, this.options.devServer.port);
}
});
} | javascript | function WebpackPluginDone() {
let launched = false;
this.plugin('done', (stats) => {
if (!launched) {
launched = true;
browser(argv, skyPagesConfig, stats, this.options.devServer.port);
}
});
} | [
"function",
"WebpackPluginDone",
"(",
")",
"{",
"let",
"launched",
"=",
"false",
";",
"this",
".",
"plugin",
"(",
"'done'",
",",
"(",
"stats",
")",
"=>",
"{",
"if",
"(",
"!",
"launched",
")",
"{",
"launched",
"=",
"true",
";",
"browser",
"(",
"argv",... | Opens the host service url.
@name WebpackPluginDone | [
"Opens",
"the",
"host",
"service",
"url",
"."
] | fe8c622f12817552f85940abe194ddcb262e7b44 | https://github.com/blackbaud/skyux-builder/blob/fe8c622f12817552f85940abe194ddcb262e7b44/config/webpack/serve.webpack.config.js#L25-L34 | train |
blackbaud/skyux-builder | lib/sky-pages-route-generator.js | getRoutesForConfig | function getRoutesForConfig(routes) {
return routes.map(route => ({
routePath: route.routePath === '?' ? '' : route.routePath.replace(/\#/g, ''),
routeParams: route.routeParams
}));
} | javascript | function getRoutesForConfig(routes) {
return routes.map(route => ({
routePath: route.routePath === '?' ? '' : route.routePath.replace(/\#/g, ''),
routeParams: route.routeParams
}));
} | [
"function",
"getRoutesForConfig",
"(",
"routes",
")",
"{",
"return",
"routes",
".",
"map",
"(",
"route",
"=>",
"(",
"{",
"routePath",
":",
"route",
".",
"routePath",
"===",
"'?'",
"?",
"''",
":",
"route",
".",
"routePath",
".",
"replace",
"(",
"/",
"\\... | Only expose certain properties to SkyAppConfig. Specifically routeDefinition caused errors for skyux e2e in Windows. | [
"Only",
"expose",
"certain",
"properties",
"to",
"SkyAppConfig",
".",
"Specifically",
"routeDefinition",
"caused",
"errors",
"for",
"skyux",
"e2e",
"in",
"Windows",
"."
] | fe8c622f12817552f85940abe194ddcb262e7b44 | https://github.com/blackbaud/skyux-builder/blob/fe8c622f12817552f85940abe194ddcb262e7b44/lib/sky-pages-route-generator.js#L306-L311 | train |
blackbaud/skyux-builder | cli/e2e.js | killServers | function killServers(exitCode) {
logger.info('Cleaning up running servers');
if (seleniumServer) {
logger.info('Closing selenium server');
seleniumServer.kill();
seleniumServer = null;
}
// Catch protractor's "Kitchen Sink" error.
if (exitCode === 199) {
logger.warn('Supressing protractor\'s... | javascript | function killServers(exitCode) {
logger.info('Cleaning up running servers');
if (seleniumServer) {
logger.info('Closing selenium server');
seleniumServer.kill();
seleniumServer = null;
}
// Catch protractor's "Kitchen Sink" error.
if (exitCode === 199) {
logger.warn('Supressing protractor\'s... | [
"function",
"killServers",
"(",
"exitCode",
")",
"{",
"logger",
".",
"info",
"(",
"'Cleaning up running servers'",
")",
";",
"if",
"(",
"seleniumServer",
")",
"{",
"logger",
".",
"info",
"(",
"'Closing selenium server'",
")",
";",
"seleniumServer",
".",
"kill",
... | Handles killing off the selenium and webpack servers.
@name killServers | [
"Handles",
"killing",
"off",
"the",
"selenium",
"and",
"webpack",
"servers",
"."
] | fe8c622f12817552f85940abe194ddcb262e7b44 | https://github.com/blackbaud/skyux-builder/blob/fe8c622f12817552f85940abe194ddcb262e7b44/cli/e2e.js#L27-L46 | train |
blackbaud/skyux-builder | cli/e2e.js | spawnProtractor | function spawnProtractor(configPath, chunks, port, skyPagesConfig) {
logger.info('Running Protractor');
protractorLauncher.init(configPath, {
params: {
localUrl: `https://localhost:${port}`,
chunks: chunks,
skyPagesConfig: skyPagesConfig
}
});
process.on('exit', killServers);
} | javascript | function spawnProtractor(configPath, chunks, port, skyPagesConfig) {
logger.info('Running Protractor');
protractorLauncher.init(configPath, {
params: {
localUrl: `https://localhost:${port}`,
chunks: chunks,
skyPagesConfig: skyPagesConfig
}
});
process.on('exit', killServers);
} | [
"function",
"spawnProtractor",
"(",
"configPath",
",",
"chunks",
",",
"port",
",",
"skyPagesConfig",
")",
"{",
"logger",
".",
"info",
"(",
"'Running Protractor'",
")",
";",
"protractorLauncher",
".",
"init",
"(",
"configPath",
",",
"{",
"params",
":",
"{",
"... | Spawns the protractor command.
Perhaps this should be API driven?
@name spawnProtractor | [
"Spawns",
"the",
"protractor",
"command",
".",
"Perhaps",
"this",
"should",
"be",
"API",
"driven?"
] | fe8c622f12817552f85940abe194ddcb262e7b44 | https://github.com/blackbaud/skyux-builder/blob/fe8c622f12817552f85940abe194ddcb262e7b44/cli/e2e.js#L53-L63 | train |
blackbaud/skyux-builder | cli/e2e.js | getChromeDriverVersion | function getChromeDriverVersion() {
return new Promise(resolve => {
const defaultVersion = 'latest';
matcher.getChromeDriverVersion()
.then(result => {
if (result.chromeDriverVersion) {
resolve(result.chromeDriverVersion);
} else {
resolve(defaultVersion);
}
... | javascript | function getChromeDriverVersion() {
return new Promise(resolve => {
const defaultVersion = 'latest';
matcher.getChromeDriverVersion()
.then(result => {
if (result.chromeDriverVersion) {
resolve(result.chromeDriverVersion);
} else {
resolve(defaultVersion);
}
... | [
"function",
"getChromeDriverVersion",
"(",
")",
"{",
"return",
"new",
"Promise",
"(",
"resolve",
"=>",
"{",
"const",
"defaultVersion",
"=",
"'latest'",
";",
"matcher",
".",
"getChromeDriverVersion",
"(",
")",
".",
"then",
"(",
"result",
"=>",
"{",
"if",
"(",... | Calls the getChromeDriverVersion method in our library, but handles any errors. | [
"Calls",
"the",
"getChromeDriverVersion",
"method",
"in",
"our",
"library",
"but",
"handles",
"any",
"errors",
"."
] | fe8c622f12817552f85940abe194ddcb262e7b44 | https://github.com/blackbaud/skyux-builder/blob/fe8c622f12817552f85940abe194ddcb262e7b44/cli/e2e.js#L68-L82 | train |
blackbaud/skyux-builder | cli/e2e.js | spawnSelenium | function spawnSelenium(configPath) {
const config = require(configPath).config;
return new Promise((resolve, reject) => {
logger.info('Spawning selenium...');
// Assumes we're running selenium ourselves, so we should prep it
if (config.seleniumAddress) {
logger.info('Installing Selenium...');
... | javascript | function spawnSelenium(configPath) {
const config = require(configPath).config;
return new Promise((resolve, reject) => {
logger.info('Spawning selenium...');
// Assumes we're running selenium ourselves, so we should prep it
if (config.seleniumAddress) {
logger.info('Installing Selenium...');
... | [
"function",
"spawnSelenium",
"(",
"configPath",
")",
"{",
"const",
"config",
"=",
"require",
"(",
"configPath",
")",
".",
"config",
";",
"return",
"new",
"Promise",
"(",
"(",
"resolve",
",",
"reject",
")",
"=>",
"{",
"logger",
".",
"info",
"(",
"'Spawnin... | Spawns the selenium server if directConnect is not enabled.
@name spawnSelenium | [
"Spawns",
"the",
"selenium",
"server",
"if",
"directConnect",
"is",
"not",
"enabled",
"."
] | fe8c622f12817552f85940abe194ddcb262e7b44 | https://github.com/blackbaud/skyux-builder/blob/fe8c622f12817552f85940abe194ddcb262e7b44/cli/e2e.js#L88-L150 | train |
blackbaud/skyux-builder | cli/e2e.js | spawnBuild | function spawnBuild(argv, skyPagesConfig, webpack) {
if (argv.build === false) {
logger.info('Skipping build step');
const file = 'dist/metadata.json';
if (!fs.existsSync(file)) {
logger.info(`Unable to skip build step. "${file}" not found.`);
} else {
return Promise.resolve({
m... | javascript | function spawnBuild(argv, skyPagesConfig, webpack) {
if (argv.build === false) {
logger.info('Skipping build step');
const file = 'dist/metadata.json';
if (!fs.existsSync(file)) {
logger.info(`Unable to skip build step. "${file}" not found.`);
} else {
return Promise.resolve({
m... | [
"function",
"spawnBuild",
"(",
"argv",
",",
"skyPagesConfig",
",",
"webpack",
")",
"{",
"if",
"(",
"argv",
".",
"build",
"===",
"false",
")",
"{",
"logger",
".",
"info",
"(",
"'Skipping build step'",
")",
";",
"const",
"file",
"=",
"'dist/metadata.json'",
... | Spawns the build process. Captures the config used. | [
"Spawns",
"the",
"build",
"process",
".",
"Captures",
"the",
"config",
"used",
"."
] | fe8c622f12817552f85940abe194ddcb262e7b44 | https://github.com/blackbaud/skyux-builder/blob/fe8c622f12817552f85940abe194ddcb262e7b44/cli/e2e.js#L155-L172 | train |
blackbaud/skyux-builder | cli/e2e.js | e2e | function e2e(command, argv, skyPagesConfig, webpack) {
start = new Date().getTime();
process.on('SIGINT', killServers);
const specsPath = path.resolve(process.cwd(), 'e2e/**/*.e2e-spec.ts');
const specsGlob = glob.sync(specsPath);
const configPath = configResolver.resolve(command, argv);
if (specsGlob.len... | javascript | function e2e(command, argv, skyPagesConfig, webpack) {
start = new Date().getTime();
process.on('SIGINT', killServers);
const specsPath = path.resolve(process.cwd(), 'e2e/**/*.e2e-spec.ts');
const specsGlob = glob.sync(specsPath);
const configPath = configResolver.resolve(command, argv);
if (specsGlob.len... | [
"function",
"e2e",
"(",
"command",
",",
"argv",
",",
"skyPagesConfig",
",",
"webpack",
")",
"{",
"start",
"=",
"new",
"Date",
"(",
")",
".",
"getTime",
"(",
")",
";",
"process",
".",
"on",
"(",
"'SIGINT'",
",",
"killServers",
")",
";",
"const",
"spec... | Spawns the necessary commands for e2e.
Assumes build was ran.
@name e2e | [
"Spawns",
"the",
"necessary",
"commands",
"for",
"e2e",
".",
"Assumes",
"build",
"was",
"ran",
"."
] | fe8c622f12817552f85940abe194ddcb262e7b44 | https://github.com/blackbaud/skyux-builder/blob/fe8c622f12817552f85940abe194ddcb262e7b44/cli/e2e.js#L179-L222 | train |
blackbaud/skyux-builder | e2e/shared/common.js | bindServe | function bindServe() {
return new Promise((resolve, reject) => {
// Logging "warnings" but not rejecting test
webpackServer.stderr.on('data', data => log(data));
webpackServer.stdout.on('data', data => {
const dataAsString = log(data);
if (dataAsString.indexOf('webpack: Compiled successfully.... | javascript | function bindServe() {
return new Promise((resolve, reject) => {
// Logging "warnings" but not rejecting test
webpackServer.stderr.on('data', data => log(data));
webpackServer.stdout.on('data', data => {
const dataAsString = log(data);
if (dataAsString.indexOf('webpack: Compiled successfully.... | [
"function",
"bindServe",
"(",
")",
"{",
"return",
"new",
"Promise",
"(",
"(",
"resolve",
",",
"reject",
")",
"=>",
"{",
"// Logging \"warnings\" but not rejecting test",
"webpackServer",
".",
"stderr",
".",
"on",
"(",
"'data'",
",",
"data",
"=>",
"log",
"(",
... | Adds event listeners to serve and resolves a promise. | [
"Adds",
"event",
"listeners",
"to",
"serve",
"and",
"resolves",
"a",
"promise",
"."
] | fe8c622f12817552f85940abe194ddcb262e7b44 | https://github.com/blackbaud/skyux-builder/blob/fe8c622f12817552f85940abe194ddcb262e7b44/e2e/shared/common.js#L48-L63 | train |
blackbaud/skyux-builder | e2e/shared/common.js | exec | function exec(cmd, args, opts) {
console.log(`Running command: ${cmd} ${args.join(' ')}`);
const cp = childProcessSpawn(cmd, args, opts);
cp.stdout.on('data', data => log(data));
cp.stderr.on('data', data => log(data));
return new Promise((resolve, reject) => {
cp.on('error', err => reject(log(err)));
... | javascript | function exec(cmd, args, opts) {
console.log(`Running command: ${cmd} ${args.join(' ')}`);
const cp = childProcessSpawn(cmd, args, opts);
cp.stdout.on('data', data => log(data));
cp.stderr.on('data', data => log(data));
return new Promise((resolve, reject) => {
cp.on('error', err => reject(log(err)));
... | [
"function",
"exec",
"(",
"cmd",
",",
"args",
",",
"opts",
")",
"{",
"console",
".",
"log",
"(",
"`",
"${",
"cmd",
"}",
"${",
"args",
".",
"join",
"(",
"' '",
")",
"}",
"`",
")",
";",
"const",
"cp",
"=",
"childProcessSpawn",
"(",
"cmd",
",",
"ar... | Spawns a child_process and returns a promise.
@name exec | [
"Spawns",
"a",
"child_process",
"and",
"returns",
"a",
"promise",
"."
] | fe8c622f12817552f85940abe194ddcb262e7b44 | https://github.com/blackbaud/skyux-builder/blob/fe8c622f12817552f85940abe194ddcb262e7b44/e2e/shared/common.js#L77-L88 | train |
Subsets and Splits
SQL Console for semeru/code-text-javascript
Retrieves 20,000 non-null code samples labeled as JavaScript, providing a basic overview of the dataset.