id int32 0 58k | repo stringlengths 5 67 | path stringlengths 4 116 | func_name stringlengths 0 58 | original_string stringlengths 52 373k | language stringclasses 1
value | code stringlengths 52 373k | code_tokens list | docstring stringlengths 4 11.8k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 86 226 |
|---|---|---|---|---|---|---|---|---|---|---|---|
54,100 | megahertz/node-comments-parser | index.js | applyJsDocTags | function applyJsDocTags(comment, removeTagLine) {
removeTagLine = (undefined !== removeTagLine) ? removeTagLine : true;
var lines = [];
comment.tags = [];
for (var i = 0; i < comment.lines.length; i++) {
var line = comment.lines[i];
if ('@' === line.charAt(0)) {
var spacePos = line.indexOf(' ');... | javascript | function applyJsDocTags(comment, removeTagLine) {
removeTagLine = (undefined !== removeTagLine) ? removeTagLine : true;
var lines = [];
comment.tags = [];
for (var i = 0; i < comment.lines.length; i++) {
var line = comment.lines[i];
if ('@' === line.charAt(0)) {
var spacePos = line.indexOf(' ');... | [
"function",
"applyJsDocTags",
"(",
"comment",
",",
"removeTagLine",
")",
"{",
"removeTagLine",
"=",
"(",
"undefined",
"!==",
"removeTagLine",
")",
"?",
"removeTagLine",
":",
"true",
";",
"var",
"lines",
"=",
"[",
"]",
";",
"comment",
".",
"tags",
"=",
"[",... | Find tags in comment, remove this lines and apply as property
@param {Object} comment
@param {boolean} [removeTagLine=true] | [
"Find",
"tags",
"in",
"comment",
"remove",
"this",
"lines",
"and",
"apply",
"as",
"property"
] | d849f23bf4210e999a2aa56ebad31588b2199cb5 | https://github.com/megahertz/node-comments-parser/blob/d849f23bf4210e999a2aa56ebad31588b2199cb5/index.js#L106-L130 |
54,101 | megahertz/node-comments-parser | index.js | defaults | function defaults(object, options) {
object = object || {};
for (var i in options) {
if (undefined === object[i] && options.hasOwnProperty(i)) {
object[i] = options[i];
}
}
return object;
} | javascript | function defaults(object, options) {
object = object || {};
for (var i in options) {
if (undefined === object[i] && options.hasOwnProperty(i)) {
object[i] = options[i];
}
}
return object;
} | [
"function",
"defaults",
"(",
"object",
",",
"options",
")",
"{",
"object",
"=",
"object",
"||",
"{",
"}",
";",
"for",
"(",
"var",
"i",
"in",
"options",
")",
"{",
"if",
"(",
"undefined",
"===",
"object",
"[",
"i",
"]",
"&&",
"options",
".",
"hasOwnP... | Extend object if a property is not defined yet
@param {Object} object
@param {Object} options
@returns {Object} | [
"Extend",
"object",
"if",
"a",
"property",
"is",
"not",
"defined",
"yet"
] | d849f23bf4210e999a2aa56ebad31588b2199cb5 | https://github.com/megahertz/node-comments-parser/blob/d849f23bf4210e999a2aa56ebad31588b2199cb5/index.js#L161-L169 |
54,102 | jakwings/meta-matter | index.js | matter | function matter(str, opts) {
str = formatString(str);
opts = formatOptions(opts);
var result = {src: str, data: null, body: str};
if (!str) {
return result;
}
var strict = !opts.loose;
var header = opts.delims[0];
var footer = opts.delims[1];
var dataStart, dataEnd;
// Front matter must start ... | javascript | function matter(str, opts) {
str = formatString(str);
opts = formatOptions(opts);
var result = {src: str, data: null, body: str};
if (!str) {
return result;
}
var strict = !opts.loose;
var header = opts.delims[0];
var footer = opts.delims[1];
var dataStart, dataEnd;
// Front matter must start ... | [
"function",
"matter",
"(",
"str",
",",
"opts",
")",
"{",
"str",
"=",
"formatString",
"(",
"str",
")",
";",
"opts",
"=",
"formatOptions",
"(",
"opts",
")",
";",
"var",
"result",
"=",
"{",
"src",
":",
"str",
",",
"data",
":",
"null",
",",
"body",
"... | Parse the input string with options.
@param {String} str The string to parse.
@param {Object?} opts
@param {Boolean?} opts.loose Whether to tolerate ambiguous delimiters. Default: false
@param {String?} opts.lang The name of the parser to use if opts.parsers is not a function. Default: 'yaml'
@param {(String|Array)?} ... | [
"Parse",
"the",
"input",
"string",
"with",
"options",
"."
] | c8e3f4daffb09485bd8a18e6337d17fee0a20460 | https://github.com/jakwings/meta-matter/blob/c8e3f4daffb09485bd8a18e6337d17fee0a20460/index.js#L18-L79 |
54,103 | yeptlabs/wns | src/core/base/wnModule.js | function (classesSource)
{
this.e.log&&this.e.log('Importing core classes...','system');
var classesSource = classesSource||global.wns.coreClasses;
var classBuilder = new process.wns.wnBuild(classesSource,this);
this.setComponent('classBuilder',classBuilder);
classBuilder.build();
return this;
} | javascript | function (classesSource)
{
this.e.log&&this.e.log('Importing core classes...','system');
var classesSource = classesSource||global.wns.coreClasses;
var classBuilder = new process.wns.wnBuild(classesSource,this);
this.setComponent('classBuilder',classBuilder);
classBuilder.build();
return this;
} | [
"function",
"(",
"classesSource",
")",
"{",
"this",
".",
"e",
".",
"log",
"&&",
"this",
".",
"e",
".",
"log",
"(",
"'Importing core classes...'",
",",
"'system'",
")",
";",
"var",
"classesSource",
"=",
"classesSource",
"||",
"global",
".",
"wns",
".",
"c... | Compile module's classes.
It gets classes source you give or from the core classes.
@param $classesSource (optional)
@return this | [
"Compile",
"module",
"s",
"classes",
".",
"It",
"gets",
"classes",
"source",
"you",
"give",
"or",
"from",
"the",
"core",
"classes",
"."
] | c42602b062dcf6bbffc22e4365bba2cbf363fe2f | https://github.com/yeptlabs/wns/blob/c42602b062dcf6bbffc22e4365bba2cbf363fe2f/src/core/base/wnModule.js#L142-L152 | |
54,104 | yeptlabs/wns | src/core/base/wnModule.js | function ()
{
var nmPath = this.modulePath + 'node_modules/';
var pkgJson;
var pkgName;
var pkgInfo;
var packageList = {};
var validScript = /[\w|\W]+\.[js|coffee]+$/;
if (fs.existsSync(nmPath))
{
this.e.log&&this.e.log('Importing packages...','system');
var packages = fs.readdirSync(n... | javascript | function ()
{
var nmPath = this.modulePath + 'node_modules/';
var pkgJson;
var pkgName;
var pkgInfo;
var packageList = {};
var validScript = /[\w|\W]+\.[js|coffee]+$/;
if (fs.existsSync(nmPath))
{
this.e.log&&this.e.log('Importing packages...','system');
var packages = fs.readdirSync(n... | [
"function",
"(",
")",
"{",
"var",
"nmPath",
"=",
"this",
".",
"modulePath",
"+",
"'node_modules/'",
";",
"var",
"pkgJson",
";",
"var",
"pkgName",
";",
"var",
"pkgInfo",
";",
"var",
"packageList",
"=",
"{",
"}",
";",
"var",
"validScript",
"=",
"/",
"[\\... | Import package classes from node_modules directory | [
"Import",
"package",
"classes",
"from",
"node_modules",
"directory"
] | c42602b062dcf6bbffc22e4365bba2cbf363fe2f | https://github.com/yeptlabs/wns/blob/c42602b062dcf6bbffc22e4365bba2cbf363fe2f/src/core/base/wnModule.js#L157-L207 | |
54,105 | yeptlabs/wns | src/core/base/wnModule.js | function (packageList)
{
if (!_.isObject(packageList))
return false;
var pkgList = _.keys(packageList);
var pkgRequire;
var pkgName;
var pkgInfo;
var depName;
var depVersion;
var i=0;
var valid;
var error;
while (pkgList.length > 0)
{
valid=true;
error=[];
pkgName=... | javascript | function (packageList)
{
if (!_.isObject(packageList))
return false;
var pkgList = _.keys(packageList);
var pkgRequire;
var pkgName;
var pkgInfo;
var depName;
var depVersion;
var i=0;
var valid;
var error;
while (pkgList.length > 0)
{
valid=true;
error=[];
pkgName=... | [
"function",
"(",
"packageList",
")",
"{",
"if",
"(",
"!",
"_",
".",
"isObject",
"(",
"packageList",
")",
")",
"return",
"false",
";",
"var",
"pkgList",
"=",
"_",
".",
"keys",
"(",
"packageList",
")",
";",
"var",
"pkgRequire",
";",
"var",
"pkgName",
"... | Remove invalid packages from the packageList.
@param object $packageList | [
"Remove",
"invalid",
"packages",
"from",
"the",
"packageList",
"."
] | c42602b062dcf6bbffc22e4365bba2cbf363fe2f | https://github.com/yeptlabs/wns/blob/c42602b062dcf6bbffc22e4365bba2cbf363fe2f/src/core/base/wnModule.js#L213-L261 | |
54,106 | yeptlabs/wns | src/core/base/wnModule.js | function (packageList)
{
var classes;
var className;
var classSource;
var classBuilder = this.getComponent('classBuilder');
for (p in packageList)
{
classes = packageList[p].classes;
for (c in classes)
{
className = c;
classBuilder.addSource(className,classes[c],true);
}
... | javascript | function (packageList)
{
var classes;
var className;
var classSource;
var classBuilder = this.getComponent('classBuilder');
for (p in packageList)
{
classes = packageList[p].classes;
for (c in classes)
{
className = c;
classBuilder.addSource(className,classes[c],true);
}
... | [
"function",
"(",
"packageList",
")",
"{",
"var",
"classes",
";",
"var",
"className",
";",
"var",
"classSource",
";",
"var",
"classBuilder",
"=",
"this",
".",
"getComponent",
"(",
"'classBuilder'",
")",
";",
"for",
"(",
"p",
"in",
"packageList",
")",
"{",
... | Load all packages on the classes of the packageList.
@param object $packageList | [
"Load",
"all",
"packages",
"on",
"the",
"classes",
"of",
"the",
"packageList",
"."
] | c42602b062dcf6bbffc22e4365bba2cbf363fe2f | https://github.com/yeptlabs/wns/blob/c42602b062dcf6bbffc22e4365bba2cbf363fe2f/src/core/base/wnModule.js#L267-L285 | |
54,107 | yeptlabs/wns | src/core/base/wnModule.js | function ()
{
this.e.log&&this.e.log('Importing from config...','system');
var importConfig = this.getConfig('import');
var cb = this.getComponent('classBuilder');
var validScript = /[\w|\W]+\.[js|coffee]+$/;
for (i in importConfig)
{
var path = this.modulePath+importConfig[i];
if (fs.exist... | javascript | function ()
{
this.e.log&&this.e.log('Importing from config...','system');
var importConfig = this.getConfig('import');
var cb = this.getComponent('classBuilder');
var validScript = /[\w|\W]+\.[js|coffee]+$/;
for (i in importConfig)
{
var path = this.modulePath+importConfig[i];
if (fs.exist... | [
"function",
"(",
")",
"{",
"this",
".",
"e",
".",
"log",
"&&",
"this",
".",
"e",
".",
"log",
"(",
"'Importing from config...'",
",",
"'system'",
")",
";",
"var",
"importConfig",
"=",
"this",
".",
"getConfig",
"(",
"'import'",
")",
";",
"var",
"cb",
"... | Import classes from the paths from configuration. | [
"Import",
"classes",
"from",
"the",
"paths",
"from",
"configuration",
"."
] | c42602b062dcf6bbffc22e4365bba2cbf363fe2f | https://github.com/yeptlabs/wns/blob/c42602b062dcf6bbffc22e4365bba2cbf363fe2f/src/core/base/wnModule.js#L290-L316 | |
54,108 | yeptlabs/wns | src/core/base/wnModule.js | function ()
{
for (c in this.c)
{
if (this.c[c].build && this.c[c].build.extend && this.c[c].build.extend.indexOf('wnActiveRecord')!=-1)
{
this.prepareModel(c);
}
}
} | javascript | function ()
{
for (c in this.c)
{
if (this.c[c].build && this.c[c].build.extend && this.c[c].build.extend.indexOf('wnActiveRecord')!=-1)
{
this.prepareModel(c);
}
}
} | [
"function",
"(",
")",
"{",
"for",
"(",
"c",
"in",
"this",
".",
"c",
")",
"{",
"if",
"(",
"this",
".",
"c",
"[",
"c",
"]",
".",
"build",
"&&",
"this",
".",
"c",
"[",
"c",
"]",
".",
"build",
".",
"extend",
"&&",
"this",
".",
"c",
"[",
"c",
... | Prepare all models | [
"Prepare",
"all",
"models"
] | c42602b062dcf6bbffc22e4365bba2cbf363fe2f | https://github.com/yeptlabs/wns/blob/c42602b062dcf6bbffc22e4365bba2cbf363fe2f/src/core/base/wnModule.js#L321-L330 | |
54,109 | yeptlabs/wns | src/core/base/wnModule.js | function (model) {
var c = this.c,
s = this;
this.m[model]=function () {
var modelClass = c[model];
return new modelClass({ autoInit: true }, s.c, s, s.db);
};
} | javascript | function (model) {
var c = this.c,
s = this;
this.m[model]=function () {
var modelClass = c[model];
return new modelClass({ autoInit: true }, s.c, s, s.db);
};
} | [
"function",
"(",
"model",
")",
"{",
"var",
"c",
"=",
"this",
".",
"c",
",",
"s",
"=",
"this",
";",
"this",
".",
"m",
"[",
"model",
"]",
"=",
"function",
"(",
")",
"{",
"var",
"modelClass",
"=",
"c",
"[",
"model",
"]",
";",
"return",
"new",
"m... | Prepare the model
@param $model | [
"Prepare",
"the",
"model"
] | c42602b062dcf6bbffc22e4365bba2cbf363fe2f | https://github.com/yeptlabs/wns/blob/c42602b062dcf6bbffc22e4365bba2cbf363fe2f/src/core/base/wnModule.js#L336-L343 | |
54,110 | yeptlabs/wns | src/core/base/wnModule.js | function (file)
{
if (!_.isString(file))
return false;
var file = file+'';
this.e.log&&this.e.log('Loading module configuration from file: '+file,'system');
if (fs.statSync(file).isFile() && path.extname(file) == '.json')
{
var _data = (fs.readFileSync(file,'utf8').toString())
.replace(... | javascript | function (file)
{
if (!_.isString(file))
return false;
var file = file+'';
this.e.log&&this.e.log('Loading module configuration from file: '+file,'system');
if (fs.statSync(file).isFile() && path.extname(file) == '.json')
{
var _data = (fs.readFileSync(file,'utf8').toString())
.replace(... | [
"function",
"(",
"file",
")",
"{",
"if",
"(",
"!",
"_",
".",
"isString",
"(",
"file",
")",
")",
"return",
"false",
";",
"var",
"file",
"=",
"file",
"+",
"''",
";",
"this",
".",
"e",
".",
"log",
"&&",
"this",
".",
"e",
".",
"log",
"(",
"'Loadi... | Get a JSON configuration from file then send it to the `setConfig`
@param string $file path to the file
@return boolean success? | [
"Get",
"a",
"JSON",
"configuration",
"from",
"file",
"then",
"send",
"it",
"to",
"the",
"setConfig"
] | c42602b062dcf6bbffc22e4365bba2cbf363fe2f | https://github.com/yeptlabs/wns/blob/c42602b062dcf6bbffc22e4365bba2cbf363fe2f/src/core/base/wnModule.js#L381-L401 | |
54,111 | yeptlabs/wns | src/core/base/wnModule.js | function (components)
{
for (c in components)
{
_componentsConfig[c]=_.merge({}, components[c]);
if (this.hasComponent(c))
_.merge(_componentsConfig[c],this.getComponentsConfig[c]);
}
return this;
} | javascript | function (components)
{
for (c in components)
{
_componentsConfig[c]=_.merge({}, components[c]);
if (this.hasComponent(c))
_.merge(_componentsConfig[c],this.getComponentsConfig[c]);
}
return this;
} | [
"function",
"(",
"components",
")",
"{",
"for",
"(",
"c",
"in",
"components",
")",
"{",
"_componentsConfig",
"[",
"c",
"]",
"=",
"_",
".",
"merge",
"(",
"{",
"}",
",",
"components",
"[",
"c",
"]",
")",
";",
"if",
"(",
"this",
".",
"hasComponent",
... | Set new properties to the component configuration.
@param object $components components(id=>component configuration or instances)
Defaults to true, meaning the previously registered component configuration of the same ID
will be merged with the new configuration. If false, the existing configuration will be replaced c... | [
"Set",
"new",
"properties",
"to",
"the",
"component",
"configuration",
"."
] | c42602b062dcf6bbffc22e4365bba2cbf363fe2f | https://github.com/yeptlabs/wns/blob/c42602b062dcf6bbffc22e4365bba2cbf363fe2f/src/core/base/wnModule.js#L410-L419 | |
54,112 | yeptlabs/wns | src/core/base/wnModule.js | function (className,config)
{
var component = this.createClass(className,config);
if (component)
component.setParent(this);
return component;
} | javascript | function (className,config)
{
var component = this.createClass(className,config);
if (component)
component.setParent(this);
return component;
} | [
"function",
"(",
"className",
",",
"config",
")",
"{",
"var",
"component",
"=",
"this",
".",
"createClass",
"(",
"className",
",",
"config",
")",
";",
"if",
"(",
"component",
")",
"component",
".",
"setParent",
"(",
"this",
")",
";",
"return",
"component... | Create a new instance of the component.
@param string $className component class (case-sensitive)
@param string $config component custom config
@return wnModule the module instance, false if the module is disabled or does not exist. | [
"Create",
"a",
"new",
"instance",
"of",
"the",
"component",
"."
] | c42602b062dcf6bbffc22e4365bba2cbf363fe2f | https://github.com/yeptlabs/wns/blob/c42602b062dcf6bbffc22e4365bba2cbf363fe2f/src/core/base/wnModule.js#L494-L500 | |
54,113 | yeptlabs/wns | src/core/base/wnModule.js | function ()
{
this.setConfig({components: this.preload});
var preload = this.getConfig().components;
if (preload != undefined)
{
this.setComponents(preload);
}
return this;
} | javascript | function ()
{
this.setConfig({components: this.preload});
var preload = this.getConfig().components;
if (preload != undefined)
{
this.setComponents(preload);
}
return this;
} | [
"function",
"(",
")",
"{",
"this",
".",
"setConfig",
"(",
"{",
"components",
":",
"this",
".",
"preload",
"}",
")",
";",
"var",
"preload",
"=",
"this",
".",
"getConfig",
"(",
")",
".",
"components",
";",
"if",
"(",
"preload",
"!=",
"undefined",
")",
... | Preload all required components | [
"Preload",
"all",
"required",
"components"
] | c42602b062dcf6bbffc22e4365bba2cbf363fe2f | https://github.com/yeptlabs/wns/blob/c42602b062dcf6bbffc22e4365bba2cbf363fe2f/src/core/base/wnModule.js#L541-L550 | |
54,114 | yeptlabs/wns | src/core/base/wnModule.js | function ()
{
var cps=this.getComponentsConfig();
for (c in cps)
{
var cpnt=this.getComponent(c);
if (cpnt)
this.e.log&&this.e.log('- Started component: '+cps[c].class+(cpnt.getConfig('alias')?' (as '+cpnt.getConfig('alias')+')':''),'system');
}
return this;
} | javascript | function ()
{
var cps=this.getComponentsConfig();
for (c in cps)
{
var cpnt=this.getComponent(c);
if (cpnt)
this.e.log&&this.e.log('- Started component: '+cps[c].class+(cpnt.getConfig('alias')?' (as '+cpnt.getConfig('alias')+')':''),'system');
}
return this;
} | [
"function",
"(",
")",
"{",
"var",
"cps",
"=",
"this",
".",
"getComponentsConfig",
"(",
")",
";",
"for",
"(",
"c",
"in",
"cps",
")",
"{",
"var",
"cpnt",
"=",
"this",
".",
"getComponent",
"(",
"c",
")",
";",
"if",
"(",
"cpnt",
")",
"this",
".",
"... | Start all preloaded components | [
"Start",
"all",
"preloaded",
"components"
] | c42602b062dcf6bbffc22e4365bba2cbf363fe2f | https://github.com/yeptlabs/wns/blob/c42602b062dcf6bbffc22e4365bba2cbf363fe2f/src/core/base/wnModule.js#L555-L565 | |
54,115 | yeptlabs/wns | src/core/base/wnModule.js | function (modules)
{
for (m in modules)
{
_modulesConfig[m]=_.merge({}, modules[m]);
if (this.hasModule(m))
_.merge(_modulesConfig[m],this.getModulesConfig[m]);
}
return this;
} | javascript | function (modules)
{
for (m in modules)
{
_modulesConfig[m]=_.merge({}, modules[m]);
if (this.hasModule(m))
_.merge(_modulesConfig[m],this.getModulesConfig[m]);
}
return this;
} | [
"function",
"(",
"modules",
")",
"{",
"for",
"(",
"m",
"in",
"modules",
")",
"{",
"_modulesConfig",
"[",
"m",
"]",
"=",
"_",
".",
"merge",
"(",
"{",
"}",
",",
"modules",
"[",
"m",
"]",
")",
";",
"if",
"(",
"this",
".",
"hasModule",
"(",
"m",
... | Merge new configuration into the module configuration
@param object $modules application modules(id=>module configuration or instances)
Defaults to true, meaning the previously registered module configuration of the same ID
will be merged with the new configuration. If false, the existing configuration will be replace... | [
"Merge",
"new",
"configuration",
"into",
"the",
"module",
"configuration"
] | c42602b062dcf6bbffc22e4365bba2cbf363fe2f | https://github.com/yeptlabs/wns/blob/c42602b062dcf6bbffc22e4365bba2cbf363fe2f/src/core/base/wnModule.js#L574-L583 | |
54,116 | yeptlabs/wns | src/core/base/wnModule.js | function (id,onLoad)
{
if (_modules[id] != undefined)
return _modules[id];
else if (this.hasComponent('classBuilder'))
{
try {
var config = _modulesConfig[id] || {},
modulePath = config.modulePath || id,
className = config.class;
if (fs.existsSync(this.modulePath+modulePath) &&... | javascript | function (id,onLoad)
{
if (_modules[id] != undefined)
return _modules[id];
else if (this.hasComponent('classBuilder'))
{
try {
var config = _modulesConfig[id] || {},
modulePath = config.modulePath || id,
className = config.class;
if (fs.existsSync(this.modulePath+modulePath) &&... | [
"function",
"(",
"id",
",",
"onLoad",
")",
"{",
"if",
"(",
"_modules",
"[",
"id",
"]",
"!=",
"undefined",
")",
"return",
"_modules",
"[",
"id",
"]",
";",
"else",
"if",
"(",
"this",
".",
"hasComponent",
"(",
"'classBuilder'",
")",
")",
"{",
"try",
"... | Retrieves the named application module.
The module has to be declared in the global modules list. A new instance will be created
when calling this method with the given ID for the first time.
@param string $id application module ID (case-sensitive)
@param function $onLoad function called when app loaded
@return wnModul... | [
"Retrieves",
"the",
"named",
"application",
"module",
".",
"The",
"module",
"has",
"to",
"be",
"declared",
"in",
"the",
"global",
"modules",
"list",
".",
"A",
"new",
"instance",
"will",
"be",
"created",
"when",
"calling",
"this",
"method",
"with",
"the",
"... | c42602b062dcf6bbffc22e4365bba2cbf363fe2f | https://github.com/yeptlabs/wns/blob/c42602b062dcf6bbffc22e4365bba2cbf363fe2f/src/core/base/wnModule.js#L593-L634 | |
54,117 | yeptlabs/wns | src/core/base/wnModule.js | function (className,config,modulePath,npmPath)
{
var module = this.createClass(className,config,modulePath,npmPath);
return module;
} | javascript | function (className,config,modulePath,npmPath)
{
var module = this.createClass(className,config,modulePath,npmPath);
return module;
} | [
"function",
"(",
"className",
",",
"config",
",",
"modulePath",
",",
"npmPath",
")",
"{",
"var",
"module",
"=",
"this",
".",
"createClass",
"(",
"className",
",",
"config",
",",
"modulePath",
",",
"npmPath",
")",
";",
"return",
"module",
";",
"}"
] | Create a new instance of a module.
@param string $className
@param string $modulePath
@param object $config
@param string $npmPath
@return object | [
"Create",
"a",
"new",
"instance",
"of",
"a",
"module",
"."
] | c42602b062dcf6bbffc22e4365bba2cbf363fe2f | https://github.com/yeptlabs/wns/blob/c42602b062dcf6bbffc22e4365bba2cbf363fe2f/src/core/base/wnModule.js#L654-L658 | |
54,118 | yeptlabs/wns | src/core/base/wnModule.js | function (id) {
if (!_.isString(id))
return false;
var module = this.getModule(id),
events;
this.e.log&&this.e.log("Attaching module's events...",'system');
if (module != undefined && (events=module.getEvents()) && !_.isEmpty(events)) {
for (e in events)
{
var evtConfig = {},
eve... | javascript | function (id) {
if (!_.isString(id))
return false;
var module = this.getModule(id),
events;
this.e.log&&this.e.log("Attaching module's events...",'system');
if (module != undefined && (events=module.getEvents()) && !_.isEmpty(events)) {
for (e in events)
{
var evtConfig = {},
eve... | [
"function",
"(",
"id",
")",
"{",
"if",
"(",
"!",
"_",
".",
"isString",
"(",
"id",
")",
")",
"return",
"false",
";",
"var",
"module",
"=",
"this",
".",
"getModule",
"(",
"id",
")",
",",
"events",
";",
"this",
".",
"e",
".",
"log",
"&&",
"this",
... | Attach to this module all bubble-events from loaded modules
This create a Bubble-Event to answer to each event that bubles from the module's modules.
Also attach to all modules' events and handler to dispatch the event.
@param string $id source module id | [
"Attach",
"to",
"this",
"module",
"all",
"bubble",
"-",
"events",
"from",
"loaded",
"modules",
"This",
"create",
"a",
"Bubble",
"-",
"Event",
"to",
"answer",
"to",
"each",
"event",
"that",
"bubles",
"from",
"the",
"module",
"s",
"modules",
".",
"Also",
"... | c42602b062dcf6bbffc22e4365bba2cbf363fe2f | https://github.com/yeptlabs/wns/blob/c42602b062dcf6bbffc22e4365bba2cbf363fe2f/src/core/base/wnModule.js#L684-L724 | |
54,119 | yeptlabs/wns | src/core/base/wnModule.js | function (scripts)
{
var script = {};
for (s in scripts)
{
var ref=scripts[s],
scriptName = s.substr(0,1).toUpperCase()+s.substr(1).toLowerCase(),
s = 'script-'+s.replace('-','.');
script[s]=ref;
script[s].class='wnScript'+scriptName || 'wnScript';
_componentsConfig[s]=_.merge({}, s... | javascript | function (scripts)
{
var script = {};
for (s in scripts)
{
var ref=scripts[s],
scriptName = s.substr(0,1).toUpperCase()+s.substr(1).toLowerCase(),
s = 'script-'+s.replace('-','.');
script[s]=ref;
script[s].class='wnScript'+scriptName || 'wnScript';
_componentsConfig[s]=_.merge({}, s... | [
"function",
"(",
"scripts",
")",
"{",
"var",
"script",
"=",
"{",
"}",
";",
"for",
"(",
"s",
"in",
"scripts",
")",
"{",
"var",
"ref",
"=",
"scripts",
"[",
"s",
"]",
",",
"scriptName",
"=",
"s",
".",
"substr",
"(",
"0",
",",
"1",
")",
".",
"toU... | Set new properties to the respective scripts
@param OBJECT $scripts scripts configurations | [
"Set",
"new",
"properties",
"to",
"the",
"respective",
"scripts"
] | c42602b062dcf6bbffc22e4365bba2cbf363fe2f | https://github.com/yeptlabs/wns/blob/c42602b062dcf6bbffc22e4365bba2cbf363fe2f/src/core/base/wnModule.js#L740-L753 | |
54,120 | yeptlabs/wns | src/core/base/wnModule.js | function (value)
{
if (value != undefined && fs.statSync(value).isDirectory())
{
this.modulePath = value;
this.setConfig('modulePath',value);
}
return this;
} | javascript | function (value)
{
if (value != undefined && fs.statSync(value).isDirectory())
{
this.modulePath = value;
this.setConfig('modulePath',value);
}
return this;
} | [
"function",
"(",
"value",
")",
"{",
"if",
"(",
"value",
"!=",
"undefined",
"&&",
"fs",
".",
"statSync",
"(",
"value",
")",
".",
"isDirectory",
"(",
")",
")",
"{",
"this",
".",
"modulePath",
"=",
"value",
";",
"this",
".",
"setConfig",
"(",
"'modulePa... | Sets the directory that contains the application modules.
@param string $value the directory that contains the application modules. | [
"Sets",
"the",
"directory",
"that",
"contains",
"the",
"application",
"modules",
"."
] | c42602b062dcf6bbffc22e4365bba2cbf363fe2f | https://github.com/yeptlabs/wns/blob/c42602b062dcf6bbffc22e4365bba2cbf363fe2f/src/core/base/wnModule.js#L816-L824 | |
54,121 | microservice-framework/microservice-client | index.js | MicroserviceClient | function MicroserviceClient(settings) {
var self = this;
self.settings = settings;
self.get = bind(self.get, self);
self.post = bind(self.post, self);
self.put = bind(self.put, self);
self.delete = bind(self.delete, self);
self.search = bind(self.search, self);
self._request = bind(self._request, self);... | javascript | function MicroserviceClient(settings) {
var self = this;
self.settings = settings;
self.get = bind(self.get, self);
self.post = bind(self.post, self);
self.put = bind(self.put, self);
self.delete = bind(self.delete, self);
self.search = bind(self.search, self);
self._request = bind(self._request, self);... | [
"function",
"MicroserviceClient",
"(",
"settings",
")",
"{",
"var",
"self",
"=",
"this",
";",
"self",
".",
"settings",
"=",
"settings",
";",
"self",
".",
"get",
"=",
"bind",
"(",
"self",
".",
"get",
",",
"self",
")",
";",
"self",
".",
"post",
"=",
... | Constructor of MicroserviceClientClient object.
.
settings.URL = process.env.SELF_URL;
settings.secureKey = process.env.SECURE_KEY;
settings.accessToken = if microservice-auth used, accessToken can be set here. | [
"Constructor",
"of",
"MicroserviceClientClient",
"object",
".",
".",
"settings",
".",
"URL",
"=",
"process",
".",
"env",
".",
"SELF_URL",
";",
"settings",
".",
"secureKey",
"=",
"process",
".",
"env",
".",
"SECURE_KEY",
";",
"settings",
".",
"accessToken",
"... | 48651abb0b715721210e5acd56149da8623ed3af | https://github.com/microservice-framework/microservice-client/blob/48651abb0b715721210e5acd56149da8623ed3af/index.js#L18-L27 |
54,122 | Wiredcraft/handle-http-error | lib/buildHandler.js | buildHandler | function buildHandler(overrides) {
const parseError = buildHandler.parseError;
const buildError = buildHandler.buildError;
/**
* .
*/
return function handler(error) {
const found = parseError.apply(this, arguments);
if (!found) {
if (error instanceof Error) {
Error.captureStackTrace... | javascript | function buildHandler(overrides) {
const parseError = buildHandler.parseError;
const buildError = buildHandler.buildError;
/**
* .
*/
return function handler(error) {
const found = parseError.apply(this, arguments);
if (!found) {
if (error instanceof Error) {
Error.captureStackTrace... | [
"function",
"buildHandler",
"(",
"overrides",
")",
"{",
"const",
"parseError",
"=",
"buildHandler",
".",
"parseError",
";",
"const",
"buildError",
"=",
"buildHandler",
".",
"buildError",
";",
"/**\n * .\n */",
"return",
"function",
"handler",
"(",
"error",
")"... | Build a handler.
@param {Object} overrides override the error attributes
@return {Function} the handler | [
"Build",
"a",
"handler",
"."
] | 2054c1ade9f5e4b11fd64c432317c815cb97063a | https://github.com/Wiredcraft/handle-http-error/blob/2054c1ade9f5e4b11fd64c432317c815cb97063a/lib/buildHandler.js#L23-L46 |
54,123 | tbremer/verboser | index.js | function (string) {
color = chalk.cyan;
if (args.verbose) {
if (typeof string === "string") {
console.log(color(string));
}
if (isArray(string)) {
console.log(color(arrayToString(string)));
}
}
return this;
} | javascript | function (string) {
color = chalk.cyan;
if (args.verbose) {
if (typeof string === "string") {
console.log(color(string));
}
if (isArray(string)) {
console.log(color(arrayToString(string)));
}
}
return this;
} | [
"function",
"(",
"string",
")",
"{",
"color",
"=",
"chalk",
".",
"cyan",
";",
"if",
"(",
"args",
".",
"verbose",
")",
"{",
"if",
"(",
"typeof",
"string",
"===",
"\"string\"",
")",
"{",
"console",
".",
"log",
"(",
"color",
"(",
"string",
")",
")",
... | verbose.log | [
"verbose",
".",
"log"
] | 2ad328c6f56e21f798b2e1760325a243b4df368a | https://github.com/tbremer/verboser/blob/2ad328c6f56e21f798b2e1760325a243b4df368a/index.js#L67-L78 | |
54,124 | mrdaniellewis/node-stream-collect | index.js | addListener | function addListener(name) {
if (name !== 'collect') {
return;
}
if (this._collecting) {
// Don't add more than once
return;
}
debug('adding collect method', this._readableState.objectMode, this._readableState.encoding);
let collected;
if (this._readableState.objectMode) {
collected = [... | javascript | function addListener(name) {
if (name !== 'collect') {
return;
}
if (this._collecting) {
// Don't add more than once
return;
}
debug('adding collect method', this._readableState.objectMode, this._readableState.encoding);
let collected;
if (this._readableState.objectMode) {
collected = [... | [
"function",
"addListener",
"(",
"name",
")",
"{",
"if",
"(",
"name",
"!==",
"'collect'",
")",
"{",
"return",
";",
"}",
"if",
"(",
"this",
".",
"_collecting",
")",
"{",
"// Don't add more than once",
"return",
";",
"}",
"debug",
"(",
"'adding collect method'"... | When a listener for an event named collect is added start collecting the data | [
"When",
"a",
"listener",
"for",
"an",
"event",
"named",
"collect",
"is",
"added",
"start",
"collecting",
"the",
"data"
] | cd651cdcd46ca9ecd71849cc5e1ed57a533af25f | https://github.com/mrdaniellewis/node-stream-collect/blob/cd651cdcd46ca9ecd71849cc5e1ed57a533af25f/index.js#L9-L50 |
54,125 | mrdaniellewis/node-stream-collect | index.js | addToStream | function addToStream(stream) {
// Don't add more than once
if (stream.listeners('addListener').includes(addListener)) {
return stream;
}
stream.on('newListener', addListener);
return stream;
} | javascript | function addToStream(stream) {
// Don't add more than once
if (stream.listeners('addListener').includes(addListener)) {
return stream;
}
stream.on('newListener', addListener);
return stream;
} | [
"function",
"addToStream",
"(",
"stream",
")",
"{",
"// Don't add more than once",
"if",
"(",
"stream",
".",
"listeners",
"(",
"'addListener'",
")",
".",
"includes",
"(",
"addListener",
")",
")",
"{",
"return",
"stream",
";",
"}",
"stream",
".",
"on",
"(",
... | Add the collect event to the stream
@param {Stream} stream | [
"Add",
"the",
"collect",
"event",
"to",
"the",
"stream"
] | cd651cdcd46ca9ecd71849cc5e1ed57a533af25f | https://github.com/mrdaniellewis/node-stream-collect/blob/cd651cdcd46ca9ecd71849cc5e1ed57a533af25f/index.js#L56-L65 |
54,126 | mrdaniellewis/node-stream-collect | index.js | collect | function collect(stream, encoding, cb = () => {}) {
if (typeof encoding === 'function') {
cb = encoding;
encoding = null;
}
return stream
.pipe(new Collect({ encoding, objectMode: stream._readableState.objectMode }))
.collect()
.then((data) => {
cb(null, data);
return data;
})... | javascript | function collect(stream, encoding, cb = () => {}) {
if (typeof encoding === 'function') {
cb = encoding;
encoding = null;
}
return stream
.pipe(new Collect({ encoding, objectMode: stream._readableState.objectMode }))
.collect()
.then((data) => {
cb(null, data);
return data;
})... | [
"function",
"collect",
"(",
"stream",
",",
"encoding",
",",
"cb",
"=",
"(",
")",
"=>",
"{",
"}",
")",
"{",
"if",
"(",
"typeof",
"encoding",
"===",
"'function'",
")",
"{",
"cb",
"=",
"encoding",
";",
"encoding",
"=",
"null",
";",
"}",
"return",
"str... | Collect all data in a stream and return as a promise or in a callback
@param {Stream} stream A stream
@param {String} [encoding] Stream encoding - optional
@param {Function} cb Callback, the first argument will be the data
@returns {Promise} | [
"Collect",
"all",
"data",
"in",
"a",
"stream",
"and",
"return",
"as",
"a",
"promise",
"or",
"in",
"a",
"callback"
] | cd651cdcd46ca9ecd71849cc5e1ed57a533af25f | https://github.com/mrdaniellewis/node-stream-collect/blob/cd651cdcd46ca9ecd71849cc5e1ed57a533af25f/index.js#L115-L132 |
54,127 | shawnbissell/obicallerid | obicallerid.js | ObiCallerID | function ObiCallerID() {
this.fromRegex = /^INVITE[\S\s]*From:\s*"?([\w\s\.\+\?\$]*?)"?<sip:((.*)@)?(.*)>;.*/;
this.cidRegex = /<7> \[SLIC\] CID to deliver: '([\w\s\.\+\?\$]*?)' (\d*).*/;
this.cnams = {};
this.lastSentTime = new Date();
this.outlookImported = false;
this.addressbookImported = fa... | javascript | function ObiCallerID() {
this.fromRegex = /^INVITE[\S\s]*From:\s*"?([\w\s\.\+\?\$]*?)"?<sip:((.*)@)?(.*)>;.*/;
this.cidRegex = /<7> \[SLIC\] CID to deliver: '([\w\s\.\+\?\$]*?)' (\d*).*/;
this.cnams = {};
this.lastSentTime = new Date();
this.outlookImported = false;
this.addressbookImported = fa... | [
"function",
"ObiCallerID",
"(",
")",
"{",
"this",
".",
"fromRegex",
"=",
"/",
"^INVITE[\\S\\s]*From:\\s*\"?([\\w\\s\\.\\+\\?\\$]*?)\"?<sip:((.*)@)?(.*)>;.*",
"/",
";",
"this",
".",
"cidRegex",
"=",
"/",
"<7> \\[SLIC\\] CID to deliver: '([\\w\\s\\.\\+\\?\\$]*?)' (\\d*).*",
"/",
... | An ObiCallerID object
@constructor | [
"An",
"ObiCallerID",
"object"
] | 923ad68a38d3e170fe784109108bf06d52960df8 | https://github.com/shawnbissell/obicallerid/blob/923ad68a38d3e170fe784109108bf06d52960df8/obicallerid.js#L21-L30 |
54,128 | richardschneider/sally | lib/writer.js | SallyWriter | function SallyWriter(opts)
{
this.sally = require('./sally');
opts = opts || {};
this.path = opts.path || 'sally.log';
this.prefix = opts.prefix || '';
this.digest = undefined;
this.onLog = this.onLog.bind(this);
this.onEpochStart = this.onEpochStart.bind(this);
this.onEpochEnd = this.onEpochEnd.bin... | javascript | function SallyWriter(opts)
{
this.sally = require('./sally');
opts = opts || {};
this.path = opts.path || 'sally.log';
this.prefix = opts.prefix || '';
this.digest = undefined;
this.onLog = this.onLog.bind(this);
this.onEpochStart = this.onEpochStart.bind(this);
this.onEpochEnd = this.onEpochEnd.bin... | [
"function",
"SallyWriter",
"(",
"opts",
")",
"{",
"this",
".",
"sally",
"=",
"require",
"(",
"'./sally'",
")",
";",
"opts",
"=",
"opts",
"||",
"{",
"}",
";",
"this",
".",
"path",
"=",
"opts",
".",
"path",
"||",
"'sally.log'",
";",
"this",
".",
"pre... | AuditFile constructor. | [
"AuditFile",
"constructor",
"."
] | 45f34ab121faced90ca1a2cd2b9b19c7e95c9f54 | https://github.com/richardschneider/sally/blob/45f34ab121faced90ca1a2cd2b9b19c7e95c9f54/lib/writer.js#L13-L33 |
54,129 | linyngfly/omelo | lib/components/proxy.js | function(client, app, sinfos) {
let item;
for (let i = 0, l = sinfos.length; i < l; i++) {
item = sinfos[i];
if (hasProxy(client, item)) {
continue;
}
client.addProxies(getProxyRecords(app, item));
}
} | javascript | function(client, app, sinfos) {
let item;
for (let i = 0, l = sinfos.length; i < l; i++) {
item = sinfos[i];
if (hasProxy(client, item)) {
continue;
}
client.addProxies(getProxyRecords(app, item));
}
} | [
"function",
"(",
"client",
",",
"app",
",",
"sinfos",
")",
"{",
"let",
"item",
";",
"for",
"(",
"let",
"i",
"=",
"0",
",",
"l",
"=",
"sinfos",
".",
"length",
";",
"i",
"<",
"l",
";",
"i",
"++",
")",
"{",
"item",
"=",
"sinfos",
"[",
"i",
"]"... | Generate proxy for the server infos.
@param {Object} client rpc client instance
@param {Object} app application context
@param {Array} sinfos server info list | [
"Generate",
"proxy",
"for",
"the",
"server",
"infos",
"."
] | fb5f79fa31c69de36bd1c370bad5edfa753ca601 | https://github.com/linyngfly/omelo/blob/fb5f79fa31c69de36bd1c370bad5edfa753ca601/lib/components/proxy.js#L177-L186 | |
54,130 | linyngfly/omelo | lib/components/proxy.js | function(client, sinfo) {
let proxy = client.proxies;
return !!proxy.sys && !! proxy.sys[sinfo.serverType];
} | javascript | function(client, sinfo) {
let proxy = client.proxies;
return !!proxy.sys && !! proxy.sys[sinfo.serverType];
} | [
"function",
"(",
"client",
",",
"sinfo",
")",
"{",
"let",
"proxy",
"=",
"client",
".",
"proxies",
";",
"return",
"!",
"!",
"proxy",
".",
"sys",
"&&",
"!",
"!",
"proxy",
".",
"sys",
"[",
"sinfo",
".",
"serverType",
"]",
";",
"}"
] | Check a server whether has generated proxy before
@param {Object} client rpc client instance
@param {Object} sinfo server info
@return {Boolean} true or false | [
"Check",
"a",
"server",
"whether",
"has",
"generated",
"proxy",
"before"
] | fb5f79fa31c69de36bd1c370bad5edfa753ca601 | https://github.com/linyngfly/omelo/blob/fb5f79fa31c69de36bd1c370bad5edfa753ca601/lib/components/proxy.js#L195-L198 | |
54,131 | linyngfly/omelo | lib/components/proxy.js | function(app, sinfo) {
let records = [],
appBase = app.getBase(),
record;
// sys remote service path record
if (app.isFrontend(sinfo)) {
record = pathUtil.getSysRemotePath('frontend');
} else {
record = pathUtil.getSysRemotePath('backend');
}
if (record) {
records.push(pathUtil.remotePat... | javascript | function(app, sinfo) {
let records = [],
appBase = app.getBase(),
record;
// sys remote service path record
if (app.isFrontend(sinfo)) {
record = pathUtil.getSysRemotePath('frontend');
} else {
record = pathUtil.getSysRemotePath('backend');
}
if (record) {
records.push(pathUtil.remotePat... | [
"function",
"(",
"app",
",",
"sinfo",
")",
"{",
"let",
"records",
"=",
"[",
"]",
",",
"appBase",
"=",
"app",
".",
"getBase",
"(",
")",
",",
"record",
";",
"// sys remote service path record",
"if",
"(",
"app",
".",
"isFrontend",
"(",
"sinfo",
")",
")",... | Get proxy path for rpc client.
Iterate all the remote service path and create remote path record.
@param {Object} app current application context
@param {Object} sinfo server info, format: {id, serverType, host, port}
@return {Array} remote path record array | [
"Get",
"proxy",
"path",
"for",
"rpc",
"client",
".",
"Iterate",
"all",
"the",
"remote",
"service",
"path",
"and",
"create",
"remote",
"path",
"record",
"."
] | fb5f79fa31c69de36bd1c370bad5edfa753ca601 | https://github.com/linyngfly/omelo/blob/fb5f79fa31c69de36bd1c370bad5edfa753ca601/lib/components/proxy.js#L208-L229 | |
54,132 | clarkmalmgren/angular-onselect | dist/angular-onselect.js | snapToWord | function snapToWord() {
if (isHighlighted()) {
throw new Error("Can't modify range after highlighting");
}
var start = selection.range.startOffset;
var startNode = selection.range.startContainer;
while (startNode.textContent.charAt(start) != ' ' && start > 0) {
... | javascript | function snapToWord() {
if (isHighlighted()) {
throw new Error("Can't modify range after highlighting");
}
var start = selection.range.startOffset;
var startNode = selection.range.startContainer;
while (startNode.textContent.charAt(start) != ' ' && start > 0) {
... | [
"function",
"snapToWord",
"(",
")",
"{",
"if",
"(",
"isHighlighted",
"(",
")",
")",
"{",
"throw",
"new",
"Error",
"(",
"\"Can't modify range after highlighting\"",
")",
";",
"}",
"var",
"start",
"=",
"selection",
".",
"range",
".",
"startOffset",
";",
"var",... | Expand the current range so that both the beginning and end end at word boundaries.
@memeberOf onselect.Selection
@name snapToWord | [
"Expand",
"the",
"current",
"range",
"so",
"that",
"both",
"the",
"beginning",
"and",
"end",
"end",
"at",
"word",
"boundaries",
"."
] | 07a986af1690dc7c98e0b24706ceadb2fe663e9f | https://github.com/clarkmalmgren/angular-onselect/blob/07a986af1690dc7c98e0b24706ceadb2fe663e9f/dist/angular-onselect.js#L204-L229 |
54,133 | clarkmalmgren/angular-onselect | dist/angular-onselect.js | removeHighlight | function removeHighlight() {
for (var h in selection._highlighter) {
var highlighter = selection._highlighter[h];
var parent = highlighter.parentNode;
while (highlighter.firstChild) {
parent.insertBefore(highlighter.firstChild, highlighter);
}
paren... | javascript | function removeHighlight() {
for (var h in selection._highlighter) {
var highlighter = selection._highlighter[h];
var parent = highlighter.parentNode;
while (highlighter.firstChild) {
parent.insertBefore(highlighter.firstChild, highlighter);
}
paren... | [
"function",
"removeHighlight",
"(",
")",
"{",
"for",
"(",
"var",
"h",
"in",
"selection",
".",
"_highlighter",
")",
"{",
"var",
"highlighter",
"=",
"selection",
".",
"_highlighter",
"[",
"h",
"]",
";",
"var",
"parent",
"=",
"highlighter",
".",
"parentNode",... | Remove highlighting if it currently exists.
@memeberOf onselect.Selection
@name removeHighlight | [
"Remove",
"highlighting",
"if",
"it",
"currently",
"exists",
"."
] | 07a986af1690dc7c98e0b24706ceadb2fe663e9f | https://github.com/clarkmalmgren/angular-onselect/blob/07a986af1690dc7c98e0b24706ceadb2fe663e9f/dist/angular-onselect.js#L272-L284 |
54,134 | clarkmalmgren/angular-onselect | dist/angular-onselect.js | shard | function shard() {
var treeNode = new RangeTreeNode();
treeNode.setStart(range.startContainer, range.startOffset);
var current = range.startContainer;
var distance = 0;
while (current != range.endContainer && distance < 50) {
var last = current;
if (current... | javascript | function shard() {
var treeNode = new RangeTreeNode();
treeNode.setStart(range.startContainer, range.startOffset);
var current = range.startContainer;
var distance = 0;
while (current != range.endContainer && distance < 50) {
var last = current;
if (current... | [
"function",
"shard",
"(",
")",
"{",
"var",
"treeNode",
"=",
"new",
"RangeTreeNode",
"(",
")",
";",
"treeNode",
".",
"setStart",
"(",
"range",
".",
"startContainer",
",",
"range",
".",
"startOffset",
")",
";",
"var",
"current",
"=",
"range",
".",
"startCo... | Split the current range into ranges that can actually be highlighted. This is required for doing complex
DOM highlights where the highlight HTML node would need to only partially include a non-text node.
@memberOf onselect.Selection
@name shard
@return {[Range]} the array of ranges | [
"Split",
"the",
"current",
"range",
"into",
"ranges",
"that",
"can",
"actually",
"be",
"highlighted",
".",
"This",
"is",
"required",
"for",
"doing",
"complex",
"DOM",
"highlights",
"where",
"the",
"highlight",
"HTML",
"node",
"would",
"need",
"to",
"only",
"... | 07a986af1690dc7c98e0b24706ceadb2fe663e9f | https://github.com/clarkmalmgren/angular-onselect/blob/07a986af1690dc7c98e0b24706ceadb2fe663e9f/dist/angular-onselect.js#L304-L343 |
54,135 | itsravenous/i3s-db-utils | index.js | getFingerprintsForAnimal | function getFingerprintsForAnimal(animalDir) {
if (!fs.existsSync(animalDir) || !fs.statSync(animalDir).isDirectory()) {
return false;
}
var fgpFiles = fs.readdirSync(animalDir).filter(function (entry) {
return entry.split('.').pop().toLowerCase() == 'fgp';
});
var fgps = [];
fgpFiles.forEach(function (fgpF... | javascript | function getFingerprintsForAnimal(animalDir) {
if (!fs.existsSync(animalDir) || !fs.statSync(animalDir).isDirectory()) {
return false;
}
var fgpFiles = fs.readdirSync(animalDir).filter(function (entry) {
return entry.split('.').pop().toLowerCase() == 'fgp';
});
var fgps = [];
fgpFiles.forEach(function (fgpF... | [
"function",
"getFingerprintsForAnimal",
"(",
"animalDir",
")",
"{",
"if",
"(",
"!",
"fs",
".",
"existsSync",
"(",
"animalDir",
")",
"||",
"!",
"fs",
".",
"statSync",
"(",
"animalDir",
")",
".",
"isDirectory",
"(",
")",
")",
"{",
"return",
"false",
";",
... | Fetches fingerprints for an individual
@param {String} individual ID
@return {Array} | [
"Fetches",
"fingerprints",
"for",
"an",
"individual"
] | 7d3a7d0b2d5345e2a9a3dd9dcaab9ef2e3e72043 | https://github.com/itsravenous/i3s-db-utils/blob/7d3a7d0b2d5345e2a9a3dd9dcaab9ef2e3e72043/index.js#L24-L44 |
54,136 | itsravenous/i3s-db-utils | index.js | getAllFingerprints | function getAllFingerprints(dir) {
var ids = getAnimals();
var fgps = ids.map(function (id) {
return getFingerprintsForAnimal(path.join(dir, id));
}).filter(function (fgp) { return fgp; });
return fgps;
} | javascript | function getAllFingerprints(dir) {
var ids = getAnimals();
var fgps = ids.map(function (id) {
return getFingerprintsForAnimal(path.join(dir, id));
}).filter(function (fgp) { return fgp; });
return fgps;
} | [
"function",
"getAllFingerprints",
"(",
"dir",
")",
"{",
"var",
"ids",
"=",
"getAnimals",
"(",
")",
";",
"var",
"fgps",
"=",
"ids",
".",
"map",
"(",
"function",
"(",
"id",
")",
"{",
"return",
"getFingerprintsForAnimal",
"(",
"path",
".",
"join",
"(",
"d... | Fetches fingerprints for all individuals
@return {Array} | [
"Fetches",
"fingerprints",
"for",
"all",
"individuals"
] | 7d3a7d0b2d5345e2a9a3dd9dcaab9ef2e3e72043 | https://github.com/itsravenous/i3s-db-utils/blob/7d3a7d0b2d5345e2a9a3dd9dcaab9ef2e3e72043/index.js#L50-L56 |
54,137 | itsravenous/i3s-db-utils | index.js | getAnimals | function getAnimals(dir) {
var ids = fs.readdirSync(dir).filter(function (id) {
return fs.statSync(path.join(dir, id)).isDirectory();
});
return ids;
} | javascript | function getAnimals(dir) {
var ids = fs.readdirSync(dir).filter(function (id) {
return fs.statSync(path.join(dir, id)).isDirectory();
});
return ids;
} | [
"function",
"getAnimals",
"(",
"dir",
")",
"{",
"var",
"ids",
"=",
"fs",
".",
"readdirSync",
"(",
"dir",
")",
".",
"filter",
"(",
"function",
"(",
"id",
")",
"{",
"return",
"fs",
".",
"statSync",
"(",
"path",
".",
"join",
"(",
"dir",
",",
"id",
"... | Fetches all individuals
@param {String} DB dir
@return {Array} | [
"Fetches",
"all",
"individuals"
] | 7d3a7d0b2d5345e2a9a3dd9dcaab9ef2e3e72043 | https://github.com/itsravenous/i3s-db-utils/blob/7d3a7d0b2d5345e2a9a3dd9dcaab9ef2e3e72043/index.js#L63-L68 |
54,138 | bmeck/node-devtools | lib/readline2/terminal_util.js | moveCursorRelative | function moveCursorRelative(stream, dx, dy) {
if (dx < 0) {
stream.write('\x1b[' + (-dx) + 'D');
} else if (dx > 0) {
stream.write('\x1b[' + dx + 'C');
}
if (dy < 0) {
stream.write('\x1b[' + (-dy) + 'A');
} else if (dy > 0) {
stream.write('\x1b[' + dy + 'B');
}
} | javascript | function moveCursorRelative(stream, dx, dy) {
if (dx < 0) {
stream.write('\x1b[' + (-dx) + 'D');
} else if (dx > 0) {
stream.write('\x1b[' + dx + 'C');
}
if (dy < 0) {
stream.write('\x1b[' + (-dy) + 'A');
} else if (dy > 0) {
stream.write('\x1b[' + dy + 'B');
}
} | [
"function",
"moveCursorRelative",
"(",
"stream",
",",
"dx",
",",
"dy",
")",
"{",
"if",
"(",
"dx",
"<",
"0",
")",
"{",
"stream",
".",
"write",
"(",
"'\\x1b['",
"+",
"(",
"-",
"dx",
")",
"+",
"'D'",
")",
";",
"}",
"else",
"if",
"(",
"dx",
">",
... | moves the cursor relative to its current location | [
"moves",
"the",
"cursor",
"relative",
"to",
"its",
"current",
"location"
] | 331adcae6090b85a8da126d6707f627524aa9a84 | https://github.com/bmeck/node-devtools/blob/331adcae6090b85a8da126d6707f627524aa9a84/lib/readline2/terminal_util.js#L55-L67 |
54,139 | boylesoftware/x2node-validators | index.js | createValidationErrorMessages | function createValidationErrorMessages(base, subjDef) {
if (!subjDef.validationErrorMessages &&
(base !== standard.VALIDATION_ERROR_MESSAGES))
return base;
const validationErrorMessages = Object.create(base);
for (let messageId in subjDef.validationErrorMessages) {
const messageDef = subjDef.validationErrorM... | javascript | function createValidationErrorMessages(base, subjDef) {
if (!subjDef.validationErrorMessages &&
(base !== standard.VALIDATION_ERROR_MESSAGES))
return base;
const validationErrorMessages = Object.create(base);
for (let messageId in subjDef.validationErrorMessages) {
const messageDef = subjDef.validationErrorM... | [
"function",
"createValidationErrorMessages",
"(",
"base",
",",
"subjDef",
")",
"{",
"if",
"(",
"!",
"subjDef",
".",
"validationErrorMessages",
"&&",
"(",
"base",
"!==",
"standard",
".",
"VALIDATION_ERROR_MESSAGES",
")",
")",
"return",
"base",
";",
"const",
"vali... | Create validation error messages set for the specified container or property.
@private
@param {Object.<string,Object<string,string>>} base Base validation error
messages set from the context.
@param {Object} subjDef Subject definition object possibly containing a
<code>validationErrorMessages</code> attribute.
@return... | [
"Create",
"validation",
"error",
"messages",
"set",
"for",
"the",
"specified",
"container",
"or",
"property",
"."
] | e98a65c13a4092f80e96517c8e8c9523f8e84c63 | https://github.com/boylesoftware/x2node-validators/blob/e98a65c13a4092f80e96517c8e8c9523f8e84c63/index.js#L266-L290 |
54,140 | boylesoftware/x2node-validators | index.js | createValidatorFuncs | function createValidatorFuncs(base, subjDef, subjDescription) {
if (!subjDef.validatorDefs && (base !== standard.VALIDATOR_DEFS))
return base;
const validatorFuncs = Object.create(base);
for (let validatorId in subjDef.validatorDefs) {
const validatorFunc = subjDef.validatorDefs[validatorId];
if ((typeof val... | javascript | function createValidatorFuncs(base, subjDef, subjDescription) {
if (!subjDef.validatorDefs && (base !== standard.VALIDATOR_DEFS))
return base;
const validatorFuncs = Object.create(base);
for (let validatorId in subjDef.validatorDefs) {
const validatorFunc = subjDef.validatorDefs[validatorId];
if ((typeof val... | [
"function",
"createValidatorFuncs",
"(",
"base",
",",
"subjDef",
",",
"subjDescription",
")",
"{",
"if",
"(",
"!",
"subjDef",
".",
"validatorDefs",
"&&",
"(",
"base",
"!==",
"standard",
".",
"VALIDATOR_DEFS",
")",
")",
"return",
"base",
";",
"const",
"valida... | Create validator functions set for the specified container or property.
@private
@param {Object.<string,module:x2node-validators.validator>} base Base
validator functions set from the context.
@param {Object} subjDef Subject definition object possibly containing a
<code>validatorDefs</code> attribute.
@param {string} ... | [
"Create",
"validator",
"functions",
"set",
"for",
"the",
"specified",
"container",
"or",
"property",
"."
] | e98a65c13a4092f80e96517c8e8c9523f8e84c63 | https://github.com/boylesoftware/x2node-validators/blob/e98a65c13a4092f80e96517c8e8c9523f8e84c63/index.js#L304-L320 |
54,141 | r12f/hexo-heading-index | lib/index-maker.js | function (num, uppercase) {
var digits = String(+num).split(""),
key = ["","c","cc","ccc","cd","d","dc","dcc","dccc","cm",
"","x","xx","xxx","xl","l","lx","lxx","lxxx","xc",
"","i","ii","iii","iv","v","vi","vii","viii","ix"],
roman = "",
i = 3;
while (i--)
... | javascript | function (num, uppercase) {
var digits = String(+num).split(""),
key = ["","c","cc","ccc","cd","d","dc","dcc","dccc","cm",
"","x","xx","xxx","xl","l","lx","lxx","lxxx","xc",
"","i","ii","iii","iv","v","vi","vii","viii","ix"],
roman = "",
i = 3;
while (i--)
... | [
"function",
"(",
"num",
",",
"uppercase",
")",
"{",
"var",
"digits",
"=",
"String",
"(",
"+",
"num",
")",
".",
"split",
"(",
"\"\"",
")",
",",
"key",
"=",
"[",
"\"\"",
",",
"\"c\"",
",",
"\"cc\"",
",",
"\"ccc\"",
",",
"\"cd\"",
",",
"\"d\"",
",",... | JavaScript Roman Numeral Converter (Thanks to Steven Levithan @slevithan) http://blog.stevenlevithan.com/archives/javascript-roman-numeral-converter | [
"JavaScript",
"Roman",
"Numeral",
"Converter",
"(",
"Thanks",
"to",
"Steven",
"Levithan"
] | 0bc92fd74bf7110bd07c8cb49ce8cd759dda99c5 | https://github.com/r12f/hexo-heading-index/blob/0bc92fd74bf7110bd07c8cb49ce8cd759dda99c5/lib/index-maker.js#L29-L41 | |
54,142 | soixantecircuits/media-helper | media-helper.js | getMimeType | function getMimeType (media) {
return new Promise((resolve, reject) => {
if (isFile(media)) {
typechecker.detectFile(media, (err, result) => {
err && reject(err)
resolve(result)
})
} else if (isBuffer(media)) {
typechecker.detect(media, (err, result) => {
err && rejec... | javascript | function getMimeType (media) {
return new Promise((resolve, reject) => {
if (isFile(media)) {
typechecker.detectFile(media, (err, result) => {
err && reject(err)
resolve(result)
})
} else if (isBuffer(media)) {
typechecker.detect(media, (err, result) => {
err && rejec... | [
"function",
"getMimeType",
"(",
"media",
")",
"{",
"return",
"new",
"Promise",
"(",
"(",
"resolve",
",",
"reject",
")",
"=>",
"{",
"if",
"(",
"isFile",
"(",
"media",
")",
")",
"{",
"typechecker",
".",
"detectFile",
"(",
"media",
",",
"(",
"err",
",",... | Determines the mime-type of a file
@param {string} media - either path, URL or base64 datas.
@returns {Promise} | [
"Determines",
"the",
"mime",
"-",
"type",
"of",
"a",
"file"
] | af032cd54fca424f06c26c8a6110f7f0bfe0fc1b | https://github.com/soixantecircuits/media-helper/blob/af032cd54fca424f06c26c8a6110f7f0bfe0fc1b/media-helper.js#L58-L78 |
54,143 | soixantecircuits/media-helper | media-helper.js | isImage | function isImage (path) {
return new Promise((resolve, reject) => {
getMimeType(path)
.then((type) => {
;(type.indexOf('image') > -1) ? resolve(true) : resolve(false)
})
.catch(err => reject(err))
})
} | javascript | function isImage (path) {
return new Promise((resolve, reject) => {
getMimeType(path)
.then((type) => {
;(type.indexOf('image') > -1) ? resolve(true) : resolve(false)
})
.catch(err => reject(err))
})
} | [
"function",
"isImage",
"(",
"path",
")",
"{",
"return",
"new",
"Promise",
"(",
"(",
"resolve",
",",
"reject",
")",
"=>",
"{",
"getMimeType",
"(",
"path",
")",
".",
"then",
"(",
"(",
"type",
")",
"=>",
"{",
";",
"(",
"type",
".",
"indexOf",
"(",
"... | Determines if a file is an image
@param {string} path - Path to a file
@returns {Promise} | [
"Determines",
"if",
"a",
"file",
"is",
"an",
"image"
] | af032cd54fca424f06c26c8a6110f7f0bfe0fc1b | https://github.com/soixantecircuits/media-helper/blob/af032cd54fca424f06c26c8a6110f7f0bfe0fc1b/media-helper.js#L94-L102 |
54,144 | soixantecircuits/media-helper | media-helper.js | urlToBase64 | function urlToBase64 (url) {
return new Promise((resolve, reject) => {
request.get(url, (err, response, body) => {
err && reject(err)
resolve(body.toString('base64'))
})
})
} | javascript | function urlToBase64 (url) {
return new Promise((resolve, reject) => {
request.get(url, (err, response, body) => {
err && reject(err)
resolve(body.toString('base64'))
})
})
} | [
"function",
"urlToBase64",
"(",
"url",
")",
"{",
"return",
"new",
"Promise",
"(",
"(",
"resolve",
",",
"reject",
")",
"=>",
"{",
"request",
".",
"get",
"(",
"url",
",",
"(",
"err",
",",
"response",
",",
"body",
")",
"=>",
"{",
"err",
"&&",
"reject"... | Reads an image from url and convert it to base64
@param {string} url
@returns {Promise} | [
"Reads",
"an",
"image",
"from",
"url",
"and",
"convert",
"it",
"to",
"base64"
] | af032cd54fca424f06c26c8a6110f7f0bfe0fc1b | https://github.com/soixantecircuits/media-helper/blob/af032cd54fca424f06c26c8a6110f7f0bfe0fc1b/media-helper.js#L124-L131 |
54,145 | soixantecircuits/media-helper | media-helper.js | toBase64 | function toBase64 (media) {
return new Promise((resolve, reject) => {
if (isBase64(media)) {
resolve(media)
} else if (isURL(media)) {
urlToBase64(media)
.then(data => resolve(data))
.catch(error => reject(error))
} else if (isFile(media)) {
fileToBase64(media)
.then(da... | javascript | function toBase64 (media) {
return new Promise((resolve, reject) => {
if (isBase64(media)) {
resolve(media)
} else if (isURL(media)) {
urlToBase64(media)
.then(data => resolve(data))
.catch(error => reject(error))
} else if (isFile(media)) {
fileToBase64(media)
.then(da... | [
"function",
"toBase64",
"(",
"media",
")",
"{",
"return",
"new",
"Promise",
"(",
"(",
"resolve",
",",
"reject",
")",
"=>",
"{",
"if",
"(",
"isBase64",
"(",
"media",
")",
")",
"{",
"resolve",
"(",
"media",
")",
"}",
"else",
"if",
"(",
"isURL",
"(",
... | Reads an image from file or url and convert it to base64
@param {string} media - url or path
@returns {Promise} | [
"Reads",
"an",
"image",
"from",
"file",
"or",
"url",
"and",
"convert",
"it",
"to",
"base64"
] | af032cd54fca424f06c26c8a6110f7f0bfe0fc1b | https://github.com/soixantecircuits/media-helper/blob/af032cd54fca424f06c26c8a6110f7f0bfe0fc1b/media-helper.js#L152-L171 |
54,146 | soixantecircuits/media-helper | media-helper.js | toBuffer | function toBuffer (media) {
return new Promise((resolve, reject) => {
if (isURL(media)) {
toBase64(media)
.then(data => {
toBuffer(data)
.then(data => resolve(data))
.catch(error => reject(error))
})
.catch(error => reject(error))
} else if (isBase64(media)) {
... | javascript | function toBuffer (media) {
return new Promise((resolve, reject) => {
if (isURL(media)) {
toBase64(media)
.then(data => {
toBuffer(data)
.then(data => resolve(data))
.catch(error => reject(error))
})
.catch(error => reject(error))
} else if (isBase64(media)) {
... | [
"function",
"toBuffer",
"(",
"media",
")",
"{",
"return",
"new",
"Promise",
"(",
"(",
"resolve",
",",
"reject",
")",
"=>",
"{",
"if",
"(",
"isURL",
"(",
"media",
")",
")",
"{",
"toBase64",
"(",
"media",
")",
".",
"then",
"(",
"data",
"=>",
"{",
"... | Reads an image from file or url and convert it to Buffer
@param {media} media - file, url or path
@returns {Promise} | [
"Reads",
"an",
"image",
"from",
"file",
"or",
"url",
"and",
"convert",
"it",
"to",
"Buffer"
] | af032cd54fca424f06c26c8a6110f7f0bfe0fc1b | https://github.com/soixantecircuits/media-helper/blob/af032cd54fca424f06c26c8a6110f7f0bfe0fc1b/media-helper.js#L188-L213 |
54,147 | chrishayesmu/DubBotBase | src/translator.js | translateDateTimestamp | function translateDateTimestamp(timestamp) {
if (!timestamp) {
LOG.warn("Received an invalid timestamp: {}", timestamp);
return Date.now();
}
return new Date(timestamp);
} | javascript | function translateDateTimestamp(timestamp) {
if (!timestamp) {
LOG.warn("Received an invalid timestamp: {}", timestamp);
return Date.now();
}
return new Date(timestamp);
} | [
"function",
"translateDateTimestamp",
"(",
"timestamp",
")",
"{",
"if",
"(",
"!",
"timestamp",
")",
"{",
"LOG",
".",
"warn",
"(",
"\"Received an invalid timestamp: {}\"",
",",
"timestamp",
")",
";",
"return",
"Date",
".",
"now",
"(",
")",
";",
"}",
"return",... | Translates a date string from Dubtrack into a Javascript date.
@param {integer} timestamp - A timestamp from DubAPI
@returns {integer} The UNIX timestamp represented by the string,
or the current time if string is null/empty | [
"Translates",
"a",
"date",
"string",
"from",
"Dubtrack",
"into",
"a",
"Javascript",
"date",
"."
] | 0e4b5e65531c23293d22ac766850c802b1266e48 | https://github.com/chrishayesmu/DubBotBase/blob/0e4b5e65531c23293d22ac766850c802b1266e48/src/translator.js#L25-L32 |
54,148 | chrishayesmu/DubBotBase | src/translator.js | translateRole | function translateRole(role) {
switch (role) {
case "5615fa9ae596154a5c000000":
return Types.UserRole.COOWNER;
case "5615fd84e596150061000003":
return Types.UserRole.MANAGER;
case "52d1ce33c38a06510c000001":
return Types.UserRole.MOD;
case "5615fe1... | javascript | function translateRole(role) {
switch (role) {
case "5615fa9ae596154a5c000000":
return Types.UserRole.COOWNER;
case "5615fd84e596150061000003":
return Types.UserRole.MANAGER;
case "52d1ce33c38a06510c000001":
return Types.UserRole.MOD;
case "5615fe1... | [
"function",
"translateRole",
"(",
"role",
")",
"{",
"switch",
"(",
"role",
")",
"{",
"case",
"\"5615fa9ae596154a5c000000\"",
":",
"return",
"Types",
".",
"UserRole",
".",
"COOWNER",
";",
"case",
"\"5615fd84e596150061000003\"",
":",
"return",
"Types",
".",
"UserR... | Translates the role integer returned by the dubtrack.fm API into an internal model.
@param {integer} roleAsInt - The dubtrack.fm API role
@returns {object} A corresponding object from the UserRole enum | [
"Translates",
"the",
"role",
"integer",
"returned",
"by",
"the",
"dubtrack",
".",
"fm",
"API",
"into",
"an",
"internal",
"model",
"."
] | 0e4b5e65531c23293d22ac766850c802b1266e48 | https://github.com/chrishayesmu/DubBotBase/blob/0e4b5e65531c23293d22ac766850c802b1266e48/src/translator.js#L216-L233 |
54,149 | NumminorihSF/bramqp-wrapper | domain/basic.js | Basic | function Basic(client, channel, done){
EE.call(this);
this.client = client;
this.channel = channel;
this.id = channel.$getId();
this.publishCallbackMethod = DEFAULT_PUBLISH_ANSWER_WAIT_MECHANISM;
this.timeout = DEFAULT_WAIT_TIMEOUT;
this.lastConfirmSendId = 1;
this.lastMessageId = 1;
this.done = done... | javascript | function Basic(client, channel, done){
EE.call(this);
this.client = client;
this.channel = channel;
this.id = channel.$getId();
this.publishCallbackMethod = DEFAULT_PUBLISH_ANSWER_WAIT_MECHANISM;
this.timeout = DEFAULT_WAIT_TIMEOUT;
this.lastConfirmSendId = 1;
this.lastMessageId = 1;
this.done = done... | [
"function",
"Basic",
"(",
"client",
",",
"channel",
",",
"done",
")",
"{",
"EE",
".",
"call",
"(",
"this",
")",
";",
"this",
".",
"client",
"=",
"client",
";",
"this",
".",
"channel",
"=",
"channel",
";",
"this",
".",
"id",
"=",
"channel",
".",
"... | Work with basic content.
The Basic class provides methods that support an industry-standard messaging model. Work with channels.
@class Basic
@extends EventEmitter
@param {BRAMQPClient} client Client object that returns from bramqp#openAMQPCommunication() method.
@param {Channel} channel Channel object (should be ope... | [
"Work",
"with",
"basic",
"content",
"."
] | 3e2bd769a2828f7592eba79556c9ef1491177781 | https://github.com/NumminorihSF/bramqp-wrapper/blob/3e2bd769a2828f7592eba79556c9ef1491177781/domain/basic.js#L35-L50 |
54,150 | ironboy/warp-core | include-common-imports.js | getJSFiles | function getJSFiles(folder = srcFolder){
let all = [];
let f = fs.readdirSync(folder);
for(file of f){
all.push(path.join(folder,file))
if(fs.lstatSync(path.join(folder,file)).isDirectory()){
all = all.concat(getJSFiles(path.join(folder,file)));
}
}
return all.filter(x => x.endsWith('.js'));... | javascript | function getJSFiles(folder = srcFolder){
let all = [];
let f = fs.readdirSync(folder);
for(file of f){
all.push(path.join(folder,file))
if(fs.lstatSync(path.join(folder,file)).isDirectory()){
all = all.concat(getJSFiles(path.join(folder,file)));
}
}
return all.filter(x => x.endsWith('.js'));... | [
"function",
"getJSFiles",
"(",
"folder",
"=",
"srcFolder",
")",
"{",
"let",
"all",
"=",
"[",
"]",
";",
"let",
"f",
"=",
"fs",
".",
"readdirSync",
"(",
"folder",
")",
";",
"for",
"(",
"file",
"of",
"f",
")",
"{",
"all",
".",
"push",
"(",
"path",
... | get all js file paths in a folder recursively | [
"get",
"all",
"js",
"file",
"paths",
"in",
"a",
"folder",
"recursively"
] | 0e3556e41e40cdfc0dafdfd4d9e02662010e9379 | https://github.com/ironboy/warp-core/blob/0e3556e41e40cdfc0dafdfd4d9e02662010e9379/include-common-imports.js#L74-L84 |
54,151 | camshaft/reference-count | index.js | Sweep | function Sweep(actor, context) {
this.actor = actor;
this.context = context;
this.prev = context.actors[actor] || {};
this.resources = context.actors[actor] = {};
} | javascript | function Sweep(actor, context) {
this.actor = actor;
this.context = context;
this.prev = context.actors[actor] || {};
this.resources = context.actors[actor] = {};
} | [
"function",
"Sweep",
"(",
"actor",
",",
"context",
")",
"{",
"this",
".",
"actor",
"=",
"actor",
";",
"this",
".",
"context",
"=",
"context",
";",
"this",
".",
"prev",
"=",
"context",
".",
"actors",
"[",
"actor",
"]",
"||",
"{",
"}",
";",
"this",
... | Create a sweep instance
@param {String} actor
@param {Object} prev
@param {Context} context | [
"Create",
"a",
"sweep",
"instance"
] | b08bd3c676af742584e3f0101100f8fad6e33ba3 | https://github.com/camshaft/reference-count/blob/b08bd3c676af742584e3f0101100f8fad6e33ba3/index.js#L54-L59 |
54,152 | iolo/express-toybox | session.js | session | function session(options) {
options = options || {};
DEBUG && debug('configure http session middleware', options);
if (options.store) {
try {
var storeModule = options.store.module;
var SessionStore = require(storeModule)(express);
// replace store options with st... | javascript | function session(options) {
options = options || {};
DEBUG && debug('configure http session middleware', options);
if (options.store) {
try {
var storeModule = options.store.module;
var SessionStore = require(storeModule)(express);
// replace store options with st... | [
"function",
"session",
"(",
"options",
")",
"{",
"options",
"=",
"options",
"||",
"{",
"}",
";",
"DEBUG",
"&&",
"debug",
"(",
"'configure http session middleware'",
",",
"options",
")",
";",
"if",
"(",
"options",
".",
"store",
")",
"{",
"try",
"{",
"var"... | session middleware.
@param {*} [options]
@param {*} [options.store]
@param {String} [options.store.module]
@param {*} [options.store.options] store specific options
@returns {function} connect/express middleware function
@see https://github.com/expressjs/session | [
"session",
"middleware",
"."
] | c375a1388cfc167017e8dcd2325e71ca86ccb994 | https://github.com/iolo/express-toybox/blob/c375a1388cfc167017e8dcd2325e71ca86ccb994/session.js#L20-L37 |
54,153 | zenparsing/moon-unit | build/moon-unit.js | forEachDesc | function forEachDesc(obj, fn) {
var names = Object.getOwnPropertyNames(obj);
for (var i$0 = 0; i$0 < names.length; ++i$0)
fn(names[i$0], Object.getOwnPropertyDescriptor(obj, names[i$0]));
names = Object.getOwnPropertySymbols(obj);
for (var i$1 = 0; i$1 < names.length; ++i$1)
fn(names... | javascript | function forEachDesc(obj, fn) {
var names = Object.getOwnPropertyNames(obj);
for (var i$0 = 0; i$0 < names.length; ++i$0)
fn(names[i$0], Object.getOwnPropertyDescriptor(obj, names[i$0]));
names = Object.getOwnPropertySymbols(obj);
for (var i$1 = 0; i$1 < names.length; ++i$1)
fn(names... | [
"function",
"forEachDesc",
"(",
"obj",
",",
"fn",
")",
"{",
"var",
"names",
"=",
"Object",
".",
"getOwnPropertyNames",
"(",
"obj",
")",
";",
"for",
"(",
"var",
"i$0",
"=",
"0",
";",
"i$0",
"<",
"names",
".",
"length",
";",
"++",
"i$0",
")",
"fn",
... | Iterates over the descriptors for each own property of an object | [
"Iterates",
"over",
"the",
"descriptors",
"for",
"each",
"own",
"property",
"of",
"an",
"object"
] | 5fbe6805e3d382a0ce9e2913da65613ec33b19cb | https://github.com/zenparsing/moon-unit/blob/5fbe6805e3d382a0ce9e2913da65613ec33b19cb/build/moon-unit.js#L22-L35 |
54,154 | zenparsing/moon-unit | build/moon-unit.js | mergeProperty | function mergeProperty(target, name, desc, enumerable) {
if (desc.get || desc.set) {
var d$0 = { configurable: true };
if (desc.get) d$0.get = desc.get;
if (desc.set) d$0.set = desc.set;
desc = d$0;
}
desc.enumerable = enumerable;
Object.defineProperty(target, name, de... | javascript | function mergeProperty(target, name, desc, enumerable) {
if (desc.get || desc.set) {
var d$0 = { configurable: true };
if (desc.get) d$0.get = desc.get;
if (desc.set) d$0.set = desc.set;
desc = d$0;
}
desc.enumerable = enumerable;
Object.defineProperty(target, name, de... | [
"function",
"mergeProperty",
"(",
"target",
",",
"name",
",",
"desc",
",",
"enumerable",
")",
"{",
"if",
"(",
"desc",
".",
"get",
"||",
"desc",
".",
"set",
")",
"{",
"var",
"d$0",
"=",
"{",
"configurable",
":",
"true",
"}",
";",
"if",
"(",
"desc",
... | Installs a property into an object, merging "get" and "set" functions | [
"Installs",
"a",
"property",
"into",
"an",
"object",
"merging",
"get",
"and",
"set",
"functions"
] | 5fbe6805e3d382a0ce9e2913da65613ec33b19cb | https://github.com/zenparsing/moon-unit/blob/5fbe6805e3d382a0ce9e2913da65613ec33b19cb/build/moon-unit.js#L38-L50 |
54,155 | zenparsing/moon-unit | build/moon-unit.js | mergeProperties | function mergeProperties(target, source, enumerable) {
forEachDesc(source, function(name, desc) { return mergeProperty(target, name, desc, enumerable); });
} | javascript | function mergeProperties(target, source, enumerable) {
forEachDesc(source, function(name, desc) { return mergeProperty(target, name, desc, enumerable); });
} | [
"function",
"mergeProperties",
"(",
"target",
",",
"source",
",",
"enumerable",
")",
"{",
"forEachDesc",
"(",
"source",
",",
"function",
"(",
"name",
",",
"desc",
")",
"{",
"return",
"mergeProperty",
"(",
"target",
",",
"name",
",",
"desc",
",",
"enumerabl... | Installs properties on an object, merging "get" and "set" functions | [
"Installs",
"properties",
"on",
"an",
"object",
"merging",
"get",
"and",
"set",
"functions"
] | 5fbe6805e3d382a0ce9e2913da65613ec33b19cb | https://github.com/zenparsing/moon-unit/blob/5fbe6805e3d382a0ce9e2913da65613ec33b19cb/build/moon-unit.js#L53-L56 |
54,156 | zenparsing/moon-unit | build/moon-unit.js | buildClass | function buildClass(base, def) {
var parent;
if (def === void 0) {
// If no base class is specified, then Object.prototype
// is the parent prototype
def = base;
base = null;
parent = Object.prototype;
} else if (base === null) {
// If the base is null, t... | javascript | function buildClass(base, def) {
var parent;
if (def === void 0) {
// If no base class is specified, then Object.prototype
// is the parent prototype
def = base;
base = null;
parent = Object.prototype;
} else if (base === null) {
// If the base is null, t... | [
"function",
"buildClass",
"(",
"base",
",",
"def",
")",
"{",
"var",
"parent",
";",
"if",
"(",
"def",
"===",
"void",
"0",
")",
"{",
"// If no base class is specified, then Object.prototype",
"// is the parent prototype",
"def",
"=",
"base",
";",
"base",
"=",
"nul... | Builds a class | [
"Builds",
"a",
"class"
] | 5fbe6805e3d382a0ce9e2913da65613ec33b19cb | https://github.com/zenparsing/moon-unit/blob/5fbe6805e3d382a0ce9e2913da65613ec33b19cb/build/moon-unit.js#L59-L118 |
54,157 | zenparsing/moon-unit | build/moon-unit.js | function(target) {
for (var i$2 = 1; i$2 < arguments.length; i$2 += 3) {
var desc$0 = Object.getOwnPropertyDescriptor(arguments[i$2 + 1], "_");
mergeProperty(target, arguments[i$2], desc$0, true);
if (i$2 + 2 < arguments.length)
mergeProperties(target, argu... | javascript | function(target) {
for (var i$2 = 1; i$2 < arguments.length; i$2 += 3) {
var desc$0 = Object.getOwnPropertyDescriptor(arguments[i$2 + 1], "_");
mergeProperty(target, arguments[i$2], desc$0, true);
if (i$2 + 2 < arguments.length)
mergeProperties(target, argu... | [
"function",
"(",
"target",
")",
"{",
"for",
"(",
"var",
"i$2",
"=",
"1",
";",
"i$2",
"<",
"arguments",
".",
"length",
";",
"i$2",
"+=",
"3",
")",
"{",
"var",
"desc$0",
"=",
"Object",
".",
"getOwnPropertyDescriptor",
"(",
"arguments",
"[",
"i$2",
"+",... | Support for computed property names | [
"Support",
"for",
"computed",
"property",
"names"
] | 5fbe6805e3d382a0ce9e2913da65613ec33b19cb | https://github.com/zenparsing/moon-unit/blob/5fbe6805e3d382a0ce9e2913da65613ec33b19cb/build/moon-unit.js#L130-L142 | |
54,158 | zenparsing/moon-unit | build/moon-unit.js | function(iter) {
var front = null, back = null;
return _esdown.computed({
next: function(val) { return send("next", val) },
throw: function(val) { return send("throw", val) },
return: function(val) { return send("return", val) },
}, Symbol.asyncIterator... | javascript | function(iter) {
var front = null, back = null;
return _esdown.computed({
next: function(val) { return send("next", val) },
throw: function(val) { return send("throw", val) },
return: function(val) { return send("return", val) },
}, Symbol.asyncIterator... | [
"function",
"(",
"iter",
")",
"{",
"var",
"front",
"=",
"null",
",",
"back",
"=",
"null",
";",
"return",
"_esdown",
".",
"computed",
"(",
"{",
"next",
":",
"function",
"(",
"val",
")",
"{",
"return",
"send",
"(",
"\"next\"",
",",
"val",
")",
"}",
... | Support for async generators | [
"Support",
"for",
"async",
"generators"
] | 5fbe6805e3d382a0ce9e2913da65613ec33b19cb | https://github.com/zenparsing/moon-unit/blob/5fbe6805e3d382a0ce9e2913da65613ec33b19cb/build/moon-unit.js#L181-L289 | |
54,159 | zenparsing/moon-unit | build/moon-unit.js | function(initial) {
return {
a: initial || [],
// Add items
s: function() {
for (var i$3 = 0; i$3 < arguments.length; ++i$3)
this.a.push(arguments[i$3]);
return this;
},
// Add the contents of i... | javascript | function(initial) {
return {
a: initial || [],
// Add items
s: function() {
for (var i$3 = 0; i$3 < arguments.length; ++i$3)
this.a.push(arguments[i$3]);
return this;
},
// Add the contents of i... | [
"function",
"(",
"initial",
")",
"{",
"return",
"{",
"a",
":",
"initial",
"||",
"[",
"]",
",",
"// Add items",
"s",
":",
"function",
"(",
")",
"{",
"for",
"(",
"var",
"i$3",
"=",
"0",
";",
"i$3",
"<",
"arguments",
".",
"length",
";",
"++",
"i$3",... | Support for spread operations | [
"Support",
"for",
"spread",
"operations"
] | 5fbe6805e3d382a0ce9e2913da65613ec33b19cb | https://github.com/zenparsing/moon-unit/blob/5fbe6805e3d382a0ce9e2913da65613ec33b19cb/build/moon-unit.js#L292-L324 | |
54,160 | zenparsing/moon-unit | build/moon-unit.js | function(list) {
if (Array.isArray(list)) {
this.a.push.apply(this.a, list);
} else {
for (var __$0 = (list)[Symbol.iterator](), __$1; __$1 = __$0.next(), !__$1.done;)
{ var item$0 = __$1.value; this.a.push(item$0); }
... | javascript | function(list) {
if (Array.isArray(list)) {
this.a.push.apply(this.a, list);
} else {
for (var __$0 = (list)[Symbol.iterator](), __$1; __$1 = __$0.next(), !__$1.done;)
{ var item$0 = __$1.value; this.a.push(item$0); }
... | [
"function",
"(",
"list",
")",
"{",
"if",
"(",
"Array",
".",
"isArray",
"(",
"list",
")",
")",
"{",
"this",
".",
"a",
".",
"push",
".",
"apply",
"(",
"this",
".",
"a",
",",
"list",
")",
";",
"}",
"else",
"{",
"for",
"(",
"var",
"__$0",
"=",
... | Add the contents of iterables | [
"Add",
"the",
"contents",
"of",
"iterables"
] | 5fbe6805e3d382a0ce9e2913da65613ec33b19cb | https://github.com/zenparsing/moon-unit/blob/5fbe6805e3d382a0ce9e2913da65613ec33b19cb/build/moon-unit.js#L308-L321 | |
54,161 | zenparsing/moon-unit | build/moon-unit.js | function(obj) {
if (Array.isArray(obj)) {
return {
at: function(skip, pos) { return obj[pos] },
rest: function(skip, pos) { return obj.slice(pos) }
};
}
var iter = toObject(obj)[Symbol.iterator]();
return {
at: fun... | javascript | function(obj) {
if (Array.isArray(obj)) {
return {
at: function(skip, pos) { return obj[pos] },
rest: function(skip, pos) { return obj.slice(pos) }
};
}
var iter = toObject(obj)[Symbol.iterator]();
return {
at: fun... | [
"function",
"(",
"obj",
")",
"{",
"if",
"(",
"Array",
".",
"isArray",
"(",
"obj",
")",
")",
"{",
"return",
"{",
"at",
":",
"function",
"(",
"skip",
",",
"pos",
")",
"{",
"return",
"obj",
"[",
"pos",
"]",
"}",
",",
"rest",
":",
"function",
"(",
... | Support for array destructuring | [
"Support",
"for",
"array",
"destructuring"
] | 5fbe6805e3d382a0ce9e2913da65613ec33b19cb | https://github.com/zenparsing/moon-unit/blob/5fbe6805e3d382a0ce9e2913da65613ec33b19cb/build/moon-unit.js#L333-L371 | |
54,162 | zenparsing/moon-unit | build/moon-unit.js | function(obj, map, name) {
var entry = map.get(Object(obj));
if (!entry)
throw new TypeError;
return entry[name];
} | javascript | function(obj, map, name) {
var entry = map.get(Object(obj));
if (!entry)
throw new TypeError;
return entry[name];
} | [
"function",
"(",
"obj",
",",
"map",
",",
"name",
")",
"{",
"var",
"entry",
"=",
"map",
".",
"get",
"(",
"Object",
"(",
"obj",
")",
")",
";",
"if",
"(",
"!",
"entry",
")",
"throw",
"new",
"TypeError",
";",
"return",
"entry",
"[",
"name",
"]",
";... | Support for private fields | [
"Support",
"for",
"private",
"fields"
] | 5fbe6805e3d382a0ce9e2913da65613ec33b19cb | https://github.com/zenparsing/moon-unit/blob/5fbe6805e3d382a0ce9e2913da65613ec33b19cb/build/moon-unit.js#L374-L382 | |
54,163 | zenparsing/moon-unit | build/moon-unit.js | getClass | function getClass(o) {
if (o === null || o === undefined) return "Object";
return OP_toString.call(o).slice("[object ".length, -1);
} | javascript | function getClass(o) {
if (o === null || o === undefined) return "Object";
return OP_toString.call(o).slice("[object ".length, -1);
} | [
"function",
"getClass",
"(",
"o",
")",
"{",
"if",
"(",
"o",
"===",
"null",
"||",
"o",
"===",
"undefined",
")",
"return",
"\"Object\"",
";",
"return",
"OP_toString",
".",
"call",
"(",
"o",
")",
".",
"slice",
"(",
"\"[object \"",
".",
"length",
",",
"-... | Returns the internal class of an object | [
"Returns",
"the",
"internal",
"class",
"of",
"an",
"object"
] | 5fbe6805e3d382a0ce9e2913da65613ec33b19cb | https://github.com/zenparsing/moon-unit/blob/5fbe6805e3d382a0ce9e2913da65613ec33b19cb/build/moon-unit.js#L409-L413 |
54,164 | zenparsing/moon-unit | build/moon-unit.js | equal | function equal(a, b) {
if (Object.is(a, b))
return true;
// Dates must have equal time values
if (isDate(a) && isDate(b))
return a.getTime() === b.getTime();
// Non-objects must be strictly equal (types must be equal)
if (!isObject(a) || !isObject(b))
return a === b;
// Prototypes must be ident... | javascript | function equal(a, b) {
if (Object.is(a, b))
return true;
// Dates must have equal time values
if (isDate(a) && isDate(b))
return a.getTime() === b.getTime();
// Non-objects must be strictly equal (types must be equal)
if (!isObject(a) || !isObject(b))
return a === b;
// Prototypes must be ident... | [
"function",
"equal",
"(",
"a",
",",
"b",
")",
"{",
"if",
"(",
"Object",
".",
"is",
"(",
"a",
",",
"b",
")",
")",
"return",
"true",
";",
"// Dates must have equal time values",
"if",
"(",
"isDate",
"(",
"a",
")",
"&&",
"isDate",
"(",
"b",
")",
")",
... | Returns true if the arguments are "equal" | [
"Returns",
"true",
"if",
"the",
"arguments",
"are",
"equal"
] | 5fbe6805e3d382a0ce9e2913da65613ec33b19cb | https://github.com/zenparsing/moon-unit/blob/5fbe6805e3d382a0ce9e2913da65613ec33b19cb/build/moon-unit.js#L428-L469 |
54,165 | davidmarkclements/seneca-scheduler | lib/scheduler.js | punch | function punch(date) {
Object.defineProperty(date, '_isValid', {
get: function() {
return this.toDate() !== this.lang().invalidDate()
}
});
return date;
} | javascript | function punch(date) {
Object.defineProperty(date, '_isValid', {
get: function() {
return this.toDate() !== this.lang().invalidDate()
}
});
return date;
} | [
"function",
"punch",
"(",
"date",
")",
"{",
"Object",
".",
"defineProperty",
"(",
"date",
",",
"'_isValid'",
",",
"{",
"get",
":",
"function",
"(",
")",
"{",
"return",
"this",
".",
"toDate",
"(",
")",
"!==",
"this",
".",
"lang",
"(",
")",
".",
"inv... | monkey punch moment to get around a validation bug | [
"monkey",
"punch",
"moment",
"to",
"get",
"around",
"a",
"validation",
"bug"
] | 3a2b3c40c086b244f985bd1612e6af677e2df9e5 | https://github.com/davidmarkclements/seneca-scheduler/blob/3a2b3c40c086b244f985bd1612e6af677e2df9e5/lib/scheduler.js#L13-L20 |
54,166 | spacemaus/postvox | vox-server/interchangesockets.js | handleSocketMessage | function handleSocketMessage(method, data, replyFn) {
debug('%s %s %s', socket.id, method, data.url, data.payload);
eyes.mark('sockets.' + method);
var url = data.url;
if (!url) {
replyFn({ status: 400, message: 'No URL given in request!' });
return;
}
if (url.indexOf('/') == -1) {
... | javascript | function handleSocketMessage(method, data, replyFn) {
debug('%s %s %s', socket.id, method, data.url, data.payload);
eyes.mark('sockets.' + method);
var url = data.url;
if (!url) {
replyFn({ status: 400, message: 'No URL given in request!' });
return;
}
if (url.indexOf('/') == -1) {
... | [
"function",
"handleSocketMessage",
"(",
"method",
",",
"data",
",",
"replyFn",
")",
"{",
"debug",
"(",
"'%s %s %s'",
",",
"socket",
".",
"id",
",",
"method",
",",
"data",
".",
"url",
",",
"data",
".",
"payload",
")",
";",
"eyes",
".",
"mark",
"(",
"'... | Handles the VOX command. A VOX command wraps a URL, HTTP method, and JSON
data payload, and it expects a JSON response.
@param method {String} The command's HTTP-like method. E.g. "POST".
@param data.url {String} The URL of the command. E.g.,
"vox://<source>/threads/<threadId>".
@param data.payload {Object} The com... | [
"Handles",
"the",
"VOX",
"command",
".",
"A",
"VOX",
"command",
"wraps",
"a",
"URL",
"HTTP",
"method",
"and",
"JSON",
"data",
"payload",
"and",
"it",
"expects",
"a",
"JSON",
"response",
"."
] | de98e5ed37edaee1b1edadf93e15eb8f8d21f457 | https://github.com/spacemaus/postvox/blob/de98e5ed37edaee1b1edadf93e15eb8f8d21f457/vox-server/interchangesockets.js#L71-L119 |
54,167 | shama/cettings | namespace.js | getParts | function getParts(str) {
return str.replace(/\\\./g, '\uffff').split('.').map(function(s) {
return s.replace(/\uffff/g, '.');
});
} | javascript | function getParts(str) {
return str.replace(/\\\./g, '\uffff').split('.').map(function(s) {
return s.replace(/\uffff/g, '.');
});
} | [
"function",
"getParts",
"(",
"str",
")",
"{",
"return",
"str",
".",
"replace",
"(",
"/",
"\\\\\\.",
"/",
"g",
",",
"'\\uffff'",
")",
".",
"split",
"(",
"'.'",
")",
".",
"map",
"(",
"function",
"(",
"s",
")",
"{",
"return",
"s",
".",
"replace",
"(... | Split strings on dot, but only if dot isn't preceded by a backslash. Since JavaScript doesn't support lookbehinds, use a placeholder for "\.", split on dot, then replace the placeholder character with a dot. | [
"Split",
"strings",
"on",
"dot",
"but",
"only",
"if",
"dot",
"isn",
"t",
"preceded",
"by",
"a",
"backslash",
".",
"Since",
"JavaScript",
"doesn",
"t",
"support",
"lookbehinds",
"use",
"a",
"placeholder",
"for",
"\\",
".",
"split",
"on",
"dot",
"then",
"r... | 886eeec0c1fb92a2d1ce9926c8c1edf61c678c03 | https://github.com/shama/cettings/blob/886eeec0c1fb92a2d1ce9926c8c1edf61c678c03/namespace.js#L17-L21 |
54,168 | slikts/promiseproxy | src/cached.js | CachedPromiseProxy | function CachedPromiseProxy(target, context, cache = new WeakMap(), factory = PromiseProxy) {
const cached = cache.get(target)
if (cached) {
return cached
}
const obj = factory(target, context,
(target, context) => CachedPromiseProxy(target, context, cache))
cache.set(target, obj)
return obj
} | javascript | function CachedPromiseProxy(target, context, cache = new WeakMap(), factory = PromiseProxy) {
const cached = cache.get(target)
if (cached) {
return cached
}
const obj = factory(target, context,
(target, context) => CachedPromiseProxy(target, context, cache))
cache.set(target, obj)
return obj
} | [
"function",
"CachedPromiseProxy",
"(",
"target",
",",
"context",
",",
"cache",
"=",
"new",
"WeakMap",
"(",
")",
",",
"factory",
"=",
"PromiseProxy",
")",
"{",
"const",
"cached",
"=",
"cache",
".",
"get",
"(",
"target",
")",
"if",
"(",
"cached",
")",
"{... | Wraps PromiseProxy factory and caches instances in a WeakMap | [
"Wraps",
"PromiseProxy",
"factory",
"and",
"caches",
"instances",
"in",
"a",
"WeakMap"
] | bcda1b4372bf03a86af7d2bb1ba01a746a9ba952 | https://github.com/slikts/promiseproxy/blob/bcda1b4372bf03a86af7d2bb1ba01a746a9ba952/src/cached.js#L6-L15 |
54,169 | alex-seville/feta | dist/devtools.js | checkIfPlaying | function checkIfPlaying(){
runInPage(window.fetaSource.isPlayingStr(),
function(result){
if(!result){
setTimeout(checkIfPlaying,500);
}else{
_window.msgFromDevtools("revertRun",{data: result});
}
},... | javascript | function checkIfPlaying(){
runInPage(window.fetaSource.isPlayingStr(),
function(result){
if(!result){
setTimeout(checkIfPlaying,500);
}else{
_window.msgFromDevtools("revertRun",{data: result});
}
},... | [
"function",
"checkIfPlaying",
"(",
")",
"{",
"runInPage",
"(",
"window",
".",
"fetaSource",
".",
"isPlayingStr",
"(",
")",
",",
"function",
"(",
"result",
")",
"{",
"if",
"(",
"!",
"result",
")",
"{",
"setTimeout",
"(",
"checkIfPlaying",
",",
"500",
")",... | we check if the test is still running when it isn't running anymore we update the run test button | [
"we",
"check",
"if",
"the",
"test",
"is",
"still",
"running",
"when",
"it",
"isn",
"t",
"running",
"anymore",
"we",
"update",
"the",
"run",
"test",
"button"
] | 2ba603320ccba3fec313d26a3a70fab3d6f39e3a | https://github.com/alex-seville/feta/blob/2ba603320ccba3fec313d26a3a70fab3d6f39e3a/dist/devtools.js#L86-L98 |
54,170 | alex-seville/feta | dist/devtools.js | doFeta | function doFeta(msg) {
if(msg){
runInPage(window.fetaSource.startStr(),
function(){
btn.update("images/recording.png", "Stop Recording");
});
}else{
runInPage(window.fetaSource.stopStr(),
function(resul... | javascript | function doFeta(msg) {
if(msg){
runInPage(window.fetaSource.startStr(),
function(){
btn.update("images/recording.png", "Stop Recording");
});
}else{
runInPage(window.fetaSource.stopStr(),
function(resul... | [
"function",
"doFeta",
"(",
"msg",
")",
"{",
"if",
"(",
"msg",
")",
"{",
"runInPage",
"(",
"window",
".",
"fetaSource",
".",
"startStr",
"(",
")",
",",
"function",
"(",
")",
"{",
"btn",
".",
"update",
"(",
"\"images/recording.png\"",
",",
"\"Stop Recordin... | we inject feta.start or feta.stop depending on the mode. we update the panel button as well | [
"we",
"inject",
"feta",
".",
"start",
"or",
"feta",
".",
"stop",
"depending",
"on",
"the",
"mode",
".",
"we",
"update",
"the",
"panel",
"button",
"as",
"well"
] | 2ba603320ccba3fec313d26a3a70fab3d6f39e3a | https://github.com/alex-seville/feta/blob/2ba603320ccba3fec313d26a3a70fab3d6f39e3a/dist/devtools.js#L102-L115 |
54,171 | alex-seville/feta | dist/devtools.js | makeDownload | function makeDownload(url,fname){
fname = fname === "" ? "feta_output.js" : fname;
//this code is from SO, but I'm missing the link right now
var s = "var a = document.createElement('a');";
s+= "a.href = '"+url+"';";
s+= "a.download = '"+ fname +"';";... | javascript | function makeDownload(url,fname){
fname = fname === "" ? "feta_output.js" : fname;
//this code is from SO, but I'm missing the link right now
var s = "var a = document.createElement('a');";
s+= "a.href = '"+url+"';";
s+= "a.download = '"+ fname +"';";... | [
"function",
"makeDownload",
"(",
"url",
",",
"fname",
")",
"{",
"fname",
"=",
"fname",
"===",
"\"\"",
"?",
"\"feta_output.js\"",
":",
"fname",
";",
"//this code is from SO, but I'm missing the link right now",
"var",
"s",
"=",
"\"var a = document.createElement('a');\"",
... | create a link element and click it to download the file | [
"create",
"a",
"link",
"element",
"and",
"click",
"it",
"to",
"download",
"the",
"file"
] | 2ba603320ccba3fec313d26a3a70fab3d6f39e3a | https://github.com/alex-seville/feta/blob/2ba603320ccba3fec313d26a3a70fab3d6f39e3a/dist/devtools.js#L123-L134 |
54,172 | alex-seville/feta | dist/devtools.js | runInPage | function runInPage(code,callback,errorCallback){
errorCallback = errorCallback || function(err){ alert(errorMessage+err); };
chrome.devtools.inspectedWindow["eval"](
code,
function(result, isException) {
if (isException)
errorCallback(isException);
else{
callback(result);
}
})... | javascript | function runInPage(code,callback,errorCallback){
errorCallback = errorCallback || function(err){ alert(errorMessage+err); };
chrome.devtools.inspectedWindow["eval"](
code,
function(result, isException) {
if (isException)
errorCallback(isException);
else{
callback(result);
}
})... | [
"function",
"runInPage",
"(",
"code",
",",
"callback",
",",
"errorCallback",
")",
"{",
"errorCallback",
"=",
"errorCallback",
"||",
"function",
"(",
"err",
")",
"{",
"alert",
"(",
"errorMessage",
"+",
"err",
")",
";",
"}",
";",
"chrome",
".",
"devtools",
... | helper function to evaluate code in the inspected page context with access to the JS and the DOM | [
"helper",
"function",
"to",
"evaluate",
"code",
"in",
"the",
"inspected",
"page",
"context",
"with",
"access",
"to",
"the",
"JS",
"and",
"the",
"DOM"
] | 2ba603320ccba3fec313d26a3a70fab3d6f39e3a | https://github.com/alex-seville/feta/blob/2ba603320ccba3fec313d26a3a70fab3d6f39e3a/dist/devtools.js#L143-L154 |
54,173 | nullivex/oose-sdk | helpers/api.js | function(err){
//if this is already a network error just throw it
if(err instanceof NetworkError){
throw err
}
//convert strings to errors
if('string' === typeof err){
err = new Error(err)
}
//check if the error message matches a known TCP error
var error
for(var i = 0; i < tcpErrors.length; i... | javascript | function(err){
//if this is already a network error just throw it
if(err instanceof NetworkError){
throw err
}
//convert strings to errors
if('string' === typeof err){
err = new Error(err)
}
//check if the error message matches a known TCP error
var error
for(var i = 0; i < tcpErrors.length; i... | [
"function",
"(",
"err",
")",
"{",
"//if this is already a network error just throw it",
"if",
"(",
"err",
"instanceof",
"NetworkError",
")",
"{",
"throw",
"err",
"}",
"//convert strings to errors",
"if",
"(",
"'string'",
"===",
"typeof",
"err",
")",
"{",
"err",
"=... | Handle network errors
@param {Error} err | [
"Handle",
"network",
"errors"
] | 46a3a950107b904825195b2a6645d9db5a3dd5bd | https://github.com/nullivex/oose-sdk/blob/46a3a950107b904825195b2a6645d9db5a3dd5bd/helpers/api.js#L102-L124 | |
54,174 | nullivex/oose-sdk | helpers/api.js | function(type,options){
var cacheKey = type + ':' + options.host + ':' + options.port
if(!cache[cacheKey]){
debug('cache miss',cacheKey)
var reqDefaults = {
rejectUnauthorized: false,
json: true,
timeout:
+process.env.REQUEST_TIMEOUT ||
+options.timeout ||
214748364... | javascript | function(type,options){
var cacheKey = type + ':' + options.host + ':' + options.port
if(!cache[cacheKey]){
debug('cache miss',cacheKey)
var reqDefaults = {
rejectUnauthorized: false,
json: true,
timeout:
+process.env.REQUEST_TIMEOUT ||
+options.timeout ||
214748364... | [
"function",
"(",
"type",
",",
"options",
")",
"{",
"var",
"cacheKey",
"=",
"type",
"+",
"':'",
"+",
"options",
".",
"host",
"+",
"':'",
"+",
"options",
".",
"port",
"if",
"(",
"!",
"cache",
"[",
"cacheKey",
"]",
")",
"{",
"debug",
"(",
"'cache miss... | Setup a new request object
@param {string} type
@param {object} options
@return {request} | [
"Setup",
"a",
"new",
"request",
"object"
] | 46a3a950107b904825195b2a6645d9db5a3dd5bd | https://github.com/nullivex/oose-sdk/blob/46a3a950107b904825195b2a6645d9db5a3dd5bd/helpers/api.js#L151-L184 | |
54,175 | Vanessa219/gulp-header-license | index.js | isMatch | function isMatch(file, license, rate, srcNLReg) {
var srcLines = file.contents.toString('utf8').split(/\r?\n/),
templateLines = license.split(/\r?\n/),
type = path.extname(file.path),
matchRates = 0,
removed = false;
// after '<?php' has n... | javascript | function isMatch(file, license, rate, srcNLReg) {
var srcLines = file.contents.toString('utf8').split(/\r?\n/),
templateLines = license.split(/\r?\n/),
type = path.extname(file.path),
matchRates = 0,
removed = false;
// after '<?php' has n... | [
"function",
"isMatch",
"(",
"file",
",",
"license",
",",
"rate",
",",
"srcNLReg",
")",
"{",
"var",
"srcLines",
"=",
"file",
".",
"contents",
".",
"toString",
"(",
"'utf8'",
")",
".",
"split",
"(",
"/",
"\\r?\\n",
"/",
")",
",",
"templateLines",
"=",
... | According to rate, get matching.
@param {object} file nodeJS file object.
@param {string} license The license template string.
@param {float} rate Matching rate.
@param {string} srcNLReg new line char code.
@returns {boolean} dose match. | [
"According",
"to",
"rate",
"get",
"matching",
"."
] | 41e5287a7a58aab7f1799d916d8c0ccaf3353358 | https://github.com/Vanessa219/gulp-header-license/blob/41e5287a7a58aab7f1799d916d8c0ccaf3353358/index.js#L39-L104 |
54,176 | Vanessa219/gulp-header-license | index.js | getMatchRate | function getMatchRate(src, str) {
if (typeof (src) === 'undefined' || typeof (str) === 'undefined') {
return 0;
}
var maxLength = src.length > str.length ? src.length : str.length,
matchCnt = 0;
if (maxLength === 0) {
return 1;
}
... | javascript | function getMatchRate(src, str) {
if (typeof (src) === 'undefined' || typeof (str) === 'undefined') {
return 0;
}
var maxLength = src.length > str.length ? src.length : str.length,
matchCnt = 0;
if (maxLength === 0) {
return 1;
}
... | [
"function",
"getMatchRate",
"(",
"src",
",",
"str",
")",
"{",
"if",
"(",
"typeof",
"(",
"src",
")",
"===",
"'undefined'",
"||",
"typeof",
"(",
"str",
")",
"===",
"'undefined'",
")",
"{",
"return",
"0",
";",
"}",
"var",
"maxLength",
"=",
"src",
".",
... | Compare each character for ever line, and get ever line match rate.
@param {type} src text for template.
@param {type} str text for file.
@returns {float} match rate. | [
"Compare",
"each",
"character",
"for",
"ever",
"line",
"and",
"get",
"ever",
"line",
"match",
"rate",
"."
] | 41e5287a7a58aab7f1799d916d8c0ccaf3353358 | https://github.com/Vanessa219/gulp-header-license/blob/41e5287a7a58aab7f1799d916d8c0ccaf3353358/index.js#L113-L135 |
54,177 | Vanessa219/gulp-header-license | index.js | getSeparator | function getSeparator(str, str2) {
// 13 \r 10 \n
for (var i = str.length; i > -1; i--) {
if (str.charCodeAt(i) === 10) {
if (str.charCodeAt(i - 1) === 13) {
return '\r\n';
}
if (str.charCodeAt(i + 1) === 13) {
... | javascript | function getSeparator(str, str2) {
// 13 \r 10 \n
for (var i = str.length; i > -1; i--) {
if (str.charCodeAt(i) === 10) {
if (str.charCodeAt(i - 1) === 13) {
return '\r\n';
}
if (str.charCodeAt(i + 1) === 13) {
... | [
"function",
"getSeparator",
"(",
"str",
",",
"str2",
")",
"{",
"// 13 \\r 10 \\n",
"for",
"(",
"var",
"i",
"=",
"str",
".",
"length",
";",
"i",
">",
"-",
"1",
";",
"i",
"--",
")",
"{",
"if",
"(",
"str",
".",
"charCodeAt",
"(",
"i",
")",
"===",
... | Test first newline character and get newline character.
@param {type} str file content.
@returns {String} newline character. | [
"Test",
"first",
"newline",
"character",
"and",
"get",
"newline",
"character",
"."
] | 41e5287a7a58aab7f1799d916d8c0ccaf3353358 | https://github.com/Vanessa219/gulp-header-license/blob/41e5287a7a58aab7f1799d916d8c0ccaf3353358/index.js#L143-L190 |
54,178 | joneit/extend-me | index.js | function(memberName) {
var parent = this.super;
do { parent = Object.getPrototypeOf(parent); } while (!parent.hasOwnProperty(memberName));
return parent && parent[memberName];
} | javascript | function(memberName) {
var parent = this.super;
do { parent = Object.getPrototypeOf(parent); } while (!parent.hasOwnProperty(memberName));
return parent && parent[memberName];
} | [
"function",
"(",
"memberName",
")",
"{",
"var",
"parent",
"=",
"this",
".",
"super",
";",
"do",
"{",
"parent",
"=",
"Object",
".",
"getPrototypeOf",
"(",
"parent",
")",
";",
"}",
"while",
"(",
"!",
"parent",
".",
"hasOwnProperty",
"(",
"memberName",
")... | Find member on prototype chain beginning with super class.
@param {string} memberName
@returns {undefined|*} `undefined` if not found; value otherwise. | [
"Find",
"member",
"on",
"prototype",
"chain",
"beginning",
"with",
"super",
"class",
"."
] | 727386ee29ab77ec0eb48bcc995dcd20b72ff091 | https://github.com/joneit/extend-me/blob/727386ee29ab77ec0eb48bcc995dcd20b72ff091/index.js#L146-L150 | |
54,179 | SwirlNetworks/discus | src/super.js | findSuper | function findSuper(methodName, childObject) {
var object = childObject;
while (object[methodName] === childObject[methodName]) {
object = object.constructor.__super__;
if (!object) {
throw new Error('Class has no super method for', methodName, '. Remove the _super call to the non-existent method');
}
}
re... | javascript | function findSuper(methodName, childObject) {
var object = childObject;
while (object[methodName] === childObject[methodName]) {
object = object.constructor.__super__;
if (!object) {
throw new Error('Class has no super method for', methodName, '. Remove the _super call to the non-existent method');
}
}
re... | [
"function",
"findSuper",
"(",
"methodName",
",",
"childObject",
")",
"{",
"var",
"object",
"=",
"childObject",
";",
"while",
"(",
"object",
"[",
"methodName",
"]",
"===",
"childObject",
"[",
"methodName",
"]",
")",
"{",
"object",
"=",
"object",
".",
"const... | Find the next object up the prototype chain that has a different implementation of the method. | [
"Find",
"the",
"next",
"object",
"up",
"the",
"prototype",
"chain",
"that",
"has",
"a",
"different",
"implementation",
"of",
"the",
"method",
"."
] | 79df8de5ec268879e50ec1e12e78b62a13b4a427 | https://github.com/SwirlNetworks/discus/blob/79df8de5ec268879e50ec1e12e78b62a13b4a427/src/super.js#L5-L15 |
54,180 | teabyii/qa | lib/index.js | prompt | function prompt (config) {
const controller = new Controller()
return controller
.prompt(config)
.then(function (answer) {
controller.destroy()
return answer
})
} | javascript | function prompt (config) {
const controller = new Controller()
return controller
.prompt(config)
.then(function (answer) {
controller.destroy()
return answer
})
} | [
"function",
"prompt",
"(",
"config",
")",
"{",
"const",
"controller",
"=",
"new",
"Controller",
"(",
")",
"return",
"controller",
".",
"prompt",
"(",
"config",
")",
".",
"then",
"(",
"function",
"(",
"answer",
")",
"{",
"controller",
".",
"destroy",
"(",... | Prompt use not in `qa`, provide new constroller to take.
@param {Object} config
@returns {Promise} | [
"Prompt",
"use",
"not",
"in",
"qa",
"provide",
"new",
"constroller",
"to",
"take",
"."
] | 9224180dcb9e6b57c021f83b259316e84ebc573e | https://github.com/teabyii/qa/blob/9224180dcb9e6b57c021f83b259316e84ebc573e/lib/index.js#L10-L18 |
54,181 | teabyii/qa | lib/index.js | function (gen) {
var main = co.wrap(gen)
const controller = new Controller()
function finish () {
controller.destroy()
return controller.answers
}
function error (error) {
console.error(error.stack)
}
return main(function (config) {
return controller.prompt(config)
}, register).... | javascript | function (gen) {
var main = co.wrap(gen)
const controller = new Controller()
function finish () {
controller.destroy()
return controller.answers
}
function error (error) {
console.error(error.stack)
}
return main(function (config) {
return controller.prompt(config)
}, register).... | [
"function",
"(",
"gen",
")",
"{",
"var",
"main",
"=",
"co",
".",
"wrap",
"(",
"gen",
")",
"const",
"controller",
"=",
"new",
"Controller",
"(",
")",
"function",
"finish",
"(",
")",
"{",
"controller",
".",
"destroy",
"(",
")",
"return",
"controller",
... | Method to run a generator for interative command line program.
@param {Generator} gen The generator to put program.
@returns {Promise} The Promise to end program and take answers. | [
"Method",
"to",
"run",
"a",
"generator",
"for",
"interative",
"command",
"line",
"program",
"."
] | 9224180dcb9e6b57c021f83b259316e84ebc573e | https://github.com/teabyii/qa/blob/9224180dcb9e6b57c021f83b259316e84ebc573e/lib/index.js#L37-L53 | |
54,182 | fczbkk/style-properties | src/parse-property-value.js | convertColorComponent | function convertColorComponent (input) {
let result = input.toString(16);
if (result.length < 2) {
result = '0' + result
}
return result;
} | javascript | function convertColorComponent (input) {
let result = input.toString(16);
if (result.length < 2) {
result = '0' + result
}
return result;
} | [
"function",
"convertColorComponent",
"(",
"input",
")",
"{",
"let",
"result",
"=",
"input",
".",
"toString",
"(",
"16",
")",
";",
"if",
"(",
"result",
".",
"length",
"<",
"2",
")",
"{",
"result",
"=",
"'0'",
"+",
"result",
"}",
"return",
"result",
";... | converts number in base 10 to base 16, adds padding zero if needed | [
"converts",
"number",
"in",
"base",
"10",
"to",
"base",
"16",
"adds",
"padding",
"zero",
"if",
"needed"
] | d4e7b271001c0cd555534eb4a3bfde7795c58eed | https://github.com/fczbkk/style-properties/blob/d4e7b271001c0cd555534eb4a3bfde7795c58eed/src/parse-property-value.js#L6-L12 |
54,183 | liuhaixia888/fis-parser-less-px2rem | index.js | function(s1, s2, s5, val){
return s1 ?
[s1 + s2 + val, 'px' + s5].join(''):
[s2 + val, 'px' + s5].join('');
} | javascript | function(s1, s2, s5, val){
return s1 ?
[s1 + s2 + val, 'px' + s5].join(''):
[s2 + val, 'px' + s5].join('');
} | [
"function",
"(",
"s1",
",",
"s2",
",",
"s5",
",",
"val",
")",
"{",
"return",
"s1",
"?",
"[",
"s1",
"+",
"s2",
"+",
"val",
",",
"'px'",
"+",
"s5",
"]",
".",
"join",
"(",
"''",
")",
":",
"[",
"s2",
"+",
"val",
",",
"'px'",
"+",
"s5",
"]",
... | REM => PX | [
"REM",
"=",
">",
"PX"
] | b56011a0749e607828c3a04e0b846fe727a8b18f | https://github.com/liuhaixia888/fis-parser-less-px2rem/blob/b56011a0749e607828c3a04e0b846fe727a8b18f/index.js#L24-L28 | |
54,184 | carrascoMDD/protractor-relaunchable | lib/taskScheduler.js | function(capability, specLists) {
this.capability = capability;
this.numRunningInstances = 0;
this.maxInstance = capability.maxInstances || 1;
this.specsIndex = 0;
this.specLists = specLists;
} | javascript | function(capability, specLists) {
this.capability = capability;
this.numRunningInstances = 0;
this.maxInstance = capability.maxInstances || 1;
this.specsIndex = 0;
this.specLists = specLists;
} | [
"function",
"(",
"capability",
",",
"specLists",
")",
"{",
"this",
".",
"capability",
"=",
"capability",
";",
"this",
".",
"numRunningInstances",
"=",
"0",
";",
"this",
".",
"maxInstance",
"=",
"capability",
".",
"maxInstances",
"||",
"1",
";",
"this",
"."... | A queue of specs for a particular capacity | [
"A",
"queue",
"of",
"specs",
"for",
"a",
"particular",
"capacity"
] | c18e17ecd8b5b036217f87680800c6e14b47361f | https://github.com/carrascoMDD/protractor-relaunchable/blob/c18e17ecd8b5b036217f87680800c6e14b47361f/lib/taskScheduler.js#L10-L16 | |
54,185 | MRN-Code/decentralized-laplacian-ridge-regression | src/local.js | addBias | function addBias(arr) {
if (!Array.isArray(arr) || !arr.length) {
throw new Error(`Expected ${arr} to be an array with length`);
} else if (!arr.every(Array.isArray)) {
throw new Error(`Expected every item of ${arr} to be an array`);
}
return arr.map(row => [1].concat(row));
} | javascript | function addBias(arr) {
if (!Array.isArray(arr) || !arr.length) {
throw new Error(`Expected ${arr} to be an array with length`);
} else if (!arr.every(Array.isArray)) {
throw new Error(`Expected every item of ${arr} to be an array`);
}
return arr.map(row => [1].concat(row));
} | [
"function",
"addBias",
"(",
"arr",
")",
"{",
"if",
"(",
"!",
"Array",
".",
"isArray",
"(",
"arr",
")",
"||",
"!",
"arr",
".",
"length",
")",
"{",
"throw",
"new",
"Error",
"(",
"`",
"${",
"arr",
"}",
"`",
")",
";",
"}",
"else",
"if",
"(",
"!",... | Add bias.
@param {?} A
@returns {Array} | [
"Add",
"bias",
"."
] | 38fbd789c90d0b6b7e320cca735b51c246179f3b | https://github.com/MRN-Code/decentralized-laplacian-ridge-regression/blob/38fbd789c90d0b6b7e320cca735b51c246179f3b/src/local.js#L16-L24 |
54,186 | MRN-Code/decentralized-laplacian-ridge-regression | src/local.js | getNormalizedTags | function getNormalizedTags(tags) {
return Object.keys(tags).sort().reduce((memo, tag) => {
const value = tags[tag];
if (typeof value === 'boolean') {
return memo.concat(value === true ? 1 : -1);
} else if (typeof value === 'number') {
return memo.concat(value);
}
return memo;
}, []... | javascript | function getNormalizedTags(tags) {
return Object.keys(tags).sort().reduce((memo, tag) => {
const value = tags[tag];
if (typeof value === 'boolean') {
return memo.concat(value === true ? 1 : -1);
} else if (typeof value === 'number') {
return memo.concat(value);
}
return memo;
}, []... | [
"function",
"getNormalizedTags",
"(",
"tags",
")",
"{",
"return",
"Object",
".",
"keys",
"(",
"tags",
")",
".",
"sort",
"(",
")",
".",
"reduce",
"(",
"(",
"memo",
",",
"tag",
")",
"=>",
"{",
"const",
"value",
"=",
"tags",
"[",
"tag",
"]",
";",
"i... | Get normalized co-variate values.
@todo This ignores non-numeric and non-boolean tag values. Determine
an effective way to map strings and non-primitives to numbers.
@param {Object} tags Hash of tag names to tag values
@returns {Array} | [
"Get",
"normalized",
"co",
"-",
"variate",
"values",
"."
] | 38fbd789c90d0b6b7e320cca735b51c246179f3b | https://github.com/MRN-Code/decentralized-laplacian-ridge-regression/blob/38fbd789c90d0b6b7e320cca735b51c246179f3b/src/local.js#L35-L47 |
54,187 | tanem/stweam | lib/stweam.js | Stweam | function Stweam(opts) {
stream.Transform.call(this);
opts = opts || {};
if (!opts.consumerKey) throw new Error('consumer key is required');
if (!opts.consumerSecret) throw new Error('consumer secret is required');
if (!opts.token) throw new Error('token is required');
if (!opts.tokenSecret) throw new Error(... | javascript | function Stweam(opts) {
stream.Transform.call(this);
opts = opts || {};
if (!opts.consumerKey) throw new Error('consumer key is required');
if (!opts.consumerSecret) throw new Error('consumer secret is required');
if (!opts.token) throw new Error('token is required');
if (!opts.tokenSecret) throw new Error(... | [
"function",
"Stweam",
"(",
"opts",
")",
"{",
"stream",
".",
"Transform",
".",
"call",
"(",
"this",
")",
";",
"opts",
"=",
"opts",
"||",
"{",
"}",
";",
"if",
"(",
"!",
"opts",
".",
"consumerKey",
")",
"throw",
"new",
"Error",
"(",
"'consumer key is re... | Initialise a new `Stweam` with the given `opts`.
@param {String} opts.consumerKey
@param {String} opts.consumerSecret
@param {String} opts.token
@param {String} opts.tokenSecret
@api public | [
"Initialise",
"a",
"new",
"Stweam",
"with",
"the",
"given",
"opts",
"."
] | 287469074655f7a120684b121876b470525bf963 | https://github.com/tanem/stweam/blob/287469074655f7a120684b121876b470525bf963/lib/stweam.js#L22-L37 |
54,188 | azendal/argon | argon/model.js | all | function all(callback) {
var Model = this;
var request = {
find : 'find',
model : Model
};
this.dispatch('beforeAll');
this.storage.find(request, function findCallback(data) {
if (callback) {
callback(data);
... | javascript | function all(callback) {
var Model = this;
var request = {
find : 'find',
model : Model
};
this.dispatch('beforeAll');
this.storage.find(request, function findCallback(data) {
if (callback) {
callback(data);
... | [
"function",
"all",
"(",
"callback",
")",
"{",
"var",
"Model",
"=",
"this",
";",
"var",
"request",
"=",
"{",
"find",
":",
"'find'",
",",
"model",
":",
"Model",
"}",
";",
"this",
".",
"dispatch",
"(",
"'beforeAll'",
")",
";",
"this",
".",
"storage",
... | Fetches all records of a given Model and creates the instances.
@method all <public, static>
@argument callback <optional> [Function] method to handle data.
@return [Argon.Model]. | [
"Fetches",
"all",
"records",
"of",
"a",
"given",
"Model",
"and",
"creates",
"the",
"instances",
"."
] | 0cfd3a3b3731b69abca55c956c757476779ec1bd | https://github.com/azendal/argon/blob/0cfd3a3b3731b69abca55c956c757476779ec1bd/argon/model.js#L24-L40 |
54,189 | azendal/argon | argon/model.js | find | function find(id, callback) {
var Model, request;
Model = this;
request = {
action : 'findOne',
model : Model,
params : {
id : id
}
};
this.storage.findOne(request, function findOneCallback(data) {
if (c... | javascript | function find(id, callback) {
var Model, request;
Model = this;
request = {
action : 'findOne',
model : Model,
params : {
id : id
}
};
this.storage.findOne(request, function findOneCallback(data) {
if (c... | [
"function",
"find",
"(",
"id",
",",
"callback",
")",
"{",
"var",
"Model",
",",
"request",
";",
"Model",
"=",
"this",
";",
"request",
"=",
"{",
"action",
":",
"'findOne'",
",",
"model",
":",
"Model",
",",
"params",
":",
"{",
"id",
":",
"id",
"}",
... | Fetches one record of a given Model and creates the instance.
@method find <public, static>
@argument id <required> [Object] the id of the record.
@argument callback <optional> [Function] method to handle data.
@return [Argon.Model]. | [
"Fetches",
"one",
"record",
"of",
"a",
"given",
"Model",
"and",
"creates",
"the",
"instance",
"."
] | 0cfd3a3b3731b69abca55c956c757476779ec1bd | https://github.com/azendal/argon/blob/0cfd3a3b3731b69abca55c956c757476779ec1bd/argon/model.js#L49-L66 |
54,190 | azendal/argon | argon/model.js | init | function init(properties) {
this.eventListeners = [];
if (typeof properties !== 'undefined') {
Object.keys(properties).forEach(function (property) {
this[property] = properties[property];
}, this);
}
return this;
... | javascript | function init(properties) {
this.eventListeners = [];
if (typeof properties !== 'undefined') {
Object.keys(properties).forEach(function (property) {
this[property] = properties[property];
}, this);
}
return this;
... | [
"function",
"init",
"(",
"properties",
")",
"{",
"this",
".",
"eventListeners",
"=",
"[",
"]",
";",
"if",
"(",
"typeof",
"properties",
"!==",
"'undefined'",
")",
"{",
"Object",
".",
"keys",
"(",
"properties",
")",
".",
"forEach",
"(",
"function",
"(",
... | Object initializer, this method server as the real constructor
@method init <public>
@argument properties <optional> [Object] ({}) the attributes for the model isntance | [
"Object",
"initializer",
"this",
"method",
"server",
"as",
"the",
"real",
"constructor"
] | 0cfd3a3b3731b69abca55c956c757476779ec1bd | https://github.com/azendal/argon/blob/0cfd3a3b3731b69abca55c956c757476779ec1bd/argon/model.js#L75-L85 |
54,191 | azendal/argon | argon/model.js | setProperty | function setProperty(property, newValue) {
var originalValue;
if (newValue != originalValue) {
originalValue = this[property];
this[property] = newValue;
this.dispatch('change:' + property, {
originalValue : originalValue,
... | javascript | function setProperty(property, newValue) {
var originalValue;
if (newValue != originalValue) {
originalValue = this[property];
this[property] = newValue;
this.dispatch('change:' + property, {
originalValue : originalValue,
... | [
"function",
"setProperty",
"(",
"property",
",",
"newValue",
")",
"{",
"var",
"originalValue",
";",
"if",
"(",
"newValue",
"!=",
"originalValue",
")",
"{",
"originalValue",
"=",
"this",
"[",
"property",
"]",
";",
"this",
"[",
"property",
"]",
"=",
"newValu... | Sets the value of a property.
@method setProperty <public>
@argument property <required> [String] the property to write.
@argument newValue <required> [String] the value for the property.
@return [Object] instance of the model. | [
"Sets",
"the",
"value",
"of",
"a",
"property",
"."
] | 0cfd3a3b3731b69abca55c956c757476779ec1bd | https://github.com/azendal/argon/blob/0cfd3a3b3731b69abca55c956c757476779ec1bd/argon/model.js#L104-L118 |
54,192 | azendal/argon | argon/model.js | save | function save(callback) {
var model, request;
model = this;
this.constructor.dispatch('beforeSave', {
data : {
model : this
}
});
this.dispatch('beforeSave');
this.isValid(function (isValid) {
... | javascript | function save(callback) {
var model, request;
model = this;
this.constructor.dispatch('beforeSave', {
data : {
model : this
}
});
this.dispatch('beforeSave');
this.isValid(function (isValid) {
... | [
"function",
"save",
"(",
"callback",
")",
"{",
"var",
"model",
",",
"request",
";",
"model",
"=",
"this",
";",
"this",
".",
"constructor",
".",
"dispatch",
"(",
"'beforeSave'",
",",
"{",
"data",
":",
"{",
"model",
":",
"this",
"}",
"}",
")",
";",
"... | Saves the model to storage.
@method save <public>
@argument callback <required> [Function] function to manage response.
@return Noting. | [
"Saves",
"the",
"model",
"to",
"storage",
"."
] | 0cfd3a3b3731b69abca55c956c757476779ec1bd | https://github.com/azendal/argon/blob/0cfd3a3b3731b69abca55c956c757476779ec1bd/argon/model.js#L126-L185 |
54,193 | azendal/argon | argon/model.js | destroy | function destroy(callback) {
var model = this;
var request = {
action : 'remove',
model : model.constructor,
data : this
};
this.dispatch('beforeDestroy');
this.constructor.storage.remove(request, function destr... | javascript | function destroy(callback) {
var model = this;
var request = {
action : 'remove',
model : model.constructor,
data : this
};
this.dispatch('beforeDestroy');
this.constructor.storage.remove(request, function destr... | [
"function",
"destroy",
"(",
"callback",
")",
"{",
"var",
"model",
"=",
"this",
";",
"var",
"request",
"=",
"{",
"action",
":",
"'remove'",
",",
"model",
":",
"model",
".",
"constructor",
",",
"data",
":",
"this",
"}",
";",
"this",
".",
"dispatch",
"(... | Removes a record from storage.
@method destroy <public>
@argument callback [Function] function to manage response.
@return Noting. | [
"Removes",
"a",
"record",
"from",
"storage",
"."
] | 0cfd3a3b3731b69abca55c956c757476779ec1bd | https://github.com/azendal/argon/blob/0cfd3a3b3731b69abca55c956c757476779ec1bd/argon/model.js#L193-L209 |
54,194 | sebv/mocha-bdd-with-opts | common.js | function(mocha, test) {
test.parent._onlyTests = test.parent._onlyTests.concat(test);
mocha.options.hasOnly = true;
return test;
} | javascript | function(mocha, test) {
test.parent._onlyTests = test.parent._onlyTests.concat(test);
mocha.options.hasOnly = true;
return test;
} | [
"function",
"(",
"mocha",
",",
"test",
")",
"{",
"test",
".",
"parent",
".",
"_onlyTests",
"=",
"test",
".",
"parent",
".",
"_onlyTests",
".",
"concat",
"(",
"test",
")",
";",
"mocha",
".",
"options",
".",
"hasOnly",
"=",
"true",
";",
"return",
"test... | Exclusive test-case.
@param {Object} mocha
@param {Function} test
@returns {*} | [
"Exclusive",
"test",
"-",
"case",
"."
] | bc15bb96aa2ebda5b4427f8729b4e1cc5da69396 | https://github.com/sebv/mocha-bdd-with-opts/blob/bc15bb96aa2ebda5b4427f8729b4e1cc5da69396/common.js#L139-L143 | |
54,195 | cirocosta/yaspm | src/Machines.js | Machines | function Machines (sigTerm) {
if (!(this instanceof Machines))
return new Machines(sigTerm);
this._sigTerm = sigTerm;
this._devices = {};
EventEmitter.call(this);
} | javascript | function Machines (sigTerm) {
if (!(this instanceof Machines))
return new Machines(sigTerm);
this._sigTerm = sigTerm;
this._devices = {};
EventEmitter.call(this);
} | [
"function",
"Machines",
"(",
"sigTerm",
")",
"{",
"if",
"(",
"!",
"(",
"this",
"instanceof",
"Machines",
")",
")",
"return",
"new",
"Machines",
"(",
"sigTerm",
")",
";",
"this",
".",
"_sigTerm",
"=",
"sigTerm",
";",
"this",
".",
"_devices",
"=",
"{",
... | Describes the conjunction of machines to
search for.
emits:
- removeddevice,
- device,
- invaliddevice,
- validdevice.
@param {string} sigTerm signature string to
match. | [
"Describes",
"the",
"conjunction",
"of",
"machines",
"to",
"search",
"for",
"."
] | 676524906425ba99b1e6f95a75ce4a82501a0ee9 | https://github.com/cirocosta/yaspm/blob/676524906425ba99b1e6f95a75ce4a82501a0ee9/src/Machines.js#L24-L32 |
54,196 | deanlandolt/bytespace | index.js | addHook | function addHook(hooks, hook) {
hooks.push(hook)
return function () {
var i = hooks.indexOf(hook)
if (i >= 0) return hooks.splice(i, 1)
}
} | javascript | function addHook(hooks, hook) {
hooks.push(hook)
return function () {
var i = hooks.indexOf(hook)
if (i >= 0) return hooks.splice(i, 1)
}
} | [
"function",
"addHook",
"(",
"hooks",
",",
"hook",
")",
"{",
"hooks",
".",
"push",
"(",
"hook",
")",
"return",
"function",
"(",
")",
"{",
"var",
"i",
"=",
"hooks",
".",
"indexOf",
"(",
"hook",
")",
"if",
"(",
"i",
">=",
"0",
")",
"return",
"hooks"... | helper to register pre and post commit hooks | [
"helper",
"to",
"register",
"pre",
"and",
"post",
"commit",
"hooks"
] | 3d3b92d5a8999eedf766fea62bfa7f5643fd467d | https://github.com/deanlandolt/bytespace/blob/3d3b92d5a8999eedf766fea62bfa7f5643fd467d/index.js#L150-L156 |
54,197 | deanlandolt/bytespace | index.js | decodeStream | function decodeStream(opts) {
opts || (opts = {})
var stream = Transform({ objectMode: true })
stream._transform = function (data, _, cb) {
try {
// decode keys even when keys or values aren't requested specifically
if ((opts.keys && opts.values) || (!opts.keys && !opts.values)) {
... | javascript | function decodeStream(opts) {
opts || (opts = {})
var stream = Transform({ objectMode: true })
stream._transform = function (data, _, cb) {
try {
// decode keys even when keys or values aren't requested specifically
if ((opts.keys && opts.values) || (!opts.keys && !opts.values)) {
... | [
"function",
"decodeStream",
"(",
"opts",
")",
"{",
"opts",
"||",
"(",
"opts",
"=",
"{",
"}",
")",
"var",
"stream",
"=",
"Transform",
"(",
"{",
"objectMode",
":",
"true",
"}",
")",
"stream",
".",
"_transform",
"=",
"function",
"(",
"data",
",",
"_",
... | transform stream to decode data keys | [
"transform",
"stream",
"to",
"decode",
"data",
"keys"
] | 3d3b92d5a8999eedf766fea62bfa7f5643fd467d | https://github.com/deanlandolt/bytespace/blob/3d3b92d5a8999eedf766fea62bfa7f5643fd467d/index.js#L284-L305 |
54,198 | Irrelon/overload | Overload.js | function (def) {
if (def) {
var self = this,
index,
count,
tmpDef,
defNewKey,
sigIndex,
signatures;
if (!(def instanceof Array)) {
tmpDef = {};
// Def is an object, make sure all prop names are devoid of spaces
for (index in def) {
if (def.hasOwnProperty(index)) {
defNewKey = ... | javascript | function (def) {
if (def) {
var self = this,
index,
count,
tmpDef,
defNewKey,
sigIndex,
signatures;
if (!(def instanceof Array)) {
tmpDef = {};
// Def is an object, make sure all prop names are devoid of spaces
for (index in def) {
if (def.hasOwnProperty(index)) {
defNewKey = ... | [
"function",
"(",
"def",
")",
"{",
"if",
"(",
"def",
")",
"{",
"var",
"self",
"=",
"this",
",",
"index",
",",
"count",
",",
"tmpDef",
",",
"defNewKey",
",",
"sigIndex",
",",
"signatures",
";",
"if",
"(",
"!",
"(",
"def",
"instanceof",
"Array",
")",
... | Allows a method to accept overloaded calls with different parameters controlling
which passed overload function is called.
@param {Object} def
@returns {Function}
@constructor | [
"Allows",
"a",
"method",
"to",
"accept",
"overloaded",
"calls",
"with",
"different",
"parameters",
"controlling",
"which",
"passed",
"overload",
"function",
"is",
"called",
"."
] | cfa76f0e2c1112938c27364c031dae8d530183b8 | https://github.com/Irrelon/overload/blob/cfa76f0e2c1112938c27364c031dae8d530183b8/Overload.js#L10-L106 | |
54,199 | hammy2899/circle-assign | src/internals.js | mergeObject | function mergeObject(target, source) {
// create a variable to hold the target object
// so it can be changed if its not an object
let targetObject = target;
let sourceObject = source;
if (!isObj(target)) {
targetObject = {};
}
if (!isObj(source)) {
sourceObject = {};
}
// get the object ke... | javascript | function mergeObject(target, source) {
// create a variable to hold the target object
// so it can be changed if its not an object
let targetObject = target;
let sourceObject = source;
if (!isObj(target)) {
targetObject = {};
}
if (!isObj(source)) {
sourceObject = {};
}
// get the object ke... | [
"function",
"mergeObject",
"(",
"target",
",",
"source",
")",
"{",
"// create a variable to hold the target object",
"// so it can be changed if its not an object",
"let",
"targetObject",
"=",
"target",
";",
"let",
"sourceObject",
"=",
"source",
";",
"if",
"(",
"!",
"is... | Merge the specified source object into the target object
@param {Object} target The base target object
@param {Object} source The object to merge into the target
@returns {Object} The merged object | [
"Merge",
"the",
"specified",
"source",
"object",
"into",
"the",
"target",
"object"
] | 4eb202021279b789ce758b3feae2417eb7f2ded5 | https://github.com/hammy2899/circle-assign/blob/4eb202021279b789ce758b3feae2417eb7f2ded5/src/internals.js#L21-L88 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.