repo stringlengths 5 67 | path stringlengths 4 116 | func_name stringlengths 0 58 | original_string stringlengths 52 373k | language stringclasses 1
value | code stringlengths 52 373k | code_tokens list | docstring stringlengths 4 11.8k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 86 226 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
micro-node/amqp | lib/amqp.js | assetQueue | function assetQueue(addr, queue, options) {
return createChannel(addr).then(data => {
let ch = data[1];
return ch.assertQueue(queue, options).then(q => [ch, q]);
});
} | javascript | function assetQueue(addr, queue, options) {
return createChannel(addr).then(data => {
let ch = data[1];
return ch.assertQueue(queue, options).then(q => [ch, q]);
});
} | [
"function",
"assetQueue",
"(",
"addr",
",",
"queue",
",",
"options",
")",
"{",
"return",
"createChannel",
"(",
"addr",
")",
".",
"then",
"(",
"data",
"=>",
"{",
"let",
"ch",
"=",
"data",
"[",
"1",
"]",
";",
"return",
"ch",
".",
"assertQueue",
"(",
... | asset queue helper | [
"asset",
"queue",
"helper"
] | 40e12b04a4426f51b790284c13ebef9fd91a6733 | https://github.com/micro-node/amqp/blob/40e12b04a4426f51b790284c13ebef9fd91a6733/lib/amqp.js#L183-L189 | train |
micro-node/amqp | lib/amqp.js | createChannel | function createChannel(addr) {
return amqp.connect(genAddr(addr)).then(conn => {
return conn.createChannel().then(ch => {
connections.push(conn);
return [conn, ch];
});
}, debugError);
} | javascript | function createChannel(addr) {
return amqp.connect(genAddr(addr)).then(conn => {
return conn.createChannel().then(ch => {
connections.push(conn);
return [conn, ch];
});
}, debugError);
} | [
"function",
"createChannel",
"(",
"addr",
")",
"{",
"return",
"amqp",
".",
"connect",
"(",
"genAddr",
"(",
"addr",
")",
")",
".",
"then",
"(",
"conn",
"=>",
"{",
"return",
"conn",
".",
"createChannel",
"(",
")",
".",
"then",
"(",
"ch",
"=>",
"{",
"... | create channel helper | [
"create",
"channel",
"helper"
] | 40e12b04a4426f51b790284c13ebef9fd91a6733 | https://github.com/micro-node/amqp/blob/40e12b04a4426f51b790284c13ebef9fd91a6733/lib/amqp.js#L192-L200 | train |
iuap-design/compox | dist/compox.js | SubClass | function SubClass() {
var ret;
// Call the parent constructor.
parent.apply(this, arguments);
// Only call initialize in self constructor.
if(this.constructor === SubClass && this.initialize) {
ret = this.initialize.apply(this, arguments);
}
return ret ? ret : this;
} | javascript | function SubClass() {
var ret;
// Call the parent constructor.
parent.apply(this, arguments);
// Only call initialize in self constructor.
if(this.constructor === SubClass && this.initialize) {
ret = this.initialize.apply(this, arguments);
}
return ret ? ret : this;
} | [
"function",
"SubClass",
"(",
")",
"{",
"var",
"ret",
";",
"// Call the parent constructor.",
"parent",
".",
"apply",
"(",
"this",
",",
"arguments",
")",
";",
"// Only call initialize in self constructor.",
"if",
"(",
"this",
".",
"constructor",
"===",
"SubClass",
... | The created class constructor | [
"The",
"created",
"class",
"constructor"
] | 79b6a6d24a64f072134cc7385b6cdd29a2e310ac | https://github.com/iuap-design/compox/blob/79b6a6d24a64f072134cc7385b6cdd29a2e310ac/dist/compox.js#L537-L547 | train |
iuap-design/compox | dist/compox.js | function (event) {
//event = $.event.fix(event); // jQuery event normalization.
var element = this;//event.target;
// @ TextNode -> nodeType == 3
element = (element.nodeType == 3) ? element.parentNode : element;
if (opt['disableInInput']) { // Disable shortcut keys in Input, Tex... | javascript | function (event) {
//event = $.event.fix(event); // jQuery event normalization.
var element = this;//event.target;
// @ TextNode -> nodeType == 3
element = (element.nodeType == 3) ? element.parentNode : element;
if (opt['disableInInput']) { // Disable shortcut keys in Input, Tex... | [
"function",
"(",
"event",
")",
"{",
"//event = $.event.fix(event); // jQuery event normalization.",
"var",
"element",
"=",
"this",
";",
"//event.target;",
"// @ TextNode -> nodeType == 3",
"element",
"=",
"(",
"element",
".",
"nodeType",
"==",
"3",
")",
"?",
"element",
... | inspect if keystroke matches | [
"inspect",
"if",
"keystroke",
"matches"
] | 79b6a6d24a64f072134cc7385b6cdd29a2e310ac | https://github.com/iuap-design/compox/blob/79b6a6d24a64f072134cc7385b6cdd29a2e310ac/dist/compox.js#L712-L766 | train | |
gethuman/pancakes-recipe | utils/active.user.js | init | function init() {
return user.initComplete ?
Q.when(user) :
userService.findMe()
.then(function setUserLocal(me) {
me = me || {};
// pull out the user
_.extend(user, me.user);
// return the ... | javascript | function init() {
return user.initComplete ?
Q.when(user) :
userService.findMe()
.then(function setUserLocal(me) {
me = me || {};
// pull out the user
_.extend(user, me.user);
// return the ... | [
"function",
"init",
"(",
")",
"{",
"return",
"user",
".",
"initComplete",
"?",
"Q",
".",
"when",
"(",
"user",
")",
":",
"userService",
".",
"findMe",
"(",
")",
".",
"then",
"(",
"function",
"setUserLocal",
"(",
"me",
")",
"{",
"me",
"=",
"me",
"||"... | If user already loaded, use that, otherwise get it from the API
@returns {*} | [
"If",
"user",
"already",
"loaded",
"use",
"that",
"otherwise",
"get",
"it",
"from",
"the",
"API"
] | ea3feb8839e2edaf1b4577c052b8958953db4498 | https://github.com/gethuman/pancakes-recipe/blob/ea3feb8839e2edaf1b4577c052b8958953db4498/utils/active.user.js#L18-L34 | train |
Postmedia/timbits | lib/timbits.js | filteredFiles | function filteredFiles(folder, pattern) {
var files = [];
if (fs.existsSync(folder)){
fs.readdirSync(folder).forEach(function(file) {
if (file.match(pattern) != null)
files.push(file);
});
}
return files;
} | javascript | function filteredFiles(folder, pattern) {
var files = [];
if (fs.existsSync(folder)){
fs.readdirSync(folder).forEach(function(file) {
if (file.match(pattern) != null)
files.push(file);
});
}
return files;
} | [
"function",
"filteredFiles",
"(",
"folder",
",",
"pattern",
")",
"{",
"var",
"files",
"=",
"[",
"]",
";",
"if",
"(",
"fs",
".",
"existsSync",
"(",
"folder",
")",
")",
"{",
"fs",
".",
"readdirSync",
"(",
"folder",
")",
".",
"forEach",
"(",
"function",... | retrieve list of matching files in a folder | [
"retrieve",
"list",
"of",
"matching",
"files",
"in",
"a",
"folder"
] | 0213593db6cf94bb35679a4fad01588b19f7fe62 | https://github.com/Postmedia/timbits/blob/0213593db6cf94bb35679a4fad01588b19f7fe62/lib/timbits.js#L28-L38 | train |
Postmedia/timbits | lib/timbits.js | loadViews | function loadViews(timbit) {
timbit.views = [];
var pattern = new RegExp('\.' + timbits.app.settings['view engine'] + '$')
, folder = path.join(config.home, 'views', timbit.viewBase);
if (fs.existsSync(folder)) {
var files = fs.readdirSync(folder);
files.forEach(function(file) {
timbit.view... | javascript | function loadViews(timbit) {
timbit.views = [];
var pattern = new RegExp('\.' + timbits.app.settings['view engine'] + '$')
, folder = path.join(config.home, 'views', timbit.viewBase);
if (fs.existsSync(folder)) {
var files = fs.readdirSync(folder);
files.forEach(function(file) {
timbit.view... | [
"function",
"loadViews",
"(",
"timbit",
")",
"{",
"timbit",
".",
"views",
"=",
"[",
"]",
";",
"var",
"pattern",
"=",
"new",
"RegExp",
"(",
"'\\.'",
"+",
"timbits",
".",
"app",
".",
"settings",
"[",
"'view engine'",
"]",
"+",
"'$'",
")",
",",
"folder"... | automagically load views for a given timbit | [
"automagically",
"load",
"views",
"for",
"a",
"given",
"timbit"
] | 0213593db6cf94bb35679a4fad01588b19f7fe62 | https://github.com/Postmedia/timbits/blob/0213593db6cf94bb35679a4fad01588b19f7fe62/lib/timbits.js#L57-L72 | train |
Postmedia/timbits | lib/timbits.js | compileTemplate | function compileTemplate(name) {
var filename = path.join(__dirname, "templates", name + '.hjs');
var contents = fs.readFileSync(filename);
return hogan.compile(contents.toString());
} | javascript | function compileTemplate(name) {
var filename = path.join(__dirname, "templates", name + '.hjs');
var contents = fs.readFileSync(filename);
return hogan.compile(contents.toString());
} | [
"function",
"compileTemplate",
"(",
"name",
")",
"{",
"var",
"filename",
"=",
"path",
".",
"join",
"(",
"__dirname",
",",
"\"templates\"",
",",
"name",
"+",
"'.hjs'",
")",
";",
"var",
"contents",
"=",
"fs",
".",
"readFileSync",
"(",
"filename",
")",
";",... | compile built in templates | [
"compile",
"built",
"in",
"templates"
] | 0213593db6cf94bb35679a4fad01588b19f7fe62 | https://github.com/Postmedia/timbits/blob/0213593db6cf94bb35679a4fad01588b19f7fe62/lib/timbits.js#L87-L91 | train |
Postmedia/timbits | lib/timbits.js | allowedMethods | function allowedMethods(methods) {
// default values
var methodsAllowed = { 'GET': true, 'POST': false, 'PUT': false, 'HEAD': false, 'DELETE': false };
// check and override if one of the default methods
for (var key in methods) {
var newKey = key.toUpperCase();
if ( methodsAllowed[newKey]!=undefined) ... | javascript | function allowedMethods(methods) {
// default values
var methodsAllowed = { 'GET': true, 'POST': false, 'PUT': false, 'HEAD': false, 'DELETE': false };
// check and override if one of the default methods
for (var key in methods) {
var newKey = key.toUpperCase();
if ( methodsAllowed[newKey]!=undefined) ... | [
"function",
"allowedMethods",
"(",
"methods",
")",
"{",
"// default values",
"var",
"methodsAllowed",
"=",
"{",
"'GET'",
":",
"true",
",",
"'POST'",
":",
"false",
",",
"'PUT'",
":",
"false",
",",
"'HEAD'",
":",
"false",
",",
"'DELETE'",
":",
"false",
"}",
... | generates the allowed methods | [
"generates",
"the",
"allowed",
"methods"
] | 0213593db6cf94bb35679a4fad01588b19f7fe62 | https://github.com/Postmedia/timbits/blob/0213593db6cf94bb35679a4fad01588b19f7fe62/lib/timbits.js#L94-L105 | train |
bigpipe/parsifal | index.js | text | function text(element) {
var type = element.nodeType
, value = '';
if (1 === type || 9 === type || 11 === type) {
//
// Use `textContent` instead of `innerText` as it's inconsistent with new
// lines.
//
if ('string' === typeof element.textContent) return element.textContent;
for (elem... | javascript | function text(element) {
var type = element.nodeType
, value = '';
if (1 === type || 9 === type || 11 === type) {
//
// Use `textContent` instead of `innerText` as it's inconsistent with new
// lines.
//
if ('string' === typeof element.textContent) return element.textContent;
for (elem... | [
"function",
"text",
"(",
"element",
")",
"{",
"var",
"type",
"=",
"element",
".",
"nodeType",
",",
"value",
"=",
"''",
";",
"if",
"(",
"1",
"===",
"type",
"||",
"9",
"===",
"type",
"||",
"11",
"===",
"type",
")",
"{",
"//",
"// Use `textContent` inst... | Get the text or inner text from a given element.
@param {Element} element
@returns {String} text
@api public | [
"Get",
"the",
"text",
"or",
"inner",
"text",
"from",
"a",
"given",
"element",
"."
] | 4b35938c62b72810c4117cda5d57123cb8a9a318 | https://github.com/bigpipe/parsifal/blob/4b35938c62b72810c4117cda5d57123cb8a9a318/index.js#L58-L77 | train |
bigpipe/parsifal | index.js | attribute | function attribute(element, name, val) {
return supports.attributes || !supports.html
? element.getAttribute(name)
: (val = element.getAttributeNode(name)) && val.specified ? val.value : '';
} | javascript | function attribute(element, name, val) {
return supports.attributes || !supports.html
? element.getAttribute(name)
: (val = element.getAttributeNode(name)) && val.specified ? val.value : '';
} | [
"function",
"attribute",
"(",
"element",
",",
"name",
",",
"val",
")",
"{",
"return",
"supports",
".",
"attributes",
"||",
"!",
"supports",
".",
"html",
"?",
"element",
".",
"getAttribute",
"(",
"name",
")",
":",
"(",
"val",
"=",
"element",
".",
"getAt... | Find the attribute.
@param {Element} element
@returns {String} The `.value` of the element.
@api private | [
"Find",
"the",
"attribute",
"."
] | 4b35938c62b72810c4117cda5d57123cb8a9a318 | https://github.com/bigpipe/parsifal/blob/4b35938c62b72810c4117cda5d57123cb8a9a318/index.js#L97-L101 | train |
bigpipe/parsifal | index.js | get | function get(element) {
var name = element.nodeName.toLowerCase()
, value;
if (get.parser[element.type] && hasOwn.call(get.parser, element.type)) {
value = get.parser[element.type](element);
} else if (get.parser[name] && hasOwn.call(get.parser, name)) {
value = get.parser[name](element);
}
if (... | javascript | function get(element) {
var name = element.nodeName.toLowerCase()
, value;
if (get.parser[element.type] && hasOwn.call(get.parser, element.type)) {
value = get.parser[element.type](element);
} else if (get.parser[name] && hasOwn.call(get.parser, name)) {
value = get.parser[name](element);
}
if (... | [
"function",
"get",
"(",
"element",
")",
"{",
"var",
"name",
"=",
"element",
".",
"nodeName",
".",
"toLowerCase",
"(",
")",
",",
"value",
";",
"if",
"(",
"get",
".",
"parser",
"[",
"element",
".",
"type",
"]",
"&&",
"hasOwn",
".",
"call",
"(",
"get"... | Get the value from a given element.
@param {Element} element The HTML element we need to extract the value from.
@returns {Mixed} The value of the element.
@api public | [
"Get",
"the",
"value",
"from",
"a",
"given",
"element",
"."
] | 4b35938c62b72810c4117cda5d57123cb8a9a318 | https://github.com/bigpipe/parsifal/blob/4b35938c62b72810c4117cda5d57123cb8a9a318/index.js#L110-L127 | train |
redisjs/jsr-server | lib/command/server/monitor.js | execute | function execute(req, res) {
req.conn.monitor(this);
res.send(null, Constants.OK);
} | javascript | function execute(req, res) {
req.conn.monitor(this);
res.send(null, Constants.OK);
} | [
"function",
"execute",
"(",
"req",
",",
"res",
")",
"{",
"req",
".",
"conn",
".",
"monitor",
"(",
"this",
")",
";",
"res",
".",
"send",
"(",
"null",
",",
"Constants",
".",
"OK",
")",
";",
"}"
] | Respond to the MONITOR command. | [
"Respond",
"to",
"the",
"MONITOR",
"command",
"."
] | 49413052d3039524fbdd2ade0ef9bae26cb4d647 | https://github.com/redisjs/jsr-server/blob/49413052d3039524fbdd2ade0ef9bae26cb4d647/lib/command/server/monitor.js#L17-L20 | train |
chanoch/simple-react-router | src/route/RouteConfiguration.js | routeMatcher | function routeMatcher(keys) {
return match => {
const parseParams = paramsParser(keys);
if(match) {
const params = parseParams(match);
return {
match,
keys,
params,
}
}
}
} | javascript | function routeMatcher(keys) {
return match => {
const parseParams = paramsParser(keys);
if(match) {
const params = parseParams(match);
return {
match,
keys,
params,
}
}
}
} | [
"function",
"routeMatcher",
"(",
"keys",
")",
"{",
"return",
"match",
"=>",
"{",
"const",
"parseParams",
"=",
"paramsParser",
"(",
"keys",
")",
";",
"if",
"(",
"match",
")",
"{",
"const",
"params",
"=",
"parseParams",
"(",
"match",
")",
";",
"return",
... | A route match instance which parses for URL params based on the specific location
passed into it.
@param {RegExpExecArray} pathMatch - an array of tokens based on the regexp execution
@param {*} keys - the list of parameter keys (:param) to extract from the URI | [
"A",
"route",
"match",
"instance",
"which",
"parses",
"for",
"URL",
"params",
"based",
"on",
"the",
"specific",
"location",
"passed",
"into",
"it",
"."
] | 3c71feeeb039111f33c934257732e2ea6ddde9ff | https://github.com/chanoch/simple-react-router/blob/3c71feeeb039111f33c934257732e2ea6ddde9ff/src/route/RouteConfiguration.js#L35-L47 | train |
cafjs/caf_iot | lib/plug_iot_queue.js | function(msg, code, errorStr, cb1) {
return function(error, data) {
if (error) {
error = json_rpc.newSysError(msg, code, errorStr,
error);
}
cb1(error, data);
... | javascript | function(msg, code, errorStr, cb1) {
return function(error, data) {
if (error) {
error = json_rpc.newSysError(msg, code, errorStr,
error);
}
cb1(error, data);
... | [
"function",
"(",
"msg",
",",
"code",
",",
"errorStr",
",",
"cb1",
")",
"{",
"return",
"function",
"(",
"error",
",",
"data",
")",
"{",
"if",
"(",
"error",
")",
"{",
"error",
"=",
"json_rpc",
".",
"newSysError",
"(",
"msg",
",",
"code",
",",
"errorS... | Wraps error into a SystemError | [
"Wraps",
"error",
"into",
"a",
"SystemError"
] | 12e4042c354d966be2736cb7e00d0fae64875788 | https://github.com/cafjs/caf_iot/blob/12e4042c354d966be2736cb7e00d0fae64875788/lib/plug_iot_queue.js#L50-L58 | train | |
vkiding/judpack-lib | src/plugman/platforms/android.js | function(project_dir) {
var mDoc = xml_helpers.parseElementtreeSync(path.join(project_dir, 'AndroidManifest.xml'));
return mDoc._root.attrib['package'];
} | javascript | function(project_dir) {
var mDoc = xml_helpers.parseElementtreeSync(path.join(project_dir, 'AndroidManifest.xml'));
return mDoc._root.attrib['package'];
} | [
"function",
"(",
"project_dir",
")",
"{",
"var",
"mDoc",
"=",
"xml_helpers",
".",
"parseElementtreeSync",
"(",
"path",
".",
"join",
"(",
"project_dir",
",",
"'AndroidManifest.xml'",
")",
")",
";",
"return",
"mDoc",
".",
"_root",
".",
"attrib",
"[",
"'package... | reads the package name out of the Android Manifest file @param string project_dir the absolute path to the directory containing the project @return string the name of the package | [
"reads",
"the",
"package",
"name",
"out",
"of",
"the",
"Android",
"Manifest",
"file"
] | 8657cecfec68221109279106adca8dbc81f430f4 | https://github.com/vkiding/judpack-lib/blob/8657cecfec68221109279106adca8dbc81f430f4/src/plugman/platforms/android.js#L61-L65 | train | |
origin1tech/chek | dist/modules/function.js | tryWrap | function tryWrap(fn) {
var args = [];
for (var _i = 1; _i < arguments.length; _i++) {
args[_i - 1] = arguments[_i];
}
return function (def) {
try {
return fn.apply(void 0, args);
}
catch (ex) {
if (is_1.isFunction(def))
return def(e... | javascript | function tryWrap(fn) {
var args = [];
for (var _i = 1; _i < arguments.length; _i++) {
args[_i - 1] = arguments[_i];
}
return function (def) {
try {
return fn.apply(void 0, args);
}
catch (ex) {
if (is_1.isFunction(def))
return def(e... | [
"function",
"tryWrap",
"(",
"fn",
")",
"{",
"var",
"args",
"=",
"[",
"]",
";",
"for",
"(",
"var",
"_i",
"=",
"1",
";",
"_i",
"<",
"arguments",
".",
"length",
";",
"_i",
"++",
")",
"{",
"args",
"[",
"_i",
"-",
"1",
"]",
"=",
"arguments",
"[",
... | Try Wrap
Generic helper for calling try catch on a method.
If a default method is provided it will return in on error
otherwise it will return null.
@example
function func(val: any) { return isString(val); }
const result = tryWrap(func)();
With params
tryWrap(JSON.stringify, { name: 'Adele', age: 30 }, null, 2)()
Wi... | [
"Try",
"Wrap",
"Generic",
"helper",
"for",
"calling",
"try",
"catch",
"on",
"a",
"method",
".",
"If",
"a",
"default",
"method",
"is",
"provided",
"it",
"will",
"return",
"in",
"on",
"error",
"otherwise",
"it",
"will",
"return",
"null",
"."
] | 6bc3ab0ac36126cc7918a244a606009749897b2e | https://github.com/origin1tech/chek/blob/6bc3ab0ac36126cc7918a244a606009749897b2e/dist/modules/function.js#L46-L61 | train |
origin1tech/chek | dist/modules/function.js | tryRequire | function tryRequire(name, def, isRoot) {
function _require() {
if (!is_1.isNode())
/* istanbul ignore next */
return to_1.toDefault(null, def);
if (isRoot)
return require.main.require(name);
return require(name);
}
return tryWrap(_require)(def);
} | javascript | function tryRequire(name, def, isRoot) {
function _require() {
if (!is_1.isNode())
/* istanbul ignore next */
return to_1.toDefault(null, def);
if (isRoot)
return require.main.require(name);
return require(name);
}
return tryWrap(_require)(def);
} | [
"function",
"tryRequire",
"(",
"name",
",",
"def",
",",
"isRoot",
")",
"{",
"function",
"_require",
"(",
")",
"{",
"if",
"(",
"!",
"is_1",
".",
"isNode",
"(",
")",
")",
"/* istanbul ignore next */",
"return",
"to_1",
".",
"toDefault",
"(",
"null",
",",
... | Try Require
Tries to require a module returns null
if cannot require or empty object.
@param name the name of module to try and require.
@param def optional default value on null.
@param isRoot used internally by tryRootRequire to require root modules. | [
"Try",
"Require",
"Tries",
"to",
"require",
"a",
"module",
"returns",
"null",
"if",
"cannot",
"require",
"or",
"empty",
"object",
"."
] | 6bc3ab0ac36126cc7918a244a606009749897b2e | https://github.com/origin1tech/chek/blob/6bc3ab0ac36126cc7918a244a606009749897b2e/dist/modules/function.js#L72-L82 | train |
gethuman/pancakes-angular | lib/ngapp/state.loader.js | getPascalCase | function getPascalCase(val) {
var parts = val.split('.');
var newVal = '';
for (var i = 0; i < parts.length; i++) {
newVal += parts[i].substring(0, 1).toUpperCase() + parts[i].substring(1);
}
return newVal;
} | javascript | function getPascalCase(val) {
var parts = val.split('.');
var newVal = '';
for (var i = 0; i < parts.length; i++) {
newVal += parts[i].substring(0, 1).toUpperCase() + parts[i].substring(1);
}
return newVal;
} | [
"function",
"getPascalCase",
"(",
"val",
")",
"{",
"var",
"parts",
"=",
"val",
".",
"split",
"(",
"'.'",
")",
";",
"var",
"newVal",
"=",
"''",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"parts",
".",
"length",
";",
"i",
"++",
")",
... | Helper function to get pascal case of a route name
@param val
@returns {string} | [
"Helper",
"function",
"to",
"get",
"pascal",
"case",
"of",
"a",
"route",
"name"
] | 9589b7ba09619843e271293088005c62ed23f355 | https://github.com/gethuman/pancakes-angular/blob/9589b7ba09619843e271293088005c62ed23f355/lib/ngapp/state.loader.js#L17-L26 | train |
palantus/mscp-browserlibs | www/js/jquery.longpress.js | mouseup_callback | function mouseup_callback(e) {
var press_time = new Date().getTime() - mouse_down_time;
if (press_time < duration) {
// cancel the timeout
clearTimeout(timeout);
// call the shortCallback if provided
if (typ... | javascript | function mouseup_callback(e) {
var press_time = new Date().getTime() - mouse_down_time;
if (press_time < duration) {
// cancel the timeout
clearTimeout(timeout);
// call the shortCallback if provided
if (typ... | [
"function",
"mouseup_callback",
"(",
"e",
")",
"{",
"var",
"press_time",
"=",
"new",
"Date",
"(",
")",
".",
"getTime",
"(",
")",
"-",
"mouse_down_time",
";",
"if",
"(",
"press_time",
"<",
"duration",
")",
"{",
"// cancel the timeout",
"clearTimeout",
"(",
... | mouseup or touchend callback | [
"mouseup",
"or",
"touchend",
"callback"
] | d8344639697e137af767d04b5111120890579556 | https://github.com/palantus/mscp-browserlibs/blob/d8344639697e137af767d04b5111120890579556/www/js/jquery.longpress.js#L46-L61 | train |
MakerCollider/node-red-contrib-smartnode-hook | html/scripts/highchart/modules/treemap.src.js | function () {
var series = this,
points = series.points,
options,
level,
dataLabelsGroup = this.dataLabelsGroup,
dataLabels;
each(points, function (point) {
if (point.node.isVisible) {
level = series.levelMap[point.level];
if (!point.isLeaf || level) {
options = undefined;
... | javascript | function () {
var series = this,
points = series.points,
options,
level,
dataLabelsGroup = this.dataLabelsGroup,
dataLabels;
each(points, function (point) {
if (point.node.isVisible) {
level = series.levelMap[point.level];
if (!point.isLeaf || level) {
options = undefined;
... | [
"function",
"(",
")",
"{",
"var",
"series",
"=",
"this",
",",
"points",
"=",
"series",
".",
"points",
",",
"options",
",",
"level",
",",
"dataLabelsGroup",
"=",
"this",
".",
"dataLabelsGroup",
",",
"dataLabels",
";",
"each",
"(",
"points",
",",
"function... | Extend drawDataLabels with logic to handle the levels option | [
"Extend",
"drawDataLabels",
"with",
"logic",
"to",
"handle",
"the",
"levels",
"option"
] | 245c267e832968bad880ca009929043e82c7bc25 | https://github.com/MakerCollider/node-red-contrib-smartnode-hook/blob/245c267e832968bad880ca009929043e82c7bc25/html/scripts/highchart/modules/treemap.src.js#L567-L600 | train | |
MakerCollider/node-red-contrib-smartnode-hook | html/scripts/highchart/modules/treemap.src.js | function () {
var series = this,
points = series.points,
seriesOptions = series.options,
attr,
hover,
level;
each(points, function (point) {
if (point.node.isVisible) {
level = series.levelMap[point.level];
attr = {
stroke: seriesOptions.borderColor,
'stroke-width': s... | javascript | function () {
var series = this,
points = series.points,
seriesOptions = series.options,
attr,
hover,
level;
each(points, function (point) {
if (point.node.isVisible) {
level = series.levelMap[point.level];
attr = {
stroke: seriesOptions.borderColor,
'stroke-width': s... | [
"function",
"(",
")",
"{",
"var",
"series",
"=",
"this",
",",
"points",
"=",
"series",
".",
"points",
",",
"seriesOptions",
"=",
"series",
".",
"options",
",",
"attr",
",",
"hover",
",",
"level",
";",
"each",
"(",
"points",
",",
"function",
"(",
"poi... | Extending ColumnSeries drawPoints | [
"Extending",
"ColumnSeries",
"drawPoints"
] | 245c267e832968bad880ca009929043e82c7bc25 | https://github.com/MakerCollider/node-red-contrib-smartnode-hook/blob/245c267e832968bad880ca009929043e82c7bc25/html/scripts/highchart/modules/treemap.src.js#L605-L674 | train | |
MakerCollider/node-red-contrib-smartnode-hook | html/scripts/highchart/modules/treemap.src.js | function () {
var series = this,
points = series.points;
each(points, function (point) {
var drillId,
drillName;
if (point.node.isVisible) {
H.removeEvent(point, 'click');
if (point.graphic) {
point.graphic.css({ cursor: 'default' });
}
// Get the drill to id
if (s... | javascript | function () {
var series = this,
points = series.points;
each(points, function (point) {
var drillId,
drillName;
if (point.node.isVisible) {
H.removeEvent(point, 'click');
if (point.graphic) {
point.graphic.css({ cursor: 'default' });
}
// Get the drill to id
if (s... | [
"function",
"(",
")",
"{",
"var",
"series",
"=",
"this",
",",
"points",
"=",
"series",
".",
"points",
";",
"each",
"(",
"points",
",",
"function",
"(",
"point",
")",
"{",
"var",
"drillId",
",",
"drillName",
";",
"if",
"(",
"point",
".",
"node",
"."... | Add drilling on the suitable points | [
"Add",
"drilling",
"on",
"the",
"suitable",
"points"
] | 245c267e832968bad880ca009929043e82c7bc25 | https://github.com/MakerCollider/node-red-contrib-smartnode-hook/blob/245c267e832968bad880ca009929043e82c7bc25/html/scripts/highchart/modules/treemap.src.js#L678-L711 | train | |
MakerCollider/node-red-contrib-smartnode-hook | html/scripts/highchart/modules/treemap.src.js | function (point) {
var series = this,
drillId = false;
if ((point.node.level - series.nodeMap[series.rootNode].level) === 1 && !point.isLeaf) {
drillId = point.id;
}
return drillId;
} | javascript | function (point) {
var series = this,
drillId = false;
if ((point.node.level - series.nodeMap[series.rootNode].level) === 1 && !point.isLeaf) {
drillId = point.id;
}
return drillId;
} | [
"function",
"(",
"point",
")",
"{",
"var",
"series",
"=",
"this",
",",
"drillId",
"=",
"false",
";",
"if",
"(",
"(",
"point",
".",
"node",
".",
"level",
"-",
"series",
".",
"nodeMap",
"[",
"series",
".",
"rootNode",
"]",
".",
"level",
")",
"===",
... | Finds the drill id for a parent node.
Returns false if point should not have a click event
@param {Object} point
@return {string || boolean} Drill to id or false when point should not have a click event | [
"Finds",
"the",
"drill",
"id",
"for",
"a",
"parent",
"node",
".",
"Returns",
"false",
"if",
"point",
"should",
"not",
"have",
"a",
"click",
"event"
] | 245c267e832968bad880ca009929043e82c7bc25 | https://github.com/MakerCollider/node-red-contrib-smartnode-hook/blob/245c267e832968bad880ca009929043e82c7bc25/html/scripts/highchart/modules/treemap.src.js#L718-L725 | train | |
MakerCollider/node-red-contrib-smartnode-hook | html/scripts/highchart/modules/treemap.src.js | function (point) {
var series = this,
drillId = false,
nodeParent;
if ((point.node.parent !== series.rootNode) && (point.isLeaf)) {
nodeParent = point.node;
while (!drillId) {
nodeParent = series.nodeMap[nodeParent.parent];
if (nodeParent.parent === series.rootNode) {
drillId = nod... | javascript | function (point) {
var series = this,
drillId = false,
nodeParent;
if ((point.node.parent !== series.rootNode) && (point.isLeaf)) {
nodeParent = point.node;
while (!drillId) {
nodeParent = series.nodeMap[nodeParent.parent];
if (nodeParent.parent === series.rootNode) {
drillId = nod... | [
"function",
"(",
"point",
")",
"{",
"var",
"series",
"=",
"this",
",",
"drillId",
"=",
"false",
",",
"nodeParent",
";",
"if",
"(",
"(",
"point",
".",
"node",
".",
"parent",
"!==",
"series",
".",
"rootNode",
")",
"&&",
"(",
"point",
".",
"isLeaf",
"... | Finds the drill id for a leaf node.
Returns false if point should not have a click event
@param {Object} point
@return {string || boolean} Drill to id or false when point should not have a click event | [
"Finds",
"the",
"drill",
"id",
"for",
"a",
"leaf",
"node",
".",
"Returns",
"false",
"if",
"point",
"should",
"not",
"have",
"a",
"click",
"event"
] | 245c267e832968bad880ca009929043e82c7bc25 | https://github.com/MakerCollider/node-red-contrib-smartnode-hook/blob/245c267e832968bad880ca009929043e82c7bc25/html/scripts/highchart/modules/treemap.src.js#L732-L746 | train | |
wunderbyte/grunt-spiritual-edbml | tasks/things/formatter.js | simplified | function simplified(js) {
var is = false;
var go = false;
var here = 'out.html += '; // hardcoced
var gone = ' '; // hardcoded to equal length
var fixes = [];
var lines = js.split('\n').map(function(line, index) {
go = line.trim().startsWith(here);
if (is && go) {
line = line.replace(here, gone)... | javascript | function simplified(js) {
var is = false;
var go = false;
var here = 'out.html += '; // hardcoced
var gone = ' '; // hardcoded to equal length
var fixes = [];
var lines = js.split('\n').map(function(line, index) {
go = line.trim().startsWith(here);
if (is && go) {
line = line.replace(here, gone)... | [
"function",
"simplified",
"(",
"js",
")",
"{",
"var",
"is",
"=",
"false",
";",
"var",
"go",
"=",
"false",
";",
"var",
"here",
"=",
"'out.html += '",
";",
"// hardcoced",
"var",
"gone",
"=",
"' '",
";",
"// hardcoded to equal length",
"var",
"fixes... | Substiture repeated lines of `out.html +=` with simple
`+` concatenation. Watch out for hardcoded strings here.
@param {string} js
@returns {string} | [
"Substiture",
"repeated",
"lines",
"of",
"out",
".",
"html",
"+",
"=",
"with",
"simple",
"+",
"concatenation",
".",
"Watch",
"out",
"for",
"hardcoded",
"strings",
"here",
"."
] | 2ba0aa8042eceee917f1ee48c7881345df3bce46 | https://github.com/wunderbyte/grunt-spiritual-edbml/blob/2ba0aa8042eceee917f1ee48c7881345df3bce46/tasks/things/formatter.js#L76-L98 | train |
ashleydavis/routey | route_init.js | function (params) {
//
// Close the route once it has been handled.
//
var closeRoute = function () {
that._closeRoute(dir, req, res, params);
};
var async = new Async(closeRoute);
routeConfig.handler(req, res, params, async);
if (!async.started()) {
// No async operation was started.... | javascript | function (params) {
//
// Close the route once it has been handled.
//
var closeRoute = function () {
that._closeRoute(dir, req, res, params);
};
var async = new Async(closeRoute);
routeConfig.handler(req, res, params, async);
if (!async.started()) {
// No async operation was started.... | [
"function",
"(",
"params",
")",
"{",
"// ",
"// Close the route once it has been handled.",
"//",
"var",
"closeRoute",
"=",
"function",
"(",
")",
"{",
"that",
".",
"_closeRoute",
"(",
"dir",
",",
"req",
",",
"res",
",",
"params",
")",
";",
"}",
";",
"var",... | When the route has been opened, invoke the route handler. | [
"When",
"the",
"route",
"has",
"been",
"opened",
"invoke",
"the",
"route",
"handler",
"."
] | dd5e797603f6f0b584d6712165e9b73c7d8efc78 | https://github.com/ashleydavis/routey/blob/dd5e797603f6f0b584d6712165e9b73c7d8efc78/route_init.js#L158-L174 | train | |
semantic-math/math-traverse | lib/replace.js | replace | function replace(node, {enter, leave}) {
let rep = (enter && enter(node)) || node
switch (rep.type) {
// regular non-leaf nodes
case 'Apply':
for (let i = 0; i < rep.args.length; i++) {
const arg = rep.args[i]
rep.args[i] = replace(arg, {enter, leave}... | javascript | function replace(node, {enter, leave}) {
let rep = (enter && enter(node)) || node
switch (rep.type) {
// regular non-leaf nodes
case 'Apply':
for (let i = 0; i < rep.args.length; i++) {
const arg = rep.args[i]
rep.args[i] = replace(arg, {enter, leave}... | [
"function",
"replace",
"(",
"node",
",",
"{",
"enter",
",",
"leave",
"}",
")",
"{",
"let",
"rep",
"=",
"(",
"enter",
"&&",
"enter",
"(",
"node",
")",
")",
"||",
"node",
"switch",
"(",
"rep",
".",
"type",
")",
"{",
"// regular non-leaf nodes",
"case",... | replace - visit all nodes in the tree with the ability to replace them.
This function may modify the node passed in and/or any of its descendants.
If neither 'enter' nor 'leave' return a value, the node is unchanged.
If 'enter' returns a new node, the children of the new node will be traversed
instead of the old one.... | [
"replace",
"-",
"visit",
"all",
"nodes",
"in",
"the",
"tree",
"with",
"the",
"ability",
"to",
"replace",
"them",
"."
] | 251430b4a984200fb1b3fd373fde2da50a78830c | https://github.com/semantic-math/math-traverse/blob/251430b4a984200fb1b3fd373fde2da50a78830c/lib/replace.js#L12-L61 | train |
ottojs/otto-errors | lib/bad_request.error.js | ErrorBadRequest | function ErrorBadRequest (message) {
Error.call(this);
// Add Information
this.name = 'ErrorBadRequest';
this.type = 'client';
this.status = 400;
if (message) {
this.message = message;
}
} | javascript | function ErrorBadRequest (message) {
Error.call(this);
// Add Information
this.name = 'ErrorBadRequest';
this.type = 'client';
this.status = 400;
if (message) {
this.message = message;
}
} | [
"function",
"ErrorBadRequest",
"(",
"message",
")",
"{",
"Error",
".",
"call",
"(",
"this",
")",
";",
"// Add Information",
"this",
".",
"name",
"=",
"'ErrorBadRequest'",
";",
"this",
".",
"type",
"=",
"'client'",
";",
"this",
".",
"status",
"=",
"400",
... | Error - ErrorBadRequest | [
"Error",
"-",
"ErrorBadRequest"
] | a3c6d98fd5d35ce3c136ed7e1edd2f800af268d9 | https://github.com/ottojs/otto-errors/blob/a3c6d98fd5d35ce3c136ed7e1edd2f800af268d9/lib/bad_request.error.js#L8-L20 | train |
Objectway/bower-rhodecode-resolver | index.js | function (source) {
packageUrl = source;
if (source && source.indexOf(bower.config.rhodecode.repo) != -1) {
return true;
}
return Q.nfcall(registryClient.lookup.bind(registryClient), source)
.then(function (entry) {
i... | javascript | function (source) {
packageUrl = source;
if (source && source.indexOf(bower.config.rhodecode.repo) != -1) {
return true;
}
return Q.nfcall(registryClient.lookup.bind(registryClient), source)
.then(function (entry) {
i... | [
"function",
"(",
"source",
")",
"{",
"packageUrl",
"=",
"source",
";",
"if",
"(",
"source",
"&&",
"source",
".",
"indexOf",
"(",
"bower",
".",
"config",
".",
"rhodecode",
".",
"repo",
")",
"!=",
"-",
"1",
")",
"{",
"return",
"true",
";",
"}",
"retu... | Match method tells whether resolver supports given source It can return either boolean or promise of boolean | [
"Match",
"method",
"tells",
"whether",
"resolver",
"supports",
"given",
"source",
"It",
"can",
"return",
"either",
"boolean",
"or",
"promise",
"of",
"boolean"
] | b5e563c7aecc2b45bf904785a714a110769109cb | https://github.com/Objectway/bower-rhodecode-resolver/blob/b5e563c7aecc2b45bf904785a714a110769109cb/index.js#L32-L50 | train | |
Objectway/bower-rhodecode-resolver | index.js | function (endpoint) {
var deferred = Q.defer(),
tmpDir = tmp.dirSync().name,
target = endpoint.target == '*' ? 'tip' : endpoint.target,
url = endpoint.source + '/archive/' + target + '.zip?auth_token=' + bower.config.rhodecode.token,
filePath =... | javascript | function (endpoint) {
var deferred = Q.defer(),
tmpDir = tmp.dirSync().name,
target = endpoint.target == '*' ? 'tip' : endpoint.target,
url = endpoint.source + '/archive/' + target + '.zip?auth_token=' + bower.config.rhodecode.token,
filePath =... | [
"function",
"(",
"endpoint",
")",
"{",
"var",
"deferred",
"=",
"Q",
".",
"defer",
"(",
")",
",",
"tmpDir",
"=",
"tmp",
".",
"dirSync",
"(",
")",
".",
"name",
",",
"target",
"=",
"endpoint",
".",
"target",
"==",
"'*'",
"?",
"'tip'",
":",
"endpoint",... | It downloads package and extracts it to temporary directory You can use npm's "tmp" package to tmp directories See the "Resolver API" section for details on this method | [
"It",
"downloads",
"package",
"and",
"extracts",
"it",
"to",
"temporary",
"directory",
"You",
"can",
"use",
"npm",
"s",
"tmp",
"package",
"to",
"tmp",
"directories",
"See",
"the",
"Resolver",
"API",
"section",
"for",
"details",
"on",
"this",
"method"
] | b5e563c7aecc2b45bf904785a714a110769109cb | https://github.com/Objectway/bower-rhodecode-resolver/blob/b5e563c7aecc2b45bf904785a714a110769109cb/index.js#L96-L150 | train | |
polo2ro/restitute | src/service.js | listItemsService | function listItemsService(app) {
apiService.call(this);
this.setApp(app);
var service = this;
/**
* Default function used to resolve a result set
*
* @param {Error} err mongoose error
* @param {Array} docs an array of mongoose documents or an array of objects
*/
this.... | javascript | function listItemsService(app) {
apiService.call(this);
this.setApp(app);
var service = this;
/**
* Default function used to resolve a result set
*
* @param {Error} err mongoose error
* @param {Array} docs an array of mongoose documents or an array of objects
*/
this.... | [
"function",
"listItemsService",
"(",
"app",
")",
"{",
"apiService",
".",
"call",
"(",
"this",
")",
";",
"this",
".",
"setApp",
"(",
"app",
")",
";",
"var",
"service",
"=",
"this",
";",
"/**\n * Default function used to resolve a result set\n *\n * @param... | Service to get a list of items
output a resultset | [
"Service",
"to",
"get",
"a",
"list",
"of",
"items",
"output",
"a",
"resultset"
] | 532f10b01469f76b8a60f5be624ebf562ebfcf55 | https://github.com/polo2ro/restitute/blob/532f10b01469f76b8a60f5be624ebf562ebfcf55/src/service.js#L333-L400 | train |
derdesign/protos | middleware/logger/transport-redis.js | initRedis | function initRedis(config, callback) {
var self = this;
protos.util.checkLocalPort(config.port, function(err) {
if (err) {
app.log("RedisTransport [%s:%s] %s", config.host, config.port, err.code);
} else {
// Set redis client
self.client = redis.createClient(config.port, config.host, s... | javascript | function initRedis(config, callback) {
var self = this;
protos.util.checkLocalPort(config.port, function(err) {
if (err) {
app.log("RedisTransport [%s:%s] %s", config.host, config.port, err.code);
} else {
// Set redis client
self.client = redis.createClient(config.port, config.host, s... | [
"function",
"initRedis",
"(",
"config",
",",
"callback",
")",
"{",
"var",
"self",
"=",
"this",
";",
"protos",
".",
"util",
".",
"checkLocalPort",
"(",
"config",
".",
"port",
",",
"function",
"(",
"err",
")",
"{",
"if",
"(",
"err",
")",
"{",
"app",
... | Initializes the redis client
@param {object} config
@param {function} callback
@private | [
"Initializes",
"the",
"redis",
"client"
] | 0b679b2a7581dfbb5d065fd4b0914436ef4ef2c9 | https://github.com/derdesign/protos/blob/0b679b2a7581dfbb5d065fd4b0914436ef4ef2c9/middleware/logger/transport-redis.js#L124-L167 | train |
tjmehta/mongooseware | lib/method-lists/list-instance-methods.js | listInstanceMethods | function listInstanceMethods (Model) {
var classMethods = Object.keys(Model.schema.methods);
for (var method in ModelPrototype) {
if (!isPrivateMethod(method) && isFunction(ModelPrototype[method])) {
classMethods.push(method);
}
}
return classMethods;
} | javascript | function listInstanceMethods (Model) {
var classMethods = Object.keys(Model.schema.methods);
for (var method in ModelPrototype) {
if (!isPrivateMethod(method) && isFunction(ModelPrototype[method])) {
classMethods.push(method);
}
}
return classMethods;
} | [
"function",
"listInstanceMethods",
"(",
"Model",
")",
"{",
"var",
"classMethods",
"=",
"Object",
".",
"keys",
"(",
"Model",
".",
"schema",
".",
"methods",
")",
";",
"for",
"(",
"var",
"method",
"in",
"ModelPrototype",
")",
"{",
"if",
"(",
"!",
"isPrivate... | Return list of all instance methods when supplied a Model constructor
@param {Object} Model
@return {Array} | [
"Return",
"list",
"of",
"all",
"instance",
"methods",
"when",
"supplied",
"a",
"Model",
"constructor"
] | c62ce0bac82880826b3528231e08f5e5b3efdb83 | https://github.com/tjmehta/mongooseware/blob/c62ce0bac82880826b3528231e08f5e5b3efdb83/lib/method-lists/list-instance-methods.js#L19-L27 | train |
BlueSilverCat/bsc-utilities | lib/utility.js | circulationSearch | function circulationSearch(array, current, direction, func) {
let start = 0;
let end = array.length - 1;
if (direction === -1) {
start = array.length - 1;
end = 0;
}
for (let i = current; i * direction <= end * direction; i += direction) {
if (func(array[i])) {
return i;
}
}
for (le... | javascript | function circulationSearch(array, current, direction, func) {
let start = 0;
let end = array.length - 1;
if (direction === -1) {
start = array.length - 1;
end = 0;
}
for (let i = current; i * direction <= end * direction; i += direction) {
if (func(array[i])) {
return i;
}
}
for (le... | [
"function",
"circulationSearch",
"(",
"array",
",",
"current",
",",
"direction",
",",
"func",
")",
"{",
"let",
"start",
"=",
"0",
";",
"let",
"end",
"=",
"array",
".",
"length",
"-",
"1",
";",
"if",
"(",
"direction",
"===",
"-",
"1",
")",
"{",
"sta... | direction 1, -1 need test | [
"direction",
"1",
"-",
"1",
"need",
"test"
] | 51315321b9a260987689c50cf8acfb53eb758c7a | https://github.com/BlueSilverCat/bsc-utilities/blob/51315321b9a260987689c50cf8acfb53eb758c7a/lib/utility.js#L377-L397 | train |
redisjs/jsr-server | lib/command/database/zset/zincrby.js | execute | function execute(req, res) {
// store returns a number but we need to send
// a bulk string reply
var reply = req.exec.proxy(req, res);
res.send(null, '' + reply);
} | javascript | function execute(req, res) {
// store returns a number but we need to send
// a bulk string reply
var reply = req.exec.proxy(req, res);
res.send(null, '' + reply);
} | [
"function",
"execute",
"(",
"req",
",",
"res",
")",
"{",
"// store returns a number but we need to send",
"// a bulk string reply",
"var",
"reply",
"=",
"req",
".",
"exec",
".",
"proxy",
"(",
"req",
",",
"res",
")",
";",
"res",
".",
"send",
"(",
"null",
",",... | Respond to the ZINCRBY command. | [
"Respond",
"to",
"the",
"ZINCRBY",
"command",
"."
] | 49413052d3039524fbdd2ade0ef9bae26cb4d647 | https://github.com/redisjs/jsr-server/blob/49413052d3039524fbdd2ade0ef9bae26cb4d647/lib/command/database/zset/zincrby.js#L17-L22 | train |
bucharest-gold/unifiedpush-admin-client | lib/applications.js | find | function find (client) {
return function find (pushAppId) {
const req = {
url: pushAppId ? `${client.baseUrl}/rest/applications/${pushAppId}` : `${client.baseUrl}/rest/applications/`
};
return request(client, req)
.then((response) => {
if (response.resp.statusCode !== 200) {
... | javascript | function find (client) {
return function find (pushAppId) {
const req = {
url: pushAppId ? `${client.baseUrl}/rest/applications/${pushAppId}` : `${client.baseUrl}/rest/applications/`
};
return request(client, req)
.then((response) => {
if (response.resp.statusCode !== 200) {
... | [
"function",
"find",
"(",
"client",
")",
"{",
"return",
"function",
"find",
"(",
"pushAppId",
")",
"{",
"const",
"req",
"=",
"{",
"url",
":",
"pushAppId",
"?",
"`",
"${",
"client",
".",
"baseUrl",
"}",
"${",
"pushAppId",
"}",
"`",
":",
"`",
"${",
"c... | A function to get all the push applications or just 1 push application
@param {string} [pushAppId] - The id of the push application
@returns {Promise} A promise that will resolve with the Array of application objects or if a pushAppId is specified, just the application object
@example
adminClient(baseUrl, settings)
.th... | [
"A",
"function",
"to",
"get",
"all",
"the",
"push",
"applications",
"or",
"just",
"1",
"push",
"application"
] | a39c98c9a383d7f87cb5cbbc25c4371ea1ad049e | https://github.com/bucharest-gold/unifiedpush-admin-client/blob/a39c98c9a383d7f87cb5cbbc25c4371ea1ad049e/lib/applications.js#L32-L47 | train |
bucharest-gold/unifiedpush-admin-client | lib/applications.js | update | function update (client) {
return function update (pushApp) {
const req = {
url: `${client.baseUrl}/rest/applications/${pushApp.pushApplicationID}`,
body: pushApp,
method: 'PUT'
};
return request(client, req)
.then((response) => {
if (response.resp.statusCode !== 204) {
... | javascript | function update (client) {
return function update (pushApp) {
const req = {
url: `${client.baseUrl}/rest/applications/${pushApp.pushApplicationID}`,
body: pushApp,
method: 'PUT'
};
return request(client, req)
.then((response) => {
if (response.resp.statusCode !== 204) {
... | [
"function",
"update",
"(",
"client",
")",
"{",
"return",
"function",
"update",
"(",
"pushApp",
")",
"{",
"const",
"req",
"=",
"{",
"url",
":",
"`",
"${",
"client",
".",
"baseUrl",
"}",
"${",
"pushApp",
".",
"pushApplicationID",
"}",
"`",
",",
"body",
... | A function to update an existing Push Application
@param {object} pushApp - The JSON representation of the push application to update. pushApp.pushApplicationID and pushApp.name is required. ATM, it looks like the only fields that are updatable are name and description
@returns {Promise} A promise that resolves with N... | [
"A",
"function",
"to",
"update",
"an",
"existing",
"Push",
"Application"
] | a39c98c9a383d7f87cb5cbbc25c4371ea1ad049e | https://github.com/bucharest-gold/unifiedpush-admin-client/blob/a39c98c9a383d7f87cb5cbbc25c4371ea1ad049e/lib/applications.js#L94-L111 | train |
bucharest-gold/unifiedpush-admin-client | lib/applications.js | bootstrap | function bootstrap (client) {
return function bootstrap (pushApp) {
const req = {
url: `${client.baseUrl}/rest/applications/bootstrap`,
method: 'POST'
};
const data = pushApp;
// If they send in a string, then lets assume that is the location of the cert file
// Otherwise, we will as... | javascript | function bootstrap (client) {
return function bootstrap (pushApp) {
const req = {
url: `${client.baseUrl}/rest/applications/bootstrap`,
method: 'POST'
};
const data = pushApp;
// If they send in a string, then lets assume that is the location of the cert file
// Otherwise, we will as... | [
"function",
"bootstrap",
"(",
"client",
")",
"{",
"return",
"function",
"bootstrap",
"(",
"pushApp",
")",
"{",
"const",
"req",
"=",
"{",
"url",
":",
"`",
"${",
"client",
".",
"baseUrl",
"}",
"`",
",",
"method",
":",
"'POST'",
"}",
";",
"const",
"data... | A Convenience function to create a complete Push Application with a set of variants
@param {object} pushApp - The push application object
@param {string} pushApp.pushApplicationName - The name of the Push Application
@param {string} [pushApp.androidVariantName] - Android Variant Name
@param {string} [pushApp.androidGoo... | [
"A",
"Convenience",
"function",
"to",
"create",
"a",
"complete",
"Push",
"Application",
"with",
"a",
"set",
"of",
"variants"
] | a39c98c9a383d7f87cb5cbbc25c4371ea1ad049e | https://github.com/bucharest-gold/unifiedpush-admin-client/blob/a39c98c9a383d7f87cb5cbbc25c4371ea1ad049e/lib/applications.js#L204-L234 | train |
API-Load-Testing/http-request-hook | http-request-hook.js | function () {
var res = arguments[0];
userOptions.emit('response', req, res);
if (callback && userOptions.resCallback) callback.apply(this, arguments);
res.on('end', function() {
userOptions.emit('afterResponse', req, res);
});
} | javascript | function () {
var res = arguments[0];
userOptions.emit('response', req, res);
if (callback && userOptions.resCallback) callback.apply(this, arguments);
res.on('end', function() {
userOptions.emit('afterResponse', req, res);
});
} | [
"function",
"(",
")",
"{",
"var",
"res",
"=",
"arguments",
"[",
"0",
"]",
";",
"userOptions",
".",
"emit",
"(",
"'response'",
",",
"req",
",",
"res",
")",
";",
"if",
"(",
"callback",
"&&",
"userOptions",
".",
"resCallback",
")",
"callback",
".",
"app... | Create the callback function for response | [
"Create",
"the",
"callback",
"function",
"for",
"response"
] | 660c115f298613fc1556d6a40ac78f1c2c322fa4 | https://github.com/API-Load-Testing/http-request-hook/blob/660c115f298613fc1556d6a40ac78f1c2c322fa4/http-request-hook.js#L124-L136 | train | |
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... | 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... | [
"function",
"get_cookies",
"(",
"url",
")",
"{",
"debug",
".",
"assert",
"(",
"url",
")",
".",
"is",
"(",
"'object'",
")",
";",
"debug",
".",
"assert",
"(",
"url",
".",
"host",
")",
".",
"is",
"(",
"'string'",
")",
";",
"if",
"(",
"!",
"is",
".... | 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 | train |
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;... | 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;... | [
"function",
"set_cookies",
"(",
"url",
",",
"cookies",
")",
"{",
"if",
"(",
"is",
".",
"string",
"(",
"cookies",
")",
")",
"{",
"cookies",
"=",
"[",
"cookies",
"]",
";",
"}",
"debug",
".",
"assert",
"(",
"url",
")",
".",
"is",
"(",
"'object'",
")... | 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 | train |
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(l... | 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(l... | [
"function",
"grunt",
"(",
"gruntInst",
",",
"verbose",
",",
"patch",
")",
"{",
"var",
"mw",
"=",
"(",
"patch",
"||",
"core",
".",
"base",
"(",
")",
")",
";",
"mw",
".",
"enabled",
"=",
"true",
";",
"if",
"(",
"verbose",
")",
"{",
"mw",
".",
"wr... | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - grunt lazy | [
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"... | 0b716dfdd203e20bdf71b552d1776ade8a55ced5 | https://github.com/Bartvds/miniwrite/blob/0b716dfdd203e20bdf71b552d1776ade8a55ced5/lib/log.js#L75-L98 | train |
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(... | 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(... | [
"function",
"stoogeStored",
"(",
"model",
",",
"error",
")",
"{",
"if",
"(",
"typeof",
"error",
"!=",
"'undefined'",
")",
"{",
"callback",
"(",
"error",
")",
";",
"return",
";",
"}",
"try",
"{",
"self",
".",
"stoogeIDsStored",
".",
"push",
"(",
"model"... | 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 | train |
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();
... | 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();
... | [
"function",
"createLines",
"(",
")",
"{",
"var",
"moesLine",
"=",
"new",
"self",
".",
"StoogeLine",
"(",
")",
";",
"moesLine",
".",
"set",
"(",
"'Scene'",
",",
"1",
")",
";",
"moesLine",
".",
"set",
"(",
"'SetID'",
",",
"self",
".",
"indoorSet",
".",... | 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 | train |
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;
}
... | 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;
}
... | [
"function",
"toggle",
"(",
"main",
",",
"alt",
")",
"{",
"var",
"mw",
"=",
"core",
".",
"base",
"(",
")",
";",
"mw",
".",
"main",
"=",
"main",
";",
"mw",
".",
"alt",
"=",
"(",
"alt",
"||",
"function",
"(",
")",
"{",
"}",
")",
";",
"mw",
"."... | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - control output | [
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"... | 0b716dfdd203e20bdf71b552d1776ade8a55ced5 | https://github.com/Bartvds/miniwrite/blob/0b716dfdd203e20bdf71b552d1776ade8a55ced5/lib/core.js#L203-L226 | train |
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);
}... | 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);
}... | [
"function",
"multi",
"(",
"list",
"/*, ... */",
")",
"{",
"var",
"mw",
"=",
"core",
".",
"base",
"(",
")",
";",
"mw",
".",
"targets",
"=",
"(",
"isArray",
"(",
"list",
")",
"?",
"list",
":",
"Array",
".",
"prototype",
".",
"slice",
".",
"call",
"... | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - call multiple other writers | [
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"... | 0b716dfdd203e20bdf71b552d1776ade8a55ced5 | https://github.com/Bartvds/miniwrite/blob/0b716dfdd203e20bdf71b552d1776ade8a55ced5/lib/core.js#L231-L246 | train |
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') {
... | 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') {
... | [
"function",
"peek",
"(",
"target",
",",
"callback",
")",
"{",
"var",
"mw",
"=",
"core",
".",
"base",
"(",
")",
";",
"mw",
".",
"enabled",
"=",
"true",
";",
"mw",
".",
"target",
"=",
"target",
";",
"mw",
".",
"callback",
"=",
"(",
"callback",
"||"... | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - use callback to transform | [
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"... | 0b716dfdd203e20bdf71b552d1776ade8a55ced5 | https://github.com/Bartvds/miniwrite/blob/0b716dfdd203e20bdf71b552d1776ade8a55ced5/lib/core.js#L251-L270 | train |
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);
... | 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);
... | [
"function",
"need",
"(",
"args",
")",
"{",
"var",
"argsArray",
",",
"restArgs",
";",
"if",
"(",
"!",
"args",
")",
"{",
"return",
"args",
";",
"}",
"argsArray",
"=",
"Array",
".",
"prototype",
".",
"slice",
".",
"call",
"(",
"args",
")",
";",
"restA... | 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 | train |
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",... | 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 | train | |
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 fil... | 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 fil... | [
"function",
"(",
"config",
")",
"{",
"var",
"filePath",
"=",
"null",
";",
"if",
"(",
"config",
".",
"levelControllerConfig",
"&&",
"config",
".",
"levelControllerConfig",
".",
"fileName",
")",
"{",
"filePath",
"=",
"path",
".",
"join",
"(",
"_getLevelDir",
... | 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 | train | |
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 (... | 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 (... | [
"function",
"assertType",
"(",
"value",
",",
"type",
",",
"allowUndefined",
",",
"message",
")",
"{",
"if",
"(",
"!",
"assert",
"(",
"type",
"!==",
"undefined",
",",
"'Paremeter \\'type\\' must be a string or a class'",
")",
")",
"return",
";",
"if",
"(",
"!",... | 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 param... | [
"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 | train |
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];
... | 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];
... | [
"function",
"listToObject",
"(",
"list",
",",
"key",
")",
"{",
"var",
"length",
",",
"result",
",",
"i",
",",
"obj",
",",
"keyValue",
";",
"if",
"(",
"!",
"list",
")",
"{",
"list",
"=",
"[",
"]",
";",
"}",
"length",
"=",
"list",
".",
"length",
... | 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 | train |
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... | 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... | [
"function",
"exclude",
"(",
"obj",
",",
"keys",
")",
"{",
"var",
"result",
",",
"key",
";",
"result",
"=",
"{",
"}",
";",
"keys",
"=",
"keys",
"||",
"[",
"]",
";",
"for",
"(",
"key",
"in",
"obj",
")",
"{",
"if",
"(",
"obj",
".",
"hasOwnProperty... | 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 | train |
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;
... | 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;
... | [
"function",
"keep",
"(",
"orig",
",",
"dest",
",",
"options",
")",
"{",
"var",
"keep",
",",
"i",
",",
"t",
";",
"keep",
"=",
"options",
".",
"keep",
"||",
"[",
"]",
";",
"if",
"(",
"keep",
".",
"length",
"===",
"0",
")",
"{",
"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 | train |
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
{
... | 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
{
... | [
"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",
"(",
... | Check if a path exists | [
"Check",
"if",
"a",
"path",
"exists"
] | f620180aa21fc8ece0f7b2c268cda335e9e28831 | https://github.com/jmjuanes/utily/blob/f620180aa21fc8ece0f7b2c268cda335e9e28831/lib/fs.js#L134-L158 | train | |
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 t... | 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 t... | [
"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 file method | [
"Remove",
"file",
"method"
] | f620180aa21fc8ece0f7b2c268cda335e9e28831 | https://github.com/jmjuanes/utily/blob/f620180aa21fc8ece0f7b2c268cda335e9e28831/lib/fs.js#L293-L322 | train | |
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... | 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 | train |
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",
lef... | 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",
lef... | [
"function",
"createBoxes",
"(",
"count",
")",
"{",
"var",
"boxes",
"=",
"[",
"]",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"N",
";",
"i",
"++",
")",
"{",
"boxes",
".",
"push",
"(",
"V",
"(",
"elementFlag",
",",
"\"div\"",
",",
"\... | 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 | train |
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",
"(",
"builtInCommandParentDi... | 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 | train |
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 | train |
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... | 67085b524dab4396831c3bc46242d36f3eac93e1 | https://github.com/nearform/aws-ami-container/blob/67085b524dab4396831c3bc46242d36f3eac93e1/lib/container.js#L105-L109 | train |
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... | 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... | [
"function",
"link",
"(",
"mode",
",",
"target",
",",
"system",
",",
"containerDef",
",",
"container",
",",
"out",
",",
"cb",
")",
"{",
"logger",
".",
"info",
"(",
"'linking'",
")",
";",
"out",
".",
"stdout",
"(",
"'linking'",
")",
";",
"var",
"elb",
... | 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",
"... | 67085b524dab4396831c3bc46242d36f3eac93e1 | https://github.com/nearform/aws-ami-container/blob/67085b524dab4396831c3bc46242d36f3eac93e1/lib/container.js#L257-L270 | train |
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... | 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... | [
"function",
"unlink",
"(",
"mode",
",",
"target",
",",
"system",
",",
"containerDef",
",",
"container",
",",
"out",
",",
"cb",
")",
"{",
"logger",
".",
"info",
"(",
"'unlinking'",
")",
";",
"out",
".",
"stdout",
"(",
"'unlinking'",
")",
";",
"var",
"... | 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",... | 67085b524dab4396831c3bc46242d36f3eac93e1 | https://github.com/nearform/aws-ami-container/blob/67085b524dab4396831c3bc46242d36f3eac93e1/lib/container.js#L283-L296 | train |
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(... | 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(... | [
"function",
"(",
"options",
",",
"chart",
",",
"firstAxis",
")",
"{",
"var",
"pane",
"=",
"this",
",",
"backgroundOption",
",",
"defaultOptions",
"=",
"pane",
".",
"defaultOptions",
";",
"pane",
".",
"chart",
"=",
"chart",
";",
"// Set options",
"if",
"(",... | 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 | train | |
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.... | 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.... | [
"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",... | 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 | train | |
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,
inner... | 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,
inner... | [
"function",
"(",
"lineWidth",
",",
"radius",
")",
"{",
"var",
"center",
"=",
"this",
".",
"center",
";",
"radius",
"=",
"pick",
"(",
"radius",
",",
"center",
"[",
"2",
"]",
"/",
"2",
"-",
"this",
".",
"offset",
")",
";",
"return",
"this",
".",
"c... | 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 | train | |
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);
... | 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);
... | [
"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"... | 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 | train | |
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.isCirc... | 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.isCirc... | [
"function",
"(",
")",
"{",
"axisProto",
".",
"setAxisSize",
".",
"call",
"(",
"this",
")",
";",
"if",
"(",
"this",
".",
"isRadial",
")",
"{",
"// Set the center array",
"this",
".",
"center",
"=",
"this",
".",
"pane",
".",
"center",
"=",
"Highcharts",
... | 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 | train | |
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... | 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 | train | |
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.isCi... | 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.isCi... | [
"function",
"(",
"from",
",",
"to",
",",
"options",
")",
"{",
"var",
"center",
"=",
"this",
".",
"center",
",",
"startAngleRad",
"=",
"this",
".",
"startAngleRad",
",",
"fullRadius",
"=",
"center",
"[",
"2",
"]",
"/",
"2",
",",
"radii",
"=",
"[",
"... | 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 | train | |
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... | 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... | [
"function",
"(",
"value",
",",
"reverse",
")",
"{",
"var",
"axis",
"=",
"this",
",",
"center",
"=",
"axis",
".",
"center",
",",
"chart",
"=",
"axis",
".",
"chart",
",",
"end",
"=",
"axis",
".",
"getPosition",
"(",
"value",
")",
",",
"xAxis",
",",
... | 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 | train | |
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",
... | 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 | train | |
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.gr... | 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.gr... | [
"function",
"(",
"segment",
")",
"{",
"var",
"lowSegment",
",",
"highSegment",
"=",
"[",
"]",
",",
"i",
"=",
"segment",
".",
"length",
",",
"baseGetSegmentPath",
"=",
"Series",
".",
"prototype",
".",
"getSegmentPath",
",",
"point",
",",
"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 | train | |
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... | 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... | [
"function",
"(",
")",
"{",
"var",
"data",
"=",
"this",
".",
"data",
",",
"length",
"=",
"data",
".",
"length",
",",
"i",
",",
"originalDataLabels",
"=",
"[",
"]",
",",
"seriesProto",
"=",
"Series",
".",
"prototype",
",",
"dataLabelOptions",
"=",
"this"... | 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 | train | |
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,
... | 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,
... | [
"function",
"(",
")",
"{",
"var",
"series",
"=",
"this",
",",
"yAxis",
"=",
"series",
".",
"yAxis",
",",
"options",
"=",
"series",
".",
"options",
",",
"center",
"=",
"yAxis",
".",
"center",
";",
"series",
".",
"generatePoints",
"(",
")",
";",
"each"... | 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 | train | |
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.... | 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.... | [
"function",
"(",
"init",
")",
"{",
"var",
"series",
"=",
"this",
";",
"if",
"(",
"!",
"init",
")",
"{",
"each",
"(",
"series",
".",
"points",
",",
"function",
"(",
"point",
")",
"{",
"var",
"graphic",
"=",
"point",
".",
"graphic",
";",
"if",
"(",... | 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 | train | |
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 | train | |
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 = su... | 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 = su... | [
"function",
"(",
"force",
")",
"{",
"var",
"series",
"=",
"this",
",",
"options",
"=",
"series",
".",
"options",
",",
"yData",
"=",
"series",
".",
"yData",
",",
"points",
"=",
"series",
".",
"options",
".",
"data",
",",
"// #3710 Update point does not prop... | 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 | train | |
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",
".",
... | 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 | train | |
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.pointAtt... | 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.pointAtt... | [
"function",
"(",
")",
"{",
"seriesTypes",
".",
"column",
".",
"prototype",
".",
"getAttribs",
".",
"apply",
"(",
"this",
",",
"arguments",
")",
";",
"var",
"series",
"=",
"this",
",",
"options",
"=",
"series",
".",
"options",
",",
"stateOptions",
"=",
... | 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 | train | |
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;
prev... | 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;
prev... | [
"function",
"(",
")",
"{",
"var",
"data",
"=",
"this",
".",
"data",
",",
"length",
"=",
"data",
".",
"length",
",",
"lineWidth",
"=",
"this",
".",
"options",
".",
"lineWidth",
"+",
"this",
".",
"borderWidth",
",",
"normalizer",
"=",
"mathRound",
"(",
... | 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 | train | |
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)... | 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)... | [
"function",
"(",
"fill",
")",
"{",
"var",
"markerOptions",
"=",
"this",
".",
"options",
".",
"marker",
",",
"fillOpacity",
"=",
"pick",
"(",
"markerOptions",
".",
"fillOpacity",
",",
"0.5",
")",
";",
"// When called from Legend.colorizeItem, the fill isn't predefine... | 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 | train | |
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",... | 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 | train | |
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 = ... | 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 = ... | [
"function",
"(",
"zMin",
",",
"zMax",
",",
"minSize",
",",
"maxSize",
")",
"{",
"var",
"len",
",",
"i",
",",
"pos",
",",
"zData",
"=",
"this",
".",
"zData",
",",
"radii",
"=",
"[",
"]",
",",
"sizeByArea",
"=",
"this",
".",
"options",
".",
"sizeBy... | 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",
... | 245c267e832968bad880ca009929043e82c7bc25 | https://github.com/MakerCollider/node-red-contrib-smartnode-hook/blob/245c267e832968bad880ca009929043e82c7bc25/html/scripts/highchart/highcharts-more.src.js#L1917-L1938 | train | |
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.ani... | 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.ani... | [
"function",
"(",
"init",
")",
"{",
"var",
"animation",
"=",
"this",
".",
"options",
".",
"animation",
";",
"if",
"(",
"!",
"init",
")",
"{",
"// run the animation",
"each",
"(",
"this",
".",
"points",
",",
"function",
"(",
"point",
")",
"{",
"var",
"... | 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 | train | |
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 = radi... | 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 = radi... | [
"function",
"(",
")",
"{",
"var",
"i",
",",
"data",
"=",
"this",
".",
"data",
",",
"point",
",",
"radius",
",",
"radii",
"=",
"this",
".",
"radii",
";",
"// Run the parent method",
"seriesTypes",
".",
"scatter",
".",
"prototype",
".",
"translate",
".",
... | 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 | train | |
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 ... | 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 ... | [
"function",
"initArea",
"(",
"proceed",
",",
"chart",
",",
"options",
")",
"{",
"proceed",
".",
"call",
"(",
"this",
",",
"chart",
",",
"options",
")",
";",
"if",
"(",
"this",
".",
"chart",
".",
"polar",
")",
"{",
"/**\n\t\t\t * Overridden method to close ... | 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 | train |
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(medi... | 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(medi... | [
"function",
"(",
")",
"{",
"var",
"mediaPath",
"=",
"path",
".",
"join",
"(",
"__dirname",
",",
"'..'",
",",
"'media'",
")",
",",
"templateFile",
"=",
"path",
".",
"join",
"(",
"mediaPath",
",",
"'templates'",
",",
"'index.jade'",
")",
",",
"monolith",
... | 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 | train | |
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",
"(",
... | 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 e... | [
"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 | train |
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",
"(",
"... | 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 | train |
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",
... | 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 | train |
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 | train |
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:... | 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:... | [
"function",
"_normalizeUrl",
"(",
"route",
",",
"prefix",
")",
"{",
"const",
"_route",
"=",
"Object",
".",
"assign",
"(",
"{",
"}",
",",
"route",
")",
"const",
"url",
"=",
"_route",
".",
"url",
".",
"replace",
"(",
"/",
"^\\/",
"/",
",",
"''",
")",... | 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 | train |
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... | 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... | [
"function",
"(",
"opts",
")",
"{",
"xml2js",
".",
"opts",
"=",
"opts",
";",
"return",
"opts",
".",
"option",
"(",
"'-i, --inputdir [directory]'",
",",
"'directory for xml files'",
",",
"__dirname",
"+",
"'/xml/mraa'",
")",
".",
"option",
"(",
"'-c, --custom [fil... | 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 | train | |
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",
"(",
"xmlgramma... | create an xml parser | [
"create",
"an",
"xml",
"parser"
] | 525e775a17b85c30716c00435a2acb26bb198c12 | https://github.com/MakerCollider/upm_mc/blob/525e775a17b85c30716c00435a2acb26bb198c12/doxy/node/xml2js.js#L251-L255 | train |
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) && me... | 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) && me... | [
"function",
"findUsage",
"(",
"type",
",",
"classOnly",
")",
"{",
"var",
"filterClasses",
"=",
"function",
"(",
"fn",
")",
"{",
"return",
"_",
".",
"without",
"(",
"_",
".",
"map",
"(",
"xml2js",
".",
"CLASSES",
",",
"fn",
")",
",",
"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 | train |
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",
",",
"... | 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 | train |
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) {
printIgnoredMethodOnc... | 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) {
printIgnoredMethodOnc... | [
"function",
"isValidMethodSpec",
"(",
"methodSpec",
",",
"methodName",
")",
"{",
"var",
"valid",
"=",
"true",
";",
"var",
"printIgnoredMethodOnce",
"=",
"_",
".",
"once",
"(",
"function",
"(",
")",
"{",
"console",
".",
"log",
"(",
"methodName",
"+",
"' fro... | 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 | train |
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(enumGrou... | 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(enumGrou... | [
"function",
"getEnums",
"(",
"spec_c",
",",
"bygroup",
",",
"parent",
")",
"{",
"var",
"spec_js",
"=",
"{",
"}",
";",
"var",
"enumGroups",
"=",
"_",
".",
"find",
"(",
"getChildren",
"(",
"spec_c",
",",
"'sectiondef'",
")",
",",
"function",
"(",
"sectio... | get enum specifications | [
"get",
"enum",
"specifications"
] | 525e775a17b85c30716c00435a2acb26bb198c12 | https://github.com/MakerCollider/upm_mc/blob/525e775a17b85c30716c00435a2acb26bb198c12/doxy/node/xml2js.js#L520-L553 | train |
Subsets and Splits
SQL Console for semeru/code-text-javascript
Retrieves 20,000 non-null code samples labeled as JavaScript, providing a basic overview of the dataset.