repo stringlengths 5 67 | path stringlengths 4 116 | func_name stringlengths 0 58 | original_string stringlengths 52 373k | language stringclasses 1
value | code stringlengths 52 373k | code_tokens list | docstring stringlengths 4 11.8k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 86 226 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
MakerCollider/upm_mc | doxy/node/xml2js.js | getParent | function getParent(spec_c, className) {
var parent = getChild(spec_c, 'basecompoundref');
if (parent) {
parent = getText(parent);
if (!_.has(xml2js.CLASSES, parent)) {
console.log('WARNING: Class ' + className + ' has unknown parent class ' + parent);
}
}
return parent;
} | javascript | function getParent(spec_c, className) {
var parent = getChild(spec_c, 'basecompoundref');
if (parent) {
parent = getText(parent);
if (!_.has(xml2js.CLASSES, parent)) {
console.log('WARNING: Class ' + className + ' has unknown parent class ' + parent);
}
}
return parent;
} | [
"function",
"getParent",
"(",
"spec_c",
",",
"className",
")",
"{",
"var",
"parent",
"=",
"getChild",
"(",
"spec_c",
",",
"'basecompoundref'",
")",
";",
"if",
"(",
"parent",
")",
"{",
"parent",
"=",
"getText",
"(",
"parent",
")",
";",
"if",
"(",
"!",
... | get parent class, if any | [
"get",
"parent",
"class",
"if",
"any"
] | 525e775a17b85c30716c00435a2acb26bb198c12 | https://github.com/MakerCollider/upm_mc/blob/525e775a17b85c30716c00435a2acb26bb198c12/doxy/node/xml2js.js#L593-L602 | train |
MakerCollider/upm_mc | doxy/node/xml2js.js | getUniqueMethodName | function getUniqueMethodName(methodName, module, parent) {
if (methodName in module) {
do {
methodName += '!';
} while (methodName in module);
}
return methodName;
} | javascript | function getUniqueMethodName(methodName, module, parent) {
if (methodName in module) {
do {
methodName += '!';
} while (methodName in module);
}
return methodName;
} | [
"function",
"getUniqueMethodName",
"(",
"methodName",
",",
"module",
",",
"parent",
")",
"{",
"if",
"(",
"methodName",
"in",
"module",
")",
"{",
"do",
"{",
"methodName",
"+=",
"'!'",
";",
"}",
"while",
"(",
"methodName",
"in",
"module",
")",
";",
"}",
... | get a unique string to represent the name of an overloaded method | [
"get",
"a",
"unique",
"string",
"to",
"represent",
"the",
"name",
"of",
"an",
"overloaded",
"method"
] | 525e775a17b85c30716c00435a2acb26bb198c12 | https://github.com/MakerCollider/upm_mc/blob/525e775a17b85c30716c00435a2acb26bb198c12/doxy/node/xml2js.js#L655-L662 | train |
MakerCollider/upm_mc | doxy/node/xml2js.js | getVariables | function getVariables(spec_c, parent) {
var spec_js = {};
var vars = _.find(getChildren(spec_c, 'sectiondef'), function(section) {
var kind = getAttr(section, 'kind');
return (kind == 'public-attrib');
});
if (vars) {
_.each(_.filter(vars.children, function(variable) {
return (getAttr(variable... | javascript | function getVariables(spec_c, parent) {
var spec_js = {};
var vars = _.find(getChildren(spec_c, 'sectiondef'), function(section) {
var kind = getAttr(section, 'kind');
return (kind == 'public-attrib');
});
if (vars) {
_.each(_.filter(vars.children, function(variable) {
return (getAttr(variable... | [
"function",
"getVariables",
"(",
"spec_c",
",",
"parent",
")",
"{",
"var",
"spec_js",
"=",
"{",
"}",
";",
"var",
"vars",
"=",
"_",
".",
"find",
"(",
"getChildren",
"(",
"spec_c",
",",
"'sectiondef'",
")",
",",
"function",
"(",
"section",
")",
"{",
"v... | get variable specifications for a class | [
"get",
"variable",
"specifications",
"for",
"a",
"class"
] | 525e775a17b85c30716c00435a2acb26bb198c12 | https://github.com/MakerCollider/upm_mc/blob/525e775a17b85c30716c00435a2acb26bb198c12/doxy/node/xml2js.js#L666-L686 | train |
MakerCollider/upm_mc | doxy/node/xml2js.js | getReturn | function getReturn(spec_c, details, method, parent) {
var retType = getType(getText(spec_c, 'type'), parent);
var retDescription = (details ? getText(details, 'description') : '');
return ((retType == 'void') ? {} : {
type: retType,
description: retDescription
});
} | javascript | function getReturn(spec_c, details, method, parent) {
var retType = getType(getText(spec_c, 'type'), parent);
var retDescription = (details ? getText(details, 'description') : '');
return ((retType == 'void') ? {} : {
type: retType,
description: retDescription
});
} | [
"function",
"getReturn",
"(",
"spec_c",
",",
"details",
",",
"method",
",",
"parent",
")",
"{",
"var",
"retType",
"=",
"getType",
"(",
"getText",
"(",
"spec_c",
",",
"'type'",
")",
",",
"parent",
")",
";",
"var",
"retDescription",
"=",
"(",
"details",
... | get return value specs of a method | [
"get",
"return",
"value",
"specs",
"of",
"a",
"method"
] | 525e775a17b85c30716c00435a2acb26bb198c12 | https://github.com/MakerCollider/upm_mc/blob/525e775a17b85c30716c00435a2acb26bb198c12/doxy/node/xml2js.js#L690-L697 | train |
MakerCollider/upm_mc | doxy/node/xml2js.js | getParams | function getParams(spec_c, details, method, parent) {
var spec_js = {};
_.each(spec_c, function(param) {
try {
var paramType = getType(getText(getChild(param, 'type'), 'type'), parent);
var paramName = getText(getChild(param, 'declname'), 'name');
spec_js[paramName] = { type: paramType };
... | javascript | function getParams(spec_c, details, method, parent) {
var spec_js = {};
_.each(spec_c, function(param) {
try {
var paramType = getType(getText(getChild(param, 'type'), 'type'), parent);
var paramName = getText(getChild(param, 'declname'), 'name');
spec_js[paramName] = { type: paramType };
... | [
"function",
"getParams",
"(",
"spec_c",
",",
"details",
",",
"method",
",",
"parent",
")",
"{",
"var",
"spec_js",
"=",
"{",
"}",
";",
"_",
".",
"each",
"(",
"spec_c",
",",
"function",
"(",
"param",
")",
"{",
"try",
"{",
"var",
"paramType",
"=",
"ge... | get paramater specs of a method | [
"get",
"paramater",
"specs",
"of",
"a",
"method"
] | 525e775a17b85c30716c00435a2acb26bb198c12 | https://github.com/MakerCollider/upm_mc/blob/525e775a17b85c30716c00435a2acb26bb198c12/doxy/node/xml2js.js#L701-L730 | train |
MakerCollider/upm_mc | doxy/node/xml2js.js | getType | function getType(type_c, parent) {
var type_js = type_c;
_.find(xml2js.TYPEMAPS, function(to, from) {
var pattern = new RegExp(from, 'i');
if (type_c.search(pattern) == 0) {
type_js = to;
return true;
}
});
if (isPointer(type_js)) {
var dataType = getPointerDataType(type_js);
var... | javascript | function getType(type_c, parent) {
var type_js = type_c;
_.find(xml2js.TYPEMAPS, function(to, from) {
var pattern = new RegExp(from, 'i');
if (type_c.search(pattern) == 0) {
type_js = to;
return true;
}
});
if (isPointer(type_js)) {
var dataType = getPointerDataType(type_js);
var... | [
"function",
"getType",
"(",
"type_c",
",",
"parent",
")",
"{",
"var",
"type_js",
"=",
"type_c",
";",
"_",
".",
"find",
"(",
"xml2js",
".",
"TYPEMAPS",
",",
"function",
"(",
"to",
",",
"from",
")",
"{",
"var",
"pattern",
"=",
"new",
"RegExp",
"(",
"... | get the equivalent javascript type from the given c type | [
"get",
"the",
"equivalent",
"javascript",
"type",
"from",
"the",
"given",
"c",
"type"
] | 525e775a17b85c30716c00435a2acb26bb198c12 | https://github.com/MakerCollider/upm_mc/blob/525e775a17b85c30716c00435a2acb26bb198c12/doxy/node/xml2js.js#L734-L757 | train |
MakerCollider/upm_mc | doxy/node/xml2js.js | hasValidTypes | function hasValidTypes(methodSpec, methodName, parent) {
var valid = true;
var msg = (xml2js.opts.strict ? ' is omitted from JS documentation.' : ' has invalid type(s).');
var printIgnoredMethodOnce = _.once(function() { console.log(methodName + msg); });
_.each(methodSpec.params, function(paramSpec, paramName)... | javascript | function hasValidTypes(methodSpec, methodName, parent) {
var valid = true;
var msg = (xml2js.opts.strict ? ' is omitted from JS documentation.' : ' has invalid type(s).');
var printIgnoredMethodOnce = _.once(function() { console.log(methodName + msg); });
_.each(methodSpec.params, function(paramSpec, paramName)... | [
"function",
"hasValidTypes",
"(",
"methodSpec",
",",
"methodName",
",",
"parent",
")",
"{",
"var",
"valid",
"=",
"true",
";",
"var",
"msg",
"=",
"(",
"xml2js",
".",
"opts",
".",
"strict",
"?",
"' is omitted from JS documentation.'",
":",
"' has invalid type(s).'... | verify that all types associated with the method are valid | [
"verify",
"that",
"all",
"types",
"associated",
"with",
"the",
"method",
"are",
"valid"
] | 525e775a17b85c30716c00435a2acb26bb198c12 | https://github.com/MakerCollider/upm_mc/blob/525e775a17b85c30716c00435a2acb26bb198c12/doxy/node/xml2js.js#L761-L778 | train |
MakerCollider/upm_mc | doxy/node/xml2js.js | ofValidType | function ofValidType(varSpec, varName, parent) {
if (isValidType(varSpec.type, parent)) {
return true;
} else {
var msgAddendum = (xml2js.opts.strict ? ' Omitted from JS documentation.' : '');
console.log('Error: ' + varName + ' is of invalid type ' + typeToString(varSpec.type) + '.' + msgAddendum);
... | javascript | function ofValidType(varSpec, varName, parent) {
if (isValidType(varSpec.type, parent)) {
return true;
} else {
var msgAddendum = (xml2js.opts.strict ? ' Omitted from JS documentation.' : '');
console.log('Error: ' + varName + ' is of invalid type ' + typeToString(varSpec.type) + '.' + msgAddendum);
... | [
"function",
"ofValidType",
"(",
"varSpec",
",",
"varName",
",",
"parent",
")",
"{",
"if",
"(",
"isValidType",
"(",
"varSpec",
".",
"type",
",",
"parent",
")",
")",
"{",
"return",
"true",
";",
"}",
"else",
"{",
"var",
"msgAddendum",
"=",
"(",
"xml2js",
... | verify that type of variable is valid | [
"verify",
"that",
"type",
"of",
"variable",
"is",
"valid"
] | 525e775a17b85c30716c00435a2acb26bb198c12 | https://github.com/MakerCollider/upm_mc/blob/525e775a17b85c30716c00435a2acb26bb198c12/doxy/node/xml2js.js#L782-L790 | train |
MakerCollider/upm_mc | doxy/node/xml2js.js | isValidType | function isValidType(type, parent) {
return (_.contains(_.values(xml2js.TYPEMAPS), type) ||
_.has(xml2js.CLASSES, type) ||
_.has(xml2js.ENUMS_BY_GROUP, type) ||
_.contains(['Buffer', 'Function', 'mraa_result_t'], type) ||
_.has((parent ? xml2js.CLASSES[parent].enums_by_group : ... | javascript | function isValidType(type, parent) {
return (_.contains(_.values(xml2js.TYPEMAPS), type) ||
_.has(xml2js.CLASSES, type) ||
_.has(xml2js.ENUMS_BY_GROUP, type) ||
_.contains(['Buffer', 'Function', 'mraa_result_t'], type) ||
_.has((parent ? xml2js.CLASSES[parent].enums_by_group : ... | [
"function",
"isValidType",
"(",
"type",
",",
"parent",
")",
"{",
"return",
"(",
"_",
".",
"contains",
"(",
"_",
".",
"values",
"(",
"xml2js",
".",
"TYPEMAPS",
")",
",",
"type",
")",
"||",
"_",
".",
"has",
"(",
"xml2js",
".",
"CLASSES",
",",
"type",... | verify whether the given type is valid JS | [
"verify",
"whether",
"the",
"given",
"type",
"is",
"valid",
"JS"
] | 525e775a17b85c30716c00435a2acb26bb198c12 | https://github.com/MakerCollider/upm_mc/blob/525e775a17b85c30716c00435a2acb26bb198c12/doxy/node/xml2js.js#L794-L801 | train |
MakerCollider/upm_mc | doxy/node/xml2js.js | getParamsDetails | function getParamsDetails(spec_c) {
var paras = getChildren(spec_c, 'para');
var details = _.find(_.map(paras, function(para) {
return getChild(para, 'parameterlist');
}), function(obj) { return (obj != undefined); });
return (details ? details.children : undefined);
} | javascript | function getParamsDetails(spec_c) {
var paras = getChildren(spec_c, 'para');
var details = _.find(_.map(paras, function(para) {
return getChild(para, 'parameterlist');
}), function(obj) { return (obj != undefined); });
return (details ? details.children : undefined);
} | [
"function",
"getParamsDetails",
"(",
"spec_c",
")",
"{",
"var",
"paras",
"=",
"getChildren",
"(",
"spec_c",
",",
"'para'",
")",
";",
"var",
"details",
"=",
"_",
".",
"find",
"(",
"_",
".",
"map",
"(",
"paras",
",",
"function",
"(",
"para",
")",
"{",
... | get the detailed description of a method's parameters | [
"get",
"the",
"detailed",
"description",
"of",
"a",
"method",
"s",
"parameters"
] | 525e775a17b85c30716c00435a2acb26bb198c12 | https://github.com/MakerCollider/upm_mc/blob/525e775a17b85c30716c00435a2acb26bb198c12/doxy/node/xml2js.js#L838-L844 | train |
MakerCollider/upm_mc | doxy/node/xml2js.js | getReturnDetails | function getReturnDetails(spec_c) {
var paras = getChildren(spec_c, 'para');
return _.find(_.map(paras, function(para) {
return getChild(para, 'simplesect');
}), function(obj) { return ((obj != undefined) && (getAttr(obj, 'kind') == 'return')); });
} | javascript | function getReturnDetails(spec_c) {
var paras = getChildren(spec_c, 'para');
return _.find(_.map(paras, function(para) {
return getChild(para, 'simplesect');
}), function(obj) { return ((obj != undefined) && (getAttr(obj, 'kind') == 'return')); });
} | [
"function",
"getReturnDetails",
"(",
"spec_c",
")",
"{",
"var",
"paras",
"=",
"getChildren",
"(",
"spec_c",
",",
"'para'",
")",
";",
"return",
"_",
".",
"find",
"(",
"_",
".",
"map",
"(",
"paras",
",",
"function",
"(",
"para",
")",
"{",
"return",
"ge... | get the detailed description of a method's return value | [
"get",
"the",
"detailed",
"description",
"of",
"a",
"method",
"s",
"return",
"value"
] | 525e775a17b85c30716c00435a2acb26bb198c12 | https://github.com/MakerCollider/upm_mc/blob/525e775a17b85c30716c00435a2acb26bb198c12/doxy/node/xml2js.js#L848-L853 | train |
MakerCollider/upm_mc | doxy/node/xml2js.js | getAttr | function getAttr(obj, name) {
return _.find(obj.attr, function(item) {
return item.name == name;
}).value;
} | javascript | function getAttr(obj, name) {
return _.find(obj.attr, function(item) {
return item.name == name;
}).value;
} | [
"function",
"getAttr",
"(",
"obj",
",",
"name",
")",
"{",
"return",
"_",
".",
"find",
"(",
"obj",
".",
"attr",
",",
"function",
"(",
"item",
")",
"{",
"return",
"item",
".",
"name",
"==",
"name",
";",
"}",
")",
".",
"value",
";",
"}"
] | get the value of attribute with the given name of the given object | [
"get",
"the",
"value",
"of",
"attribute",
"with",
"the",
"given",
"name",
"of",
"the",
"given",
"object"
] | 525e775a17b85c30716c00435a2acb26bb198c12 | https://github.com/MakerCollider/upm_mc/blob/525e775a17b85c30716c00435a2acb26bb198c12/doxy/node/xml2js.js#L906-L910 | train |
MakerCollider/upm_mc | doxy/node/xml2js.js | getChild | function getChild(obj, name) {
return _.find(obj.children, function(child) {
return child.name == name;
});
} | javascript | function getChild(obj, name) {
return _.find(obj.children, function(child) {
return child.name == name;
});
} | [
"function",
"getChild",
"(",
"obj",
",",
"name",
")",
"{",
"return",
"_",
".",
"find",
"(",
"obj",
".",
"children",
",",
"function",
"(",
"child",
")",
"{",
"return",
"child",
".",
"name",
"==",
"name",
";",
"}",
")",
";",
"}"
] | get the child object with the given name of the given object | [
"get",
"the",
"child",
"object",
"with",
"the",
"given",
"name",
"of",
"the",
"given",
"object"
] | 525e775a17b85c30716c00435a2acb26bb198c12 | https://github.com/MakerCollider/upm_mc/blob/525e775a17b85c30716c00435a2acb26bb198c12/doxy/node/xml2js.js#L914-L918 | train |
MakerCollider/upm_mc | doxy/node/xml2js.js | getChildren | function getChildren(obj, name) {
return _.filter(obj.children, function(child) {
return child.name == name;
});
} | javascript | function getChildren(obj, name) {
return _.filter(obj.children, function(child) {
return child.name == name;
});
} | [
"function",
"getChildren",
"(",
"obj",
",",
"name",
")",
"{",
"return",
"_",
".",
"filter",
"(",
"obj",
".",
"children",
",",
"function",
"(",
"child",
")",
"{",
"return",
"child",
".",
"name",
"==",
"name",
";",
"}",
")",
";",
"}"
] | get all children objects with the given name of the given object | [
"get",
"all",
"children",
"objects",
"with",
"the",
"given",
"name",
"of",
"the",
"given",
"object"
] | 525e775a17b85c30716c00435a2acb26bb198c12 | https://github.com/MakerCollider/upm_mc/blob/525e775a17b85c30716c00435a2acb26bb198c12/doxy/node/xml2js.js#L922-L926 | train |
lemyskaman/kaman-ui | models/menu.model.js | function(payload) {
console.log('parse',this.defaults)
var toReturn = {};
//todo: will be better to use regular expressions to avoid full witespaces strings
toReturn.caption = payload.caption || ' -x- ';
toReturn.name = payload.name || 'test-action';
toReturn.icon = payload.icon || 'fa-icon';
... | javascript | function(payload) {
console.log('parse',this.defaults)
var toReturn = {};
//todo: will be better to use regular expressions to avoid full witespaces strings
toReturn.caption = payload.caption || ' -x- ';
toReturn.name = payload.name || 'test-action';
toReturn.icon = payload.icon || 'fa-icon';
... | [
"function",
"(",
"payload",
")",
"{",
"console",
".",
"log",
"(",
"'parse'",
",",
"this",
".",
"defaults",
")",
"var",
"toReturn",
"=",
"{",
"}",
";",
"//todo: will be better to use regular expressions to avoid full witespaces strings",
"toReturn",
".",
"caption",
"... | in case of some null properties we set for some defaults | [
"in",
"case",
"of",
"some",
"null",
"properties",
"we",
"set",
"for",
"some",
"defaults"
] | e25aa5c92cca79dd024ebcb1bebfa05071aca9e8 | https://github.com/lemyskaman/kaman-ui/blob/e25aa5c92cca79dd024ebcb1bebfa05071aca9e8/models/menu.model.js#L11-L20 | train | |
alexpods/ClazzJS | src/components/meta/Properties.js | function(clazz, metaData) {
this.applyProperties(clazz, metaData.clazz_properties || {});
this.applyProperties(clazz.prototype, metaData.properties || {});
} | javascript | function(clazz, metaData) {
this.applyProperties(clazz, metaData.clazz_properties || {});
this.applyProperties(clazz.prototype, metaData.properties || {});
} | [
"function",
"(",
"clazz",
",",
"metaData",
")",
"{",
"this",
".",
"applyProperties",
"(",
"clazz",
",",
"metaData",
".",
"clazz_properties",
"||",
"{",
"}",
")",
";",
"this",
".",
"applyProperties",
"(",
"clazz",
".",
"prototype",
",",
"metaData",
".",
"... | Applies properties to clazz and its prototype
@param {clazz} clazz Clazz
@param {object} metaData Meta data with properties 'methods' and 'clazz_methods'
@this {metaProcessor} | [
"Applies",
"properties",
"to",
"clazz",
"and",
"its",
"prototype"
] | 2f94496019669813c8246d48fcceb12a3e68a870 | https://github.com/alexpods/ClazzJS/blob/2f94496019669813c8246d48fcceb12a3e68a870/src/components/meta/Properties.js#L20-L23 | train | |
alexpods/ClazzJS | src/components/meta/Properties.js | function(object, properties) {
if (!object.__isInterfaceImplemented('properties')) {
object.__implementInterface('properties', this.interface);
}
object.__initProperties();
var processor = this.get();
_.each(properties, function(data, property) {
proce... | javascript | function(object, properties) {
if (!object.__isInterfaceImplemented('properties')) {
object.__implementInterface('properties', this.interface);
}
object.__initProperties();
var processor = this.get();
_.each(properties, function(data, property) {
proce... | [
"function",
"(",
"object",
",",
"properties",
")",
"{",
"if",
"(",
"!",
"object",
".",
"__isInterfaceImplemented",
"(",
"'properties'",
")",
")",
"{",
"object",
".",
"__implementInterface",
"(",
"'properties'",
",",
"this",
".",
"interface",
")",
";",
"}",
... | Apply properties to object
Implements properties interface, call property meta processor for each property
@param {clazz|object} object Clazz of its prototype
@param {object} properties Properties
@this {metaProcessor} | [
"Apply",
"properties",
"to",
"object",
"Implements",
"properties",
"interface",
"call",
"property",
"meta",
"processor",
"for",
"each",
"property"
] | 2f94496019669813c8246d48fcceb12a3e68a870 | https://github.com/alexpods/ClazzJS/blob/2f94496019669813c8246d48fcceb12a3e68a870/src/components/meta/Properties.js#L34-L46 | train | |
alexpods/ClazzJS | src/components/meta/Properties.js | function() {
var that = this;
var propertiesParams = that.__getPropertiesParam();
_.each(propertiesParams, function(params, property) {
var value = that.__getPropertyValue(property);
if (_.isUndefined(value) && 'default' in params) {
... | javascript | function() {
var that = this;
var propertiesParams = that.__getPropertiesParam();
_.each(propertiesParams, function(params, property) {
var value = that.__getPropertyValue(property);
if (_.isUndefined(value) && 'default' in params) {
... | [
"function",
"(",
")",
"{",
"var",
"that",
"=",
"this",
";",
"var",
"propertiesParams",
"=",
"that",
".",
"__getPropertiesParam",
"(",
")",
";",
"_",
".",
"each",
"(",
"propertiesParams",
",",
"function",
"(",
"params",
",",
"property",
")",
"{",
"var",
... | Sets properties defaults values
@this {clazz|object} | [
"Sets",
"properties",
"defaults",
"values"
] | 2f94496019669813c8246d48fcceb12a3e68a870 | https://github.com/alexpods/ClazzJS/blob/2f94496019669813c8246d48fcceb12a3e68a870/src/components/meta/Properties.js#L99-L125 | train | |
alexpods/ClazzJS | src/components/meta/Properties.js | function(parameters) {
var that = this;
_.each(parameters, function(params, property) {
that.__setPropertyParam(property, params);
});
return that;
} | javascript | function(parameters) {
var that = this;
_.each(parameters, function(params, property) {
that.__setPropertyParam(property, params);
});
return that;
} | [
"function",
"(",
"parameters",
")",
"{",
"var",
"that",
"=",
"this",
";",
"_",
".",
"each",
"(",
"parameters",
",",
"function",
"(",
"params",
",",
"property",
")",
"{",
"that",
".",
"__setPropertyParam",
"(",
"property",
",",
"params",
")",
";",
"}",
... | Sets properties parameters
@param {object} parameters Properties parameters
@returns {clazz|object} this
@this {clazz|object} | [
"Sets",
"properties",
"parameters"
] | 2f94496019669813c8246d48fcceb12a3e68a870 | https://github.com/alexpods/ClazzJS/blob/2f94496019669813c8246d48fcceb12a3e68a870/src/components/meta/Properties.js#L135-L141 | train | |
alexpods/ClazzJS | src/components/meta/Properties.js | function(property, param, value) {
var params = {};
if (!_.isUndefined(value)) {
params[param] = value;
}
else if (_.isObject(param)) {
_.extend(params, param);
}
if (!(property in this.__properties)) {
... | javascript | function(property, param, value) {
var params = {};
if (!_.isUndefined(value)) {
params[param] = value;
}
else if (_.isObject(param)) {
_.extend(params, param);
}
if (!(property in this.__properties)) {
... | [
"function",
"(",
"property",
",",
"param",
",",
"value",
")",
"{",
"var",
"params",
"=",
"{",
"}",
";",
"if",
"(",
"!",
"_",
".",
"isUndefined",
"(",
"value",
")",
")",
"{",
"params",
"[",
"param",
"]",
"=",
"value",
";",
"}",
"else",
"if",
"("... | Sets property parameter
@param {string} property Property name
@param {string} param Parameter name
@param {*} value Parameter value
@returns {clazz|object} this
@this {clazz|object} | [
"Sets",
"property",
"parameter"
] | 2f94496019669813c8246d48fcceb12a3e68a870 | https://github.com/alexpods/ClazzJS/blob/2f94496019669813c8246d48fcceb12a3e68a870/src/components/meta/Properties.js#L165-L182 | train | |
alexpods/ClazzJS | src/components/meta/Properties.js | function(property, param) {
var params = this.__collectAllPropertyValues.apply(this, ['__properties', 2, property].concat(param || []))[property];
return param ? params[param] : params;
} | javascript | function(property, param) {
var params = this.__collectAllPropertyValues.apply(this, ['__properties', 2, property].concat(param || []))[property];
return param ? params[param] : params;
} | [
"function",
"(",
"property",
",",
"param",
")",
"{",
"var",
"params",
"=",
"this",
".",
"__collectAllPropertyValues",
".",
"apply",
"(",
"this",
",",
"[",
"'__properties'",
",",
"2",
",",
"property",
"]",
".",
"concat",
"(",
"param",
"||",
"[",
"]",
")... | Gets single property parameter or all property parameters
@param {string} property Property name
@param {string|undefined} param Parameter name.
If it does not specified - all property parameters are returned.
@returns {*} Single property parameter or all property parameters
@this {clazz|object} | [
"Gets",
"single",
"property",
"parameter",
"or",
"all",
"property",
"parameters"
] | 2f94496019669813c8246d48fcceb12a3e68a870 | https://github.com/alexpods/ClazzJS/blob/2f94496019669813c8246d48fcceb12a3e68a870/src/components/meta/Properties.js#L195-L198 | train | |
alexpods/ClazzJS | src/components/meta/Properties.js | function(fields, options) {
fields = this.__resolveFields(fields);
options = this.__resolveOptions(options);
var property = fields.shift();
if (options.check) {
this.__checkProperty(property, {
readable: true,
met... | javascript | function(fields, options) {
fields = this.__resolveFields(fields);
options = this.__resolveOptions(options);
var property = fields.shift();
if (options.check) {
this.__checkProperty(property, {
readable: true,
met... | [
"function",
"(",
"fields",
",",
"options",
")",
"{",
"fields",
"=",
"this",
".",
"__resolveFields",
"(",
"fields",
")",
";",
"options",
"=",
"this",
".",
"__resolveOptions",
"(",
"options",
")",
";",
"var",
"property",
"=",
"fields",
".",
"shift",
"(",
... | Gets property value
@param {string|array} fields Property fields
@param {object} options Options (emit, check)
@returns {*} Property value
@this {clazz|object} | [
"Gets",
"property",
"value"
] | 2f94496019669813c8246d48fcceb12a3e68a870 | https://github.com/alexpods/ClazzJS/blob/2f94496019669813c8246d48fcceb12a3e68a870/src/components/meta/Properties.js#L221-L256 | train | |
alexpods/ClazzJS | src/components/meta/Properties.js | function(fields, compareValue, options) {
fields = this.__resolveFields(fields);
options = this.__resolveOptions(options);
var property = fields.shift();
if (options.check) {
this.__checkProperty(property, {
readable: true,
... | javascript | function(fields, compareValue, options) {
fields = this.__resolveFields(fields);
options = this.__resolveOptions(options);
var property = fields.shift();
if (options.check) {
this.__checkProperty(property, {
readable: true,
... | [
"function",
"(",
"fields",
",",
"compareValue",
",",
"options",
")",
"{",
"fields",
"=",
"this",
".",
"__resolveFields",
"(",
"fields",
")",
";",
"options",
"=",
"this",
".",
"__resolveOptions",
"(",
"options",
")",
";",
"var",
"property",
"=",
"fields",
... | Checker whether property value is equals specified one.
If value does not specified - checks whether property value is not false
@param {string|array} fields Property fields
@param {*} compareValue Value for comparison
@param {object} options Options (emit, check)
@returns {booelan} ... | [
"Checker",
"whether",
"property",
"value",
"is",
"equals",
"specified",
"one",
".",
"If",
"value",
"does",
"not",
"specified",
"-",
"checks",
"whether",
"property",
"value",
"is",
"not",
"false"
] | 2f94496019669813c8246d48fcceb12a3e68a870 | https://github.com/alexpods/ClazzJS/blob/2f94496019669813c8246d48fcceb12a3e68a870/src/components/meta/Properties.js#L323-L348 | train | |
alexpods/ClazzJS | src/components/meta/Properties.js | function(fields, options) {
fields = this.__resolveFields(fields);
options = this.__resolveOptions(options);
var property = fields.shift();
if (options.check) {
this.__checkProperty(property, {
writable: true,
met... | javascript | function(fields, options) {
fields = this.__resolveFields(fields);
options = this.__resolveOptions(options);
var property = fields.shift();
if (options.check) {
this.__checkProperty(property, {
writable: true,
met... | [
"function",
"(",
"fields",
",",
"options",
")",
"{",
"fields",
"=",
"this",
".",
"__resolveFields",
"(",
"fields",
")",
";",
"options",
"=",
"this",
".",
"__resolveOptions",
"(",
"options",
")",
";",
"var",
"property",
"=",
"fields",
".",
"shift",
"(",
... | Removes property value.
Really remove property in contrast to `clear` method
@param {string|array} fields Property fields
@param {object} options Options (emit, check)
@returns {clazz|object} this
@this {clazz|object} | [
"Removes",
"property",
"value",
".",
"Really",
"remove",
"property",
"in",
"contrast",
"to",
"clear",
"method"
] | 2f94496019669813c8246d48fcceb12a3e68a870 | https://github.com/alexpods/ClazzJS/blob/2f94496019669813c8246d48fcceb12a3e68a870/src/components/meta/Properties.js#L411-L453 | train | |
alexpods/ClazzJS | src/components/meta/Properties.js | function(fields, value, options) {
fields = this.__resolveFields(fields);
options = this.__resolveOptions(options);
var property = fields.shift();
if (options.check) {
this.__checkProperty(property, {
writable: true,
... | javascript | function(fields, value, options) {
fields = this.__resolveFields(fields);
options = this.__resolveOptions(options);
var property = fields.shift();
if (options.check) {
this.__checkProperty(property, {
writable: true,
... | [
"function",
"(",
"fields",
",",
"value",
",",
"options",
")",
"{",
"fields",
"=",
"this",
".",
"__resolveFields",
"(",
"fields",
")",
";",
"options",
"=",
"this",
".",
"__resolveOptions",
"(",
"options",
")",
";",
"var",
"property",
"=",
"fields",
".",
... | Sets property value
@param {string|array} fields Property fields
@param {*} value Property value
@param {object} options Options (emit, check)
@returns {clazz|object} this
@this {clazz|object} | [
"Sets",
"property",
"value"
] | 2f94496019669813c8246d48fcceb12a3e68a870 | https://github.com/alexpods/ClazzJS/blob/2f94496019669813c8246d48fcceb12a3e68a870/src/components/meta/Properties.js#L465-L501 | train | |
alexpods/ClazzJS | src/components/meta/Properties.js | function(options) {
if (_.isUndefined(options)) {
options = {};
}
if (!_.isObject(options)) {
options = { emit: options, check: options };
}
return _.extend({ emit: true, check: true }, options);
} | javascript | function(options) {
if (_.isUndefined(options)) {
options = {};
}
if (!_.isObject(options)) {
options = { emit: options, check: options };
}
return _.extend({ emit: true, check: true }, options);
} | [
"function",
"(",
"options",
")",
"{",
"if",
"(",
"_",
".",
"isUndefined",
"(",
"options",
")",
")",
"{",
"options",
"=",
"{",
"}",
";",
"}",
"if",
"(",
"!",
"_",
".",
"isObject",
"(",
"options",
")",
")",
"{",
"options",
"=",
"{",
"emit",
":",
... | Resolves property method options
Add absent 'emit' and 'check' options
@param {object} options Property method options
@returns {object} Resolved property options
@this {clazz|object} | [
"Resolves",
"property",
"method",
"options",
"Add",
"absent",
"emit",
"and",
"check",
"options"
] | 2f94496019669813c8246d48fcceb12a3e68a870 | https://github.com/alexpods/ClazzJS/blob/2f94496019669813c8246d48fcceb12a3e68a870/src/components/meta/Properties.js#L530-L538 | train | |
alexpods/ClazzJS | src/components/meta/Properties.js | function(property, options, throwError) {
throwError = !_.isUndefined(throwError) ? throwError : true;
var that = this;
try {
if (!this.__hasProperty(property)) {
throw 'Property "' + property + '" does not exists!';
}
... | javascript | function(property, options, throwError) {
throwError = !_.isUndefined(throwError) ? throwError : true;
var that = this;
try {
if (!this.__hasProperty(property)) {
throw 'Property "' + property + '" does not exists!';
}
... | [
"function",
"(",
"property",
",",
"options",
",",
"throwError",
")",
"{",
"throwError",
"=",
"!",
"_",
".",
"isUndefined",
"(",
"throwError",
")",
"?",
"throwError",
":",
"true",
";",
"var",
"that",
"=",
"this",
";",
"try",
"{",
"if",
"(",
"!",
"this... | Checks property on existence and several options
@param {string} property Property name
@param {object} options Checking options (writable, readable, method, params)
@param {boolean} throwError if true throws errors, if false return result of check
@returns {boolean} Check result
@this {clazz|object} | [
"Checks",
"property",
"on",
"existence",
"and",
"several",
"options"
] | 2f94496019669813c8246d48fcceb12a3e68a870 | https://github.com/alexpods/ClazzJS/blob/2f94496019669813c8246d48fcceb12a3e68a870/src/components/meta/Properties.js#L563-L608 | train | |
alexpods/ClazzJS | src/components/meta/Properties.js | function(fields, oldValue) {
fields = this.__resolveFields(fields);
var prop, key;
this.__checkEmitEvent(true);
if (fields.length) {
prop = fields.slice(0, -1).join('.');
key = _.last(fields);
this.__emitEvent('property... | javascript | function(fields, oldValue) {
fields = this.__resolveFields(fields);
var prop, key;
this.__checkEmitEvent(true);
if (fields.length) {
prop = fields.slice(0, -1).join('.');
key = _.last(fields);
this.__emitEvent('property... | [
"function",
"(",
"fields",
",",
"oldValue",
")",
"{",
"fields",
"=",
"this",
".",
"__resolveFields",
"(",
"fields",
")",
";",
"var",
"prop",
",",
"key",
";",
"this",
".",
"__checkEmitEvent",
"(",
"true",
")",
";",
"if",
"(",
"fields",
".",
"length",
... | Emits property remove events
@param {string|array} fields Property fields
@param {*} oldValue Property value before removing
@returns {clazz|object} this
@this {clazz|object} | [
"Emits",
"property",
"remove",
"events"
] | 2f94496019669813c8246d48fcceb12a3e68a870 | https://github.com/alexpods/ClazzJS/blob/2f94496019669813c8246d48fcceb12a3e68a870/src/components/meta/Properties.js#L619-L640 | train | |
alexpods/ClazzJS | src/components/meta/Properties.js | function(fields, oldValue) {
fields = this.__resolveFields(fields);
var prop, key, i, ii;
this.__checkEmitEvent(true);
if (_.isSimpleObject(oldValue)) {
for (key in oldValue) {
this.__emitPropertyRemove(fields.concat(key), oldValue[k... | javascript | function(fields, oldValue) {
fields = this.__resolveFields(fields);
var prop, key, i, ii;
this.__checkEmitEvent(true);
if (_.isSimpleObject(oldValue)) {
for (key in oldValue) {
this.__emitPropertyRemove(fields.concat(key), oldValue[k... | [
"function",
"(",
"fields",
",",
"oldValue",
")",
"{",
"fields",
"=",
"this",
".",
"__resolveFields",
"(",
"fields",
")",
";",
"var",
"prop",
",",
"key",
",",
"i",
",",
"ii",
";",
"this",
".",
"__checkEmitEvent",
"(",
"true",
")",
";",
"if",
"(",
"_... | Emits property clear events
@param {string|array} fields Property fields
@param {*} oldValue Property value before clearing
@returns {clazz|object} this
@this {clazz|object} | [
"Emits",
"property",
"clear",
"events"
] | 2f94496019669813c8246d48fcceb12a3e68a870 | https://github.com/alexpods/ClazzJS/blob/2f94496019669813c8246d48fcceb12a3e68a870/src/components/meta/Properties.js#L651-L675 | train | |
alexpods/ClazzJS | src/components/meta/Properties.js | function(fields, newValue, oldValue, wasExists) {
fields = this.__resolveFields(fields);
var prop, event, key, i, ii;
this.__checkEmitEvent(true);
var isEqual = true;
if (_.isSimpleObject(newValue) && _.isSimpleObject(oldValue)) {
for (key ... | javascript | function(fields, newValue, oldValue, wasExists) {
fields = this.__resolveFields(fields);
var prop, event, key, i, ii;
this.__checkEmitEvent(true);
var isEqual = true;
if (_.isSimpleObject(newValue) && _.isSimpleObject(oldValue)) {
for (key ... | [
"function",
"(",
"fields",
",",
"newValue",
",",
"oldValue",
",",
"wasExists",
")",
"{",
"fields",
"=",
"this",
".",
"__resolveFields",
"(",
"fields",
")",
";",
"var",
"prop",
",",
"event",
",",
"key",
",",
"i",
",",
"ii",
";",
"this",
".",
"__checkE... | Emits property set events
@param {string|array} fields Property fields
@param {*} newValue New property value
@param {*} oldValue Old property value
@param {boolean} wasExists true if property was exist before setting
@returns {clazz|object} this
@this {clazz|object} | [
"Emits",
"property",
"set",
"events"
] | 2f94496019669813c8246d48fcceb12a3e68a870 | https://github.com/alexpods/ClazzJS/blob/2f94496019669813c8246d48fcceb12a3e68a870/src/components/meta/Properties.js#L688-L733 | train | |
alexpods/ClazzJS | src/components/meta/Properties.js | function(property, name, weight, callback) {
if (_.isUndefined(callback)) {
callback = weight;
weight = 0;
}
if (_.isArray(callback)) {
weight = callback[0];
callback = callback[1];
}
else if ... | javascript | function(property, name, weight, callback) {
if (_.isUndefined(callback)) {
callback = weight;
weight = 0;
}
if (_.isArray(callback)) {
weight = callback[0];
callback = callback[1];
}
else if ... | [
"function",
"(",
"property",
",",
"name",
",",
"weight",
",",
"callback",
")",
"{",
"if",
"(",
"_",
".",
"isUndefined",
"(",
"callback",
")",
")",
"{",
"callback",
"=",
"weight",
";",
"weight",
"=",
"0",
";",
"}",
"if",
"(",
"_",
".",
"isArray",
... | Adds property setter
@param {string} property Property name
@param {string} name Setter name
@param {number} weight Setter weight
@param {function} callback Setter handler
@returns {clazz|object} this
@this {clazz|object} | [
"Adds",
"property",
"setter"
] | 2f94496019669813c8246d48fcceb12a3e68a870 | https://github.com/alexpods/ClazzJS/blob/2f94496019669813c8246d48fcceb12a3e68a870/src/components/meta/Properties.js#L766-L784 | train | |
alexpods/ClazzJS | src/components/meta/Properties.js | function(property, sorted) {
var setters = this.__collectAllPropertyValues.apply(this, ['__setters', 1].concat(property || []));
if (!property) {
return setters;
}
setters = setters[property];
if (!sorted) {
return setters[pr... | javascript | function(property, sorted) {
var setters = this.__collectAllPropertyValues.apply(this, ['__setters', 1].concat(property || []));
if (!property) {
return setters;
}
setters = setters[property];
if (!sorted) {
return setters[pr... | [
"function",
"(",
"property",
",",
"sorted",
")",
"{",
"var",
"setters",
"=",
"this",
".",
"__collectAllPropertyValues",
".",
"apply",
"(",
"this",
",",
"[",
"'__setters'",
",",
"1",
"]",
".",
"concat",
"(",
"property",
"||",
"[",
"]",
")",
")",
";",
... | Gets property setters
@param {string} property Property name
@param {boolean} sorted If true returns setters in sorted order
@returns {array} Property setters;
@this {clazz|object} | [
"Gets",
"property",
"setters"
] | 2f94496019669813c8246d48fcceb12a3e68a870 | https://github.com/alexpods/ClazzJS/blob/2f94496019669813c8246d48fcceb12a3e68a870/src/components/meta/Properties.js#L795-L821 | train | |
alexpods/ClazzJS | src/components/meta/Properties.js | function(property, value, fields) {
fields = fields || [];
var setters = this.__getSetters(property, true);
for (var i = 0, ii = setters.length; i < ii; ++i) {
var result = setters[i].call(this, value, fields);
if (!_.isUndefined(result)) {
... | javascript | function(property, value, fields) {
fields = fields || [];
var setters = this.__getSetters(property, true);
for (var i = 0, ii = setters.length; i < ii; ++i) {
var result = setters[i].call(this, value, fields);
if (!_.isUndefined(result)) {
... | [
"function",
"(",
"property",
",",
"value",
",",
"fields",
")",
"{",
"fields",
"=",
"fields",
"||",
"[",
"]",
";",
"var",
"setters",
"=",
"this",
".",
"__getSetters",
"(",
"property",
",",
"true",
")",
";",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"... | Applies setters to value
@param {string} property Property name
@param {*} value Property value
@param {string|array} fields Property fields
@returns {*} Processed value
@this {clazz|object} | [
"Applies",
"setters",
"to",
"value"
] | 2f94496019669813c8246d48fcceb12a3e68a870 | https://github.com/alexpods/ClazzJS/blob/2f94496019669813c8246d48fcceb12a3e68a870/src/components/meta/Properties.js#L834-L849 | train | |
alexpods/ClazzJS | src/components/meta/Properties.js | function(property, sorted) {
var getters = this.__collectAllPropertyValues.apply(this, ['__getters', 1].concat(property || []));
if (!property) {
return getters;
}
getters = getters[property];
if (!sorted) {
return getters[pr... | javascript | function(property, sorted) {
var getters = this.__collectAllPropertyValues.apply(this, ['__getters', 1].concat(property || []));
if (!property) {
return getters;
}
getters = getters[property];
if (!sorted) {
return getters[pr... | [
"function",
"(",
"property",
",",
"sorted",
")",
"{",
"var",
"getters",
"=",
"this",
".",
"__collectAllPropertyValues",
".",
"apply",
"(",
"this",
",",
"[",
"'__getters'",
",",
"1",
"]",
".",
"concat",
"(",
"property",
"||",
"[",
"]",
")",
")",
";",
... | Gets property getters
@param {string} property Property name
@param {boolean} sorted If true returns getters in sorted order
@returns {array} Property getters;
@this {clazz|object} | [
"Gets",
"property",
"getters"
] | 2f94496019669813c8246d48fcceb12a3e68a870 | https://github.com/alexpods/ClazzJS/blob/2f94496019669813c8246d48fcceb12a3e68a870/src/components/meta/Properties.js#L891-L917 | train | |
alexpods/ClazzJS | src/components/meta/Properties.js | function(property, value, fields) {
fields = fields || [];
var getters = this.__getGetters(property, true);
for (var i = 0, ii = getters.length; i < ii; ++i) {
var result = getters[i].call(this, value, fields);
if (!_.isUndefined(result)) {
... | javascript | function(property, value, fields) {
fields = fields || [];
var getters = this.__getGetters(property, true);
for (var i = 0, ii = getters.length; i < ii; ++i) {
var result = getters[i].call(this, value, fields);
if (!_.isUndefined(result)) {
... | [
"function",
"(",
"property",
",",
"value",
",",
"fields",
")",
"{",
"fields",
"=",
"fields",
"||",
"[",
"]",
";",
"var",
"getters",
"=",
"this",
".",
"__getGetters",
"(",
"property",
",",
"true",
")",
";",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"... | Applies getters to value
@param {string} property Property name
@param {*} value Property value
@param {string|array} fields Property fields
@returns {*} Processed value
@this {clazz|object} | [
"Applies",
"getters",
"to",
"value"
] | 2f94496019669813c8246d48fcceb12a3e68a870 | https://github.com/alexpods/ClazzJS/blob/2f94496019669813c8246d48fcceb12a3e68a870/src/components/meta/Properties.js#L930-L943 | train | |
alexpods/ClazzJS | src/components/meta/Properties.js | function(data, options) {
for (var property in data) {
if (!this.__hasProperty(property.split('.')[0])) {
continue;
}
var value = data[property];
if (_.isUndefined(value) || _.isNull(value)) {
this.__re... | javascript | function(data, options) {
for (var property in data) {
if (!this.__hasProperty(property.split('.')[0])) {
continue;
}
var value = data[property];
if (_.isUndefined(value) || _.isNull(value)) {
this.__re... | [
"function",
"(",
"data",
",",
"options",
")",
"{",
"for",
"(",
"var",
"property",
"in",
"data",
")",
"{",
"if",
"(",
"!",
"this",
".",
"__hasProperty",
"(",
"property",
".",
"split",
"(",
"'.'",
")",
"[",
"0",
"]",
")",
")",
"{",
"continue",
";",... | Sets object data
@param {object} data Property data ({ property1: value1, property2: value2, .. })
@param {object} options Property options ({ emit: emitValue, check: checkValue })
@returns {clazz|object} this
@this {clazz|object} | [
"Sets",
"object",
"data"
] | 2f94496019669813c8246d48fcceb12a3e68a870 | https://github.com/alexpods/ClazzJS/blob/2f94496019669813c8246d48fcceb12a3e68a870/src/components/meta/Properties.js#L954-L973 | train | |
alexpods/ClazzJS | src/components/meta/Properties.js | function() {
var data = {};
var properties = this.__getPropertiesParam();
for (var property in properties) {
data[property] = this.__processData(this.__getPropertyValue(property));
}
return data;
} | javascript | function() {
var data = {};
var properties = this.__getPropertiesParam();
for (var property in properties) {
data[property] = this.__processData(this.__getPropertyValue(property));
}
return data;
} | [
"function",
"(",
")",
"{",
"var",
"data",
"=",
"{",
"}",
";",
"var",
"properties",
"=",
"this",
".",
"__getPropertiesParam",
"(",
")",
";",
"for",
"(",
"var",
"property",
"in",
"properties",
")",
"{",
"data",
"[",
"property",
"]",
"=",
"this",
".",
... | Gets object data
@returns {object} Object dat
@this {clazz|object} | [
"Gets",
"object",
"data"
] | 2f94496019669813c8246d48fcceb12a3e68a870 | https://github.com/alexpods/ClazzJS/blob/2f94496019669813c8246d48fcceb12a3e68a870/src/components/meta/Properties.js#L982-L992 | train | |
alexpods/ClazzJS | src/components/meta/Properties.js | self_method | function self_method(data, methods) {
if (!data) {
return data;
}
var i, ii, prop;
if (data.constructor === ({}).constructor) {
for (prop in data) {
if (_.isUndefined(data[prop])) {
delete data[... | javascript | function self_method(data, methods) {
if (!data) {
return data;
}
var i, ii, prop;
if (data.constructor === ({}).constructor) {
for (prop in data) {
if (_.isUndefined(data[prop])) {
delete data[... | [
"function",
"self_method",
"(",
"data",
",",
"methods",
")",
"{",
"if",
"(",
"!",
"data",
")",
"{",
"return",
"data",
";",
"}",
"var",
"i",
",",
"ii",
",",
"prop",
";",
"if",
"(",
"data",
".",
"constructor",
"===",
"(",
"{",
"}",
")",
".",
"con... | Process object data
@param {object} data Object data
@param {object} methods Getter methods
@returns {object} Processed data
@this {clazz|object} | [
"Process",
"object",
"data"
] | 2f94496019669813c8246d48fcceb12a3e68a870 | https://github.com/alexpods/ClazzJS/blob/2f94496019669813c8246d48fcceb12a3e68a870/src/components/meta/Properties.js#L1003-L1052 | train |
xsolon/spexplorerjs | webapi/src/components/mirrors/xmlmirror.js | function (ui, opts) {
log("xxmlmirror.init");
var $el = $(ui);
var state = ($("div.xmlmirrorstate:first", $el).html() || "").trim();
opts = $.extend({ defaultScript: state }, opts);
$el.html(template.trim());
var editor = null;
(function iframeImplementation() {
var iframe = $("iframe", ui);
... | javascript | function (ui, opts) {
log("xxmlmirror.init");
var $el = $(ui);
var state = ($("div.xmlmirrorstate:first", $el).html() || "").trim();
opts = $.extend({ defaultScript: state }, opts);
$el.html(template.trim());
var editor = null;
(function iframeImplementation() {
var iframe = $("iframe", ui);
... | [
"function",
"(",
"ui",
",",
"opts",
")",
"{",
"log",
"(",
"\"xxmlmirror.init\"",
")",
";",
"var",
"$el",
"=",
"$",
"(",
"ui",
")",
";",
"var",
"state",
"=",
"(",
"$",
"(",
"\"div.xmlmirrorstate:first\"",
",",
"$el",
")",
".",
"html",
"(",
")",
"||"... | var error = tracing.error; | [
"var",
"error",
"=",
"tracing",
".",
"error",
";"
] | 4e9b410864afb731f88e84414984fa18ac5705f1 | https://github.com/xsolon/spexplorerjs/blob/4e9b410864afb731f88e84414984fa18ac5705f1/webapi/src/components/mirrors/xmlmirror.js#L17-L50 | train | |
Jinjiang/dabao | src/runtime-config.js | readTargetRc | function readTargetRc () {
if (!fs.existsSync('./.dabao.target.json')) {
return {}
}
try {
const content = fs.readFileSync('./.dabao.target.json', { encoding: 'utf-8' })
return JSON.parse(content)
} catch (e) {
console.warn('[Warning] File parsing error: .dabao.target.json')
console.warn(e)
... | javascript | function readTargetRc () {
if (!fs.existsSync('./.dabao.target.json')) {
return {}
}
try {
const content = fs.readFileSync('./.dabao.target.json', { encoding: 'utf-8' })
return JSON.parse(content)
} catch (e) {
console.warn('[Warning] File parsing error: .dabao.target.json')
console.warn(e)
... | [
"function",
"readTargetRc",
"(",
")",
"{",
"if",
"(",
"!",
"fs",
".",
"existsSync",
"(",
"'./.dabao.target.json'",
")",
")",
"{",
"return",
"{",
"}",
"}",
"try",
"{",
"const",
"content",
"=",
"fs",
".",
"readFileSync",
"(",
"'./.dabao.target.json'",
",",
... | '.dabao.target.json'
Key-value pairs about multi-entries. | [
".",
"dabao",
".",
"target",
".",
"json",
"Key",
"-",
"value",
"pairs",
"about",
"multi",
"-",
"entries",
"."
] | 8de08ea1277067cc676c488663b6d7861f1bd223 | https://github.com/Jinjiang/dabao/blob/8de08ea1277067cc676c488663b6d7861f1bd223/src/runtime-config.js#L88-L100 | train |
origin1tech/stiks | dist/utils.js | copy | function copy(src, dest) {
if (!src || !dest)
return false;
try {
fs_extra_1.copySync(src, dest);
logger_1.log.notify("copied " + src + " to " + dest + ".");
return true;
}
catch (ex) {
logger_1.log.warn("failed to copy " + src + " to " + dest + ".");
retu... | javascript | function copy(src, dest) {
if (!src || !dest)
return false;
try {
fs_extra_1.copySync(src, dest);
logger_1.log.notify("copied " + src + " to " + dest + ".");
return true;
}
catch (ex) {
logger_1.log.warn("failed to copy " + src + " to " + dest + ".");
retu... | [
"function",
"copy",
"(",
"src",
",",
"dest",
")",
"{",
"if",
"(",
"!",
"src",
"||",
"!",
"dest",
")",
"return",
"false",
";",
"try",
"{",
"fs_extra_1",
".",
"copySync",
"(",
"src",
",",
"dest",
")",
";",
"logger_1",
".",
"log",
".",
"notify",
"("... | Copy
Copies source to target. Does NOT support globs.
@param src the source path to be copied.
@param dest the destination path to copy to. | [
"Copy",
"Copies",
"source",
"to",
"target",
".",
"Does",
"NOT",
"support",
"globs",
"."
] | dca9cd352bb914e53e64e791fc85985aef3d9fb7 | https://github.com/origin1tech/stiks/blob/dca9cd352bb914e53e64e791fc85985aef3d9fb7/dist/utils.js#L62-L74 | train |
origin1tech/stiks | dist/utils.js | copyAll | function copyAll(copies) {
var success = 0;
var failed = 0;
var result;
function update(_result) {
if (!_result)
failed++;
else
success++;
}
function logResults() {
// only log if something copied or failed.
if (success || failed) {
... | javascript | function copyAll(copies) {
var success = 0;
var failed = 0;
var result;
function update(_result) {
if (!_result)
failed++;
else
success++;
}
function logResults() {
// only log if something copied or failed.
if (success || failed) {
... | [
"function",
"copyAll",
"(",
"copies",
")",
"{",
"var",
"success",
"=",
"0",
";",
"var",
"failed",
"=",
"0",
";",
"var",
"result",
";",
"function",
"update",
"(",
"_result",
")",
"{",
"if",
"(",
"!",
"_result",
")",
"failed",
"++",
";",
"else",
"suc... | Copy All
Takes collection and copies to destination.
@param copies collection of source and destination targets. | [
"Copy",
"All",
"Takes",
"collection",
"and",
"copies",
"to",
"destination",
"."
] | dca9cd352bb914e53e64e791fc85985aef3d9fb7 | https://github.com/origin1tech/stiks/blob/dca9cd352bb914e53e64e791fc85985aef3d9fb7/dist/utils.js#L82-L154 | train |
origin1tech/stiks | dist/utils.js | pkg | function pkg(val) {
var filename = path_1.resolve(exports.cwd, 'package.json');
if (!val)
return _pkg || (_pkg = fs_extra_1.readJSONSync(filename));
fs_extra_1.writeJSONSync(filename, val, { spaces: 2 });
} | javascript | function pkg(val) {
var filename = path_1.resolve(exports.cwd, 'package.json');
if (!val)
return _pkg || (_pkg = fs_extra_1.readJSONSync(filename));
fs_extra_1.writeJSONSync(filename, val, { spaces: 2 });
} | [
"function",
"pkg",
"(",
"val",
")",
"{",
"var",
"filename",
"=",
"path_1",
".",
"resolve",
"(",
"exports",
".",
"cwd",
",",
"'package.json'",
")",
";",
"if",
"(",
"!",
"val",
")",
"return",
"_pkg",
"||",
"(",
"_pkg",
"=",
"fs_extra_1",
".",
"readJSON... | Pkg
Loads the package.json file for project or saves package.json.
@param val the package.json object to be written to file. | [
"Pkg",
"Loads",
"the",
"package",
".",
"json",
"file",
"for",
"project",
"or",
"saves",
"package",
".",
"json",
"."
] | dca9cd352bb914e53e64e791fc85985aef3d9fb7 | https://github.com/origin1tech/stiks/blob/dca9cd352bb914e53e64e791fc85985aef3d9fb7/dist/utils.js#L162-L167 | train |
origin1tech/stiks | dist/utils.js | platform | function platform() {
var cpus = os.cpus();
var cpu = cpus[0];
cpu.cores = cpus.length;
var tmpPlatform = os.platform();
if (/^win/.test(tmpPlatform))
tmpPlatform = 'windows';
else if (tmpPlatform === 'darwin' || tmpPlatform === 'freebsd')
tmpPlatform = 'mac';
else if (tmpPla... | javascript | function platform() {
var cpus = os.cpus();
var cpu = cpus[0];
cpu.cores = cpus.length;
var tmpPlatform = os.platform();
if (/^win/.test(tmpPlatform))
tmpPlatform = 'windows';
else if (tmpPlatform === 'darwin' || tmpPlatform === 'freebsd')
tmpPlatform = 'mac';
else if (tmpPla... | [
"function",
"platform",
"(",
")",
"{",
"var",
"cpus",
"=",
"os",
".",
"cpus",
"(",
")",
";",
"var",
"cpu",
"=",
"cpus",
"[",
"0",
"]",
";",
"cpu",
".",
"cores",
"=",
"cpus",
".",
"length",
";",
"var",
"tmpPlatform",
"=",
"os",
".",
"platform",
... | Platform
Gets information and paths for the current platform. | [
"Platform",
"Gets",
"information",
"and",
"paths",
"for",
"the",
"current",
"platform",
"."
] | dca9cd352bb914e53e64e791fc85985aef3d9fb7 | https://github.com/origin1tech/stiks/blob/dca9cd352bb914e53e64e791fc85985aef3d9fb7/dist/utils.js#L235-L254 | train |
origin1tech/stiks | dist/utils.js | colorize | function colorize(val) {
var styles = [];
for (var _i = 1; _i < arguments.length; _i++) {
styles[_i - 1] = arguments[_i];
}
styles = chek_1.flatten(styles);
if (chek_1.isObject(val))
return util_1.inspect(val, null, null, true);
if (/\./.test(styles[0]))
styles = styles[0... | javascript | function colorize(val) {
var styles = [];
for (var _i = 1; _i < arguments.length; _i++) {
styles[_i - 1] = arguments[_i];
}
styles = chek_1.flatten(styles);
if (chek_1.isObject(val))
return util_1.inspect(val, null, null, true);
if (/\./.test(styles[0]))
styles = styles[0... | [
"function",
"colorize",
"(",
"val",
")",
"{",
"var",
"styles",
"=",
"[",
"]",
";",
"for",
"(",
"var",
"_i",
"=",
"1",
";",
"_i",
"<",
"arguments",
".",
"length",
";",
"_i",
"++",
")",
"{",
"styles",
"[",
"_i",
"-",
"1",
"]",
"=",
"arguments",
... | Colorizes a value.
@param val the value to colorize.
@param styles the styles to be applied. | [
"Colorizes",
"a",
"value",
"."
] | dca9cd352bb914e53e64e791fc85985aef3d9fb7 | https://github.com/origin1tech/stiks/blob/dca9cd352bb914e53e64e791fc85985aef3d9fb7/dist/utils.js#L262-L273 | train |
origin1tech/pargv | dist/utils.js | findPackage | function findPackage(filename) {
if (!ctr)
return;
filename = filename || require.main.filename;
var parsed = path_1.parse(filename);
var curPath = path_1.join(parsed.dir, 'package.json');
if (!fs_1.existsSync(curPath)) {
ctr--;
return findPackage(parsed.dir);
}
else ... | javascript | function findPackage(filename) {
if (!ctr)
return;
filename = filename || require.main.filename;
var parsed = path_1.parse(filename);
var curPath = path_1.join(parsed.dir, 'package.json');
if (!fs_1.existsSync(curPath)) {
ctr--;
return findPackage(parsed.dir);
}
else ... | [
"function",
"findPackage",
"(",
"filename",
")",
"{",
"if",
"(",
"!",
"ctr",
")",
"return",
";",
"filename",
"=",
"filename",
"||",
"require",
".",
"main",
".",
"filename",
";",
"var",
"parsed",
"=",
"path_1",
".",
"parse",
"(",
"filename",
")",
";",
... | limit recursion. | [
"limit",
"recursion",
"."
] | 3dfe91190b843e9b0d84f9a65bcd45a86617cc05 | https://github.com/origin1tech/pargv/blob/3dfe91190b843e9b0d84f9a65bcd45a86617cc05/dist/utils.js#L13-L26 | train |
redisjs/jsr-conf | lib/validator.js | save | function save(val) {
if(Array.isArray(val)) {
val.forEach(function(item) {
var seconds = item[0]
, changes = item[1];
if(seconds < 1 || changes < 0) {
throw new Error('Invalid save parameters');
}
})
}
} | javascript | function save(val) {
if(Array.isArray(val)) {
val.forEach(function(item) {
var seconds = item[0]
, changes = item[1];
if(seconds < 1 || changes < 0) {
throw new Error('Invalid save parameters');
}
})
}
} | [
"function",
"save",
"(",
"val",
")",
"{",
"if",
"(",
"Array",
".",
"isArray",
"(",
"val",
")",
")",
"{",
"val",
".",
"forEach",
"(",
"function",
"(",
"item",
")",
"{",
"var",
"seconds",
"=",
"item",
"[",
"0",
"]",
",",
"changes",
"=",
"item",
"... | Validate a save value. | [
"Validate",
"a",
"save",
"value",
"."
] | 97c5e2e77e1601c879a62dfc2d500df537eaaddd | https://github.com/redisjs/jsr-conf/blob/97c5e2e77e1601c879a62dfc2d500df537eaaddd/lib/validator.js#L71-L81 | train |
redisjs/jsr-conf | lib/validator.js | dir | function dir(val) {
try {
process.chdir(val);
}catch(e) {
throw new Error(
util.format('Can\'t chdir to \'%s\': %s'), val, e.message);
}
} | javascript | function dir(val) {
try {
process.chdir(val);
}catch(e) {
throw new Error(
util.format('Can\'t chdir to \'%s\': %s'), val, e.message);
}
} | [
"function",
"dir",
"(",
"val",
")",
"{",
"try",
"{",
"process",
".",
"chdir",
"(",
"val",
")",
";",
"}",
"catch",
"(",
"e",
")",
"{",
"throw",
"new",
"Error",
"(",
"util",
".",
"format",
"(",
"'Can\\'t chdir to \\'%s\\': %s'",
")",
",",
"val",
",",
... | Validate a dir value. | [
"Validate",
"a",
"dir",
"value",
"."
] | 97c5e2e77e1601c879a62dfc2d500df537eaaddd | https://github.com/redisjs/jsr-conf/blob/97c5e2e77e1601c879a62dfc2d500df537eaaddd/lib/validator.js#L86-L93 | train |
redisjs/jsr-conf | lib/validator.js | logfile | function logfile(val) {
var fd;
// empty string disables use of log file
if(val) {
try {
fd = fs.openSync(val, 'a');
fs.closeSync(fd);
}catch(e) {
throw new Error(util.format('Can\'t open the log file: %s', val));
}
}
} | javascript | function logfile(val) {
var fd;
// empty string disables use of log file
if(val) {
try {
fd = fs.openSync(val, 'a');
fs.closeSync(fd);
}catch(e) {
throw new Error(util.format('Can\'t open the log file: %s', val));
}
}
} | [
"function",
"logfile",
"(",
"val",
")",
"{",
"var",
"fd",
";",
"// empty string disables use of log file",
"if",
"(",
"val",
")",
"{",
"try",
"{",
"fd",
"=",
"fs",
".",
"openSync",
"(",
"val",
",",
"'a'",
")",
";",
"fs",
".",
"closeSync",
"(",
"fd",
... | Validate a logfile value. | [
"Validate",
"a",
"logfile",
"value",
"."
] | 97c5e2e77e1601c879a62dfc2d500df537eaaddd | https://github.com/redisjs/jsr-conf/blob/97c5e2e77e1601c879a62dfc2d500df537eaaddd/lib/validator.js#L98-L109 | train |
redisjs/jsr-conf | lib/validator.js | include | function include(val) {
var i, inc;
// disallow the empty string
if(Array.isArray(val)) {
for(i = 0;i < val.length;i++) {
inc = val[i];
if(!inc) throw new Error('Invalid include value');
}
}
} | javascript | function include(val) {
var i, inc;
// disallow the empty string
if(Array.isArray(val)) {
for(i = 0;i < val.length;i++) {
inc = val[i];
if(!inc) throw new Error('Invalid include value');
}
}
} | [
"function",
"include",
"(",
"val",
")",
"{",
"var",
"i",
",",
"inc",
";",
"// disallow the empty string",
"if",
"(",
"Array",
".",
"isArray",
"(",
"val",
")",
")",
"{",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"val",
".",
"length",
";",
"i",
"++... | Validate an include value. | [
"Validate",
"an",
"include",
"value",
"."
] | 97c5e2e77e1601c879a62dfc2d500df537eaaddd | https://github.com/redisjs/jsr-conf/blob/97c5e2e77e1601c879a62dfc2d500df537eaaddd/lib/validator.js#L133-L142 | train |
redisjs/jsr-conf | lib/validator.js | requirepass | function requirepass(val) {
if(val && val.length > AUTHPASS_MAX_LEN) {
throw new Error(
util.format('Password is longer than %s', AUTHPASS_MAX_LEN));
}
} | javascript | function requirepass(val) {
if(val && val.length > AUTHPASS_MAX_LEN) {
throw new Error(
util.format('Password is longer than %s', AUTHPASS_MAX_LEN));
}
} | [
"function",
"requirepass",
"(",
"val",
")",
"{",
"if",
"(",
"val",
"&&",
"val",
".",
"length",
">",
"AUTHPASS_MAX_LEN",
")",
"{",
"throw",
"new",
"Error",
"(",
"util",
".",
"format",
"(",
"'Password is longer than %s'",
",",
"AUTHPASS_MAX_LEN",
")",
")",
"... | Validate a requirepass value. | [
"Validate",
"a",
"requirepass",
"value",
"."
] | 97c5e2e77e1601c879a62dfc2d500df537eaaddd | https://github.com/redisjs/jsr-conf/blob/97c5e2e77e1601c879a62dfc2d500df537eaaddd/lib/validator.js#L204-L209 | train |
redisjs/jsr-conf | lib/validator.js | clientOutputBufferLimit | function clientOutputBufferLimit(val) {
if(Array.isArray(val)) {
val.forEach(function(limit) {
var type = limit[0]
, seconds = limit[3];
if(!~Constants.CLIENT_CLASS.indexOf(type)) {
throw new Error('Unrecognized client limit class');
}
if(seconds < 0) {
throw new Er... | javascript | function clientOutputBufferLimit(val) {
if(Array.isArray(val)) {
val.forEach(function(limit) {
var type = limit[0]
, seconds = limit[3];
if(!~Constants.CLIENT_CLASS.indexOf(type)) {
throw new Error('Unrecognized client limit class');
}
if(seconds < 0) {
throw new Er... | [
"function",
"clientOutputBufferLimit",
"(",
"val",
")",
"{",
"if",
"(",
"Array",
".",
"isArray",
"(",
"val",
")",
")",
"{",
"val",
".",
"forEach",
"(",
"function",
"(",
"limit",
")",
"{",
"var",
"type",
"=",
"limit",
"[",
"0",
"]",
",",
"seconds",
... | Validate a client-output-buffer-limit value. | [
"Validate",
"a",
"client",
"-",
"output",
"-",
"buffer",
"-",
"limit",
"value",
"."
] | 97c5e2e77e1601c879a62dfc2d500df537eaaddd | https://github.com/redisjs/jsr-conf/blob/97c5e2e77e1601c879a62dfc2d500df537eaaddd/lib/validator.js#L214-L228 | train |
redisjs/jsr-conf | lib/validator.js | notifyKeyspaceEvents | function notifyKeyspaceEvents(val) {
var i, c;
if(val) {
for(i = 0;i < val.length;i++) {
c = val.charAt(i);
if(!~KEYSPACES_EVENTS.indexOf(c)) {
throw new Error('Invalid event class character. Use \'g$lshzxeA\'.');
}
}
}
} | javascript | function notifyKeyspaceEvents(val) {
var i, c;
if(val) {
for(i = 0;i < val.length;i++) {
c = val.charAt(i);
if(!~KEYSPACES_EVENTS.indexOf(c)) {
throw new Error('Invalid event class character. Use \'g$lshzxeA\'.');
}
}
}
} | [
"function",
"notifyKeyspaceEvents",
"(",
"val",
")",
"{",
"var",
"i",
",",
"c",
";",
"if",
"(",
"val",
")",
"{",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"val",
".",
"length",
";",
"i",
"++",
")",
"{",
"c",
"=",
"val",
".",
"charAt",
"(",
... | Validate a notify-keyspace-events value. | [
"Validate",
"a",
"notify",
"-",
"keyspace",
"-",
"events",
"value",
"."
] | 97c5e2e77e1601c879a62dfc2d500df537eaaddd | https://github.com/redisjs/jsr-conf/blob/97c5e2e77e1601c879a62dfc2d500df537eaaddd/lib/validator.js#L233-L243 | train |
passcod/quenya | index.js | rawLineToText | function rawLineToText (line) {
const cut = line.indexOf(' ')
return cut === -1
? ''
: line.slice(cut + 1).trim()
} | javascript | function rawLineToText (line) {
const cut = line.indexOf(' ')
return cut === -1
? ''
: line.slice(cut + 1).trim()
} | [
"function",
"rawLineToText",
"(",
"line",
")",
"{",
"const",
"cut",
"=",
"line",
".",
"indexOf",
"(",
"' '",
")",
"return",
"cut",
"===",
"-",
"1",
"?",
"''",
":",
"line",
".",
"slice",
"(",
"cut",
"+",
"1",
")",
".",
"trim",
"(",
")",
"}"
] | ! Extracts the text out of a raw comment line | [
"!",
"Extracts",
"the",
"text",
"out",
"of",
"a",
"raw",
"comment",
"line"
] | 05ceedf58d3bd50b91698b4b15a98f9139ca1918 | https://github.com/passcod/quenya/blob/05ceedf58d3bd50b91698b4b15a98f9139ca1918/index.js#L78-L83 | train |
jmike/naomi | src/datatypes/Float.js | calculateMaxValue | function calculateMaxValue(precision, scale) {
const arr = _.fill(Array(precision), '9');
if (scale) {
arr.splice(precision - scale, 0, '.');
}
return parseFloat(arr.join(''));
} | javascript | function calculateMaxValue(precision, scale) {
const arr = _.fill(Array(precision), '9');
if (scale) {
arr.splice(precision - scale, 0, '.');
}
return parseFloat(arr.join(''));
} | [
"function",
"calculateMaxValue",
"(",
"precision",
",",
"scale",
")",
"{",
"const",
"arr",
"=",
"_",
".",
"fill",
"(",
"Array",
"(",
"precision",
")",
",",
"'9'",
")",
";",
"if",
"(",
"scale",
")",
"{",
"arr",
".",
"splice",
"(",
"precision",
"-",
... | Calculates the max absolute value for the given precision and scale.
@param {number} precision the number of total digits in value, including decimals.
@param {number} [scale] the numver of decimal digits in value.
@return {number}
@private | [
"Calculates",
"the",
"max",
"absolute",
"value",
"for",
"the",
"given",
"precision",
"and",
"scale",
"."
] | debf6d7a70e5968ff57ffabb803e0eaa5c065a93 | https://github.com/jmike/naomi/blob/debf6d7a70e5968ff57ffabb803e0eaa5c065a93/src/datatypes/Float.js#L12-L20 | train |
create-conform/allume | bin/boot.js | open | function open(selector) {
if (p["--debug"] && host.runtime == host.RUNTIME_NODEJS) {
return debug(p);
}
if (p["--ui"] && !ui) {
if (!nw) {
allume.update(allume.STATUS_ERROR, MSG_UI_UNAVAILABLE);
return;
... | javascript | function open(selector) {
if (p["--debug"] && host.runtime == host.RUNTIME_NODEJS) {
return debug(p);
}
if (p["--ui"] && !ui) {
if (!nw) {
allume.update(allume.STATUS_ERROR, MSG_UI_UNAVAILABLE);
return;
... | [
"function",
"open",
"(",
"selector",
")",
"{",
"if",
"(",
"p",
"[",
"\"--debug\"",
"]",
"&&",
"host",
".",
"runtime",
"==",
"host",
".",
"RUNTIME_NODEJS",
")",
"{",
"return",
"debug",
"(",
"p",
")",
";",
"}",
"if",
"(",
"p",
"[",
"\"--ui\"",
"]",
... | start the loading process for the specified selector | [
"start",
"the",
"loading",
"process",
"for",
"the",
"specified",
"selector"
] | 5fdc87804f1e2309c155d001e64d23029c781491 | https://github.com/create-conform/allume/blob/5fdc87804f1e2309c155d001e64d23029c781491/bin/boot.js#L310-L392 | train |
create-conform/allume | bin/boot.js | debug | function debug(cmd) {
// start node in debug mode
childProcess = childProcess || require("child_process");
var PATH_CWD = process.cwd();
// splice out allume command
process.argv.splice(0, 1);
// find debug argument
var debugIdx = -1;
for (var a in proc... | javascript | function debug(cmd) {
// start node in debug mode
childProcess = childProcess || require("child_process");
var PATH_CWD = process.cwd();
// splice out allume command
process.argv.splice(0, 1);
// find debug argument
var debugIdx = -1;
for (var a in proc... | [
"function",
"debug",
"(",
"cmd",
")",
"{",
"// start node in debug mode",
"childProcess",
"=",
"childProcess",
"||",
"require",
"(",
"\"child_process\"",
")",
";",
"var",
"PATH_CWD",
"=",
"process",
".",
"cwd",
"(",
")",
";",
"// splice out allume command",
"proce... | CLI -> DEBUG COMMAND | [
"CLI",
"-",
">",
"DEBUG",
"COMMAND"
] | 5fdc87804f1e2309c155d001e64d23029c781491 | https://github.com/create-conform/allume/blob/5fdc87804f1e2309c155d001e64d23029c781491/bin/boot.js#L489-L533 | train |
atd-schubert/node-stream-lib | lib/spawn.js | function (command, params, opts) {
var self = this;
this.cmd = spawn(command, params, opts);
this.cmd.stdout.on('readable', function () {
self.isSpawnReadable = true;
privatePump.apply(self);
});
this.cmd.stdout.on('end', function () {
self.pu... | javascript | function (command, params, opts) {
var self = this;
this.cmd = spawn(command, params, opts);
this.cmd.stdout.on('readable', function () {
self.isSpawnReadable = true;
privatePump.apply(self);
});
this.cmd.stdout.on('end', function () {
self.pu... | [
"function",
"(",
"command",
",",
"params",
",",
"opts",
")",
"{",
"var",
"self",
"=",
"this",
";",
"this",
".",
"cmd",
"=",
"spawn",
"(",
"command",
",",
"params",
",",
"opts",
")",
";",
"this",
".",
"cmd",
".",
"stdout",
".",
"on",
"(",
"'readab... | Spawn a process and set stdin to writable stream and stdout to readable stream.
Please take a look at node.js-API for further information.
@param {string} command - Command name that shoul be executed
@param {string[]} [params] - Parameters to set in spawned process
@param {{}} [opts] - Optional spawn settings | [
"Spawn",
"a",
"process",
"and",
"set",
"stdin",
"to",
"writable",
"stream",
"and",
"stdout",
"to",
"readable",
"stream",
"."
] | 90f27042fae84d2fbdbf9d28149b0673997f151a | https://github.com/atd-schubert/node-stream-lib/blob/90f27042fae84d2fbdbf9d28149b0673997f151a/lib/spawn.js#L56-L71 | train | |
gethuman/pancakes-angular | lib/ngapp/generic.directives.js | addDirective | function addDirective(directiveName, dashCase, attrName, filterType, isBind, isBindOnce, isFilter) {
app.directive(directiveName, ['i18n', 'config', function (i18n, config) {
function setValue(scope, element, attrs, value) {
value = !isFilter ? value :
filterType... | javascript | function addDirective(directiveName, dashCase, attrName, filterType, isBind, isBindOnce, isFilter) {
app.directive(directiveName, ['i18n', 'config', function (i18n, config) {
function setValue(scope, element, attrs, value) {
value = !isFilter ? value :
filterType... | [
"function",
"addDirective",
"(",
"directiveName",
",",
"dashCase",
",",
"attrName",
",",
"filterType",
",",
"isBind",
",",
"isBindOnce",
",",
"isFilter",
")",
"{",
"app",
".",
"directive",
"(",
"directiveName",
",",
"[",
"'i18n'",
",",
"'config'",
",",
"func... | function used for each of the generic directives | [
"function",
"used",
"for",
"each",
"of",
"the",
"generic",
"directives"
] | 9589b7ba09619843e271293088005c62ed23f355 | https://github.com/gethuman/pancakes-angular/blob/9589b7ba09619843e271293088005c62ed23f355/lib/ngapp/generic.directives.js#L30-L84 | train |
boxxa/1broker-api | 1broker.js | apiMethod | function apiMethod(path, params, callback) {
var url = config.url + path + '?token=' + config.api_key;
if(params) url = url+= '&'+params;
return apiRequest(url, callback);
} | javascript | function apiMethod(path, params, callback) {
var url = config.url + path + '?token=' + config.api_key;
if(params) url = url+= '&'+params;
return apiRequest(url, callback);
} | [
"function",
"apiMethod",
"(",
"path",
",",
"params",
",",
"callback",
")",
"{",
"var",
"url",
"=",
"config",
".",
"url",
"+",
"path",
"+",
"'?token='",
"+",
"config",
".",
"api_key",
";",
"if",
"(",
"params",
")",
"url",
"=",
"url",
"+=",
"'&'",
"+... | This method makes a private API request.
@param {String} path The path to the API method
@param {Object} params String of arguments to pass to the api call
@param {Function} callback A callback function to be executed when the request is complete
@return {Object} The request object | [
"This",
"method",
"makes",
"a",
"private",
"API",
"request",
"."
] | a32c8f6ba9fa744f4ff0c2dcbc616f37d3bebb43 | https://github.com/boxxa/1broker-api/blob/a32c8f6ba9fa744f4ff0c2dcbc616f37d3bebb43/1broker.js#L69-L73 | train |
boxxa/1broker-api | 1broker.js | apiRequest | function apiRequest(url, callback) {
var options = {
url: url,
method: 'GET',
timeout: config.timeoutMS,
maxAttempts: 3,
retryDelay: 2000, // (default) wait for 2s before trying again
retryStrategy: request.RetryStrategies.HTTPOrNetworkError // (default) retry on 5xx or netw... | javascript | function apiRequest(url, callback) {
var options = {
url: url,
method: 'GET',
timeout: config.timeoutMS,
maxAttempts: 3,
retryDelay: 2000, // (default) wait for 2s before trying again
retryStrategy: request.RetryStrategies.HTTPOrNetworkError // (default) retry on 5xx or netw... | [
"function",
"apiRequest",
"(",
"url",
",",
"callback",
")",
"{",
"var",
"options",
"=",
"{",
"url",
":",
"url",
",",
"method",
":",
"'GET'",
",",
"timeout",
":",
"config",
".",
"timeoutMS",
",",
"maxAttempts",
":",
"3",
",",
"retryDelay",
":",
"2000",
... | This method sends the actual HTTP request
@param {String} url The URL to make the request
@param {String} requestType POST or GET
@param {Object} params POST or GET body
@param {Function} callback A callback function to call when the request is complete
@return {Object} The request object | [
"This",
"method",
"sends",
"the",
"actual",
"HTTP",
"request"
] | a32c8f6ba9fa744f4ff0c2dcbc616f37d3bebb43 | https://github.com/boxxa/1broker-api/blob/a32c8f6ba9fa744f4ff0c2dcbc616f37d3bebb43/1broker.js#L82-L116 | train |
redisjs/jsr-conf | lib/resolve.js | resolve | function resolve(file) {
// not too sure about windows, but put the \\
// just in case
if(!/^(\\\\|\/)/.test(file)) {
return path.normalize(path.join(process.cwd(), file));
}
return file;
} | javascript | function resolve(file) {
// not too sure about windows, but put the \\
// just in case
if(!/^(\\\\|\/)/.test(file)) {
return path.normalize(path.join(process.cwd(), file));
}
return file;
} | [
"function",
"resolve",
"(",
"file",
")",
"{",
"// not too sure about windows, but put the \\\\",
"// just in case",
"if",
"(",
"!",
"/",
"^(\\\\\\\\|\\/)",
"/",
".",
"test",
"(",
"file",
")",
")",
"{",
"return",
"path",
".",
"normalize",
"(",
"path",
".",
"joi... | Utility used to resolve relative paths so that circular references
can be detected correctly. | [
"Utility",
"used",
"to",
"resolve",
"relative",
"paths",
"so",
"that",
"circular",
"references",
"can",
"be",
"detected",
"correctly",
"."
] | 97c5e2e77e1601c879a62dfc2d500df537eaaddd | https://github.com/redisjs/jsr-conf/blob/97c5e2e77e1601c879a62dfc2d500df537eaaddd/lib/resolve.js#L7-L14 | train |
redisjs/jsr-persistence | lib/encoding.js | encoding | function encoding(rtype, value, conf) {
var enc;
//console.dir('rtype: ' + rtype);
//console.dir(value);
switch(rtype) {
case RTYPE.STRING:
enc = ENCODING.RAW;
// integer encoding
if(typeof value === 'number'
&& parseInt(value) === value
|| (typeof value === 'string'
... | javascript | function encoding(rtype, value, conf) {
var enc;
//console.dir('rtype: ' + rtype);
//console.dir(value);
switch(rtype) {
case RTYPE.STRING:
enc = ENCODING.RAW;
// integer encoding
if(typeof value === 'number'
&& parseInt(value) === value
|| (typeof value === 'string'
... | [
"function",
"encoding",
"(",
"rtype",
",",
"value",
",",
"conf",
")",
"{",
"var",
"enc",
";",
"//console.dir('rtype: ' + rtype);",
"//console.dir(value);",
"switch",
"(",
"rtype",
")",
"{",
"case",
"RTYPE",
".",
"STRING",
":",
"enc",
"=",
"ENCODING",
".",
"R... | Determine the encoding of an object.
@param rtype The redis type string.
@param value The value of the object.
@param conf Reference to the configuration. | [
"Determine",
"the",
"encoding",
"of",
"an",
"object",
"."
] | 77f3fc84ea7cbdb9f41a4dfa7ee1d89be61f7510 | https://github.com/redisjs/jsr-persistence/blob/77f3fc84ea7cbdb9f41a4dfa7ee1d89be61f7510/lib/encoding.js#L46-L83 | train |
pasquale-inc/dictmanager | src/dictmanager.js | clone | function clone(obj) {
if (null == obj || "object" != typeof obj)
return obj;
if (obj instanceof Object) {
var copy = {};
for (var attr in obj) {
if (obj.hasOwnProperty(attr)) copy[attr] = clone(obj[attr]);
}
return copy;
}
throw new Error("Unable to copy obj! Its type isn't supported... | javascript | function clone(obj) {
if (null == obj || "object" != typeof obj)
return obj;
if (obj instanceof Object) {
var copy = {};
for (var attr in obj) {
if (obj.hasOwnProperty(attr)) copy[attr] = clone(obj[attr]);
}
return copy;
}
throw new Error("Unable to copy obj! Its type isn't supported... | [
"function",
"clone",
"(",
"obj",
")",
"{",
"if",
"(",
"null",
"==",
"obj",
"||",
"\"object\"",
"!=",
"typeof",
"obj",
")",
"return",
"obj",
";",
"if",
"(",
"obj",
"instanceof",
"Object",
")",
"{",
"var",
"copy",
"=",
"{",
"}",
";",
"for",
"(",
"v... | Clones a given Object. This leads us to a
more 'immutable' programming. | [
"Clones",
"a",
"given",
"Object",
".",
"This",
"leads",
"us",
"to",
"a",
"more",
"immutable",
"programming",
"."
] | b4d219c37132429a132e98f0270a11b8d1e9d286 | https://github.com/pasquale-inc/dictmanager/blob/b4d219c37132429a132e98f0270a11b8d1e9d286/src/dictmanager.js#L19-L32 | train |
wunderbyte/grunt-spiritual-edbml | tasks/things/inliner.js | resolvehtml | function resolvehtml(html, holders) {
Object.keys(holders).forEach(function(key) {
html = html.replace(placeholder(key), holders[key]);
});
return html;
} | javascript | function resolvehtml(html, holders) {
Object.keys(holders).forEach(function(key) {
html = html.replace(placeholder(key), holders[key]);
});
return html;
} | [
"function",
"resolvehtml",
"(",
"html",
",",
"holders",
")",
"{",
"Object",
".",
"keys",
"(",
"holders",
")",
".",
"forEach",
"(",
"function",
"(",
"key",
")",
"{",
"html",
"=",
"html",
".",
"replace",
"(",
"placeholder",
"(",
"key",
")",
",",
"holde... | Bypass dysfunction in Cheerio that would HTML-encode the JS.
@param {string} html
@param {Map<string,string>} holders
@returns {string} | [
"Bypass",
"dysfunction",
"in",
"Cheerio",
"that",
"would",
"HTML",
"-",
"encode",
"the",
"JS",
"."
] | 2ba0aa8042eceee917f1ee48c7881345df3bce46 | https://github.com/wunderbyte/grunt-spiritual-edbml/blob/2ba0aa8042eceee917f1ee48c7881345df3bce46/tasks/things/inliner.js#L103-L108 | train |
wunderbyte/grunt-spiritual-edbml | tasks/things/inliner.js | rename | function rename(filepath, options) {
var base = filepath.substr(0, filepath.lastIndexOf('.'));
return base + (options.extname || '.html');
} | javascript | function rename(filepath, options) {
var base = filepath.substr(0, filepath.lastIndexOf('.'));
return base + (options.extname || '.html');
} | [
"function",
"rename",
"(",
"filepath",
",",
"options",
")",
"{",
"var",
"base",
"=",
"filepath",
".",
"substr",
"(",
"0",
",",
"filepath",
".",
"lastIndexOf",
"(",
"'.'",
")",
")",
";",
"return",
"base",
"+",
"(",
"options",
".",
"extname",
"||",
"'.... | Change extension of file and return new path.
@param {string} filepath
@param {Map} options
@returns {string} | [
"Change",
"extension",
"of",
"file",
"and",
"return",
"new",
"path",
"."
] | 2ba0aa8042eceee917f1ee48c7881345df3bce46 | https://github.com/wunderbyte/grunt-spiritual-edbml/blob/2ba0aa8042eceee917f1ee48c7881345df3bce46/tasks/things/inliner.js#L139-L142 | train |
wunderbyte/grunt-spiritual-edbml | tasks/things/inliner.js | tabbing | function tabbing(script) {
var prev, data;
script = script[0];
if ((prev = script.prev) && (data = prev.data)) {
return data.replace(/\n/g, '');
}
return '';
} | javascript | function tabbing(script) {
var prev, data;
script = script[0];
if ((prev = script.prev) && (data = prev.data)) {
return data.replace(/\n/g, '');
}
return '';
} | [
"function",
"tabbing",
"(",
"script",
")",
"{",
"var",
"prev",
",",
"data",
";",
"script",
"=",
"script",
"[",
"0",
"]",
";",
"if",
"(",
"(",
"prev",
"=",
"script",
".",
"prev",
")",
"&&",
"(",
"data",
"=",
"prev",
".",
"data",
")",
")",
"{",
... | Preserve some indentation in output.
@TODO: double check whitespace only.
@param {$} script
@returns {string} | [
"Preserve",
"some",
"indentation",
"in",
"output",
"."
] | 2ba0aa8042eceee917f1ee48c7881345df3bce46 | https://github.com/wunderbyte/grunt-spiritual-edbml/blob/2ba0aa8042eceee917f1ee48c7881345df3bce46/tasks/things/inliner.js#L159-L166 | train |
imyelo/template-cache | lib/cache.js | function (filename, ext) {
if (!_.isString(filename) || !_.isString(ext)) {
return false;
}
ext = ext.slice(0, 1) === '.' ? ext : ('.' + ext);
return !!(filename && filename.split(ext).pop() === '');
} | javascript | function (filename, ext) {
if (!_.isString(filename) || !_.isString(ext)) {
return false;
}
ext = ext.slice(0, 1) === '.' ? ext : ('.' + ext);
return !!(filename && filename.split(ext).pop() === '');
} | [
"function",
"(",
"filename",
",",
"ext",
")",
"{",
"if",
"(",
"!",
"_",
".",
"isString",
"(",
"filename",
")",
"||",
"!",
"_",
".",
"isString",
"(",
"ext",
")",
")",
"{",
"return",
"false",
";",
"}",
"ext",
"=",
"ext",
".",
"slice",
"(",
"0",
... | return if the filename with the extension | [
"return",
"if",
"the",
"filename",
"with",
"the",
"extension"
] | 32f801072d35b5e85115ba8df56fc9ee6c468dd3 | https://github.com/imyelo/template-cache/blob/32f801072d35b5e85115ba8df56fc9ee6c468dd3/lib/cache.js#L73-L79 | train | |
imyelo/template-cache | lib/cache.js | function (basepath, action, recursive) {
var isDirectory = function (target) {
return fs.statSync(target).isDirectory();
};
var nextLevel = function (subpath) {
_.each(fs.readdirSync(path.join(basepath, subpath)), function (filename) {
if (isDirectory(path.join(basepath, (filename = path.join(subpat... | javascript | function (basepath, action, recursive) {
var isDirectory = function (target) {
return fs.statSync(target).isDirectory();
};
var nextLevel = function (subpath) {
_.each(fs.readdirSync(path.join(basepath, subpath)), function (filename) {
if (isDirectory(path.join(basepath, (filename = path.join(subpat... | [
"function",
"(",
"basepath",
",",
"action",
",",
"recursive",
")",
"{",
"var",
"isDirectory",
"=",
"function",
"(",
"target",
")",
"{",
"return",
"fs",
".",
"statSync",
"(",
"target",
")",
".",
"isDirectory",
"(",
")",
";",
"}",
";",
"var",
"nextLevel"... | recursive read each file in directories | [
"recursive",
"read",
"each",
"file",
"in",
"directories"
] | 32f801072d35b5e85115ba8df56fc9ee6c468dd3 | https://github.com/imyelo/template-cache/blob/32f801072d35b5e85115ba8df56fc9ee6c468dd3/lib/cache.js#L107-L123 | train | |
inviqa/deck-task-registry | src/scripts/buildScripts.js | buildScripts | function buildScripts(conf, undertaker) {
const uglifyConf = {
mangle: false
};
const typeScriptConf = {
target: 'es5',
allowJs: true
};
const jsSrc = path.join(conf.themeConfig.root, conf.themeConfig.js.src, '**', '*.[tj]s');
const jsDest = path.join(conf.themeConfig.root, conf.themeConfig.j... | javascript | function buildScripts(conf, undertaker) {
const uglifyConf = {
mangle: false
};
const typeScriptConf = {
target: 'es5',
allowJs: true
};
const jsSrc = path.join(conf.themeConfig.root, conf.themeConfig.js.src, '**', '*.[tj]s');
const jsDest = path.join(conf.themeConfig.root, conf.themeConfig.j... | [
"function",
"buildScripts",
"(",
"conf",
",",
"undertaker",
")",
"{",
"const",
"uglifyConf",
"=",
"{",
"mangle",
":",
"false",
"}",
";",
"const",
"typeScriptConf",
"=",
"{",
"target",
":",
"'es5'",
",",
"allowJs",
":",
"true",
"}",
";",
"const",
"jsSrc",... | Build project scripts.
@param {ConfigParser} conf A configuration parser object.
@param {Undertaker} undertaker An Undertaker instance.
@returns {Stream} A stream of files. | [
"Build",
"project",
"scripts",
"."
] | 4c31787b978e9d99a47052e090d4589a50cd3015 | https://github.com/inviqa/deck-task-registry/blob/4c31787b978e9d99a47052e090d4589a50cd3015/src/scripts/buildScripts.js#L17-L41 | train |
andrewscwei/requiem | src/dom/hasStyle.js | hasStyle | function hasStyle(element, key) {
assertType(element, Node, false, 'Invalid element specified');
return element.style[key] !== '';
} | javascript | function hasStyle(element, key) {
assertType(element, Node, false, 'Invalid element specified');
return element.style[key] !== '';
} | [
"function",
"hasStyle",
"(",
"element",
",",
"key",
")",
"{",
"assertType",
"(",
"element",
",",
"Node",
",",
"false",
",",
"'Invalid element specified'",
")",
";",
"return",
"element",
".",
"style",
"[",
"key",
"]",
"!==",
"''",
";",
"}"
] | Checks to see if a Node has the specified inline CSS rule.
@param {Node} element - Target element.
@param {string} key - Name of the style.
@return {boolean}
@alias module:requiem~dom.hasStyle | [
"Checks",
"to",
"see",
"if",
"a",
"Node",
"has",
"the",
"specified",
"inline",
"CSS",
"rule",
"."
] | c4182bfffc9841c6de5718f689ad3c2060511777 | https://github.com/andrewscwei/requiem/blob/c4182bfffc9841c6de5718f689ad3c2060511777/src/dom/hasStyle.js#L17-L20 | train |
gethuman/jyt | lib/jyt.parser.js | convertDomToJyt | function convertDomToJyt(dom) {
var i, elems, tempElem;
// if just one element in the array, bump it up a level
if (utils.isArray(dom) && dom.length === 1) {
dom = dom[0];
}
// if multiple, then we create a sibling array of elems and return it
else if (utils.isArray(dom)) {
elem... | javascript | function convertDomToJyt(dom) {
var i, elems, tempElem;
// if just one element in the array, bump it up a level
if (utils.isArray(dom) && dom.length === 1) {
dom = dom[0];
}
// if multiple, then we create a sibling array of elems and return it
else if (utils.isArray(dom)) {
elem... | [
"function",
"convertDomToJyt",
"(",
"dom",
")",
"{",
"var",
"i",
",",
"elems",
",",
"tempElem",
";",
"// if just one element in the array, bump it up a level",
"if",
"(",
"utils",
".",
"isArray",
"(",
"dom",
")",
"&&",
"dom",
".",
"length",
"===",
"1",
")",
... | Convert the HTML parser DOM format to Jyt format
@param dom | [
"Convert",
"the",
"HTML",
"parser",
"DOM",
"format",
"to",
"Jyt",
"format"
] | 716be37e09217b4be917e179389f752212a428b3 | https://github.com/gethuman/jyt/blob/716be37e09217b4be917e179389f752212a428b3/lib/jyt.parser.js#L15-L73 | train |
gethuman/jyt | lib/jyt.parser.js | parse | function parse(html, cb) {
if (!cb) {
throw new Error('Must pass in callback to parse() as 2nd param');
}
var handler = new htmlparser.DefaultHandler(function (error, dom) {
if (error) {
cb('Error while parsing: ' + error);
}
else {
var jytObj = conv... | javascript | function parse(html, cb) {
if (!cb) {
throw new Error('Must pass in callback to parse() as 2nd param');
}
var handler = new htmlparser.DefaultHandler(function (error, dom) {
if (error) {
cb('Error while parsing: ' + error);
}
else {
var jytObj = conv... | [
"function",
"parse",
"(",
"html",
",",
"cb",
")",
"{",
"if",
"(",
"!",
"cb",
")",
"{",
"throw",
"new",
"Error",
"(",
"'Must pass in callback to parse() as 2nd param'",
")",
";",
"}",
"var",
"handler",
"=",
"new",
"htmlparser",
".",
"DefaultHandler",
"(",
"... | Parse the HTML into Jyt format
@param html
@param cb
@returns {*} | [
"Parse",
"the",
"HTML",
"into",
"Jyt",
"format"
] | 716be37e09217b4be917e179389f752212a428b3 | https://github.com/gethuman/jyt/blob/716be37e09217b4be917e179389f752212a428b3/lib/jyt.parser.js#L81-L99 | train |
jsdevel/node-no-utils | index.js | transform | function transform(input, test) {
var i, len, value, keys, key, newInput;
if (Array.isArray(input)) {
newInput = [];
for (i = input.length - 1; i >= 0 ; i--) {
value = input[i];
if (!test(value)) {
newInput.unshift(value);
}
}
input = newInput;
} else if (input && inp... | javascript | function transform(input, test) {
var i, len, value, keys, key, newInput;
if (Array.isArray(input)) {
newInput = [];
for (i = input.length - 1; i >= 0 ; i--) {
value = input[i];
if (!test(value)) {
newInput.unshift(value);
}
}
input = newInput;
} else if (input && inp... | [
"function",
"transform",
"(",
"input",
",",
"test",
")",
"{",
"var",
"i",
",",
"len",
",",
"value",
",",
"keys",
",",
"key",
",",
"newInput",
";",
"if",
"(",
"Array",
".",
"isArray",
"(",
"input",
")",
")",
"{",
"newInput",
"=",
"[",
"]",
";",
... | Transforms the input based on the result of test. Test is run against object
values, array values, and anything else. If test returns true, object values are
deleted, array items are removed, and null is returned for anything else.
@param {?} input
@param {Function} test
@return {?} | [
"Transforms",
"the",
"input",
"based",
"on",
"the",
"result",
"of",
"test",
".",
"Test",
"is",
"run",
"against",
"object",
"values",
"array",
"values",
"and",
"anything",
"else",
".",
"If",
"test",
"returns",
"true",
"object",
"values",
"are",
"deleted",
"... | cbb79cff028c0e1dc7ce40b495a38a5cbb3dd412 | https://github.com/jsdevel/node-no-utils/blob/cbb79cff028c0e1dc7ce40b495a38a5cbb3dd412/index.js#L16-L51 | train |
andrewscwei/requiem | src/helpers/checkType.js | checkType | function checkType(value, type) {
if (typeof type === 'string') {
switch (type) {
case 'string':
case 'object':
case 'number':
case 'boolean':
case 'function':
return typeof value === type;
case 'class':
return typeof value === 'function';
case 'array':
... | javascript | function checkType(value, type) {
if (typeof type === 'string') {
switch (type) {
case 'string':
case 'object':
case 'number':
case 'boolean':
case 'function':
return typeof value === type;
case 'class':
return typeof value === 'function';
case 'array':
... | [
"function",
"checkType",
"(",
"value",
",",
"type",
")",
"{",
"if",
"(",
"typeof",
"type",
"===",
"'string'",
")",
"{",
"switch",
"(",
"type",
")",
"{",
"case",
"'string'",
":",
"case",
"'object'",
":",
"case",
"'number'",
":",
"case",
"'boolean'",
":"... | Verifies that a given is of the given type.
@param {*} value - Any value.
@param {*} type - Any class or string that describes a type.
@return {boolean} True if validation passes, false otherwise.
@alias module:requiem~helpers.checkType | [
"Verifies",
"that",
"a",
"given",
"is",
"of",
"the",
"given",
"type",
"."
] | c4182bfffc9841c6de5718f689ad3c2060511777 | https://github.com/andrewscwei/requiem/blob/c4182bfffc9841c6de5718f689ad3c2060511777/src/helpers/checkType.js#L15-L35 | train |
damsonjs/damson-driver-file | index.js | send | function send(object) {
if (typeof object === 'object') {
return write(this.filepath, JSON.stringify(object, null, ' '));
} else {
return write(this.filepath, object.toString());
}
} | javascript | function send(object) {
if (typeof object === 'object') {
return write(this.filepath, JSON.stringify(object, null, ' '));
} else {
return write(this.filepath, object.toString());
}
} | [
"function",
"send",
"(",
"object",
")",
"{",
"if",
"(",
"typeof",
"object",
"===",
"'object'",
")",
"{",
"return",
"write",
"(",
"this",
".",
"filepath",
",",
"JSON",
".",
"stringify",
"(",
"object",
",",
"null",
",",
"' '",
")",
")",
";",
"}",
"e... | Writes object to File
@param {object} object Some output to File | [
"Writes",
"object",
"to",
"File"
] | bc71c73dcfdc90b45a6a94a266e79ba7ea30da13 | https://github.com/damsonjs/damson-driver-file/blob/bc71c73dcfdc90b45a6a94a266e79ba7ea30da13/index.js#L11-L17 | train |
belbis/dynamizer | src/dynamizer.js | Dynamizer | function Dynamizer(options) {
// don"t enforce new
if (!(this instanceof Dynamizer)) return new Dynamizer(options);
if (options) {
this.disableBoolean = options.disableBoolean || false; // maps boolean values to numeric
this.enableSets = options.enableSets || false;
// unsure about this option as yet... | javascript | function Dynamizer(options) {
// don"t enforce new
if (!(this instanceof Dynamizer)) return new Dynamizer(options);
if (options) {
this.disableBoolean = options.disableBoolean || false; // maps boolean values to numeric
this.enableSets = options.enableSets || false;
// unsure about this option as yet... | [
"function",
"Dynamizer",
"(",
"options",
")",
"{",
"// don\"t enforce new",
"if",
"(",
"!",
"(",
"this",
"instanceof",
"Dynamizer",
")",
")",
"return",
"new",
"Dynamizer",
"(",
"options",
")",
";",
"if",
"(",
"options",
")",
"{",
"this",
".",
"disableBoole... | mirror of the boto Dynamizer class for node.js | [
"mirror",
"of",
"the",
"boto",
"Dynamizer",
"class",
"for",
"node",
".",
"js"
] | 75e05e2d1c8ca6f05c09c9dac0bd70f8f82fbbda | https://github.com/belbis/dynamizer/blob/75e05e2d1c8ca6f05c09c9dac0bd70f8f82fbbda/src/dynamizer.js#L17-L27 | train |
integreat-io/great-uri-template | lib/filters/max.js | max | function max (value, length) {
if (value === null || value === undefined || isNaN(length)) {
return value
}
return String.prototype.substring.call(value, 0, length)
} | javascript | function max (value, length) {
if (value === null || value === undefined || isNaN(length)) {
return value
}
return String.prototype.substring.call(value, 0, length)
} | [
"function",
"max",
"(",
"value",
",",
"length",
")",
"{",
"if",
"(",
"value",
"===",
"null",
"||",
"value",
"===",
"undefined",
"||",
"isNaN",
"(",
"length",
")",
")",
"{",
"return",
"value",
"}",
"return",
"String",
".",
"prototype",
".",
"substring",... | Return the `length` first characters of `value`. If `length` is higher
than the number of characters in value, value is returned as is.
@param {string} value - The value to shorten
@param {integer} length - The max number of characers to return
@returns {string} A string of maximum `length` characters | [
"Return",
"the",
"length",
"first",
"characters",
"of",
"value",
".",
"If",
"length",
"is",
"higher",
"than",
"the",
"number",
"of",
"characters",
"in",
"value",
"value",
"is",
"returned",
"as",
"is",
"."
] | 0e896ead0567737cf31a4a8b76a26cfa6ce60759 | https://github.com/integreat-io/great-uri-template/blob/0e896ead0567737cf31a4a8b76a26cfa6ce60759/lib/filters/max.js#L8-L14 | train |
transomjs/transom-server-functions | lib/serverFxHandler.js | function (req, res, next) {
// Delayed resolution of the isLoggedIn middleware.
if (server.registry.has('localUserMiddleware')) {
const middleware = server.registry.get('localUserMiddleware');
middleware.isLoggedInMiddleware()(req, res, next);
... | javascript | function (req, res, next) {
// Delayed resolution of the isLoggedIn middleware.
if (server.registry.has('localUserMiddleware')) {
const middleware = server.registry.get('localUserMiddleware');
middleware.isLoggedInMiddleware()(req, res, next);
... | [
"function",
"(",
"req",
",",
"res",
",",
"next",
")",
"{",
"// Delayed resolution of the isLoggedIn middleware.",
"if",
"(",
"server",
".",
"registry",
".",
"has",
"(",
"'localUserMiddleware'",
")",
")",
"{",
"const",
"middleware",
"=",
"server",
".",
"registry"... | Make sure User is authenticated | [
"Make",
"sure",
"User",
"is",
"authenticated"
] | 68577950f5964031929f6b7360240bdcda65f004 | https://github.com/transomjs/transom-server-functions/blob/68577950f5964031929f6b7360240bdcda65f004/lib/serverFxHandler.js#L15-L23 | train | |
jmendiara/gitftw | examples/usage-async.js | doWork | function doWork(cb) {
async.series([
async.apply(deleteTags),
async.apply(createTag)
], cb);
} | javascript | function doWork(cb) {
async.series([
async.apply(deleteTags),
async.apply(createTag)
], cb);
} | [
"function",
"doWork",
"(",
"cb",
")",
"{",
"async",
".",
"series",
"(",
"[",
"async",
".",
"apply",
"(",
"deleteTags",
")",
",",
"async",
".",
"apply",
"(",
"createTag",
")",
"]",
",",
"cb",
")",
";",
"}"
] | Creates and deletes tags | [
"Creates",
"and",
"deletes",
"tags"
] | ba91b0d68b7791b5b557addc685737f6c912b4f3 | https://github.com/jmendiara/gitftw/blob/ba91b0d68b7791b5b557addc685737f6c912b4f3/examples/usage-async.js#L47-L52 | train |
openknowledge-archive/datapackage-init-js | demo/app.js | dictify | function dictify(serializedFormArray) {
var o = {};
$.each(serializedFormArray, function() {
if (o[this.name] !== undefined) {
if (!o[this.name].push) {
o[this.name] = [o[this.name]];
}
o[this.name].push(this.value || '');
} else {
o[this.name] = this.value || '';
}
});... | javascript | function dictify(serializedFormArray) {
var o = {};
$.each(serializedFormArray, function() {
if (o[this.name] !== undefined) {
if (!o[this.name].push) {
o[this.name] = [o[this.name]];
}
o[this.name].push(this.value || '');
} else {
o[this.name] = this.value || '';
}
});... | [
"function",
"dictify",
"(",
"serializedFormArray",
")",
"{",
"var",
"o",
"=",
"{",
"}",
";",
"$",
".",
"each",
"(",
"serializedFormArray",
",",
"function",
"(",
")",
"{",
"if",
"(",
"o",
"[",
"this",
".",
"name",
"]",
"!==",
"undefined",
")",
"{",
... | convert form array to dict | [
"convert",
"form",
"array",
"to",
"dict"
] | 75d6c35f301e42c96dad345956cee5aeb0656d04 | https://github.com/openknowledge-archive/datapackage-init-js/blob/75d6c35f301e42c96dad345956cee5aeb0656d04/demo/app.js#L39-L52 | train |
maxprogram/q-plus | index.js | eachSeries | function eachSeries(fn) {
var i = 0;
return this.then(function(object) {
return reduce(object, function(newPromise, value, key) {
// Allow value to be a promise
if (Q.isPromise(value)) return newPromise.then(function() {
return value;
}).then(function(... | javascript | function eachSeries(fn) {
var i = 0;
return this.then(function(object) {
return reduce(object, function(newPromise, value, key) {
// Allow value to be a promise
if (Q.isPromise(value)) return newPromise.then(function() {
return value;
}).then(function(... | [
"function",
"eachSeries",
"(",
"fn",
")",
"{",
"var",
"i",
"=",
"0",
";",
"return",
"this",
".",
"then",
"(",
"function",
"(",
"object",
")",
"{",
"return",
"reduce",
"(",
"object",
",",
"function",
"(",
"newPromise",
",",
"value",
",",
"key",
")",
... | Executes function for each element of an array or object, running
any promises in series only after the last has been completed.
@promise {(array|object)}
@param {function} fn : The function called per iteration
@param value : Value of element
@param key|index : Key if object, index if array
@returns {object} Origina... | [
"Executes",
"function",
"for",
"each",
"element",
"of",
"an",
"array",
"or",
"object",
"running",
"any",
"promises",
"in",
"series",
"only",
"after",
"the",
"last",
"has",
"been",
"completed",
"."
] | d3406f662a00172be39eebe0907db06e41db8307 | https://github.com/maxprogram/q-plus/blob/d3406f662a00172be39eebe0907db06e41db8307/index.js#L142-L159 | train |
maxprogram/q-plus | index.js | mapSeries | function mapSeries(fn) {
var newArray = [];
// Allow iterator return to be a promise
function push(value, key) {
value = fn(value, key);
if (Q.isPromise(value)) return value.then(function(v) {
newArray.push(v);
});
newArray.push(value);
}
return this.then... | javascript | function mapSeries(fn) {
var newArray = [];
// Allow iterator return to be a promise
function push(value, key) {
value = fn(value, key);
if (Q.isPromise(value)) return value.then(function(v) {
newArray.push(v);
});
newArray.push(value);
}
return this.then... | [
"function",
"mapSeries",
"(",
"fn",
")",
"{",
"var",
"newArray",
"=",
"[",
"]",
";",
"// Allow iterator return to be a promise",
"function",
"push",
"(",
"value",
",",
"key",
")",
"{",
"value",
"=",
"fn",
"(",
"value",
",",
"key",
")",
";",
"if",
"(",
... | Transforms an array or object into a new array using the iterator function,
running any promises in series only after the last has been completed.
@promise {(array|object)}
@param {function} fn : The function called per iteration
@param value : Value of element
@param [key] : Key of element
@returns {array} Transform... | [
"Transforms",
"an",
"array",
"or",
"object",
"into",
"a",
"new",
"array",
"using",
"the",
"iterator",
"function",
"running",
"any",
"promises",
"in",
"series",
"only",
"after",
"the",
"last",
"has",
"been",
"completed",
"."
] | d3406f662a00172be39eebe0907db06e41db8307 | https://github.com/maxprogram/q-plus/blob/d3406f662a00172be39eebe0907db06e41db8307/index.js#L170-L195 | train |
maxprogram/q-plus | index.js | push | function push(value, key) {
value = fn(value, key);
if (Q.isPromise(value)) return value.then(function(v) {
newArray.push(v);
});
newArray.push(value);
} | javascript | function push(value, key) {
value = fn(value, key);
if (Q.isPromise(value)) return value.then(function(v) {
newArray.push(v);
});
newArray.push(value);
} | [
"function",
"push",
"(",
"value",
",",
"key",
")",
"{",
"value",
"=",
"fn",
"(",
"value",
",",
"key",
")",
";",
"if",
"(",
"Q",
".",
"isPromise",
"(",
"value",
")",
")",
"return",
"value",
".",
"then",
"(",
"function",
"(",
"v",
")",
"{",
"newA... | Allow iterator return to be a promise | [
"Allow",
"iterator",
"return",
"to",
"be",
"a",
"promise"
] | d3406f662a00172be39eebe0907db06e41db8307 | https://github.com/maxprogram/q-plus/blob/d3406f662a00172be39eebe0907db06e41db8307/index.js#L173-L179 | train |
maxprogram/q-plus | index.js | times | function times(n, fn) {
var counter = [];
return this.then(function(last) {
for (var i = 0; i < n; i++) {
counter.push(last || i);
}
return Q(counter).map(fn);
});
} | javascript | function times(n, fn) {
var counter = [];
return this.then(function(last) {
for (var i = 0; i < n; i++) {
counter.push(last || i);
}
return Q(counter).map(fn);
});
} | [
"function",
"times",
"(",
"n",
",",
"fn",
")",
"{",
"var",
"counter",
"=",
"[",
"]",
";",
"return",
"this",
".",
"then",
"(",
"function",
"(",
"last",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"n",
";",
"i",
"++",
")",
"{",... | Calls the callback function n times, and accumulates results in the same manner you would use with map.
@promise {*} last
@param {number} n : How many times to iterate
@param {function} fn : The function called per iteration
@param value : Last return value
@returns {array} New array | [
"Calls",
"the",
"callback",
"function",
"n",
"times",
"and",
"accumulates",
"results",
"in",
"the",
"same",
"manner",
"you",
"would",
"use",
"with",
"map",
"."
] | d3406f662a00172be39eebe0907db06e41db8307 | https://github.com/maxprogram/q-plus/blob/d3406f662a00172be39eebe0907db06e41db8307/index.js#L240-L248 | train |
origin1tech/chek | dist/modules/object.js | assign | function assign(obj) {
var args = [];
for (var _i = 1; _i < arguments.length; _i++) {
args[_i - 1] = arguments[_i];
}
if (Object.assign)
return Object.assign.apply(Object, [obj].concat(args));
return objAssign.apply(void 0, [obj].concat(args));
} | javascript | function assign(obj) {
var args = [];
for (var _i = 1; _i < arguments.length; _i++) {
args[_i - 1] = arguments[_i];
}
if (Object.assign)
return Object.assign.apply(Object, [obj].concat(args));
return objAssign.apply(void 0, [obj].concat(args));
} | [
"function",
"assign",
"(",
"obj",
")",
"{",
"var",
"args",
"=",
"[",
"]",
";",
"for",
"(",
"var",
"_i",
"=",
"1",
";",
"_i",
"<",
"arguments",
".",
"length",
";",
"_i",
"++",
")",
"{",
"args",
"[",
"_i",
"-",
"1",
"]",
"=",
"arguments",
"[",
... | Uses Object.assign if available or falls back to polyfill.
@param obj object to assign.
@param args additional source object. | [
"Uses",
"Object",
".",
"assign",
"if",
"available",
"or",
"falls",
"back",
"to",
"polyfill",
"."
] | 6bc3ab0ac36126cc7918a244a606009749897b2e | https://github.com/origin1tech/chek/blob/6bc3ab0ac36126cc7918a244a606009749897b2e/dist/modules/object.js#L127-L135 | train |
origin1tech/chek | dist/modules/object.js | del | function del(obj, key, immutable) {
if (immutable)
return _del(assign({}, obj), key);
return _del(obj, key);
} | javascript | function del(obj, key, immutable) {
if (immutable)
return _del(assign({}, obj), key);
return _del(obj, key);
} | [
"function",
"del",
"(",
"obj",
",",
"key",
",",
"immutable",
")",
"{",
"if",
"(",
"immutable",
")",
"return",
"_del",
"(",
"assign",
"(",
"{",
"}",
",",
"obj",
")",
",",
"key",
")",
";",
"return",
"_del",
"(",
"obj",
",",
"key",
")",
";",
"}"
] | Del
Removes a property within the supplied object.
@param obj the object to inspect.
@param key the dot notated key or array of keys.
@param immutable when true original object NOT mutated. | [
"Del",
"Removes",
"a",
"property",
"within",
"the",
"supplied",
"object",
"."
] | 6bc3ab0ac36126cc7918a244a606009749897b2e | https://github.com/origin1tech/chek/blob/6bc3ab0ac36126cc7918a244a606009749897b2e/dist/modules/object.js#L145-L149 | train |
origin1tech/chek | dist/modules/object.js | get | function get(obj, key, def) {
var result = _get(assign({}, obj), key);
if (!is_1.isValue(result) && def) {
_set(obj, key, def);
result = def;
}
return result;
} | javascript | function get(obj, key, def) {
var result = _get(assign({}, obj), key);
if (!is_1.isValue(result) && def) {
_set(obj, key, def);
result = def;
}
return result;
} | [
"function",
"get",
"(",
"obj",
",",
"key",
",",
"def",
")",
"{",
"var",
"result",
"=",
"_get",
"(",
"assign",
"(",
"{",
"}",
",",
"obj",
")",
",",
"key",
")",
";",
"if",
"(",
"!",
"is_1",
".",
"isValue",
"(",
"result",
")",
"&&",
"def",
")",
... | Get
Gets a property within the supplied object.
@param obj the object to inspect.
@param key the dot notated key or array of keys.
@param def a default value to set if not exists. | [
"Get",
"Gets",
"a",
"property",
"within",
"the",
"supplied",
"object",
"."
] | 6bc3ab0ac36126cc7918a244a606009749897b2e | https://github.com/origin1tech/chek/blob/6bc3ab0ac36126cc7918a244a606009749897b2e/dist/modules/object.js#L159-L166 | train |
origin1tech/chek | dist/modules/object.js | has | function has(obj, key) {
if (!is_1.isObject(obj) || (!is_1.isArray(key) && !is_1.isString(key)))
return false;
obj = assign({}, obj);
var props = is_1.isArray(key) ? key : string_1.split(key);
while (props.length && obj) {
var prop = props.shift(), match = matchIndex(prop);
if (!... | javascript | function has(obj, key) {
if (!is_1.isObject(obj) || (!is_1.isArray(key) && !is_1.isString(key)))
return false;
obj = assign({}, obj);
var props = is_1.isArray(key) ? key : string_1.split(key);
while (props.length && obj) {
var prop = props.shift(), match = matchIndex(prop);
if (!... | [
"function",
"has",
"(",
"obj",
",",
"key",
")",
"{",
"if",
"(",
"!",
"is_1",
".",
"isObject",
"(",
"obj",
")",
"||",
"(",
"!",
"is_1",
".",
"isArray",
"(",
"key",
")",
"&&",
"!",
"is_1",
".",
"isString",
"(",
"key",
")",
")",
")",
"return",
"... | Has
Checks if property exists in object.
@param obj the object to be inpsected.
@param key the key to be found. | [
"Has",
"Checks",
"if",
"property",
"exists",
"in",
"object",
"."
] | 6bc3ab0ac36126cc7918a244a606009749897b2e | https://github.com/origin1tech/chek/blob/6bc3ab0ac36126cc7918a244a606009749897b2e/dist/modules/object.js#L175-L203 | train |
origin1tech/chek | dist/modules/object.js | clone | function clone(obj, json) {
if (json)
return JSON.parse(JSON.stringify(obj));
return _clone(obj);
} | javascript | function clone(obj, json) {
if (json)
return JSON.parse(JSON.stringify(obj));
return _clone(obj);
} | [
"function",
"clone",
"(",
"obj",
",",
"json",
")",
"{",
"if",
"(",
"json",
")",
"return",
"JSON",
".",
"parse",
"(",
"JSON",
".",
"stringify",
"(",
"obj",
")",
")",
";",
"return",
"_clone",
"(",
"obj",
")",
";",
"}"
] | Clone
Performs deep cloning of objects.
@param obj object to be cloned.
@param json performs quick shallow clone using JSON. | [
"Clone",
"Performs",
"deep",
"cloning",
"of",
"objects",
"."
] | 6bc3ab0ac36126cc7918a244a606009749897b2e | https://github.com/origin1tech/chek/blob/6bc3ab0ac36126cc7918a244a606009749897b2e/dist/modules/object.js#L212-L216 | train |
origin1tech/chek | dist/modules/object.js | put | function put(obj, key, val, immutable) {
if (immutable)
return _put(assign({}, obj), key, val);
return _put(obj, key, val);
} | javascript | function put(obj, key, val, immutable) {
if (immutable)
return _put(assign({}, obj), key, val);
return _put(obj, key, val);
} | [
"function",
"put",
"(",
"obj",
",",
"key",
",",
"val",
",",
"immutable",
")",
"{",
"if",
"(",
"immutable",
")",
"return",
"_put",
"(",
"assign",
"(",
"{",
"}",
",",
"obj",
")",
",",
"key",
",",
"val",
")",
";",
"return",
"_put",
"(",
"obj",
","... | Put a value to key. If the value is not currently an array it converts.
@param obj the object to push value to.
@param key the key or array of keys to be joined as dot notation.
@param val the value to be pushed.
@param immutable when true update in immutable mode. | [
"Put",
"a",
"value",
"to",
"key",
".",
"If",
"the",
"value",
"is",
"not",
"currently",
"an",
"array",
"it",
"converts",
"."
] | 6bc3ab0ac36126cc7918a244a606009749897b2e | https://github.com/origin1tech/chek/blob/6bc3ab0ac36126cc7918a244a606009749897b2e/dist/modules/object.js#L285-L289 | train |
origin1tech/chek | dist/modules/object.js | reverse | function reverse(obj) {
if (!is_1.isValue(obj))
return null;
// Reverse an array.
if (is_1.isArray(obj))
return obj.reverse();
// Reverse a string.
if (is_1.isString(obj)) {
var i = obj.toString().length;
var tmpStr = '';
while (i--)
tmpStr += obj[... | javascript | function reverse(obj) {
if (!is_1.isValue(obj))
return null;
// Reverse an array.
if (is_1.isArray(obj))
return obj.reverse();
// Reverse a string.
if (is_1.isString(obj)) {
var i = obj.toString().length;
var tmpStr = '';
while (i--)
tmpStr += obj[... | [
"function",
"reverse",
"(",
"obj",
")",
"{",
"if",
"(",
"!",
"is_1",
".",
"isValue",
"(",
"obj",
")",
")",
"return",
"null",
";",
"// Reverse an array.",
"if",
"(",
"is_1",
".",
"isArray",
"(",
"obj",
")",
")",
"return",
"obj",
".",
"reverse",
"(",
... | Reverse
Reverses arrays, strings or objects.
Only numbers, strings or booleans are supported
when reverse mapping objects.
@param obj the object to reverse. | [
"Reverse",
"Reverses",
"arrays",
"strings",
"or",
"objects",
".",
"Only",
"numbers",
"strings",
"or",
"booleans",
"are",
"supported",
"when",
"reverse",
"mapping",
"objects",
"."
] | 6bc3ab0ac36126cc7918a244a606009749897b2e | https://github.com/origin1tech/chek/blob/6bc3ab0ac36126cc7918a244a606009749897b2e/dist/modules/object.js#L299-L321 | train |
origin1tech/chek | dist/modules/object.js | set | function set(obj, key, val, immutable) {
if (immutable)
return _set(assign({}, obj), key, val);
return _set(obj, key, val);
} | javascript | function set(obj, key, val, immutable) {
if (immutable)
return _set(assign({}, obj), key, val);
return _set(obj, key, val);
} | [
"function",
"set",
"(",
"obj",
",",
"key",
",",
"val",
",",
"immutable",
")",
"{",
"if",
"(",
"immutable",
")",
"return",
"_set",
"(",
"assign",
"(",
"{",
"}",
",",
"obj",
")",
",",
"key",
",",
"val",
")",
";",
"return",
"_set",
"(",
"obj",
","... | Set
Sets a value on an object using dot notation or url path.
@todo need to refactor this method.
@param obj the object to set the value on.
@param key the property used for setting the value.
@param value the value used for updating the property.
@param immutable when true the original object is NOT mutated. | [
"Set",
"Sets",
"a",
"value",
"on",
"an",
"object",
"using",
"dot",
"notation",
"or",
"url",
"path",
"."
] | 6bc3ab0ac36126cc7918a244a606009749897b2e | https://github.com/origin1tech/chek/blob/6bc3ab0ac36126cc7918a244a606009749897b2e/dist/modules/object.js#L335-L339 | train |
origin1tech/chek | dist/modules/object.js | pick | function pick(obj, props) {
props = to_1.toArray(props, []);
if (!is_1.isValue(obj) || !is_1.isObject(obj) || !props || !props.length)
return obj;
return props.reduce(function (a, c) {
var val = get(obj, c, undefined);
if (is_1.isUndefined(val))
return a;
return s... | javascript | function pick(obj, props) {
props = to_1.toArray(props, []);
if (!is_1.isValue(obj) || !is_1.isObject(obj) || !props || !props.length)
return obj;
return props.reduce(function (a, c) {
var val = get(obj, c, undefined);
if (is_1.isUndefined(val))
return a;
return s... | [
"function",
"pick",
"(",
"obj",
",",
"props",
")",
"{",
"props",
"=",
"to_1",
".",
"toArray",
"(",
"props",
",",
"[",
"]",
")",
";",
"if",
"(",
"!",
"is_1",
".",
"isValue",
"(",
"obj",
")",
"||",
"!",
"is_1",
".",
"isObject",
"(",
"obj",
")",
... | Picks values from object by property name.
@param obj the object to pick from.
@param props the properties to be picked. | [
"Picks",
"values",
"from",
"object",
"by",
"property",
"name",
"."
] | 6bc3ab0ac36126cc7918a244a606009749897b2e | https://github.com/origin1tech/chek/blob/6bc3ab0ac36126cc7918a244a606009749897b2e/dist/modules/object.js#L382-L392 | train |
bootprint/customize-watch | index.js | wrap | function wrap (fnName) {
/* dynamic arguments */
return function () {
var args = arguments
return new Recustomize(function () {
var customize = builder()
return customize[fnName].apply(customize, args)
})
}
} | javascript | function wrap (fnName) {
/* dynamic arguments */
return function () {
var args = arguments
return new Recustomize(function () {
var customize = builder()
return customize[fnName].apply(customize, args)
})
}
} | [
"function",
"wrap",
"(",
"fnName",
")",
"{",
"/* dynamic arguments */",
"return",
"function",
"(",
")",
"{",
"var",
"args",
"=",
"arguments",
"return",
"new",
"Recustomize",
"(",
"function",
"(",
")",
"{",
"var",
"customize",
"=",
"builder",
"(",
")",
"ret... | Wrap the method of a Customize object such that
instead of the new Customize object, new Recustomize object
with the appropriate builder-function is returned
@param fnName
@returns {Function}
@api private | [
"Wrap",
"the",
"method",
"of",
"a",
"Customize",
"object",
"such",
"that",
"instead",
"of",
"the",
"new",
"Customize",
"object",
"new",
"Recustomize",
"object",
"with",
"the",
"appropriate",
"builder",
"-",
"function",
"is",
"returned"
] | 61135b5f4d956d5a231551cc565d56da08ca7e3d | https://github.com/bootprint/customize-watch/blob/61135b5f4d956d5a231551cc565d56da08ca7e3d/index.js#L45-L54 | train |
MakerCollider/upm_mc | doxy/node/tolower.js | getHtmlFilenames | function getHtmlFilenames (directory)
{
return fs.readdirSync(directory).map(function (file) {
return path.join(directory, file);
}).filter(function (file) {
return fs.statSync(file).isFile();
}).filter(function (file) {
return path.extname(file).toLowerCase() == ".html";
});
} | javascript | function getHtmlFilenames (directory)
{
return fs.readdirSync(directory).map(function (file) {
return path.join(directory, file);
}).filter(function (file) {
return fs.statSync(file).isFile();
}).filter(function (file) {
return path.extname(file).toLowerCase() == ".html";
});
} | [
"function",
"getHtmlFilenames",
"(",
"directory",
")",
"{",
"return",
"fs",
".",
"readdirSync",
"(",
"directory",
")",
".",
"map",
"(",
"function",
"(",
"file",
")",
"{",
"return",
"path",
".",
"join",
"(",
"directory",
",",
"file",
")",
";",
"}",
")",... | Helper function that returns paths to the html files in the specified directory | [
"Helper",
"function",
"that",
"returns",
"paths",
"to",
"the",
"html",
"files",
"in",
"the",
"specified",
"directory"
] | 525e775a17b85c30716c00435a2acb26bb198c12 | https://github.com/MakerCollider/upm_mc/blob/525e775a17b85c30716c00435a2acb26bb198c12/doxy/node/tolower.js#L58-L67 | train |
nodejitsu/packages-pagelet | example/filecache.js | Filecache | function Filecache(options) {
options = options || {};
this.directory = options.directory || path.join(__dirname, '/.cache');
this.fresh = +options.fresh || 500000;
} | javascript | function Filecache(options) {
options = options || {};
this.directory = options.directory || path.join(__dirname, '/.cache');
this.fresh = +options.fresh || 500000;
} | [
"function",
"Filecache",
"(",
"options",
")",
"{",
"options",
"=",
"options",
"||",
"{",
"}",
";",
"this",
".",
"directory",
"=",
"options",
".",
"directory",
"||",
"path",
".",
"join",
"(",
"__dirname",
",",
"'/.cache'",
")",
";",
"this",
".",
"fresh"... | Really minimal implementation of a data cache sytem. This should not be used
in production it merely serves as an example of caching the data to speedup
the rendering of the pages.
@constructor
@param {Object} options Configuration.
@api public | [
"Really",
"minimal",
"implementation",
"of",
"a",
"data",
"cache",
"sytem",
".",
"This",
"should",
"not",
"be",
"used",
"in",
"production",
"it",
"merely",
"serves",
"as",
"an",
"example",
"of",
"caching",
"the",
"data",
"to",
"speedup",
"the",
"rendering",
... | 10c4bdb1a99a808b58e41d87c8e7ec8c9947a3d8 | https://github.com/nodejitsu/packages-pagelet/blob/10c4bdb1a99a808b58e41d87c8e7ec8c9947a3d8/example/filecache.js#L15-L20 | train |
artdecocode/makepromise | build/index.js | makePromise | async function makePromise(fn, args, resolveValue) {
const er = erotic(true)
if (typeof fn !== 'function') {
throw new Error('Function must be passed.')
}
const { length: fnLength } = fn
if (!fnLength) {
throw new Error('Function does not accept any arguments.')
}
const res = await new Promise((r... | javascript | async function makePromise(fn, args, resolveValue) {
const er = erotic(true)
if (typeof fn !== 'function') {
throw new Error('Function must be passed.')
}
const { length: fnLength } = fn
if (!fnLength) {
throw new Error('Function does not accept any arguments.')
}
const res = await new Promise((r... | [
"async",
"function",
"makePromise",
"(",
"fn",
",",
"args",
",",
"resolveValue",
")",
"{",
"const",
"er",
"=",
"erotic",
"(",
"true",
")",
"if",
"(",
"typeof",
"fn",
"!==",
"'function'",
")",
"{",
"throw",
"new",
"Error",
"(",
"'Function must be passed.'",... | Get a promise from a function which otherwise accepts a callback.
@param {Function} fn A function to promisify.
@param {*|Array<*>} [args] An array of arguments to use in the call, or a single argument.
@param {*} [resolveValue] A value to override the value with which the promise will be resolved.
@returns {Promise<*>... | [
"Get",
"a",
"promise",
"from",
"a",
"function",
"which",
"otherwise",
"accepts",
"a",
"callback",
"."
] | 2cea573b4c5379f05404632efef08a4235fb22a0 | https://github.com/artdecocode/makepromise/blob/2cea573b4c5379f05404632efef08a4235fb22a0/build/index.js#L16-L49 | train |
on-point/thin-orm | drivers/pg.js | function(table, result) {
if (result && result.rows && result.rows.length > 0)
return result.rows[0][table.id];
return -1;
} | javascript | function(table, result) {
if (result && result.rows && result.rows.length > 0)
return result.rows[0][table.id];
return -1;
} | [
"function",
"(",
"table",
",",
"result",
")",
"{",
"if",
"(",
"result",
"&&",
"result",
".",
"rows",
"&&",
"result",
".",
"rows",
".",
"length",
">",
"0",
")",
"return",
"result",
".",
"rows",
"[",
"0",
"]",
"[",
"table",
".",
"id",
"]",
";",
"... | gets the id of a new row from the result of an INSERT query | [
"gets",
"the",
"id",
"of",
"a",
"new",
"row",
"from",
"the",
"result",
"of",
"an",
"INSERT",
"query"
] | 761783a133ef6983f46060af68febc07e1f880e8 | https://github.com/on-point/thin-orm/blob/761783a133ef6983f46060af68febc07e1f880e8/drivers/pg.js#L27-L31 | train | |
averta-lab/touch-swipe | lib/touchSwipe.es.js | unbindEvents | function unbindEvents(target, events, listener) {
events.split(' ').forEach(function (event) {
return target.removeEventListener(event, listener, false);
});
} | javascript | function unbindEvents(target, events, listener) {
events.split(' ').forEach(function (event) {
return target.removeEventListener(event, listener, false);
});
} | [
"function",
"unbindEvents",
"(",
"target",
",",
"events",
",",
"listener",
")",
"{",
"events",
".",
"split",
"(",
"' '",
")",
".",
"forEach",
"(",
"function",
"(",
"event",
")",
"{",
"return",
"target",
".",
"removeEventListener",
"(",
"event",
",",
"lis... | Unbind multiple events on one element
@param {Element} target Target element
@param {String} events List of events separated by space
@param {Function} listener Event listener | [
"Unbind",
"multiple",
"events",
"on",
"one",
"element"
] | ffd3da21f8a0590a7a47603b32b1003fcfd330f8 | https://github.com/averta-lab/touch-swipe/blob/ffd3da21f8a0590a7a47603b32b1003fcfd330f8/lib/touchSwipe.es.js#L55-L59 | train |
Subsets and Splits
SQL Console for semeru/code-text-javascript
Retrieves 20,000 non-null code samples labeled as JavaScript, providing a basic overview of the dataset.