id
int32 0
58k
| repo
stringlengths 5
67
| path
stringlengths 4
116
| func_name
stringlengths 0
58
| original_string
stringlengths 52
373k
| language
stringclasses 1
value | code
stringlengths 52
373k
| code_tokens
sequence | docstring
stringlengths 4
11.8k
| docstring_tokens
sequence | sha
stringlengths 40
40
| url
stringlengths 86
226
|
---|---|---|---|---|---|---|---|---|---|---|---|
53,100 | sendanor/nor-rest | src/cookies.js | get_cookies | function get_cookies(url) {
debug.assert(url).is('object');
debug.assert(url.host).is('string');
if(!is.array(_cookies[url.host])) {
//debug.log('No cookies for host ', url.host);
return undefined;
}
var cookies = ARRAY(_cookies[url.host]).map(function(cookie) {
var i = cookie.indexOf(';');
return cookie.substr(0, ((i >= 1) ? i : cookie.length));
}).valueOf();
//debug.log('Cookies found (for host ', url.host ,'): ', cookies);
return cookies;
} | javascript | function get_cookies(url) {
debug.assert(url).is('object');
debug.assert(url.host).is('string');
if(!is.array(_cookies[url.host])) {
//debug.log('No cookies for host ', url.host);
return undefined;
}
var cookies = ARRAY(_cookies[url.host]).map(function(cookie) {
var i = cookie.indexOf(';');
return cookie.substr(0, ((i >= 1) ? i : cookie.length));
}).valueOf();
//debug.log('Cookies found (for host ', url.host ,'): ', cookies);
return cookies;
} | [
"function",
"get_cookies",
"(",
"url",
")",
"{",
"debug",
".",
"assert",
"(",
"url",
")",
".",
"is",
"(",
"'object'",
")",
";",
"debug",
".",
"assert",
"(",
"url",
".",
"host",
")",
".",
"is",
"(",
"'string'",
")",
";",
"if",
"(",
"!",
"is",
".",
"array",
"(",
"_cookies",
"[",
"url",
".",
"host",
"]",
")",
")",
"{",
"//debug.log('No cookies for host ', url.host);",
"return",
"undefined",
";",
"}",
"var",
"cookies",
"=",
"ARRAY",
"(",
"_cookies",
"[",
"url",
".",
"host",
"]",
")",
".",
"map",
"(",
"function",
"(",
"cookie",
")",
"{",
"var",
"i",
"=",
"cookie",
".",
"indexOf",
"(",
"';'",
")",
";",
"return",
"cookie",
".",
"substr",
"(",
"0",
",",
"(",
"(",
"i",
">=",
"1",
")",
"?",
"i",
":",
"cookie",
".",
"length",
")",
")",
";",
"}",
")",
".",
"valueOf",
"(",
")",
";",
"//debug.log('Cookies found (for host ', url.host ,'): ', cookies);",
"return",
"cookies",
";",
"}"
] | Get Cookie header line for an URL
@params url {object} The parsed object | [
"Get",
"Cookie",
"header",
"line",
"for",
"an",
"URL"
] | b2571e689c7a7e5129e361a7c66c7e5e946d4ca1 | https://github.com/sendanor/nor-rest/blob/b2571e689c7a7e5129e361a7c66c7e5e946d4ca1/src/cookies.js#L16-L33 |
53,101 | sendanor/nor-rest | src/cookies.js | set_cookies | function set_cookies(url, cookies) {
if(is.string(cookies)) {
cookies = [cookies];
}
debug.assert(url).is('object');
debug.assert(url.host).is('string');
debug.assert(cookies).is('array');
//debug.log('Saving cookies for host = ', url.host);
if(!is.array(_cookies[url.host])) {
_cookies[url.host] = cookies;
//debug.log('Saved new cookies as: ', _cookies[url.host]);
return;
}
var tmp = {};
function save_cookie(cookie) {
var i = cookie.indexOf('=');
var name = cookie.substr(0, ((i >= 1) ? i : cookie.length));
tmp[name] = cookie;
}
ARRAY(_cookies[url.host]).forEach(save_cookie);
ARRAY(cookies).forEach(save_cookie);
_cookies[url.host] = ARRAY(Object.keys(tmp)).map(function(key) { return tmp[key]; }).valueOf();
//debug.log('Saved new cookies as: ', _cookies[url.host]);
} | javascript | function set_cookies(url, cookies) {
if(is.string(cookies)) {
cookies = [cookies];
}
debug.assert(url).is('object');
debug.assert(url.host).is('string');
debug.assert(cookies).is('array');
//debug.log('Saving cookies for host = ', url.host);
if(!is.array(_cookies[url.host])) {
_cookies[url.host] = cookies;
//debug.log('Saved new cookies as: ', _cookies[url.host]);
return;
}
var tmp = {};
function save_cookie(cookie) {
var i = cookie.indexOf('=');
var name = cookie.substr(0, ((i >= 1) ? i : cookie.length));
tmp[name] = cookie;
}
ARRAY(_cookies[url.host]).forEach(save_cookie);
ARRAY(cookies).forEach(save_cookie);
_cookies[url.host] = ARRAY(Object.keys(tmp)).map(function(key) { return tmp[key]; }).valueOf();
//debug.log('Saved new cookies as: ', _cookies[url.host]);
} | [
"function",
"set_cookies",
"(",
"url",
",",
"cookies",
")",
"{",
"if",
"(",
"is",
".",
"string",
"(",
"cookies",
")",
")",
"{",
"cookies",
"=",
"[",
"cookies",
"]",
";",
"}",
"debug",
".",
"assert",
"(",
"url",
")",
".",
"is",
"(",
"'object'",
")",
";",
"debug",
".",
"assert",
"(",
"url",
".",
"host",
")",
".",
"is",
"(",
"'string'",
")",
";",
"debug",
".",
"assert",
"(",
"cookies",
")",
".",
"is",
"(",
"'array'",
")",
";",
"//debug.log('Saving cookies for host = ', url.host);",
"if",
"(",
"!",
"is",
".",
"array",
"(",
"_cookies",
"[",
"url",
".",
"host",
"]",
")",
")",
"{",
"_cookies",
"[",
"url",
".",
"host",
"]",
"=",
"cookies",
";",
"//debug.log('Saved new cookies as: ', _cookies[url.host]);",
"return",
";",
"}",
"var",
"tmp",
"=",
"{",
"}",
";",
"function",
"save_cookie",
"(",
"cookie",
")",
"{",
"var",
"i",
"=",
"cookie",
".",
"indexOf",
"(",
"'='",
")",
";",
"var",
"name",
"=",
"cookie",
".",
"substr",
"(",
"0",
",",
"(",
"(",
"i",
">=",
"1",
")",
"?",
"i",
":",
"cookie",
".",
"length",
")",
")",
";",
"tmp",
"[",
"name",
"]",
"=",
"cookie",
";",
"}",
"ARRAY",
"(",
"_cookies",
"[",
"url",
".",
"host",
"]",
")",
".",
"forEach",
"(",
"save_cookie",
")",
";",
"ARRAY",
"(",
"cookies",
")",
".",
"forEach",
"(",
"save_cookie",
")",
";",
"_cookies",
"[",
"url",
".",
"host",
"]",
"=",
"ARRAY",
"(",
"Object",
".",
"keys",
"(",
"tmp",
")",
")",
".",
"map",
"(",
"function",
"(",
"key",
")",
"{",
"return",
"tmp",
"[",
"key",
"]",
";",
"}",
")",
".",
"valueOf",
"(",
")",
";",
"//debug.log('Saved new cookies as: ', _cookies[url.host]);",
"}"
] | Update cookie cache
@params url {object} The parsed URL object
@params cookies {array|string} The array of cookies or single cookie | [
"Update",
"cookie",
"cache"
] | b2571e689c7a7e5129e361a7c66c7e5e946d4ca1 | https://github.com/sendanor/nor-rest/blob/b2571e689c7a7e5129e361a7c66c7e5e946d4ca1/src/cookies.js#L39-L69 |
53,102 | Bartvds/miniwrite | lib/log.js | grunt | function grunt(gruntInst, verbose, patch) {
var mw = (patch || core.base());
mw.enabled = true;
if (verbose) {
mw.writeln = function (line) {
if (mw.enabled) {
gruntInst.verbose.writeln(line);
}
};
}
else {
mw.writeln = function (line) {
if (mw.enabled) {
gruntInst.log.writeln(line);
}
};
}
if (!patch) {
mw.toString = function () {
return '<miniwrite-grunt>';
};
}
return mw;
} | javascript | function grunt(gruntInst, verbose, patch) {
var mw = (patch || core.base());
mw.enabled = true;
if (verbose) {
mw.writeln = function (line) {
if (mw.enabled) {
gruntInst.verbose.writeln(line);
}
};
}
else {
mw.writeln = function (line) {
if (mw.enabled) {
gruntInst.log.writeln(line);
}
};
}
if (!patch) {
mw.toString = function () {
return '<miniwrite-grunt>';
};
}
return mw;
} | [
"function",
"grunt",
"(",
"gruntInst",
",",
"verbose",
",",
"patch",
")",
"{",
"var",
"mw",
"=",
"(",
"patch",
"||",
"core",
".",
"base",
"(",
")",
")",
";",
"mw",
".",
"enabled",
"=",
"true",
";",
"if",
"(",
"verbose",
")",
"{",
"mw",
".",
"writeln",
"=",
"function",
"(",
"line",
")",
"{",
"if",
"(",
"mw",
".",
"enabled",
")",
"{",
"gruntInst",
".",
"verbose",
".",
"writeln",
"(",
"line",
")",
";",
"}",
"}",
";",
"}",
"else",
"{",
"mw",
".",
"writeln",
"=",
"function",
"(",
"line",
")",
"{",
"if",
"(",
"mw",
".",
"enabled",
")",
"{",
"gruntInst",
".",
"log",
".",
"writeln",
"(",
"line",
")",
";",
"}",
"}",
";",
"}",
"if",
"(",
"!",
"patch",
")",
"{",
"mw",
".",
"toString",
"=",
"function",
"(",
")",
"{",
"return",
"'<miniwrite-grunt>'",
";",
"}",
";",
"}",
"return",
"mw",
";",
"}"
] | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - grunt lazy | [
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"grunt",
"lazy"
] | 0b716dfdd203e20bdf71b552d1776ade8a55ced5 | https://github.com/Bartvds/miniwrite/blob/0b716dfdd203e20bdf71b552d1776ade8a55ced5/lib/log.js#L75-L98 |
53,103 | tgi-io/tgi-core | lib/core/tgi-core-store.spec.js | stoogeStored | function stoogeStored(model, error) {
if (typeof error != 'undefined') {
callback(error);
return;
}
try {
self.stoogeIDsStored.push(model.get('id'));
//console.log('Now we have moe ' + self.moe.get('id'));
//console.log('model says ' + model.get('id'));
if (self.stoogeIDsStored.length == 3) {
// Now that first 3 stooges are stored lets retrieve and verify
var actors = [];
for (var i = 0; i < 3; i++) {
actors.push(new self.Stooge());
actors[i].set('id', self.stoogeIDsStored[i]);
spec.integrationStore.getModel(actors[i], stoogeRetrieved);
}
}
}
catch (err) {
callback(err);
}
} | javascript | function stoogeStored(model, error) {
if (typeof error != 'undefined') {
callback(error);
return;
}
try {
self.stoogeIDsStored.push(model.get('id'));
//console.log('Now we have moe ' + self.moe.get('id'));
//console.log('model says ' + model.get('id'));
if (self.stoogeIDsStored.length == 3) {
// Now that first 3 stooges are stored lets retrieve and verify
var actors = [];
for (var i = 0; i < 3; i++) {
actors.push(new self.Stooge());
actors[i].set('id', self.stoogeIDsStored[i]);
spec.integrationStore.getModel(actors[i], stoogeRetrieved);
}
}
}
catch (err) {
callback(err);
}
} | [
"function",
"stoogeStored",
"(",
"model",
",",
"error",
")",
"{",
"if",
"(",
"typeof",
"error",
"!=",
"'undefined'",
")",
"{",
"callback",
"(",
"error",
")",
";",
"return",
";",
"}",
"try",
"{",
"self",
".",
"stoogeIDsStored",
".",
"push",
"(",
"model",
".",
"get",
"(",
"'id'",
")",
")",
";",
"//console.log('Now we have moe ' + self.moe.get('id'));",
"//console.log('model says ' + model.get('id'));",
"if",
"(",
"self",
".",
"stoogeIDsStored",
".",
"length",
"==",
"3",
")",
"{",
"// Now that first 3 stooges are stored lets retrieve and verify",
"var",
"actors",
"=",
"[",
"]",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"3",
";",
"i",
"++",
")",
"{",
"actors",
".",
"push",
"(",
"new",
"self",
".",
"Stooge",
"(",
")",
")",
";",
"actors",
"[",
"i",
"]",
".",
"set",
"(",
"'id'",
",",
"self",
".",
"stoogeIDsStored",
"[",
"i",
"]",
")",
";",
"spec",
".",
"integrationStore",
".",
"getModel",
"(",
"actors",
"[",
"i",
"]",
",",
"stoogeRetrieved",
")",
";",
"}",
"}",
"}",
"catch",
"(",
"err",
")",
"{",
"callback",
"(",
"err",
")",
";",
"}",
"}"
] | callback after storing stooges | [
"callback",
"after",
"storing",
"stooges"
] | d965f11e9b168d5a401d9e2627f2786b5e4bcf30 | https://github.com/tgi-io/tgi-core/blob/d965f11e9b168d5a401d9e2627f2786b5e4bcf30/lib/core/tgi-core-store.spec.js#L402-L424 |
53,104 | tgi-io/tgi-core | lib/core/tgi-core-store.spec.js | createLines | function createLines() {
var moesLine = new self.StoogeLine();
moesLine.set('Scene', 1);
moesLine.set('SetID', self.indoorSet.get('id'));
moesLine.set('StoogeID', self.moe.get('id'));
moesLine.set('Line', 'To be or not to be?');
var larrysLine = new self.StoogeLine();
larrysLine.set('Scene', 2);
larrysLine.set('SetID', self.desertSet.get('id'));
larrysLine.set('StoogeID', self.larry.get('id'));
larrysLine.set('Line', 'That is the question!');
spec.integrationStore.putModel(moesLine, function (model, error) {
if (typeof error != 'undefined') {
callback(error);
} else {
spec.integrationStore.putModel(larrysLine, function (model, error) {
if (typeof error != 'undefined') {
callback(error);
} else {
createView();
}
});
}
});
} | javascript | function createLines() {
var moesLine = new self.StoogeLine();
moesLine.set('Scene', 1);
moesLine.set('SetID', self.indoorSet.get('id'));
moesLine.set('StoogeID', self.moe.get('id'));
moesLine.set('Line', 'To be or not to be?');
var larrysLine = new self.StoogeLine();
larrysLine.set('Scene', 2);
larrysLine.set('SetID', self.desertSet.get('id'));
larrysLine.set('StoogeID', self.larry.get('id'));
larrysLine.set('Line', 'That is the question!');
spec.integrationStore.putModel(moesLine, function (model, error) {
if (typeof error != 'undefined') {
callback(error);
} else {
spec.integrationStore.putModel(larrysLine, function (model, error) {
if (typeof error != 'undefined') {
callback(error);
} else {
createView();
}
});
}
});
} | [
"function",
"createLines",
"(",
")",
"{",
"var",
"moesLine",
"=",
"new",
"self",
".",
"StoogeLine",
"(",
")",
";",
"moesLine",
".",
"set",
"(",
"'Scene'",
",",
"1",
")",
";",
"moesLine",
".",
"set",
"(",
"'SetID'",
",",
"self",
".",
"indoorSet",
".",
"get",
"(",
"'id'",
")",
")",
";",
"moesLine",
".",
"set",
"(",
"'StoogeID'",
",",
"self",
".",
"moe",
".",
"get",
"(",
"'id'",
")",
")",
";",
"moesLine",
".",
"set",
"(",
"'Line'",
",",
"'To be or not to be?'",
")",
";",
"var",
"larrysLine",
"=",
"new",
"self",
".",
"StoogeLine",
"(",
")",
";",
"larrysLine",
".",
"set",
"(",
"'Scene'",
",",
"2",
")",
";",
"larrysLine",
".",
"set",
"(",
"'SetID'",
",",
"self",
".",
"desertSet",
".",
"get",
"(",
"'id'",
")",
")",
";",
"larrysLine",
".",
"set",
"(",
"'StoogeID'",
",",
"self",
".",
"larry",
".",
"get",
"(",
"'id'",
")",
")",
";",
"larrysLine",
".",
"set",
"(",
"'Line'",
",",
"'That is the question!'",
")",
";",
"spec",
".",
"integrationStore",
".",
"putModel",
"(",
"moesLine",
",",
"function",
"(",
"model",
",",
"error",
")",
"{",
"if",
"(",
"typeof",
"error",
"!=",
"'undefined'",
")",
"{",
"callback",
"(",
"error",
")",
";",
"}",
"else",
"{",
"spec",
".",
"integrationStore",
".",
"putModel",
"(",
"larrysLine",
",",
"function",
"(",
"model",
",",
"error",
")",
"{",
"if",
"(",
"typeof",
"error",
"!=",
"'undefined'",
")",
"{",
"callback",
"(",
"error",
")",
";",
"}",
"else",
"{",
"createView",
"(",
")",
";",
"}",
"}",
")",
";",
"}",
"}",
")",
";",
"}"
] | Prepare the rest of the store for testing getList with View type list | [
"Prepare",
"the",
"rest",
"of",
"the",
"store",
"for",
"testing",
"getList",
"with",
"View",
"type",
"list"
] | d965f11e9b168d5a401d9e2627f2786b5e4bcf30 | https://github.com/tgi-io/tgi-core/blob/d965f11e9b168d5a401d9e2627f2786b5e4bcf30/lib/core/tgi-core-store.spec.js#L572-L596 |
53,105 | Bartvds/miniwrite | lib/core.js | toggle | function toggle(main, alt) {
var mw = core.base();
mw.main = main;
mw.alt = (alt || function () {
});
mw.active = mw.main;
mw.enabled = true;
mw.swap = function () {
mw.active = (mw.active !== mw.main ? mw.main : mw.alt);
};
mw.writeln = function (line) {
if (!mw.enabled) {
return;
}
if (mw.enabled) {
mw.active.writeln(line);
}
};
mw.toString = function () {
return '<miniwrite-toggle>';
};
return mw;
} | javascript | function toggle(main, alt) {
var mw = core.base();
mw.main = main;
mw.alt = (alt || function () {
});
mw.active = mw.main;
mw.enabled = true;
mw.swap = function () {
mw.active = (mw.active !== mw.main ? mw.main : mw.alt);
};
mw.writeln = function (line) {
if (!mw.enabled) {
return;
}
if (mw.enabled) {
mw.active.writeln(line);
}
};
mw.toString = function () {
return '<miniwrite-toggle>';
};
return mw;
} | [
"function",
"toggle",
"(",
"main",
",",
"alt",
")",
"{",
"var",
"mw",
"=",
"core",
".",
"base",
"(",
")",
";",
"mw",
".",
"main",
"=",
"main",
";",
"mw",
".",
"alt",
"=",
"(",
"alt",
"||",
"function",
"(",
")",
"{",
"}",
")",
";",
"mw",
".",
"active",
"=",
"mw",
".",
"main",
";",
"mw",
".",
"enabled",
"=",
"true",
";",
"mw",
".",
"swap",
"=",
"function",
"(",
")",
"{",
"mw",
".",
"active",
"=",
"(",
"mw",
".",
"active",
"!==",
"mw",
".",
"main",
"?",
"mw",
".",
"main",
":",
"mw",
".",
"alt",
")",
";",
"}",
";",
"mw",
".",
"writeln",
"=",
"function",
"(",
"line",
")",
"{",
"if",
"(",
"!",
"mw",
".",
"enabled",
")",
"{",
"return",
";",
"}",
"if",
"(",
"mw",
".",
"enabled",
")",
"{",
"mw",
".",
"active",
".",
"writeln",
"(",
"line",
")",
";",
"}",
"}",
";",
"mw",
".",
"toString",
"=",
"function",
"(",
")",
"{",
"return",
"'<miniwrite-toggle>'",
";",
"}",
";",
"return",
"mw",
";",
"}"
] | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - control output | [
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"control",
"output"
] | 0b716dfdd203e20bdf71b552d1776ade8a55ced5 | https://github.com/Bartvds/miniwrite/blob/0b716dfdd203e20bdf71b552d1776ade8a55ced5/lib/core.js#L203-L226 |
53,106 | Bartvds/miniwrite | lib/core.js | multi | function multi(list /*, ... */) {
var mw = core.base();
mw.targets = (isArray(list) ? list : Array.prototype.slice.call(arguments.length, 0));
mw.enabled = true;
mw.writeln = function (line) {
if (mw.enabled) {
for (var i = 0, ii = mw.targets.length; i < ii; i++) {
mw.targets[i].writeln(line);
}
}
};
mw.toString = function () {
return '<miniwrite-multi>';
};
return mw;
} | javascript | function multi(list /*, ... */) {
var mw = core.base();
mw.targets = (isArray(list) ? list : Array.prototype.slice.call(arguments.length, 0));
mw.enabled = true;
mw.writeln = function (line) {
if (mw.enabled) {
for (var i = 0, ii = mw.targets.length; i < ii; i++) {
mw.targets[i].writeln(line);
}
}
};
mw.toString = function () {
return '<miniwrite-multi>';
};
return mw;
} | [
"function",
"multi",
"(",
"list",
"/*, ... */",
")",
"{",
"var",
"mw",
"=",
"core",
".",
"base",
"(",
")",
";",
"mw",
".",
"targets",
"=",
"(",
"isArray",
"(",
"list",
")",
"?",
"list",
":",
"Array",
".",
"prototype",
".",
"slice",
".",
"call",
"(",
"arguments",
".",
"length",
",",
"0",
")",
")",
";",
"mw",
".",
"enabled",
"=",
"true",
";",
"mw",
".",
"writeln",
"=",
"function",
"(",
"line",
")",
"{",
"if",
"(",
"mw",
".",
"enabled",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"ii",
"=",
"mw",
".",
"targets",
".",
"length",
";",
"i",
"<",
"ii",
";",
"i",
"++",
")",
"{",
"mw",
".",
"targets",
"[",
"i",
"]",
".",
"writeln",
"(",
"line",
")",
";",
"}",
"}",
"}",
";",
"mw",
".",
"toString",
"=",
"function",
"(",
")",
"{",
"return",
"'<miniwrite-multi>'",
";",
"}",
";",
"return",
"mw",
";",
"}"
] | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - call multiple other writers | [
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"call",
"multiple",
"other",
"writers"
] | 0b716dfdd203e20bdf71b552d1776ade8a55ced5 | https://github.com/Bartvds/miniwrite/blob/0b716dfdd203e20bdf71b552d1776ade8a55ced5/lib/core.js#L231-L246 |
53,107 | Bartvds/miniwrite | lib/core.js | peek | function peek(target, callback) {
var mw = core.base();
mw.enabled = true;
mw.target = target;
mw.callback = (callback || function (line /*, mw*/) {
return line;
});
mw.writeln = function (line) {
if (mw.enabled && mw.callback) {
line = mw.callback(line, mw);
if (typeof line === 'string') {
mw.target.writeln(line);
}
}
};
mw.toString = function () {
return '<miniwrite-peek>';
};
return mw;
} | javascript | function peek(target, callback) {
var mw = core.base();
mw.enabled = true;
mw.target = target;
mw.callback = (callback || function (line /*, mw*/) {
return line;
});
mw.writeln = function (line) {
if (mw.enabled && mw.callback) {
line = mw.callback(line, mw);
if (typeof line === 'string') {
mw.target.writeln(line);
}
}
};
mw.toString = function () {
return '<miniwrite-peek>';
};
return mw;
} | [
"function",
"peek",
"(",
"target",
",",
"callback",
")",
"{",
"var",
"mw",
"=",
"core",
".",
"base",
"(",
")",
";",
"mw",
".",
"enabled",
"=",
"true",
";",
"mw",
".",
"target",
"=",
"target",
";",
"mw",
".",
"callback",
"=",
"(",
"callback",
"||",
"function",
"(",
"line",
"/*, mw*/",
")",
"{",
"return",
"line",
";",
"}",
")",
";",
"mw",
".",
"writeln",
"=",
"function",
"(",
"line",
")",
"{",
"if",
"(",
"mw",
".",
"enabled",
"&&",
"mw",
".",
"callback",
")",
"{",
"line",
"=",
"mw",
".",
"callback",
"(",
"line",
",",
"mw",
")",
";",
"if",
"(",
"typeof",
"line",
"===",
"'string'",
")",
"{",
"mw",
".",
"target",
".",
"writeln",
"(",
"line",
")",
";",
"}",
"}",
"}",
";",
"mw",
".",
"toString",
"=",
"function",
"(",
")",
"{",
"return",
"'<miniwrite-peek>'",
";",
"}",
";",
"return",
"mw",
";",
"}"
] | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - use callback to transform | [
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"use",
"callback",
"to",
"transform"
] | 0b716dfdd203e20bdf71b552d1776ade8a55ced5 | https://github.com/Bartvds/miniwrite/blob/0b716dfdd203e20bdf71b552d1776ade8a55ced5/lib/core.js#L251-L270 |
53,108 | benaston/niid | dist/niid.js | need | function need(args) {
var argsArray, restArgs;
if (!args) {
return args;
}
argsArray = Array.prototype.slice.call(args);
restArgs = Array.prototype.slice.call(arguments, 1);
if (isArgumentObject(args)) {
return argCheck(argsArray, restArgs);
}
return objectCheck(args, restArgs);
} | javascript | function need(args) {
var argsArray, restArgs;
if (!args) {
return args;
}
argsArray = Array.prototype.slice.call(args);
restArgs = Array.prototype.slice.call(arguments, 1);
if (isArgumentObject(args)) {
return argCheck(argsArray, restArgs);
}
return objectCheck(args, restArgs);
} | [
"function",
"need",
"(",
"args",
")",
"{",
"var",
"argsArray",
",",
"restArgs",
";",
"if",
"(",
"!",
"args",
")",
"{",
"return",
"args",
";",
"}",
"argsArray",
"=",
"Array",
".",
"prototype",
".",
"slice",
".",
"call",
"(",
"args",
")",
";",
"restArgs",
"=",
"Array",
".",
"prototype",
".",
"slice",
".",
"call",
"(",
"arguments",
",",
"1",
")",
";",
"if",
"(",
"isArgumentObject",
"(",
"args",
")",
")",
"{",
"return",
"argCheck",
"(",
"argsArray",
",",
"restArgs",
")",
";",
"}",
"return",
"objectCheck",
"(",
"args",
",",
"restArgs",
")",
";",
"}"
] | See the readme.md for examples of use.
@param {Object/Arguments} args The object to check.
@return {undefined or null} | [
"See",
"the",
"readme",
".",
"md",
"for",
"examples",
"of",
"use",
"."
] | 1a45dcd6e1e00d5372c8d2b99e92adc2db6027e8 | https://github.com/benaston/niid/blob/1a45dcd6e1e00d5372c8d2b99e92adc2db6027e8/dist/niid.js#L52-L67 |
53,109 | marcojonker/data-elevator | lib/level-controllers/file-level-controller.js | function(config) {
var directory = null;
if(config.workingDir) {
directory = path.join(config.workingDir, 'level');
} else {
throw Errors.invalidConfig('Invalid configuration. Working directory not defined.');
}
return directory;
} | javascript | function(config) {
var directory = null;
if(config.workingDir) {
directory = path.join(config.workingDir, 'level');
} else {
throw Errors.invalidConfig('Invalid configuration. Working directory not defined.');
}
return directory;
} | [
"function",
"(",
"config",
")",
"{",
"var",
"directory",
"=",
"null",
";",
"if",
"(",
"config",
".",
"workingDir",
")",
"{",
"directory",
"=",
"path",
".",
"join",
"(",
"config",
".",
"workingDir",
",",
"'level'",
")",
";",
"}",
"else",
"{",
"throw",
"Errors",
".",
"invalidConfig",
"(",
"'Invalid configuration. Working directory not defined.'",
")",
";",
"}",
"return",
"directory",
";",
"}"
] | Get level directory
@param config
@result string
@throws Error | [
"Get",
"level",
"directory"
] | 7d56e5b2e8ca24b9576066e5265713db6452f289 | https://github.com/marcojonker/data-elevator/blob/7d56e5b2e8ca24b9576066e5265713db6452f289/lib/level-controllers/file-level-controller.js#L23-L33 |
|
53,110 | marcojonker/data-elevator | lib/level-controllers/file-level-controller.js | function(config) {
var filePath = null;
if(config.levelControllerConfig && config.levelControllerConfig.fileName) {
filePath = path.join(_getLevelDir(config), config.levelControllerConfig.fileName);
} else {
throw Errors.invalidConfig('Invalid configuration. Level controller file name not defined.');
}
return filePath;
} | javascript | function(config) {
var filePath = null;
if(config.levelControllerConfig && config.levelControllerConfig.fileName) {
filePath = path.join(_getLevelDir(config), config.levelControllerConfig.fileName);
} else {
throw Errors.invalidConfig('Invalid configuration. Level controller file name not defined.');
}
return filePath;
} | [
"function",
"(",
"config",
")",
"{",
"var",
"filePath",
"=",
"null",
";",
"if",
"(",
"config",
".",
"levelControllerConfig",
"&&",
"config",
".",
"levelControllerConfig",
".",
"fileName",
")",
"{",
"filePath",
"=",
"path",
".",
"join",
"(",
"_getLevelDir",
"(",
"config",
")",
",",
"config",
".",
"levelControllerConfig",
".",
"fileName",
")",
";",
"}",
"else",
"{",
"throw",
"Errors",
".",
"invalidConfig",
"(",
"'Invalid configuration. Level controller file name not defined.'",
")",
";",
"}",
"return",
"filePath",
";",
"}"
] | Get level file path
@param config
@result string
@throws Error | [
"Get",
"level",
"file",
"path"
] | 7d56e5b2e8ca24b9576066e5265713db6452f289 | https://github.com/marcojonker/data-elevator/blob/7d56e5b2e8ca24b9576066e5265713db6452f289/lib/level-controllers/file-level-controller.js#L41-L50 |
|
53,111 | andrewscwei/requiem | src/helpers/assertType.js | assertType | function assertType(value, type, allowUndefined, message) {
if (!assert(type !== undefined, 'Paremeter \'type\' must be a string or a class')) return;
if (!assert((allowUndefined === undefined) || (typeof allowUndefined === 'boolean'), 'Paremeter \'allowUndefined\', if specified, must be a boolean')) return;
if (!assert((message === undefined) || (typeof message === 'string'), 'Parameter \'message\', if specified, must be a string')) return;
allowUndefined = (allowUndefined === undefined) ? false : allowUndefined;
if (allowUndefined && (value === undefined)) return true;
if (type instanceof Array) {
let n = type.length;
for (let i = 0; i < n; i++) {
if (checkType(value, type[i])) return true;
}
throw new Error(message || 'AssertType failed');
}
if (checkType(value, type)) return true;
throw new Error(message || 'AssertType failed');
} | javascript | function assertType(value, type, allowUndefined, message) {
if (!assert(type !== undefined, 'Paremeter \'type\' must be a string or a class')) return;
if (!assert((allowUndefined === undefined) || (typeof allowUndefined === 'boolean'), 'Paremeter \'allowUndefined\', if specified, must be a boolean')) return;
if (!assert((message === undefined) || (typeof message === 'string'), 'Parameter \'message\', if specified, must be a string')) return;
allowUndefined = (allowUndefined === undefined) ? false : allowUndefined;
if (allowUndefined && (value === undefined)) return true;
if (type instanceof Array) {
let n = type.length;
for (let i = 0; i < n; i++) {
if (checkType(value, type[i])) return true;
}
throw new Error(message || 'AssertType failed');
}
if (checkType(value, type)) return true;
throw new Error(message || 'AssertType failed');
} | [
"function",
"assertType",
"(",
"value",
",",
"type",
",",
"allowUndefined",
",",
"message",
")",
"{",
"if",
"(",
"!",
"assert",
"(",
"type",
"!==",
"undefined",
",",
"'Paremeter \\'type\\' must be a string or a class'",
")",
")",
"return",
";",
"if",
"(",
"!",
"assert",
"(",
"(",
"allowUndefined",
"===",
"undefined",
")",
"||",
"(",
"typeof",
"allowUndefined",
"===",
"'boolean'",
")",
",",
"'Paremeter \\'allowUndefined\\', if specified, must be a boolean'",
")",
")",
"return",
";",
"if",
"(",
"!",
"assert",
"(",
"(",
"message",
"===",
"undefined",
")",
"||",
"(",
"typeof",
"message",
"===",
"'string'",
")",
",",
"'Parameter \\'message\\', if specified, must be a string'",
")",
")",
"return",
";",
"allowUndefined",
"=",
"(",
"allowUndefined",
"===",
"undefined",
")",
"?",
"false",
":",
"allowUndefined",
";",
"if",
"(",
"allowUndefined",
"&&",
"(",
"value",
"===",
"undefined",
")",
")",
"return",
"true",
";",
"if",
"(",
"type",
"instanceof",
"Array",
")",
"{",
"let",
"n",
"=",
"type",
".",
"length",
";",
"for",
"(",
"let",
"i",
"=",
"0",
";",
"i",
"<",
"n",
";",
"i",
"++",
")",
"{",
"if",
"(",
"checkType",
"(",
"value",
",",
"type",
"[",
"i",
"]",
")",
")",
"return",
"true",
";",
"}",
"throw",
"new",
"Error",
"(",
"message",
"||",
"'AssertType failed'",
")",
";",
"}",
"if",
"(",
"checkType",
"(",
"value",
",",
"type",
")",
")",
"return",
"true",
";",
"throw",
"new",
"Error",
"(",
"message",
"||",
"'AssertType failed'",
")",
";",
"}"
] | Asserts the specified condition and throws a warning if assertion fails.
Internal use only.
@param {*} value - Value used for the assertion.
@param {String|Class} type - Type(s) to evaluate against. If this is a
string, this method will use 'typeof' operator.
Otherwise 'instanceof' operator will be used. If
this parameter is an array, all elements in the
array will be evaluated against.
@param {boolean} [allowUndefined=false] - Specifies whether assertion should
pass if the supplied value is
undefined.
@param {string} [message] - Message to be displayed when assertion fails.
@return {boolean} True if assert passed, false otherwise.
@throws Error if assert fails.
@alias module:requiem~helpers.assertType | [
"Asserts",
"the",
"specified",
"condition",
"and",
"throws",
"a",
"warning",
"if",
"assertion",
"fails",
".",
"Internal",
"use",
"only",
"."
] | c4182bfffc9841c6de5718f689ad3c2060511777 | https://github.com/andrewscwei/requiem/blob/c4182bfffc9841c6de5718f689ad3c2060511777/src/helpers/assertType.js#L29-L51 |
53,112 | andreax79/obj-list-diff | index.js | listToObject | function listToObject(list, key) {
var length, result, i, obj, keyValue;
if (!list) {
list = [];
}
length = list.length;
result = { valids: {}, discarded: [] };
for (i = 0; i < length; i += 1) {
obj = list[i];
keyValue = obj[key];
// discard the object without a key
if (keyValue) {
result.valids[keyValue] = obj;
} else {
result.discarded.push(obj);
}
}
return result;
} | javascript | function listToObject(list, key) {
var length, result, i, obj, keyValue;
if (!list) {
list = [];
}
length = list.length;
result = { valids: {}, discarded: [] };
for (i = 0; i < length; i += 1) {
obj = list[i];
keyValue = obj[key];
// discard the object without a key
if (keyValue) {
result.valids[keyValue] = obj;
} else {
result.discarded.push(obj);
}
}
return result;
} | [
"function",
"listToObject",
"(",
"list",
",",
"key",
")",
"{",
"var",
"length",
",",
"result",
",",
"i",
",",
"obj",
",",
"keyValue",
";",
"if",
"(",
"!",
"list",
")",
"{",
"list",
"=",
"[",
"]",
";",
"}",
"length",
"=",
"list",
".",
"length",
";",
"result",
"=",
"{",
"valids",
":",
"{",
"}",
",",
"discarded",
":",
"[",
"]",
"}",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"length",
";",
"i",
"+=",
"1",
")",
"{",
"obj",
"=",
"list",
"[",
"i",
"]",
";",
"keyValue",
"=",
"obj",
"[",
"key",
"]",
";",
"// discard the object without a key",
"if",
"(",
"keyValue",
")",
"{",
"result",
".",
"valids",
"[",
"keyValue",
"]",
"=",
"obj",
";",
"}",
"else",
"{",
"result",
".",
"discarded",
".",
"push",
"(",
"obj",
")",
";",
"}",
"}",
"return",
"result",
";",
"}"
] | Convert a list to an object using the given key name | [
"Convert",
"a",
"list",
"to",
"an",
"object",
"using",
"the",
"given",
"key",
"name"
] | 568024a340f3409b17c55770ed05b09820d5cb97 | https://github.com/andreax79/obj-list-diff/blob/568024a340f3409b17c55770ed05b09820d5cb97/index.js#L25-L43 |
53,113 | andreax79/obj-list-diff | index.js | exclude | function exclude(obj, keys) {
var result, key;
result = {};
keys = keys || [];
for (key in obj) {
if (obj.hasOwnProperty(key)) {
if (keys.indexOf(key) === -1) {
if (typeof obj[key] !== 'function') {
result[key] = obj[key];
}
}
}
}
return result;
} | javascript | function exclude(obj, keys) {
var result, key;
result = {};
keys = keys || [];
for (key in obj) {
if (obj.hasOwnProperty(key)) {
if (keys.indexOf(key) === -1) {
if (typeof obj[key] !== 'function') {
result[key] = obj[key];
}
}
}
}
return result;
} | [
"function",
"exclude",
"(",
"obj",
",",
"keys",
")",
"{",
"var",
"result",
",",
"key",
";",
"result",
"=",
"{",
"}",
";",
"keys",
"=",
"keys",
"||",
"[",
"]",
";",
"for",
"(",
"key",
"in",
"obj",
")",
"{",
"if",
"(",
"obj",
".",
"hasOwnProperty",
"(",
"key",
")",
")",
"{",
"if",
"(",
"keys",
".",
"indexOf",
"(",
"key",
")",
"===",
"-",
"1",
")",
"{",
"if",
"(",
"typeof",
"obj",
"[",
"key",
"]",
"!==",
"'function'",
")",
"{",
"result",
"[",
"key",
"]",
"=",
"obj",
"[",
"key",
"]",
";",
"}",
"}",
"}",
"}",
"return",
"result",
";",
"}"
] | Return a copy of an object excluding the given keys and all the functions | [
"Return",
"a",
"copy",
"of",
"an",
"object",
"excluding",
"the",
"given",
"keys",
"and",
"all",
"the",
"functions"
] | 568024a340f3409b17c55770ed05b09820d5cb97 | https://github.com/andreax79/obj-list-diff/blob/568024a340f3409b17c55770ed05b09820d5cb97/index.js#L48-L62 |
53,114 | andreax79/obj-list-diff | index.js | keep | function keep(orig, dest, options) {
var keep, i, t;
keep = options.keep || [];
if (keep.length === 0) {
return dest;
}
for (i = 0; i < keep.length; i += 1) {
t = orig[keep[i]];
if (t !== undefined) {
dest[keep[i]] = t;
}
}
return dest;
} | javascript | function keep(orig, dest, options) {
var keep, i, t;
keep = options.keep || [];
if (keep.length === 0) {
return dest;
}
for (i = 0; i < keep.length; i += 1) {
t = orig[keep[i]];
if (t !== undefined) {
dest[keep[i]] = t;
}
}
return dest;
} | [
"function",
"keep",
"(",
"orig",
",",
"dest",
",",
"options",
")",
"{",
"var",
"keep",
",",
"i",
",",
"t",
";",
"keep",
"=",
"options",
".",
"keep",
"||",
"[",
"]",
";",
"if",
"(",
"keep",
".",
"length",
"===",
"0",
")",
"{",
"return",
"dest",
";",
"}",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"keep",
".",
"length",
";",
"i",
"+=",
"1",
")",
"{",
"t",
"=",
"orig",
"[",
"keep",
"[",
"i",
"]",
"]",
";",
"if",
"(",
"t",
"!==",
"undefined",
")",
"{",
"dest",
"[",
"keep",
"[",
"i",
"]",
"]",
"=",
"t",
";",
"}",
"}",
"return",
"dest",
";",
"}"
] | Copy the 'options.keep' keys from orig to dest | [
"Copy",
"the",
"options",
".",
"keep",
"keys",
"from",
"orig",
"to",
"dest"
] | 568024a340f3409b17c55770ed05b09820d5cb97 | https://github.com/andreax79/obj-list-diff/blob/568024a340f3409b17c55770ed05b09820d5cb97/index.js#L67-L80 |
53,115 | jmjuanes/utily | lib/fs.js | function(p, cb)
{
//Get the status of the path
return fs.stat(p, function(error, stat)
{
//Check the error
if(error)
{
//Check the error code
if(error.code !== 'ENOENT')
{
//Do the callback with the error
return cb(error, false, stat);
}
else
{
//Do the callback without error
return cb(null, false, stat);
}
}
//Do the callback with the stat
return cb(null, true, stat);
});
} | javascript | function(p, cb)
{
//Get the status of the path
return fs.stat(p, function(error, stat)
{
//Check the error
if(error)
{
//Check the error code
if(error.code !== 'ENOENT')
{
//Do the callback with the error
return cb(error, false, stat);
}
else
{
//Do the callback without error
return cb(null, false, stat);
}
}
//Do the callback with the stat
return cb(null, true, stat);
});
} | [
"function",
"(",
"p",
",",
"cb",
")",
"{",
"//Get the status of the path",
"return",
"fs",
".",
"stat",
"(",
"p",
",",
"function",
"(",
"error",
",",
"stat",
")",
"{",
"//Check the error",
"if",
"(",
"error",
")",
"{",
"//Check the error code",
"if",
"(",
"error",
".",
"code",
"!==",
"'ENOENT'",
")",
"{",
"//Do the callback with the error",
"return",
"cb",
"(",
"error",
",",
"false",
",",
"stat",
")",
";",
"}",
"else",
"{",
"//Do the callback without error",
"return",
"cb",
"(",
"null",
",",
"false",
",",
"stat",
")",
";",
"}",
"}",
"//Do the callback with the stat",
"return",
"cb",
"(",
"null",
",",
"true",
",",
"stat",
")",
";",
"}",
")",
";",
"}"
] | Check if a path exists | [
"Check",
"if",
"a",
"path",
"exists"
] | f620180aa21fc8ece0f7b2c268cda335e9e28831 | https://github.com/jmjuanes/utily/blob/f620180aa21fc8ece0f7b2c268cda335e9e28831/lib/fs.js#L134-L158 |
|
53,116 | jmjuanes/utily | lib/fs.js | function(index)
{
//Check the index
if(index >= files.length)
{
//Do the callback
return cb(null);
}
//Get the file to remove
var file = files[index];
//Remove the file
fs.unlink(file, function(error)
{
//Check the error
if(error)
{
//Check the error code
if(error.code !== 'ENOENT')
{
//Do the callback with the error
return cb(error);
}
}
//Continue with the next file
return remove_file(index + 1);
});
} | javascript | function(index)
{
//Check the index
if(index >= files.length)
{
//Do the callback
return cb(null);
}
//Get the file to remove
var file = files[index];
//Remove the file
fs.unlink(file, function(error)
{
//Check the error
if(error)
{
//Check the error code
if(error.code !== 'ENOENT')
{
//Do the callback with the error
return cb(error);
}
}
//Continue with the next file
return remove_file(index + 1);
});
} | [
"function",
"(",
"index",
")",
"{",
"//Check the index",
"if",
"(",
"index",
">=",
"files",
".",
"length",
")",
"{",
"//Do the callback",
"return",
"cb",
"(",
"null",
")",
";",
"}",
"//Get the file to remove",
"var",
"file",
"=",
"files",
"[",
"index",
"]",
";",
"//Remove the file",
"fs",
".",
"unlink",
"(",
"file",
",",
"function",
"(",
"error",
")",
"{",
"//Check the error",
"if",
"(",
"error",
")",
"{",
"//Check the error code",
"if",
"(",
"error",
".",
"code",
"!==",
"'ENOENT'",
")",
"{",
"//Do the callback with the error",
"return",
"cb",
"(",
"error",
")",
";",
"}",
"}",
"//Continue with the next file",
"return",
"remove_file",
"(",
"index",
"+",
"1",
")",
";",
"}",
")",
";",
"}"
] | Remove file method | [
"Remove",
"file",
"method"
] | f620180aa21fc8ece0f7b2c268cda335e9e28831 | https://github.com/jmjuanes/utily/blob/f620180aa21fc8ece0f7b2c268cda335e9e28831/lib/fs.js#L293-L322 |
|
53,117 | gfax/junkyard-brawl | src/deck.js | filterCards | function filterCards(cards) {
// Option was passed in to disabled this filter.
// User is probably requesting to discard.
if (noCardFilter) {
return cards
}
const [head, ...tail] = cards
if (head && head.filter) {
return [head].concat(head.filter(tail))
}
return cards
} | javascript | function filterCards(cards) {
// Option was passed in to disabled this filter.
// User is probably requesting to discard.
if (noCardFilter) {
return cards
}
const [head, ...tail] = cards
if (head && head.filter) {
return [head].concat(head.filter(tail))
}
return cards
} | [
"function",
"filterCards",
"(",
"cards",
")",
"{",
"// Option was passed in to disabled this filter.",
"// User is probably requesting to discard.",
"if",
"(",
"noCardFilter",
")",
"{",
"return",
"cards",
"}",
"const",
"[",
"head",
",",
"...",
"tail",
"]",
"=",
"cards",
"if",
"(",
"head",
"&&",
"head",
".",
"filter",
")",
"{",
"return",
"[",
"head",
"]",
".",
"concat",
"(",
"head",
".",
"filter",
"(",
"tail",
")",
")",
"}",
"return",
"cards",
"}"
] | Apply any card-specific filters. For instance, Gut Punch filters any card following itself as it is a standalone attack. | [
"Apply",
"any",
"card",
"-",
"specific",
"filters",
".",
"For",
"instance",
"Gut",
"Punch",
"filters",
"any",
"card",
"following",
"itself",
"as",
"it",
"is",
"a",
"standalone",
"attack",
"."
] | 5e1b9d3b622ffa6e602c7abe51995269a43423e1 | https://github.com/gfax/junkyard-brawl/blob/5e1b9d3b622ffa6e602c7abe51995269a43423e1/src/deck.js#L89-L100 |
53,118 | sootjs/soot | benchmarks/animation/benchmark.js | createBoxes | function createBoxes(count) {
var boxes = [];
for (var i = 0; i < N; i++) {
boxes.push(
V(
elementFlag,
"div",
"box-view",
V(elementFlag, "div", "box", count % 100, {
style: {
top: Math.sin(count / 10) * 10 + "px",
left: Math.cos(count / 10) * 10 + "px",
background: "rgb(0, 0," + count % 255 + ")"
}
})
)
);
}
return boxes;
} | javascript | function createBoxes(count) {
var boxes = [];
for (var i = 0; i < N; i++) {
boxes.push(
V(
elementFlag,
"div",
"box-view",
V(elementFlag, "div", "box", count % 100, {
style: {
top: Math.sin(count / 10) * 10 + "px",
left: Math.cos(count / 10) * 10 + "px",
background: "rgb(0, 0," + count % 255 + ")"
}
})
)
);
}
return boxes;
} | [
"function",
"createBoxes",
"(",
"count",
")",
"{",
"var",
"boxes",
"=",
"[",
"]",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"N",
";",
"i",
"++",
")",
"{",
"boxes",
".",
"push",
"(",
"V",
"(",
"elementFlag",
",",
"\"div\"",
",",
"\"box-view\"",
",",
"V",
"(",
"elementFlag",
",",
"\"div\"",
",",
"\"box\"",
",",
"count",
"%",
"100",
",",
"{",
"style",
":",
"{",
"top",
":",
"Math",
".",
"sin",
"(",
"count",
"/",
"10",
")",
"*",
"10",
"+",
"\"px\"",
",",
"left",
":",
"Math",
".",
"cos",
"(",
"count",
"/",
"10",
")",
"*",
"10",
"+",
"\"px\"",
",",
"background",
":",
"\"rgb(0, 0,\"",
"+",
"count",
"%",
"255",
"+",
"\")\"",
"}",
"}",
")",
")",
")",
";",
"}",
"return",
"boxes",
";",
"}"
] | Implementation should be same as React for comparison | [
"Implementation",
"should",
"be",
"same",
"as",
"React",
"for",
"comparison"
] | 56dcd8b969c1e138f05e092e292b26e1dd5f1156 | https://github.com/sootjs/soot/blob/56dcd8b969c1e138f05e092e292b26e1dd5f1156/benchmarks/animation/benchmark.js#L129-L148 |
53,119 | tx4x/git-module | dist/commands.js | enumerateBuiltInCommands | function enumerateBuiltInCommands(config) {
const builtInCommandParentDirGlob = path_1.join(config.builtInCommandLocation, '/*.js');
return globby.sync(builtInCommandParentDirGlob, { ignore: '**/*.map' });
} | javascript | function enumerateBuiltInCommands(config) {
const builtInCommandParentDirGlob = path_1.join(config.builtInCommandLocation, '/*.js');
return globby.sync(builtInCommandParentDirGlob, { ignore: '**/*.map' });
} | [
"function",
"enumerateBuiltInCommands",
"(",
"config",
")",
"{",
"const",
"builtInCommandParentDirGlob",
"=",
"path_1",
".",
"join",
"(",
"config",
".",
"builtInCommandLocation",
",",
"'/*.js'",
")",
";",
"return",
"globby",
".",
"sync",
"(",
"builtInCommandParentDirGlob",
",",
"{",
"ignore",
":",
"'**/*.map'",
"}",
")",
";",
"}"
] | Enumerate all the builtIn commands and return their absolute paths
@param config
@returns {Promise<string []>} the paths of all builtIn commands | [
"Enumerate",
"all",
"the",
"builtIn",
"commands",
"and",
"return",
"their",
"absolute",
"paths"
] | 93ff14eecb00c5c140f3e6413bd43404cc1dd021 | https://github.com/tx4x/git-module/blob/93ff14eecb00c5c140f3e6413bd43404cc1dd021/dist/commands.js#L27-L30 |
53,120 | nearform/aws-ami-container | lib/container.js | build | function build(mode, system, cdef, out, cb) {
logger.info('building');
out.stdout('building');
cb();
} | javascript | function build(mode, system, cdef, out, cb) {
logger.info('building');
out.stdout('building');
cb();
} | [
"function",
"build",
"(",
"mode",
",",
"system",
",",
"cdef",
",",
"out",
",",
"cb",
")",
"{",
"logger",
".",
"info",
"(",
"'building'",
")",
";",
"out",
".",
"stdout",
"(",
"'building'",
")",
";",
"cb",
"(",
")",
";",
"}"
] | build the container
cdef - contianer definition block
out - ouput stream
cb - complete callback | [
"build",
"the",
"container",
"cdef",
"-",
"contianer",
"definition",
"block",
"out",
"-",
"ouput",
"stream",
"cb",
"-",
"complete",
"callback"
] | 67085b524dab4396831c3bc46242d36f3eac93e1 | https://github.com/nearform/aws-ami-container/blob/67085b524dab4396831c3bc46242d36f3eac93e1/lib/container.js#L71-L75 |
53,121 | nearform/aws-ami-container | lib/container.js | undeploy | function undeploy(mode, target, system, containerDef, container, out, cb) {
logger.info('undeploying');
out.stdout('undeploying');
cb();
} | javascript | function undeploy(mode, target, system, containerDef, container, out, cb) {
logger.info('undeploying');
out.stdout('undeploying');
cb();
} | [
"function",
"undeploy",
"(",
"mode",
",",
"target",
",",
"system",
",",
"containerDef",
",",
"container",
",",
"out",
",",
"cb",
")",
"{",
"logger",
".",
"info",
"(",
"'undeploying'",
")",
";",
"out",
".",
"stdout",
"(",
"'undeploying'",
")",
";",
"cb",
"(",
")",
";",
"}"
] | undeploy the container from the target
target - target to deploy to
system - the target system defintinion
cdef - the contianer definition
container - the container as defined in the system topology
out - ouput stream
cb - complete callback | [
"undeploy",
"the",
"container",
"from",
"the",
"target",
"target",
"-",
"target",
"to",
"deploy",
"to",
"system",
"-",
"the",
"target",
"system",
"defintinion",
"cdef",
"-",
"the",
"contianer",
"definition",
"container",
"-",
"the",
"container",
"as",
"defined",
"in",
"the",
"system",
"topology",
"out",
"-",
"ouput",
"stream",
"cb",
"-",
"complete",
"callback"
] | 67085b524dab4396831c3bc46242d36f3eac93e1 | https://github.com/nearform/aws-ami-container/blob/67085b524dab4396831c3bc46242d36f3eac93e1/lib/container.js#L105-L109 |
53,122 | nearform/aws-ami-container | lib/container.js | link | function link(mode, target, system, containerDef, container, out, cb) {
logger.info('linking');
out.stdout('linking');
var elb = findParentELB(system, container);
if (elb) {
logger.info(elb, 'elb found');
linkToELB(mode, system, elb, container, out, cb);
} else {
logger.info('elb not found');
cb(null, system);
}
} | javascript | function link(mode, target, system, containerDef, container, out, cb) {
logger.info('linking');
out.stdout('linking');
var elb = findParentELB(system, container);
if (elb) {
logger.info(elb, 'elb found');
linkToELB(mode, system, elb, container, out, cb);
} else {
logger.info('elb not found');
cb(null, system);
}
} | [
"function",
"link",
"(",
"mode",
",",
"target",
",",
"system",
",",
"containerDef",
",",
"container",
",",
"out",
",",
"cb",
")",
"{",
"logger",
".",
"info",
"(",
"'linking'",
")",
";",
"out",
".",
"stdout",
"(",
"'linking'",
")",
";",
"var",
"elb",
"=",
"findParentELB",
"(",
"system",
",",
"container",
")",
";",
"if",
"(",
"elb",
")",
"{",
"logger",
".",
"info",
"(",
"elb",
",",
"'elb found'",
")",
";",
"linkToELB",
"(",
"mode",
",",
"system",
",",
"elb",
",",
"container",
",",
"out",
",",
"cb",
")",
";",
"}",
"else",
"{",
"logger",
".",
"info",
"(",
"'elb not found'",
")",
";",
"cb",
"(",
"null",
",",
"system",
")",
";",
"}",
"}"
] | link the container to the target
target - target to deploy to
system - the target system defintinion
cdef - the contianer definition
container - the container as defined in the system topology
out - ouput stream
cb - complete callback | [
"link",
"the",
"container",
"to",
"the",
"target",
"target",
"-",
"target",
"to",
"deploy",
"to",
"system",
"-",
"the",
"target",
"system",
"defintinion",
"cdef",
"-",
"the",
"contianer",
"definition",
"container",
"-",
"the",
"container",
"as",
"defined",
"in",
"the",
"system",
"topology",
"out",
"-",
"ouput",
"stream",
"cb",
"-",
"complete",
"callback"
] | 67085b524dab4396831c3bc46242d36f3eac93e1 | https://github.com/nearform/aws-ami-container/blob/67085b524dab4396831c3bc46242d36f3eac93e1/lib/container.js#L257-L270 |
53,123 | nearform/aws-ami-container | lib/container.js | unlink | function unlink(mode, target, system, containerDef, container, out, cb) {
logger.info('unlinking');
out.stdout('unlinking');
var elb = findParentELB(system, container);
if (elb) {
logger.info(elb, 'elb found');
unlinkFromELB(mode, system, elb, container, out, cb);
} else {
logger.info('elb not found');
cb(null, target);
}
} | javascript | function unlink(mode, target, system, containerDef, container, out, cb) {
logger.info('unlinking');
out.stdout('unlinking');
var elb = findParentELB(system, container);
if (elb) {
logger.info(elb, 'elb found');
unlinkFromELB(mode, system, elb, container, out, cb);
} else {
logger.info('elb not found');
cb(null, target);
}
} | [
"function",
"unlink",
"(",
"mode",
",",
"target",
",",
"system",
",",
"containerDef",
",",
"container",
",",
"out",
",",
"cb",
")",
"{",
"logger",
".",
"info",
"(",
"'unlinking'",
")",
";",
"out",
".",
"stdout",
"(",
"'unlinking'",
")",
";",
"var",
"elb",
"=",
"findParentELB",
"(",
"system",
",",
"container",
")",
";",
"if",
"(",
"elb",
")",
"{",
"logger",
".",
"info",
"(",
"elb",
",",
"'elb found'",
")",
";",
"unlinkFromELB",
"(",
"mode",
",",
"system",
",",
"elb",
",",
"container",
",",
"out",
",",
"cb",
")",
";",
"}",
"else",
"{",
"logger",
".",
"info",
"(",
"'elb not found'",
")",
";",
"cb",
"(",
"null",
",",
"target",
")",
";",
"}",
"}"
] | unlink the container from the target
target - target to deploy to
system - the target system defintinion
cdef - the contianer definition
container - the container as defined in the system topology
out - ouput stream
cb - complete callback | [
"unlink",
"the",
"container",
"from",
"the",
"target",
"target",
"-",
"target",
"to",
"deploy",
"to",
"system",
"-",
"the",
"target",
"system",
"defintinion",
"cdef",
"-",
"the",
"contianer",
"definition",
"container",
"-",
"the",
"container",
"as",
"defined",
"in",
"the",
"system",
"topology",
"out",
"-",
"ouput",
"stream",
"cb",
"-",
"complete",
"callback"
] | 67085b524dab4396831c3bc46242d36f3eac93e1 | https://github.com/nearform/aws-ami-container/blob/67085b524dab4396831c3bc46242d36f3eac93e1/lib/container.js#L283-L296 |
53,124 | MakerCollider/node-red-contrib-smartnode-hook | html/scripts/highchart/highcharts-more.src.js | function (options, chart, firstAxis) {
var pane = this,
backgroundOption,
defaultOptions = pane.defaultOptions;
pane.chart = chart;
// Set options
if (chart.angular) { // gauges
defaultOptions.background = {}; // gets extended by this.defaultBackgroundOptions
}
pane.options = options = merge(defaultOptions, options);
backgroundOption = options.background;
// To avoid having weighty logic to place, update and remove the backgrounds,
// push them to the first axis' plot bands and borrow the existing logic there.
if (backgroundOption) {
each([].concat(splat(backgroundOption)).reverse(), function (config) {
var backgroundColor = config.backgroundColor, // if defined, replace the old one (specific for gradients)
axisUserOptions = firstAxis.userOptions;
config = merge(pane.defaultBackgroundOptions, config);
if (backgroundColor) {
config.backgroundColor = backgroundColor;
}
config.color = config.backgroundColor; // due to naming in plotBands
firstAxis.options.plotBands.unshift(config);
axisUserOptions.plotBands = axisUserOptions.plotBands || []; // #3176
axisUserOptions.plotBands.unshift(config);
});
}
} | javascript | function (options, chart, firstAxis) {
var pane = this,
backgroundOption,
defaultOptions = pane.defaultOptions;
pane.chart = chart;
// Set options
if (chart.angular) { // gauges
defaultOptions.background = {}; // gets extended by this.defaultBackgroundOptions
}
pane.options = options = merge(defaultOptions, options);
backgroundOption = options.background;
// To avoid having weighty logic to place, update and remove the backgrounds,
// push them to the first axis' plot bands and borrow the existing logic there.
if (backgroundOption) {
each([].concat(splat(backgroundOption)).reverse(), function (config) {
var backgroundColor = config.backgroundColor, // if defined, replace the old one (specific for gradients)
axisUserOptions = firstAxis.userOptions;
config = merge(pane.defaultBackgroundOptions, config);
if (backgroundColor) {
config.backgroundColor = backgroundColor;
}
config.color = config.backgroundColor; // due to naming in plotBands
firstAxis.options.plotBands.unshift(config);
axisUserOptions.plotBands = axisUserOptions.plotBands || []; // #3176
axisUserOptions.plotBands.unshift(config);
});
}
} | [
"function",
"(",
"options",
",",
"chart",
",",
"firstAxis",
")",
"{",
"var",
"pane",
"=",
"this",
",",
"backgroundOption",
",",
"defaultOptions",
"=",
"pane",
".",
"defaultOptions",
";",
"pane",
".",
"chart",
"=",
"chart",
";",
"// Set options",
"if",
"(",
"chart",
".",
"angular",
")",
"{",
"// gauges",
"defaultOptions",
".",
"background",
"=",
"{",
"}",
";",
"// gets extended by this.defaultBackgroundOptions",
"}",
"pane",
".",
"options",
"=",
"options",
"=",
"merge",
"(",
"defaultOptions",
",",
"options",
")",
";",
"backgroundOption",
"=",
"options",
".",
"background",
";",
"// To avoid having weighty logic to place, update and remove the backgrounds,",
"// push them to the first axis' plot bands and borrow the existing logic there.",
"if",
"(",
"backgroundOption",
")",
"{",
"each",
"(",
"[",
"]",
".",
"concat",
"(",
"splat",
"(",
"backgroundOption",
")",
")",
".",
"reverse",
"(",
")",
",",
"function",
"(",
"config",
")",
"{",
"var",
"backgroundColor",
"=",
"config",
".",
"backgroundColor",
",",
"// if defined, replace the old one (specific for gradients)",
"axisUserOptions",
"=",
"firstAxis",
".",
"userOptions",
";",
"config",
"=",
"merge",
"(",
"pane",
".",
"defaultBackgroundOptions",
",",
"config",
")",
";",
"if",
"(",
"backgroundColor",
")",
"{",
"config",
".",
"backgroundColor",
"=",
"backgroundColor",
";",
"}",
"config",
".",
"color",
"=",
"config",
".",
"backgroundColor",
";",
"// due to naming in plotBands",
"firstAxis",
".",
"options",
".",
"plotBands",
".",
"unshift",
"(",
"config",
")",
";",
"axisUserOptions",
".",
"plotBands",
"=",
"axisUserOptions",
".",
"plotBands",
"||",
"[",
"]",
";",
"// #3176",
"axisUserOptions",
".",
"plotBands",
".",
"unshift",
"(",
"config",
")",
";",
"}",
")",
";",
"}",
"}"
] | Initiate the Pane object | [
"Initiate",
"the",
"Pane",
"object"
] | 245c267e832968bad880ca009929043e82c7bc25 | https://github.com/MakerCollider/node-red-contrib-smartnode-hook/blob/245c267e832968bad880ca009929043e82c7bc25/html/scripts/highchart/highcharts-more.src.js#L56-L87 |
|
53,125 | MakerCollider/node-red-contrib-smartnode-hook | html/scripts/highchart/highcharts-more.src.js | function () {
// Call the Axis prototype method (the method we're in now is on the instance)
axisProto.getOffset.call(this);
// Title or label offsets are not counted
this.chart.axisOffset[this.side] = 0;
// Set the center array
this.center = this.pane.center = CenteredSeriesMixin.getCenter.call(this.pane);
} | javascript | function () {
// Call the Axis prototype method (the method we're in now is on the instance)
axisProto.getOffset.call(this);
// Title or label offsets are not counted
this.chart.axisOffset[this.side] = 0;
// Set the center array
this.center = this.pane.center = CenteredSeriesMixin.getCenter.call(this.pane);
} | [
"function",
"(",
")",
"{",
"// Call the Axis prototype method (the method we're in now is on the instance)",
"axisProto",
".",
"getOffset",
".",
"call",
"(",
"this",
")",
";",
"// Title or label offsets are not counted",
"this",
".",
"chart",
".",
"axisOffset",
"[",
"this",
".",
"side",
"]",
"=",
"0",
";",
"// Set the center array",
"this",
".",
"center",
"=",
"this",
".",
"pane",
".",
"center",
"=",
"CenteredSeriesMixin",
".",
"getCenter",
".",
"call",
"(",
"this",
".",
"pane",
")",
";",
"}"
] | Wrap the getOffset method to return zero offset for title or labels in a radial
axis | [
"Wrap",
"the",
"getOffset",
"method",
"to",
"return",
"zero",
"offset",
"for",
"title",
"or",
"labels",
"in",
"a",
"radial",
"axis"
] | 245c267e832968bad880ca009929043e82c7bc25 | https://github.com/MakerCollider/node-red-contrib-smartnode-hook/blob/245c267e832968bad880ca009929043e82c7bc25/html/scripts/highchart/highcharts-more.src.js#L223-L232 |
|
53,126 | MakerCollider/node-red-contrib-smartnode-hook | html/scripts/highchart/highcharts-more.src.js | function (lineWidth, radius) {
var center = this.center;
radius = pick(radius, center[2] / 2 - this.offset);
return this.chart.renderer.symbols.arc(
this.left + center[0],
this.top + center[1],
radius,
radius,
{
start: this.startAngleRad,
end: this.endAngleRad,
open: true,
innerR: 0
}
);
} | javascript | function (lineWidth, radius) {
var center = this.center;
radius = pick(radius, center[2] / 2 - this.offset);
return this.chart.renderer.symbols.arc(
this.left + center[0],
this.top + center[1],
radius,
radius,
{
start: this.startAngleRad,
end: this.endAngleRad,
open: true,
innerR: 0
}
);
} | [
"function",
"(",
"lineWidth",
",",
"radius",
")",
"{",
"var",
"center",
"=",
"this",
".",
"center",
";",
"radius",
"=",
"pick",
"(",
"radius",
",",
"center",
"[",
"2",
"]",
"/",
"2",
"-",
"this",
".",
"offset",
")",
";",
"return",
"this",
".",
"chart",
".",
"renderer",
".",
"symbols",
".",
"arc",
"(",
"this",
".",
"left",
"+",
"center",
"[",
"0",
"]",
",",
"this",
".",
"top",
"+",
"center",
"[",
"1",
"]",
",",
"radius",
",",
"radius",
",",
"{",
"start",
":",
"this",
".",
"startAngleRad",
",",
"end",
":",
"this",
".",
"endAngleRad",
",",
"open",
":",
"true",
",",
"innerR",
":",
"0",
"}",
")",
";",
"}"
] | Get the path for the axis line. This method is also referenced in the getPlotLinePath
method. | [
"Get",
"the",
"path",
"for",
"the",
"axis",
"line",
".",
"This",
"method",
"is",
"also",
"referenced",
"in",
"the",
"getPlotLinePath",
"method",
"."
] | 245c267e832968bad880ca009929043e82c7bc25 | https://github.com/MakerCollider/node-red-contrib-smartnode-hook/blob/245c267e832968bad880ca009929043e82c7bc25/html/scripts/highchart/highcharts-more.src.js#L239-L255 |
|
53,127 | MakerCollider/node-red-contrib-smartnode-hook | html/scripts/highchart/highcharts-more.src.js | function () {
// Call uber method
axisProto.setAxisTranslation.call(this);
// Set transA and minPixelPadding
if (this.center) { // it's not defined the first time
if (this.isCircular) {
this.transA = (this.endAngleRad - this.startAngleRad) /
((this.max - this.min) || 1);
} else {
this.transA = (this.center[2] / 2) / ((this.max - this.min) || 1);
}
if (this.isXAxis) {
this.minPixelPadding = this.transA * this.minPointOffset;
} else {
// This is a workaround for regression #2593, but categories still don't position correctly.
// TODO: Implement true handling of Y axis categories on gauges.
this.minPixelPadding = 0;
}
}
} | javascript | function () {
// Call uber method
axisProto.setAxisTranslation.call(this);
// Set transA and minPixelPadding
if (this.center) { // it's not defined the first time
if (this.isCircular) {
this.transA = (this.endAngleRad - this.startAngleRad) /
((this.max - this.min) || 1);
} else {
this.transA = (this.center[2] / 2) / ((this.max - this.min) || 1);
}
if (this.isXAxis) {
this.minPixelPadding = this.transA * this.minPointOffset;
} else {
// This is a workaround for regression #2593, but categories still don't position correctly.
// TODO: Implement true handling of Y axis categories on gauges.
this.minPixelPadding = 0;
}
}
} | [
"function",
"(",
")",
"{",
"// Call uber method\t\t",
"axisProto",
".",
"setAxisTranslation",
".",
"call",
"(",
"this",
")",
";",
"// Set transA and minPixelPadding",
"if",
"(",
"this",
".",
"center",
")",
"{",
"// it's not defined the first time",
"if",
"(",
"this",
".",
"isCircular",
")",
"{",
"this",
".",
"transA",
"=",
"(",
"this",
".",
"endAngleRad",
"-",
"this",
".",
"startAngleRad",
")",
"/",
"(",
"(",
"this",
".",
"max",
"-",
"this",
".",
"min",
")",
"||",
"1",
")",
";",
"}",
"else",
"{",
"this",
".",
"transA",
"=",
"(",
"this",
".",
"center",
"[",
"2",
"]",
"/",
"2",
")",
"/",
"(",
"(",
"this",
".",
"max",
"-",
"this",
".",
"min",
")",
"||",
"1",
")",
";",
"}",
"if",
"(",
"this",
".",
"isXAxis",
")",
"{",
"this",
".",
"minPixelPadding",
"=",
"this",
".",
"transA",
"*",
"this",
".",
"minPointOffset",
";",
"}",
"else",
"{",
"// This is a workaround for regression #2593, but categories still don't position correctly.",
"// TODO: Implement true handling of Y axis categories on gauges.",
"this",
".",
"minPixelPadding",
"=",
"0",
";",
"}",
"}",
"}"
] | Override setAxisTranslation by setting the translation to the difference
in rotation. This allows the translate method to return angle for
any given value. | [
"Override",
"setAxisTranslation",
"by",
"setting",
"the",
"translation",
"to",
"the",
"difference",
"in",
"rotation",
".",
"This",
"allows",
"the",
"translate",
"method",
"to",
"return",
"angle",
"for",
"any",
"given",
"value",
"."
] | 245c267e832968bad880ca009929043e82c7bc25 | https://github.com/MakerCollider/node-red-contrib-smartnode-hook/blob/245c267e832968bad880ca009929043e82c7bc25/html/scripts/highchart/highcharts-more.src.js#L262-L287 |
|
53,128 | MakerCollider/node-red-contrib-smartnode-hook | html/scripts/highchart/highcharts-more.src.js | function () {
axisProto.setAxisSize.call(this);
if (this.isRadial) {
// Set the center array
this.center = this.pane.center = Highcharts.CenteredSeriesMixin.getCenter.call(this.pane);
// The sector is used in Axis.translate to compute the translation of reversed axis points (#2570)
if (this.isCircular) {
this.sector = this.endAngleRad - this.startAngleRad;
}
// Axis len is used to lay out the ticks
this.len = this.width = this.height = this.center[2] * pick(this.sector, 1) / 2;
}
} | javascript | function () {
axisProto.setAxisSize.call(this);
if (this.isRadial) {
// Set the center array
this.center = this.pane.center = Highcharts.CenteredSeriesMixin.getCenter.call(this.pane);
// The sector is used in Axis.translate to compute the translation of reversed axis points (#2570)
if (this.isCircular) {
this.sector = this.endAngleRad - this.startAngleRad;
}
// Axis len is used to lay out the ticks
this.len = this.width = this.height = this.center[2] * pick(this.sector, 1) / 2;
}
} | [
"function",
"(",
")",
"{",
"axisProto",
".",
"setAxisSize",
".",
"call",
"(",
"this",
")",
";",
"if",
"(",
"this",
".",
"isRadial",
")",
"{",
"// Set the center array",
"this",
".",
"center",
"=",
"this",
".",
"pane",
".",
"center",
"=",
"Highcharts",
".",
"CenteredSeriesMixin",
".",
"getCenter",
".",
"call",
"(",
"this",
".",
"pane",
")",
";",
"// The sector is used in Axis.translate to compute the translation of reversed axis points (#2570)",
"if",
"(",
"this",
".",
"isCircular",
")",
"{",
"this",
".",
"sector",
"=",
"this",
".",
"endAngleRad",
"-",
"this",
".",
"startAngleRad",
";",
"}",
"// Axis len is used to lay out the ticks",
"this",
".",
"len",
"=",
"this",
".",
"width",
"=",
"this",
".",
"height",
"=",
"this",
".",
"center",
"[",
"2",
"]",
"*",
"pick",
"(",
"this",
".",
"sector",
",",
"1",
")",
"/",
"2",
";",
"}",
"}"
] | Override the setAxisSize method to use the arc's circumference as length. This
allows tickPixelInterval to apply to pixel lengths along the perimeter | [
"Override",
"the",
"setAxisSize",
"method",
"to",
"use",
"the",
"arc",
"s",
"circumference",
"as",
"length",
".",
"This",
"allows",
"tickPixelInterval",
"to",
"apply",
"to",
"pixel",
"lengths",
"along",
"the",
"perimeter"
] | 245c267e832968bad880ca009929043e82c7bc25 | https://github.com/MakerCollider/node-red-contrib-smartnode-hook/blob/245c267e832968bad880ca009929043e82c7bc25/html/scripts/highchart/highcharts-more.src.js#L303-L322 |
|
53,129 | MakerCollider/node-red-contrib-smartnode-hook | html/scripts/highchart/highcharts-more.src.js | function (value, length) {
return this.postTranslate(
this.isCircular ? this.translate(value) : 0, // #2848
pick(this.isCircular ? length : this.translate(value), this.center[2] / 2) - this.offset
);
} | javascript | function (value, length) {
return this.postTranslate(
this.isCircular ? this.translate(value) : 0, // #2848
pick(this.isCircular ? length : this.translate(value), this.center[2] / 2) - this.offset
);
} | [
"function",
"(",
"value",
",",
"length",
")",
"{",
"return",
"this",
".",
"postTranslate",
"(",
"this",
".",
"isCircular",
"?",
"this",
".",
"translate",
"(",
"value",
")",
":",
"0",
",",
"// #2848",
"pick",
"(",
"this",
".",
"isCircular",
"?",
"length",
":",
"this",
".",
"translate",
"(",
"value",
")",
",",
"this",
".",
"center",
"[",
"2",
"]",
"/",
"2",
")",
"-",
"this",
".",
"offset",
")",
";",
"}"
] | Returns the x, y coordinate of a point given by a value and a pixel distance
from center | [
"Returns",
"the",
"x",
"y",
"coordinate",
"of",
"a",
"point",
"given",
"by",
"a",
"value",
"and",
"a",
"pixel",
"distance",
"from",
"center"
] | 245c267e832968bad880ca009929043e82c7bc25 | https://github.com/MakerCollider/node-red-contrib-smartnode-hook/blob/245c267e832968bad880ca009929043e82c7bc25/html/scripts/highchart/highcharts-more.src.js#L328-L333 |
|
53,130 | MakerCollider/node-red-contrib-smartnode-hook | html/scripts/highchart/highcharts-more.src.js | function (from, to, options) {
var center = this.center,
startAngleRad = this.startAngleRad,
fullRadius = center[2] / 2,
radii = [
pick(options.outerRadius, '100%'),
options.innerRadius,
pick(options.thickness, 10)
],
percentRegex = /%$/,
start,
end,
open,
isCircular = this.isCircular, // X axis in a polar chart
ret;
// Polygonal plot bands
if (this.options.gridLineInterpolation === 'polygon') {
ret = this.getPlotLinePath(from).concat(this.getPlotLinePath(to, true));
// Circular grid bands
} else {
// Keep within bounds
from = Math.max(from, this.min);
to = Math.min(to, this.max);
// Plot bands on Y axis (radial axis) - inner and outer radius depend on to and from
if (!isCircular) {
radii[0] = this.translate(from);
radii[1] = this.translate(to);
}
// Convert percentages to pixel values
radii = map(radii, function (radius) {
if (percentRegex.test(radius)) {
radius = (pInt(radius, 10) * fullRadius) / 100;
}
return radius;
});
// Handle full circle
if (options.shape === 'circle' || !isCircular) {
start = -Math.PI / 2;
end = Math.PI * 1.5;
open = true;
} else {
start = startAngleRad + this.translate(from);
end = startAngleRad + this.translate(to);
}
ret = this.chart.renderer.symbols.arc(
this.left + center[0],
this.top + center[1],
radii[0],
radii[0],
{
start: Math.min(start, end), // Math is for reversed yAxis (#3606)
end: Math.max(start, end),
innerR: pick(radii[1], radii[0] - radii[2]),
open: open
}
);
}
return ret;
} | javascript | function (from, to, options) {
var center = this.center,
startAngleRad = this.startAngleRad,
fullRadius = center[2] / 2,
radii = [
pick(options.outerRadius, '100%'),
options.innerRadius,
pick(options.thickness, 10)
],
percentRegex = /%$/,
start,
end,
open,
isCircular = this.isCircular, // X axis in a polar chart
ret;
// Polygonal plot bands
if (this.options.gridLineInterpolation === 'polygon') {
ret = this.getPlotLinePath(from).concat(this.getPlotLinePath(to, true));
// Circular grid bands
} else {
// Keep within bounds
from = Math.max(from, this.min);
to = Math.min(to, this.max);
// Plot bands on Y axis (radial axis) - inner and outer radius depend on to and from
if (!isCircular) {
radii[0] = this.translate(from);
radii[1] = this.translate(to);
}
// Convert percentages to pixel values
radii = map(radii, function (radius) {
if (percentRegex.test(radius)) {
radius = (pInt(radius, 10) * fullRadius) / 100;
}
return radius;
});
// Handle full circle
if (options.shape === 'circle' || !isCircular) {
start = -Math.PI / 2;
end = Math.PI * 1.5;
open = true;
} else {
start = startAngleRad + this.translate(from);
end = startAngleRad + this.translate(to);
}
ret = this.chart.renderer.symbols.arc(
this.left + center[0],
this.top + center[1],
radii[0],
radii[0],
{
start: Math.min(start, end), // Math is for reversed yAxis (#3606)
end: Math.max(start, end),
innerR: pick(radii[1], radii[0] - radii[2]),
open: open
}
);
}
return ret;
} | [
"function",
"(",
"from",
",",
"to",
",",
"options",
")",
"{",
"var",
"center",
"=",
"this",
".",
"center",
",",
"startAngleRad",
"=",
"this",
".",
"startAngleRad",
",",
"fullRadius",
"=",
"center",
"[",
"2",
"]",
"/",
"2",
",",
"radii",
"=",
"[",
"pick",
"(",
"options",
".",
"outerRadius",
",",
"'100%'",
")",
",",
"options",
".",
"innerRadius",
",",
"pick",
"(",
"options",
".",
"thickness",
",",
"10",
")",
"]",
",",
"percentRegex",
"=",
"/",
"%$",
"/",
",",
"start",
",",
"end",
",",
"open",
",",
"isCircular",
"=",
"this",
".",
"isCircular",
",",
"// X axis in a polar chart",
"ret",
";",
"// Polygonal plot bands",
"if",
"(",
"this",
".",
"options",
".",
"gridLineInterpolation",
"===",
"'polygon'",
")",
"{",
"ret",
"=",
"this",
".",
"getPlotLinePath",
"(",
"from",
")",
".",
"concat",
"(",
"this",
".",
"getPlotLinePath",
"(",
"to",
",",
"true",
")",
")",
";",
"// Circular grid bands",
"}",
"else",
"{",
"// Keep within bounds",
"from",
"=",
"Math",
".",
"max",
"(",
"from",
",",
"this",
".",
"min",
")",
";",
"to",
"=",
"Math",
".",
"min",
"(",
"to",
",",
"this",
".",
"max",
")",
";",
"// Plot bands on Y axis (radial axis) - inner and outer radius depend on to and from",
"if",
"(",
"!",
"isCircular",
")",
"{",
"radii",
"[",
"0",
"]",
"=",
"this",
".",
"translate",
"(",
"from",
")",
";",
"radii",
"[",
"1",
"]",
"=",
"this",
".",
"translate",
"(",
"to",
")",
";",
"}",
"// Convert percentages to pixel values",
"radii",
"=",
"map",
"(",
"radii",
",",
"function",
"(",
"radius",
")",
"{",
"if",
"(",
"percentRegex",
".",
"test",
"(",
"radius",
")",
")",
"{",
"radius",
"=",
"(",
"pInt",
"(",
"radius",
",",
"10",
")",
"*",
"fullRadius",
")",
"/",
"100",
";",
"}",
"return",
"radius",
";",
"}",
")",
";",
"// Handle full circle",
"if",
"(",
"options",
".",
"shape",
"===",
"'circle'",
"||",
"!",
"isCircular",
")",
"{",
"start",
"=",
"-",
"Math",
".",
"PI",
"/",
"2",
";",
"end",
"=",
"Math",
".",
"PI",
"*",
"1.5",
";",
"open",
"=",
"true",
";",
"}",
"else",
"{",
"start",
"=",
"startAngleRad",
"+",
"this",
".",
"translate",
"(",
"from",
")",
";",
"end",
"=",
"startAngleRad",
"+",
"this",
".",
"translate",
"(",
"to",
")",
";",
"}",
"ret",
"=",
"this",
".",
"chart",
".",
"renderer",
".",
"symbols",
".",
"arc",
"(",
"this",
".",
"left",
"+",
"center",
"[",
"0",
"]",
",",
"this",
".",
"top",
"+",
"center",
"[",
"1",
"]",
",",
"radii",
"[",
"0",
"]",
",",
"radii",
"[",
"0",
"]",
",",
"{",
"start",
":",
"Math",
".",
"min",
"(",
"start",
",",
"end",
")",
",",
"// Math is for reversed yAxis (#3606)",
"end",
":",
"Math",
".",
"max",
"(",
"start",
",",
"end",
")",
",",
"innerR",
":",
"pick",
"(",
"radii",
"[",
"1",
"]",
",",
"radii",
"[",
"0",
"]",
"-",
"radii",
"[",
"2",
"]",
")",
",",
"open",
":",
"open",
"}",
")",
";",
"}",
"return",
"ret",
";",
"}"
] | Find the path for plot bands along the radial axis | [
"Find",
"the",
"path",
"for",
"plot",
"bands",
"along",
"the",
"radial",
"axis"
] | 245c267e832968bad880ca009929043e82c7bc25 | https://github.com/MakerCollider/node-red-contrib-smartnode-hook/blob/245c267e832968bad880ca009929043e82c7bc25/html/scripts/highchart/highcharts-more.src.js#L355-L422 |
|
53,131 | MakerCollider/node-red-contrib-smartnode-hook | html/scripts/highchart/highcharts-more.src.js | function (value, reverse) {
var axis = this,
center = axis.center,
chart = axis.chart,
end = axis.getPosition(value),
xAxis,
xy,
tickPositions,
ret;
// Spokes
if (axis.isCircular) {
ret = ['M', center[0] + chart.plotLeft, center[1] + chart.plotTop, 'L', end.x, end.y];
// Concentric circles
} else if (axis.options.gridLineInterpolation === 'circle') {
value = axis.translate(value);
if (value) { // a value of 0 is in the center
ret = axis.getLinePath(0, value);
}
// Concentric polygons
} else {
// Find the X axis in the same pane
each(chart.xAxis, function (a) {
if (a.pane === axis.pane) {
xAxis = a;
}
});
ret = [];
value = axis.translate(value);
tickPositions = xAxis.tickPositions;
if (xAxis.autoConnect) {
tickPositions = tickPositions.concat([tickPositions[0]]);
}
// Reverse the positions for concatenation of polygonal plot bands
if (reverse) {
tickPositions = [].concat(tickPositions).reverse();
}
each(tickPositions, function (pos, i) {
xy = xAxis.getPosition(pos, value);
ret.push(i ? 'L' : 'M', xy.x, xy.y);
});
}
return ret;
} | javascript | function (value, reverse) {
var axis = this,
center = axis.center,
chart = axis.chart,
end = axis.getPosition(value),
xAxis,
xy,
tickPositions,
ret;
// Spokes
if (axis.isCircular) {
ret = ['M', center[0] + chart.plotLeft, center[1] + chart.plotTop, 'L', end.x, end.y];
// Concentric circles
} else if (axis.options.gridLineInterpolation === 'circle') {
value = axis.translate(value);
if (value) { // a value of 0 is in the center
ret = axis.getLinePath(0, value);
}
// Concentric polygons
} else {
// Find the X axis in the same pane
each(chart.xAxis, function (a) {
if (a.pane === axis.pane) {
xAxis = a;
}
});
ret = [];
value = axis.translate(value);
tickPositions = xAxis.tickPositions;
if (xAxis.autoConnect) {
tickPositions = tickPositions.concat([tickPositions[0]]);
}
// Reverse the positions for concatenation of polygonal plot bands
if (reverse) {
tickPositions = [].concat(tickPositions).reverse();
}
each(tickPositions, function (pos, i) {
xy = xAxis.getPosition(pos, value);
ret.push(i ? 'L' : 'M', xy.x, xy.y);
});
}
return ret;
} | [
"function",
"(",
"value",
",",
"reverse",
")",
"{",
"var",
"axis",
"=",
"this",
",",
"center",
"=",
"axis",
".",
"center",
",",
"chart",
"=",
"axis",
".",
"chart",
",",
"end",
"=",
"axis",
".",
"getPosition",
"(",
"value",
")",
",",
"xAxis",
",",
"xy",
",",
"tickPositions",
",",
"ret",
";",
"// Spokes",
"if",
"(",
"axis",
".",
"isCircular",
")",
"{",
"ret",
"=",
"[",
"'M'",
",",
"center",
"[",
"0",
"]",
"+",
"chart",
".",
"plotLeft",
",",
"center",
"[",
"1",
"]",
"+",
"chart",
".",
"plotTop",
",",
"'L'",
",",
"end",
".",
"x",
",",
"end",
".",
"y",
"]",
";",
"// Concentric circles\t\t\t",
"}",
"else",
"if",
"(",
"axis",
".",
"options",
".",
"gridLineInterpolation",
"===",
"'circle'",
")",
"{",
"value",
"=",
"axis",
".",
"translate",
"(",
"value",
")",
";",
"if",
"(",
"value",
")",
"{",
"// a value of 0 is in the center",
"ret",
"=",
"axis",
".",
"getLinePath",
"(",
"0",
",",
"value",
")",
";",
"}",
"// Concentric polygons ",
"}",
"else",
"{",
"// Find the X axis in the same pane",
"each",
"(",
"chart",
".",
"xAxis",
",",
"function",
"(",
"a",
")",
"{",
"if",
"(",
"a",
".",
"pane",
"===",
"axis",
".",
"pane",
")",
"{",
"xAxis",
"=",
"a",
";",
"}",
"}",
")",
";",
"ret",
"=",
"[",
"]",
";",
"value",
"=",
"axis",
".",
"translate",
"(",
"value",
")",
";",
"tickPositions",
"=",
"xAxis",
".",
"tickPositions",
";",
"if",
"(",
"xAxis",
".",
"autoConnect",
")",
"{",
"tickPositions",
"=",
"tickPositions",
".",
"concat",
"(",
"[",
"tickPositions",
"[",
"0",
"]",
"]",
")",
";",
"}",
"// Reverse the positions for concatenation of polygonal plot bands",
"if",
"(",
"reverse",
")",
"{",
"tickPositions",
"=",
"[",
"]",
".",
"concat",
"(",
"tickPositions",
")",
".",
"reverse",
"(",
")",
";",
"}",
"each",
"(",
"tickPositions",
",",
"function",
"(",
"pos",
",",
"i",
")",
"{",
"xy",
"=",
"xAxis",
".",
"getPosition",
"(",
"pos",
",",
"value",
")",
";",
"ret",
".",
"push",
"(",
"i",
"?",
"'L'",
":",
"'M'",
",",
"xy",
".",
"x",
",",
"xy",
".",
"y",
")",
";",
"}",
")",
";",
"}",
"return",
"ret",
";",
"}"
] | Find the path for plot lines perpendicular to the radial axis. | [
"Find",
"the",
"path",
"for",
"plot",
"lines",
"perpendicular",
"to",
"the",
"radial",
"axis",
"."
] | 245c267e832968bad880ca009929043e82c7bc25 | https://github.com/MakerCollider/node-red-contrib-smartnode-hook/blob/245c267e832968bad880ca009929043e82c7bc25/html/scripts/highchart/highcharts-more.src.js#L427-L473 |
|
53,132 | MakerCollider/node-red-contrib-smartnode-hook | html/scripts/highchart/highcharts-more.src.js | function () {
var center = this.center,
chart = this.chart,
titleOptions = this.options.title;
return {
x: chart.plotLeft + center[0] + (titleOptions.x || 0),
y: chart.plotTop + center[1] - ({ high: 0.5, middle: 0.25, low: 0 }[titleOptions.align] *
center[2]) + (titleOptions.y || 0)
};
} | javascript | function () {
var center = this.center,
chart = this.chart,
titleOptions = this.options.title;
return {
x: chart.plotLeft + center[0] + (titleOptions.x || 0),
y: chart.plotTop + center[1] - ({ high: 0.5, middle: 0.25, low: 0 }[titleOptions.align] *
center[2]) + (titleOptions.y || 0)
};
} | [
"function",
"(",
")",
"{",
"var",
"center",
"=",
"this",
".",
"center",
",",
"chart",
"=",
"this",
".",
"chart",
",",
"titleOptions",
"=",
"this",
".",
"options",
".",
"title",
";",
"return",
"{",
"x",
":",
"chart",
".",
"plotLeft",
"+",
"center",
"[",
"0",
"]",
"+",
"(",
"titleOptions",
".",
"x",
"||",
"0",
")",
",",
"y",
":",
"chart",
".",
"plotTop",
"+",
"center",
"[",
"1",
"]",
"-",
"(",
"{",
"high",
":",
"0.5",
",",
"middle",
":",
"0.25",
",",
"low",
":",
"0",
"}",
"[",
"titleOptions",
".",
"align",
"]",
"*",
"center",
"[",
"2",
"]",
")",
"+",
"(",
"titleOptions",
".",
"y",
"||",
"0",
")",
"}",
";",
"}"
] | Find the position for the axis title, by default inside the gauge | [
"Find",
"the",
"position",
"for",
"the",
"axis",
"title",
"by",
"default",
"inside",
"the",
"gauge"
] | 245c267e832968bad880ca009929043e82c7bc25 | https://github.com/MakerCollider/node-red-contrib-smartnode-hook/blob/245c267e832968bad880ca009929043e82c7bc25/html/scripts/highchart/highcharts-more.src.js#L478-L488 |
|
53,133 | MakerCollider/node-red-contrib-smartnode-hook | html/scripts/highchart/highcharts-more.src.js | function (segment) {
var lowSegment,
highSegment = [],
i = segment.length,
baseGetSegmentPath = Series.prototype.getSegmentPath,
point,
linePath,
lowerPath,
options = this.options,
step = options.step,
higherPath;
// Remove nulls from low segment
lowSegment = HighchartsAdapter.grep(segment, function (point) {
return point.plotLow !== null;
});
// Make a segment with plotX and plotY for the top values
while (i--) {
point = segment[i];
if (point.plotHigh !== null) {
highSegment.push({
plotX: point.plotHighX || point.plotX, // plotHighX is for polar charts
plotY: point.plotHigh
});
}
}
// Get the paths
lowerPath = baseGetSegmentPath.call(this, lowSegment);
if (step) {
if (step === true) {
step = 'left';
}
options.step = { left: 'right', center: 'center', right: 'left' }[step]; // swap for reading in getSegmentPath
}
higherPath = baseGetSegmentPath.call(this, highSegment);
options.step = step;
// Create a line on both top and bottom of the range
linePath = [].concat(lowerPath, higherPath);
// For the area path, we need to change the 'move' statement into 'lineTo' or 'curveTo'
if (!this.chart.polar) {
higherPath[0] = 'L'; // this probably doesn't work for spline
}
this.areaPath = this.areaPath.concat(lowerPath, higherPath);
return linePath;
} | javascript | function (segment) {
var lowSegment,
highSegment = [],
i = segment.length,
baseGetSegmentPath = Series.prototype.getSegmentPath,
point,
linePath,
lowerPath,
options = this.options,
step = options.step,
higherPath;
// Remove nulls from low segment
lowSegment = HighchartsAdapter.grep(segment, function (point) {
return point.plotLow !== null;
});
// Make a segment with plotX and plotY for the top values
while (i--) {
point = segment[i];
if (point.plotHigh !== null) {
highSegment.push({
plotX: point.plotHighX || point.plotX, // plotHighX is for polar charts
plotY: point.plotHigh
});
}
}
// Get the paths
lowerPath = baseGetSegmentPath.call(this, lowSegment);
if (step) {
if (step === true) {
step = 'left';
}
options.step = { left: 'right', center: 'center', right: 'left' }[step]; // swap for reading in getSegmentPath
}
higherPath = baseGetSegmentPath.call(this, highSegment);
options.step = step;
// Create a line on both top and bottom of the range
linePath = [].concat(lowerPath, higherPath);
// For the area path, we need to change the 'move' statement into 'lineTo' or 'curveTo'
if (!this.chart.polar) {
higherPath[0] = 'L'; // this probably doesn't work for spline
}
this.areaPath = this.areaPath.concat(lowerPath, higherPath);
return linePath;
} | [
"function",
"(",
"segment",
")",
"{",
"var",
"lowSegment",
",",
"highSegment",
"=",
"[",
"]",
",",
"i",
"=",
"segment",
".",
"length",
",",
"baseGetSegmentPath",
"=",
"Series",
".",
"prototype",
".",
"getSegmentPath",
",",
"point",
",",
"linePath",
",",
"lowerPath",
",",
"options",
"=",
"this",
".",
"options",
",",
"step",
"=",
"options",
".",
"step",
",",
"higherPath",
";",
"// Remove nulls from low segment",
"lowSegment",
"=",
"HighchartsAdapter",
".",
"grep",
"(",
"segment",
",",
"function",
"(",
"point",
")",
"{",
"return",
"point",
".",
"plotLow",
"!==",
"null",
";",
"}",
")",
";",
"// Make a segment with plotX and plotY for the top values",
"while",
"(",
"i",
"--",
")",
"{",
"point",
"=",
"segment",
"[",
"i",
"]",
";",
"if",
"(",
"point",
".",
"plotHigh",
"!==",
"null",
")",
"{",
"highSegment",
".",
"push",
"(",
"{",
"plotX",
":",
"point",
".",
"plotHighX",
"||",
"point",
".",
"plotX",
",",
"// plotHighX is for polar charts",
"plotY",
":",
"point",
".",
"plotHigh",
"}",
")",
";",
"}",
"}",
"// Get the paths",
"lowerPath",
"=",
"baseGetSegmentPath",
".",
"call",
"(",
"this",
",",
"lowSegment",
")",
";",
"if",
"(",
"step",
")",
"{",
"if",
"(",
"step",
"===",
"true",
")",
"{",
"step",
"=",
"'left'",
";",
"}",
"options",
".",
"step",
"=",
"{",
"left",
":",
"'right'",
",",
"center",
":",
"'center'",
",",
"right",
":",
"'left'",
"}",
"[",
"step",
"]",
";",
"// swap for reading in getSegmentPath",
"}",
"higherPath",
"=",
"baseGetSegmentPath",
".",
"call",
"(",
"this",
",",
"highSegment",
")",
";",
"options",
".",
"step",
"=",
"step",
";",
"// Create a line on both top and bottom of the range",
"linePath",
"=",
"[",
"]",
".",
"concat",
"(",
"lowerPath",
",",
"higherPath",
")",
";",
"// For the area path, we need to change the 'move' statement into 'lineTo' or 'curveTo'",
"if",
"(",
"!",
"this",
".",
"chart",
".",
"polar",
")",
"{",
"higherPath",
"[",
"0",
"]",
"=",
"'L'",
";",
"// this probably doesn't work for spline",
"}",
"this",
".",
"areaPath",
"=",
"this",
".",
"areaPath",
".",
"concat",
"(",
"lowerPath",
",",
"higherPath",
")",
";",
"return",
"linePath",
";",
"}"
] | Extend the line series' getSegmentPath method by applying the segment
path to both lower and higher values of the range | [
"Extend",
"the",
"line",
"series",
"getSegmentPath",
"method",
"by",
"applying",
"the",
"segment",
"path",
"to",
"both",
"lower",
"and",
"higher",
"values",
"of",
"the",
"range"
] | 245c267e832968bad880ca009929043e82c7bc25 | https://github.com/MakerCollider/node-red-contrib-smartnode-hook/blob/245c267e832968bad880ca009929043e82c7bc25/html/scripts/highchart/highcharts-more.src.js#L769-L819 |
|
53,134 | MakerCollider/node-red-contrib-smartnode-hook | html/scripts/highchart/highcharts-more.src.js | function () {
var data = this.data,
length = data.length,
i,
originalDataLabels = [],
seriesProto = Series.prototype,
dataLabelOptions = this.options.dataLabels,
align = dataLabelOptions.align,
point,
inverted = this.chart.inverted;
if (dataLabelOptions.enabled || this._hasPointLabels) {
// Step 1: set preliminary values for plotY and dataLabel and draw the upper labels
i = length;
while (i--) {
point = data[i];
// Set preliminary values
point.y = point.high;
point._plotY = point.plotY;
point.plotY = point.plotHigh;
// Store original data labels and set preliminary label objects to be picked up
// in the uber method
originalDataLabels[i] = point.dataLabel;
point.dataLabel = point.dataLabelUpper;
// Set the default offset
point.below = false;
if (inverted) {
if (!align) {
dataLabelOptions.align = 'left';
}
dataLabelOptions.x = dataLabelOptions.xHigh;
} else {
dataLabelOptions.y = dataLabelOptions.yHigh;
}
}
if (seriesProto.drawDataLabels) {
seriesProto.drawDataLabels.apply(this, arguments); // #1209
}
// Step 2: reorganize and handle data labels for the lower values
i = length;
while (i--) {
point = data[i];
// Move the generated labels from step 1, and reassign the original data labels
point.dataLabelUpper = point.dataLabel;
point.dataLabel = originalDataLabels[i];
// Reset values
point.y = point.low;
point.plotY = point._plotY;
// Set the default offset
point.below = true;
if (inverted) {
if (!align) {
dataLabelOptions.align = 'right';
}
dataLabelOptions.x = dataLabelOptions.xLow;
} else {
dataLabelOptions.y = dataLabelOptions.yLow;
}
}
if (seriesProto.drawDataLabels) {
seriesProto.drawDataLabels.apply(this, arguments);
}
}
dataLabelOptions.align = align;
} | javascript | function () {
var data = this.data,
length = data.length,
i,
originalDataLabels = [],
seriesProto = Series.prototype,
dataLabelOptions = this.options.dataLabels,
align = dataLabelOptions.align,
point,
inverted = this.chart.inverted;
if (dataLabelOptions.enabled || this._hasPointLabels) {
// Step 1: set preliminary values for plotY and dataLabel and draw the upper labels
i = length;
while (i--) {
point = data[i];
// Set preliminary values
point.y = point.high;
point._plotY = point.plotY;
point.plotY = point.plotHigh;
// Store original data labels and set preliminary label objects to be picked up
// in the uber method
originalDataLabels[i] = point.dataLabel;
point.dataLabel = point.dataLabelUpper;
// Set the default offset
point.below = false;
if (inverted) {
if (!align) {
dataLabelOptions.align = 'left';
}
dataLabelOptions.x = dataLabelOptions.xHigh;
} else {
dataLabelOptions.y = dataLabelOptions.yHigh;
}
}
if (seriesProto.drawDataLabels) {
seriesProto.drawDataLabels.apply(this, arguments); // #1209
}
// Step 2: reorganize and handle data labels for the lower values
i = length;
while (i--) {
point = data[i];
// Move the generated labels from step 1, and reassign the original data labels
point.dataLabelUpper = point.dataLabel;
point.dataLabel = originalDataLabels[i];
// Reset values
point.y = point.low;
point.plotY = point._plotY;
// Set the default offset
point.below = true;
if (inverted) {
if (!align) {
dataLabelOptions.align = 'right';
}
dataLabelOptions.x = dataLabelOptions.xLow;
} else {
dataLabelOptions.y = dataLabelOptions.yLow;
}
}
if (seriesProto.drawDataLabels) {
seriesProto.drawDataLabels.apply(this, arguments);
}
}
dataLabelOptions.align = align;
} | [
"function",
"(",
")",
"{",
"var",
"data",
"=",
"this",
".",
"data",
",",
"length",
"=",
"data",
".",
"length",
",",
"i",
",",
"originalDataLabels",
"=",
"[",
"]",
",",
"seriesProto",
"=",
"Series",
".",
"prototype",
",",
"dataLabelOptions",
"=",
"this",
".",
"options",
".",
"dataLabels",
",",
"align",
"=",
"dataLabelOptions",
".",
"align",
",",
"point",
",",
"inverted",
"=",
"this",
".",
"chart",
".",
"inverted",
";",
"if",
"(",
"dataLabelOptions",
".",
"enabled",
"||",
"this",
".",
"_hasPointLabels",
")",
"{",
"// Step 1: set preliminary values for plotY and dataLabel and draw the upper labels",
"i",
"=",
"length",
";",
"while",
"(",
"i",
"--",
")",
"{",
"point",
"=",
"data",
"[",
"i",
"]",
";",
"// Set preliminary values",
"point",
".",
"y",
"=",
"point",
".",
"high",
";",
"point",
".",
"_plotY",
"=",
"point",
".",
"plotY",
";",
"point",
".",
"plotY",
"=",
"point",
".",
"plotHigh",
";",
"// Store original data labels and set preliminary label objects to be picked up ",
"// in the uber method",
"originalDataLabels",
"[",
"i",
"]",
"=",
"point",
".",
"dataLabel",
";",
"point",
".",
"dataLabel",
"=",
"point",
".",
"dataLabelUpper",
";",
"// Set the default offset",
"point",
".",
"below",
"=",
"false",
";",
"if",
"(",
"inverted",
")",
"{",
"if",
"(",
"!",
"align",
")",
"{",
"dataLabelOptions",
".",
"align",
"=",
"'left'",
";",
"}",
"dataLabelOptions",
".",
"x",
"=",
"dataLabelOptions",
".",
"xHigh",
";",
"}",
"else",
"{",
"dataLabelOptions",
".",
"y",
"=",
"dataLabelOptions",
".",
"yHigh",
";",
"}",
"}",
"if",
"(",
"seriesProto",
".",
"drawDataLabels",
")",
"{",
"seriesProto",
".",
"drawDataLabels",
".",
"apply",
"(",
"this",
",",
"arguments",
")",
";",
"// #1209",
"}",
"// Step 2: reorganize and handle data labels for the lower values",
"i",
"=",
"length",
";",
"while",
"(",
"i",
"--",
")",
"{",
"point",
"=",
"data",
"[",
"i",
"]",
";",
"// Move the generated labels from step 1, and reassign the original data labels",
"point",
".",
"dataLabelUpper",
"=",
"point",
".",
"dataLabel",
";",
"point",
".",
"dataLabel",
"=",
"originalDataLabels",
"[",
"i",
"]",
";",
"// Reset values",
"point",
".",
"y",
"=",
"point",
".",
"low",
";",
"point",
".",
"plotY",
"=",
"point",
".",
"_plotY",
";",
"// Set the default offset",
"point",
".",
"below",
"=",
"true",
";",
"if",
"(",
"inverted",
")",
"{",
"if",
"(",
"!",
"align",
")",
"{",
"dataLabelOptions",
".",
"align",
"=",
"'right'",
";",
"}",
"dataLabelOptions",
".",
"x",
"=",
"dataLabelOptions",
".",
"xLow",
";",
"}",
"else",
"{",
"dataLabelOptions",
".",
"y",
"=",
"dataLabelOptions",
".",
"yLow",
";",
"}",
"}",
"if",
"(",
"seriesProto",
".",
"drawDataLabels",
")",
"{",
"seriesProto",
".",
"drawDataLabels",
".",
"apply",
"(",
"this",
",",
"arguments",
")",
";",
"}",
"}",
"dataLabelOptions",
".",
"align",
"=",
"align",
";",
"}"
] | Extend the basic drawDataLabels method by running it for both lower and higher
values. | [
"Extend",
"the",
"basic",
"drawDataLabels",
"method",
"by",
"running",
"it",
"for",
"both",
"lower",
"and",
"higher",
"values",
"."
] | 245c267e832968bad880ca009929043e82c7bc25 | https://github.com/MakerCollider/node-red-contrib-smartnode-hook/blob/245c267e832968bad880ca009929043e82c7bc25/html/scripts/highchart/highcharts-more.src.js#L825-L901 |
|
53,135 | MakerCollider/node-red-contrib-smartnode-hook | html/scripts/highchart/highcharts-more.src.js | function () {
var series = this,
yAxis = series.yAxis,
options = series.options,
center = yAxis.center;
series.generatePoints();
each(series.points, function (point) {
var dialOptions = merge(options.dial, point.dial),
radius = (pInt(pick(dialOptions.radius, 80)) * center[2]) / 200,
baseLength = (pInt(pick(dialOptions.baseLength, 70)) * radius) / 100,
rearLength = (pInt(pick(dialOptions.rearLength, 10)) * radius) / 100,
baseWidth = dialOptions.baseWidth || 3,
topWidth = dialOptions.topWidth || 1,
overshoot = options.overshoot,
rotation = yAxis.startAngleRad + yAxis.translate(point.y, null, null, null, true);
// Handle the wrap and overshoot options
if (overshoot && typeof overshoot === 'number') {
overshoot = overshoot / 180 * Math.PI;
rotation = Math.max(yAxis.startAngleRad - overshoot, Math.min(yAxis.endAngleRad + overshoot, rotation));
} else if (options.wrap === false) {
rotation = Math.max(yAxis.startAngleRad, Math.min(yAxis.endAngleRad, rotation));
}
rotation = rotation * 180 / Math.PI;
point.shapeType = 'path';
point.shapeArgs = {
d: dialOptions.path || [
'M',
-rearLength, -baseWidth / 2,
'L',
baseLength, -baseWidth / 2,
radius, -topWidth / 2,
radius, topWidth / 2,
baseLength, baseWidth / 2,
-rearLength, baseWidth / 2,
'z'
],
translateX: center[0],
translateY: center[1],
rotation: rotation
};
// Positions for data label
point.plotX = center[0];
point.plotY = center[1];
});
} | javascript | function () {
var series = this,
yAxis = series.yAxis,
options = series.options,
center = yAxis.center;
series.generatePoints();
each(series.points, function (point) {
var dialOptions = merge(options.dial, point.dial),
radius = (pInt(pick(dialOptions.radius, 80)) * center[2]) / 200,
baseLength = (pInt(pick(dialOptions.baseLength, 70)) * radius) / 100,
rearLength = (pInt(pick(dialOptions.rearLength, 10)) * radius) / 100,
baseWidth = dialOptions.baseWidth || 3,
topWidth = dialOptions.topWidth || 1,
overshoot = options.overshoot,
rotation = yAxis.startAngleRad + yAxis.translate(point.y, null, null, null, true);
// Handle the wrap and overshoot options
if (overshoot && typeof overshoot === 'number') {
overshoot = overshoot / 180 * Math.PI;
rotation = Math.max(yAxis.startAngleRad - overshoot, Math.min(yAxis.endAngleRad + overshoot, rotation));
} else if (options.wrap === false) {
rotation = Math.max(yAxis.startAngleRad, Math.min(yAxis.endAngleRad, rotation));
}
rotation = rotation * 180 / Math.PI;
point.shapeType = 'path';
point.shapeArgs = {
d: dialOptions.path || [
'M',
-rearLength, -baseWidth / 2,
'L',
baseLength, -baseWidth / 2,
radius, -topWidth / 2,
radius, topWidth / 2,
baseLength, baseWidth / 2,
-rearLength, baseWidth / 2,
'z'
],
translateX: center[0],
translateY: center[1],
rotation: rotation
};
// Positions for data label
point.plotX = center[0];
point.plotY = center[1];
});
} | [
"function",
"(",
")",
"{",
"var",
"series",
"=",
"this",
",",
"yAxis",
"=",
"series",
".",
"yAxis",
",",
"options",
"=",
"series",
".",
"options",
",",
"center",
"=",
"yAxis",
".",
"center",
";",
"series",
".",
"generatePoints",
"(",
")",
";",
"each",
"(",
"series",
".",
"points",
",",
"function",
"(",
"point",
")",
"{",
"var",
"dialOptions",
"=",
"merge",
"(",
"options",
".",
"dial",
",",
"point",
".",
"dial",
")",
",",
"radius",
"=",
"(",
"pInt",
"(",
"pick",
"(",
"dialOptions",
".",
"radius",
",",
"80",
")",
")",
"*",
"center",
"[",
"2",
"]",
")",
"/",
"200",
",",
"baseLength",
"=",
"(",
"pInt",
"(",
"pick",
"(",
"dialOptions",
".",
"baseLength",
",",
"70",
")",
")",
"*",
"radius",
")",
"/",
"100",
",",
"rearLength",
"=",
"(",
"pInt",
"(",
"pick",
"(",
"dialOptions",
".",
"rearLength",
",",
"10",
")",
")",
"*",
"radius",
")",
"/",
"100",
",",
"baseWidth",
"=",
"dialOptions",
".",
"baseWidth",
"||",
"3",
",",
"topWidth",
"=",
"dialOptions",
".",
"topWidth",
"||",
"1",
",",
"overshoot",
"=",
"options",
".",
"overshoot",
",",
"rotation",
"=",
"yAxis",
".",
"startAngleRad",
"+",
"yAxis",
".",
"translate",
"(",
"point",
".",
"y",
",",
"null",
",",
"null",
",",
"null",
",",
"true",
")",
";",
"// Handle the wrap and overshoot options",
"if",
"(",
"overshoot",
"&&",
"typeof",
"overshoot",
"===",
"'number'",
")",
"{",
"overshoot",
"=",
"overshoot",
"/",
"180",
"*",
"Math",
".",
"PI",
";",
"rotation",
"=",
"Math",
".",
"max",
"(",
"yAxis",
".",
"startAngleRad",
"-",
"overshoot",
",",
"Math",
".",
"min",
"(",
"yAxis",
".",
"endAngleRad",
"+",
"overshoot",
",",
"rotation",
")",
")",
";",
"}",
"else",
"if",
"(",
"options",
".",
"wrap",
"===",
"false",
")",
"{",
"rotation",
"=",
"Math",
".",
"max",
"(",
"yAxis",
".",
"startAngleRad",
",",
"Math",
".",
"min",
"(",
"yAxis",
".",
"endAngleRad",
",",
"rotation",
")",
")",
";",
"}",
"rotation",
"=",
"rotation",
"*",
"180",
"/",
"Math",
".",
"PI",
";",
"point",
".",
"shapeType",
"=",
"'path'",
";",
"point",
".",
"shapeArgs",
"=",
"{",
"d",
":",
"dialOptions",
".",
"path",
"||",
"[",
"'M'",
",",
"-",
"rearLength",
",",
"-",
"baseWidth",
"/",
"2",
",",
"'L'",
",",
"baseLength",
",",
"-",
"baseWidth",
"/",
"2",
",",
"radius",
",",
"-",
"topWidth",
"/",
"2",
",",
"radius",
",",
"topWidth",
"/",
"2",
",",
"baseLength",
",",
"baseWidth",
"/",
"2",
",",
"-",
"rearLength",
",",
"baseWidth",
"/",
"2",
",",
"'z'",
"]",
",",
"translateX",
":",
"center",
"[",
"0",
"]",
",",
"translateY",
":",
"center",
"[",
"1",
"]",
",",
"rotation",
":",
"rotation",
"}",
";",
"// Positions for data label",
"point",
".",
"plotX",
"=",
"center",
"[",
"0",
"]",
";",
"point",
".",
"plotY",
"=",
"center",
"[",
"1",
"]",
";",
"}",
")",
";",
"}"
] | Calculate paths etc | [
"Calculate",
"paths",
"etc"
] | 245c267e832968bad880ca009929043e82c7bc25 | https://github.com/MakerCollider/node-red-contrib-smartnode-hook/blob/245c267e832968bad880ca009929043e82c7bc25/html/scripts/highchart/highcharts-more.src.js#L1063-L1116 |
|
53,136 | MakerCollider/node-red-contrib-smartnode-hook | html/scripts/highchart/highcharts-more.src.js | function (init) {
var series = this;
if (!init) {
each(series.points, function (point) {
var graphic = point.graphic;
if (graphic) {
// start value
graphic.attr({
rotation: series.yAxis.startAngleRad * 180 / Math.PI
});
// animate
graphic.animate({
rotation: point.shapeArgs.rotation
}, series.options.animation);
}
});
// delete this function to allow it only once
series.animate = null;
}
} | javascript | function (init) {
var series = this;
if (!init) {
each(series.points, function (point) {
var graphic = point.graphic;
if (graphic) {
// start value
graphic.attr({
rotation: series.yAxis.startAngleRad * 180 / Math.PI
});
// animate
graphic.animate({
rotation: point.shapeArgs.rotation
}, series.options.animation);
}
});
// delete this function to allow it only once
series.animate = null;
}
} | [
"function",
"(",
"init",
")",
"{",
"var",
"series",
"=",
"this",
";",
"if",
"(",
"!",
"init",
")",
"{",
"each",
"(",
"series",
".",
"points",
",",
"function",
"(",
"point",
")",
"{",
"var",
"graphic",
"=",
"point",
".",
"graphic",
";",
"if",
"(",
"graphic",
")",
"{",
"// start value",
"graphic",
".",
"attr",
"(",
"{",
"rotation",
":",
"series",
".",
"yAxis",
".",
"startAngleRad",
"*",
"180",
"/",
"Math",
".",
"PI",
"}",
")",
";",
"// animate",
"graphic",
".",
"animate",
"(",
"{",
"rotation",
":",
"point",
".",
"shapeArgs",
".",
"rotation",
"}",
",",
"series",
".",
"options",
".",
"animation",
")",
";",
"}",
"}",
")",
";",
"// delete this function to allow it only once",
"series",
".",
"animate",
"=",
"null",
";",
"}",
"}"
] | Animate the arrow up from startAngle | [
"Animate",
"the",
"arrow",
"up",
"from",
"startAngle"
] | 245c267e832968bad880ca009929043e82c7bc25 | https://github.com/MakerCollider/node-red-contrib-smartnode-hook/blob/245c267e832968bad880ca009929043e82c7bc25/html/scripts/highchart/highcharts-more.src.js#L1173-L1196 |
|
53,137 | MakerCollider/node-red-contrib-smartnode-hook | html/scripts/highchart/highcharts-more.src.js | function (point) { // return a plain array for speedy calculation
return [point.low, point.q1, point.median, point.q3, point.high];
} | javascript | function (point) { // return a plain array for speedy calculation
return [point.low, point.q1, point.median, point.q3, point.high];
} | [
"function",
"(",
"point",
")",
"{",
"// return a plain array for speedy calculation",
"return",
"[",
"point",
".",
"low",
",",
"point",
".",
"q1",
",",
"point",
".",
"median",
",",
"point",
".",
"q3",
",",
"point",
".",
"high",
"]",
";",
"}"
] | array point configs are mapped to this | [
"array",
"point",
"configs",
"are",
"mapped",
"to",
"this"
] | 245c267e832968bad880ca009929043e82c7bc25 | https://github.com/MakerCollider/node-red-contrib-smartnode-hook/blob/245c267e832968bad880ca009929043e82c7bc25/html/scripts/highchart/highcharts-more.src.js#L1267-L1269 |
|
53,138 | MakerCollider/node-red-contrib-smartnode-hook | html/scripts/highchart/highcharts-more.src.js | function (force) {
var series = this,
options = series.options,
yData = series.yData,
points = series.options.data, // #3710 Update point does not propagate to sum
point,
dataLength = yData.length,
threshold = options.threshold || 0,
subSum,
sum,
dataMin,
dataMax,
y,
i;
sum = subSum = dataMin = dataMax = threshold;
for (i = 0; i < dataLength; i++) {
y = yData[i];
point = points && points[i] ? points[i] : {};
if (y === "sum" || point.isSum) {
yData[i] = sum;
} else if (y === "intermediateSum" || point.isIntermediateSum) {
yData[i] = subSum;
} else {
sum += y;
subSum += y;
}
dataMin = Math.min(sum, dataMin);
dataMax = Math.max(sum, dataMax);
}
Series.prototype.processData.call(this, force);
// Record extremes
series.dataMin = dataMin;
series.dataMax = dataMax;
} | javascript | function (force) {
var series = this,
options = series.options,
yData = series.yData,
points = series.options.data, // #3710 Update point does not propagate to sum
point,
dataLength = yData.length,
threshold = options.threshold || 0,
subSum,
sum,
dataMin,
dataMax,
y,
i;
sum = subSum = dataMin = dataMax = threshold;
for (i = 0; i < dataLength; i++) {
y = yData[i];
point = points && points[i] ? points[i] : {};
if (y === "sum" || point.isSum) {
yData[i] = sum;
} else if (y === "intermediateSum" || point.isIntermediateSum) {
yData[i] = subSum;
} else {
sum += y;
subSum += y;
}
dataMin = Math.min(sum, dataMin);
dataMax = Math.max(sum, dataMax);
}
Series.prototype.processData.call(this, force);
// Record extremes
series.dataMin = dataMin;
series.dataMax = dataMax;
} | [
"function",
"(",
"force",
")",
"{",
"var",
"series",
"=",
"this",
",",
"options",
"=",
"series",
".",
"options",
",",
"yData",
"=",
"series",
".",
"yData",
",",
"points",
"=",
"series",
".",
"options",
".",
"data",
",",
"// #3710 Update point does not propagate to sum",
"point",
",",
"dataLength",
"=",
"yData",
".",
"length",
",",
"threshold",
"=",
"options",
".",
"threshold",
"||",
"0",
",",
"subSum",
",",
"sum",
",",
"dataMin",
",",
"dataMax",
",",
"y",
",",
"i",
";",
"sum",
"=",
"subSum",
"=",
"dataMin",
"=",
"dataMax",
"=",
"threshold",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"dataLength",
";",
"i",
"++",
")",
"{",
"y",
"=",
"yData",
"[",
"i",
"]",
";",
"point",
"=",
"points",
"&&",
"points",
"[",
"i",
"]",
"?",
"points",
"[",
"i",
"]",
":",
"{",
"}",
";",
"if",
"(",
"y",
"===",
"\"sum\"",
"||",
"point",
".",
"isSum",
")",
"{",
"yData",
"[",
"i",
"]",
"=",
"sum",
";",
"}",
"else",
"if",
"(",
"y",
"===",
"\"intermediateSum\"",
"||",
"point",
".",
"isIntermediateSum",
")",
"{",
"yData",
"[",
"i",
"]",
"=",
"subSum",
";",
"}",
"else",
"{",
"sum",
"+=",
"y",
";",
"subSum",
"+=",
"y",
";",
"}",
"dataMin",
"=",
"Math",
".",
"min",
"(",
"sum",
",",
"dataMin",
")",
";",
"dataMax",
"=",
"Math",
".",
"max",
"(",
"sum",
",",
"dataMax",
")",
";",
"}",
"Series",
".",
"prototype",
".",
"processData",
".",
"call",
"(",
"this",
",",
"force",
")",
";",
"// Record extremes",
"series",
".",
"dataMin",
"=",
"dataMin",
";",
"series",
".",
"dataMax",
"=",
"dataMax",
";",
"}"
] | Call default processData then override yData to reflect waterfall's extremes on yAxis | [
"Call",
"default",
"processData",
"then",
"override",
"yData",
"to",
"reflect",
"waterfall",
"s",
"extremes",
"on",
"yAxis"
] | 245c267e832968bad880ca009929043e82c7bc25 | https://github.com/MakerCollider/node-red-contrib-smartnode-hook/blob/245c267e832968bad880ca009929043e82c7bc25/html/scripts/highchart/highcharts-more.src.js#L1664-L1702 |
|
53,139 | MakerCollider/node-red-contrib-smartnode-hook | html/scripts/highchart/highcharts-more.src.js | function (pt) {
if (pt.isSum) {
return (pt.x === 0 ? null : "sum"); //#3245 Error when first element is Sum or Intermediate Sum
} else if (pt.isIntermediateSum) {
return (pt.x === 0 ? null : "intermediateSum"); //#3245
}
return pt.y;
} | javascript | function (pt) {
if (pt.isSum) {
return (pt.x === 0 ? null : "sum"); //#3245 Error when first element is Sum or Intermediate Sum
} else if (pt.isIntermediateSum) {
return (pt.x === 0 ? null : "intermediateSum"); //#3245
}
return pt.y;
} | [
"function",
"(",
"pt",
")",
"{",
"if",
"(",
"pt",
".",
"isSum",
")",
"{",
"return",
"(",
"pt",
".",
"x",
"===",
"0",
"?",
"null",
":",
"\"sum\"",
")",
";",
"//#3245 Error when first element is Sum or Intermediate Sum",
"}",
"else",
"if",
"(",
"pt",
".",
"isIntermediateSum",
")",
"{",
"return",
"(",
"pt",
".",
"x",
"===",
"0",
"?",
"null",
":",
"\"intermediateSum\"",
")",
";",
"//#3245",
"}",
"return",
"pt",
".",
"y",
";",
"}"
] | Return y value or string if point is sum | [
"Return",
"y",
"value",
"or",
"string",
"if",
"point",
"is",
"sum"
] | 245c267e832968bad880ca009929043e82c7bc25 | https://github.com/MakerCollider/node-red-contrib-smartnode-hook/blob/245c267e832968bad880ca009929043e82c7bc25/html/scripts/highchart/highcharts-more.src.js#L1707-L1714 |
|
53,140 | MakerCollider/node-red-contrib-smartnode-hook | html/scripts/highchart/highcharts-more.src.js | function () {
seriesTypes.column.prototype.getAttribs.apply(this, arguments);
var series = this,
options = series.options,
stateOptions = options.states,
upColor = options.upColor || series.color,
hoverColor = Highcharts.Color(upColor).brighten(0.1).get(),
seriesDownPointAttr = merge(series.pointAttr),
upColorProp = series.upColorProp;
seriesDownPointAttr[''][upColorProp] = upColor;
seriesDownPointAttr.hover[upColorProp] = stateOptions.hover.upColor || hoverColor;
seriesDownPointAttr.select[upColorProp] = stateOptions.select.upColor || upColor;
each(series.points, function (point) {
if (!point.options.color) {
// Up color
if (point.y > 0) {
point.pointAttr = seriesDownPointAttr;
point.color = upColor;
// Down color (#3710, update to negative)
} else {
point.pointAttr = series.pointAttr;
}
}
});
} | javascript | function () {
seriesTypes.column.prototype.getAttribs.apply(this, arguments);
var series = this,
options = series.options,
stateOptions = options.states,
upColor = options.upColor || series.color,
hoverColor = Highcharts.Color(upColor).brighten(0.1).get(),
seriesDownPointAttr = merge(series.pointAttr),
upColorProp = series.upColorProp;
seriesDownPointAttr[''][upColorProp] = upColor;
seriesDownPointAttr.hover[upColorProp] = stateOptions.hover.upColor || hoverColor;
seriesDownPointAttr.select[upColorProp] = stateOptions.select.upColor || upColor;
each(series.points, function (point) {
if (!point.options.color) {
// Up color
if (point.y > 0) {
point.pointAttr = seriesDownPointAttr;
point.color = upColor;
// Down color (#3710, update to negative)
} else {
point.pointAttr = series.pointAttr;
}
}
});
} | [
"function",
"(",
")",
"{",
"seriesTypes",
".",
"column",
".",
"prototype",
".",
"getAttribs",
".",
"apply",
"(",
"this",
",",
"arguments",
")",
";",
"var",
"series",
"=",
"this",
",",
"options",
"=",
"series",
".",
"options",
",",
"stateOptions",
"=",
"options",
".",
"states",
",",
"upColor",
"=",
"options",
".",
"upColor",
"||",
"series",
".",
"color",
",",
"hoverColor",
"=",
"Highcharts",
".",
"Color",
"(",
"upColor",
")",
".",
"brighten",
"(",
"0.1",
")",
".",
"get",
"(",
")",
",",
"seriesDownPointAttr",
"=",
"merge",
"(",
"series",
".",
"pointAttr",
")",
",",
"upColorProp",
"=",
"series",
".",
"upColorProp",
";",
"seriesDownPointAttr",
"[",
"''",
"]",
"[",
"upColorProp",
"]",
"=",
"upColor",
";",
"seriesDownPointAttr",
".",
"hover",
"[",
"upColorProp",
"]",
"=",
"stateOptions",
".",
"hover",
".",
"upColor",
"||",
"hoverColor",
";",
"seriesDownPointAttr",
".",
"select",
"[",
"upColorProp",
"]",
"=",
"stateOptions",
".",
"select",
".",
"upColor",
"||",
"upColor",
";",
"each",
"(",
"series",
".",
"points",
",",
"function",
"(",
"point",
")",
"{",
"if",
"(",
"!",
"point",
".",
"options",
".",
"color",
")",
"{",
"// Up color",
"if",
"(",
"point",
".",
"y",
">",
"0",
")",
"{",
"point",
".",
"pointAttr",
"=",
"seriesDownPointAttr",
";",
"point",
".",
"color",
"=",
"upColor",
";",
"// Down color (#3710, update to negative)",
"}",
"else",
"{",
"point",
".",
"pointAttr",
"=",
"series",
".",
"pointAttr",
";",
"}",
"}",
"}",
")",
";",
"}"
] | Postprocess mapping between options and SVG attributes | [
"Postprocess",
"mapping",
"between",
"options",
"and",
"SVG",
"attributes"
] | 245c267e832968bad880ca009929043e82c7bc25 | https://github.com/MakerCollider/node-red-contrib-smartnode-hook/blob/245c267e832968bad880ca009929043e82c7bc25/html/scripts/highchart/highcharts-more.src.js#L1719-L1747 |
|
53,141 | MakerCollider/node-red-contrib-smartnode-hook | html/scripts/highchart/highcharts-more.src.js | function () {
var data = this.data,
length = data.length,
lineWidth = this.options.lineWidth + this.borderWidth,
normalizer = mathRound(lineWidth) % 2 / 2,
path = [],
M = 'M',
L = 'L',
prevArgs,
pointArgs,
i,
d;
for (i = 1; i < length; i++) {
pointArgs = data[i].shapeArgs;
prevArgs = data[i - 1].shapeArgs;
d = [
M,
prevArgs.x + prevArgs.width, prevArgs.y + normalizer,
L,
pointArgs.x, prevArgs.y + normalizer
];
if (data[i - 1].y < 0) {
d[2] += prevArgs.height;
d[5] += prevArgs.height;
}
path = path.concat(d);
}
return path;
} | javascript | function () {
var data = this.data,
length = data.length,
lineWidth = this.options.lineWidth + this.borderWidth,
normalizer = mathRound(lineWidth) % 2 / 2,
path = [],
M = 'M',
L = 'L',
prevArgs,
pointArgs,
i,
d;
for (i = 1; i < length; i++) {
pointArgs = data[i].shapeArgs;
prevArgs = data[i - 1].shapeArgs;
d = [
M,
prevArgs.x + prevArgs.width, prevArgs.y + normalizer,
L,
pointArgs.x, prevArgs.y + normalizer
];
if (data[i - 1].y < 0) {
d[2] += prevArgs.height;
d[5] += prevArgs.height;
}
path = path.concat(d);
}
return path;
} | [
"function",
"(",
")",
"{",
"var",
"data",
"=",
"this",
".",
"data",
",",
"length",
"=",
"data",
".",
"length",
",",
"lineWidth",
"=",
"this",
".",
"options",
".",
"lineWidth",
"+",
"this",
".",
"borderWidth",
",",
"normalizer",
"=",
"mathRound",
"(",
"lineWidth",
")",
"%",
"2",
"/",
"2",
",",
"path",
"=",
"[",
"]",
",",
"M",
"=",
"'M'",
",",
"L",
"=",
"'L'",
",",
"prevArgs",
",",
"pointArgs",
",",
"i",
",",
"d",
";",
"for",
"(",
"i",
"=",
"1",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"pointArgs",
"=",
"data",
"[",
"i",
"]",
".",
"shapeArgs",
";",
"prevArgs",
"=",
"data",
"[",
"i",
"-",
"1",
"]",
".",
"shapeArgs",
";",
"d",
"=",
"[",
"M",
",",
"prevArgs",
".",
"x",
"+",
"prevArgs",
".",
"width",
",",
"prevArgs",
".",
"y",
"+",
"normalizer",
",",
"L",
",",
"pointArgs",
".",
"x",
",",
"prevArgs",
".",
"y",
"+",
"normalizer",
"]",
";",
"if",
"(",
"data",
"[",
"i",
"-",
"1",
"]",
".",
"y",
"<",
"0",
")",
"{",
"d",
"[",
"2",
"]",
"+=",
"prevArgs",
".",
"height",
";",
"d",
"[",
"5",
"]",
"+=",
"prevArgs",
".",
"height",
";",
"}",
"path",
"=",
"path",
".",
"concat",
"(",
"d",
")",
";",
"}",
"return",
"path",
";",
"}"
] | Draw columns' connector lines | [
"Draw",
"columns",
"connector",
"lines"
] | 245c267e832968bad880ca009929043e82c7bc25 | https://github.com/MakerCollider/node-red-contrib-smartnode-hook/blob/245c267e832968bad880ca009929043e82c7bc25/html/scripts/highchart/highcharts-more.src.js#L1752-L1786 |
|
53,142 | MakerCollider/node-red-contrib-smartnode-hook | html/scripts/highchart/highcharts-more.src.js | function (fill) {
var markerOptions = this.options.marker,
fillOpacity = pick(markerOptions.fillOpacity, 0.5);
// When called from Legend.colorizeItem, the fill isn't predefined
fill = fill || markerOptions.fillColor || this.color;
if (fillOpacity !== 1) {
fill = Color(fill).setOpacity(fillOpacity).get('rgba');
}
return fill;
} | javascript | function (fill) {
var markerOptions = this.options.marker,
fillOpacity = pick(markerOptions.fillOpacity, 0.5);
// When called from Legend.colorizeItem, the fill isn't predefined
fill = fill || markerOptions.fillColor || this.color;
if (fillOpacity !== 1) {
fill = Color(fill).setOpacity(fillOpacity).get('rgba');
}
return fill;
} | [
"function",
"(",
"fill",
")",
"{",
"var",
"markerOptions",
"=",
"this",
".",
"options",
".",
"marker",
",",
"fillOpacity",
"=",
"pick",
"(",
"markerOptions",
".",
"fillOpacity",
",",
"0.5",
")",
";",
"// When called from Legend.colorizeItem, the fill isn't predefined",
"fill",
"=",
"fill",
"||",
"markerOptions",
".",
"fillColor",
"||",
"this",
".",
"color",
";",
"if",
"(",
"fillOpacity",
"!==",
"1",
")",
"{",
"fill",
"=",
"Color",
"(",
"fill",
")",
".",
"setOpacity",
"(",
"fillOpacity",
")",
".",
"get",
"(",
"'rgba'",
")",
";",
"}",
"return",
"fill",
";",
"}"
] | Apply the fillOpacity to all fill positions | [
"Apply",
"the",
"fillOpacity",
"to",
"all",
"fill",
"positions"
] | 245c267e832968bad880ca009929043e82c7bc25 | https://github.com/MakerCollider/node-red-contrib-smartnode-hook/blob/245c267e832968bad880ca009929043e82c7bc25/html/scripts/highchart/highcharts-more.src.js#L1888-L1899 |
|
53,143 | MakerCollider/node-red-contrib-smartnode-hook | html/scripts/highchart/highcharts-more.src.js | function () {
var obj = Series.prototype.convertAttribs.apply(this, arguments);
obj.fill = this.applyOpacity(obj.fill);
return obj;
} | javascript | function () {
var obj = Series.prototype.convertAttribs.apply(this, arguments);
obj.fill = this.applyOpacity(obj.fill);
return obj;
} | [
"function",
"(",
")",
"{",
"var",
"obj",
"=",
"Series",
".",
"prototype",
".",
"convertAttribs",
".",
"apply",
"(",
"this",
",",
"arguments",
")",
";",
"obj",
".",
"fill",
"=",
"this",
".",
"applyOpacity",
"(",
"obj",
".",
"fill",
")",
";",
"return",
"obj",
";",
"}"
] | Extend the convertAttribs method by applying opacity to the fill | [
"Extend",
"the",
"convertAttribs",
"method",
"by",
"applying",
"opacity",
"to",
"the",
"fill"
] | 245c267e832968bad880ca009929043e82c7bc25 | https://github.com/MakerCollider/node-red-contrib-smartnode-hook/blob/245c267e832968bad880ca009929043e82c7bc25/html/scripts/highchart/highcharts-more.src.js#L1904-L1910 |
|
53,144 | MakerCollider/node-red-contrib-smartnode-hook | html/scripts/highchart/highcharts-more.src.js | function (zMin, zMax, minSize, maxSize) {
var len,
i,
pos,
zData = this.zData,
radii = [],
sizeByArea = this.options.sizeBy !== 'width',
zRange;
// Set the shape type and arguments to be picked up in drawPoints
for (i = 0, len = zData.length; i < len; i++) {
zRange = zMax - zMin;
pos = zRange > 0 ? // relative size, a number between 0 and 1
(zData[i] - zMin) / (zMax - zMin) :
0.5;
if (sizeByArea && pos >= 0) {
pos = Math.sqrt(pos);
}
radii.push(math.ceil(minSize + pos * (maxSize - minSize)) / 2);
}
this.radii = radii;
} | javascript | function (zMin, zMax, minSize, maxSize) {
var len,
i,
pos,
zData = this.zData,
radii = [],
sizeByArea = this.options.sizeBy !== 'width',
zRange;
// Set the shape type and arguments to be picked up in drawPoints
for (i = 0, len = zData.length; i < len; i++) {
zRange = zMax - zMin;
pos = zRange > 0 ? // relative size, a number between 0 and 1
(zData[i] - zMin) / (zMax - zMin) :
0.5;
if (sizeByArea && pos >= 0) {
pos = Math.sqrt(pos);
}
radii.push(math.ceil(minSize + pos * (maxSize - minSize)) / 2);
}
this.radii = radii;
} | [
"function",
"(",
"zMin",
",",
"zMax",
",",
"minSize",
",",
"maxSize",
")",
"{",
"var",
"len",
",",
"i",
",",
"pos",
",",
"zData",
"=",
"this",
".",
"zData",
",",
"radii",
"=",
"[",
"]",
",",
"sizeByArea",
"=",
"this",
".",
"options",
".",
"sizeBy",
"!==",
"'width'",
",",
"zRange",
";",
"// Set the shape type and arguments to be picked up in drawPoints",
"for",
"(",
"i",
"=",
"0",
",",
"len",
"=",
"zData",
".",
"length",
";",
"i",
"<",
"len",
";",
"i",
"++",
")",
"{",
"zRange",
"=",
"zMax",
"-",
"zMin",
";",
"pos",
"=",
"zRange",
">",
"0",
"?",
"// relative size, a number between 0 and 1",
"(",
"zData",
"[",
"i",
"]",
"-",
"zMin",
")",
"/",
"(",
"zMax",
"-",
"zMin",
")",
":",
"0.5",
";",
"if",
"(",
"sizeByArea",
"&&",
"pos",
">=",
"0",
")",
"{",
"pos",
"=",
"Math",
".",
"sqrt",
"(",
"pos",
")",
";",
"}",
"radii",
".",
"push",
"(",
"math",
".",
"ceil",
"(",
"minSize",
"+",
"pos",
"*",
"(",
"maxSize",
"-",
"minSize",
")",
")",
"/",
"2",
")",
";",
"}",
"this",
".",
"radii",
"=",
"radii",
";",
"}"
] | Get the radius for each point based on the minSize, maxSize and each point's Z value. This
must be done prior to Series.translate because the axis needs to add padding in
accordance with the point sizes. | [
"Get",
"the",
"radius",
"for",
"each",
"point",
"based",
"on",
"the",
"minSize",
"maxSize",
"and",
"each",
"point",
"s",
"Z",
"value",
".",
"This",
"must",
"be",
"done",
"prior",
"to",
"Series",
".",
"translate",
"because",
"the",
"axis",
"needs",
"to",
"add",
"padding",
"in",
"accordance",
"with",
"the",
"point",
"sizes",
"."
] | 245c267e832968bad880ca009929043e82c7bc25 | https://github.com/MakerCollider/node-red-contrib-smartnode-hook/blob/245c267e832968bad880ca009929043e82c7bc25/html/scripts/highchart/highcharts-more.src.js#L1917-L1938 |
|
53,145 | MakerCollider/node-red-contrib-smartnode-hook | html/scripts/highchart/highcharts-more.src.js | function (init) {
var animation = this.options.animation;
if (!init) { // run the animation
each(this.points, function (point) {
var graphic = point.graphic,
shapeArgs = point.shapeArgs;
if (graphic && shapeArgs) {
// start values
graphic.attr('r', 1);
// animate
graphic.animate({
r: shapeArgs.r
}, animation);
}
});
// delete this function to allow it only once
this.animate = null;
}
} | javascript | function (init) {
var animation = this.options.animation;
if (!init) { // run the animation
each(this.points, function (point) {
var graphic = point.graphic,
shapeArgs = point.shapeArgs;
if (graphic && shapeArgs) {
// start values
graphic.attr('r', 1);
// animate
graphic.animate({
r: shapeArgs.r
}, animation);
}
});
// delete this function to allow it only once
this.animate = null;
}
} | [
"function",
"(",
"init",
")",
"{",
"var",
"animation",
"=",
"this",
".",
"options",
".",
"animation",
";",
"if",
"(",
"!",
"init",
")",
"{",
"// run the animation",
"each",
"(",
"this",
".",
"points",
",",
"function",
"(",
"point",
")",
"{",
"var",
"graphic",
"=",
"point",
".",
"graphic",
",",
"shapeArgs",
"=",
"point",
".",
"shapeArgs",
";",
"if",
"(",
"graphic",
"&&",
"shapeArgs",
")",
"{",
"// start values",
"graphic",
".",
"attr",
"(",
"'r'",
",",
"1",
")",
";",
"// animate",
"graphic",
".",
"animate",
"(",
"{",
"r",
":",
"shapeArgs",
".",
"r",
"}",
",",
"animation",
")",
";",
"}",
"}",
")",
";",
"// delete this function to allow it only once",
"this",
".",
"animate",
"=",
"null",
";",
"}",
"}"
] | Perform animation on the bubbles | [
"Perform",
"animation",
"on",
"the",
"bubbles"
] | 245c267e832968bad880ca009929043e82c7bc25 | https://github.com/MakerCollider/node-red-contrib-smartnode-hook/blob/245c267e832968bad880ca009929043e82c7bc25/html/scripts/highchart/highcharts-more.src.js#L1943-L1965 |
|
53,146 | MakerCollider/node-red-contrib-smartnode-hook | html/scripts/highchart/highcharts-more.src.js | function () {
var i,
data = this.data,
point,
radius,
radii = this.radii;
// Run the parent method
seriesTypes.scatter.prototype.translate.call(this);
// Set the shape type and arguments to be picked up in drawPoints
i = data.length;
while (i--) {
point = data[i];
radius = radii ? radii[i] : 0; // #1737
if (radius >= this.minPxSize / 2) {
// Shape arguments
point.shapeType = 'circle';
point.shapeArgs = {
x: point.plotX,
y: point.plotY,
r: radius
};
// Alignment box for the data label
point.dlBox = {
x: point.plotX - radius,
y: point.plotY - radius,
width: 2 * radius,
height: 2 * radius
};
} else { // below zThreshold
point.shapeArgs = point.plotY = point.dlBox = UNDEFINED; // #1691
}
}
} | javascript | function () {
var i,
data = this.data,
point,
radius,
radii = this.radii;
// Run the parent method
seriesTypes.scatter.prototype.translate.call(this);
// Set the shape type and arguments to be picked up in drawPoints
i = data.length;
while (i--) {
point = data[i];
radius = radii ? radii[i] : 0; // #1737
if (radius >= this.minPxSize / 2) {
// Shape arguments
point.shapeType = 'circle';
point.shapeArgs = {
x: point.plotX,
y: point.plotY,
r: radius
};
// Alignment box for the data label
point.dlBox = {
x: point.plotX - radius,
y: point.plotY - radius,
width: 2 * radius,
height: 2 * radius
};
} else { // below zThreshold
point.shapeArgs = point.plotY = point.dlBox = UNDEFINED; // #1691
}
}
} | [
"function",
"(",
")",
"{",
"var",
"i",
",",
"data",
"=",
"this",
".",
"data",
",",
"point",
",",
"radius",
",",
"radii",
"=",
"this",
".",
"radii",
";",
"// Run the parent method",
"seriesTypes",
".",
"scatter",
".",
"prototype",
".",
"translate",
".",
"call",
"(",
"this",
")",
";",
"// Set the shape type and arguments to be picked up in drawPoints",
"i",
"=",
"data",
".",
"length",
";",
"while",
"(",
"i",
"--",
")",
"{",
"point",
"=",
"data",
"[",
"i",
"]",
";",
"radius",
"=",
"radii",
"?",
"radii",
"[",
"i",
"]",
":",
"0",
";",
"// #1737",
"if",
"(",
"radius",
">=",
"this",
".",
"minPxSize",
"/",
"2",
")",
"{",
"// Shape arguments",
"point",
".",
"shapeType",
"=",
"'circle'",
";",
"point",
".",
"shapeArgs",
"=",
"{",
"x",
":",
"point",
".",
"plotX",
",",
"y",
":",
"point",
".",
"plotY",
",",
"r",
":",
"radius",
"}",
";",
"// Alignment box for the data label",
"point",
".",
"dlBox",
"=",
"{",
"x",
":",
"point",
".",
"plotX",
"-",
"radius",
",",
"y",
":",
"point",
".",
"plotY",
"-",
"radius",
",",
"width",
":",
"2",
"*",
"radius",
",",
"height",
":",
"2",
"*",
"radius",
"}",
";",
"}",
"else",
"{",
"// below zThreshold",
"point",
".",
"shapeArgs",
"=",
"point",
".",
"plotY",
"=",
"point",
".",
"dlBox",
"=",
"UNDEFINED",
";",
"// #1691",
"}",
"}",
"}"
] | Extend the base translate method to handle bubble size | [
"Extend",
"the",
"base",
"translate",
"method",
"to",
"handle",
"bubble",
"size"
] | 245c267e832968bad880ca009929043e82c7bc25 | https://github.com/MakerCollider/node-red-contrib-smartnode-hook/blob/245c267e832968bad880ca009929043e82c7bc25/html/scripts/highchart/highcharts-more.src.js#L1970-L2008 |
|
53,147 | MakerCollider/node-red-contrib-smartnode-hook | html/scripts/highchart/highcharts-more.src.js | initArea | function initArea(proceed, chart, options) {
proceed.call(this, chart, options);
if (this.chart.polar) {
/**
* Overridden method to close a segment path. While in a cartesian plane the area
* goes down to the threshold, in the polar chart it goes to the center.
*/
this.closeSegment = function (path) {
var center = this.xAxis.center;
path.push(
'L',
center[0],
center[1]
);
};
// Instead of complicated logic to draw an area around the inner area in a stack,
// just draw it behind
this.closedStacks = true;
}
} | javascript | function initArea(proceed, chart, options) {
proceed.call(this, chart, options);
if (this.chart.polar) {
/**
* Overridden method to close a segment path. While in a cartesian plane the area
* goes down to the threshold, in the polar chart it goes to the center.
*/
this.closeSegment = function (path) {
var center = this.xAxis.center;
path.push(
'L',
center[0],
center[1]
);
};
// Instead of complicated logic to draw an area around the inner area in a stack,
// just draw it behind
this.closedStacks = true;
}
} | [
"function",
"initArea",
"(",
"proceed",
",",
"chart",
",",
"options",
")",
"{",
"proceed",
".",
"call",
"(",
"this",
",",
"chart",
",",
"options",
")",
";",
"if",
"(",
"this",
".",
"chart",
".",
"polar",
")",
"{",
"/**\n\t\t\t * Overridden method to close a segment path. While in a cartesian plane the area \n\t\t\t * goes down to the threshold, in the polar chart it goes to the center.\n\t\t\t */",
"this",
".",
"closeSegment",
"=",
"function",
"(",
"path",
")",
"{",
"var",
"center",
"=",
"this",
".",
"xAxis",
".",
"center",
";",
"path",
".",
"push",
"(",
"'L'",
",",
"center",
"[",
"0",
"]",
",",
"center",
"[",
"1",
"]",
")",
";",
"}",
";",
"// Instead of complicated logic to draw an area around the inner area in a stack,",
"// just draw it behind",
"this",
".",
"closedStacks",
"=",
"true",
";",
"}",
"}"
] | Add some special init logic to areas and areasplines | [
"Add",
"some",
"special",
"init",
"logic",
"to",
"areas",
"and",
"areasplines"
] | 245c267e832968bad880ca009929043e82c7bc25 | https://github.com/MakerCollider/node-red-contrib-smartnode-hook/blob/245c267e832968bad880ca009929043e82c7bc25/html/scripts/highchart/highcharts-more.src.js#L2216-L2237 |
53,148 | mikl/razdraz | lib/index.js | function () {
var mediaPath = path.join(__dirname, '..', 'media'),
templateFile = path.join(mediaPath, 'templates', 'index.jade'),
monolith = require('monolith').init({
minify: true
});
monolith.addCSSFile(path.join(mediaPath, "css", "normalize.css"));
monolith.addCSSFile(path.join(mediaPath, "css", "razdraz.css"));
outputData.css = monolith.getCSS();
outputData.scripts = monolith.getScript();
outputData.pageTemplate = jade.compile(fs.readFileSync(templateFile, 'utf-8'));
} | javascript | function () {
var mediaPath = path.join(__dirname, '..', 'media'),
templateFile = path.join(mediaPath, 'templates', 'index.jade'),
monolith = require('monolith').init({
minify: true
});
monolith.addCSSFile(path.join(mediaPath, "css", "normalize.css"));
monolith.addCSSFile(path.join(mediaPath, "css", "razdraz.css"));
outputData.css = monolith.getCSS();
outputData.scripts = monolith.getScript();
outputData.pageTemplate = jade.compile(fs.readFileSync(templateFile, 'utf-8'));
} | [
"function",
"(",
")",
"{",
"var",
"mediaPath",
"=",
"path",
".",
"join",
"(",
"__dirname",
",",
"'..'",
",",
"'media'",
")",
",",
"templateFile",
"=",
"path",
".",
"join",
"(",
"mediaPath",
",",
"'templates'",
",",
"'index.jade'",
")",
",",
"monolith",
"=",
"require",
"(",
"'monolith'",
")",
".",
"init",
"(",
"{",
"minify",
":",
"true",
"}",
")",
";",
"monolith",
".",
"addCSSFile",
"(",
"path",
".",
"join",
"(",
"mediaPath",
",",
"\"css\"",
",",
"\"normalize.css\"",
")",
")",
";",
"monolith",
".",
"addCSSFile",
"(",
"path",
".",
"join",
"(",
"mediaPath",
",",
"\"css\"",
",",
"\"razdraz.css\"",
")",
")",
";",
"outputData",
".",
"css",
"=",
"monolith",
".",
"getCSS",
"(",
")",
";",
"outputData",
".",
"scripts",
"=",
"monolith",
".",
"getScript",
"(",
")",
";",
"outputData",
".",
"pageTemplate",
"=",
"jade",
".",
"compile",
"(",
"fs",
".",
"readFileSync",
"(",
"templateFile",
",",
"'utf-8'",
")",
")",
";",
"}"
] | Prepare for markup output. Collect static assets and precompile templates. | [
"Prepare",
"for",
"markup",
"output",
".",
"Collect",
"static",
"assets",
"and",
"precompile",
"templates",
"."
] | a1e03c9026371b2ee20fbc7fc5ed4f1f85bf2915 | https://github.com/mikl/razdraz/blob/a1e03c9026371b2ee20fbc7fc5ed4f1f85bf2915/lib/index.js#L14-L28 |
|
53,149 | epok75/expressjs-routes-loader | lib/index.js | load | function load (routes) {
if (!Array.isArray(routes) || routes.length === 0) {
throw new Error('argument should be an array not empty.')
}
if (!Array.isArray(routes[0])) {
routes = [routes]
}
return routes.map(route => _getFiles(route))
.reduce((acc, routes) => acc.concat(routes), [])
} | javascript | function load (routes) {
if (!Array.isArray(routes) || routes.length === 0) {
throw new Error('argument should be an array not empty.')
}
if (!Array.isArray(routes[0])) {
routes = [routes]
}
return routes.map(route => _getFiles(route))
.reduce((acc, routes) => acc.concat(routes), [])
} | [
"function",
"load",
"(",
"routes",
")",
"{",
"if",
"(",
"!",
"Array",
".",
"isArray",
"(",
"routes",
")",
"||",
"routes",
".",
"length",
"===",
"0",
")",
"{",
"throw",
"new",
"Error",
"(",
"'argument should be an array not empty.'",
")",
"}",
"if",
"(",
"!",
"Array",
".",
"isArray",
"(",
"routes",
"[",
"0",
"]",
")",
")",
"{",
"routes",
"=",
"[",
"routes",
"]",
"}",
"return",
"routes",
".",
"map",
"(",
"route",
"=>",
"_getFiles",
"(",
"route",
")",
")",
".",
"reduce",
"(",
"(",
"acc",
",",
"routes",
")",
"=>",
"acc",
".",
"concat",
"(",
"routes",
")",
",",
"[",
"]",
")",
"}"
] | entry point to be called when wanted to load dynamically
your routes.
return all imported routes.
arg
---
you want to explore the whole directory tree applying
the same prefix to every routes
[
path.join(__dirname, 'src', 'routes'),
'api',
'v1'
]
you want to explore multiple directories applying
different prefix to everyone
[
[
path.join(__dirname, 'src', 'users'),
'api',
'v1',
'users'
],
[
path.join(__dirname, 'src', 'routes', 'events'),
'api',
'events'
]
]
first array entry = directory you wnat to explore
second...n = prefix you want to apply to te final endpoint
@param {Array.<String...>|Array.<Array>} routes directories you want to
explore with extra configuration
@return {Array.<Object>} imported routes | [
"entry",
"point",
"to",
"be",
"called",
"when",
"wanted",
"to",
"load",
"dynamically",
"your",
"routes",
".",
"return",
"all",
"imported",
"routes",
"."
] | cc0f90e7441b703e038c2849e6fc06367489a210 | https://github.com/epok75/expressjs-routes-loader/blob/cc0f90e7441b703e038c2849e6fc06367489a210/lib/index.js#L45-L56 |
53,150 | epok75/expressjs-routes-loader | lib/index.js | _getFiles | function _getFiles (route) {
const dir = route[0]
const prefix = route.splice(1).join('/')
return _browseDir(dir)
.map(file => require(file))
.reduce((acc, routes) => acc.concat(routes), [])
.map(routes => _normalizeUrl(routes, prefix))
} | javascript | function _getFiles (route) {
const dir = route[0]
const prefix = route.splice(1).join('/')
return _browseDir(dir)
.map(file => require(file))
.reduce((acc, routes) => acc.concat(routes), [])
.map(routes => _normalizeUrl(routes, prefix))
} | [
"function",
"_getFiles",
"(",
"route",
")",
"{",
"const",
"dir",
"=",
"route",
"[",
"0",
"]",
"const",
"prefix",
"=",
"route",
".",
"splice",
"(",
"1",
")",
".",
"join",
"(",
"'/'",
")",
"return",
"_browseDir",
"(",
"dir",
")",
".",
"map",
"(",
"file",
"=>",
"require",
"(",
"file",
")",
")",
".",
"reduce",
"(",
"(",
"acc",
",",
"routes",
")",
"=>",
"acc",
".",
"concat",
"(",
"routes",
")",
",",
"[",
"]",
")",
".",
"map",
"(",
"routes",
"=>",
"_normalizeUrl",
"(",
"routes",
",",
"prefix",
")",
")",
"}"
] | return all imported routes
@param {Array.<String...>} route directory with extra configuration
@return {Array.<Object>} imported routes | [
"return",
"all",
"imported",
"routes"
] | cc0f90e7441b703e038c2849e6fc06367489a210 | https://github.com/epok75/expressjs-routes-loader/blob/cc0f90e7441b703e038c2849e6fc06367489a210/lib/index.js#L63-L71 |
53,151 | epok75/expressjs-routes-loader | lib/index.js | _browseDir | function _browseDir (dir, fileList) {
fileList || (fileList = [])
try {
fs.readdirSync(dir)
.map(item => _buildFullPath(dir, item))
.map(item => _addFileOrContinueBrowsing(item, fileList))
} catch (e) {
throw new Error(e.message)
}
return fileList
} | javascript | function _browseDir (dir, fileList) {
fileList || (fileList = [])
try {
fs.readdirSync(dir)
.map(item => _buildFullPath(dir, item))
.map(item => _addFileOrContinueBrowsing(item, fileList))
} catch (e) {
throw new Error(e.message)
}
return fileList
} | [
"function",
"_browseDir",
"(",
"dir",
",",
"fileList",
")",
"{",
"fileList",
"||",
"(",
"fileList",
"=",
"[",
"]",
")",
"try",
"{",
"fs",
".",
"readdirSync",
"(",
"dir",
")",
".",
"map",
"(",
"item",
"=>",
"_buildFullPath",
"(",
"dir",
",",
"item",
")",
")",
".",
"map",
"(",
"item",
"=>",
"_addFileOrContinueBrowsing",
"(",
"item",
",",
"fileList",
")",
")",
"}",
"catch",
"(",
"e",
")",
"{",
"throw",
"new",
"Error",
"(",
"e",
".",
"message",
")",
"}",
"return",
"fileList",
"}"
] | explore directories and store files in an array
@param {String} dir directory absolute path
@param {Array.<String>} fileList store all files
@param {Array.<String>} fileList return all files | [
"explore",
"directories",
"and",
"store",
"files",
"in",
"an",
"array"
] | cc0f90e7441b703e038c2849e6fc06367489a210 | https://github.com/epok75/expressjs-routes-loader/blob/cc0f90e7441b703e038c2849e6fc06367489a210/lib/index.js#L79-L91 |
53,152 | epok75/expressjs-routes-loader | lib/index.js | _addFileOrContinueBrowsing | function _addFileOrContinueBrowsing (item, fileList) {
!fs.statSync(item).isDirectory() ? fileList.push(item) : _browseDir(item, fileList)
} | javascript | function _addFileOrContinueBrowsing (item, fileList) {
!fs.statSync(item).isDirectory() ? fileList.push(item) : _browseDir(item, fileList)
} | [
"function",
"_addFileOrContinueBrowsing",
"(",
"item",
",",
"fileList",
")",
"{",
"!",
"fs",
".",
"statSync",
"(",
"item",
")",
".",
"isDirectory",
"(",
")",
"?",
"fileList",
".",
"push",
"(",
"item",
")",
":",
"_browseDir",
"(",
"item",
",",
"fileList",
")",
"}"
] | add file to the bucket or continue browsing
@param {String} item can be a file or directory
@param {Array.<String>} fileList store all files | [
"add",
"file",
"to",
"the",
"bucket",
"or",
"continue",
"browsing"
] | cc0f90e7441b703e038c2849e6fc06367489a210 | https://github.com/epok75/expressjs-routes-loader/blob/cc0f90e7441b703e038c2849e6fc06367489a210/lib/index.js#L101-L103 |
53,153 | epok75/expressjs-routes-loader | lib/index.js | _normalizeUrl | function _normalizeUrl (route, prefix) {
const _route = Object.assign({}, route)
const url = _route.url
.replace(/^\//, '')
.replace(/\/$/, '')
// build prefix
prefix = prefix ? `/${prefix}` : ''
_route.url = url ? `${prefix}/${url}/` : `${prefix}/`
debug(`rewritting url: ${_route.url}`)
return _route
} | javascript | function _normalizeUrl (route, prefix) {
const _route = Object.assign({}, route)
const url = _route.url
.replace(/^\//, '')
.replace(/\/$/, '')
// build prefix
prefix = prefix ? `/${prefix}` : ''
_route.url = url ? `${prefix}/${url}/` : `${prefix}/`
debug(`rewritting url: ${_route.url}`)
return _route
} | [
"function",
"_normalizeUrl",
"(",
"route",
",",
"prefix",
")",
"{",
"const",
"_route",
"=",
"Object",
".",
"assign",
"(",
"{",
"}",
",",
"route",
")",
"const",
"url",
"=",
"_route",
".",
"url",
".",
"replace",
"(",
"/",
"^\\/",
"/",
",",
"''",
")",
".",
"replace",
"(",
"/",
"\\/$",
"/",
",",
"''",
")",
"// build prefix",
"prefix",
"=",
"prefix",
"?",
"`",
"${",
"prefix",
"}",
"`",
":",
"''",
"_route",
".",
"url",
"=",
"url",
"?",
"`",
"${",
"prefix",
"}",
"${",
"url",
"}",
"`",
":",
"`",
"${",
"prefix",
"}",
"`",
"debug",
"(",
"`",
"${",
"_route",
".",
"url",
"}",
"`",
")",
"return",
"_route",
"}"
] | clone and return route object after having normalized url
@param {Array.<Object>} route imported route object
@param {String} prefix route prefix to be added
@return {Object} | [
"clone",
"and",
"return",
"route",
"object",
"after",
"having",
"normalized",
"url"
] | cc0f90e7441b703e038c2849e6fc06367489a210 | https://github.com/epok75/expressjs-routes-loader/blob/cc0f90e7441b703e038c2849e6fc06367489a210/lib/index.js#L111-L124 |
53,154 | MakerCollider/upm_mc | doxy/node/xml2js.js | function(opts) {
xml2js.opts = opts;
return opts
.option('-i, --inputdir [directory]', 'directory for xml files', __dirname + '/xml/mraa')
.option('-c, --custom [file]', 'json for customizations')
.option('-t, --typemaps [directory]', 'directory for custom pointer type maps')
.option('-g, --imagedir [directory]', 'directory to link to where the images will be kept', '')
.option('-s, --strict', 'leave out methods/variables if unknown type')
} | javascript | function(opts) {
xml2js.opts = opts;
return opts
.option('-i, --inputdir [directory]', 'directory for xml files', __dirname + '/xml/mraa')
.option('-c, --custom [file]', 'json for customizations')
.option('-t, --typemaps [directory]', 'directory for custom pointer type maps')
.option('-g, --imagedir [directory]', 'directory to link to where the images will be kept', '')
.option('-s, --strict', 'leave out methods/variables if unknown type')
} | [
"function",
"(",
"opts",
")",
"{",
"xml2js",
".",
"opts",
"=",
"opts",
";",
"return",
"opts",
".",
"option",
"(",
"'-i, --inputdir [directory]'",
",",
"'directory for xml files'",
",",
"__dirname",
"+",
"'/xml/mraa'",
")",
".",
"option",
"(",
"'-c, --custom [file]'",
",",
"'json for customizations'",
")",
".",
"option",
"(",
"'-t, --typemaps [directory]'",
",",
"'directory for custom pointer type maps'",
")",
".",
"option",
"(",
"'-g, --imagedir [directory]'",
",",
"'directory to link to where the images will be kept'",
",",
"''",
")",
".",
"option",
"(",
"'-s, --strict'",
",",
"'leave out methods/variables if unknown type'",
")",
"}"
] | add command line options for this module | [
"add",
"command",
"line",
"options",
"for",
"this",
"module"
] | 525e775a17b85c30716c00435a2acb26bb198c12 | https://github.com/MakerCollider/upm_mc/blob/525e775a17b85c30716c00435a2acb26bb198c12/doxy/node/xml2js.js#L127-L135 |
|
53,155 | MakerCollider/upm_mc | doxy/node/xml2js.js | createXmlParser | function createXmlParser(XML_GRAMMAR_SPEC) {
return fs.readFileAsync(XML_GRAMMAR_SPEC, 'utf8').then(function(xmlgrammar) {
return peg.buildParser(xmlgrammar);
});
} | javascript | function createXmlParser(XML_GRAMMAR_SPEC) {
return fs.readFileAsync(XML_GRAMMAR_SPEC, 'utf8').then(function(xmlgrammar) {
return peg.buildParser(xmlgrammar);
});
} | [
"function",
"createXmlParser",
"(",
"XML_GRAMMAR_SPEC",
")",
"{",
"return",
"fs",
".",
"readFileAsync",
"(",
"XML_GRAMMAR_SPEC",
",",
"'utf8'",
")",
".",
"then",
"(",
"function",
"(",
"xmlgrammar",
")",
"{",
"return",
"peg",
".",
"buildParser",
"(",
"xmlgrammar",
")",
";",
"}",
")",
";",
"}"
] | create an xml parser | [
"create",
"an",
"xml",
"parser"
] | 525e775a17b85c30716c00435a2acb26bb198c12 | https://github.com/MakerCollider/upm_mc/blob/525e775a17b85c30716c00435a2acb26bb198c12/doxy/node/xml2js.js#L251-L255 |
53,156 | MakerCollider/upm_mc | doxy/node/xml2js.js | findUsage | function findUsage(type, classOnly) {
var filterClasses = function(fn) { return _.without(_.map(xml2js.CLASSES, fn), undefined); };
var usesType = function(classSpec, className) {
var methodsOfType = (_.find(classSpec.methods, function(methodSpec, methodName) {
return ((!_.isEmpty(methodSpec.return) && methodSpec.return.type == type) ||
(_.contains(_.pluck(methodSpec.params, 'type'), type)));
}) != undefined);
var variablesOfType = _.contains(_.pluck(classSpec.variable, 'type'), type);
return ((methodsOfType || variablesOfType) ? className : undefined);
};
var extendsType = function(classSpec, className) {
return ((classSpec.parent == type) ? className : undefined);
};
var classes = _.union(filterClasses(usesType), filterClasses(extendsType));
if (classOnly) {
return classes;
} else {
return _.without(_.uniq(_.pluck(_.pick(xml2js.CLASSES, classes), 'group')), undefined);
}
} | javascript | function findUsage(type, classOnly) {
var filterClasses = function(fn) { return _.without(_.map(xml2js.CLASSES, fn), undefined); };
var usesType = function(classSpec, className) {
var methodsOfType = (_.find(classSpec.methods, function(methodSpec, methodName) {
return ((!_.isEmpty(methodSpec.return) && methodSpec.return.type == type) ||
(_.contains(_.pluck(methodSpec.params, 'type'), type)));
}) != undefined);
var variablesOfType = _.contains(_.pluck(classSpec.variable, 'type'), type);
return ((methodsOfType || variablesOfType) ? className : undefined);
};
var extendsType = function(classSpec, className) {
return ((classSpec.parent == type) ? className : undefined);
};
var classes = _.union(filterClasses(usesType), filterClasses(extendsType));
if (classOnly) {
return classes;
} else {
return _.without(_.uniq(_.pluck(_.pick(xml2js.CLASSES, classes), 'group')), undefined);
}
} | [
"function",
"findUsage",
"(",
"type",
",",
"classOnly",
")",
"{",
"var",
"filterClasses",
"=",
"function",
"(",
"fn",
")",
"{",
"return",
"_",
".",
"without",
"(",
"_",
".",
"map",
"(",
"xml2js",
".",
"CLASSES",
",",
"fn",
")",
",",
"undefined",
")",
";",
"}",
";",
"var",
"usesType",
"=",
"function",
"(",
"classSpec",
",",
"className",
")",
"{",
"var",
"methodsOfType",
"=",
"(",
"_",
".",
"find",
"(",
"classSpec",
".",
"methods",
",",
"function",
"(",
"methodSpec",
",",
"methodName",
")",
"{",
"return",
"(",
"(",
"!",
"_",
".",
"isEmpty",
"(",
"methodSpec",
".",
"return",
")",
"&&",
"methodSpec",
".",
"return",
".",
"type",
"==",
"type",
")",
"||",
"(",
"_",
".",
"contains",
"(",
"_",
".",
"pluck",
"(",
"methodSpec",
".",
"params",
",",
"'type'",
")",
",",
"type",
")",
")",
")",
";",
"}",
")",
"!=",
"undefined",
")",
";",
"var",
"variablesOfType",
"=",
"_",
".",
"contains",
"(",
"_",
".",
"pluck",
"(",
"classSpec",
".",
"variable",
",",
"'type'",
")",
",",
"type",
")",
";",
"return",
"(",
"(",
"methodsOfType",
"||",
"variablesOfType",
")",
"?",
"className",
":",
"undefined",
")",
";",
"}",
";",
"var",
"extendsType",
"=",
"function",
"(",
"classSpec",
",",
"className",
")",
"{",
"return",
"(",
"(",
"classSpec",
".",
"parent",
"==",
"type",
")",
"?",
"className",
":",
"undefined",
")",
";",
"}",
";",
"var",
"classes",
"=",
"_",
".",
"union",
"(",
"filterClasses",
"(",
"usesType",
")",
",",
"filterClasses",
"(",
"extendsType",
")",
")",
";",
"if",
"(",
"classOnly",
")",
"{",
"return",
"classes",
";",
"}",
"else",
"{",
"return",
"_",
".",
"without",
"(",
"_",
".",
"uniq",
"(",
"_",
".",
"pluck",
"(",
"_",
".",
"pick",
"(",
"xml2js",
".",
"CLASSES",
",",
"classes",
")",
",",
"'group'",
")",
")",
",",
"undefined",
")",
";",
"}",
"}"
] | search for usage of a type | [
"search",
"for",
"usage",
"of",
"a",
"type"
] | 525e775a17b85c30716c00435a2acb26bb198c12 | https://github.com/MakerCollider/upm_mc/blob/525e775a17b85c30716c00435a2acb26bb198c12/doxy/node/xml2js.js#L434-L453 |
53,157 | MakerCollider/upm_mc | doxy/node/xml2js.js | customizeMethods | function customizeMethods(custom) {
_.each(custom, function(classMethods, className) {
_.extend(xml2js.CLASSES[className].methods, _.pick(classMethods, function(methodSpec, methodName) {
return isValidMethodSpec(methodSpec, className + '.' + methodName);
}));
});
} | javascript | function customizeMethods(custom) {
_.each(custom, function(classMethods, className) {
_.extend(xml2js.CLASSES[className].methods, _.pick(classMethods, function(methodSpec, methodName) {
return isValidMethodSpec(methodSpec, className + '.' + methodName);
}));
});
} | [
"function",
"customizeMethods",
"(",
"custom",
")",
"{",
"_",
".",
"each",
"(",
"custom",
",",
"function",
"(",
"classMethods",
",",
"className",
")",
"{",
"_",
".",
"extend",
"(",
"xml2js",
".",
"CLASSES",
"[",
"className",
"]",
".",
"methods",
",",
"_",
".",
"pick",
"(",
"classMethods",
",",
"function",
"(",
"methodSpec",
",",
"methodName",
")",
"{",
"return",
"isValidMethodSpec",
"(",
"methodSpec",
",",
"className",
"+",
"'.'",
"+",
"methodName",
")",
";",
"}",
")",
")",
";",
"}",
")",
";",
"}"
] | override autogenerated methods with custom configuration | [
"override",
"autogenerated",
"methods",
"with",
"custom",
"configuration"
] | 525e775a17b85c30716c00435a2acb26bb198c12 | https://github.com/MakerCollider/upm_mc/blob/525e775a17b85c30716c00435a2acb26bb198c12/doxy/node/xml2js.js#L457-L463 |
53,158 | MakerCollider/upm_mc | doxy/node/xml2js.js | isValidMethodSpec | function isValidMethodSpec(methodSpec, methodName) {
var valid = true;
var printIgnoredMethodOnce = _.once(function() { console.log(methodName + ' from ' + path.basename(xml2js.opts.custom) + ' is omitted from JS documentation.'); });
function checkRule(rule, errMsg) {
if (!rule) {
printIgnoredMethodOnce();
console.log(' ' + errMsg);
valid = false;
}
}
checkRule(_.has(methodSpec, 'description'), 'no description given');
checkRule(_.has(methodSpec, 'params'), 'no params given (specify "params": {} for no params)');
_.each(methodSpec.params, function(paramSpec, paramName) {
checkRule(_.has(paramSpec, 'type'), 'no type given for param ' + paramName);
checkRule(_.has(paramSpec, 'description'), 'no description given for param ' + paramName);
});
checkRule(_.has(methodSpec, 'return'), 'no return given (specify "return": {} for no return value)');
checkRule(_.has(methodSpec.return, 'type'), 'no type given for return value');
checkRule(_.has(methodSpec.return, 'description'), 'no description given for return value');
return valid;
} | javascript | function isValidMethodSpec(methodSpec, methodName) {
var valid = true;
var printIgnoredMethodOnce = _.once(function() { console.log(methodName + ' from ' + path.basename(xml2js.opts.custom) + ' is omitted from JS documentation.'); });
function checkRule(rule, errMsg) {
if (!rule) {
printIgnoredMethodOnce();
console.log(' ' + errMsg);
valid = false;
}
}
checkRule(_.has(methodSpec, 'description'), 'no description given');
checkRule(_.has(methodSpec, 'params'), 'no params given (specify "params": {} for no params)');
_.each(methodSpec.params, function(paramSpec, paramName) {
checkRule(_.has(paramSpec, 'type'), 'no type given for param ' + paramName);
checkRule(_.has(paramSpec, 'description'), 'no description given for param ' + paramName);
});
checkRule(_.has(methodSpec, 'return'), 'no return given (specify "return": {} for no return value)');
checkRule(_.has(methodSpec.return, 'type'), 'no type given for return value');
checkRule(_.has(methodSpec.return, 'description'), 'no description given for return value');
return valid;
} | [
"function",
"isValidMethodSpec",
"(",
"methodSpec",
",",
"methodName",
")",
"{",
"var",
"valid",
"=",
"true",
";",
"var",
"printIgnoredMethodOnce",
"=",
"_",
".",
"once",
"(",
"function",
"(",
")",
"{",
"console",
".",
"log",
"(",
"methodName",
"+",
"' from '",
"+",
"path",
".",
"basename",
"(",
"xml2js",
".",
"opts",
".",
"custom",
")",
"+",
"' is omitted from JS documentation.'",
")",
";",
"}",
")",
";",
"function",
"checkRule",
"(",
"rule",
",",
"errMsg",
")",
"{",
"if",
"(",
"!",
"rule",
")",
"{",
"printIgnoredMethodOnce",
"(",
")",
";",
"console",
".",
"log",
"(",
"' '",
"+",
"errMsg",
")",
";",
"valid",
"=",
"false",
";",
"}",
"}",
"checkRule",
"(",
"_",
".",
"has",
"(",
"methodSpec",
",",
"'description'",
")",
",",
"'no description given'",
")",
";",
"checkRule",
"(",
"_",
".",
"has",
"(",
"methodSpec",
",",
"'params'",
")",
",",
"'no params given (specify \"params\": {} for no params)'",
")",
";",
"_",
".",
"each",
"(",
"methodSpec",
".",
"params",
",",
"function",
"(",
"paramSpec",
",",
"paramName",
")",
"{",
"checkRule",
"(",
"_",
".",
"has",
"(",
"paramSpec",
",",
"'type'",
")",
",",
"'no type given for param '",
"+",
"paramName",
")",
";",
"checkRule",
"(",
"_",
".",
"has",
"(",
"paramSpec",
",",
"'description'",
")",
",",
"'no description given for param '",
"+",
"paramName",
")",
";",
"}",
")",
";",
"checkRule",
"(",
"_",
".",
"has",
"(",
"methodSpec",
",",
"'return'",
")",
",",
"'no return given (specify \"return\": {} for no return value)'",
")",
";",
"checkRule",
"(",
"_",
".",
"has",
"(",
"methodSpec",
".",
"return",
",",
"'type'",
")",
",",
"'no type given for return value'",
")",
";",
"checkRule",
"(",
"_",
".",
"has",
"(",
"methodSpec",
".",
"return",
",",
"'description'",
")",
",",
"'no description given for return value'",
")",
";",
"return",
"valid",
";",
"}"
] | verify that the json spec is well formatted | [
"verify",
"that",
"the",
"json",
"spec",
"is",
"well",
"formatted"
] | 525e775a17b85c30716c00435a2acb26bb198c12 | https://github.com/MakerCollider/upm_mc/blob/525e775a17b85c30716c00435a2acb26bb198c12/doxy/node/xml2js.js#L496-L516 |
53,159 | MakerCollider/upm_mc | doxy/node/xml2js.js | getEnums | function getEnums(spec_c, bygroup, parent) {
var spec_js = {};
var enumGroups = _.find(getChildren(spec_c, 'sectiondef'), function(section) {
var kind = getAttr(section, 'kind');
return ((kind == 'enum') || (kind == 'public-type'));
});
if (enumGroups) {
_.each(enumGroups.children, function(enumGroup) {
var enumGroupName = getText(getChild(enumGroup, 'name'), 'name');
var enumGroupDescription = getText(getChild(enumGroup, 'detaileddescription'), 'description');
var enumGroupVals = getChildren(enumGroup, 'enumvalue');
if (bygroup) {
spec_js[enumGroupName] = {
description: enumGroupDescription,
members: []
};
}
_.each(enumGroupVals, function(e) {
// TODO: get prefix as option
var enumName = getText(getChild(e, 'name'), 'name').replace(/^MRAA_/, '');
var enumDescription = getText(getChild(e, 'detaileddescription'), 'description');
if (!bygroup) {
spec_js[enumName] = {
type: enumGroupName,
description: enumDescription
};
} else {
spec_js[enumGroupName].members.push(enumName);
}
});
});
}
return spec_js;
} | javascript | function getEnums(spec_c, bygroup, parent) {
var spec_js = {};
var enumGroups = _.find(getChildren(spec_c, 'sectiondef'), function(section) {
var kind = getAttr(section, 'kind');
return ((kind == 'enum') || (kind == 'public-type'));
});
if (enumGroups) {
_.each(enumGroups.children, function(enumGroup) {
var enumGroupName = getText(getChild(enumGroup, 'name'), 'name');
var enumGroupDescription = getText(getChild(enumGroup, 'detaileddescription'), 'description');
var enumGroupVals = getChildren(enumGroup, 'enumvalue');
if (bygroup) {
spec_js[enumGroupName] = {
description: enumGroupDescription,
members: []
};
}
_.each(enumGroupVals, function(e) {
// TODO: get prefix as option
var enumName = getText(getChild(e, 'name'), 'name').replace(/^MRAA_/, '');
var enumDescription = getText(getChild(e, 'detaileddescription'), 'description');
if (!bygroup) {
spec_js[enumName] = {
type: enumGroupName,
description: enumDescription
};
} else {
spec_js[enumGroupName].members.push(enumName);
}
});
});
}
return spec_js;
} | [
"function",
"getEnums",
"(",
"spec_c",
",",
"bygroup",
",",
"parent",
")",
"{",
"var",
"spec_js",
"=",
"{",
"}",
";",
"var",
"enumGroups",
"=",
"_",
".",
"find",
"(",
"getChildren",
"(",
"spec_c",
",",
"'sectiondef'",
")",
",",
"function",
"(",
"section",
")",
"{",
"var",
"kind",
"=",
"getAttr",
"(",
"section",
",",
"'kind'",
")",
";",
"return",
"(",
"(",
"kind",
"==",
"'enum'",
")",
"||",
"(",
"kind",
"==",
"'public-type'",
")",
")",
";",
"}",
")",
";",
"if",
"(",
"enumGroups",
")",
"{",
"_",
".",
"each",
"(",
"enumGroups",
".",
"children",
",",
"function",
"(",
"enumGroup",
")",
"{",
"var",
"enumGroupName",
"=",
"getText",
"(",
"getChild",
"(",
"enumGroup",
",",
"'name'",
")",
",",
"'name'",
")",
";",
"var",
"enumGroupDescription",
"=",
"getText",
"(",
"getChild",
"(",
"enumGroup",
",",
"'detaileddescription'",
")",
",",
"'description'",
")",
";",
"var",
"enumGroupVals",
"=",
"getChildren",
"(",
"enumGroup",
",",
"'enumvalue'",
")",
";",
"if",
"(",
"bygroup",
")",
"{",
"spec_js",
"[",
"enumGroupName",
"]",
"=",
"{",
"description",
":",
"enumGroupDescription",
",",
"members",
":",
"[",
"]",
"}",
";",
"}",
"_",
".",
"each",
"(",
"enumGroupVals",
",",
"function",
"(",
"e",
")",
"{",
"// TODO: get prefix as option",
"var",
"enumName",
"=",
"getText",
"(",
"getChild",
"(",
"e",
",",
"'name'",
")",
",",
"'name'",
")",
".",
"replace",
"(",
"/",
"^MRAA_",
"/",
",",
"''",
")",
";",
"var",
"enumDescription",
"=",
"getText",
"(",
"getChild",
"(",
"e",
",",
"'detaileddescription'",
")",
",",
"'description'",
")",
";",
"if",
"(",
"!",
"bygroup",
")",
"{",
"spec_js",
"[",
"enumName",
"]",
"=",
"{",
"type",
":",
"enumGroupName",
",",
"description",
":",
"enumDescription",
"}",
";",
"}",
"else",
"{",
"spec_js",
"[",
"enumGroupName",
"]",
".",
"members",
".",
"push",
"(",
"enumName",
")",
";",
"}",
"}",
")",
";",
"}",
")",
";",
"}",
"return",
"spec_js",
";",
"}"
] | get enum specifications | [
"get",
"enum",
"specifications"
] | 525e775a17b85c30716c00435a2acb26bb198c12 | https://github.com/MakerCollider/upm_mc/blob/525e775a17b85c30716c00435a2acb26bb198c12/doxy/node/xml2js.js#L520-L553 |
53,160 | 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",
"(",
"!",
"_",
".",
"has",
"(",
"xml2js",
".",
"CLASSES",
",",
"parent",
")",
")",
"{",
"console",
".",
"log",
"(",
"'WARNING: Class '",
"+",
"className",
"+",
"' has unknown parent class '",
"+",
"parent",
")",
";",
"}",
"}",
"return",
"parent",
";",
"}"
] | 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 |
53,161 | 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",
")",
";",
"}",
"return",
"methodName",
";",
"}"
] | 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 |
53,162 | 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, 'kind') == 'variable');
}), function(variable) {
var varName = getText(getChild(variable, 'name'), 'name');
var varType = getType(getText(getChild(variable, 'type')), parent);
var varDescription = getText(getChild(variable, 'detaileddescription'));
spec_js[varName] = {
type: varType,
description: varDescription
}
});
}
return spec_js;
} | 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, 'kind') == 'variable');
}), function(variable) {
var varName = getText(getChild(variable, 'name'), 'name');
var varType = getType(getText(getChild(variable, 'type')), parent);
var varDescription = getText(getChild(variable, 'detaileddescription'));
spec_js[varName] = {
type: varType,
description: varDescription
}
});
}
return spec_js;
} | [
"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",
",",
"'kind'",
")",
"==",
"'variable'",
")",
";",
"}",
")",
",",
"function",
"(",
"variable",
")",
"{",
"var",
"varName",
"=",
"getText",
"(",
"getChild",
"(",
"variable",
",",
"'name'",
")",
",",
"'name'",
")",
";",
"var",
"varType",
"=",
"getType",
"(",
"getText",
"(",
"getChild",
"(",
"variable",
",",
"'type'",
")",
")",
",",
"parent",
")",
";",
"var",
"varDescription",
"=",
"getText",
"(",
"getChild",
"(",
"variable",
",",
"'detaileddescription'",
")",
")",
";",
"spec_js",
"[",
"varName",
"]",
"=",
"{",
"type",
":",
"varType",
",",
"description",
":",
"varDescription",
"}",
"}",
")",
";",
"}",
"return",
"spec_js",
";",
"}"
] | 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 |
53,163 | 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",
"?",
"getText",
"(",
"details",
",",
"'description'",
")",
":",
"''",
")",
";",
"return",
"(",
"(",
"retType",
"==",
"'void'",
")",
"?",
"{",
"}",
":",
"{",
"type",
":",
"retType",
",",
"description",
":",
"retDescription",
"}",
")",
";",
"}"
] | 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 |
53,164 | 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 };
} catch(e) {
if (paramType == '...') {
spec_js['arguments'] = { type: paramType };
} else {
throw e;
}
}
});
_.each(details, function(param) {
var getParamName = function(p) { return getText(getChild(getChild(p, 'parameternamelist'), 'parametername'), 'name'); }
var paramName = getParamName(param);
var paramDescription = getText(getChild(param, 'parameterdescription'), 'description');
if (_.has(spec_js, paramName)) {
spec_js[paramName].description = paramDescription;
} else {
var msg = ' has documentation for an unknown parameter: ' + paramName + '. ';
var suggestions = _.difference(_.keys(spec_js), _.map(details, getParamName));
var msgAddendum = (!_.isEmpty(suggestions) ? ('Did you mean ' + suggestions.join(', or ') + '?') : '');
console.log('Warning: ' + (parent ? (parent + '.') : '') + method + msg + msgAddendum);
}
});
return spec_js;
} | 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 };
} catch(e) {
if (paramType == '...') {
spec_js['arguments'] = { type: paramType };
} else {
throw e;
}
}
});
_.each(details, function(param) {
var getParamName = function(p) { return getText(getChild(getChild(p, 'parameternamelist'), 'parametername'), 'name'); }
var paramName = getParamName(param);
var paramDescription = getText(getChild(param, 'parameterdescription'), 'description');
if (_.has(spec_js, paramName)) {
spec_js[paramName].description = paramDescription;
} else {
var msg = ' has documentation for an unknown parameter: ' + paramName + '. ';
var suggestions = _.difference(_.keys(spec_js), _.map(details, getParamName));
var msgAddendum = (!_.isEmpty(suggestions) ? ('Did you mean ' + suggestions.join(', or ') + '?') : '');
console.log('Warning: ' + (parent ? (parent + '.') : '') + method + msg + msgAddendum);
}
});
return spec_js;
} | [
"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",
"}",
";",
"}",
"catch",
"(",
"e",
")",
"{",
"if",
"(",
"paramType",
"==",
"'...'",
")",
"{",
"spec_js",
"[",
"'arguments'",
"]",
"=",
"{",
"type",
":",
"paramType",
"}",
";",
"}",
"else",
"{",
"throw",
"e",
";",
"}",
"}",
"}",
")",
";",
"_",
".",
"each",
"(",
"details",
",",
"function",
"(",
"param",
")",
"{",
"var",
"getParamName",
"=",
"function",
"(",
"p",
")",
"{",
"return",
"getText",
"(",
"getChild",
"(",
"getChild",
"(",
"p",
",",
"'parameternamelist'",
")",
",",
"'parametername'",
")",
",",
"'name'",
")",
";",
"}",
"var",
"paramName",
"=",
"getParamName",
"(",
"param",
")",
";",
"var",
"paramDescription",
"=",
"getText",
"(",
"getChild",
"(",
"param",
",",
"'parameterdescription'",
")",
",",
"'description'",
")",
";",
"if",
"(",
"_",
".",
"has",
"(",
"spec_js",
",",
"paramName",
")",
")",
"{",
"spec_js",
"[",
"paramName",
"]",
".",
"description",
"=",
"paramDescription",
";",
"}",
"else",
"{",
"var",
"msg",
"=",
"' has documentation for an unknown parameter: '",
"+",
"paramName",
"+",
"'. '",
";",
"var",
"suggestions",
"=",
"_",
".",
"difference",
"(",
"_",
".",
"keys",
"(",
"spec_js",
")",
",",
"_",
".",
"map",
"(",
"details",
",",
"getParamName",
")",
")",
";",
"var",
"msgAddendum",
"=",
"(",
"!",
"_",
".",
"isEmpty",
"(",
"suggestions",
")",
"?",
"(",
"'Did you mean '",
"+",
"suggestions",
".",
"join",
"(",
"', or '",
")",
"+",
"'?'",
")",
":",
"''",
")",
";",
"console",
".",
"log",
"(",
"'Warning: '",
"+",
"(",
"parent",
"?",
"(",
"parent",
"+",
"'.'",
")",
":",
"''",
")",
"+",
"method",
"+",
"msg",
"+",
"msgAddendum",
")",
";",
"}",
"}",
")",
";",
"return",
"spec_js",
";",
"}"
] | 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 |
53,165 | 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 className = parent.toLowerCase();
if (_.has(xml2js.ARRAY_TYPEMAPS, dataType) && _.contains(xml2js.ARRAY_TYPEMAPS[dataType].classes, className)) {
type_js = xml2js.ARRAY_TYPEMAPS[dataType].arrayType;
} else if (_.has(xml2js.POINTER_TYPEMAPS, className) && _.has(xml2js.POINTER_TYPEMAPS[className], dataType)) {
type_js = xml2js.POINTER_TYPEMAPS[className][dataType];
} else if (_.has(xml2js.CLASSES, dataType)) { // TODO: verify that swig does this mapping
type_js = dataType;
} else {
type_js = dataType + ' *'
}
}
return type_js;
} | 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 className = parent.toLowerCase();
if (_.has(xml2js.ARRAY_TYPEMAPS, dataType) && _.contains(xml2js.ARRAY_TYPEMAPS[dataType].classes, className)) {
type_js = xml2js.ARRAY_TYPEMAPS[dataType].arrayType;
} else if (_.has(xml2js.POINTER_TYPEMAPS, className) && _.has(xml2js.POINTER_TYPEMAPS[className], dataType)) {
type_js = xml2js.POINTER_TYPEMAPS[className][dataType];
} else if (_.has(xml2js.CLASSES, dataType)) { // TODO: verify that swig does this mapping
type_js = dataType;
} else {
type_js = dataType + ' *'
}
}
return type_js;
} | [
"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",
"className",
"=",
"parent",
".",
"toLowerCase",
"(",
")",
";",
"if",
"(",
"_",
".",
"has",
"(",
"xml2js",
".",
"ARRAY_TYPEMAPS",
",",
"dataType",
")",
"&&",
"_",
".",
"contains",
"(",
"xml2js",
".",
"ARRAY_TYPEMAPS",
"[",
"dataType",
"]",
".",
"classes",
",",
"className",
")",
")",
"{",
"type_js",
"=",
"xml2js",
".",
"ARRAY_TYPEMAPS",
"[",
"dataType",
"]",
".",
"arrayType",
";",
"}",
"else",
"if",
"(",
"_",
".",
"has",
"(",
"xml2js",
".",
"POINTER_TYPEMAPS",
",",
"className",
")",
"&&",
"_",
".",
"has",
"(",
"xml2js",
".",
"POINTER_TYPEMAPS",
"[",
"className",
"]",
",",
"dataType",
")",
")",
"{",
"type_js",
"=",
"xml2js",
".",
"POINTER_TYPEMAPS",
"[",
"className",
"]",
"[",
"dataType",
"]",
";",
"}",
"else",
"if",
"(",
"_",
".",
"has",
"(",
"xml2js",
".",
"CLASSES",
",",
"dataType",
")",
")",
"{",
"// TODO: verify that swig does this mapping",
"type_js",
"=",
"dataType",
";",
"}",
"else",
"{",
"type_js",
"=",
"dataType",
"+",
"' *'",
"}",
"}",
"return",
"type_js",
";",
"}"
] | 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 |
53,166 | 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) {
if (!isValidType(paramSpec.type, parent)) {
valid = false;
printIgnoredMethodOnce();
console.log(' Error: parameter ' + paramName + ' has invalid type ' + typeToString(paramSpec.type));
}
});
if (!_.isEmpty(methodSpec.return) && !isValidType(methodSpec.return.type, parent)) {
valid = false;
printIgnoredMethodOnce();
console.log(' Error: returns invalid type ' + typeToString(methodSpec.return.type));
}
return valid;
} | 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) {
if (!isValidType(paramSpec.type, parent)) {
valid = false;
printIgnoredMethodOnce();
console.log(' Error: parameter ' + paramName + ' has invalid type ' + typeToString(paramSpec.type));
}
});
if (!_.isEmpty(methodSpec.return) && !isValidType(methodSpec.return.type, parent)) {
valid = false;
printIgnoredMethodOnce();
console.log(' Error: returns invalid type ' + typeToString(methodSpec.return.type));
}
return valid;
} | [
"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",
")",
"{",
"if",
"(",
"!",
"isValidType",
"(",
"paramSpec",
".",
"type",
",",
"parent",
")",
")",
"{",
"valid",
"=",
"false",
";",
"printIgnoredMethodOnce",
"(",
")",
";",
"console",
".",
"log",
"(",
"' Error: parameter '",
"+",
"paramName",
"+",
"' has invalid type '",
"+",
"typeToString",
"(",
"paramSpec",
".",
"type",
")",
")",
";",
"}",
"}",
")",
";",
"if",
"(",
"!",
"_",
".",
"isEmpty",
"(",
"methodSpec",
".",
"return",
")",
"&&",
"!",
"isValidType",
"(",
"methodSpec",
".",
"return",
".",
"type",
",",
"parent",
")",
")",
"{",
"valid",
"=",
"false",
";",
"printIgnoredMethodOnce",
"(",
")",
";",
"console",
".",
"log",
"(",
"' Error: returns invalid type '",
"+",
"typeToString",
"(",
"methodSpec",
".",
"return",
".",
"type",
")",
")",
";",
"}",
"return",
"valid",
";",
"}"
] | 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 |
53,167 | 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);
return false;
}
} | 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);
return false;
}
} | [
"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",
")",
";",
"return",
"false",
";",
"}",
"}"
] | 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 |
53,168 | 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 : []), type) ||
isValidPointerType(type, parent));
} | 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 : []), type) ||
isValidPointerType(type, parent));
} | [
"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",
":",
"[",
"]",
")",
",",
"type",
")",
"||",
"isValidPointerType",
"(",
"type",
",",
"parent",
")",
")",
";",
"}"
] | 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 |
53,169 | 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",
")",
"{",
"return",
"getChild",
"(",
"para",
",",
"'parameterlist'",
")",
";",
"}",
")",
",",
"function",
"(",
"obj",
")",
"{",
"return",
"(",
"obj",
"!=",
"undefined",
")",
";",
"}",
")",
";",
"return",
"(",
"details",
"?",
"details",
".",
"children",
":",
"undefined",
")",
";",
"}"
] | 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 |
53,170 | 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",
"getChild",
"(",
"para",
",",
"'simplesect'",
")",
";",
"}",
")",
",",
"function",
"(",
"obj",
")",
"{",
"return",
"(",
"(",
"obj",
"!=",
"undefined",
")",
"&&",
"(",
"getAttr",
"(",
"obj",
",",
"'kind'",
")",
"==",
"'return'",
")",
")",
";",
"}",
")",
";",
"}"
] | 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 |
53,171 | 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 |
53,172 | 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 |
53,173 | 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 |
53,174 | 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';
toReturn.status=payload.status || false;
return toReturn;
} | 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';
toReturn.status=payload.status || false;
return toReturn;
} | [
"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'",
";",
"toReturn",
".",
"status",
"=",
"payload",
".",
"status",
"||",
"false",
";",
"return",
"toReturn",
";",
"}"
] | 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 |
|
53,175 | 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",
".",
"properties",
"||",
"{",
"}",
")",
";",
"}"
] | 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 |
|
53,176 | 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) {
processor.process(object, data, property);
});
} | javascript | function(object, properties) {
if (!object.__isInterfaceImplemented('properties')) {
object.__implementInterface('properties', this.interface);
}
object.__initProperties();
var processor = this.get();
_.each(properties, function(data, property) {
processor.process(object, data, property);
});
} | [
"function",
"(",
"object",
",",
"properties",
")",
"{",
"if",
"(",
"!",
"object",
".",
"__isInterfaceImplemented",
"(",
"'properties'",
")",
")",
"{",
"object",
".",
"__implementInterface",
"(",
"'properties'",
",",
"this",
".",
"interface",
")",
";",
"}",
"object",
".",
"__initProperties",
"(",
")",
";",
"var",
"processor",
"=",
"this",
".",
"get",
"(",
")",
";",
"_",
".",
"each",
"(",
"properties",
",",
"function",
"(",
"data",
",",
"property",
")",
"{",
"processor",
".",
"process",
"(",
"object",
",",
"data",
",",
"property",
")",
";",
"}",
")",
";",
"}"
] | 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 |
|
53,177 | 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) {
var defaultValue = params.default;
if (_.isFunction(defaultValue)) {
defaultValue = defaultValue.call(that);
}
if (defaultValue) {
if ((_.isSimpleObject(defaultValue)) || _.isArray(defaultValue)) {
defaultValue = _.clone(defaultValue)
}
}
that.__setPropertyValue(property, defaultValue, false);
}
});
} | 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) {
var defaultValue = params.default;
if (_.isFunction(defaultValue)) {
defaultValue = defaultValue.call(that);
}
if (defaultValue) {
if ((_.isSimpleObject(defaultValue)) || _.isArray(defaultValue)) {
defaultValue = _.clone(defaultValue)
}
}
that.__setPropertyValue(property, defaultValue, false);
}
});
} | [
"function",
"(",
")",
"{",
"var",
"that",
"=",
"this",
";",
"var",
"propertiesParams",
"=",
"that",
".",
"__getPropertiesParam",
"(",
")",
";",
"_",
".",
"each",
"(",
"propertiesParams",
",",
"function",
"(",
"params",
",",
"property",
")",
"{",
"var",
"value",
"=",
"that",
".",
"__getPropertyValue",
"(",
"property",
")",
";",
"if",
"(",
"_",
".",
"isUndefined",
"(",
"value",
")",
"&&",
"'default'",
"in",
"params",
")",
"{",
"var",
"defaultValue",
"=",
"params",
".",
"default",
";",
"if",
"(",
"_",
".",
"isFunction",
"(",
"defaultValue",
")",
")",
"{",
"defaultValue",
"=",
"defaultValue",
".",
"call",
"(",
"that",
")",
";",
"}",
"if",
"(",
"defaultValue",
")",
"{",
"if",
"(",
"(",
"_",
".",
"isSimpleObject",
"(",
"defaultValue",
")",
")",
"||",
"_",
".",
"isArray",
"(",
"defaultValue",
")",
")",
"{",
"defaultValue",
"=",
"_",
".",
"clone",
"(",
"defaultValue",
")",
"}",
"}",
"that",
".",
"__setPropertyValue",
"(",
"property",
",",
"defaultValue",
",",
"false",
")",
";",
"}",
"}",
")",
";",
"}"
] | 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 |
|
53,178 | 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",
")",
";",
"}",
")",
";",
"return",
"that",
";",
"}"
] | 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 |
|
53,179 | 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)) {
this.__properties[property] = {};
}
_.extend(this.__properties[property], params);
return this;
} | 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)) {
this.__properties[property] = {};
}
_.extend(this.__properties[property], params);
return this;
} | [
"function",
"(",
"property",
",",
"param",
",",
"value",
")",
"{",
"var",
"params",
"=",
"{",
"}",
";",
"if",
"(",
"!",
"_",
".",
"isUndefined",
"(",
"value",
")",
")",
"{",
"params",
"[",
"param",
"]",
"=",
"value",
";",
"}",
"else",
"if",
"(",
"_",
".",
"isObject",
"(",
"param",
")",
")",
"{",
"_",
".",
"extend",
"(",
"params",
",",
"param",
")",
";",
"}",
"if",
"(",
"!",
"(",
"property",
"in",
"this",
".",
"__properties",
")",
")",
"{",
"this",
".",
"__properties",
"[",
"property",
"]",
"=",
"{",
"}",
";",
"}",
"_",
".",
"extend",
"(",
"this",
".",
"__properties",
"[",
"property",
"]",
",",
"params",
")",
";",
"return",
"this",
";",
"}"
] | 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 |
|
53,180 | 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",
"||",
"[",
"]",
")",
")",
"[",
"property",
"]",
";",
"return",
"param",
"?",
"params",
"[",
"param",
"]",
":",
"params",
";",
"}"
] | 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 |
|
53,181 | 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,
method: 'get',
params: _.toArray(arguments)
});
}
var value = this.__applyGetters(property, this['_' + property]);
for (var i = 0, ii = fields.length; i < ii; ++i) {
var field = fields[i];
if (!(field in value)) {
throw new Error('Property "' + [property].concat(fields.slice(0, i+1)).join('.') + '" does not exists!');
}
value = this.__applyGetters(property, value[field], fields.slice(0, i+1));
}
if (options.emit && this.__checkEmitEvent()) {
var prop = [property].concat(fields).join('.');
this.__emitEvent('property.' + prop + '.get', value);
this.__emitEvent('property.get', prop, value);
}
return value;
} | javascript | function(fields, options) {
fields = this.__resolveFields(fields);
options = this.__resolveOptions(options);
var property = fields.shift();
if (options.check) {
this.__checkProperty(property, {
readable: true,
method: 'get',
params: _.toArray(arguments)
});
}
var value = this.__applyGetters(property, this['_' + property]);
for (var i = 0, ii = fields.length; i < ii; ++i) {
var field = fields[i];
if (!(field in value)) {
throw new Error('Property "' + [property].concat(fields.slice(0, i+1)).join('.') + '" does not exists!');
}
value = this.__applyGetters(property, value[field], fields.slice(0, i+1));
}
if (options.emit && this.__checkEmitEvent()) {
var prop = [property].concat(fields).join('.');
this.__emitEvent('property.' + prop + '.get', value);
this.__emitEvent('property.get', prop, value);
}
return value;
} | [
"function",
"(",
"fields",
",",
"options",
")",
"{",
"fields",
"=",
"this",
".",
"__resolveFields",
"(",
"fields",
")",
";",
"options",
"=",
"this",
".",
"__resolveOptions",
"(",
"options",
")",
";",
"var",
"property",
"=",
"fields",
".",
"shift",
"(",
")",
";",
"if",
"(",
"options",
".",
"check",
")",
"{",
"this",
".",
"__checkProperty",
"(",
"property",
",",
"{",
"readable",
":",
"true",
",",
"method",
":",
"'get'",
",",
"params",
":",
"_",
".",
"toArray",
"(",
"arguments",
")",
"}",
")",
";",
"}",
"var",
"value",
"=",
"this",
".",
"__applyGetters",
"(",
"property",
",",
"this",
"[",
"'_'",
"+",
"property",
"]",
")",
";",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"ii",
"=",
"fields",
".",
"length",
";",
"i",
"<",
"ii",
";",
"++",
"i",
")",
"{",
"var",
"field",
"=",
"fields",
"[",
"i",
"]",
";",
"if",
"(",
"!",
"(",
"field",
"in",
"value",
")",
")",
"{",
"throw",
"new",
"Error",
"(",
"'Property \"'",
"+",
"[",
"property",
"]",
".",
"concat",
"(",
"fields",
".",
"slice",
"(",
"0",
",",
"i",
"+",
"1",
")",
")",
".",
"join",
"(",
"'.'",
")",
"+",
"'\" does not exists!'",
")",
";",
"}",
"value",
"=",
"this",
".",
"__applyGetters",
"(",
"property",
",",
"value",
"[",
"field",
"]",
",",
"fields",
".",
"slice",
"(",
"0",
",",
"i",
"+",
"1",
")",
")",
";",
"}",
"if",
"(",
"options",
".",
"emit",
"&&",
"this",
".",
"__checkEmitEvent",
"(",
")",
")",
"{",
"var",
"prop",
"=",
"[",
"property",
"]",
".",
"concat",
"(",
"fields",
")",
".",
"join",
"(",
"'.'",
")",
";",
"this",
".",
"__emitEvent",
"(",
"'property.'",
"+",
"prop",
"+",
"'.get'",
",",
"value",
")",
";",
"this",
".",
"__emitEvent",
"(",
"'property.get'",
",",
"prop",
",",
"value",
")",
";",
"}",
"return",
"value",
";",
"}"
] | 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 |
|
53,182 | 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,
method: 'is',
params: _.toArray(arguments)
});
}
var value = this.__getPropertyValue([property].concat(fields), false);
var result = !_.isUndefined(compareValue) ? value === compareValue : !!value;
if (options.emit && this.__checkEmitEvent()) {
var prop = [property].concat(fields).join('.');
this.__emitEvent('property.' + prop + '.is', result);
this.__emitEvent('property.is', prop, result);
}
return result;
} | 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,
method: 'is',
params: _.toArray(arguments)
});
}
var value = this.__getPropertyValue([property].concat(fields), false);
var result = !_.isUndefined(compareValue) ? value === compareValue : !!value;
if (options.emit && this.__checkEmitEvent()) {
var prop = [property].concat(fields).join('.');
this.__emitEvent('property.' + prop + '.is', result);
this.__emitEvent('property.is', prop, result);
}
return result;
} | [
"function",
"(",
"fields",
",",
"compareValue",
",",
"options",
")",
"{",
"fields",
"=",
"this",
".",
"__resolveFields",
"(",
"fields",
")",
";",
"options",
"=",
"this",
".",
"__resolveOptions",
"(",
"options",
")",
";",
"var",
"property",
"=",
"fields",
".",
"shift",
"(",
")",
";",
"if",
"(",
"options",
".",
"check",
")",
"{",
"this",
".",
"__checkProperty",
"(",
"property",
",",
"{",
"readable",
":",
"true",
",",
"method",
":",
"'is'",
",",
"params",
":",
"_",
".",
"toArray",
"(",
"arguments",
")",
"}",
")",
";",
"}",
"var",
"value",
"=",
"this",
".",
"__getPropertyValue",
"(",
"[",
"property",
"]",
".",
"concat",
"(",
"fields",
")",
",",
"false",
")",
";",
"var",
"result",
"=",
"!",
"_",
".",
"isUndefined",
"(",
"compareValue",
")",
"?",
"value",
"===",
"compareValue",
":",
"!",
"!",
"value",
";",
"if",
"(",
"options",
".",
"emit",
"&&",
"this",
".",
"__checkEmitEvent",
"(",
")",
")",
"{",
"var",
"prop",
"=",
"[",
"property",
"]",
".",
"concat",
"(",
"fields",
")",
".",
"join",
"(",
"'.'",
")",
";",
"this",
".",
"__emitEvent",
"(",
"'property.'",
"+",
"prop",
"+",
"'.is'",
",",
"result",
")",
";",
"this",
".",
"__emitEvent",
"(",
"'property.is'",
",",
"prop",
",",
"result",
")",
";",
"}",
"return",
"result",
";",
"}"
] | 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} true if property value is equals to specified or or is not false
@this {clazz|object} | [
"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 |
|
53,183 | 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,
method: 'remove',
params: _.toArray(arguments)
});
}
var field, container;
if (fields.length) {
field = _.last(fields);
container = this.__getPropertyValue([property].concat(fields).slice(0, -1));
if (!(field in container)) {
return this;
}
}
else {
field = '_' + property;
container = this;
}
var oldValue = container[field];
if (fields.length) {
delete container[field]
}
else {
container[field] = undefined;
}
if (options.emit && this.__checkEmitEvent()) {
this.__emitPropertyRemove([property].concat(fields), oldValue);
}
return this;
} | javascript | function(fields, options) {
fields = this.__resolveFields(fields);
options = this.__resolveOptions(options);
var property = fields.shift();
if (options.check) {
this.__checkProperty(property, {
writable: true,
method: 'remove',
params: _.toArray(arguments)
});
}
var field, container;
if (fields.length) {
field = _.last(fields);
container = this.__getPropertyValue([property].concat(fields).slice(0, -1));
if (!(field in container)) {
return this;
}
}
else {
field = '_' + property;
container = this;
}
var oldValue = container[field];
if (fields.length) {
delete container[field]
}
else {
container[field] = undefined;
}
if (options.emit && this.__checkEmitEvent()) {
this.__emitPropertyRemove([property].concat(fields), oldValue);
}
return this;
} | [
"function",
"(",
"fields",
",",
"options",
")",
"{",
"fields",
"=",
"this",
".",
"__resolveFields",
"(",
"fields",
")",
";",
"options",
"=",
"this",
".",
"__resolveOptions",
"(",
"options",
")",
";",
"var",
"property",
"=",
"fields",
".",
"shift",
"(",
")",
";",
"if",
"(",
"options",
".",
"check",
")",
"{",
"this",
".",
"__checkProperty",
"(",
"property",
",",
"{",
"writable",
":",
"true",
",",
"method",
":",
"'remove'",
",",
"params",
":",
"_",
".",
"toArray",
"(",
"arguments",
")",
"}",
")",
";",
"}",
"var",
"field",
",",
"container",
";",
"if",
"(",
"fields",
".",
"length",
")",
"{",
"field",
"=",
"_",
".",
"last",
"(",
"fields",
")",
";",
"container",
"=",
"this",
".",
"__getPropertyValue",
"(",
"[",
"property",
"]",
".",
"concat",
"(",
"fields",
")",
".",
"slice",
"(",
"0",
",",
"-",
"1",
")",
")",
";",
"if",
"(",
"!",
"(",
"field",
"in",
"container",
")",
")",
"{",
"return",
"this",
";",
"}",
"}",
"else",
"{",
"field",
"=",
"'_'",
"+",
"property",
";",
"container",
"=",
"this",
";",
"}",
"var",
"oldValue",
"=",
"container",
"[",
"field",
"]",
";",
"if",
"(",
"fields",
".",
"length",
")",
"{",
"delete",
"container",
"[",
"field",
"]",
"}",
"else",
"{",
"container",
"[",
"field",
"]",
"=",
"undefined",
";",
"}",
"if",
"(",
"options",
".",
"emit",
"&&",
"this",
".",
"__checkEmitEvent",
"(",
")",
")",
"{",
"this",
".",
"__emitPropertyRemove",
"(",
"[",
"property",
"]",
".",
"concat",
"(",
"fields",
")",
",",
"oldValue",
")",
";",
"}",
"return",
"this",
";",
"}"
] | 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 |
|
53,184 | 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,
method: 'set',
params: _.toArray(arguments)
});
}
var field, container;
if (fields.length) {
field = _.last(fields);
container = this.__getPropertyValue([property].concat(fields).slice(0, -1), false);
}
else {
field = '_' + property;
container = this;
}
var wasExisted = field in container;
var oldValue = container[field];
var newValue = this.__applySetters(property, value, fields);
container[field] = newValue;
if (options.emit && this.__checkEmitEvent()) {
this.__emitPropertySet([property].concat(fields), newValue, oldValue, wasExisted);
}
return this;
} | 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,
method: 'set',
params: _.toArray(arguments)
});
}
var field, container;
if (fields.length) {
field = _.last(fields);
container = this.__getPropertyValue([property].concat(fields).slice(0, -1), false);
}
else {
field = '_' + property;
container = this;
}
var wasExisted = field in container;
var oldValue = container[field];
var newValue = this.__applySetters(property, value, fields);
container[field] = newValue;
if (options.emit && this.__checkEmitEvent()) {
this.__emitPropertySet([property].concat(fields), newValue, oldValue, wasExisted);
}
return this;
} | [
"function",
"(",
"fields",
",",
"value",
",",
"options",
")",
"{",
"fields",
"=",
"this",
".",
"__resolveFields",
"(",
"fields",
")",
";",
"options",
"=",
"this",
".",
"__resolveOptions",
"(",
"options",
")",
";",
"var",
"property",
"=",
"fields",
".",
"shift",
"(",
")",
";",
"if",
"(",
"options",
".",
"check",
")",
"{",
"this",
".",
"__checkProperty",
"(",
"property",
",",
"{",
"writable",
":",
"true",
",",
"method",
":",
"'set'",
",",
"params",
":",
"_",
".",
"toArray",
"(",
"arguments",
")",
"}",
")",
";",
"}",
"var",
"field",
",",
"container",
";",
"if",
"(",
"fields",
".",
"length",
")",
"{",
"field",
"=",
"_",
".",
"last",
"(",
"fields",
")",
";",
"container",
"=",
"this",
".",
"__getPropertyValue",
"(",
"[",
"property",
"]",
".",
"concat",
"(",
"fields",
")",
".",
"slice",
"(",
"0",
",",
"-",
"1",
")",
",",
"false",
")",
";",
"}",
"else",
"{",
"field",
"=",
"'_'",
"+",
"property",
";",
"container",
"=",
"this",
";",
"}",
"var",
"wasExisted",
"=",
"field",
"in",
"container",
";",
"var",
"oldValue",
"=",
"container",
"[",
"field",
"]",
";",
"var",
"newValue",
"=",
"this",
".",
"__applySetters",
"(",
"property",
",",
"value",
",",
"fields",
")",
";",
"container",
"[",
"field",
"]",
"=",
"newValue",
";",
"if",
"(",
"options",
".",
"emit",
"&&",
"this",
".",
"__checkEmitEvent",
"(",
")",
")",
"{",
"this",
".",
"__emitPropertySet",
"(",
"[",
"property",
"]",
".",
"concat",
"(",
"fields",
")",
",",
"newValue",
",",
"oldValue",
",",
"wasExisted",
")",
";",
"}",
"return",
"this",
";",
"}"
] | 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 |
|
53,185 | 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",
":",
"options",
",",
"check",
":",
"options",
"}",
";",
"}",
"return",
"_",
".",
"extend",
"(",
"{",
"emit",
":",
"true",
",",
"check",
":",
"true",
"}",
",",
"options",
")",
";",
"}"
] | 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 |
|
53,186 | 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!';
}
if ('readable' in options || 'writable' in options) {
var params = this.__getPropertyParam(property);
var rights = ['readable', 'writable'];
for (var i = 0, ii = rights.length; i < ii; ++i) {
if (!checkRight(rights[i], options, params)) {
throw '"' + rights[i] + '" check was failed for property "' + property + '"!';
}
}
}
}
catch (error) {
if (!_.isString(error)) {
throw error;
}
if (throwError) {
throw new Error(error);
}
return false;
}
return true;
function checkRight(right, options, params) {
if (!(right in options)) {
return true;
}
var value = right in params
? (_.isFunction(params[right]) ? params[right].call(that, options.method, options.params) : params[right])
: true;
return options[right] == !!value;
}
} | javascript | function(property, options, throwError) {
throwError = !_.isUndefined(throwError) ? throwError : true;
var that = this;
try {
if (!this.__hasProperty(property)) {
throw 'Property "' + property + '" does not exists!';
}
if ('readable' in options || 'writable' in options) {
var params = this.__getPropertyParam(property);
var rights = ['readable', 'writable'];
for (var i = 0, ii = rights.length; i < ii; ++i) {
if (!checkRight(rights[i], options, params)) {
throw '"' + rights[i] + '" check was failed for property "' + property + '"!';
}
}
}
}
catch (error) {
if (!_.isString(error)) {
throw error;
}
if (throwError) {
throw new Error(error);
}
return false;
}
return true;
function checkRight(right, options, params) {
if (!(right in options)) {
return true;
}
var value = right in params
? (_.isFunction(params[right]) ? params[right].call(that, options.method, options.params) : params[right])
: true;
return options[right] == !!value;
}
} | [
"function",
"(",
"property",
",",
"options",
",",
"throwError",
")",
"{",
"throwError",
"=",
"!",
"_",
".",
"isUndefined",
"(",
"throwError",
")",
"?",
"throwError",
":",
"true",
";",
"var",
"that",
"=",
"this",
";",
"try",
"{",
"if",
"(",
"!",
"this",
".",
"__hasProperty",
"(",
"property",
")",
")",
"{",
"throw",
"'Property \"'",
"+",
"property",
"+",
"'\" does not exists!'",
";",
"}",
"if",
"(",
"'readable'",
"in",
"options",
"||",
"'writable'",
"in",
"options",
")",
"{",
"var",
"params",
"=",
"this",
".",
"__getPropertyParam",
"(",
"property",
")",
";",
"var",
"rights",
"=",
"[",
"'readable'",
",",
"'writable'",
"]",
";",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"ii",
"=",
"rights",
".",
"length",
";",
"i",
"<",
"ii",
";",
"++",
"i",
")",
"{",
"if",
"(",
"!",
"checkRight",
"(",
"rights",
"[",
"i",
"]",
",",
"options",
",",
"params",
")",
")",
"{",
"throw",
"'\"'",
"+",
"rights",
"[",
"i",
"]",
"+",
"'\" check was failed for property \"'",
"+",
"property",
"+",
"'\"!'",
";",
"}",
"}",
"}",
"}",
"catch",
"(",
"error",
")",
"{",
"if",
"(",
"!",
"_",
".",
"isString",
"(",
"error",
")",
")",
"{",
"throw",
"error",
";",
"}",
"if",
"(",
"throwError",
")",
"{",
"throw",
"new",
"Error",
"(",
"error",
")",
";",
"}",
"return",
"false",
";",
"}",
"return",
"true",
";",
"function",
"checkRight",
"(",
"right",
",",
"options",
",",
"params",
")",
"{",
"if",
"(",
"!",
"(",
"right",
"in",
"options",
")",
")",
"{",
"return",
"true",
";",
"}",
"var",
"value",
"=",
"right",
"in",
"params",
"?",
"(",
"_",
".",
"isFunction",
"(",
"params",
"[",
"right",
"]",
")",
"?",
"params",
"[",
"right",
"]",
".",
"call",
"(",
"that",
",",
"options",
".",
"method",
",",
"options",
".",
"params",
")",
":",
"params",
"[",
"right",
"]",
")",
":",
"true",
";",
"return",
"options",
"[",
"right",
"]",
"==",
"!",
"!",
"value",
";",
"}",
"}"
] | 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 |
|
53,187 | 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.' + prop + '.item_removed', key, oldValue);
this.__emitEvent('property.item_removed', prop, key, oldValue);
}
prop = fields.join('.');
this.__emitEvent('property.' + prop + '.remove', oldValue);
this.__emitEvent('property.remove', prop, oldValue);
return this;
} | 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.' + prop + '.item_removed', key, oldValue);
this.__emitEvent('property.item_removed', prop, key, oldValue);
}
prop = fields.join('.');
this.__emitEvent('property.' + prop + '.remove', oldValue);
this.__emitEvent('property.remove', prop, oldValue);
return this;
} | [
"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.'",
"+",
"prop",
"+",
"'.item_removed'",
",",
"key",
",",
"oldValue",
")",
";",
"this",
".",
"__emitEvent",
"(",
"'property.item_removed'",
",",
"prop",
",",
"key",
",",
"oldValue",
")",
";",
"}",
"prop",
"=",
"fields",
".",
"join",
"(",
"'.'",
")",
";",
"this",
".",
"__emitEvent",
"(",
"'property.'",
"+",
"prop",
"+",
"'.remove'",
",",
"oldValue",
")",
";",
"this",
".",
"__emitEvent",
"(",
"'property.remove'",
",",
"prop",
",",
"oldValue",
")",
";",
"return",
"this",
";",
"}"
] | 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 |
|
53,188 | 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[key]);
}
}
else if (_.isArray(oldValue)) {
for (i = 0, ii = oldValue.length; i < ii; ++i) {
this.__emitPropertyRemove(fields.concat(i), oldValue[i]);
}
}
prop = fields.join('.');
this.__emitEvent('property.' + prop + '.clear', oldValue);
this.__emitEvent('property.clear', prop, oldValue);
return this;
} | 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[key]);
}
}
else if (_.isArray(oldValue)) {
for (i = 0, ii = oldValue.length; i < ii; ++i) {
this.__emitPropertyRemove(fields.concat(i), oldValue[i]);
}
}
prop = fields.join('.');
this.__emitEvent('property.' + prop + '.clear', oldValue);
this.__emitEvent('property.clear', prop, oldValue);
return this;
} | [
"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",
"[",
"key",
"]",
")",
";",
"}",
"}",
"else",
"if",
"(",
"_",
".",
"isArray",
"(",
"oldValue",
")",
")",
"{",
"for",
"(",
"i",
"=",
"0",
",",
"ii",
"=",
"oldValue",
".",
"length",
";",
"i",
"<",
"ii",
";",
"++",
"i",
")",
"{",
"this",
".",
"__emitPropertyRemove",
"(",
"fields",
".",
"concat",
"(",
"i",
")",
",",
"oldValue",
"[",
"i",
"]",
")",
";",
"}",
"}",
"prop",
"=",
"fields",
".",
"join",
"(",
"'.'",
")",
";",
"this",
".",
"__emitEvent",
"(",
"'property.'",
"+",
"prop",
"+",
"'.clear'",
",",
"oldValue",
")",
";",
"this",
".",
"__emitEvent",
"(",
"'property.clear'",
",",
"prop",
",",
"oldValue",
")",
";",
"return",
"this",
";",
"}"
] | 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 |
|
53,189 | 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 in oldValue) {
if (newValue[key] !== oldValue[key]) {
isEqual = false;
break;
}
}
}
else if (_.isArray(newValue) && _.isArray(oldValue)) {
for (i = 0, ii = oldValue.length; i < ii; ++i) {
if (newValue[i] !== oldValue[i]) {
isEqual = false;
break;
}
}
}
else if (newValue !== oldValue) {
isEqual = false;
}
if (!isEqual) {
prop = fields.join('.');
this.__emitEvent('property.' + prop + '.' + 'set', newValue, oldValue);
this.__emitEvent('property.set', prop, newValue, oldValue);
if (fields.length && !wasExists) {
prop = fields.slice(0,-1).join('.');
key = _.last(fields);
this.__emitEvent('property.' + prop + '.item_added', key, newValue);
this.__emitEvent('property.item_added', prop, key, newValue);
}
}
return this;
} | 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 in oldValue) {
if (newValue[key] !== oldValue[key]) {
isEqual = false;
break;
}
}
}
else if (_.isArray(newValue) && _.isArray(oldValue)) {
for (i = 0, ii = oldValue.length; i < ii; ++i) {
if (newValue[i] !== oldValue[i]) {
isEqual = false;
break;
}
}
}
else if (newValue !== oldValue) {
isEqual = false;
}
if (!isEqual) {
prop = fields.join('.');
this.__emitEvent('property.' + prop + '.' + 'set', newValue, oldValue);
this.__emitEvent('property.set', prop, newValue, oldValue);
if (fields.length && !wasExists) {
prop = fields.slice(0,-1).join('.');
key = _.last(fields);
this.__emitEvent('property.' + prop + '.item_added', key, newValue);
this.__emitEvent('property.item_added', prop, key, newValue);
}
}
return this;
} | [
"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",
"in",
"oldValue",
")",
"{",
"if",
"(",
"newValue",
"[",
"key",
"]",
"!==",
"oldValue",
"[",
"key",
"]",
")",
"{",
"isEqual",
"=",
"false",
";",
"break",
";",
"}",
"}",
"}",
"else",
"if",
"(",
"_",
".",
"isArray",
"(",
"newValue",
")",
"&&",
"_",
".",
"isArray",
"(",
"oldValue",
")",
")",
"{",
"for",
"(",
"i",
"=",
"0",
",",
"ii",
"=",
"oldValue",
".",
"length",
";",
"i",
"<",
"ii",
";",
"++",
"i",
")",
"{",
"if",
"(",
"newValue",
"[",
"i",
"]",
"!==",
"oldValue",
"[",
"i",
"]",
")",
"{",
"isEqual",
"=",
"false",
";",
"break",
";",
"}",
"}",
"}",
"else",
"if",
"(",
"newValue",
"!==",
"oldValue",
")",
"{",
"isEqual",
"=",
"false",
";",
"}",
"if",
"(",
"!",
"isEqual",
")",
"{",
"prop",
"=",
"fields",
".",
"join",
"(",
"'.'",
")",
";",
"this",
".",
"__emitEvent",
"(",
"'property.'",
"+",
"prop",
"+",
"'.'",
"+",
"'set'",
",",
"newValue",
",",
"oldValue",
")",
";",
"this",
".",
"__emitEvent",
"(",
"'property.set'",
",",
"prop",
",",
"newValue",
",",
"oldValue",
")",
";",
"if",
"(",
"fields",
".",
"length",
"&&",
"!",
"wasExists",
")",
"{",
"prop",
"=",
"fields",
".",
"slice",
"(",
"0",
",",
"-",
"1",
")",
".",
"join",
"(",
"'.'",
")",
";",
"key",
"=",
"_",
".",
"last",
"(",
"fields",
")",
";",
"this",
".",
"__emitEvent",
"(",
"'property.'",
"+",
"prop",
"+",
"'.item_added'",
",",
"key",
",",
"newValue",
")",
";",
"this",
".",
"__emitEvent",
"(",
"'property.item_added'",
",",
"prop",
",",
"key",
",",
"newValue",
")",
";",
"}",
"}",
"return",
"this",
";",
"}"
] | 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 |
|
53,190 | 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 (!_.isFunction(callback)) {
throw new Error('Setter callback must be a function!');
}
if (!(property in this.__setters)) {
this.__setters[property] = {};
}
this.__setters[property][name] = [weight, callback];
return this;
} | javascript | function(property, name, weight, callback) {
if (_.isUndefined(callback)) {
callback = weight;
weight = 0;
}
if (_.isArray(callback)) {
weight = callback[0];
callback = callback[1];
}
else if (!_.isFunction(callback)) {
throw new Error('Setter callback must be a function!');
}
if (!(property in this.__setters)) {
this.__setters[property] = {};
}
this.__setters[property][name] = [weight, callback];
return this;
} | [
"function",
"(",
"property",
",",
"name",
",",
"weight",
",",
"callback",
")",
"{",
"if",
"(",
"_",
".",
"isUndefined",
"(",
"callback",
")",
")",
"{",
"callback",
"=",
"weight",
";",
"weight",
"=",
"0",
";",
"}",
"if",
"(",
"_",
".",
"isArray",
"(",
"callback",
")",
")",
"{",
"weight",
"=",
"callback",
"[",
"0",
"]",
";",
"callback",
"=",
"callback",
"[",
"1",
"]",
";",
"}",
"else",
"if",
"(",
"!",
"_",
".",
"isFunction",
"(",
"callback",
")",
")",
"{",
"throw",
"new",
"Error",
"(",
"'Setter callback must be a function!'",
")",
";",
"}",
"if",
"(",
"!",
"(",
"property",
"in",
"this",
".",
"__setters",
")",
")",
"{",
"this",
".",
"__setters",
"[",
"property",
"]",
"=",
"{",
"}",
";",
"}",
"this",
".",
"__setters",
"[",
"property",
"]",
"[",
"name",
"]",
"=",
"[",
"weight",
",",
"callback",
"]",
";",
"return",
"this",
";",
"}"
] | 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 |
|
53,191 | 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[property];
}
var sortedSetters = [];
for (var name in setters) {
sortedSetters.push(setters[name]);
}
sortedSetters = sortedSetters.sort(function(s1, s2) { return s2[0] - s1[0]; });
for (var i = 0, ii = sortedSetters.length; i < ii; ++i) {
sortedSetters[i] = sortedSetters[i][1];
}
return sortedSetters;
} | 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[property];
}
var sortedSetters = [];
for (var name in setters) {
sortedSetters.push(setters[name]);
}
sortedSetters = sortedSetters.sort(function(s1, s2) { return s2[0] - s1[0]; });
for (var i = 0, ii = sortedSetters.length; i < ii; ++i) {
sortedSetters[i] = sortedSetters[i][1];
}
return sortedSetters;
} | [
"function",
"(",
"property",
",",
"sorted",
")",
"{",
"var",
"setters",
"=",
"this",
".",
"__collectAllPropertyValues",
".",
"apply",
"(",
"this",
",",
"[",
"'__setters'",
",",
"1",
"]",
".",
"concat",
"(",
"property",
"||",
"[",
"]",
")",
")",
";",
"if",
"(",
"!",
"property",
")",
"{",
"return",
"setters",
";",
"}",
"setters",
"=",
"setters",
"[",
"property",
"]",
";",
"if",
"(",
"!",
"sorted",
")",
"{",
"return",
"setters",
"[",
"property",
"]",
";",
"}",
"var",
"sortedSetters",
"=",
"[",
"]",
";",
"for",
"(",
"var",
"name",
"in",
"setters",
")",
"{",
"sortedSetters",
".",
"push",
"(",
"setters",
"[",
"name",
"]",
")",
";",
"}",
"sortedSetters",
"=",
"sortedSetters",
".",
"sort",
"(",
"function",
"(",
"s1",
",",
"s2",
")",
"{",
"return",
"s2",
"[",
"0",
"]",
"-",
"s1",
"[",
"0",
"]",
";",
"}",
")",
";",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"ii",
"=",
"sortedSetters",
".",
"length",
";",
"i",
"<",
"ii",
";",
"++",
"i",
")",
"{",
"sortedSetters",
"[",
"i",
"]",
"=",
"sortedSetters",
"[",
"i",
"]",
"[",
"1",
"]",
";",
"}",
"return",
"sortedSetters",
";",
"}"
] | 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 |
|
53,192 | 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)) {
value = result;
}
}
return value;
} | 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)) {
value = result;
}
}
return value;
} | [
"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",
")",
")",
"{",
"value",
"=",
"result",
";",
"}",
"}",
"return",
"value",
";",
"}"
] | 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 |
|
53,193 | 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[property];
}
var sortedGetters = [];
for (var name in getters) {
sortedGetters.push(getters[name]);
}
sortedGetters = sortedGetters.sort(function(s1, s2) { return s2[0] - s1[0]; });
for (var i = 0, ii = sortedGetters.length; i < ii; ++i) {
sortedGetters[i] = sortedGetters[i][1];
}
return sortedGetters;
} | 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[property];
}
var sortedGetters = [];
for (var name in getters) {
sortedGetters.push(getters[name]);
}
sortedGetters = sortedGetters.sort(function(s1, s2) { return s2[0] - s1[0]; });
for (var i = 0, ii = sortedGetters.length; i < ii; ++i) {
sortedGetters[i] = sortedGetters[i][1];
}
return sortedGetters;
} | [
"function",
"(",
"property",
",",
"sorted",
")",
"{",
"var",
"getters",
"=",
"this",
".",
"__collectAllPropertyValues",
".",
"apply",
"(",
"this",
",",
"[",
"'__getters'",
",",
"1",
"]",
".",
"concat",
"(",
"property",
"||",
"[",
"]",
")",
")",
";",
"if",
"(",
"!",
"property",
")",
"{",
"return",
"getters",
";",
"}",
"getters",
"=",
"getters",
"[",
"property",
"]",
";",
"if",
"(",
"!",
"sorted",
")",
"{",
"return",
"getters",
"[",
"property",
"]",
";",
"}",
"var",
"sortedGetters",
"=",
"[",
"]",
";",
"for",
"(",
"var",
"name",
"in",
"getters",
")",
"{",
"sortedGetters",
".",
"push",
"(",
"getters",
"[",
"name",
"]",
")",
";",
"}",
"sortedGetters",
"=",
"sortedGetters",
".",
"sort",
"(",
"function",
"(",
"s1",
",",
"s2",
")",
"{",
"return",
"s2",
"[",
"0",
"]",
"-",
"s1",
"[",
"0",
"]",
";",
"}",
")",
";",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"ii",
"=",
"sortedGetters",
".",
"length",
";",
"i",
"<",
"ii",
";",
"++",
"i",
")",
"{",
"sortedGetters",
"[",
"i",
"]",
"=",
"sortedGetters",
"[",
"i",
"]",
"[",
"1",
"]",
";",
"}",
"return",
"sortedGetters",
";",
"}"
] | 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 |
|
53,194 | 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)) {
value = result;
}
}
return value;
} | 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)) {
value = result;
}
}
return value;
} | [
"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",
")",
")",
"{",
"value",
"=",
"result",
";",
"}",
"}",
"return",
"value",
";",
"}"
] | 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 |
|
53,195 | 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.__removePropertyValue(property, options);
}
else if (_.isObject(value) && _.isEmpty(value)) {
this.__clearPropertyValue(property, options)
}
else {
this.__setPropertyValue(property, value, options);
}
}
return this;
} | 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.__removePropertyValue(property, options);
}
else if (_.isObject(value) && _.isEmpty(value)) {
this.__clearPropertyValue(property, options)
}
else {
this.__setPropertyValue(property, value, options);
}
}
return this;
} | [
"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",
".",
"__removePropertyValue",
"(",
"property",
",",
"options",
")",
";",
"}",
"else",
"if",
"(",
"_",
".",
"isObject",
"(",
"value",
")",
"&&",
"_",
".",
"isEmpty",
"(",
"value",
")",
")",
"{",
"this",
".",
"__clearPropertyValue",
"(",
"property",
",",
"options",
")",
"}",
"else",
"{",
"this",
".",
"__setPropertyValue",
"(",
"property",
",",
"value",
",",
"options",
")",
";",
"}",
"}",
"return",
"this",
";",
"}"
] | 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 |
|
53,196 | 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",
".",
"__processData",
"(",
"this",
".",
"__getPropertyValue",
"(",
"property",
")",
")",
";",
"}",
"return",
"data",
";",
"}"
] | 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 |
|
53,197 | 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[prop];
continue;
}
data[prop] = self_method(data[prop], methods);
}
}
else if (_.isArray(data)) {
for (i = 0, ii = data.length; i < ii; ++i) {
if (_.isUndefined(data[i])) {
--i; --ii;
continue;
}
data[i] = self_method(data[i], methods);
}
}
else {
methods = _.extend({}, methods, { __getData: null });
_.each(methods, function(params, method) {
if (!_.isFunction(data[method])) {
return;
}
if (_.isNull(params) || _.isUndefined(params)) {
params = [];
}
if (!_.isArray(params)) {
params = [params];
}
data = data[method].apply(data, params);
});
}
return 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[prop];
continue;
}
data[prop] = self_method(data[prop], methods);
}
}
else if (_.isArray(data)) {
for (i = 0, ii = data.length; i < ii; ++i) {
if (_.isUndefined(data[i])) {
--i; --ii;
continue;
}
data[i] = self_method(data[i], methods);
}
}
else {
methods = _.extend({}, methods, { __getData: null });
_.each(methods, function(params, method) {
if (!_.isFunction(data[method])) {
return;
}
if (_.isNull(params) || _.isUndefined(params)) {
params = [];
}
if (!_.isArray(params)) {
params = [params];
}
data = data[method].apply(data, params);
});
}
return data;
} | [
"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",
"[",
"prop",
"]",
";",
"continue",
";",
"}",
"data",
"[",
"prop",
"]",
"=",
"self_method",
"(",
"data",
"[",
"prop",
"]",
",",
"methods",
")",
";",
"}",
"}",
"else",
"if",
"(",
"_",
".",
"isArray",
"(",
"data",
")",
")",
"{",
"for",
"(",
"i",
"=",
"0",
",",
"ii",
"=",
"data",
".",
"length",
";",
"i",
"<",
"ii",
";",
"++",
"i",
")",
"{",
"if",
"(",
"_",
".",
"isUndefined",
"(",
"data",
"[",
"i",
"]",
")",
")",
"{",
"--",
"i",
";",
"--",
"ii",
";",
"continue",
";",
"}",
"data",
"[",
"i",
"]",
"=",
"self_method",
"(",
"data",
"[",
"i",
"]",
",",
"methods",
")",
";",
"}",
"}",
"else",
"{",
"methods",
"=",
"_",
".",
"extend",
"(",
"{",
"}",
",",
"methods",
",",
"{",
"__getData",
":",
"null",
"}",
")",
";",
"_",
".",
"each",
"(",
"methods",
",",
"function",
"(",
"params",
",",
"method",
")",
"{",
"if",
"(",
"!",
"_",
".",
"isFunction",
"(",
"data",
"[",
"method",
"]",
")",
")",
"{",
"return",
";",
"}",
"if",
"(",
"_",
".",
"isNull",
"(",
"params",
")",
"||",
"_",
".",
"isUndefined",
"(",
"params",
")",
")",
"{",
"params",
"=",
"[",
"]",
";",
"}",
"if",
"(",
"!",
"_",
".",
"isArray",
"(",
"params",
")",
")",
"{",
"params",
"=",
"[",
"params",
"]",
";",
"}",
"data",
"=",
"data",
"[",
"method",
"]",
".",
"apply",
"(",
"data",
",",
"params",
")",
";",
"}",
")",
";",
"}",
"return",
"data",
";",
"}"
] | 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 |
53,198 | 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);
editor = ns.widgets.xmleditorInitIframe(iframe);
})();
if (opts.defaultScript) {
editor.set(ns.modules.string.htmlDecode(opts.defaultScript));
}
var me = {};
me.refresh = function () { editor.refresh(); };
me.getXml = function () {
var code = editor.get();
return code;
};
me.setXml = function (xml) {
editor.set(xml);
};
return me;
} | 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);
editor = ns.widgets.xmleditorInitIframe(iframe);
})();
if (opts.defaultScript) {
editor.set(ns.modules.string.htmlDecode(opts.defaultScript));
}
var me = {};
me.refresh = function () { editor.refresh(); };
me.getXml = function () {
var code = editor.get();
return code;
};
me.setXml = function (xml) {
editor.set(xml);
};
return me;
} | [
"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",
")",
";",
"editor",
"=",
"ns",
".",
"widgets",
".",
"xmleditorInitIframe",
"(",
"iframe",
")",
";",
"}",
")",
"(",
")",
";",
"if",
"(",
"opts",
".",
"defaultScript",
")",
"{",
"editor",
".",
"set",
"(",
"ns",
".",
"modules",
".",
"string",
".",
"htmlDecode",
"(",
"opts",
".",
"defaultScript",
")",
")",
";",
"}",
"var",
"me",
"=",
"{",
"}",
";",
"me",
".",
"refresh",
"=",
"function",
"(",
")",
"{",
"editor",
".",
"refresh",
"(",
")",
";",
"}",
";",
"me",
".",
"getXml",
"=",
"function",
"(",
")",
"{",
"var",
"code",
"=",
"editor",
".",
"get",
"(",
")",
";",
"return",
"code",
";",
"}",
";",
"me",
".",
"setXml",
"=",
"function",
"(",
"xml",
")",
"{",
"editor",
".",
"set",
"(",
"xml",
")",
";",
"}",
";",
"return",
"me",
";",
"}"
] | var error = tracing.error; | [
"var",
"error",
"=",
"tracing",
".",
"error",
";"
] | 4e9b410864afb731f88e84414984fa18ac5705f1 | https://github.com/xsolon/spexplorerjs/blob/4e9b410864afb731f88e84414984fa18ac5705f1/webapi/src/components/mirrors/xmlmirror.js#L17-L50 |
|
53,199 | 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)
return {}
}
} | 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)
return {}
}
} | [
"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",
")",
"return",
"{",
"}",
"}",
"}"
] | '.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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.