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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
epeios-q37/xdhelcq | js/mktree/mktree.js | convertTrees | function convertTrees() {
setDefault("treeClass","mktree");
setDefault("nodeClosedClass","liClosed");
setDefault("nodeOpenClass","liOpen");
setDefault("nodeBulletClass","liBullet");
setDefault("nodeLinkClass","bullet");
setDefault("preProcessTrees",true);
if (preProcessTrees) {
if (!document.createElement) { r... | javascript | function convertTrees() {
setDefault("treeClass","mktree");
setDefault("nodeClosedClass","liClosed");
setDefault("nodeOpenClass","liOpen");
setDefault("nodeBulletClass","liBullet");
setDefault("nodeLinkClass","bullet");
setDefault("preProcessTrees",true);
if (preProcessTrees) {
if (!document.createElement) { r... | [
"function",
"convertTrees",
"(",
")",
"{",
"setDefault",
"(",
"\"treeClass\"",
",",
"\"mktree\"",
")",
";",
"setDefault",
"(",
"\"nodeClosedClass\"",
",",
"\"liClosed\"",
")",
";",
"setDefault",
"(",
"\"nodeOpenClass\"",
",",
"\"liOpen\"",
")",
";",
"setDefault",
... | Search the document for UL elements with the correct CLASS name, then process them | [
"Search",
"the",
"document",
"for",
"UL",
"elements",
"with",
"the",
"correct",
"CLASS",
"name",
"then",
"process",
"them"
] | 8cffac0650297c313779c9fba545096be24e52a5 | https://github.com/epeios-q37/xdhelcq/blob/8cffac0650297c313779c9fba545096be24e52a5/js/mktree/mktree.js#L98-L118 | train |
epeios-q37/xdhelcq | js/mktree/mktree.js | processList | function processList(ul) {
if ( ul.getAttribute( "data-xdh-mktree" ) == "handled" )
return;
if (!ul.childNodes || ul.childNodes.length==0) { return; }
// Iterate LIs
var childNodesLength = ul.childNodes.length;
for (var itemi=0;itemi<childNodesLength;itemi++) {
var item = ul.childNodes[itemi];
if (item.nod... | javascript | function processList(ul) {
if ( ul.getAttribute( "data-xdh-mktree" ) == "handled" )
return;
if (!ul.childNodes || ul.childNodes.length==0) { return; }
// Iterate LIs
var childNodesLength = ul.childNodes.length;
for (var itemi=0;itemi<childNodesLength;itemi++) {
var item = ul.childNodes[itemi];
if (item.nod... | [
"function",
"processList",
"(",
"ul",
")",
"{",
"if",
"(",
"ul",
".",
"getAttribute",
"(",
"\"data-xdh-mktree\"",
")",
"==",
"\"handled\"",
")",
"return",
";",
"if",
"(",
"!",
"ul",
".",
"childNodes",
"||",
"ul",
".",
"childNodes",
".",
"length",
"==",
... | Process a UL tag and all its children, to convert to a tree | [
"Process",
"a",
"UL",
"tag",
"and",
"all",
"its",
"children",
"to",
"convert",
"to",
"a",
"tree"
] | 8cffac0650297c313779c9fba545096be24e52a5 | https://github.com/epeios-q37/xdhelcq/blob/8cffac0650297c313779c9fba545096be24e52a5/js/mktree/mktree.js#L128-L172 | train |
Digznav/bilberry | git-date-of.js | gitDateOf | function gitDateOf(val) {
let date = null;
try {
date = exec(`git log -1 --format=%cI ${val}`).toString();
} catch (err) {
return new Error(err);
}
return date.substring(0, date.indexOf('T'));
} | javascript | function gitDateOf(val) {
let date = null;
try {
date = exec(`git log -1 --format=%cI ${val}`).toString();
} catch (err) {
return new Error(err);
}
return date.substring(0, date.indexOf('T'));
} | [
"function",
"gitDateOf",
"(",
"val",
")",
"{",
"let",
"date",
"=",
"null",
";",
"try",
"{",
"date",
"=",
"exec",
"(",
"`",
"${",
"val",
"}",
"`",
")",
".",
"toString",
"(",
")",
";",
"}",
"catch",
"(",
"err",
")",
"{",
"return",
"new",
"Error",... | Date of a git value
@param {string} val Value.
@return {string} Date. | [
"Date",
"of",
"a",
"git",
"value"
] | ef6db49de6c8b0d2f4f9d3e10e8a8153e39ffcc4 | https://github.com/Digznav/bilberry/blob/ef6db49de6c8b0d2f4f9d3e10e8a8153e39ffcc4/git-date-of.js#L8-L18 | train |
lujintan/sherrie-cmd-scaffold | main.js | function(text){
var deferred = Q.defer();
r.question(text, function(answer) {
deferred.resolve(answer);
});
return deferred.promise;
} | javascript | function(text){
var deferred = Q.defer();
r.question(text, function(answer) {
deferred.resolve(answer);
});
return deferred.promise;
} | [
"function",
"(",
"text",
")",
"{",
"var",
"deferred",
"=",
"Q",
".",
"defer",
"(",
")",
";",
"r",
".",
"question",
"(",
"text",
",",
"function",
"(",
"answer",
")",
"{",
"deferred",
".",
"resolve",
"(",
"answer",
")",
";",
"}",
")",
";",
"return"... | transfer the question funtion to a promised function | [
"transfer",
"the",
"question",
"funtion",
"to",
"a",
"promised",
"function"
] | af077b4bc3d73155765ad8f8601414d4d0858fea | https://github.com/lujintan/sherrie-cmd-scaffold/blob/af077b4bc3d73155765ad8f8601414d4d0858fea/main.js#L17-L23 | train | |
origin1tech/chek | dist/modules/type.js | castType | function castType(val, type, def) {
function cast() {
if (!is_1.isValue(val))
return to_1.toDefault(null, def);
// If no type specified try to get automatically.
type = type || getType(val);
if (is_1.isArray(type)) {
return to_1.toArray(val)
.m... | javascript | function castType(val, type, def) {
function cast() {
if (!is_1.isValue(val))
return to_1.toDefault(null, def);
// If no type specified try to get automatically.
type = type || getType(val);
if (is_1.isArray(type)) {
return to_1.toArray(val)
.m... | [
"function",
"castType",
"(",
"val",
",",
"type",
",",
"def",
")",
"{",
"function",
"cast",
"(",
")",
"{",
"if",
"(",
"!",
"is_1",
".",
"isValue",
"(",
"val",
")",
")",
"return",
"to_1",
".",
"toDefault",
"(",
"null",
",",
"def",
")",
";",
"// If ... | Cast Type
Attempts to cast to specified type.
@param val the value to be cast.
@param type the type to cast to.
@param def optional default value to return on null. | [
"Cast",
"Type",
"Attempts",
"to",
"cast",
"to",
"specified",
"type",
"."
] | 6bc3ab0ac36126cc7918a244a606009749897b2e | https://github.com/origin1tech/chek/blob/6bc3ab0ac36126cc7918a244a606009749897b2e/dist/modules/type.js#L25-L51 | train |
origin1tech/chek | dist/modules/type.js | getType | function getType(val, strict, def) {
if (is_1.isString(strict)) {
def = strict;
strict = undefined;
}
var type = typeof val;
var parse = !is_1.isValue(strict) ? true : false;
function isKnown() {
return (type === 'undefined' ||
(type !== 'object' &&
... | javascript | function getType(val, strict, def) {
if (is_1.isString(strict)) {
def = strict;
strict = undefined;
}
var type = typeof val;
var parse = !is_1.isValue(strict) ? true : false;
function isKnown() {
return (type === 'undefined' ||
(type !== 'object' &&
... | [
"function",
"getType",
"(",
"val",
",",
"strict",
",",
"def",
")",
"{",
"if",
"(",
"is_1",
".",
"isString",
"(",
"strict",
")",
")",
"{",
"def",
"=",
"strict",
";",
"strict",
"=",
"undefined",
";",
"}",
"var",
"type",
"=",
"typeof",
"val",
";",
"... | Get Type
Gets the type of the provided value.
Value Type Strict
-------------------------------------------------
{} literal object
true boolean boolean
'true' boolean string
25 i... | [
"Get",
"Type",
"Gets",
"the",
"type",
"of",
"the",
"provided",
"value",
"."
] | 6bc3ab0ac36126cc7918a244a606009749897b2e | https://github.com/origin1tech/chek/blob/6bc3ab0ac36126cc7918a244a606009749897b2e/dist/modules/type.js#L77-L135 | train |
vkiding/jud-vue-loader | lib/loader.js | ensureLoader | function ensureLoader (lang) {
return lang.split('!').map(function (loader) {
return loader.replace(/^([\w-]+)(\?.*)?/, function (_, name, query) {
return (/-loader$/.test(name) ? name : (name + '-loader')) + (query || '')
})
}).join('!')
} | javascript | function ensureLoader (lang) {
return lang.split('!').map(function (loader) {
return loader.replace(/^([\w-]+)(\?.*)?/, function (_, name, query) {
return (/-loader$/.test(name) ? name : (name + '-loader')) + (query || '')
})
}).join('!')
} | [
"function",
"ensureLoader",
"(",
"lang",
")",
"{",
"return",
"lang",
".",
"split",
"(",
"'!'",
")",
".",
"map",
"(",
"function",
"(",
"loader",
")",
"{",
"return",
"loader",
".",
"replace",
"(",
"/",
"^([\\w-]+)(\\?.*)?",
"/",
",",
"function",
"(",
"_"... | sass => sass-loader sass-loader => sass-loader sass?indentedsyntax!css => sass-loader?indentedSyntax!css-loader | [
"sass",
"=",
">",
"sass",
"-",
"loader",
"sass",
"-",
"loader",
"=",
">",
"sass",
"-",
"loader",
"sass?indentedsyntax!css",
"=",
">",
"sass",
"-",
"loader?indentedSyntax!css",
"-",
"loader"
] | e629aa1dc49d24a0ebe2f26b324966b9db17b256 | https://github.com/vkiding/jud-vue-loader/blob/e629aa1dc49d24a0ebe2f26b324966b9db17b256/lib/loader.js#L189-L195 | train |
jmjuanes/logty | index.js | function (opt) {
if (typeof opt !== "object" || opt === null) {
opt = {};
}
if (typeof opt.tag !== "string") {
opt.tag = null;
}
if (typeof opt.encoding !== "string") {
opt.encoding = "utf8";
}
//Extends the readable stream
stream.Readable.call(this, {encoding: o... | javascript | function (opt) {
if (typeof opt !== "object" || opt === null) {
opt = {};
}
if (typeof opt.tag !== "string") {
opt.tag = null;
}
if (typeof opt.encoding !== "string") {
opt.encoding = "utf8";
}
//Extends the readable stream
stream.Readable.call(this, {encoding: o... | [
"function",
"(",
"opt",
")",
"{",
"if",
"(",
"typeof",
"opt",
"!==",
"\"object\"",
"||",
"opt",
"===",
"null",
")",
"{",
"opt",
"=",
"{",
"}",
";",
"}",
"if",
"(",
"typeof",
"opt",
".",
"tag",
"!==",
"\"string\"",
")",
"{",
"opt",
".",
"tag",
"... | Logty readable stream | [
"Logty",
"readable",
"stream"
] | 47c4f9ea65f9443f54bd2ccb6a7277fb7c12201b | https://github.com/jmjuanes/logty/blob/47c4f9ea65f9443f54bd2ccb6a7277fb7c12201b/index.js#L10-L42 | train | |
hydrojs/chai | dist/hydro-chai.js | is | function is(type, input) {
if (type === 'Object') return Object(input) === input;
return toString.call(input) === '[object ' + type + ']';
} | javascript | function is(type, input) {
if (type === 'Object') return Object(input) === input;
return toString.call(input) === '[object ' + type + ']';
} | [
"function",
"is",
"(",
"type",
",",
"input",
")",
"{",
"if",
"(",
"type",
"===",
"'Object'",
")",
"return",
"Object",
"(",
"input",
")",
"===",
"input",
";",
"return",
"toString",
".",
"call",
"(",
"input",
")",
"===",
"'[object '",
"+",
"type",
"+",... | Check if `input` is String, Function or Object.
@param {String} type
@param {Mixed} input
@returns {Boolean}
@api private | [
"Check",
"if",
"input",
"is",
"String",
"Function",
"or",
"Object",
"."
] | d8aa18e3a19f0f49d9cd57bac9ab633b1eb439de | https://github.com/hydrojs/chai/blob/d8aa18e3a19f0f49d9cd57bac9ab633b1eb439de/dist/hydro-chai.js#L225-L228 | train |
hydrojs/chai | dist/hydro-chai.js | str | function str(input) {
if (!is('String', input)) return;
return root[input] || (root.require || require)(input);
} | javascript | function str(input) {
if (!is('String', input)) return;
return root[input] || (root.require || require)(input);
} | [
"function",
"str",
"(",
"input",
")",
"{",
"if",
"(",
"!",
"is",
"(",
"'String'",
",",
"input",
")",
")",
"return",
";",
"return",
"root",
"[",
"input",
"]",
"||",
"(",
"root",
".",
"require",
"||",
"require",
")",
"(",
"input",
")",
";",
"}"
] | Check if `input` is a string and if so, either
refer to the global scope or `require` it. Then
call `loa` again in case the exported object
is a function.
@param {Mixed} input
@api private | [
"Check",
"if",
"input",
"is",
"a",
"string",
"and",
"if",
"so",
"either",
"refer",
"to",
"the",
"global",
"scope",
"or",
"require",
"it",
".",
"Then",
"call",
"loa",
"again",
"in",
"case",
"the",
"exported",
"object",
"is",
"a",
"function",
"."
] | d8aa18e3a19f0f49d9cd57bac9ab633b1eb439de | https://github.com/hydrojs/chai/blob/d8aa18e3a19f0f49d9cd57bac9ab633b1eb439de/dist/hydro-chai.js#L240-L243 | train |
emiljohansson/captn | captn.dom.removeclass/index.js | removeClass | function removeClass(element, className) {
if (!hasClassNameProperty(element)) {
return;
}
element.className = element.className
.replace(className, '')
.replace(/^\s+|\s+$/g, '')
.replace(/\s\s/g, ' ');
} | javascript | function removeClass(element, className) {
if (!hasClassNameProperty(element)) {
return;
}
element.className = element.className
.replace(className, '')
.replace(/^\s+|\s+$/g, '')
.replace(/\s\s/g, ' ');
} | [
"function",
"removeClass",
"(",
"element",
",",
"className",
")",
"{",
"if",
"(",
"!",
"hasClassNameProperty",
"(",
"element",
")",
")",
"{",
"return",
";",
"}",
"element",
".",
"className",
"=",
"element",
".",
"className",
".",
"replace",
"(",
"className... | Removes a class name from the element's list of class names.
@static
@param {DOMElement} element The DOM element to modify.
@param {string} className The name to remove.
@example
addClass(el, 'container');
hasClass(el, 'container');
// => true
removeClass(el, 'container');
hasClass(el, 'container');
// => false | [
"Removes",
"a",
"class",
"name",
"from",
"the",
"element",
"s",
"list",
"of",
"class",
"names",
"."
] | dae7520116dc2148b4de06af7e1d7a47a3a3ac37 | https://github.com/emiljohansson/captn/blob/dae7520116dc2148b4de06af7e1d7a47a3a3ac37/captn.dom.removeclass/index.js#L23-L31 | train |
jonschlinkert/normalize-config | index.js | normalizeOptions | function normalizeOptions(obj) {
for (var key in obj) {
if (utils.optsKeys.indexOf(key) > -1) {
obj.options = obj.options || {};
obj.options[key] = obj[key];
delete obj[key];
}
}
return obj;
} | javascript | function normalizeOptions(obj) {
for (var key in obj) {
if (utils.optsKeys.indexOf(key) > -1) {
obj.options = obj.options || {};
obj.options[key] = obj[key];
delete obj[key];
}
}
return obj;
} | [
"function",
"normalizeOptions",
"(",
"obj",
")",
"{",
"for",
"(",
"var",
"key",
"in",
"obj",
")",
"{",
"if",
"(",
"utils",
".",
"optsKeys",
".",
"indexOf",
"(",
"key",
")",
">",
"-",
"1",
")",
"{",
"obj",
".",
"options",
"=",
"obj",
".",
"options... | Move reserved options properties from `obj` to `obj.options` | [
"Move",
"reserved",
"options",
"properties",
"from",
"obj",
"to",
"obj",
".",
"options"
] | dc05e6ace37c5ae87e8b053d5817656d2a13d69c | https://github.com/jonschlinkert/normalize-config/blob/dc05e6ace37c5ae87e8b053d5817656d2a13d69c/index.js#L42-L51 | train |
jonschlinkert/normalize-config | index.js | toObject | function toObject(src, dest, options) {
if (!utils.isObject(options)) {
options = {};
}
var config = {};
if (utils.isObject(dest)) {
options = extend({}, options, dest);
dest = null;
}
if (utils.isObject(src)) {
config = src;
}
if (isValidSrc(src)) {
config.src = src;
} else if ... | javascript | function toObject(src, dest, options) {
if (!utils.isObject(options)) {
options = {};
}
var config = {};
if (utils.isObject(dest)) {
options = extend({}, options, dest);
dest = null;
}
if (utils.isObject(src)) {
config = src;
}
if (isValidSrc(src)) {
config.src = src;
} else if ... | [
"function",
"toObject",
"(",
"src",
",",
"dest",
",",
"options",
")",
"{",
"if",
"(",
"!",
"utils",
".",
"isObject",
"(",
"options",
")",
")",
"{",
"options",
"=",
"{",
"}",
";",
"}",
"var",
"config",
"=",
"{",
"}",
";",
"if",
"(",
"utils",
"."... | Convert args list to a config object. | [
"Convert",
"args",
"list",
"to",
"a",
"config",
"object",
"."
] | dc05e6ace37c5ae87e8b053d5817656d2a13d69c | https://github.com/jonschlinkert/normalize-config/blob/dc05e6ace37c5ae87e8b053d5817656d2a13d69c/index.js#L67-L99 | train |
jonschlinkert/normalize-config | index.js | normalizeSrc | function normalizeSrc(val) {
if (!val.src) return val;
val.src = utils.arrayify(val.src);
return val;
} | javascript | function normalizeSrc(val) {
if (!val.src) return val;
val.src = utils.arrayify(val.src);
return val;
} | [
"function",
"normalizeSrc",
"(",
"val",
")",
"{",
"if",
"(",
"!",
"val",
".",
"src",
")",
"return",
"val",
";",
"val",
".",
"src",
"=",
"utils",
".",
"arrayify",
"(",
"val",
".",
"src",
")",
";",
"return",
"val",
";",
"}"
] | Ensure that `src` on the given val is an array
@param {Object} `val` Object with a `src` property
@return {Object} | [
"Ensure",
"that",
"src",
"on",
"the",
"given",
"val",
"is",
"an",
"array"
] | dc05e6ace37c5ae87e8b053d5817656d2a13d69c | https://github.com/jonschlinkert/normalize-config/blob/dc05e6ace37c5ae87e8b053d5817656d2a13d69c/index.js#L151-L155 | train |
jonschlinkert/normalize-config | index.js | reduceFiles | function reduceFiles(files, orig) {
var config = {files: []};
var len = files.length;
var idx = -1;
while (++idx < len) {
var val = normalize(files[idx]);
config.files = config.files.concat(val.files);
}
return copyNonfiles(config, orig);
} | javascript | function reduceFiles(files, orig) {
var config = {files: []};
var len = files.length;
var idx = -1;
while (++idx < len) {
var val = normalize(files[idx]);
config.files = config.files.concat(val.files);
}
return copyNonfiles(config, orig);
} | [
"function",
"reduceFiles",
"(",
"files",
",",
"orig",
")",
"{",
"var",
"config",
"=",
"{",
"files",
":",
"[",
"]",
"}",
";",
"var",
"len",
"=",
"files",
".",
"length",
";",
"var",
"idx",
"=",
"-",
"1",
";",
"while",
"(",
"++",
"idx",
"<",
"len"... | Normalize all objects in a `files` array.
@param {Array} `files`
@return {Array} | [
"Normalize",
"all",
"objects",
"in",
"a",
"files",
"array",
"."
] | dc05e6ace37c5ae87e8b053d5817656d2a13d69c | https://github.com/jonschlinkert/normalize-config/blob/dc05e6ace37c5ae87e8b053d5817656d2a13d69c/index.js#L192-L203 | train |
jonschlinkert/normalize-config | index.js | copyNonfiles | function copyNonfiles(config, provider) {
if (!provider) return config;
for (var key in provider) {
if (!isFilesKey(key)) {
config[key] = provider[key];
}
}
return config;
} | javascript | function copyNonfiles(config, provider) {
if (!provider) return config;
for (var key in provider) {
if (!isFilesKey(key)) {
config[key] = provider[key];
}
}
return config;
} | [
"function",
"copyNonfiles",
"(",
"config",
",",
"provider",
")",
"{",
"if",
"(",
"!",
"provider",
")",
"return",
"config",
";",
"for",
"(",
"var",
"key",
"in",
"provider",
")",
"{",
"if",
"(",
"!",
"isFilesKey",
"(",
"key",
")",
")",
"{",
"config",
... | Create a `files` array from a src-dest object.
```js
// converts from:
{ src: '*.js', dest: 'foo/' }
// to:
{ files: [{ src: ['*.js'], dest: 'foo/' }] }
``` | [
"Create",
"a",
"files",
"array",
"from",
"a",
"src",
"-",
"dest",
"object",
"."
] | dc05e6ace37c5ae87e8b053d5817656d2a13d69c | https://github.com/jonschlinkert/normalize-config/blob/dc05e6ace37c5ae87e8b053d5817656d2a13d69c/index.js#L217-L225 | train |
jonschlinkert/normalize-config | index.js | filesObjects | function filesObjects(val) {
var res = {};
if (val.options) res.options = val.options;
res.files = [];
for (var key in val) {
if (key !== 'options') {
var file = {};
if (val.options) file.options = val.options;
file.src = utils.arrayify(val[key]);
file.dest = key;
res.files.pu... | javascript | function filesObjects(val) {
var res = {};
if (val.options) res.options = val.options;
res.files = [];
for (var key in val) {
if (key !== 'options') {
var file = {};
if (val.options) file.options = val.options;
file.src = utils.arrayify(val[key]);
file.dest = key;
res.files.pu... | [
"function",
"filesObjects",
"(",
"val",
")",
"{",
"var",
"res",
"=",
"{",
"}",
";",
"if",
"(",
"val",
".",
"options",
")",
"res",
".",
"options",
"=",
"val",
".",
"options",
";",
"res",
".",
"files",
"=",
"[",
"]",
";",
"for",
"(",
"var",
"key"... | When `src`, `dest` and `files` are absent from the
object, we check to see if file objects were defined.
```js
// converts from:
{ 'foo/': '*.js' }
// to
{ files: [{ src: ['*.js'], dest: 'foo/' }] }
``` | [
"When",
"src",
"dest",
"and",
"files",
"are",
"absent",
"from",
"the",
"object",
"we",
"check",
"to",
"see",
"if",
"file",
"objects",
"were",
"defined",
"."
] | dc05e6ace37c5ae87e8b053d5817656d2a13d69c | https://github.com/jonschlinkert/normalize-config/blob/dc05e6ace37c5ae87e8b053d5817656d2a13d69c/index.js#L257-L272 | train |
jonschlinkert/normalize-config | index.js | formatObject | function formatObject(val) {
if (val.options && val.options.format === false) {
return val;
}
var res = { options: val.options };
res.files = val.files;
for (var key in val) {
if (key === 'files' || key === 'options') {
continue;
}
res[key] = val[key];
}
var len = res.files.length;... | javascript | function formatObject(val) {
if (val.options && val.options.format === false) {
return val;
}
var res = { options: val.options };
res.files = val.files;
for (var key in val) {
if (key === 'files' || key === 'options') {
continue;
}
res[key] = val[key];
}
var len = res.files.length;... | [
"function",
"formatObject",
"(",
"val",
")",
"{",
"if",
"(",
"val",
".",
"options",
"&&",
"val",
".",
"options",
".",
"format",
"===",
"false",
")",
"{",
"return",
"val",
";",
"}",
"var",
"res",
"=",
"{",
"options",
":",
"val",
".",
"options",
"}",... | Optionally sort the keys in all of the files objects.
Helps with debugging.
@param {Object} `val` Pass `{sort: true}` on `val.options` to enable sorting.
@return {Object} | [
"Optionally",
"sort",
"the",
"keys",
"in",
"all",
"of",
"the",
"files",
"objects",
".",
"Helps",
"with",
"debugging",
"."
] | dc05e6ace37c5ae87e8b053d5817656d2a13d69c | https://github.com/jonschlinkert/normalize-config/blob/dc05e6ace37c5ae87e8b053d5817656d2a13d69c/index.js#L282-L315 | train |
chrisenytc/livi18n | lib/livi18n.js | function (app) {
//Provide angularLivi18nService
app.get('/livi18n/ngLivi18n.js', function (req, res) {
var filepath = path.join(__dirname, 'client', 'ngLivi18n.js');
res.sendfile(filepath);
});
//Check if socket is enabled
if (config.socket) {
//Provide SocketManager
app.get('/livi18n/livi18n... | javascript | function (app) {
//Provide angularLivi18nService
app.get('/livi18n/ngLivi18n.js', function (req, res) {
var filepath = path.join(__dirname, 'client', 'ngLivi18n.js');
res.sendfile(filepath);
});
//Check if socket is enabled
if (config.socket) {
//Provide SocketManager
app.get('/livi18n/livi18n... | [
"function",
"(",
"app",
")",
"{",
"//Provide angularLivi18nService",
"app",
".",
"get",
"(",
"'/livi18n/ngLivi18n.js'",
",",
"function",
"(",
"req",
",",
"res",
")",
"{",
"var",
"filepath",
"=",
"path",
".",
"join",
"(",
"__dirname",
",",
"'client'",
",",
... | Provide ClientSide API | [
"Provide",
"ClientSide",
"API"
] | cff846d533f2db9162013dd572d18ffd8fa38340 | https://github.com/chrisenytc/livi18n/blob/cff846d533f2db9162013dd572d18ffd8fa38340/lib/livi18n.js#L63-L94 | train | |
chrisenytc/livi18n | lib/livi18n.js | function (language) {
for (var i in config.languages) {
if (config.languages[i] === language) {return true;}
}
//
return false;
} | javascript | function (language) {
for (var i in config.languages) {
if (config.languages[i] === language) {return true;}
}
//
return false;
} | [
"function",
"(",
"language",
")",
"{",
"for",
"(",
"var",
"i",
"in",
"config",
".",
"languages",
")",
"{",
"if",
"(",
"config",
".",
"languages",
"[",
"i",
"]",
"===",
"language",
")",
"{",
"return",
"true",
";",
"}",
"}",
"//",
"return",
"false",
... | Check if this language exists | [
"Check",
"if",
"this",
"language",
"exists"
] | cff846d533f2db9162013dd572d18ffd8fa38340 | https://github.com/chrisenytc/livi18n/blob/cff846d533f2db9162013dd572d18ffd8fa38340/lib/livi18n.js#L111-L117 | train | |
jmjuanes/minsql | lib/query/insert.js | GetValues | function GetValues(mydata, keys, index)
{
//Output
var values = [];
//Loop
for(var j = 0; j < keys.length; j++)
{
//Save data value
var value = mydata[keys[j]];
//Check if value exists
if(!value)
{
//Show warning
console.log('WARNING: value "' + keys[j] + '" is not defined on el... | javascript | function GetValues(mydata, keys, index)
{
//Output
var values = [];
//Loop
for(var j = 0; j < keys.length; j++)
{
//Save data value
var value = mydata[keys[j]];
//Check if value exists
if(!value)
{
//Show warning
console.log('WARNING: value "' + keys[j] + '" is not defined on el... | [
"function",
"GetValues",
"(",
"mydata",
",",
"keys",
",",
"index",
")",
"{",
"//Output\r",
"var",
"values",
"=",
"[",
"]",
";",
"//Loop\r",
"for",
"(",
"var",
"j",
"=",
"0",
";",
"j",
"<",
"keys",
".",
"length",
";",
"j",
"++",
")",
"{",
"//Save ... | Get all the values | [
"Get",
"all",
"the",
"values"
] | 80eddd97e858545997b30e3c9bc067d5fc2df5a0 | https://github.com/jmjuanes/minsql/blob/80eddd97e858545997b30e3c9bc067d5fc2df5a0/lib/query/insert.js#L59-L93 | train |
redisjs/jsr-store | lib/command/zset.js | zadd | function zadd(key /* score-1, member-1, score-N, member-N, req */) {
var args = slice.call(arguments, 1)
, req = typeof args[args.length-1] === 'object' ? args.pop() : null
, val = this.getKey(key, req);
if(val === undefined) {
val = new SortedSet();
this.setKey(key, val, undefined, undefined, unde... | javascript | function zadd(key /* score-1, member-1, score-N, member-N, req */) {
var args = slice.call(arguments, 1)
, req = typeof args[args.length-1] === 'object' ? args.pop() : null
, val = this.getKey(key, req);
if(val === undefined) {
val = new SortedSet();
this.setKey(key, val, undefined, undefined, unde... | [
"function",
"zadd",
"(",
"key",
"/* score-1, member-1, score-N, member-N, req */",
")",
"{",
"var",
"args",
"=",
"slice",
".",
"call",
"(",
"arguments",
",",
"1",
")",
",",
"req",
"=",
"typeof",
"args",
"[",
"args",
".",
"length",
"-",
"1",
"]",
"===",
"... | Adds all the specified members with the specified scores
to the sorted set stored at key. | [
"Adds",
"all",
"the",
"specified",
"members",
"with",
"the",
"specified",
"scores",
"to",
"the",
"sorted",
"set",
"stored",
"at",
"key",
"."
] | b2b5c5b0347819f8a388b5d67e121ee8d73f328c | https://github.com/redisjs/jsr-store/blob/b2b5c5b0347819f8a388b5d67e121ee8d73f328c/lib/command/zset.js#L8-L19 | train |
redisjs/jsr-store | lib/command/zset.js | zrank | function zrank(key, member, req) {
var zset = this.getKey(key, req);
if(zset === undefined) return null;
return zset.zrank(member);
} | javascript | function zrank(key, member, req) {
var zset = this.getKey(key, req);
if(zset === undefined) return null;
return zset.zrank(member);
} | [
"function",
"zrank",
"(",
"key",
",",
"member",
",",
"req",
")",
"{",
"var",
"zset",
"=",
"this",
".",
"getKey",
"(",
"key",
",",
"req",
")",
";",
"if",
"(",
"zset",
"===",
"undefined",
")",
"return",
"null",
";",
"return",
"zset",
".",
"zrank",
... | Returns the rank of member in the sorted set stored at key,
with the scores ordered from low to high. | [
"Returns",
"the",
"rank",
"of",
"member",
"in",
"the",
"sorted",
"set",
"stored",
"at",
"key",
"with",
"the",
"scores",
"ordered",
"from",
"low",
"to",
"high",
"."
] | b2b5c5b0347819f8a388b5d67e121ee8d73f328c | https://github.com/redisjs/jsr-store/blob/b2b5c5b0347819f8a388b5d67e121ee8d73f328c/lib/command/zset.js#L35-L39 | train |
redisjs/jsr-store | lib/command/zset.js | zrevrank | function zrevrank(key, member, req) {
var zset = this.getKey(key, req);
if(zset === undefined) return null;
return zset.zrevrank(member);
} | javascript | function zrevrank(key, member, req) {
var zset = this.getKey(key, req);
if(zset === undefined) return null;
return zset.zrevrank(member);
} | [
"function",
"zrevrank",
"(",
"key",
",",
"member",
",",
"req",
")",
"{",
"var",
"zset",
"=",
"this",
".",
"getKey",
"(",
"key",
",",
"req",
")",
";",
"if",
"(",
"zset",
"===",
"undefined",
")",
"return",
"null",
";",
"return",
"zset",
".",
"zrevran... | Returns the rank of member in the sorted set stored at key,
with the scores ordered from high to low. | [
"Returns",
"the",
"rank",
"of",
"member",
"in",
"the",
"sorted",
"set",
"stored",
"at",
"key",
"with",
"the",
"scores",
"ordered",
"from",
"high",
"to",
"low",
"."
] | b2b5c5b0347819f8a388b5d67e121ee8d73f328c | https://github.com/redisjs/jsr-store/blob/b2b5c5b0347819f8a388b5d67e121ee8d73f328c/lib/command/zset.js#L45-L49 | train |
redisjs/jsr-store | lib/command/zset.js | zscore | function zscore(key, member, req) {
var zset = this.getKey(key, req);
if(zset === undefined) return null;
return zset.zscore(member);
} | javascript | function zscore(key, member, req) {
var zset = this.getKey(key, req);
if(zset === undefined) return null;
return zset.zscore(member);
} | [
"function",
"zscore",
"(",
"key",
",",
"member",
",",
"req",
")",
"{",
"var",
"zset",
"=",
"this",
".",
"getKey",
"(",
"key",
",",
"req",
")",
";",
"if",
"(",
"zset",
"===",
"undefined",
")",
"return",
"null",
";",
"return",
"zset",
".",
"zscore",
... | Returns the score of member in the sorted set at key. | [
"Returns",
"the",
"score",
"of",
"member",
"in",
"the",
"sorted",
"set",
"at",
"key",
"."
] | b2b5c5b0347819f8a388b5d67e121ee8d73f328c | https://github.com/redisjs/jsr-store/blob/b2b5c5b0347819f8a388b5d67e121ee8d73f328c/lib/command/zset.js#L54-L58 | train |
redisjs/jsr-store | lib/command/zset.js | zrem | function zrem(key /* member-1, member-N, req */) {
var args = slice.call(arguments, 1)
, req = typeof args[args.length-1] === 'object' ? args.pop() : null
, val = this.getKey(key, req);
if(val === undefined) return 0;
var deleted = val.zrem(args);
if(val.zcard() === 0) {
this.delKey(key, req);
}
... | javascript | function zrem(key /* member-1, member-N, req */) {
var args = slice.call(arguments, 1)
, req = typeof args[args.length-1] === 'object' ? args.pop() : null
, val = this.getKey(key, req);
if(val === undefined) return 0;
var deleted = val.zrem(args);
if(val.zcard() === 0) {
this.delKey(key, req);
}
... | [
"function",
"zrem",
"(",
"key",
"/* member-1, member-N, req */",
")",
"{",
"var",
"args",
"=",
"slice",
".",
"call",
"(",
"arguments",
",",
"1",
")",
",",
"req",
"=",
"typeof",
"args",
"[",
"args",
".",
"length",
"-",
"1",
"]",
"===",
"'object'",
"?",
... | Removes the specified members from the sorted set stored at key. | [
"Removes",
"the",
"specified",
"members",
"from",
"the",
"sorted",
"set",
"stored",
"at",
"key",
"."
] | b2b5c5b0347819f8a388b5d67e121ee8d73f328c | https://github.com/redisjs/jsr-store/blob/b2b5c5b0347819f8a388b5d67e121ee8d73f328c/lib/command/zset.js#L63-L73 | train |
redisjs/jsr-store | lib/command/zset.js | zincrby | function zincrby(key, increment, member, req) {
var val = this.getKey(key, req);
if(val === undefined) {
val = new SortedSet();
this.setKey(key, val, undefined, undefined, undefined, req);
}
return val.zincrby(increment, member);
} | javascript | function zincrby(key, increment, member, req) {
var val = this.getKey(key, req);
if(val === undefined) {
val = new SortedSet();
this.setKey(key, val, undefined, undefined, undefined, req);
}
return val.zincrby(increment, member);
} | [
"function",
"zincrby",
"(",
"key",
",",
"increment",
",",
"member",
",",
"req",
")",
"{",
"var",
"val",
"=",
"this",
".",
"getKey",
"(",
"key",
",",
"req",
")",
";",
"if",
"(",
"val",
"===",
"undefined",
")",
"{",
"val",
"=",
"new",
"SortedSet",
... | Increments the score of member in the sorted set stored
at key by increment. | [
"Increments",
"the",
"score",
"of",
"member",
"in",
"the",
"sorted",
"set",
"stored",
"at",
"key",
"by",
"increment",
"."
] | b2b5c5b0347819f8a388b5d67e121ee8d73f328c | https://github.com/redisjs/jsr-store/blob/b2b5c5b0347819f8a388b5d67e121ee8d73f328c/lib/command/zset.js#L79-L86 | train |
eliascodes/modload | lib/utils.js | function (arr, val) {
if (!arr || arr.length === 0) return {}
let o = {}
let v = val || null
if (arr.length > 1)
v = this.fromArray(arr.slice(1), v)
o[arr[0]] = v
return o
} | javascript | function (arr, val) {
if (!arr || arr.length === 0) return {}
let o = {}
let v = val || null
if (arr.length > 1)
v = this.fromArray(arr.slice(1), v)
o[arr[0]] = v
return o
} | [
"function",
"(",
"arr",
",",
"val",
")",
"{",
"if",
"(",
"!",
"arr",
"||",
"arr",
".",
"length",
"===",
"0",
")",
"return",
"{",
"}",
"let",
"o",
"=",
"{",
"}",
"let",
"v",
"=",
"val",
"||",
"null",
"if",
"(",
"arr",
".",
"length",
">",
"1"... | Constructs nested object reflecting array
@returns {object} The nested object
@param {array} arr - array from which to construct object
@param {any} val - value to assign to the deepest level object key | [
"Constructs",
"nested",
"object",
"reflecting",
"array"
] | bc3bad88c8b677970bb9154764db7bbf72401d3a | https://github.com/eliascodes/modload/blob/bc3bad88c8b677970bb9154764db7bbf72401d3a/lib/utils.js#L38-L49 | train | |
eliascodes/modload | lib/utils.js | function (str, sep, val) {
if (!str || str.length === 0) return {}
const parts = str.split(sep).filter((s) => s)
return this.fromArray(parts, val)
} | javascript | function (str, sep, val) {
if (!str || str.length === 0) return {}
const parts = str.split(sep).filter((s) => s)
return this.fromArray(parts, val)
} | [
"function",
"(",
"str",
",",
"sep",
",",
"val",
")",
"{",
"if",
"(",
"!",
"str",
"||",
"str",
".",
"length",
"===",
"0",
")",
"return",
"{",
"}",
"const",
"parts",
"=",
"str",
".",
"split",
"(",
"sep",
")",
".",
"filter",
"(",
"(",
"s",
")",
... | Constructs nested object reflecting string
@returns {object} The nested object
@param {string} str - string from which to construct object
@param {string} sep - separator with which to split the string
@param {any} val - value to assign to the deepest level object key | [
"Constructs",
"nested",
"object",
"reflecting",
"string"
] | bc3bad88c8b677970bb9154764db7bbf72401d3a | https://github.com/eliascodes/modload/blob/bc3bad88c8b677970bb9154764db7bbf72401d3a/lib/utils.js#L58-L62 | train | |
eliascodes/modload | lib/utils.js | mergeObjects | function mergeObjects (o1, o2) {
let m = Object.assign({}, o1)
for (let attr in o2) {
let v = o2[attr]
if (attr in m && isPlainObject(v) && isPlainObject(m[attr]))
m[attr] = mergeObjects(m[attr], v)
else
m[attr] = v
}
return m
} | javascript | function mergeObjects (o1, o2) {
let m = Object.assign({}, o1)
for (let attr in o2) {
let v = o2[attr]
if (attr in m && isPlainObject(v) && isPlainObject(m[attr]))
m[attr] = mergeObjects(m[attr], v)
else
m[attr] = v
}
return m
} | [
"function",
"mergeObjects",
"(",
"o1",
",",
"o2",
")",
"{",
"let",
"m",
"=",
"Object",
".",
"assign",
"(",
"{",
"}",
",",
"o1",
")",
"for",
"(",
"let",
"attr",
"in",
"o2",
")",
"{",
"let",
"v",
"=",
"o2",
"[",
"attr",
"]",
"if",
"(",
"attr",
... | Merges objects recursively. Conflicts are resolved by privileging the second argument.
@returns {object} Recursively merged object
@param {object} o1 - First object to merge: taken as the base
@param {object} o2 - Second object to merge: overwrites the base | [
"Merges",
"objects",
"recursively",
".",
"Conflicts",
"are",
"resolved",
"by",
"privileging",
"the",
"second",
"argument",
"."
] | bc3bad88c8b677970bb9154764db7bbf72401d3a | https://github.com/eliascodes/modload/blob/bc3bad88c8b677970bb9154764db7bbf72401d3a/lib/utils.js#L71-L82 | train |
eliascodes/modload | lib/utils.js | parser | function parser (defaults, validators, mappers) {
return function (opts) {
const merged = mergeObjects(defaults, opts)
Object.keys(merged).forEach((key) => {
if (validators[key] && ! validators[key](merged[key]))
throw new Error('Failed to validate ' + key)
if (mappers && mappers[key])
... | javascript | function parser (defaults, validators, mappers) {
return function (opts) {
const merged = mergeObjects(defaults, opts)
Object.keys(merged).forEach((key) => {
if (validators[key] && ! validators[key](merged[key]))
throw new Error('Failed to validate ' + key)
if (mappers && mappers[key])
... | [
"function",
"parser",
"(",
"defaults",
",",
"validators",
",",
"mappers",
")",
"{",
"return",
"function",
"(",
"opts",
")",
"{",
"const",
"merged",
"=",
"mergeObjects",
"(",
"defaults",
",",
"opts",
")",
"Object",
".",
"keys",
"(",
"merged",
")",
".",
... | Creates function to validate and transform objects.
Useful for parsing of options objects
@returns {object} Parsed, validated and transformed object
@param {object} defaults - of default values used if absent from object being parsed
@param {object} validators - of methods used to validate values of object being parsed... | [
"Creates",
"function",
"to",
"validate",
"and",
"transform",
"objects",
".",
"Useful",
"for",
"parsing",
"of",
"options",
"objects"
] | bc3bad88c8b677970bb9154764db7bbf72401d3a | https://github.com/eliascodes/modload/blob/bc3bad88c8b677970bb9154764db7bbf72401d3a/lib/utils.js#L92-L106 | train |
eliascodes/modload | lib/utils.js | combine | function combine () {
const c = Array.prototype.concat.apply([], arguments)
.map((expression) => '(' + expression.source + ')')
.join('|')
return new RegExp(c)
} | javascript | function combine () {
const c = Array.prototype.concat.apply([], arguments)
.map((expression) => '(' + expression.source + ')')
.join('|')
return new RegExp(c)
} | [
"function",
"combine",
"(",
")",
"{",
"const",
"c",
"=",
"Array",
".",
"prototype",
".",
"concat",
".",
"apply",
"(",
"[",
"]",
",",
"arguments",
")",
".",
"map",
"(",
"(",
"expression",
")",
"=>",
"'('",
"+",
"expression",
".",
"source",
"+",
"')'... | Combines array of RegExp objects into a single RegExp with OR
Takes an arbitrary number of RegExp objects
@returns {RegExp} Combined RegExp | [
"Combines",
"array",
"of",
"RegExp",
"objects",
"into",
"a",
"single",
"RegExp",
"with",
"OR",
"Takes",
"an",
"arbitrary",
"number",
"of",
"RegExp",
"objects"
] | bc3bad88c8b677970bb9154764db7bbf72401d3a | https://github.com/eliascodes/modload/blob/bc3bad88c8b677970bb9154764db7bbf72401d3a/lib/utils.js#L113-L118 | train |
Psychopoulet/node-promfs | bin/extractFromArgs.js | _executeCommands | function _executeCommands (showDetails, cmds) {
if (cmds.length) {
const cmd = cmds.shift();
execute(showDetails, cmd.cmd, cmd.options).then((...data) => {
if (data.length && undefined !== data[0]) {
if (1 === data.length && "boolean" === typeof data[0]) {
if (showDetails) {
(... | javascript | function _executeCommands (showDetails, cmds) {
if (cmds.length) {
const cmd = cmds.shift();
execute(showDetails, cmd.cmd, cmd.options).then((...data) => {
if (data.length && undefined !== data[0]) {
if (1 === data.length && "boolean" === typeof data[0]) {
if (showDetails) {
(... | [
"function",
"_executeCommands",
"(",
"showDetails",
",",
"cmds",
")",
"{",
"if",
"(",
"cmds",
".",
"length",
")",
"{",
"const",
"cmd",
"=",
"cmds",
".",
"shift",
"(",
")",
";",
"execute",
"(",
"showDetails",
",",
"cmd",
".",
"cmd",
",",
"cmd",
".",
... | methods
Synchronously execute commands
@param {boolean} showDetails : show execution's details in console
@param {Array} cmds : all commands to execute
@returns {void} | [
"methods",
"Synchronously",
"execute",
"commands"
] | 016e272fc58c6ef6eae5ea551a0e8873f0ac20cc | https://github.com/Psychopoulet/node-promfs/blob/016e272fc58c6ef6eae5ea551a0e8873f0ac20cc/bin/extractFromArgs.js#L59-L97 | train |
thebapi/connect-mongoose-session-store | lib/index.js | _getDefaultSessionSchema | function _getDefaultSessionSchema() {
return new MongooseSchema({
sid: {type : String, index: true },
session: {
type: MongooseSchema.Types.Mixed
},
dateLoggedIn : {
type : Date,
default : new Date()
},
lastAccessTime: {
type : Date,
default : new Date()
... | javascript | function _getDefaultSessionSchema() {
return new MongooseSchema({
sid: {type : String, index: true },
session: {
type: MongooseSchema.Types.Mixed
},
dateLoggedIn : {
type : Date,
default : new Date()
},
lastAccessTime: {
type : Date,
default : new Date()
... | [
"function",
"_getDefaultSessionSchema",
"(",
")",
"{",
"return",
"new",
"MongooseSchema",
"(",
"{",
"sid",
":",
"{",
"type",
":",
"String",
",",
"index",
":",
"true",
"}",
",",
"session",
":",
"{",
"type",
":",
"MongooseSchema",
".",
"Types",
".",
"Mixed... | Create a default mongoose schema
@returns {MongooseSchema}
@private | [
"Create",
"a",
"default",
"mongoose",
"schema"
] | a919f37582fb1fc619f375486e56046c0cae1813 | https://github.com/thebapi/connect-mongoose-session-store/blob/a919f37582fb1fc619f375486e56046c0cae1813/lib/index.js#L24-L45 | train |
thebapi/connect-mongoose-session-store | lib/index.js | _pasreCookies | function _pasreCookies(sessionToStore) {
if (sessionToStore && sessionToStore.cookie && (typeof sessionToStore.cookie.toJSON === "function")) {
sessionToStore.cookie = sessionToStore.cookie.toJSON();
}
return sessionToStore;
} | javascript | function _pasreCookies(sessionToStore) {
if (sessionToStore && sessionToStore.cookie && (typeof sessionToStore.cookie.toJSON === "function")) {
sessionToStore.cookie = sessionToStore.cookie.toJSON();
}
return sessionToStore;
} | [
"function",
"_pasreCookies",
"(",
"sessionToStore",
")",
"{",
"if",
"(",
"sessionToStore",
"&&",
"sessionToStore",
".",
"cookie",
"&&",
"(",
"typeof",
"sessionToStore",
".",
"cookie",
".",
"toJSON",
"===",
"\"function\"",
")",
")",
"{",
"sessionToStore",
".",
... | parse and format cookie object | [
"parse",
"and",
"format",
"cookie",
"object"
] | a919f37582fb1fc619f375486e56046c0cae1813 | https://github.com/thebapi/connect-mongoose-session-store/blob/a919f37582fb1fc619f375486e56046c0cae1813/lib/index.js#L147-L152 | train |
panjiesw/frest | internal/docs/themes/hugo-theme-learn/static/js/search.js | initLunr | function initLunr() {
if (!endsWith(baseurl,"/")){
baseurl = baseurl+'/'
};
// First retrieve the index file
$.getJSON(baseurl +"index.json")
.done(function(index) {
pagesIndex = index;
// Set up lunrjs by declaring the fields we use
// Also provide... | javascript | function initLunr() {
if (!endsWith(baseurl,"/")){
baseurl = baseurl+'/'
};
// First retrieve the index file
$.getJSON(baseurl +"index.json")
.done(function(index) {
pagesIndex = index;
// Set up lunrjs by declaring the fields we use
// Also provide... | [
"function",
"initLunr",
"(",
")",
"{",
"if",
"(",
"!",
"endsWith",
"(",
"baseurl",
",",
"\"/\"",
")",
")",
"{",
"baseurl",
"=",
"baseurl",
"+",
"'/'",
"}",
";",
"// First retrieve the index file",
"$",
".",
"getJSON",
"(",
"baseurl",
"+",
"\"index.json\"",... | Initialize lunrjs using our generated index file | [
"Initialize",
"lunrjs",
"using",
"our",
"generated",
"index",
"file"
] | 975a16ae24bd214b608d0b0001d3d86e5cd65f9e | https://github.com/panjiesw/frest/blob/975a16ae24bd214b608d0b0001d3d86e5cd65f9e/internal/docs/themes/hugo-theme-learn/static/js/search.js#L8-L41 | train |
panjiesw/frest | internal/docs/themes/hugo-theme-learn/static/js/search.js | search | function search(query) {
// Find the item in our index corresponding to the lunr one to have more info
return lunrIndex.search(query).map(function(result) {
return pagesIndex.filter(function(page) {
return page.uri === result.ref;
})[0];
});
} | javascript | function search(query) {
// Find the item in our index corresponding to the lunr one to have more info
return lunrIndex.search(query).map(function(result) {
return pagesIndex.filter(function(page) {
return page.uri === result.ref;
})[0];
});
} | [
"function",
"search",
"(",
"query",
")",
"{",
"// Find the item in our index corresponding to the lunr one to have more info",
"return",
"lunrIndex",
".",
"search",
"(",
"query",
")",
".",
"map",
"(",
"function",
"(",
"result",
")",
"{",
"return",
"pagesIndex",
".",
... | Trigger a search in lunr and transform the result
@param {String} query
@return {Array} results | [
"Trigger",
"a",
"search",
"in",
"lunr",
"and",
"transform",
"the",
"result"
] | 975a16ae24bd214b608d0b0001d3d86e5cd65f9e | https://github.com/panjiesw/frest/blob/975a16ae24bd214b608d0b0001d3d86e5cd65f9e/internal/docs/themes/hugo-theme-learn/static/js/search.js#L49-L56 | train |
gethuman/pancakes-recipe | middleware/mw.tasks.js | init | function init(ctx) {
_.each(resources, function (resource) {
_.each(resource.tasks, function (taskInfo, taskName) {
taskInfo.name = taskName;
taskInfo.service = pancakes.getService(resource.name);
taskHandlers[taskName] = taskInfo;
});
... | javascript | function init(ctx) {
_.each(resources, function (resource) {
_.each(resource.tasks, function (taskInfo, taskName) {
taskInfo.name = taskName;
taskInfo.service = pancakes.getService(resource.name);
taskHandlers[taskName] = taskInfo;
});
... | [
"function",
"init",
"(",
"ctx",
")",
"{",
"_",
".",
"each",
"(",
"resources",
",",
"function",
"(",
"resource",
")",
"{",
"_",
".",
"each",
"(",
"resource",
".",
"tasks",
",",
"function",
"(",
"taskInfo",
",",
"taskName",
")",
"{",
"taskInfo",
".",
... | Initialize a local variable that holds the config values for the task
handlers
@param ctx | [
"Initialize",
"a",
"local",
"variable",
"that",
"holds",
"the",
"config",
"values",
"for",
"the",
"task",
"handlers"
] | ea3feb8839e2edaf1b4577c052b8958953db4498 | https://github.com/gethuman/pancakes-recipe/blob/ea3feb8839e2edaf1b4577c052b8958953db4498/middleware/mw.tasks.js#L15-L25 | train |
gethuman/pancakes-recipe | middleware/mw.tasks.js | isTaskHandled | function isTaskHandled(request, reply) {
var taskName = request.query.task;
// if no task or task handler, don't do anything
if (!taskName && !taskHandlers[taskName]) { return false; }
// if task info doesn't have service or method, don't do anything
var taskInfo = taskHandlers... | javascript | function isTaskHandled(request, reply) {
var taskName = request.query.task;
// if no task or task handler, don't do anything
if (!taskName && !taskHandlers[taskName]) { return false; }
// if task info doesn't have service or method, don't do anything
var taskInfo = taskHandlers... | [
"function",
"isTaskHandled",
"(",
"request",
",",
"reply",
")",
"{",
"var",
"taskName",
"=",
"request",
".",
"query",
".",
"task",
";",
"// if no task or task handler, don't do anything",
"if",
"(",
"!",
"taskName",
"&&",
"!",
"taskHandlers",
"[",
"taskName",
"]... | Handle one particular task
@param request
@param reply | [
"Handle",
"one",
"particular",
"task"
] | ea3feb8839e2edaf1b4577c052b8958953db4498 | https://github.com/gethuman/pancakes-recipe/blob/ea3feb8839e2edaf1b4577c052b8958953db4498/middleware/mw.tasks.js#L32-L73 | train |
HenriJ/careless | vendor/browser-transforms.js | transformReact | function transformReact(source, options) {
// TODO: just use react-tools
options = options || {};
var visitorList;
if (options.harmony) {
visitorList = visitors.getAllVisitors();
} else {
visitorList = visitors.transformVisitors.react;
}
if (options.stripTypes) {
// Stripping types needs to h... | javascript | function transformReact(source, options) {
// TODO: just use react-tools
options = options || {};
var visitorList;
if (options.harmony) {
visitorList = visitors.getAllVisitors();
} else {
visitorList = visitors.transformVisitors.react;
}
if (options.stripTypes) {
// Stripping types needs to h... | [
"function",
"transformReact",
"(",
"source",
",",
"options",
")",
"{",
"// TODO: just use react-tools",
"options",
"=",
"options",
"||",
"{",
"}",
";",
"var",
"visitorList",
";",
"if",
"(",
"options",
".",
"harmony",
")",
"{",
"visitorList",
"=",
"visitors",
... | Run provided code through jstransform.
@param {string} source Original source code
@param {object?} options Options to pass to jstransform
@return {object} object as returned from jstransform | [
"Run",
"provided",
"code",
"through",
"jstransform",
"."
] | 7dea2384b412bf2a03e111dae22055dd9bdf95fe | https://github.com/HenriJ/careless/blob/7dea2384b412bf2a03e111dae22055dd9bdf95fe/vendor/browser-transforms.js#L36-L57 | train |
HenriJ/careless | vendor/browser-transforms.js | createSourceCodeErrorMessage | function createSourceCodeErrorMessage(code, e) {
var sourceLines = code.split('\n');
var erroneousLine = sourceLines[e.lineNumber - 1];
// Removes any leading indenting spaces and gets the number of
// chars indenting the `erroneousLine`
var indentation = 0;
erroneousLine = erroneousLine.replace(/^\s+/, fu... | javascript | function createSourceCodeErrorMessage(code, e) {
var sourceLines = code.split('\n');
var erroneousLine = sourceLines[e.lineNumber - 1];
// Removes any leading indenting spaces and gets the number of
// chars indenting the `erroneousLine`
var indentation = 0;
erroneousLine = erroneousLine.replace(/^\s+/, fu... | [
"function",
"createSourceCodeErrorMessage",
"(",
"code",
",",
"e",
")",
"{",
"var",
"sourceLines",
"=",
"code",
".",
"split",
"(",
"'\\n'",
")",
";",
"var",
"erroneousLine",
"=",
"sourceLines",
"[",
"e",
".",
"lineNumber",
"-",
"1",
"]",
";",
"// Removes a... | This method returns a nicely formated line of code pointing to the exact
location of the error `e`. The line is limited in size so big lines of code
are also shown in a readable way.
Example:
... x', overflow:'scroll'}} id={} onScroll={this.scroll} class=" ...
^
@param {string} code The full string of code
@param {Er... | [
"This",
"method",
"returns",
"a",
"nicely",
"formated",
"line",
"of",
"code",
"pointing",
"to",
"the",
"exact",
"location",
"of",
"the",
"error",
"e",
".",
"The",
"line",
"is",
"limited",
"in",
"size",
"so",
"big",
"lines",
"of",
"code",
"are",
"also",
... | 7dea2384b412bf2a03e111dae22055dd9bdf95fe | https://github.com/HenriJ/careless/blob/7dea2384b412bf2a03e111dae22055dd9bdf95fe/vendor/browser-transforms.js#L83-L110 | train |
borntorun/grunt-release-build | tasks/releasebuild.js | verifyTasks | function verifyTasks() {
if ( options.tasks.build ) {
if ( isTypeString(options.tasks.build) ) {
options.tasks.build = [options.tasks.build];
}
if ( util.isArray(options.tasks.build) ) {
options.tasks.build.forEach(function( item ) {
if ( !isTypeString(item)... | javascript | function verifyTasks() {
if ( options.tasks.build ) {
if ( isTypeString(options.tasks.build) ) {
options.tasks.build = [options.tasks.build];
}
if ( util.isArray(options.tasks.build) ) {
options.tasks.build.forEach(function( item ) {
if ( !isTypeString(item)... | [
"function",
"verifyTasks",
"(",
")",
"{",
"if",
"(",
"options",
".",
"tasks",
".",
"build",
")",
"{",
"if",
"(",
"isTypeString",
"(",
"options",
".",
"tasks",
".",
"build",
")",
")",
"{",
"options",
".",
"tasks",
".",
"build",
"=",
"[",
"options",
... | Test tasks.build option | [
"Test",
"tasks",
".",
"build",
"option"
] | 9f0a72c88a5e134f92766f4b9ef2b7906a791215 | https://github.com/borntorun/grunt-release-build/blob/9f0a72c88a5e134f92766f4b9ef2b7906a791215/tasks/releasebuild.js#L137-L156 | train |
borntorun/grunt-release-build | tasks/releasebuild.js | verifyOthers | function verifyOthers() {
if ( !isTypeString(options.commit) ) {
errorOption('commit', options.commit);
}
if ( !isTypeString(options.tag) ) {
errorOption('tag', options.tag);
}
} | javascript | function verifyOthers() {
if ( !isTypeString(options.commit) ) {
errorOption('commit', options.commit);
}
if ( !isTypeString(options.tag) ) {
errorOption('tag', options.tag);
}
} | [
"function",
"verifyOthers",
"(",
")",
"{",
"if",
"(",
"!",
"isTypeString",
"(",
"options",
".",
"commit",
")",
")",
"{",
"errorOption",
"(",
"'commit'",
",",
"options",
".",
"commit",
")",
";",
"}",
"if",
"(",
"!",
"isTypeString",
"(",
"options",
".",
... | Test other options | [
"Test",
"other",
"options"
] | 9f0a72c88a5e134f92766f4b9ef2b7906a791215 | https://github.com/borntorun/grunt-release-build/blob/9f0a72c88a5e134f92766f4b9ef2b7906a791215/tasks/releasebuild.js#L161-L168 | train |
borntorun/grunt-release-build | tasks/releasebuild.js | isCurrentBranch | function isCurrentBranch( branch ) {
return function() {
var deferred = Q.defer();
Q.fcall(command('git symbolic-ref --short -q HEAD', 'Get current branch'))
.then(function( data ) {
//console.log('data=',data);
if ( data && data.trim() === branch ) {
... | javascript | function isCurrentBranch( branch ) {
return function() {
var deferred = Q.defer();
Q.fcall(command('git symbolic-ref --short -q HEAD', 'Get current branch'))
.then(function( data ) {
//console.log('data=',data);
if ( data && data.trim() === branch ) {
... | [
"function",
"isCurrentBranch",
"(",
"branch",
")",
"{",
"return",
"function",
"(",
")",
"{",
"var",
"deferred",
"=",
"Q",
".",
"defer",
"(",
")",
";",
"Q",
".",
"fcall",
"(",
"command",
"(",
"'git symbolic-ref --short -q HEAD'",
",",
"'Get current branch'",
... | Test if a brach is the current one
@param branch
@returns {Function} | [
"Test",
"if",
"a",
"brach",
"is",
"the",
"current",
"one"
] | 9f0a72c88a5e134f92766f4b9ef2b7906a791215 | https://github.com/borntorun/grunt-release-build/blob/9f0a72c88a5e134f92766f4b9ef2b7906a791215/tasks/releasebuild.js#L175-L195 | train |
borntorun/grunt-release-build | tasks/releasebuild.js | runBuildTasks | function runBuildTasks() {
return (function() {
if ( options.tasks.build.length > 0 ) {
var aToRun = [];
options.tasks.build.forEach(function( item ) {
aToRun.push(command('grunt ' + item, 'Task:' + item));
});
return aToRun.reduce(function( accum, cur... | javascript | function runBuildTasks() {
return (function() {
if ( options.tasks.build.length > 0 ) {
var aToRun = [];
options.tasks.build.forEach(function( item ) {
aToRun.push(command('grunt ' + item, 'Task:' + item));
});
return aToRun.reduce(function( accum, cur... | [
"function",
"runBuildTasks",
"(",
")",
"{",
"return",
"(",
"function",
"(",
")",
"{",
"if",
"(",
"options",
".",
"tasks",
".",
"build",
".",
"length",
">",
"0",
")",
"{",
"var",
"aToRun",
"=",
"[",
"]",
";",
"options",
".",
"tasks",
".",
"build",
... | Run build tasks | [
"Run",
"build",
"tasks"
] | 9f0a72c88a5e134f92766f4b9ef2b7906a791215 | https://github.com/borntorun/grunt-release-build/blob/9f0a72c88a5e134f92766f4b9ef2b7906a791215/tasks/releasebuild.js#L298-L312 | train |
borntorun/grunt-release-build | tasks/releasebuild.js | gitTag | function gitTag() {
return function() {
var deferred = Q.defer();
if (!grunt.option('version')) {
throw new Error('Error in step [Git tag]. Version is not defined.');
}
Q.fcall(command(format('git tag -a v%s -m \'%s\'', grunt.option('version'), options.tag.replace('%v', ... | javascript | function gitTag() {
return function() {
var deferred = Q.defer();
if (!grunt.option('version')) {
throw new Error('Error in step [Git tag]. Version is not defined.');
}
Q.fcall(command(format('git tag -a v%s -m \'%s\'', grunt.option('version'), options.tag.replace('%v', ... | [
"function",
"gitTag",
"(",
")",
"{",
"return",
"function",
"(",
")",
"{",
"var",
"deferred",
"=",
"Q",
".",
"defer",
"(",
")",
";",
"if",
"(",
"!",
"grunt",
".",
"option",
"(",
"'version'",
")",
")",
"{",
"throw",
"new",
"Error",
"(",
"'Error in st... | Tag the new version
@returns {Function} | [
"Tag",
"the",
"new",
"version"
] | 9f0a72c88a5e134f92766f4b9ef2b7906a791215 | https://github.com/borntorun/grunt-release-build/blob/9f0a72c88a5e134f92766f4b9ef2b7906a791215/tasks/releasebuild.js#L359-L376 | train |
borntorun/grunt-release-build | tasks/releasebuild.js | gitRemote | function gitRemote() {
return function() {
var deferred = Q.defer();
Q.fcall(command('git remote', 'Git remote'))
.then(function( data ) {
if ( !data || !data.trim() ) {
deferred.reject(new Error('Error in step [Git remote]. No remotes founds.'));
}
... | javascript | function gitRemote() {
return function() {
var deferred = Q.defer();
Q.fcall(command('git remote', 'Git remote'))
.then(function( data ) {
if ( !data || !data.trim() ) {
deferred.reject(new Error('Error in step [Git remote]. No remotes founds.'));
}
... | [
"function",
"gitRemote",
"(",
")",
"{",
"return",
"function",
"(",
")",
"{",
"var",
"deferred",
"=",
"Q",
".",
"defer",
"(",
")",
";",
"Q",
".",
"fcall",
"(",
"command",
"(",
"'git remote'",
",",
"'Git remote'",
")",
")",
".",
"then",
"(",
"function"... | Retrieve the remote name
@returns {Function} | [
"Retrieve",
"the",
"remote",
"name"
] | 9f0a72c88a5e134f92766f4b9ef2b7906a791215 | https://github.com/borntorun/grunt-release-build/blob/9f0a72c88a5e134f92766f4b9ef2b7906a791215/tasks/releasebuild.js#L382-L420 | train |
tolokoban/ToloFrameWork | ker/mod/squire2/squire-raw.js | function ( range, root ) {
var container = range.startContainer,
block;
// If inline, get the containing block.
if ( isInline( container ) ) {
block = getPreviousBlock( container, root );
} else if ( container !== root && isBlock( container ) ) {
block = container;
} else {
... | javascript | function ( range, root ) {
var container = range.startContainer,
block;
// If inline, get the containing block.
if ( isInline( container ) ) {
block = getPreviousBlock( container, root );
} else if ( container !== root && isBlock( container ) ) {
block = container;
} else {
... | [
"function",
"(",
"range",
",",
"root",
")",
"{",
"var",
"container",
"=",
"range",
".",
"startContainer",
",",
"block",
";",
"// If inline, get the containing block.",
"if",
"(",
"isInline",
"(",
"container",
")",
")",
"{",
"block",
"=",
"getPreviousBlock",
"(... | Returns the first block at least partially contained by the range, or null if no block is contained by the range. | [
"Returns",
"the",
"first",
"block",
"at",
"least",
"partially",
"contained",
"by",
"the",
"range",
"or",
"null",
"if",
"no",
"block",
"is",
"contained",
"by",
"the",
"range",
"."
] | 730845a833a9660ebfdb60ad027ebaab5ac871b6 | https://github.com/tolokoban/ToloFrameWork/blob/730845a833a9660ebfdb60ad027ebaab5ac871b6/ker/mod/squire2/squire-raw.js#L1142-L1157 | train | |
tolokoban/ToloFrameWork | ker/mod/squire2/squire-raw.js | function ( event ) {
var types = event.dataTransfer.types;
var l = types.length;
var hasPlain = false;
var hasHTML = false;
while ( l-- ) {
switch ( types[l] ) {
case 'text/plain':
hasPlain = true;
break;
case 'text/html':
hasHTML = true;
break;
... | javascript | function ( event ) {
var types = event.dataTransfer.types;
var l = types.length;
var hasPlain = false;
var hasHTML = false;
while ( l-- ) {
switch ( types[l] ) {
case 'text/plain':
hasPlain = true;
break;
case 'text/html':
hasHTML = true;
break;
... | [
"function",
"(",
"event",
")",
"{",
"var",
"types",
"=",
"event",
".",
"dataTransfer",
".",
"types",
";",
"var",
"l",
"=",
"types",
".",
"length",
";",
"var",
"hasPlain",
"=",
"false",
";",
"var",
"hasHTML",
"=",
"false",
";",
"while",
"(",
"l",
"-... | On Windows you can drag an drop text. We can't handle this ourselves, because as far as I can see, there's no way to get the drop insertion point. So just save an undo state and hope for the best. | [
"On",
"Windows",
"you",
"can",
"drag",
"an",
"drop",
"text",
".",
"We",
"can",
"t",
"handle",
"this",
"ourselves",
"because",
"as",
"far",
"as",
"I",
"can",
"see",
"there",
"s",
"no",
"way",
"to",
"get",
"the",
"drop",
"insertion",
"point",
".",
"So"... | 730845a833a9660ebfdb60ad027ebaab5ac871b6 | https://github.com/tolokoban/ToloFrameWork/blob/730845a833a9660ebfdb60ad027ebaab5ac871b6/ker/mod/squire2/squire-raw.js#L2417-L2437 | train | |
gethuman/pancakes-angular | lib/ngapp/page.settings.js | updateHead | function updateHead(title, description) {
updateTitle(title);
description = (description || '').replace(/"/g, '');
var metaDesc = angular.element($rootElement.find('meta[name=description]')[0]);
metaDesc.attr('content', description);
} | javascript | function updateHead(title, description) {
updateTitle(title);
description = (description || '').replace(/"/g, '');
var metaDesc = angular.element($rootElement.find('meta[name=description]')[0]);
metaDesc.attr('content', description);
} | [
"function",
"updateHead",
"(",
"title",
",",
"description",
")",
"{",
"updateTitle",
"(",
"title",
")",
";",
"description",
"=",
"(",
"description",
"||",
"''",
")",
".",
"replace",
"(",
"/",
"\"",
"/",
"g",
",",
"''",
")",
";",
"var",
"metaDesc",
"=... | Set the page title and description
@param title
@param description | [
"Set",
"the",
"page",
"title",
"and",
"description"
] | 9589b7ba09619843e271293088005c62ed23f355 | https://github.com/gethuman/pancakes-angular/blob/9589b7ba09619843e271293088005c62ed23f355/lib/ngapp/page.settings.js#L22-L27 | train |
gethuman/pancakes-angular | lib/ngapp/page.settings.js | updatePageStyle | function updatePageStyle(pageName) {
var pageCssId = 'gh-' + pageName.replace('.', '-');
var elem = $rootElement.find('.maincontent');
if (elem && elem.length) {
elem = angular.element(elem[0]);
elem.attr('id', pageCssId);
}
} | javascript | function updatePageStyle(pageName) {
var pageCssId = 'gh-' + pageName.replace('.', '-');
var elem = $rootElement.find('.maincontent');
if (elem && elem.length) {
elem = angular.element(elem[0]);
elem.attr('id', pageCssId);
}
} | [
"function",
"updatePageStyle",
"(",
"pageName",
")",
"{",
"var",
"pageCssId",
"=",
"'gh-'",
"+",
"pageName",
".",
"replace",
"(",
"'.'",
",",
"'-'",
")",
";",
"var",
"elem",
"=",
"$rootElement",
".",
"find",
"(",
"'.maincontent'",
")",
";",
"if",
"(",
... | Update the class name used to key off all styles on the page
@param pageName | [
"Update",
"the",
"class",
"name",
"used",
"to",
"key",
"off",
"all",
"styles",
"on",
"the",
"page"
] | 9589b7ba09619843e271293088005c62ed23f355 | https://github.com/gethuman/pancakes-angular/blob/9589b7ba09619843e271293088005c62ed23f355/lib/ngapp/page.settings.js#L33-L41 | train |
lautr3k/lw.canvas-filters | src/canvas-filters.js | canvasFilters | function canvasFilters(canvas, settings) {
settings = Object.assign({}, {
smoothing : false, // Smoothing [true|fale]
brightness : 0, // Image brightness [-255 to +255]
contrast : 0, // Image contrast [-255 to +255]
gamma : 0, // Image gamma correction [0.... | javascript | function canvasFilters(canvas, settings) {
settings = Object.assign({}, {
smoothing : false, // Smoothing [true|fale]
brightness : 0, // Image brightness [-255 to +255]
contrast : 0, // Image contrast [-255 to +255]
gamma : 0, // Image gamma correction [0.... | [
"function",
"canvasFilters",
"(",
"canvas",
",",
"settings",
")",
"{",
"settings",
"=",
"Object",
".",
"assign",
"(",
"{",
"}",
",",
"{",
"smoothing",
":",
"false",
",",
"// Smoothing [true|fale]",
"brightness",
":",
"0",
",",
"// Image brightness [-255 to +255]... | Apply filters on provided canvas | [
"Apply",
"filters",
"on",
"provided",
"canvas"
] | b2766e5d4d306d6fa17016d0fb00365887065c20 | https://github.com/lautr3k/lw.canvas-filters/blob/b2766e5d4d306d6fa17016d0fb00365887065c20/src/canvas-filters.js#L130-L190 | train |
MostlyJS/mostly-poplarjs-rest | src/wrappers.js | getHandler | function getHandler (method, trans, version) {
return function (req, res, next) {
res.setHeader('Allow', Object.values(allowedMethods).join(','));
let service = req.params.__service;
let id = req.params.__id;
let action = req.params.__action;
let path = '/' + service +
(id? '/' + id : '') +... | javascript | function getHandler (method, trans, version) {
return function (req, res, next) {
res.setHeader('Allow', Object.values(allowedMethods).join(','));
let service = req.params.__service;
let id = req.params.__id;
let action = req.params.__action;
let path = '/' + service +
(id? '/' + id : '') +... | [
"function",
"getHandler",
"(",
"method",
",",
"trans",
",",
"version",
")",
"{",
"return",
"function",
"(",
"req",
",",
"res",
",",
"next",
")",
"{",
"res",
".",
"setHeader",
"(",
"'Allow'",
",",
"Object",
".",
"values",
"(",
"allowedMethods",
")",
"."... | A function that returns the middleware for a given method | [
"A",
"function",
"that",
"returns",
"the",
"middleware",
"for",
"a",
"given",
"method"
] | 0acd6ebe93e3d7dd9c08cd6e31d2b194d0a87e54 | https://github.com/MostlyJS/mostly-poplarjs-rest/blob/0acd6ebe93e3d7dd9c08cd6e31d2b194d0a87e54/src/wrappers.js#L21-L72 | train |
jaycetde/is-validation | lib/chain.js | Chain | function Chain(val, name) {
if (!(this instanceof Chain)) return new Chain(val, name);
this._val = val;
this._name = name;
this.clear();
return this;
} | javascript | function Chain(val, name) {
if (!(this instanceof Chain)) return new Chain(val, name);
this._val = val;
this._name = name;
this.clear();
return this;
} | [
"function",
"Chain",
"(",
"val",
",",
"name",
")",
"{",
"if",
"(",
"!",
"(",
"this",
"instanceof",
"Chain",
")",
")",
"return",
"new",
"Chain",
"(",
"val",
",",
"name",
")",
";",
"this",
".",
"_val",
"=",
"val",
";",
"this",
".",
"_name",
"=",
... | Creates a chain instance
@constructor
@this {Chain}
@param {!Object} val The value the chain is focused on
@param {string} name A human-readable name of the value | [
"Creates",
"a",
"chain",
"instance"
] | 6dc9ddb830480f4bd680f904163126a9c247fa98 | https://github.com/jaycetde/is-validation/blob/6dc9ddb830480f4bd680f904163126a9c247fa98/lib/chain.js#L23-L33 | train |
MakerCollider/node-red-contrib-smartnode-hook | html/scripts/RGraph/RGraph.modaldialog.js | function (id, width)
{
ModalDialog.id = id;
ModalDialog.width = width;
ModalDialog.ShowBackground();
ModalDialog.ShowDialog();
// Install the event handlers
window.onresize = ModalDialog.Resize;
//... | javascript | function (id, width)
{
ModalDialog.id = id;
ModalDialog.width = width;
ModalDialog.ShowBackground();
ModalDialog.ShowDialog();
// Install the event handlers
window.onresize = ModalDialog.Resize;
//... | [
"function",
"(",
"id",
",",
"width",
")",
"{",
"ModalDialog",
".",
"id",
"=",
"id",
";",
"ModalDialog",
".",
"width",
"=",
"width",
";",
"ModalDialog",
".",
"ShowBackground",
"(",
")",
";",
"ModalDialog",
".",
"ShowDialog",
"(",
")",
";",
"// Install the... | Shows the dialog with the supplied DIV acting as the contents
@param string id The ID of the DIV to use as the dialogs contents
@param int width The width of the dialog | [
"Shows",
"the",
"dialog",
"with",
"the",
"supplied",
"DIV",
"acting",
"as",
"the",
"contents"
] | 245c267e832968bad880ca009929043e82c7bc25 | https://github.com/MakerCollider/node-red-contrib-smartnode-hook/blob/245c267e832968bad880ca009929043e82c7bc25/html/scripts/RGraph/RGraph.modaldialog.js#L32-L51 | train | |
MakerCollider/node-red-contrib-smartnode-hook | html/scripts/RGraph/RGraph.modaldialog.js | function ()
{
// Create the background if neccessary
ModalDialog.background = document.createElement('DIV');
ModalDialog.background.className = 'ModalDialog_background';
ModalDialog.background.style.position = 'fixed';
ModalDialog.background.style... | javascript | function ()
{
// Create the background if neccessary
ModalDialog.background = document.createElement('DIV');
ModalDialog.background.className = 'ModalDialog_background';
ModalDialog.background.style.position = 'fixed';
ModalDialog.background.style... | [
"function",
"(",
")",
"{",
"// Create the background if neccessary",
"ModalDialog",
".",
"background",
"=",
"document",
".",
"createElement",
"(",
"'DIV'",
")",
";",
"ModalDialog",
".",
"background",
".",
"className",
"=",
"'ModalDialog_background'",
";",
"ModalDialog... | Shows the background semi-transparent darkened DIV | [
"Shows",
"the",
"background",
"semi",
"-",
"transparent",
"darkened",
"DIV"
] | 245c267e832968bad880ca009929043e82c7bc25 | https://github.com/MakerCollider/node-red-contrib-smartnode-hook/blob/245c267e832968bad880ca009929043e82c7bc25/html/scripts/RGraph/RGraph.modaldialog.js#L59-L77 | train | |
MakerCollider/node-red-contrib-smartnode-hook | html/scripts/RGraph/RGraph.modaldialog.js | function ()
{
if (ModalDialog.dialog) {
ModalDialog.dialog.style.left = (document.body.offsetWidth / 2) - (ModalDialog.dialog.offsetWidth / 2) + 'px';
}
ModalDialog.background.style.width = '2500px';
ModalDialog.background.style.height = '250... | javascript | function ()
{
if (ModalDialog.dialog) {
ModalDialog.dialog.style.left = (document.body.offsetWidth / 2) - (ModalDialog.dialog.offsetWidth / 2) + 'px';
}
ModalDialog.background.style.width = '2500px';
ModalDialog.background.style.height = '250... | [
"function",
"(",
")",
"{",
"if",
"(",
"ModalDialog",
".",
"dialog",
")",
"{",
"ModalDialog",
".",
"dialog",
".",
"style",
".",
"left",
"=",
"(",
"document",
".",
"body",
".",
"offsetWidth",
"/",
"2",
")",
"-",
"(",
"ModalDialog",
".",
"dialog",
".",
... | Accommodate the window being resized | [
"Accommodate",
"the",
"window",
"being",
"resized"
] | 245c267e832968bad880ca009929043e82c7bc25 | https://github.com/MakerCollider/node-red-contrib-smartnode-hook/blob/245c267e832968bad880ca009929043e82c7bc25/html/scripts/RGraph/RGraph.modaldialog.js#L224-L232 | train | |
MakerCollider/node-red-contrib-smartnode-hook | html/scripts/RGraph/RGraph.modaldialog.js | function (name, func)
{
if (typeof(ModalDialog.events) == 'undefined') {
ModalDialog.events = [];
}
ModalDialog.events.push([name, func]);
} | javascript | function (name, func)
{
if (typeof(ModalDialog.events) == 'undefined') {
ModalDialog.events = [];
}
ModalDialog.events.push([name, func]);
} | [
"function",
"(",
"name",
",",
"func",
")",
"{",
"if",
"(",
"typeof",
"(",
"ModalDialog",
".",
"events",
")",
"==",
"'undefined'",
")",
"{",
"ModalDialog",
".",
"events",
"=",
"[",
"]",
";",
"}",
"ModalDialog",
".",
"events",
".",
"push",
"(",
"[",
... | Returns the page height
@return int The page height | [
"Returns",
"the",
"page",
"height"
] | 245c267e832968bad880ca009929043e82c7bc25 | https://github.com/MakerCollider/node-red-contrib-smartnode-hook/blob/245c267e832968bad880ca009929043e82c7bc25/html/scripts/RGraph/RGraph.modaldialog.js#L242-L249 | train | |
MakerCollider/node-red-contrib-smartnode-hook | html/scripts/RGraph/RGraph.modaldialog.js | function (name)
{
for (var i=0; i<ModalDialog.events.length; ++i) {
if (typeof(ModalDialog.events[i][0]) == 'string' && ModalDialog.events[i][0] == name && typeof(ModalDialog.events[i][1]) == 'function') {
ModalDialog.events[i][1]();
}
... | javascript | function (name)
{
for (var i=0; i<ModalDialog.events.length; ++i) {
if (typeof(ModalDialog.events[i][0]) == 'string' && ModalDialog.events[i][0] == name && typeof(ModalDialog.events[i][1]) == 'function') {
ModalDialog.events[i][1]();
}
... | [
"function",
"(",
"name",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"ModalDialog",
".",
"events",
".",
"length",
";",
"++",
"i",
")",
"{",
"if",
"(",
"typeof",
"(",
"ModalDialog",
".",
"events",
"[",
"i",
"]",
"[",
"0",
"]",
"... | Used to fire the ModalDialog custom event
@param object obj The graph object that fires the event
@param string event The name of the event to fire | [
"Used",
"to",
"fire",
"the",
"ModalDialog",
"custom",
"event"
] | 245c267e832968bad880ca009929043e82c7bc25 | https://github.com/MakerCollider/node-red-contrib-smartnode-hook/blob/245c267e832968bad880ca009929043e82c7bc25/html/scripts/RGraph/RGraph.modaldialog.js#L260-L267 | train | |
yefremov/aggregatejs | median.js | median | function median(array) {
var length = array.length;
if (length === 0) {
throw new RangeError("Error");
}
array.sort(function(a, b) {
return a - b;
});
var middle = Math.floor(length / 2);
return length % 2 ? array[middle] : (array[middle] + array[middle - 1]) / 2;
} | javascript | function median(array) {
var length = array.length;
if (length === 0) {
throw new RangeError("Error");
}
array.sort(function(a, b) {
return a - b;
});
var middle = Math.floor(length / 2);
return length % 2 ? array[middle] : (array[middle] + array[middle - 1]) / 2;
} | [
"function",
"median",
"(",
"array",
")",
"{",
"var",
"length",
"=",
"array",
".",
"length",
";",
"if",
"(",
"length",
"===",
"0",
")",
"{",
"throw",
"new",
"RangeError",
"(",
"\"Error\"",
")",
";",
"}",
"array",
".",
"sort",
"(",
"function",
"(",
"... | Returns the median of the numbers in `array`.
@param {Array} array Range of numbers to get the median.
@return {number}
@example
median([100, -100, 150, -50, 100, 250]);
// => 100 | [
"Returns",
"the",
"median",
"of",
"the",
"numbers",
"in",
"array",
"."
] | 932b28a15a5707135e7095950000a838db409511 | https://github.com/yefremov/aggregatejs/blob/932b28a15a5707135e7095950000a838db409511/median.js#L19-L33 | train |
sendanor/nor-db | lib/mysql/Connection.js | Connection | function Connection(conn) {
if(!(this instanceof Connection)) {
return new Connection(conn);
}
var self = this;
if(!conn) { throw new TypeError("no connection set"); }
self._connection = conn;
self._connect = Q.nfbind(self._connection.connect.bind(self._connection));
self._query = Q.nfbind(self._connec... | javascript | function Connection(conn) {
if(!(this instanceof Connection)) {
return new Connection(conn);
}
var self = this;
if(!conn) { throw new TypeError("no connection set"); }
self._connection = conn;
self._connect = Q.nfbind(self._connection.connect.bind(self._connection));
self._query = Q.nfbind(self._connec... | [
"function",
"Connection",
"(",
"conn",
")",
"{",
"if",
"(",
"!",
"(",
"this",
"instanceof",
"Connection",
")",
")",
"{",
"return",
"new",
"Connection",
"(",
"conn",
")",
";",
"}",
"var",
"self",
"=",
"this",
";",
"if",
"(",
"!",
"conn",
")",
"{",
... | Create MySQL connection object | [
"Create",
"MySQL",
"connection",
"object"
] | db4b78691956a49370fc9d9a4eed27e7d3720aeb | https://github.com/sendanor/nor-db/blob/db4b78691956a49370fc9d9a4eed27e7d3720aeb/lib/mysql/Connection.js#L10-L26 | train |
MeldCE/skemer | src/spec/lib/builder.js | mapFalseInputs | function mapFalseInputs(suite, input, p) {
if (p === undefined) {
p = 0;
}
for (p; p < input.length; p++) {
if (input[p] === false) {
var i, newInput = [];
for (i in suite[map[p]]) {
var mapped, cloned = input.slice(0);
cloned[p] = i;
if ((mapped = mapFalseInputs(suit... | javascript | function mapFalseInputs(suite, input, p) {
if (p === undefined) {
p = 0;
}
for (p; p < input.length; p++) {
if (input[p] === false) {
var i, newInput = [];
for (i in suite[map[p]]) {
var mapped, cloned = input.slice(0);
cloned[p] = i;
if ((mapped = mapFalseInputs(suit... | [
"function",
"mapFalseInputs",
"(",
"suite",
",",
"input",
",",
"p",
")",
"{",
"if",
"(",
"p",
"===",
"undefined",
")",
"{",
"p",
"=",
"0",
";",
"}",
"for",
"(",
"p",
";",
"p",
"<",
"input",
".",
"length",
";",
"p",
"++",
")",
"{",
"if",
"(",
... | Expands tests containing false to repeat over all the available values
@param {Obect} suite Test suite of test array to expand
@param {Array} input Test to expand
@param {number} p Last test element expanded
@returns {Array|true} New expanded array or true if no expansion required | [
"Expands",
"tests",
"containing",
"false",
"to",
"repeat",
"over",
"all",
"the",
"available",
"values"
] | 9ef7b00c7c96db5d13c368180b2f660e571de44c | https://github.com/MeldCE/skemer/blob/9ef7b00c7c96db5d13c368180b2f660e571de44c/src/spec/lib/builder.js#L15-L38 | train |
icelab/attache-upload.js | src/index.js | presignRequest | function presignRequest (presignUrl, token) {
return new Promise((resolve, reject) => {
request
.post(presignUrl)
.set({
'Accept': 'application/json',
'Content-Type': 'application/json',
'X-CSRF-Token': token
})
.end((err, res) => {
// throw a custom error m... | javascript | function presignRequest (presignUrl, token) {
return new Promise((resolve, reject) => {
request
.post(presignUrl)
.set({
'Accept': 'application/json',
'Content-Type': 'application/json',
'X-CSRF-Token': token
})
.end((err, res) => {
// throw a custom error m... | [
"function",
"presignRequest",
"(",
"presignUrl",
",",
"token",
")",
"{",
"return",
"new",
"Promise",
"(",
"(",
"resolve",
",",
"reject",
")",
"=>",
"{",
"request",
".",
"post",
"(",
"presignUrl",
")",
".",
"set",
"(",
"{",
"'Accept'",
":",
"'application/... | presignRequest
Perform an XHR request and Resolve or Reject
@param {String} presignUrl
@param {String} token
@param {Promise} | [
"presignRequest",
"Perform",
"an",
"XHR",
"request",
"and",
"Resolve",
"or",
"Reject"
] | ff40a9d8caa45c53e147c810dc7449de685fcaf4 | https://github.com/icelab/attache-upload.js/blob/ff40a9d8caa45c53e147c810dc7449de685fcaf4/src/index.js#L197-L212 | train |
icelab/attache-upload.js | src/index.js | presign | function presign (presignUrl, token, fn = presignRequest) {
return new Promise((resolve, reject) => {
fn(presignUrl, token)
.then(responseStatus)
.then(parseJSON)
.then((res) => {
resolve(res)
})
.catch((err) => {
reject(err)
})
})
} | javascript | function presign (presignUrl, token, fn = presignRequest) {
return new Promise((resolve, reject) => {
fn(presignUrl, token)
.then(responseStatus)
.then(parseJSON)
.then((res) => {
resolve(res)
})
.catch((err) => {
reject(err)
})
})
} | [
"function",
"presign",
"(",
"presignUrl",
",",
"token",
",",
"fn",
"=",
"presignRequest",
")",
"{",
"return",
"new",
"Promise",
"(",
"(",
"resolve",
",",
"reject",
")",
"=>",
"{",
"fn",
"(",
"presignUrl",
",",
"token",
")",
".",
"then",
"(",
"responseS... | presign
Take a url and optional token
return a Promise
@param {String} presignUrl
@param {String} token
@param {Function} defaults to presignRequest()
@param {Promise} | [
"presign",
"Take",
"a",
"url",
"and",
"optional",
"token",
"return",
"a",
"Promise"
] | ff40a9d8caa45c53e147c810dc7449de685fcaf4 | https://github.com/icelab/attache-upload.js/blob/ff40a9d8caa45c53e147c810dc7449de685fcaf4/src/index.js#L224-L236 | train |
sumanjs/suman-inquirer-directory | index.js | Prompt | function Prompt () {
Base.apply(this, arguments);
if (!this.opt.basePath) {
this.throwParamError('basePath');
}
this.pathIndexHash = {};
this.originalBaseDir = this.currentPath =
path.normalize(path.isAbsolute(this.opt.basePath) ?
path.resolve(this.opt.basePath) : path.resolve(process.cwd(), t... | javascript | function Prompt () {
Base.apply(this, arguments);
if (!this.opt.basePath) {
this.throwParamError('basePath');
}
this.pathIndexHash = {};
this.originalBaseDir = this.currentPath =
path.normalize(path.isAbsolute(this.opt.basePath) ?
path.resolve(this.opt.basePath) : path.resolve(process.cwd(), t... | [
"function",
"Prompt",
"(",
")",
"{",
"Base",
".",
"apply",
"(",
"this",
",",
"arguments",
")",
";",
"if",
"(",
"!",
"this",
".",
"opt",
".",
"basePath",
")",
"{",
"this",
".",
"throwParamError",
"(",
"'basePath'",
")",
";",
"}",
"this",
".",
"pathI... | stores what index to use for a path if you go back a directory
Constructor | [
"stores",
"what",
"index",
"to",
"use",
"for",
"a",
"path",
"if",
"you",
"go",
"back",
"a",
"directory",
"Constructor"
] | 6ecc706476ed0644ebf8442593884906df1c6faa | https://github.com/sumanjs/suman-inquirer-directory/blob/6ecc706476ed0644ebf8442593884906df1c6faa/index.js#L44-L75 | train |
taoyuan/wide | lib/transports/file.js | createAndFlush | function createAndFlush(size) {
if (self._stream) {
self._stream.end();
self._stream.destroySoon();
}
self._size = size;
self.filename = target;
self._stream = fs.createWriteStream(fullname, self.options);
//
... | javascript | function createAndFlush(size) {
if (self._stream) {
self._stream.end();
self._stream.destroySoon();
}
self._size = size;
self.filename = target;
self._stream = fs.createWriteStream(fullname, self.options);
//
... | [
"function",
"createAndFlush",
"(",
"size",
")",
"{",
"if",
"(",
"self",
".",
"_stream",
")",
"{",
"self",
".",
"_stream",
".",
"end",
"(",
")",
";",
"self",
".",
"_stream",
".",
"destroySoon",
"(",
")",
";",
"}",
"self",
".",
"_size",
"=",
"size",
... | Creates the `WriteStream` and then flushes any buffered messages. | [
"Creates",
"the",
"WriteStream",
"and",
"then",
"flushes",
"any",
"buffered",
"messages",
"."
] | a3bc92580f43c56001d8a6d72b45b0e44ba3a7c6 | https://github.com/taoyuan/wide/blob/a3bc92580f43c56001d8a6d72b45b0e44ba3a7c6/lib/transports/file.js#L417-L456 | train |
nbrownus/ppunit | lib/Suite.js | function (title) {
Suite.super_.call(this)
this.title = title
this.suites = []
this.exclusivity = Suite.EXCLUSIVITY.NONE
this.testExclusivity = undefined
this.parent = undefined
this.nextTests = []
this.globalTests = []
this.testContainer = false
this.testDependencies = []
... | javascript | function (title) {
Suite.super_.call(this)
this.title = title
this.suites = []
this.exclusivity = Suite.EXCLUSIVITY.NONE
this.testExclusivity = undefined
this.parent = undefined
this.nextTests = []
this.globalTests = []
this.testContainer = false
this.testDependencies = []
... | [
"function",
"(",
"title",
")",
"{",
"Suite",
".",
"super_",
".",
"call",
"(",
"this",
")",
"this",
".",
"title",
"=",
"title",
"this",
".",
"suites",
"=",
"[",
"]",
"this",
".",
"exclusivity",
"=",
"Suite",
".",
"EXCLUSIVITY",
".",
"NONE",
"this",
... | Contains a set of tests and children suites
@param {String} title Title for the suite
@constructor | [
"Contains",
"a",
"set",
"of",
"tests",
"and",
"children",
"suites"
] | dcce602497d9548ce9085a8db115e65561dcc3de | https://github.com/nbrownus/ppunit/blob/dcce602497d9548ce9085a8db115e65561dcc3de/lib/Suite.js#L12-L41 | train | |
origin1tech/chek | dist/modules/is.js | isArray | function isArray(val) {
/* istanbul ignore if */
if (!Array.isArray)
return constant_1.toStr.call(val) === '[object Array]';
return Array.isArray(val);
} | javascript | function isArray(val) {
/* istanbul ignore if */
if (!Array.isArray)
return constant_1.toStr.call(val) === '[object Array]';
return Array.isArray(val);
} | [
"function",
"isArray",
"(",
"val",
")",
"{",
"/* istanbul ignore if */",
"if",
"(",
"!",
"Array",
".",
"isArray",
")",
"return",
"constant_1",
".",
"toStr",
".",
"call",
"(",
"val",
")",
"===",
"'[object Array]'",
";",
"return",
"Array",
".",
"isArray",
"(... | Is Array
Check if value is an array.
@param val the value to test if is array. | [
"Is",
"Array",
"Check",
"if",
"value",
"is",
"an",
"array",
"."
] | 6bc3ab0ac36126cc7918a244a606009749897b2e | https://github.com/origin1tech/chek/blob/6bc3ab0ac36126cc7918a244a606009749897b2e/dist/modules/is.js#L20-L25 | train |
origin1tech/chek | dist/modules/is.js | isBrowser | function isBrowser(override) {
// Enables checking a process.env key while
// in Node.
if (override)
return typeof process !== 'undefined' &&
function_1.tryWrap(to_1.toBoolean, process.env &&
process.env[override])(false) === true;
// Otherwise just return NOT Node.
... | javascript | function isBrowser(override) {
// Enables checking a process.env key while
// in Node.
if (override)
return typeof process !== 'undefined' &&
function_1.tryWrap(to_1.toBoolean, process.env &&
process.env[override])(false) === true;
// Otherwise just return NOT Node.
... | [
"function",
"isBrowser",
"(",
"override",
")",
"{",
"// Enables checking a process.env key while",
"// in Node.",
"if",
"(",
"override",
")",
"return",
"typeof",
"process",
"!==",
"'undefined'",
"&&",
"function_1",
".",
"tryWrap",
"(",
"to_1",
".",
"toBoolean",
",",... | Is Browser
Checks if script is running in browser.
@param override an optional key to inspect on process.env. | [
"Is",
"Browser",
"Checks",
"if",
"script",
"is",
"running",
"in",
"browser",
"."
] | 6bc3ab0ac36126cc7918a244a606009749897b2e | https://github.com/origin1tech/chek/blob/6bc3ab0ac36126cc7918a244a606009749897b2e/dist/modules/is.js#L42-L51 | train |
origin1tech/chek | dist/modules/is.js | isDebug | function isDebug(debugging) {
// If manually passed just return.
if (isValue(debugging))
return debugging;
var eargv = process && process.execArgv;
function chkDebug() {
return (eargv.filter(function (v) { return /^(--debug|--inspect)/.test(v); }).length ||
isValue(v8debug));... | javascript | function isDebug(debugging) {
// If manually passed just return.
if (isValue(debugging))
return debugging;
var eargv = process && process.execArgv;
function chkDebug() {
return (eargv.filter(function (v) { return /^(--debug|--inspect)/.test(v); }).length ||
isValue(v8debug));... | [
"function",
"isDebug",
"(",
"debugging",
")",
"{",
"// If manually passed just return.",
"if",
"(",
"isValue",
"(",
"debugging",
")",
")",
"return",
"debugging",
";",
"var",
"eargv",
"=",
"process",
"&&",
"process",
".",
"execArgv",
";",
"function",
"chkDebug",
... | Indicates if app is in debug mode.
@param debugging a manual flag to denote debugging. | [
"Indicates",
"if",
"app",
"is",
"in",
"debug",
"mode",
"."
] | 6bc3ab0ac36126cc7918a244a606009749897b2e | https://github.com/origin1tech/chek/blob/6bc3ab0ac36126cc7918a244a606009749897b2e/dist/modules/is.js#L81-L91 | train |
origin1tech/chek | dist/modules/is.js | isEmpty | function isEmpty(val) {
return (isUndefined(val) ||
isNull(val) ||
(isString(val) && val.length === 0) ||
(isNumber(val) && isNaN(val)) ||
(isPlainObject(val) && !array_1.keys(val).length) ||
(isArray(val) && !val.length));
} | javascript | function isEmpty(val) {
return (isUndefined(val) ||
isNull(val) ||
(isString(val) && val.length === 0) ||
(isNumber(val) && isNaN(val)) ||
(isPlainObject(val) && !array_1.keys(val).length) ||
(isArray(val) && !val.length));
} | [
"function",
"isEmpty",
"(",
"val",
")",
"{",
"return",
"(",
"isUndefined",
"(",
"val",
")",
"||",
"isNull",
"(",
"val",
")",
"||",
"(",
"isString",
"(",
"val",
")",
"&&",
"val",
".",
"length",
"===",
"0",
")",
"||",
"(",
"isNumber",
"(",
"val",
"... | Is Empty
Test if value provided is empty.
Note 0 would be empty.
@param val value to be inspected. | [
"Is",
"Empty",
"Test",
"if",
"value",
"provided",
"is",
"empty",
".",
"Note",
"0",
"would",
"be",
"empty",
"."
] | 6bc3ab0ac36126cc7918a244a606009749897b2e | https://github.com/origin1tech/chek/blob/6bc3ab0ac36126cc7918a244a606009749897b2e/dist/modules/is.js#L100-L107 | train |
origin1tech/chek | dist/modules/is.js | isEqual | function isEqual(val, comp, loose) {
if (isDate(val) && isDate(comp))
return to_1.toEpoch(val) === to_1.toEpoch(comp);
if (loose)
return val == comp;
return val === comp;
} | javascript | function isEqual(val, comp, loose) {
if (isDate(val) && isDate(comp))
return to_1.toEpoch(val) === to_1.toEpoch(comp);
if (loose)
return val == comp;
return val === comp;
} | [
"function",
"isEqual",
"(",
"val",
",",
"comp",
",",
"loose",
")",
"{",
"if",
"(",
"isDate",
"(",
"val",
")",
"&&",
"isDate",
"(",
"comp",
")",
")",
"return",
"to_1",
".",
"toEpoch",
"(",
"val",
")",
"===",
"to_1",
".",
"toEpoch",
"(",
"comp",
")... | Is Equal
Tests if two values are equal.
Does not support "deep equal".
@param val the value to be compared.
@param comp the comparer value.
@param loose when true == is used instead of ===. | [
"Is",
"Equal",
"Tests",
"if",
"two",
"values",
"are",
"equal",
".",
"Does",
"not",
"support",
"deep",
"equal",
"."
] | 6bc3ab0ac36126cc7918a244a606009749897b2e | https://github.com/origin1tech/chek/blob/6bc3ab0ac36126cc7918a244a606009749897b2e/dist/modules/is.js#L118-L124 | train |
origin1tech/chek | dist/modules/is.js | isError | function isError(val, prop) {
if (!isValue(val) || !isObject(val))
return false;
var type = constant_1.toStr.call(val).toLowerCase();
return type === '[object error]' || type === '[object domexception]' || !isEmpty(val[prop]);
} | javascript | function isError(val, prop) {
if (!isValue(val) || !isObject(val))
return false;
var type = constant_1.toStr.call(val).toLowerCase();
return type === '[object error]' || type === '[object domexception]' || !isEmpty(val[prop]);
} | [
"function",
"isError",
"(",
"val",
",",
"prop",
")",
"{",
"if",
"(",
"!",
"isValue",
"(",
"val",
")",
"||",
"!",
"isObject",
"(",
"val",
")",
")",
"return",
"false",
";",
"var",
"type",
"=",
"constant_1",
".",
"toStr",
".",
"call",
"(",
"val",
")... | Is Error
Checks if value is an error. Allows custom error property
which can be useful in certain scenarios to flag an object
as an error.
@param val the value/object to be inspected.
@param prop a custom property to check if exists indicating is error. | [
"Is",
"Error",
"Checks",
"if",
"value",
"is",
"an",
"error",
".",
"Allows",
"custom",
"error",
"property",
"which",
"can",
"be",
"useful",
"in",
"certain",
"scenarios",
"to",
"flag",
"an",
"object",
"as",
"an",
"error",
"."
] | 6bc3ab0ac36126cc7918a244a606009749897b2e | https://github.com/origin1tech/chek/blob/6bc3ab0ac36126cc7918a244a606009749897b2e/dist/modules/is.js#L135-L140 | train |
origin1tech/chek | dist/modules/is.js | isDocker | function isDocker() {
if (!isNode())
return false;
var hasEnv = function_1.tryWrap(function () {
statSync('/.dockerenv');
return true;
})(false);
var hasGroup = function_1.tryWrap(function () {
return ~readFileSync('/proc/self/cgroup', 'utf8').indexOf('docker');
})(fa... | javascript | function isDocker() {
if (!isNode())
return false;
var hasEnv = function_1.tryWrap(function () {
statSync('/.dockerenv');
return true;
})(false);
var hasGroup = function_1.tryWrap(function () {
return ~readFileSync('/proc/self/cgroup', 'utf8').indexOf('docker');
})(fa... | [
"function",
"isDocker",
"(",
")",
"{",
"if",
"(",
"!",
"isNode",
"(",
")",
")",
"return",
"false",
";",
"var",
"hasEnv",
"=",
"function_1",
".",
"tryWrap",
"(",
"function",
"(",
")",
"{",
"statSync",
"(",
"'/.dockerenv'",
")",
";",
"return",
"true",
... | Is Docker
Checks if running inside Docker container. | [
"Is",
"Docker",
"Checks",
"if",
"running",
"inside",
"Docker",
"container",
"."
] | 6bc3ab0ac36126cc7918a244a606009749897b2e | https://github.com/origin1tech/chek/blob/6bc3ab0ac36126cc7918a244a606009749897b2e/dist/modules/is.js#L172-L183 | train |
origin1tech/chek | dist/modules/is.js | isObject | function isObject(val) {
return (!isUndefined(val) &&
!isNull(val) &&
((val && val.constructor === Object) || typeof val === 'function' || typeof val === 'object'));
} | javascript | function isObject(val) {
return (!isUndefined(val) &&
!isNull(val) &&
((val && val.constructor === Object) || typeof val === 'function' || typeof val === 'object'));
} | [
"function",
"isObject",
"(",
"val",
")",
"{",
"return",
"(",
"!",
"isUndefined",
"(",
"val",
")",
"&&",
"!",
"isNull",
"(",
"val",
")",
"&&",
"(",
"(",
"val",
"&&",
"val",
".",
"constructor",
"===",
"Object",
")",
"||",
"typeof",
"val",
"===",
"'fu... | Is Object
Checks if value is an object.
@param val the value to inspect. | [
"Is",
"Object",
"Checks",
"if",
"value",
"is",
"an",
"object",
"."
] | 6bc3ab0ac36126cc7918a244a606009749897b2e | https://github.com/origin1tech/chek/blob/6bc3ab0ac36126cc7918a244a606009749897b2e/dist/modules/is.js#L288-L292 | train |
origin1tech/chek | dist/modules/is.js | isPromise | function isPromise(val, name) {
name = name || 'Promise';
return (!isEmpty(val) &&
val.constructor &&
val.constructor.name === name);
} | javascript | function isPromise(val, name) {
name = name || 'Promise';
return (!isEmpty(val) &&
val.constructor &&
val.constructor.name === name);
} | [
"function",
"isPromise",
"(",
"val",
",",
"name",
")",
"{",
"name",
"=",
"name",
"||",
"'Promise'",
";",
"return",
"(",
"!",
"isEmpty",
"(",
"val",
")",
"&&",
"val",
".",
"constructor",
"&&",
"val",
".",
"constructor",
".",
"name",
"===",
"name",
")"... | Is Promise
Checks if value is a Promise.
@param val the value to inspect.
@param name optional constructor name for promise defaults to Promise. | [
"Is",
"Promise",
"Checks",
"if",
"value",
"is",
"a",
"Promise",
"."
] | 6bc3ab0ac36126cc7918a244a606009749897b2e | https://github.com/origin1tech/chek/blob/6bc3ab0ac36126cc7918a244a606009749897b2e/dist/modules/is.js#L311-L316 | train |
rowanmanning/mocha-srv | lib/app.js | renderTmpl | function renderTmpl (path, vars, callback) {
fs.readFile(path, 'utf8', function (err, file) {
if (err) {
return callback(err);
}
var out = file.replace(/\{\{([a-z]+)\}\}/ig, function (all, name) {
return vars[name];
});
callback(null, out);
});
} | javascript | function renderTmpl (path, vars, callback) {
fs.readFile(path, 'utf8', function (err, file) {
if (err) {
return callback(err);
}
var out = file.replace(/\{\{([a-z]+)\}\}/ig, function (all, name) {
return vars[name];
});
callback(null, out);
});
} | [
"function",
"renderTmpl",
"(",
"path",
",",
"vars",
",",
"callback",
")",
"{",
"fs",
".",
"readFile",
"(",
"path",
",",
"'utf8'",
",",
"function",
"(",
"err",
",",
"file",
")",
"{",
"if",
"(",
"err",
")",
"{",
"return",
"callback",
"(",
"err",
")",... | Poor-man's mustache | [
"Poor",
"-",
"man",
"s",
"mustache"
] | 47af5e5bc91bb37ba5ccdb0ea7cf1771748fdff2 | https://github.com/rowanmanning/mocha-srv/blob/47af5e5bc91bb37ba5ccdb0ea7cf1771748fdff2/lib/app.js#L55-L65 | train |
sendanor/nor-nopg | src/schema/v0032.js | function(db) {
var methods_uuid = uuid();
debug.assert(methods_uuid).is('uuid');
return db.query('CREATE SEQUENCE methods_seq')
.query(['CREATE TABLE IF NOT EXISTS methods (',
" id uuid PRIMARY KEY NOT NULL default uuid_generate_v5('"+methods_uuid+"', nextval('methods_seq'::regclass)::text),",
' typ... | javascript | function(db) {
var methods_uuid = uuid();
debug.assert(methods_uuid).is('uuid');
return db.query('CREATE SEQUENCE methods_seq')
.query(['CREATE TABLE IF NOT EXISTS methods (',
" id uuid PRIMARY KEY NOT NULL default uuid_generate_v5('"+methods_uuid+"', nextval('methods_seq'::regclass)::text),",
' typ... | [
"function",
"(",
"db",
")",
"{",
"var",
"methods_uuid",
"=",
"uuid",
"(",
")",
";",
"debug",
".",
"assert",
"(",
"methods_uuid",
")",
".",
"is",
"(",
"'uuid'",
")",
";",
"return",
"db",
".",
"query",
"(",
"'CREATE SEQUENCE methods_seq'",
")",
".",
"que... | The methods table | [
"The",
"methods",
"table"
] | 0d99b86c1a1996b5828b56de8de23700df8bbc0c | https://github.com/sendanor/nor-nopg/blob/0d99b86c1a1996b5828b56de8de23700df8bbc0c/src/schema/v0032.js#L10-L67 | train | |
jokeyrhyme/jqlint | jqlint.js | isInstance | function isInstance(node) {
if (node.type === 'Identifier') {
if (currentOptions.angular) {
if (instanceVarsRegExp.angular.test(node.name)) {
return true;
}
} else {
if (instanceVarsRegExp.noangular.test(node.name)) {
return true;
}
}
}
if (node.type === 'CallEx... | javascript | function isInstance(node) {
if (node.type === 'Identifier') {
if (currentOptions.angular) {
if (instanceVarsRegExp.angular.test(node.name)) {
return true;
}
} else {
if (instanceVarsRegExp.noangular.test(node.name)) {
return true;
}
}
}
if (node.type === 'CallEx... | [
"function",
"isInstance",
"(",
"node",
")",
"{",
"if",
"(",
"node",
".",
"type",
"===",
"'Identifier'",
")",
"{",
"if",
"(",
"currentOptions",
".",
"angular",
")",
"{",
"if",
"(",
"instanceVarsRegExp",
".",
"angular",
".",
"test",
"(",
"node",
".",
"na... | determine if a syntax node a jQuery-wrapped element list
@param node
@returns {boolean} | [
"determine",
"if",
"a",
"syntax",
"node",
"a",
"jQuery",
"-",
"wrapped",
"element",
"list"
] | 23989825abb0afe5b92cea31c9334d385ca93afb | https://github.com/jokeyrhyme/jqlint/blob/23989825abb0afe5b92cea31c9334d385ca93afb/jqlint.js#L64-L90 | train |
meltmedia/node-usher | lib/decider/poller.js | DecisionPoller | function DecisionPoller(name, domain, options) {
if (!(this instanceof DecisionPoller)) {
return new DecisionPoller(name, domain, options);
}
if (!_.isString(name)) {
throw new Error('A `name` is required');
}
if (!_.isString(domain)) {
throw new Error('A `domain` is required');
}
this.name... | javascript | function DecisionPoller(name, domain, options) {
if (!(this instanceof DecisionPoller)) {
return new DecisionPoller(name, domain, options);
}
if (!_.isString(name)) {
throw new Error('A `name` is required');
}
if (!_.isString(domain)) {
throw new Error('A `domain` is required');
}
this.name... | [
"function",
"DecisionPoller",
"(",
"name",
",",
"domain",
",",
"options",
")",
"{",
"if",
"(",
"!",
"(",
"this",
"instanceof",
"DecisionPoller",
")",
")",
"{",
"return",
"new",
"DecisionPoller",
"(",
"name",
",",
"domain",
",",
"options",
")",
";",
"}",
... | Represents a single, named decision poller, where all workflow versions can be created. Tasks will automaticly be
routed to the first workflow that satisfies the version requested. If no valid workflow is found, the task will
be marked as a failure.
@constructor
@param {string} name - The name of the workflow.
@param ... | [
"Represents",
"a",
"single",
"named",
"decision",
"poller",
"where",
"all",
"workflow",
"versions",
"can",
"be",
"created",
".",
"Tasks",
"will",
"automaticly",
"be",
"routed",
"to",
"the",
"first",
"workflow",
"that",
"satisfies",
"the",
"version",
"requested",... | fe6183bf7097f84bef935e8d9c19463accc08ad6 | https://github.com/meltmedia/node-usher/blob/fe6183bf7097f84bef935e8d9c19463accc08ad6/lib/decider/poller.js#L33-L64 | train |
sorensen/configs | index.js | getInfo | function getInfo(d) {
var p = path.join(d, 'package.json')
return exists(p) ? require(p) : false
} | javascript | function getInfo(d) {
var p = path.join(d, 'package.json')
return exists(p) ? require(p) : false
} | [
"function",
"getInfo",
"(",
"d",
")",
"{",
"var",
"p",
"=",
"path",
".",
"join",
"(",
"d",
",",
"'package.json'",
")",
"return",
"exists",
"(",
"p",
")",
"?",
"require",
"(",
"p",
")",
":",
"false",
"}"
] | Find and load the `package.json` of the parent
@param {String} target directory
@returns {Object} package info | [
"Find",
"and",
"load",
"the",
"package",
".",
"json",
"of",
"the",
"parent"
] | 579d15081f47188749f4cf5efc527417809aeecb | https://github.com/sorensen/configs/blob/579d15081f47188749f4cf5efc527417809aeecb/index.js#L31-L34 | train |
sorensen/configs | index.js | getPath | function getPath() {
var p = info && info.config ? info.config : './config'
if (p.charAt(0) === '/') return p
return path.join(base, p)
} | javascript | function getPath() {
var p = info && info.config ? info.config : './config'
if (p.charAt(0) === '/') return p
return path.join(base, p)
} | [
"function",
"getPath",
"(",
")",
"{",
"var",
"p",
"=",
"info",
"&&",
"info",
".",
"config",
"?",
"info",
".",
"config",
":",
"'./config'",
"if",
"(",
"p",
".",
"charAt",
"(",
"0",
")",
"===",
"'/'",
")",
"return",
"p",
"return",
"path",
".",
"joi... | Determine the directory config from `package.info`, can
be relative to the project base or an absolute path
@returns {String} directory | [
"Determine",
"the",
"directory",
"config",
"from",
"package",
".",
"info",
"can",
"be",
"relative",
"to",
"the",
"project",
"base",
"or",
"an",
"absolute",
"path"
] | 579d15081f47188749f4cf5efc527417809aeecb | https://github.com/sorensen/configs/blob/579d15081f47188749f4cf5efc527417809aeecb/index.js#L43-L47 | train |
sorensen/configs | index.js | pathExtend | function pathExtend(p) {
if (!exists(p)) return false
loaded.push(p)
return extend(config, require(p))
} | javascript | function pathExtend(p) {
if (!exists(p)) return false
loaded.push(p)
return extend(config, require(p))
} | [
"function",
"pathExtend",
"(",
"p",
")",
"{",
"if",
"(",
"!",
"exists",
"(",
"p",
")",
")",
"return",
"false",
"loaded",
".",
"push",
"(",
"p",
")",
"return",
"extend",
"(",
"config",
",",
"require",
"(",
"p",
")",
")",
"}"
] | Check if a path exists and extend the config if so
@param {String} path
@returns {Object} extened config | [
"Check",
"if",
"a",
"path",
"exists",
"and",
"extend",
"the",
"config",
"if",
"so"
] | 579d15081f47188749f4cf5efc527417809aeecb | https://github.com/sorensen/configs/blob/579d15081f47188749f4cf5efc527417809aeecb/index.js#L56-L60 | train |
ClinicalSoftwareSolutions/stackmob-client | stackmob-js-0.9.2.js | function(options, methods){
options = options || {};
// Wrap yes/no methods with a success method
options['success'] = function(result){
if ( methods['isValidResult'](result) ){
if (typeof methods['yes'] === "function") methods['yes'](result);
} else {
if (typeof m... | javascript | function(options, methods){
options = options || {};
// Wrap yes/no methods with a success method
options['success'] = function(result){
if ( methods['isValidResult'](result) ){
if (typeof methods['yes'] === "function") methods['yes'](result);
} else {
if (typeof m... | [
"function",
"(",
"options",
",",
"methods",
")",
"{",
"options",
"=",
"options",
"||",
"{",
"}",
";",
"// Wrap yes/no methods with a success method",
"options",
"[",
"'success'",
"]",
"=",
"function",
"(",
"result",
")",
"{",
"if",
"(",
"methods",
"[",
"'isV... | Helper method to allow altering callback methods | [
"Helper",
"method",
"to",
"allow",
"altering",
"callback",
"methods"
] | 9ee3ddbdf4172b4ed826283bb7d855b6ee22f67a | https://github.com/ClinicalSoftwareSolutions/stackmob-client/blob/9ee3ddbdf4172b4ed826283bb7d855b6ee22f67a/stackmob-js-0.9.2.js#L127-L145 | train | |
ClinicalSoftwareSolutions/stackmob-client | stackmob-js-0.9.2.js | function(username, options) {
if ( this._containsCallbacks(options, ['yes', 'no']) ){
options = this._generateCallbacks(options, {
'isValidResult': function(result) {
return result == username;
},
'yes': options['yes'],
'no': options['no'],
'er... | javascript | function(username, options) {
if ( this._containsCallbacks(options, ['yes', 'no']) ){
options = this._generateCallbacks(options, {
'isValidResult': function(result) {
return result == username;
},
'yes': options['yes'],
'no': options['no'],
'er... | [
"function",
"(",
"username",
",",
"options",
")",
"{",
"if",
"(",
"this",
".",
"_containsCallbacks",
"(",
"options",
",",
"[",
"'yes'",
",",
"'no'",
"]",
")",
")",
"{",
"options",
"=",
"this",
".",
"_generateCallbacks",
"(",
"options",
",",
"{",
"'isVa... | Without specifying the 'options' argument, this is a "dumb" method in that simply checks if the given `username` is that of the logged in user without asking the server.
Optionally accepts asynchronous callback methods in the options object. When provided, this method will renew the refresh token if required. | [
"Without",
"specifying",
"the",
"options",
"argument",
"this",
"is",
"a",
"dumb",
"method",
"in",
"that",
"simply",
"checks",
"if",
"the",
"given",
"username",
"is",
"that",
"of",
"the",
"logged",
"in",
"user",
"without",
"asking",
"the",
"server",
"."
] | 9ee3ddbdf4172b4ed826283bb7d855b6ee22f67a | https://github.com/ClinicalSoftwareSolutions/stackmob-client/blob/9ee3ddbdf4172b4ed826283bb7d855b6ee22f67a/stackmob-js-0.9.2.js#L196-L210 | train | |
ClinicalSoftwareSolutions/stackmob-client | stackmob-js-0.9.2.js | function() {
if( StackMob['useRelativePathForAjax'] ){
// Build "relative path" (also used for OAuth signing)
return StackMob.apiDomain ? StackMob.apiDomain : (this.getHostname() + (this.getPort() ? ':' + this.getPort() : '')) + '/';
} else {
// Use absolute path and operate through ... | javascript | function() {
if( StackMob['useRelativePathForAjax'] ){
// Build "relative path" (also used for OAuth signing)
return StackMob.apiDomain ? StackMob.apiDomain : (this.getHostname() + (this.getPort() ? ':' + this.getPort() : '')) + '/';
} else {
// Use absolute path and operate through ... | [
"function",
"(",
")",
"{",
"if",
"(",
"StackMob",
"[",
"'useRelativePathForAjax'",
"]",
")",
"{",
"// Build \"relative path\" (also used for OAuth signing)",
"return",
"StackMob",
".",
"apiDomain",
"?",
"StackMob",
".",
"apiDomain",
":",
"(",
"this",
".",
"getHostna... | This is an internally used method to get the API URL no matter what the context - development, production, etc. This envelopes `getDevAPIBase` and `getProdAPIBase` in that this method is smart enough to choose which of the URLs to use. | [
"This",
"is",
"an",
"internally",
"used",
"method",
"to",
"get",
"the",
"API",
"URL",
"no",
"matter",
"what",
"the",
"context",
"-",
"development",
"production",
"etc",
".",
"This",
"envelopes",
"getDevAPIBase",
"and",
"getProdAPIBase",
"in",
"that",
"this",
... | 9ee3ddbdf4172b4ed826283bb7d855b6ee22f67a | https://github.com/ClinicalSoftwareSolutions/stackmob-client/blob/9ee3ddbdf4172b4ed826283bb7d855b6ee22f67a/stackmob-js-0.9.2.js#L234-L242 | train | |
ClinicalSoftwareSolutions/stackmob-client | stackmob-js-0.9.2.js | function(options) {
options = options || {};
//If we aren't running in OAuth 2.0 mode, then kick out early.
if(!this.isOAuth2Mode()){
if (options && options['error'])
options['error']();
return false;
}
//Check to see if we have all the necessary OAuth 2.0 crede... | javascript | function(options) {
options = options || {};
//If we aren't running in OAuth 2.0 mode, then kick out early.
if(!this.isOAuth2Mode()){
if (options && options['error'])
options['error']();
return false;
}
//Check to see if we have all the necessary OAuth 2.0 crede... | [
"function",
"(",
"options",
")",
"{",
"options",
"=",
"options",
"||",
"{",
"}",
";",
"//If we aren't running in OAuth 2.0 mode, then kick out early.",
"if",
"(",
"!",
"this",
".",
"isOAuth2Mode",
"(",
")",
")",
"{",
"if",
"(",
"options",
"&&",
"options",
"[",... | StackMob validates OAuth 2.0 credentials upon each request and will send back a error message if the credentials have expired. To save the trip, developers can check to see if their user has valid OAuth 2.0 credentials that indicate the user is logged in. | [
"StackMob",
"validates",
"OAuth",
"2",
".",
"0",
"credentials",
"upon",
"each",
"request",
"and",
"will",
"send",
"back",
"a",
"error",
"message",
"if",
"the",
"credentials",
"have",
"expired",
".",
"To",
"save",
"the",
"trip",
"developers",
"can",
"check",
... | 9ee3ddbdf4172b4ed826283bb7d855b6ee22f67a | https://github.com/ClinicalSoftwareSolutions/stackmob-client/blob/9ee3ddbdf4172b4ed826283bb7d855b6ee22f67a/stackmob-js-0.9.2.js#L298-L340 | train | |
ClinicalSoftwareSolutions/stackmob-client | stackmob-js-0.9.2.js | function() {
var oauth_accessToken = StackMob.Storage.retrieve('oauth2.accessToken');
var oauth_macKey = StackMob.Storage.retrieve('oauth2.macKey');
var oauth_expires = StackMob.Storage.retrieve('oauth2.expires');
var oauth_refreshToken = StackMob.Storage.retrieve(StackMob.REFRESH_TOKEN_KEY);
... | javascript | function() {
var oauth_accessToken = StackMob.Storage.retrieve('oauth2.accessToken');
var oauth_macKey = StackMob.Storage.retrieve('oauth2.macKey');
var oauth_expires = StackMob.Storage.retrieve('oauth2.expires');
var oauth_refreshToken = StackMob.Storage.retrieve(StackMob.REFRESH_TOKEN_KEY);
... | [
"function",
"(",
")",
"{",
"var",
"oauth_accessToken",
"=",
"StackMob",
".",
"Storage",
".",
"retrieve",
"(",
"'oauth2.accessToken'",
")",
";",
"var",
"oauth_macKey",
"=",
"StackMob",
".",
"Storage",
".",
"retrieve",
"(",
"'oauth2.macKey'",
")",
";",
"var",
... | Retrieve the OAuth 2.0 credentials from client storage. | [
"Retrieve",
"the",
"OAuth",
"2",
".",
"0",
"credentials",
"from",
"client",
"storage",
"."
] | 9ee3ddbdf4172b4ed826283bb7d855b6ee22f67a | https://github.com/ClinicalSoftwareSolutions/stackmob-client/blob/9ee3ddbdf4172b4ed826283bb7d855b6ee22f67a/stackmob-js-0.9.2.js#L376-L402 | train | |
ClinicalSoftwareSolutions/stackmob-client | stackmob-js-0.9.2.js | function(options) {
options = options || {};
// Run stuff before StackMob is initialized.
this.initStart(options);
/* DEPRECATED METHODS BELOW */
this.userSchema = options['userSchema']; // DEPRECATED: Use StackMob.User.extend({ schemaName: 'customschemaname' });
this.login... | javascript | function(options) {
options = options || {};
// Run stuff before StackMob is initialized.
this.initStart(options);
/* DEPRECATED METHODS BELOW */
this.userSchema = options['userSchema']; // DEPRECATED: Use StackMob.User.extend({ schemaName: 'customschemaname' });
this.login... | [
"function",
"(",
"options",
")",
"{",
"options",
"=",
"options",
"||",
"{",
"}",
";",
"// Run stuff before StackMob is initialized.",
"this",
".",
"initStart",
"(",
"options",
")",
";",
"/* DEPRECATED METHODS BELOW */",
"this",
".",
"userSchema",
"=",
"options",
"... | Externally called by user to initialize their StackMob config. | [
"Externally",
"called",
"by",
"user",
"to",
"initialize",
"their",
"StackMob",
"config",
"."
] | 9ee3ddbdf4172b4ed826283bb7d855b6ee22f67a | https://github.com/ClinicalSoftwareSolutions/stackmob-client/blob/9ee3ddbdf4172b4ed826283bb7d855b6ee22f67a/stackmob-js-0.9.2.js#L455-L537 | train | |
ClinicalSoftwareSolutions/stackmob-client | stackmob-js-0.9.2.js | function(facebookAccessToken, options) {
options = options || {};
options['data'] = options['data'] || {};
_.extend(options['data'], {
"fb_at" : facebookAccessToken,
"token_type" : "mac"
});
(this.sync || Backbone.sync).call(this, "linkUserWithFacebook", this... | javascript | function(facebookAccessToken, options) {
options = options || {};
options['data'] = options['data'] || {};
_.extend(options['data'], {
"fb_at" : facebookAccessToken,
"token_type" : "mac"
});
(this.sync || Backbone.sync).call(this, "linkUserWithFacebook", this... | [
"function",
"(",
"facebookAccessToken",
",",
"options",
")",
"{",
"options",
"=",
"options",
"||",
"{",
"}",
";",
"options",
"[",
"'data'",
"]",
"=",
"options",
"[",
"'data'",
"]",
"||",
"{",
"}",
";",
"_",
".",
"extend",
"(",
"options",
"[",
"'data'... | Use after a user has logged in with a regular user account and you want to add Facebook to their account | [
"Use",
"after",
"a",
"user",
"has",
"logged",
"in",
"with",
"a",
"regular",
"user",
"account",
"and",
"you",
"want",
"to",
"add",
"Facebook",
"to",
"their",
"account"
] | 9ee3ddbdf4172b4ed826283bb7d855b6ee22f67a | https://github.com/ClinicalSoftwareSolutions/stackmob-client/blob/9ee3ddbdf4172b4ed826283bb7d855b6ee22f67a/stackmob-js-0.9.2.js#L1516-L1525 | train | |
ClinicalSoftwareSolutions/stackmob-client | stackmob-js-0.9.2.js | function(b){
/*
* Naming convention: A.or(B)
*/
if (typeof this.orId == "undefined"){
/*
* If A is a normal AND query:
* Clone A into newQuery
* Clear newQuery's params
* Assign OR Group# (1)
* Prefix A params with and[#... | javascript | function(b){
/*
* Naming convention: A.or(B)
*/
if (typeof this.orId == "undefined"){
/*
* If A is a normal AND query:
* Clone A into newQuery
* Clear newQuery's params
* Assign OR Group# (1)
* Prefix A params with and[#... | [
"function",
"(",
"b",
")",
"{",
"/*\n * Naming convention: A.or(B)\n */",
"if",
"(",
"typeof",
"this",
".",
"orId",
"==",
"\"undefined\"",
")",
"{",
"/*\n * If A is a normal AND query:\n * Clone A into newQuery\n * Clear newQuery's params... | Combine a Query with an OR operator between it and
the current Query object.
Example:
var isAged = new StackMob.Collection.Query().equals("age", "25");
var isNYC = new StackMob.Collection.Query().equals("location", "NYC");
var notJohn = new StackMob.Collection.Query().notEquals("name", "john");
var notMary = new St... | [
"Combine",
"a",
"Query",
"with",
"an",
"OR",
"operator",
"between",
"it",
"and",
"the",
"current",
"Query",
"object",
"."
] | 9ee3ddbdf4172b4ed826283bb7d855b6ee22f67a | https://github.com/ClinicalSoftwareSolutions/stackmob-client/blob/9ee3ddbdf4172b4ed826283bb7d855b6ee22f67a/stackmob-js-0.9.2.js#L1660-L1755 | train | |
ClinicalSoftwareSolutions/stackmob-client | stackmob-js-0.9.2.js | function(b){
/*
* Naming convention: A.or(B)
*
* Combine all params of a and b into one object
*/
var a = this;
var newQuery = this.clone();
for (var key in b['params']){
newQuery['params'][key] = b['params'][key];
}
return... | javascript | function(b){
/*
* Naming convention: A.or(B)
*
* Combine all params of a and b into one object
*/
var a = this;
var newQuery = this.clone();
for (var key in b['params']){
newQuery['params'][key] = b['params'][key];
}
return... | [
"function",
"(",
"b",
")",
"{",
"/*\n * Naming convention: A.or(B)\n *\n * Combine all params of a and b into one object\n */",
"var",
"a",
"=",
"this",
";",
"var",
"newQuery",
"=",
"this",
".",
"clone",
"(",
")",
";",
"for",
"(",
"var",
... | Combine a Query with an AND operator between it and
the current Query object.
Example:
var isAged = new StackMob.Collection.Query().equals("age", "25");
var isNYC = new StackMob.Collection.Query().equals("location", "NYC");
var notJohn = new StackMob.Collection.Query().notEquals("name", "john");
var notMary = new S... | [
"Combine",
"a",
"Query",
"with",
"an",
"AND",
"operator",
"between",
"it",
"and",
"the",
"current",
"Query",
"object",
"."
] | 9ee3ddbdf4172b4ed826283bb7d855b6ee22f67a | https://github.com/ClinicalSoftwareSolutions/stackmob-client/blob/9ee3ddbdf4172b4ed826283bb7d855b6ee22f67a/stackmob-js-0.9.2.js#L1772-L1787 | train | |
Lindurion/closure-pro-build | lib/js-builder.js | build | function build(
projectOptions, buildOptions, outDirsAsync, cssRenamingFileAsync) {
var inputFilesAsync = resolveInputsAsync(projectOptions);
return outDirsAsync.then(function(outDirs) {
var transitiveClosureDepsAsync =
closureDepCalculator.calcDeps(projectOptions, buildOptions, outDirs);
retur... | javascript | function build(
projectOptions, buildOptions, outDirsAsync, cssRenamingFileAsync) {
var inputFilesAsync = resolveInputsAsync(projectOptions);
return outDirsAsync.then(function(outDirs) {
var transitiveClosureDepsAsync =
closureDepCalculator.calcDeps(projectOptions, buildOptions, outDirs);
retur... | [
"function",
"build",
"(",
"projectOptions",
",",
"buildOptions",
",",
"outDirsAsync",
",",
"cssRenamingFileAsync",
")",
"{",
"var",
"inputFilesAsync",
"=",
"resolveInputsAsync",
"(",
"projectOptions",
")",
";",
"return",
"outDirsAsync",
".",
"then",
"(",
"function",... | Builds project JS as specified in the given options, using Closure JS
Compiler if required and assembling final output JS files.
@param {!Object} projectOptions Specifies the project input files; see
README.md for option documentation.
@param {!Object} buildOptions Specifies options specific to this build (like
debug/r... | [
"Builds",
"project",
"JS",
"as",
"specified",
"in",
"the",
"given",
"options",
"using",
"Closure",
"JS",
"Compiler",
"if",
"required",
"and",
"assembling",
"final",
"output",
"JS",
"files",
"."
] | c279d0fcc3a65969d2fe965f55e627b074792f1a | https://github.com/Lindurion/closure-pro-build/blob/c279d0fcc3a65969d2fe965f55e627b074792f1a/lib/js-builder.js#L43-L63 | train |
melnikov-s/anvoy | src/template.js | getNodesMetaData | function getNodesMetaData(rootEl) {
let elMeta = [];
let toVisit = [rootEl];
let current = {el: rootEl, path: [], isPre: $.tag(rootEl) === 'PRE'};
//generate paths for comment and text nodes. There's no way to quickly retrieve them
//need to deeply traverse the DOM tree
while (current) {
... | javascript | function getNodesMetaData(rootEl) {
let elMeta = [];
let toVisit = [rootEl];
let current = {el: rootEl, path: [], isPre: $.tag(rootEl) === 'PRE'};
//generate paths for comment and text nodes. There's no way to quickly retrieve them
//need to deeply traverse the DOM tree
while (current) {
... | [
"function",
"getNodesMetaData",
"(",
"rootEl",
")",
"{",
"let",
"elMeta",
"=",
"[",
"]",
";",
"let",
"toVisit",
"=",
"[",
"rootEl",
"]",
";",
"let",
"current",
"=",
"{",
"el",
":",
"rootEl",
",",
"path",
":",
"[",
"]",
",",
"isPre",
":",
"$",
"."... | gather meta data from a DOM element template. Only runs once per template and the resulting data can be applied to any cloned template. Primarly used to generate paths to non-static nodes within a cloned template. | [
"gather",
"meta",
"data",
"from",
"a",
"DOM",
"element",
"template",
".",
"Only",
"runs",
"once",
"per",
"template",
"and",
"the",
"resulting",
"data",
"can",
"be",
"applied",
"to",
"any",
"cloned",
"template",
".",
"Primarly",
"used",
"to",
"generate",
"p... | c0c5ff2a409004721a26bb9815d7cc7706b6c4e0 | https://github.com/melnikov-s/anvoy/blob/c0c5ff2a409004721a26bb9815d7cc7706b6c4e0/src/template.js#L141-L186 | train |
cli-kit/cli-mid-parser | index.js | getParserConfiguration | function getParserConfiguration(target, config) {
target = target || this;
config = config || {alias: {}, flags: [], options: []};
var k, arg, key
, conf = this.configure();
var no = /^\[?no\]?/, nor = /(\[no-?\]-?)/;
for(k in target._options) {
arg = target._options[k];
// misconfigured option,... | javascript | function getParserConfiguration(target, config) {
target = target || this;
config = config || {alias: {}, flags: [], options: []};
var k, arg, key
, conf = this.configure();
var no = /^\[?no\]?/, nor = /(\[no-?\]-?)/;
for(k in target._options) {
arg = target._options[k];
// misconfigured option,... | [
"function",
"getParserConfiguration",
"(",
"target",
",",
"config",
")",
"{",
"target",
"=",
"target",
"||",
"this",
";",
"config",
"=",
"config",
"||",
"{",
"alias",
":",
"{",
"}",
",",
"flags",
":",
"[",
"]",
",",
"options",
":",
"[",
"]",
"}",
"... | Retrieve a configuration suitable for passing to
the arguments parser. | [
"Retrieve",
"a",
"configuration",
"suitable",
"for",
"passing",
"to",
"the",
"arguments",
"parser",
"."
] | cfd6300eeb5cc69a33370c9b1a0978bbdce250bf | https://github.com/cli-kit/cli-mid-parser/blob/cfd6300eeb5cc69a33370c9b1a0978bbdce250bf/index.js#L8-L59 | train |
uxter/fluxter | src/fluxter.js | next | function next(actionData) {
index++;
if(index === store.middlewares.length) {
done(actionData);
} else {
store.middlewares[index](store, actionName, actionData, next);
}
} | javascript | function next(actionData) {
index++;
if(index === store.middlewares.length) {
done(actionData);
} else {
store.middlewares[index](store, actionName, actionData, next);
}
} | [
"function",
"next",
"(",
"actionData",
")",
"{",
"index",
"++",
";",
"if",
"(",
"index",
"===",
"store",
".",
"middlewares",
".",
"length",
")",
"{",
"done",
"(",
"actionData",
")",
";",
"}",
"else",
"{",
"store",
".",
"middlewares",
"[",
"index",
"]... | Call next middleware or done
@function next
@param {*} actionData - An action data | [
"Call",
"next",
"middleware",
"or",
"done"
] | f3a878c92ec3b3bab609515aca3ae8982d044ecd | https://github.com/uxter/fluxter/blob/f3a878c92ec3b3bab609515aca3ae8982d044ecd/src/fluxter.js#L158-L165 | train |
uxter/fluxter | src/fluxter.js | checkArgumentType | function checkArgumentType(argument, position, type) {
let wrongTypeOf = typeof argument !== type;
let isCheckObject = type === 'object';
let n = isCheckObject ? 'n' : '';
if (isCheckObject && (wrongTypeOf || argument.constructor !== Object) || wrongTypeOf) {
throw new TypeError('A ' + position ... | javascript | function checkArgumentType(argument, position, type) {
let wrongTypeOf = typeof argument !== type;
let isCheckObject = type === 'object';
let n = isCheckObject ? 'n' : '';
if (isCheckObject && (wrongTypeOf || argument.constructor !== Object) || wrongTypeOf) {
throw new TypeError('A ' + position ... | [
"function",
"checkArgumentType",
"(",
"argument",
",",
"position",
",",
"type",
")",
"{",
"let",
"wrongTypeOf",
"=",
"typeof",
"argument",
"!==",
"type",
";",
"let",
"isCheckObject",
"=",
"type",
"===",
"'object'",
";",
"let",
"n",
"=",
"isCheckObject",
"?",... | Check type of argument
@function checkArgumentType
@param {*} argument
@param {String} position - first, second, ...
@param {String} type - string, function, ...
@throws {TypeError}
@private | [
"Check",
"type",
"of",
"argument"
] | f3a878c92ec3b3bab609515aca3ae8982d044ecd | https://github.com/uxter/fluxter/blob/f3a878c92ec3b3bab609515aca3ae8982d044ecd/src/fluxter.js#L200-L207 | train |
N4SJAMK/jarmo-express | index.js | onResponseFinished | function onResponseFinished() {
// Resolve the payload from the 'request' and 'response' objects,
// and send it to the Jarmo server, catching any errors.
var payload = config.resolve(req, res, Date.now() - start);
if(!payload) {
// If the payload is falsy we don't send the data. This allows
// for... | javascript | function onResponseFinished() {
// Resolve the payload from the 'request' and 'response' objects,
// and send it to the Jarmo server, catching any errors.
var payload = config.resolve(req, res, Date.now() - start);
if(!payload) {
// If the payload is falsy we don't send the data. This allows
// for... | [
"function",
"onResponseFinished",
"(",
")",
"{",
"// Resolve the payload from the 'request' and 'response' objects,",
"// and send it to the Jarmo server, catching any errors.",
"var",
"payload",
"=",
"config",
".",
"resolve",
"(",
"req",
",",
"res",
",",
"Date",
".",
"now",
... | Get the data out of the request and response and send it to the
configured server. Also make sure to remove listeners when done. | [
"Get",
"the",
"data",
"out",
"of",
"the",
"request",
"and",
"response",
"and",
"send",
"it",
"to",
"the",
"configured",
"server",
".",
"Also",
"make",
"sure",
"to",
"remove",
"listeners",
"when",
"done",
"."
] | 42808d93ef29922f6a9a68fd3507d280c2a45a0f | https://github.com/N4SJAMK/jarmo-express/blob/42808d93ef29922f6a9a68fd3507d280c2a45a0f/index.js#L61-L78 | train |
N4SJAMK/jarmo-express | index.js | removeListeners | function removeListeners() {
res.removeListener('error', removeListeners);
res.removeListener('close', removeListeners);
res.removeListener('finish', onResponseFinished);
} | javascript | function removeListeners() {
res.removeListener('error', removeListeners);
res.removeListener('close', removeListeners);
res.removeListener('finish', onResponseFinished);
} | [
"function",
"removeListeners",
"(",
")",
"{",
"res",
".",
"removeListener",
"(",
"'error'",
",",
"removeListeners",
")",
";",
"res",
".",
"removeListener",
"(",
"'close'",
",",
"removeListeners",
")",
";",
"res",
".",
"removeListener",
"(",
"'finish'",
",",
... | Clean up listeners to prevent any memory shenanigans. | [
"Clean",
"up",
"listeners",
"to",
"prevent",
"any",
"memory",
"shenanigans",
"."
] | 42808d93ef29922f6a9a68fd3507d280c2a45a0f | https://github.com/N4SJAMK/jarmo-express/blob/42808d93ef29922f6a9a68fd3507d280c2a45a0f/index.js#L83-L87 | train |
N4SJAMK/jarmo-express | index.js | send | function send(host, port, payload, callback) {
// Create a Buffer of the JSON stringified payload, so we can send it.
var data = new Buffer(JSON.stringify(payload));
// Resolve or reject the promise once the we have at least attempted to
// send the payload. Should we add some sort of a retry on error?
return cli... | javascript | function send(host, port, payload, callback) {
// Create a Buffer of the JSON stringified payload, so we can send it.
var data = new Buffer(JSON.stringify(payload));
// Resolve or reject the promise once the we have at least attempted to
// send the payload. Should we add some sort of a retry on error?
return cli... | [
"function",
"send",
"(",
"host",
",",
"port",
",",
"payload",
",",
"callback",
")",
"{",
"// Create a Buffer of the JSON stringified payload, so we can send it.",
"var",
"data",
"=",
"new",
"Buffer",
"(",
"JSON",
".",
"stringify",
"(",
"payload",
")",
")",
";",
... | Send data via UDP to the target server.
@param {string} host Server host.
@param {string} port Server port.
@param {object} payload Payload object, that will be made into a string,
and sent to the server.
@return {Promise} Promise for sending the payload. | [
"Send",
"data",
"via",
"UDP",
"to",
"the",
"target",
"server",
"."
] | 42808d93ef29922f6a9a68fd3507d280c2a45a0f | https://github.com/N4SJAMK/jarmo-express/blob/42808d93ef29922f6a9a68fd3507d280c2a45a0f/index.js#L127-L134 | 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.