id int32 0 58k | repo stringlengths 5 67 | path stringlengths 4 116 | func_name stringlengths 0 58 | original_string stringlengths 52 373k | language stringclasses 1
value | code stringlengths 52 373k | code_tokens list | docstring stringlengths 4 11.8k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 86 226 |
|---|---|---|---|---|---|---|---|---|---|---|---|
31,000 | observing/square | lib/watch.js | getPath | function getPath(path, callback) {
fs.lstat(path, function(err, stats) {
if(err) return callback(err);
// Check if it's a link
if(stats.isSymbolicLink()) fs.readlink(path, callback);
callback(err, path);
});
} | javascript | function getPath(path, callback) {
fs.lstat(path, function(err, stats) {
if(err) return callback(err);
// Check if it's a link
if(stats.isSymbolicLink()) fs.readlink(path, callback);
callback(err, path);
});
} | [
"function",
"getPath",
"(",
"path",
",",
"callback",
")",
"{",
"fs",
".",
"lstat",
"(",
"path",
",",
"function",
"(",
"err",
",",
"stats",
")",
"{",
"if",
"(",
"err",
")",
"return",
"callback",
"(",
"err",
")",
";",
"// Check if it's a link",
"if",
"... | Helper for finder to also handle symlinks.
@param {String} path
@param {Function} callback
@api private | [
"Helper",
"for",
"finder",
"to",
"also",
"handle",
"symlinks",
"."
] | 0a801de3815526d0d5231976f666e97674312de2 | https://github.com/observing/square/blob/0a801de3815526d0d5231976f666e97674312de2/lib/watch.js#L48-L57 |
31,001 | observing/square | lib/watch.js | filter | function filter(location) {
var file = path.basename(location)
, vim = file.charAt(file.length - 1) === '~'
, extension = path.extname(location).slice(1);
// filter out the duplicates
if (~changes.indexOf(location) || vim) return;
changes.push(location);
process.nextTick(limited);
} | javascript | function filter(location) {
var file = path.basename(location)
, vim = file.charAt(file.length - 1) === '~'
, extension = path.extname(location).slice(1);
// filter out the duplicates
if (~changes.indexOf(location) || vim) return;
changes.push(location);
process.nextTick(limited);
} | [
"function",
"filter",
"(",
"location",
")",
"{",
"var",
"file",
"=",
"path",
".",
"basename",
"(",
"location",
")",
",",
"vim",
"=",
"file",
".",
"charAt",
"(",
"file",
".",
"length",
"-",
"1",
")",
"===",
"'~'",
",",
"extension",
"=",
"path",
".",... | Filter out the bad files and try to remove some noise. For example vim
generates some silly swap files in directories or other silly thumb files
The this context of this file will be set the current directory that we are
watching.
@param {String} file
@api private | [
"Filter",
"out",
"the",
"bad",
"files",
"and",
"try",
"to",
"remove",
"some",
"noise",
".",
"For",
"example",
"vim",
"generates",
"some",
"silly",
"swap",
"files",
"in",
"directories",
"or",
"other",
"silly",
"thumb",
"files"
] | 0a801de3815526d0d5231976f666e97674312de2 | https://github.com/observing/square/blob/0a801de3815526d0d5231976f666e97674312de2/lib/watch.js#L195-L205 |
31,002 | observing/square | plugins/update.js | done | function done(err, content) {
if (err) return cb(err);
var code = JSON.parse(self.square.package.source)
, current = bundle.version || self.version(bundle.meta.content)
, source;
code.bundle[key].version = version;
bundle.version = version;
... | javascript | function done(err, content) {
if (err) return cb(err);
var code = JSON.parse(self.square.package.source)
, current = bundle.version || self.version(bundle.meta.content)
, source;
code.bundle[key].version = version;
bundle.version = version;
... | [
"function",
"done",
"(",
"err",
",",
"content",
")",
"{",
"if",
"(",
"err",
")",
"return",
"cb",
"(",
"err",
")",
";",
"var",
"code",
"=",
"JSON",
".",
"parse",
"(",
"self",
".",
"square",
".",
"package",
".",
"source",
")",
",",
"current",
"=",
... | Handle file upgrades.
@param {Mixed} err
@param {String} content
@api private | [
"Handle",
"file",
"upgrades",
"."
] | 0a801de3815526d0d5231976f666e97674312de2 | https://github.com/observing/square/blob/0a801de3815526d0d5231976f666e97674312de2/plugins/update.js#L156-L187 |
31,003 | observing/square | plugins/lib/child.js | compile | function compile (extension, content, options, fn) {
// allow optional options argument
if (_.isFunction(options)) {
fn = options;
options = {};
}
var config = _.clone(compile.configuration)
, args = flags.slice(0)
, buffer = ''
, errors = ''
, compressor;
if (c... | javascript | function compile (extension, content, options, fn) {
// allow optional options argument
if (_.isFunction(options)) {
fn = options;
options = {};
}
var config = _.clone(compile.configuration)
, args = flags.slice(0)
, buffer = ''
, errors = ''
, compressor;
if (c... | [
"function",
"compile",
"(",
"extension",
",",
"content",
",",
"options",
",",
"fn",
")",
"{",
"// allow optional options argument",
"if",
"(",
"_",
".",
"isFunction",
"(",
"options",
")",
")",
"{",
"fn",
"=",
"options",
";",
"options",
"=",
"{",
"}",
";"... | Delegrate all the hard core processing to the vendor file.
@param {String} extension file extenstion
@param {String} content file contents
@param {Object} options options
@param {Function} fn error first callback
@api public | [
"Delegrate",
"all",
"the",
"hard",
"core",
"processing",
"to",
"the",
"vendor",
"file",
"."
] | 0a801de3815526d0d5231976f666e97674312de2 | https://github.com/observing/square/blob/0a801de3815526d0d5231976f666e97674312de2/plugins/lib/child.js#L31-L105 |
31,004 | observing/square | plugins/lib/crusher.js | message | function message(worker, task) {
var callback = worker.queue[task.id]
, err;
// Rebuild the Error object so we can pass it to our callbacks
if (task.err) {
err = new Error(task.err.message);
err.stack = task.err.stack;
}
// Kill the whole fucking system, we are in a fucked up sta... | javascript | function message(worker, task) {
var callback = worker.queue[task.id]
, err;
// Rebuild the Error object so we can pass it to our callbacks
if (task.err) {
err = new Error(task.err.message);
err.stack = task.err.stack;
}
// Kill the whole fucking system, we are in a fucked up sta... | [
"function",
"message",
"(",
"worker",
",",
"task",
")",
"{",
"var",
"callback",
"=",
"worker",
".",
"queue",
"[",
"task",
".",
"id",
"]",
",",
"err",
";",
"// Rebuild the Error object so we can pass it to our callbacks",
"if",
"(",
"task",
".",
"err",
")",
"... | Message handler for the workers.
@param {Worker} worker
@param {Error} err
@param {Object} task the updated task
@api private | [
"Message",
"handler",
"for",
"the",
"workers",
"."
] | 0a801de3815526d0d5231976f666e97674312de2 | https://github.com/observing/square/blob/0a801de3815526d0d5231976f666e97674312de2/plugins/lib/crusher.js#L264-L285 |
31,005 | observing/square | plugin.js | Plugin | function Plugin(square, collection) {
if (!(this instanceof Plugin)) return new Plugin(square, collection);
if (!square) throw new Error('Missing square instance');
if (!collection) throw new Error('Missing collection');
var self = this;
this.square = square; // Reference to the current square ins... | javascript | function Plugin(square, collection) {
if (!(this instanceof Plugin)) return new Plugin(square, collection);
if (!square) throw new Error('Missing square instance');
if (!collection) throw new Error('Missing collection');
var self = this;
this.square = square; // Reference to the current square ins... | [
"function",
"Plugin",
"(",
"square",
",",
"collection",
")",
"{",
"if",
"(",
"!",
"(",
"this",
"instanceof",
"Plugin",
")",
")",
"return",
"new",
"Plugin",
"(",
"square",
",",
"collection",
")",
";",
"if",
"(",
"!",
"square",
")",
"throw",
"new",
"Er... | Plugin interface for square.
@constructor
@param {Square} square
@param {Object} collection
@api public | [
"Plugin",
"interface",
"for",
"square",
"."
] | 0a801de3815526d0d5231976f666e97674312de2 | https://github.com/observing/square/blob/0a801de3815526d0d5231976f666e97674312de2/plugin.js#L32-L64 |
31,006 | observing/square | plugin.js | configure | function configure() {
var pkg = this.square.package
, configuration = pkg.configuration
, type = this.type || Plugin.modifier
, self = this
, load = [];
// Check for the distribution and if it should accept the given extension,
// extend self with the context of the p... | javascript | function configure() {
var pkg = this.square.package
, configuration = pkg.configuration
, type = this.type || Plugin.modifier
, self = this
, load = [];
// Check for the distribution and if it should accept the given extension,
// extend self with the context of the p... | [
"function",
"configure",
"(",
")",
"{",
"var",
"pkg",
"=",
"this",
".",
"square",
".",
"package",
",",
"configuration",
"=",
"pkg",
".",
"configuration",
",",
"type",
"=",
"this",
".",
"type",
"||",
"Plugin",
".",
"modifier",
",",
"self",
"=",
"this",
... | Configure the plugin, prepare all the things.
@api private | [
"Configure",
"the",
"plugin",
"prepare",
"all",
"the",
"things",
"."
] | 0a801de3815526d0d5231976f666e97674312de2 | https://github.com/observing/square/blob/0a801de3815526d0d5231976f666e97674312de2/plugin.js#L128-L196 |
31,007 | observing/square | plugins/lint.js | parser | function parser (content, options, fn) {
var jshintrc = path.join(process.env.HOME || process.env.USERPROFILE, '.jshintrc')
, jshintninja = configurator(jshintrc)
, config = options.jshint;
// extend all the things
config = _.extend(config, jshintninja);
canihaz.jshint(function... | javascript | function parser (content, options, fn) {
var jshintrc = path.join(process.env.HOME || process.env.USERPROFILE, '.jshintrc')
, jshintninja = configurator(jshintrc)
, config = options.jshint;
// extend all the things
config = _.extend(config, jshintninja);
canihaz.jshint(function... | [
"function",
"parser",
"(",
"content",
",",
"options",
",",
"fn",
")",
"{",
"var",
"jshintrc",
"=",
"path",
".",
"join",
"(",
"process",
".",
"env",
".",
"HOME",
"||",
"process",
".",
"env",
".",
"USERPROFILE",
",",
"'.jshintrc'",
")",
",",
"jshintninja... | JSHint the content
@param {String} content
@param {Object} options
@param {Function} fn
@api private | [
"JSHint",
"the",
"content"
] | 0a801de3815526d0d5231976f666e97674312de2 | https://github.com/observing/square/blob/0a801de3815526d0d5231976f666e97674312de2/plugins/lint.js#L127-L144 |
31,008 | observing/square | plugins/lint.js | formatter | function formatter (fail) {
return fail.map(function oops (err) {
return {
line: err.line
, column: err.character
, message: err.reason
, ref: err
};
});
} | javascript | function formatter (fail) {
return fail.map(function oops (err) {
return {
line: err.line
, column: err.character
, message: err.reason
, ref: err
};
});
} | [
"function",
"formatter",
"(",
"fail",
")",
"{",
"return",
"fail",
".",
"map",
"(",
"function",
"oops",
"(",
"err",
")",
"{",
"return",
"{",
"line",
":",
"err",
".",
"line",
",",
"column",
":",
"err",
".",
"character",
",",
"message",
":",
"err",
".... | Format the output of the jshint tool.
@param {Array} fail
@returns {Array}
@api private | [
"Format",
"the",
"output",
"of",
"the",
"jshint",
"tool",
"."
] | 0a801de3815526d0d5231976f666e97674312de2 | https://github.com/observing/square/blob/0a801de3815526d0d5231976f666e97674312de2/plugins/lint.js#L192-L201 |
31,009 | observing/square | plugins/lint.js | function (file, errors, options) {
var reports = []
, content = file.content.split('\n');
errors.forEach(function error (err) {
// some linters don't return the location -_-
if (!err.line) return reports.push(err.message.grey, '');
var start = err.line > 3 ? err.line - 3 : ... | javascript | function (file, errors, options) {
var reports = []
, content = file.content.split('\n');
errors.forEach(function error (err) {
// some linters don't return the location -_-
if (!err.line) return reports.push(err.message.grey, '');
var start = err.line > 3 ? err.line - 3 : ... | [
"function",
"(",
"file",
",",
"errors",
",",
"options",
")",
"{",
"var",
"reports",
"=",
"[",
"]",
",",
"content",
"=",
"file",
".",
"content",
".",
"split",
"(",
"'\\n'",
")",
";",
"errors",
".",
"forEach",
"(",
"function",
"error",
"(",
"err",
")... | Simple output of the errors in a human readable fashion.
@param {Object} file
@param {Array} errors
@api pprivate | [
"Simple",
"output",
"of",
"the",
"errors",
"in",
"a",
"human",
"readable",
"fashion",
"."
] | 0a801de3815526d0d5231976f666e97674312de2 | https://github.com/observing/square/blob/0a801de3815526d0d5231976f666e97674312de2/plugins/lint.js#L238-L293 | |
31,010 | observing/square | plugins/lint.js | configurator | function configurator (location) {
return !(location && fs.existsSync(location))
? {}
: JSON.parse(
fs.readFileSync(location, 'UTF-8')
.replace(/\/\*[\s\S]*(?:\*\/)/g, '') // removes /* comments */
.replace(/\/\/[^\n\r]*/g, '') // removes // comments
);
} | javascript | function configurator (location) {
return !(location && fs.existsSync(location))
? {}
: JSON.parse(
fs.readFileSync(location, 'UTF-8')
.replace(/\/\*[\s\S]*(?:\*\/)/g, '') // removes /* comments */
.replace(/\/\/[^\n\r]*/g, '') // removes // comments
);
} | [
"function",
"configurator",
"(",
"location",
")",
"{",
"return",
"!",
"(",
"location",
"&&",
"fs",
".",
"existsSync",
"(",
"location",
")",
")",
"?",
"{",
"}",
":",
"JSON",
".",
"parse",
"(",
"fs",
".",
"readFileSync",
"(",
"location",
",",
"'UTF-8'",
... | Simple configuration parser, which is less strict then a regular JSON parser.
@param {String} path
@returns {Object} | [
"Simple",
"configuration",
"parser",
"which",
"is",
"less",
"strict",
"then",
"a",
"regular",
"JSON",
"parser",
"."
] | 0a801de3815526d0d5231976f666e97674312de2 | https://github.com/observing/square/blob/0a801de3815526d0d5231976f666e97674312de2/plugins/lint.js#L317-L325 |
31,011 | SilentCicero/ipfs-mini | src/index.js | createBoundary | function createBoundary(data) {
while (true) {
var boundary = `----IPFSMini${Math.random() * 100000}.${Math.random() * 100000}`;
if (data.indexOf(boundary) === -1) {
return boundary;
}
}
} | javascript | function createBoundary(data) {
while (true) {
var boundary = `----IPFSMini${Math.random() * 100000}.${Math.random() * 100000}`;
if (data.indexOf(boundary) === -1) {
return boundary;
}
}
} | [
"function",
"createBoundary",
"(",
"data",
")",
"{",
"while",
"(",
"true",
")",
"{",
"var",
"boundary",
"=",
"`",
"${",
"Math",
".",
"random",
"(",
")",
"*",
"100000",
"}",
"${",
"Math",
".",
"random",
"(",
")",
"*",
"100000",
"}",
"`",
";",
"if"... | creates a boundary that isn't part of the payload | [
"creates",
"a",
"boundary",
"that",
"isn",
"t",
"part",
"of",
"the",
"payload"
] | 8a007116995ec84e26901b6bd3eb119c6b06aca7 | https://github.com/SilentCicero/ipfs-mini/blob/8a007116995ec84e26901b6bd3eb119c6b06aca7/src/index.js#L102-L109 |
31,012 | larvit/larvitimages | index.js | returnFile | function returnFile(cb) {
fs.readFile(fileToLoad, function (err, fileBuf) {
if (err || ! fileBuf) {
createFile(function (err) {
if (err) return cb(err);
returnFile(cb);
});
return;
}
cb(null, fileBuf, fileToLoad);
});
} | javascript | function returnFile(cb) {
fs.readFile(fileToLoad, function (err, fileBuf) {
if (err || ! fileBuf) {
createFile(function (err) {
if (err) return cb(err);
returnFile(cb);
});
return;
}
cb(null, fileBuf, fileToLoad);
});
} | [
"function",
"returnFile",
"(",
"cb",
")",
"{",
"fs",
".",
"readFile",
"(",
"fileToLoad",
",",
"function",
"(",
"err",
",",
"fileBuf",
")",
"{",
"if",
"(",
"err",
"||",
"!",
"fileBuf",
")",
"{",
"createFile",
"(",
"function",
"(",
"err",
")",
"{",
"... | Check if cached file exists, and if so, return it | [
"Check",
"if",
"cached",
"file",
"exists",
"and",
"if",
"so",
"return",
"it"
] | 6f918fc7d6e6e932fb177d9d42106fd6c3daffa1 | https://github.com/larvit/larvitimages/blob/6f918fc7d6e6e932fb177d9d42106fd6c3daffa1/index.js#L340-L351 |
31,013 | nico3333fr/van11y-accessible-modal-window-aria | dist/van11y-accessible-modal-window-aria.js | createOverlay | function createOverlay(config) {
var id = MODAL_OVERLAY_ID;
var overlayText = config.text || MODAL_OVERLAY_TXT;
var overlayClass = config.prefixClass + MODAL_OVERLAY_CLASS_SUFFIX;
var overlayBackgroundEnabled = config.backgroundEnabled === 'disabled' ? 'disabled' : 'enabled';
return '<span\n ... | javascript | function createOverlay(config) {
var id = MODAL_OVERLAY_ID;
var overlayText = config.text || MODAL_OVERLAY_TXT;
var overlayClass = config.prefixClass + MODAL_OVERLAY_CLASS_SUFFIX;
var overlayBackgroundEnabled = config.backgroundEnabled === 'disabled' ? 'disabled' : 'enabled';
return '<span\n ... | [
"function",
"createOverlay",
"(",
"config",
")",
"{",
"var",
"id",
"=",
"MODAL_OVERLAY_ID",
";",
"var",
"overlayText",
"=",
"config",
".",
"text",
"||",
"MODAL_OVERLAY_TXT",
";",
"var",
"overlayClass",
"=",
"config",
".",
"prefixClass",
"+",
"MODAL_OVERLAY_CLASS... | Create the template for an overlay
@param {Object} config
@return {String} | [
"Create",
"the",
"template",
"for",
"an",
"overlay"
] | 77b6075aa50fde0ddd41f2c59d4c0b79fb01dcd9 | https://github.com/nico3333fr/van11y-accessible-modal-window-aria/blob/77b6075aa50fde0ddd41f2c59d4c0b79fb01dcd9/dist/van11y-accessible-modal-window-aria.js#L133-L141 |
31,014 | nico3333fr/van11y-accessible-modal-window-aria | dist/van11y-accessible-modal-window-aria.js | createModal | function createModal(config) {
var id = MODAL_JS_ID;
var modalClassName = config.modalPrefixClass + MODAL_CLASS_SUFFIX;
var modalClassWrapper = config.modalPrefixClass + MODAL_WRAPPER_CLASS_SUFFIX;
var buttonCloseClassName = config.modalPrefixClass + MODAL_BUTTON_CLASS_SUFFIX;
var buttonCloseInner ... | javascript | function createModal(config) {
var id = MODAL_JS_ID;
var modalClassName = config.modalPrefixClass + MODAL_CLASS_SUFFIX;
var modalClassWrapper = config.modalPrefixClass + MODAL_WRAPPER_CLASS_SUFFIX;
var buttonCloseClassName = config.modalPrefixClass + MODAL_BUTTON_CLASS_SUFFIX;
var buttonCloseInner ... | [
"function",
"createModal",
"(",
"config",
")",
"{",
"var",
"id",
"=",
"MODAL_JS_ID",
";",
"var",
"modalClassName",
"=",
"config",
".",
"modalPrefixClass",
"+",
"MODAL_CLASS_SUFFIX",
";",
"var",
"modalClassWrapper",
"=",
"config",
".",
"modalPrefixClass",
"+",
"M... | Create the template for a modal
@param {Object} config
@return {String} | [
"Create",
"the",
"template",
"for",
"a",
"modal"
] | 77b6075aa50fde0ddd41f2c59d4c0b79fb01dcd9 | https://github.com/nico3333fr/van11y-accessible-modal-window-aria/blob/77b6075aa50fde0ddd41f2c59d4c0b79fb01dcd9/dist/van11y-accessible-modal-window-aria.js#L148-L173 |
31,015 | nico3333fr/van11y-accessible-modal-window-aria | dist/van11y-accessible-modal-window-aria.js | $listModals | function $listModals() {
var node = arguments.length <= 0 || arguments[0] === undefined ? doc : arguments[0];
return [].slice.call(node.querySelectorAll('.' + MODAL_JS_CLASS));
} | javascript | function $listModals() {
var node = arguments.length <= 0 || arguments[0] === undefined ? doc : arguments[0];
return [].slice.call(node.querySelectorAll('.' + MODAL_JS_CLASS));
} | [
"function",
"$listModals",
"(",
")",
"{",
"var",
"node",
"=",
"arguments",
".",
"length",
"<=",
"0",
"||",
"arguments",
"[",
"0",
"]",
"===",
"undefined",
"?",
"doc",
":",
"arguments",
"[",
"0",
"]",
";",
"return",
"[",
"]",
".",
"slice",
".",
"cal... | Find all modals inside a container
@param {Node} node Default document
@return {Array} | [
"Find",
"all",
"modals",
"inside",
"a",
"container"
] | 77b6075aa50fde0ddd41f2c59d4c0b79fb01dcd9 | https://github.com/nico3333fr/van11y-accessible-modal-window-aria/blob/77b6075aa50fde0ddd41f2c59d4c0b79fb01dcd9/dist/van11y-accessible-modal-window-aria.js#L199-L202 |
31,016 | dcodeIO/MetaScript | MetaScript.js | function(sourceOrProgram, filename) {
if (!(this instanceof MetaScript)) {
__version = Array.prototype.join.call(arguments, '.');
return;
}
// Whether constructing from a meta program or, otherwise, a source
var isProgram = (sourceOrProgram+="").... | javascript | function(sourceOrProgram, filename) {
if (!(this instanceof MetaScript)) {
__version = Array.prototype.join.call(arguments, '.');
return;
}
// Whether constructing from a meta program or, otherwise, a source
var isProgram = (sourceOrProgram+="").... | [
"function",
"(",
"sourceOrProgram",
",",
"filename",
")",
"{",
"if",
"(",
"!",
"(",
"this",
"instanceof",
"MetaScript",
")",
")",
"{",
"__version",
"=",
"Array",
".",
"prototype",
".",
"join",
".",
"call",
"(",
"arguments",
",",
"'.'",
")",
";",
"retur... | Constructs a new MetaScript instance.
@exports MetaScript
@param {string} sourceOrProgram Source to compile or meta program to run
@param {string=} filename Source file name if known, defaults to `"main"`.
@constructor | [
"Constructs",
"a",
"new",
"MetaScript",
"instance",
"."
] | dc7caf5eae2f2b2467f6c6467203dbcd05f23549 | https://github.com/dcodeIO/MetaScript/blob/dc7caf5eae2f2b2467f6c6467203dbcd05f23549/MetaScript.js#L38-L65 | |
31,017 | dcodeIO/MetaScript | MetaScript.js | evaluate | function evaluate(expr) {
if (expr.substring(0, 2) === '==') {
return 'write(JSON.stringify('+expr.substring(2).trim()+'));\n';
} else if (expr.substring(0, 1) === '=') {
return 'write('+expr.substring(1).trim()+');\n';
} else if (expr.substring(0, 3) ... | javascript | function evaluate(expr) {
if (expr.substring(0, 2) === '==') {
return 'write(JSON.stringify('+expr.substring(2).trim()+'));\n';
} else if (expr.substring(0, 1) === '=') {
return 'write('+expr.substring(1).trim()+');\n';
} else if (expr.substring(0, 3) ... | [
"function",
"evaluate",
"(",
"expr",
")",
"{",
"if",
"(",
"expr",
".",
"substring",
"(",
"0",
",",
"2",
")",
"===",
"'=='",
")",
"{",
"return",
"'write(JSON.stringify('",
"+",
"expr",
".",
"substring",
"(",
"2",
")",
".",
"trim",
"(",
")",
"+",
"')... | Evaluates a meta expression | [
"Evaluates",
"a",
"meta",
"expression"
] | dc7caf5eae2f2b2467f6c6467203dbcd05f23549 | https://github.com/dcodeIO/MetaScript/blob/dc7caf5eae2f2b2467f6c6467203dbcd05f23549/MetaScript.js#L103-L115 |
31,018 | dcodeIO/MetaScript | MetaScript.js | append | function append(source) {
if (s === '') return;
var index = 0,
expr = /\n/g,
s,
match;
while (match = expr.exec(source)) {
s = source.substring(index, match.index+1);
if (s !== '') out.push(' write(\''+e... | javascript | function append(source) {
if (s === '') return;
var index = 0,
expr = /\n/g,
s,
match;
while (match = expr.exec(source)) {
s = source.substring(index, match.index+1);
if (s !== '') out.push(' write(\''+e... | [
"function",
"append",
"(",
"source",
")",
"{",
"if",
"(",
"s",
"===",
"''",
")",
"return",
";",
"var",
"index",
"=",
"0",
",",
"expr",
"=",
"/",
"\\n",
"/",
"g",
",",
"s",
",",
"match",
";",
"while",
"(",
"match",
"=",
"expr",
".",
"exec",
"(... | Appends additional content to the program, if not empty | [
"Appends",
"additional",
"content",
"to",
"the",
"program",
"if",
"not",
"empty"
] | dc7caf5eae2f2b2467f6c6467203dbcd05f23549 | https://github.com/dcodeIO/MetaScript/blob/dc7caf5eae2f2b2467f6c6467203dbcd05f23549/MetaScript.js#L118-L131 |
31,019 | dcodeIO/MetaScript | MetaScript.js | indent | function indent(str, indent) {
if (typeof indent === 'number') {
var indent_str = '';
while (indent_str.length < indent) indent_str += ' ';
indent = indent_str;
}
var lines = str.split(/\n/);
for (var i=0; i<lines.length; i+... | javascript | function indent(str, indent) {
if (typeof indent === 'number') {
var indent_str = '';
while (indent_str.length < indent) indent_str += ' ';
indent = indent_str;
}
var lines = str.split(/\n/);
for (var i=0; i<lines.length; i+... | [
"function",
"indent",
"(",
"str",
",",
"indent",
")",
"{",
"if",
"(",
"typeof",
"indent",
"===",
"'number'",
")",
"{",
"var",
"indent_str",
"=",
"''",
";",
"while",
"(",
"indent_str",
".",
"length",
"<",
"indent",
")",
"indent_str",
"+=",
"' '",
";",
... | Indents a block of text.
@function indent
@param {string} str Text to indent
@param {string|number} indent Whitespace text to use for indentation or the number of whitespaces to use
@returns {string} Indented text | [
"Indents",
"a",
"block",
"of",
"text",
"."
] | dc7caf5eae2f2b2467f6c6467203dbcd05f23549 | https://github.com/dcodeIO/MetaScript/blob/dc7caf5eae2f2b2467f6c6467203dbcd05f23549/MetaScript.js#L317-L329 |
31,020 | dcodeIO/MetaScript | MetaScript.js | include | function include(filename, absolute) {
filename = absolute
? filename
: __dirname + '/' + filename;
var _program = __program, // Previous meta program
_source = __source, // Previous source
_filename = __filename, // Previous ... | javascript | function include(filename, absolute) {
filename = absolute
? filename
: __dirname + '/' + filename;
var _program = __program, // Previous meta program
_source = __source, // Previous source
_filename = __filename, // Previous ... | [
"function",
"include",
"(",
"filename",
",",
"absolute",
")",
"{",
"filename",
"=",
"absolute",
"?",
"filename",
":",
"__dirname",
"+",
"'/'",
"+",
"filename",
";",
"var",
"_program",
"=",
"__program",
",",
"// Previous meta program",
"_source",
"=",
"__source... | Includes another source file.
@function include
@param {string} filename File to include. May be a glob expression on node.js.
@param {boolean} absolute Whether the path is absolute, defaults to `false` for a relative path | [
"Includes",
"another",
"source",
"file",
"."
] | dc7caf5eae2f2b2467f6c6467203dbcd05f23549 | https://github.com/dcodeIO/MetaScript/blob/dc7caf5eae2f2b2467f6c6467203dbcd05f23549/MetaScript.js#L337-L366 |
31,021 | dcodeIO/MetaScript | MetaScript.js | escapestr | function escapestr(s) {
return s.replace(/\\/g, '\\\\')
.replace(/'/g, '\\\'')
.replace(/"/g, '\\"')
.replace(/\r/g, '\\r')
.replace(/\n/g, '\\n');
} | javascript | function escapestr(s) {
return s.replace(/\\/g, '\\\\')
.replace(/'/g, '\\\'')
.replace(/"/g, '\\"')
.replace(/\r/g, '\\r')
.replace(/\n/g, '\\n');
} | [
"function",
"escapestr",
"(",
"s",
")",
"{",
"return",
"s",
".",
"replace",
"(",
"/",
"\\\\",
"/",
"g",
",",
"'\\\\\\\\'",
")",
".",
"replace",
"(",
"/",
"'",
"/",
"g",
",",
"'\\\\\\''",
")",
".",
"replace",
"(",
"/",
"\"",
"/",
"g",
",",
"'\\\... | Escaoes a string to be used inside of a single or double quote enclosed JavaScript string.
@function escapestr
@param {string} s String to escape
@returns {string} Escaped string | [
"Escaoes",
"a",
"string",
"to",
"be",
"used",
"inside",
"of",
"a",
"single",
"or",
"double",
"quote",
"enclosed",
"JavaScript",
"string",
"."
] | dc7caf5eae2f2b2467f6c6467203dbcd05f23549 | https://github.com/dcodeIO/MetaScript/blob/dc7caf5eae2f2b2467f6c6467203dbcd05f23549/MetaScript.js#L374-L380 |
31,022 | dcodeIO/MetaScript | MetaScript.js | __err2code | function __err2code(program, err) {
if (typeof err.stack !== 'string')
return indent(program, 4);
var match = /<anonymous>:(\d+):(\d+)\)/.exec(err.stack);
if (!match) {
return indent(program, 4);
}
var line = parseInt(match[1], ... | javascript | function __err2code(program, err) {
if (typeof err.stack !== 'string')
return indent(program, 4);
var match = /<anonymous>:(\d+):(\d+)\)/.exec(err.stack);
if (!match) {
return indent(program, 4);
}
var line = parseInt(match[1], ... | [
"function",
"__err2code",
"(",
"program",
",",
"err",
")",
"{",
"if",
"(",
"typeof",
"err",
".",
"stack",
"!==",
"'string'",
")",
"return",
"indent",
"(",
"program",
",",
"4",
")",
";",
"var",
"match",
"=",
"/",
"<anonymous>:(\\d+):(\\d+)\\)",
"/",
".",
... | Generates a code view of eval'ed code from an Error.
@param {string} program Failed program
@param {!Error} err Error caught
@returns {string} Code view
@inner
@private | [
"Generates",
"a",
"code",
"view",
"of",
"eval",
"ed",
"code",
"from",
"an",
"Error",
"."
] | dc7caf5eae2f2b2467f6c6467203dbcd05f23549 | https://github.com/dcodeIO/MetaScript/blob/dc7caf5eae2f2b2467f6c6467203dbcd05f23549/MetaScript.js#L408-L428 |
31,023 | ExpressenAB/exp-amqp-connection | index.js | function(callback) {
bootstrap(behaviour, (bootstrapErr, bootstrapRes) => {
if (bootstrapErr) api.emit("error", bootstrapErr);
if (bootstrapRes && bootstrapRes.virgin) {
bootstrapRes.connection.on("error", (err) => api.emit("error", err));
bootstrapRes.connection.on("close", (why) => api... | javascript | function(callback) {
bootstrap(behaviour, (bootstrapErr, bootstrapRes) => {
if (bootstrapErr) api.emit("error", bootstrapErr);
if (bootstrapRes && bootstrapRes.virgin) {
bootstrapRes.connection.on("error", (err) => api.emit("error", err));
bootstrapRes.connection.on("close", (why) => api... | [
"function",
"(",
"callback",
")",
"{",
"bootstrap",
"(",
"behaviour",
",",
"(",
"bootstrapErr",
",",
"bootstrapRes",
")",
"=>",
"{",
"if",
"(",
"bootstrapErr",
")",
"api",
".",
"emit",
"(",
"\"error\"",
",",
"bootstrapErr",
")",
";",
"if",
"(",
"bootstra... | get connnection and add event listeners if it's brand new. | [
"get",
"connnection",
"and",
"add",
"event",
"listeners",
"if",
"it",
"s",
"brand",
"new",
"."
] | 999240feee6f0861ddd7404b58b3e6600bd36062 | https://github.com/ExpressenAB/exp-amqp-connection/blob/999240feee6f0861ddd7404b58b3e6600bd36062/index.js#L35-L48 | |
31,024 | healthsparq/ember-fountainhead | lib/create-dirs.js | mkdirSync | function mkdirSync(dirPath) {
// Get relative path to output
const relativePath = dirPath.replace(`${CWD}${pathSep}`, '');
const dirs = relativePath.split(pathSep);
let currentDir = CWD;
// Check if each dir exists, and if not, create it
dirs.forEach(dir => {
currentDir = path.resolve(curre... | javascript | function mkdirSync(dirPath) {
// Get relative path to output
const relativePath = dirPath.replace(`${CWD}${pathSep}`, '');
const dirs = relativePath.split(pathSep);
let currentDir = CWD;
// Check if each dir exists, and if not, create it
dirs.forEach(dir => {
currentDir = path.resolve(curre... | [
"function",
"mkdirSync",
"(",
"dirPath",
")",
"{",
"// Get relative path to output",
"const",
"relativePath",
"=",
"dirPath",
".",
"replace",
"(",
"`",
"${",
"CWD",
"}",
"${",
"pathSep",
"}",
"`",
",",
"''",
")",
";",
"const",
"dirs",
"=",
"relativePath",
... | Synchronous mkdir that handles creating a potentially nested directory
@method mkdirSync
@param {string} dirPath Directory path to create, can be nested
@return {undefined} | [
"Synchronous",
"mkdir",
"that",
"handles",
"creating",
"a",
"potentially",
"nested",
"directory"
] | 3577546719b251385ca1093f812889590459205a | https://github.com/healthsparq/ember-fountainhead/blob/3577546719b251385ca1093f812889590459205a/lib/create-dirs.js#L26-L39 |
31,025 | mia-js/mia-js-core | lib/baseModel/lib/baseModel.js | function (values, options, callback) {
var deferred = Q.defer();
var args = ArgumentHelpers.prepareArguments(options, callback)
, wrapper = {};
options = args.options;
callback = Qext.makeNodeResolver(deferred, args.callback);
... | javascript | function (values, options, callback) {
var deferred = Q.defer();
var args = ArgumentHelpers.prepareArguments(options, callback)
, wrapper = {};
options = args.options;
callback = Qext.makeNodeResolver(deferred, args.callback);
... | [
"function",
"(",
"values",
",",
"options",
",",
"callback",
")",
"{",
"var",
"deferred",
"=",
"Q",
".",
"defer",
"(",
")",
";",
"var",
"args",
"=",
"ArgumentHelpers",
".",
"prepareArguments",
"(",
"options",
",",
"callback",
")",
",",
"wrapper",
"=",
"... | Validates provided 'values' against this model.
@param values
@param callback | [
"Validates",
"provided",
"values",
"against",
"this",
"model",
"."
] | 77c976a72382fd0edef1144f9bea47d8c175c26b | https://github.com/mia-js/mia-js-core/blob/77c976a72382fd0edef1144f9bea47d8c175c26b/lib/baseModel/lib/baseModel.js#L202-L265 | |
31,026 | mia-js/mia-js-core | lib/baseModel/lib/baseModel.js | function (callback) {
var self = this;
var deferred = Q.defer();
callback = Qext.makeNodeResolver(deferred, callback);
var breakExec = {};
Async.waterfall([
function (next) {
if (!self.collectio... | javascript | function (callback) {
var self = this;
var deferred = Q.defer();
callback = Qext.makeNodeResolver(deferred, callback);
var breakExec = {};
Async.waterfall([
function (next) {
if (!self.collectio... | [
"function",
"(",
"callback",
")",
"{",
"var",
"self",
"=",
"this",
";",
"var",
"deferred",
"=",
"Q",
".",
"defer",
"(",
")",
";",
"callback",
"=",
"Qext",
".",
"makeNodeResolver",
"(",
"deferred",
",",
"callback",
")",
";",
"var",
"breakExec",
"=",
"... | Gets the collection of this model. Collection is specified in the 'collectionName' property of the model. | [
"Gets",
"the",
"collection",
"of",
"this",
"model",
".",
"Collection",
"is",
"specified",
"in",
"the",
"collectionName",
"property",
"of",
"the",
"model",
"."
] | 77c976a72382fd0edef1144f9bea47d8c175c26b | https://github.com/mia-js/mia-js-core/blob/77c976a72382fd0edef1144f9bea47d8c175c26b/lib/baseModel/lib/baseModel.js#L286-L381 | |
31,027 | mia-js/mia-js-core | lib/baseModel/lib/baseModel.js | function (arguments) {
var argData = ArgumentHelpers.prepareCallback(arguments);
var callback = argData.callback;
var args = argData.arguments;
if (callback) {
args.pop();
}
return args;
} | javascript | function (arguments) {
var argData = ArgumentHelpers.prepareCallback(arguments);
var callback = argData.callback;
var args = argData.arguments;
if (callback) {
args.pop();
}
return args;
} | [
"function",
"(",
"arguments",
")",
"{",
"var",
"argData",
"=",
"ArgumentHelpers",
".",
"prepareCallback",
"(",
"arguments",
")",
";",
"var",
"callback",
"=",
"argData",
".",
"callback",
";",
"var",
"args",
"=",
"argData",
".",
"arguments",
";",
"if",
"(",
... | Removes callback function from arguments and returns the arguments
@param {Object} arguments
@returns {Array}
@private | [
"Removes",
"callback",
"function",
"from",
"arguments",
"and",
"returns",
"the",
"arguments"
] | 77c976a72382fd0edef1144f9bea47d8c175c26b | https://github.com/mia-js/mia-js-core/blob/77c976a72382fd0edef1144f9bea47d8c175c26b/lib/baseModel/lib/baseModel.js#L389-L397 | |
31,028 | mia-js/mia-js-core | lib/baseModel/lib/baseModel.js | function (functionName, arguments) {
var self = this;
var args = self._getArgs(arguments);
var callback = self._getCallback(arguments);
return self._generic(functionName, args)
.nodeify(callback);
} | javascript | function (functionName, arguments) {
var self = this;
var args = self._getArgs(arguments);
var callback = self._getCallback(arguments);
return self._generic(functionName, args)
.nodeify(callback);
} | [
"function",
"(",
"functionName",
",",
"arguments",
")",
"{",
"var",
"self",
"=",
"this",
";",
"var",
"args",
"=",
"self",
".",
"_getArgs",
"(",
"arguments",
")",
";",
"var",
"callback",
"=",
"self",
".",
"_getCallback",
"(",
"arguments",
")",
";",
"ret... | Calls generic driver functions
@param {String} functionName
@param {Object} arguments
@returns {*}
@private | [
"Calls",
"generic",
"driver",
"functions"
] | 77c976a72382fd0edef1144f9bea47d8c175c26b | https://github.com/mia-js/mia-js-core/blob/77c976a72382fd0edef1144f9bea47d8c175c26b/lib/baseModel/lib/baseModel.js#L417-L424 | |
31,029 | mia-js/mia-js-core | lib/baseModel/lib/baseModel.js | function (args) {
var shardKey = this.prototype.shardKey;
var query = !_.isUndefined(args[0]) ? args[0] : {};
var options = !_.isUndefined(args[1]) ? args[1] : {};
var ignoreShardKey = MemberHelpers.getPathPropertyValue(options, 'ignoreShardKey') ? true : ... | javascript | function (args) {
var shardKey = this.prototype.shardKey;
var query = !_.isUndefined(args[0]) ? args[0] : {};
var options = !_.isUndefined(args[1]) ? args[1] : {};
var ignoreShardKey = MemberHelpers.getPathPropertyValue(options, 'ignoreShardKey') ? true : ... | [
"function",
"(",
"args",
")",
"{",
"var",
"shardKey",
"=",
"this",
".",
"prototype",
".",
"shardKey",
";",
"var",
"query",
"=",
"!",
"_",
".",
"isUndefined",
"(",
"args",
"[",
"0",
"]",
")",
"?",
"args",
"[",
"0",
"]",
":",
"{",
"}",
";",
"var"... | Checks whether there is a shard key and if it is in the query
@param {Object} args
@returns {*}
@private | [
"Checks",
"whether",
"there",
"is",
"a",
"shard",
"key",
"and",
"if",
"it",
"is",
"in",
"the",
"query"
] | 77c976a72382fd0edef1144f9bea47d8c175c26b | https://github.com/mia-js/mia-js-core/blob/77c976a72382fd0edef1144f9bea47d8c175c26b/lib/baseModel/lib/baseModel.js#L469-L491 | |
31,030 | jbaicoianu/elation | components/utils/scripts/events.js | function(event) {
if (typeof event.touches != 'undefined' && event.touches.length > 0) {
var c = {
x: event.touches[0].pageX,
y: event.touches[0].pageY
};
} else {
var c = {
x: (event.pageX || (event.clientX + document.body.scrollLeft)),
y: (event.pageY || (ev... | javascript | function(event) {
if (typeof event.touches != 'undefined' && event.touches.length > 0) {
var c = {
x: event.touches[0].pageX,
y: event.touches[0].pageY
};
} else {
var c = {
x: (event.pageX || (event.clientX + document.body.scrollLeft)),
y: (event.pageY || (ev... | [
"function",
"(",
"event",
")",
"{",
"if",
"(",
"typeof",
"event",
".",
"touches",
"!=",
"'undefined'",
"&&",
"event",
".",
"touches",
".",
"length",
">",
"0",
")",
"{",
"var",
"c",
"=",
"{",
"x",
":",
"event",
".",
"touches",
"[",
"0",
"]",
".",
... | returns mouse or all finger touch coords | [
"returns",
"mouse",
"or",
"all",
"finger",
"touch",
"coords"
] | 5fb8824d8b7150c463daf2fe99c31716c6e8812f | https://github.com/jbaicoianu/elation/blob/5fb8824d8b7150c463daf2fe99c31716c6e8812f/components/utils/scripts/events.js#L397-L411 | |
31,031 | mia-js/mia-js-core | lib/routesHandler/lib/swaggerDocs.js | function (bodySchemaModels, defName) {
for (var i in bodySchemaModels) {
if (bodySchemaModels[i]["name"] == defName) {
return bodySchemaModels[i];
}
}
return null;
} | javascript | function (bodySchemaModels, defName) {
for (var i in bodySchemaModels) {
if (bodySchemaModels[i]["name"] == defName) {
return bodySchemaModels[i];
}
}
return null;
} | [
"function",
"(",
"bodySchemaModels",
",",
"defName",
")",
"{",
"for",
"(",
"var",
"i",
"in",
"bodySchemaModels",
")",
"{",
"if",
"(",
"bodySchemaModels",
"[",
"i",
"]",
"[",
"\"name\"",
"]",
"==",
"defName",
")",
"{",
"return",
"bodySchemaModels",
"[",
"... | Create swagger compatible schema for body parameters
@param bodySchemaModels
@param obj
@param defName
@returns {{bodySchemaModels: *, attributes: {}}}
@private | [
"Create",
"swagger",
"compatible",
"schema",
"for",
"body",
"parameters"
] | 77c976a72382fd0edef1144f9bea47d8c175c26b | https://github.com/mia-js/mia-js-core/blob/77c976a72382fd0edef1144f9bea47d8c175c26b/lib/routesHandler/lib/swaggerDocs.js#L20-L27 | |
31,032 | mia-js/mia-js-core | lib/modelValidator/lib/modelValidator.js | function (values, schema) {
var publicList = find(schema, 'public')
, arrElem;
for (var value in values) {
if (publicList[value]) {
if (_.isArray(publicList[value])) {
for (var thisArrayElem in publicList[value]) {
if (!_.isArray(values[value]))... | javascript | function (values, schema) {
var publicList = find(schema, 'public')
, arrElem;
for (var value in values) {
if (publicList[value]) {
if (_.isArray(publicList[value])) {
for (var thisArrayElem in publicList[value]) {
if (!_.isArray(values[value]))... | [
"function",
"(",
"values",
",",
"schema",
")",
"{",
"var",
"publicList",
"=",
"find",
"(",
"schema",
",",
"'public'",
")",
",",
"arrElem",
";",
"for",
"(",
"var",
"value",
"in",
"values",
")",
"{",
"if",
"(",
"publicList",
"[",
"value",
"]",
")",
"... | Remove values where schema setting public.set false
@param values
@param schema
@returns {*} | [
"Remove",
"values",
"where",
"schema",
"setting",
"public",
".",
"set",
"false"
] | 77c976a72382fd0edef1144f9bea47d8c175c26b | https://github.com/mia-js/mia-js-core/blob/77c976a72382fd0edef1144f9bea47d8c175c26b/lib/modelValidator/lib/modelValidator.js#L724-L763 | |
31,033 | mia-js/mia-js-core | lib/modelValidator/lib/modelValidator.js | function (values, schema, options) {
var virtualList = find(schema, 'virtual');
//Set default value for virtual if not exists in values
if (options && options.query === true) {
}
else {
for (var virtual in virtualList) {
if (_.isArray(virtualList[virtual])) {
f... | javascript | function (values, schema, options) {
var virtualList = find(schema, 'virtual');
//Set default value for virtual if not exists in values
if (options && options.query === true) {
}
else {
for (var virtual in virtualList) {
if (_.isArray(virtualList[virtual])) {
f... | [
"function",
"(",
"values",
",",
"schema",
",",
"options",
")",
"{",
"var",
"virtualList",
"=",
"find",
"(",
"schema",
",",
"'virtual'",
")",
";",
"//Set default value for virtual if not exists in values",
"if",
"(",
"options",
"&&",
"options",
".",
"query",
"===... | Apply virtual functions defined in schema
@param values
@param model
@param options
@returns {*} | [
"Apply",
"virtual",
"functions",
"defined",
"in",
"schema"
] | 77c976a72382fd0edef1144f9bea47d8c175c26b | https://github.com/mia-js/mia-js-core/blob/77c976a72382fd0edef1144f9bea47d8c175c26b/lib/modelValidator/lib/modelValidator.js#L772-L840 | |
31,034 | mia-js/mia-js-core | lib/modelValidator/lib/modelValidator.js | function (model, filter, value) {
if (!_.isString(filter)) {
return null;
}
if (model.data) {
var list = findKeys(model.data, filter)
, values = [];
for (var res in list) {
if (value === undefined || list[res][filter] === value) {
values.pu... | javascript | function (model, filter, value) {
if (!_.isString(filter)) {
return null;
}
if (model.data) {
var list = findKeys(model.data, filter)
, values = [];
for (var res in list) {
if (value === undefined || list[res][filter] === value) {
values.pu... | [
"function",
"(",
"model",
",",
"filter",
",",
"value",
")",
"{",
"if",
"(",
"!",
"_",
".",
"isString",
"(",
"filter",
")",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"model",
".",
"data",
")",
"{",
"var",
"list",
"=",
"findKeys",
"(",
"mo... | Finds all nodes with filter property in given model and returns array list of nodes
@param model
@param filter
@returns {*} | [
"Finds",
"all",
"nodes",
"with",
"filter",
"property",
"in",
"given",
"model",
"and",
"returns",
"array",
"list",
"of",
"nodes"
] | 77c976a72382fd0edef1144f9bea47d8c175c26b | https://github.com/mia-js/mia-js-core/blob/77c976a72382fd0edef1144f9bea47d8c175c26b/lib/modelValidator/lib/modelValidator.js#L977-L997 | |
31,035 | mia-js/mia-js-core | lib/modelValidator/lib/modelValidator.js | function (schema) {
var extendList = find(schema, 'extend');
for (var extendElem in extendList) {
if (extendList[extendElem] && extendList[extendElem].extend && _.isFunction(extendList[extendElem].extend)) {
schema[extendElem] = extendList[extendElem].extend();
}
}
return sc... | javascript | function (schema) {
var extendList = find(schema, 'extend');
for (var extendElem in extendList) {
if (extendList[extendElem] && extendList[extendElem].extend && _.isFunction(extendList[extendElem].extend)) {
schema[extendElem] = extendList[extendElem].extend();
}
}
return sc... | [
"function",
"(",
"schema",
")",
"{",
"var",
"extendList",
"=",
"find",
"(",
"schema",
",",
"'extend'",
")",
";",
"for",
"(",
"var",
"extendElem",
"in",
"extendList",
")",
"{",
"if",
"(",
"extendList",
"[",
"extendElem",
"]",
"&&",
"extendList",
"[",
"e... | Extend schema by dynamic functions. Write a function that defined the schema settings for a node
@param schema
@returns {*} | [
"Extend",
"schema",
"by",
"dynamic",
"functions",
".",
"Write",
"a",
"function",
"that",
"defined",
"the",
"schema",
"settings",
"for",
"a",
"node"
] | 77c976a72382fd0edef1144f9bea47d8c175c26b | https://github.com/mia-js/mia-js-core/blob/77c976a72382fd0edef1144f9bea47d8c175c26b/lib/modelValidator/lib/modelValidator.js#L1004-L1013 | |
31,036 | jonschlinkert/plasma | index.js | name | function name(fp, options) {
var opts = options || {};
if (typeof opts.namespace === 'function') {
return opts.namespace(fp, opts);
}
if (typeof opts.namespace === false) {
return fp;
}
var ext = path.extname(fp);
return path.basename(fp, ext);
} | javascript | function name(fp, options) {
var opts = options || {};
if (typeof opts.namespace === 'function') {
return opts.namespace(fp, opts);
}
if (typeof opts.namespace === false) {
return fp;
}
var ext = path.extname(fp);
return path.basename(fp, ext);
} | [
"function",
"name",
"(",
"fp",
",",
"options",
")",
"{",
"var",
"opts",
"=",
"options",
"||",
"{",
"}",
";",
"if",
"(",
"typeof",
"opts",
".",
"namespace",
"===",
"'function'",
")",
"{",
"return",
"opts",
".",
"namespace",
"(",
"fp",
",",
"opts",
"... | Default `namespace` function. Pass a function on `options.namespace`
to customize.
@param {String} `fp`
@param {Object} `opts`
@return {String}
@api private | [
"Default",
"namespace",
"function",
".",
"Pass",
"a",
"function",
"on",
"options",
".",
"namespace",
"to",
"customize",
"."
] | 573027b52817ceb2f1295779bc2b3bceefa74d11 | https://github.com/jonschlinkert/plasma/blob/573027b52817ceb2f1295779bc2b3bceefa74d11/index.js#L229-L239 |
31,037 | jonschlinkert/plasma | index.js | read | function read(fp, opts) {
if (opts && opts.read) {
return opts.read(fp, opts);
}
return readData.call(this, fp, opts);
} | javascript | function read(fp, opts) {
if (opts && opts.read) {
return opts.read(fp, opts);
}
return readData.call(this, fp, opts);
} | [
"function",
"read",
"(",
"fp",
",",
"opts",
")",
"{",
"if",
"(",
"opts",
"&&",
"opts",
".",
"read",
")",
"{",
"return",
"opts",
".",
"read",
"(",
"fp",
",",
"opts",
")",
";",
"}",
"return",
"readData",
".",
"call",
"(",
"this",
",",
"fp",
",",
... | Default `read` function. Pass a function on `options.read`
to customize.
@param {String} `fp`
@param {Object} `opts`
@return {String}
@api private | [
"Default",
"read",
"function",
".",
"Pass",
"a",
"function",
"on",
"options",
".",
"read",
"to",
"customize",
"."
] | 573027b52817ceb2f1295779bc2b3bceefa74d11 | https://github.com/jonschlinkert/plasma/blob/573027b52817ceb2f1295779bc2b3bceefa74d11/index.js#L251-L256 |
31,038 | jonschlinkert/plasma | index.js | readData | function readData(fp, options) {
// shallow clone options
var opts = utils.extend({}, options);
// get the loader for this file.
var ext = opts.lang || path.extname(fp);
if (ext && ext.charAt(0) !== '.') {
ext = '.' + ext;
}
if (!this.dataLoaders.hasOwnProperty(ext)) {
return this.dataLoader('read... | javascript | function readData(fp, options) {
// shallow clone options
var opts = utils.extend({}, options);
// get the loader for this file.
var ext = opts.lang || path.extname(fp);
if (ext && ext.charAt(0) !== '.') {
ext = '.' + ext;
}
if (!this.dataLoaders.hasOwnProperty(ext)) {
return this.dataLoader('read... | [
"function",
"readData",
"(",
"fp",
",",
"options",
")",
"{",
"// shallow clone options",
"var",
"opts",
"=",
"utils",
".",
"extend",
"(",
"{",
"}",
",",
"options",
")",
";",
"// get the loader for this file.",
"var",
"ext",
"=",
"opts",
".",
"lang",
"||",
... | Utility for reading data files.
@param {String} `fp` Filepath to read.
@param {Object} `options` Options to pass to [js-yaml]
@api private | [
"Utility",
"for",
"reading",
"data",
"files",
"."
] | 573027b52817ceb2f1295779bc2b3bceefa74d11 | https://github.com/jonschlinkert/plasma/blob/573027b52817ceb2f1295779bc2b3bceefa74d11/index.js#L266-L278 |
31,039 | jbaicoianu/elation | components/utils/scripts/ajaxlib.js | function() {
if (common.inlinescripts.length > 0) {
var script_text = '';
for (var i = 0; i < common.inlinescripts.length; i++) {
if (!common.inlinescripts[i] || typeof common.inlinescripts[i] == 'undefined')
continue;
else
script_text += common.inlines... | javascript | function() {
if (common.inlinescripts.length > 0) {
var script_text = '';
for (var i = 0; i < common.inlinescripts.length; i++) {
if (!common.inlinescripts[i] || typeof common.inlinescripts[i] == 'undefined')
continue;
else
script_text += common.inlines... | [
"function",
"(",
")",
"{",
"if",
"(",
"common",
".",
"inlinescripts",
".",
"length",
">",
"0",
")",
"{",
"var",
"script_text",
"=",
"''",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"common",
".",
"inlinescripts",
".",
"length",
";",
"i... | Execute all inline scripts | [
"Execute",
"all",
"inline",
"scripts"
] | 5fb8824d8b7150c463daf2fe99c31716c6e8812f | https://github.com/jbaicoianu/elation/blob/5fb8824d8b7150c463daf2fe99c31716c6e8812f/components/utils/scripts/ajaxlib.js#L229-L244 | |
31,040 | healthsparq/ember-fountainhead | lib/generate-fountainhead-data.js | saveObjectToJSON | function saveObjectToJSON(filePath, data) {
try {
data = JSON.stringify(data, null, 2);
writeFileSync(filePath, data, { encoding: 'utf8' });
return true;
} catch(ex) {
console.warn('Unable to save class JSON');
return false;
}
// NOTE: ASYNC REQUIRES PROMISIFYING ALL OPERA... | javascript | function saveObjectToJSON(filePath, data) {
try {
data = JSON.stringify(data, null, 2);
writeFileSync(filePath, data, { encoding: 'utf8' });
return true;
} catch(ex) {
console.warn('Unable to save class JSON');
return false;
}
// NOTE: ASYNC REQUIRES PROMISIFYING ALL OPERA... | [
"function",
"saveObjectToJSON",
"(",
"filePath",
",",
"data",
")",
"{",
"try",
"{",
"data",
"=",
"JSON",
".",
"stringify",
"(",
"data",
",",
"null",
",",
"2",
")",
";",
"writeFileSync",
"(",
"filePath",
",",
"data",
",",
"{",
"encoding",
":",
"'utf8'",... | Call to handle saving data to a file. Requires a file path and data to save.
If data is not a string, it will be stringified
@method saveObjectToJSON
@param {string} filePath Path to save file at
@param {Object|string} data Data to save in file
@return {boolean} True for successful operation, false for failu... | [
"Call",
"to",
"handle",
"saving",
"data",
"to",
"a",
"file",
".",
"Requires",
"a",
"file",
"path",
"and",
"data",
"to",
"save",
".",
"If",
"data",
"is",
"not",
"a",
"string",
"it",
"will",
"be",
"stringified"
] | 3577546719b251385ca1093f812889590459205a | https://github.com/healthsparq/ember-fountainhead/blob/3577546719b251385ca1093f812889590459205a/lib/generate-fountainhead-data.js#L58-L72 |
31,041 | kuzzleio/kuzzle-common-objects | lib/utils/assertType.js | assertObject | function assertObject(attr, data) {
if (data === null || data === undefined) {
return null;
}
if (typeof data !== 'object' || Array.isArray(data)) {
throw new ParseError(`Attribute ${attr} must be of type "object"`);
}
return data;
} | javascript | function assertObject(attr, data) {
if (data === null || data === undefined) {
return null;
}
if (typeof data !== 'object' || Array.isArray(data)) {
throw new ParseError(`Attribute ${attr} must be of type "object"`);
}
return data;
} | [
"function",
"assertObject",
"(",
"attr",
",",
"data",
")",
"{",
"if",
"(",
"data",
"===",
"null",
"||",
"data",
"===",
"undefined",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"typeof",
"data",
"!==",
"'object'",
"||",
"Array",
".",
"isArray",
"... | Throws if the provided data is not an object.
Returns the unmodified data if validated
@throws
@param {string} attr - tested attribute name
@param {*} data
@return {object} | [
"Throws",
"if",
"the",
"provided",
"data",
"is",
"not",
"an",
"object",
".",
"Returns",
"the",
"unmodified",
"data",
"if",
"validated"
] | 7a7bac8245d9a34ea14c8e7326e95a1f13b9acc2 | https://github.com/kuzzleio/kuzzle-common-objects/blob/7a7bac8245d9a34ea14c8e7326e95a1f13b9acc2/lib/utils/assertType.js#L14-L24 |
31,042 | kuzzleio/kuzzle-common-objects | lib/utils/assertType.js | assertArray | function assertArray(attr, data, type) {
if (data === null || data === undefined) {
return [];
}
if (!Array.isArray(data)) {
throw new ParseError(`Attribute ${attr} must be of type "array"`);
}
const clone = [];
for (const d of data) {
if (d !== undefined && d !== null) {
if (typeof d !... | javascript | function assertArray(attr, data, type) {
if (data === null || data === undefined) {
return [];
}
if (!Array.isArray(data)) {
throw new ParseError(`Attribute ${attr} must be of type "array"`);
}
const clone = [];
for (const d of data) {
if (d !== undefined && d !== null) {
if (typeof d !... | [
"function",
"assertArray",
"(",
"attr",
",",
"data",
",",
"type",
")",
"{",
"if",
"(",
"data",
"===",
"null",
"||",
"data",
"===",
"undefined",
")",
"{",
"return",
"[",
"]",
";",
"}",
"if",
"(",
"!",
"Array",
".",
"isArray",
"(",
"data",
")",
")"... | Throws if the provided data is not an array containing exclusively
values of the specified "type"
Returns a clone of the provided array if valid
@throws
@param {string} attr - tested attribute name
@param {*} data
@return {array} | [
"Throws",
"if",
"the",
"provided",
"data",
"is",
"not",
"an",
"array",
"containing",
"exclusively",
"values",
"of",
"the",
"specified",
"type",
"Returns",
"a",
"clone",
"of",
"the",
"provided",
"array",
"if",
"valid"
] | 7a7bac8245d9a34ea14c8e7326e95a1f13b9acc2 | https://github.com/kuzzleio/kuzzle-common-objects/blob/7a7bac8245d9a34ea14c8e7326e95a1f13b9acc2/lib/utils/assertType.js#L36-L58 |
31,043 | kuzzleio/kuzzle-common-objects | lib/utils/assertType.js | assertUniTypeObject | function assertUniTypeObject(attr, data, type) {
data = assertObject(attr, data);
if (data === null) {
return null;
}
Object.keys(data).forEach(key => {
if (type === undefined) {
type = typeof data[key];
}
type = type.toLowerCase();
let msg = `Attribute ${attr} must be of type "obje... | javascript | function assertUniTypeObject(attr, data, type) {
data = assertObject(attr, data);
if (data === null) {
return null;
}
Object.keys(data).forEach(key => {
if (type === undefined) {
type = typeof data[key];
}
type = type.toLowerCase();
let msg = `Attribute ${attr} must be of type "obje... | [
"function",
"assertUniTypeObject",
"(",
"attr",
",",
"data",
",",
"type",
")",
"{",
"data",
"=",
"assertObject",
"(",
"attr",
",",
"data",
")",
";",
"if",
"(",
"data",
"===",
"null",
")",
"{",
"return",
"null",
";",
"}",
"Object",
".",
"keys",
"(",
... | Throws if the provided object is not an object or if it contains heterogeaous typed properties.
Returns the unmodified data if validated.
@throws {ParseError}
@param {string} attr - tested attribute name
@param {*} data
@param {string} [type] - expected type for data properties
@returns {object|null} | [
"Throws",
"if",
"the",
"provided",
"object",
"is",
"not",
"an",
"object",
"or",
"if",
"it",
"contains",
"heterogeaous",
"typed",
"properties",
".",
"Returns",
"the",
"unmodified",
"data",
"if",
"validated",
"."
] | 7a7bac8245d9a34ea14c8e7326e95a1f13b9acc2 | https://github.com/kuzzleio/kuzzle-common-objects/blob/7a7bac8245d9a34ea14c8e7326e95a1f13b9acc2/lib/utils/assertType.js#L70-L102 |
31,044 | kuzzleio/kuzzle-common-objects | lib/utils/assertType.js | assertString | function assertString(attr, data) {
if (data === null || data === undefined) {
return null;
}
if (typeof data !== 'string') {
throw new ParseError(`Attribute ${attr} must be of type "string"`);
}
return data;
} | javascript | function assertString(attr, data) {
if (data === null || data === undefined) {
return null;
}
if (typeof data !== 'string') {
throw new ParseError(`Attribute ${attr} must be of type "string"`);
}
return data;
} | [
"function",
"assertString",
"(",
"attr",
",",
"data",
")",
"{",
"if",
"(",
"data",
"===",
"null",
"||",
"data",
"===",
"undefined",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"typeof",
"data",
"!==",
"'string'",
")",
"{",
"throw",
"new",
"Parse... | Throws if the provided data is not a string
Returns the unmodified data if validated
@throws
@param {string} attr - tested attribute name
@param {*} data
@return {null|string} | [
"Throws",
"if",
"the",
"provided",
"data",
"is",
"not",
"a",
"string",
"Returns",
"the",
"unmodified",
"data",
"if",
"validated"
] | 7a7bac8245d9a34ea14c8e7326e95a1f13b9acc2 | https://github.com/kuzzleio/kuzzle-common-objects/blob/7a7bac8245d9a34ea14c8e7326e95a1f13b9acc2/lib/utils/assertType.js#L114-L124 |
31,045 | mia-js/mia-js-core | lib/routesHandler/lib/preconditionsCheck.js | function (values, model, type) {
var deferred = Q.defer();
var modelData = {data: model};
ModelValidator.validate(values, modelData, function (err, data) {
deferred.resolve({data: data, err: err, type: type});
});
return deferred.promise;
} | javascript | function (values, model, type) {
var deferred = Q.defer();
var modelData = {data: model};
ModelValidator.validate(values, modelData, function (err, data) {
deferred.resolve({data: data, err: err, type: type});
});
return deferred.promise;
} | [
"function",
"(",
"values",
",",
"model",
",",
"type",
")",
"{",
"var",
"deferred",
"=",
"Q",
".",
"defer",
"(",
")",
";",
"var",
"modelData",
"=",
"{",
"data",
":",
"model",
"}",
";",
"ModelValidator",
".",
"validate",
"(",
"values",
",",
"modelData"... | Validate given values using given model
@param values
@param model
@param type
@returns {*}
@private | [
"Validate",
"given",
"values",
"using",
"given",
"model"
] | 77c976a72382fd0edef1144f9bea47d8c175c26b | https://github.com/mia-js/mia-js-core/blob/77c976a72382fd0edef1144f9bea47d8c175c26b/lib/routesHandler/lib/preconditionsCheck.js#L82-L90 | |
31,046 | mia-js/mia-js-core | lib/routesHandler/lib/preconditionsCheck.js | function (req, controller) {
var parameters = [];
if (controller.conditions && controller.conditions.parameters && controller.conditions.parameters.header) {
parameters.push(_checkValues(req.headers, controller.conditions.parameters.header, "header"))
}
if (controller.condit... | javascript | function (req, controller) {
var parameters = [];
if (controller.conditions && controller.conditions.parameters && controller.conditions.parameters.header) {
parameters.push(_checkValues(req.headers, controller.conditions.parameters.header, "header"))
}
if (controller.condit... | [
"function",
"(",
"req",
",",
"controller",
")",
"{",
"var",
"parameters",
"=",
"[",
"]",
";",
"if",
"(",
"controller",
".",
"conditions",
"&&",
"controller",
".",
"conditions",
".",
"parameters",
"&&",
"controller",
".",
"conditions",
".",
"parameters",
".... | Parse parameter model of controller and validate all request parameters for header,query and body
@param req
@param controller
@returns {*}
@private | [
"Parse",
"parameter",
"model",
"of",
"controller",
"and",
"validate",
"all",
"request",
"parameters",
"for",
"header",
"query",
"and",
"body"
] | 77c976a72382fd0edef1144f9bea47d8c175c26b | https://github.com/mia-js/mia-js-core/blob/77c976a72382fd0edef1144f9bea47d8c175c26b/lib/routesHandler/lib/preconditionsCheck.js#L99-L149 | |
31,047 | mia-js/mia-js-core | lib/routesHandler/lib/preconditionsCheck.js | function (req, res, next) {
var hostId = req.miajs.route.hostId;
var url = req.miajs.route.url;
var prefix = req.miajs.route.prefix;
var method = req.miajs.route.method;
var group = req.miajs.route.group;
var version = req.miajs.route.version;
var registeredServic... | javascript | function (req, res, next) {
var hostId = req.miajs.route.hostId;
var url = req.miajs.route.url;
var prefix = req.miajs.route.prefix;
var method = req.miajs.route.method;
var group = req.miajs.route.group;
var version = req.miajs.route.version;
var registeredServic... | [
"function",
"(",
"req",
",",
"res",
",",
"next",
")",
"{",
"var",
"hostId",
"=",
"req",
".",
"miajs",
".",
"route",
".",
"hostId",
";",
"var",
"url",
"=",
"req",
".",
"miajs",
".",
"route",
".",
"url",
";",
"var",
"prefix",
"=",
"req",
".",
"mi... | Apply all preconditions defined in all controllers of this route.
Try to find preconditions in registeredServices matching url, prefix, method, group and version
@param req
@param res
@param next | [
"Apply",
"all",
"preconditions",
"defined",
"in",
"all",
"controllers",
"of",
"this",
"route",
".",
"Try",
"to",
"find",
"preconditions",
"in",
"registeredServices",
"matching",
"url",
"prefix",
"method",
"group",
"and",
"version"
] | 77c976a72382fd0edef1144f9bea47d8c175c26b | https://github.com/mia-js/mia-js-core/blob/77c976a72382fd0edef1144f9bea47d8c175c26b/lib/routesHandler/lib/preconditionsCheck.js#L158-L245 | |
31,048 | mia-js/mia-js-core | lib/mia-js.js | function () {
Shared.initialize('/config', process.argv[2]);
Shared.setAppHttp(appHttp);
Shared.setAppHttps(appHttps);
Shared.setExpress(express);
// Init memcached
var memcached = Shared.memcached();
// Init redis cache
var redis = Shared.redis(true);
... | javascript | function () {
Shared.initialize('/config', process.argv[2]);
Shared.setAppHttp(appHttp);
Shared.setAppHttps(appHttps);
Shared.setExpress(express);
// Init memcached
var memcached = Shared.memcached();
// Init redis cache
var redis = Shared.redis(true);
... | [
"function",
"(",
")",
"{",
"Shared",
".",
"initialize",
"(",
"'/config'",
",",
"process",
".",
"argv",
"[",
"2",
"]",
")",
";",
"Shared",
".",
"setAppHttp",
"(",
"appHttp",
")",
";",
"Shared",
".",
"setAppHttps",
"(",
"appHttps",
")",
";",
"Shared",
... | Set initialize functions
@returns {*}
@private | [
"Set",
"initialize",
"functions"
] | 77c976a72382fd0edef1144f9bea47d8c175c26b | https://github.com/mia-js/mia-js-core/blob/77c976a72382fd0edef1144f9bea47d8c175c26b/lib/mia-js.js#L52-L95 | |
31,049 | mia-js/mia-js-core | lib/mia-js.js | function (initFunction) {
if (_.isFunction(initFunction)) {
Logger.info("Run init function");
_customInitFuncton = initFunction;
return initFunction(appHttp)
.then(function () {
return initFunction(appHttps);
});
}
... | javascript | function (initFunction) {
if (_.isFunction(initFunction)) {
Logger.info("Run init function");
_customInitFuncton = initFunction;
return initFunction(appHttp)
.then(function () {
return initFunction(appHttps);
});
}
... | [
"function",
"(",
"initFunction",
")",
"{",
"if",
"(",
"_",
".",
"isFunction",
"(",
"initFunction",
")",
")",
"{",
"Logger",
".",
"info",
"(",
"\"Run init function\"",
")",
";",
"_customInitFuncton",
"=",
"initFunction",
";",
"return",
"initFunction",
"(",
"a... | Call and set custom init function to global
@param initFunction
@returns {*}
@private | [
"Call",
"and",
"set",
"custom",
"init",
"function",
"to",
"global"
] | 77c976a72382fd0edef1144f9bea47d8c175c26b | https://github.com/mia-js/mia-js-core/blob/77c976a72382fd0edef1144f9bea47d8c175c26b/lib/mia-js.js#L110-L120 | |
31,050 | mia-js/mia-js-core | lib/mia-js.js | function () {
//set logger
if (!module.parent) {
appHttp.use(morgan({format: 'dev'}));
appHttps.use(morgan({format: 'dev'}));
}
return Q();
} | javascript | function () {
//set logger
if (!module.parent) {
appHttp.use(morgan({format: 'dev'}));
appHttps.use(morgan({format: 'dev'}));
}
return Q();
} | [
"function",
"(",
")",
"{",
"//set logger",
"if",
"(",
"!",
"module",
".",
"parent",
")",
"{",
"appHttp",
".",
"use",
"(",
"morgan",
"(",
"{",
"format",
":",
"'dev'",
"}",
")",
")",
";",
"appHttps",
".",
"use",
"(",
"morgan",
"(",
"{",
"format",
"... | Set morgan logger
@returns {*}
@private | [
"Set",
"morgan",
"logger"
] | 77c976a72382fd0edef1144f9bea47d8c175c26b | https://github.com/mia-js/mia-js-core/blob/77c976a72382fd0edef1144f9bea47d8c175c26b/lib/mia-js.js#L174-L181 | |
31,051 | mia-js/mia-js-core | lib/mia-js.js | function (host, reInit) {
if (_.isEmpty(host.id) || !_.isString(host.id)) {
throw new Error("Host configuration is invalid. Host id is missing or not a string");
}
if (_.isEmpty(host.host)) {
throw new Error("Host configuration is invalid. Host is missing");
}
... | javascript | function (host, reInit) {
if (_.isEmpty(host.id) || !_.isString(host.id)) {
throw new Error("Host configuration is invalid. Host id is missing or not a string");
}
if (_.isEmpty(host.host)) {
throw new Error("Host configuration is invalid. Host is missing");
}
... | [
"function",
"(",
"host",
",",
"reInit",
")",
"{",
"if",
"(",
"_",
".",
"isEmpty",
"(",
"host",
".",
"id",
")",
"||",
"!",
"_",
".",
"isString",
"(",
"host",
".",
"id",
")",
")",
"{",
"throw",
"new",
"Error",
"(",
"\"Host configuration is invalid. Hos... | Parse virtual host definition from mia.js global environment configuration
@param {Object} host
@param {Boolean} reInit
@private | [
"Parse",
"virtual",
"host",
"definition",
"from",
"mia",
".",
"js",
"global",
"environment",
"configuration"
] | 77c976a72382fd0edef1144f9bea47d8c175c26b | https://github.com/mia-js/mia-js-core/blob/77c976a72382fd0edef1144f9bea47d8c175c26b/lib/mia-js.js#L189-L227 | |
31,052 | mia-js/mia-js-core | lib/mia-js.js | function (reInit = false) {
//load routes
var environment = Shared.config("environment");
var hosts = environment.hosts;
if (hosts) {
if (!_.isArray(hosts)) {
hosts = [hosts];
}
for (var host in hosts) {
_parseHosts(host... | javascript | function (reInit = false) {
//load routes
var environment = Shared.config("environment");
var hosts = environment.hosts;
if (hosts) {
if (!_.isArray(hosts)) {
hosts = [hosts];
}
for (var host in hosts) {
_parseHosts(host... | [
"function",
"(",
"reInit",
"=",
"false",
")",
"{",
"//load routes",
"var",
"environment",
"=",
"Shared",
".",
"config",
"(",
"\"environment\"",
")",
";",
"var",
"hosts",
"=",
"environment",
".",
"hosts",
";",
"if",
"(",
"hosts",
")",
"{",
"if",
"(",
"!... | Register all routes defined in routes definition of projects and apply to virtual hosts
@param {Boolean} reInit
@returns {*}
@private | [
"Register",
"all",
"routes",
"defined",
"in",
"routes",
"definition",
"of",
"projects",
"and",
"apply",
"to",
"virtual",
"hosts"
] | 77c976a72382fd0edef1144f9bea47d8c175c26b | https://github.com/mia-js/mia-js-core/blob/77c976a72382fd0edef1144f9bea47d8c175c26b/lib/mia-js.js#L245-L266 | |
31,053 | mia-js/mia-js-core | lib/mia-js.js | function () {
const cronJobsToStart = _getNamesOfCronJobsToStart();
if (!cronJobsToStart && _shouldStartCrons() && Shared.isDbConnectionAvailable() === true) {
return CronJobManagerJob.startListening().then(function () {
Logger.tag('Cron').info('Cron Job Manager is started. S... | javascript | function () {
const cronJobsToStart = _getNamesOfCronJobsToStart();
if (!cronJobsToStart && _shouldStartCrons() && Shared.isDbConnectionAvailable() === true) {
return CronJobManagerJob.startListening().then(function () {
Logger.tag('Cron').info('Cron Job Manager is started. S... | [
"function",
"(",
")",
"{",
"const",
"cronJobsToStart",
"=",
"_getNamesOfCronJobsToStart",
"(",
")",
";",
"if",
"(",
"!",
"cronJobsToStart",
"&&",
"_shouldStartCrons",
"(",
")",
"&&",
"Shared",
".",
"isDbConnectionAvailable",
"(",
")",
"===",
"true",
")",
"{",
... | Start cron manager
@returns {*}
@private | [
"Start",
"cron",
"manager"
] | 77c976a72382fd0edef1144f9bea47d8c175c26b | https://github.com/mia-js/mia-js-core/blob/77c976a72382fd0edef1144f9bea47d8c175c26b/lib/mia-js.js#L284-L316 | |
31,054 | mia-js/mia-js-core | lib/mia-js.js | function () {
const crons = _.get(Shared, 'runtimeArgs.cron') || _.get(Shared, 'runtimeArgs.crons');
if (crons) {
const cronTasks = crons.replace(/\s/g, '').split(',');
return cronTasks.length > 0 ? cronTasks : undefined;
}
return undefined;
} | javascript | function () {
const crons = _.get(Shared, 'runtimeArgs.cron') || _.get(Shared, 'runtimeArgs.crons');
if (crons) {
const cronTasks = crons.replace(/\s/g, '').split(',');
return cronTasks.length > 0 ? cronTasks : undefined;
}
return undefined;
} | [
"function",
"(",
")",
"{",
"const",
"crons",
"=",
"_",
".",
"get",
"(",
"Shared",
",",
"'runtimeArgs.cron'",
")",
"||",
"_",
".",
"get",
"(",
"Shared",
",",
"'runtimeArgs.crons'",
")",
";",
"if",
"(",
"crons",
")",
"{",
"const",
"cronTasks",
"=",
"cr... | Checks process arguments if specific cron jobs should be started immediately. That's the case if there is a third
argument like "cron=NameOfCronjobToStart,NameOfAnotherCronjobToStart"
@returns {Array} Names of cron jobs to start
@private | [
"Checks",
"process",
"arguments",
"if",
"specific",
"cron",
"jobs",
"should",
"be",
"started",
"immediately",
".",
"That",
"s",
"the",
"case",
"if",
"there",
"is",
"a",
"third",
"argument",
"like",
"cron",
"=",
"NameOfCronjobToStart",
"NameOfAnotherCronjobToStart"... | 77c976a72382fd0edef1144f9bea47d8c175c26b | https://github.com/mia-js/mia-js-core/blob/77c976a72382fd0edef1144f9bea47d8c175c26b/lib/mia-js.js#L324-L331 | |
31,055 | rapid7/rism | lib/rism.js | setResponsive | function setResponsive(name) {
if (name) {
setResponsiveComponents.call(this, name);
} else {
_utils2["default"].forEach(Object.keys(this._component), (function (name) {
setResponsiveComponents.call(this, name);
}).bind(this));
}
if (_utils2["default"].isUndefined(na... | javascript | function setResponsive(name) {
if (name) {
setResponsiveComponents.call(this, name);
} else {
_utils2["default"].forEach(Object.keys(this._component), (function (name) {
setResponsiveComponents.call(this, name);
}).bind(this));
}
if (_utils2["default"].isUndefined(na... | [
"function",
"setResponsive",
"(",
"name",
")",
"{",
"if",
"(",
"name",
")",
"{",
"setResponsiveComponents",
".",
"call",
"(",
"this",
",",
"name",
")",
";",
"}",
"else",
"{",
"_utils2",
"[",
"\"default\"",
"]",
".",
"forEach",
"(",
"Object",
".",
"keys... | set responsive values | [
"set",
"responsive",
"values"
] | cc1b8dd05175b0df375c0892edc4b1fefdf72b0f | https://github.com/rapid7/rism/blob/cc1b8dd05175b0df375c0892edc4b1fefdf72b0f/lib/rism.js#L154-L176 |
31,056 | playmedia/http-cli | lib/config.js | loadDefault | function loadDefault() {
return {
port: 8000,
host: '127.0.0.1',
root: './',
logFormat: 'combined',
middlewares: [
{
name: 'cors',
cfg: {
origin: true
}
},
{
name: 'morgan',
cfg: {}
},
{
name: 'serveStatic',
... | javascript | function loadDefault() {
return {
port: 8000,
host: '127.0.0.1',
root: './',
logFormat: 'combined',
middlewares: [
{
name: 'cors',
cfg: {
origin: true
}
},
{
name: 'morgan',
cfg: {}
},
{
name: 'serveStatic',
... | [
"function",
"loadDefault",
"(",
")",
"{",
"return",
"{",
"port",
":",
"8000",
",",
"host",
":",
"'127.0.0.1'",
",",
"root",
":",
"'./'",
",",
"logFormat",
":",
"'combined'",
",",
"middlewares",
":",
"[",
"{",
"name",
":",
"'cors'",
",",
"cfg",
":",
"... | Get default HTTP server configuration.
@return {Object} The HTTP server configuration. | [
"Get",
"default",
"HTTP",
"server",
"configuration",
"."
] | 81862084ef50cf9db6530b0da48cbe721355378f | https://github.com/playmedia/http-cli/blob/81862084ef50cf9db6530b0da48cbe721355378f/lib/config.js#L8-L37 |
31,057 | playmedia/http-cli | lib/config.js | loadFromFile | function loadFromFile(filename) {
var cfg = {}
Object.assign(
cfg,
loadDefault(),
JSON.parse(fs.readFileSync(filename))
)
return cfg
} | javascript | function loadFromFile(filename) {
var cfg = {}
Object.assign(
cfg,
loadDefault(),
JSON.parse(fs.readFileSync(filename))
)
return cfg
} | [
"function",
"loadFromFile",
"(",
"filename",
")",
"{",
"var",
"cfg",
"=",
"{",
"}",
"Object",
".",
"assign",
"(",
"cfg",
",",
"loadDefault",
"(",
")",
",",
"JSON",
".",
"parse",
"(",
"fs",
".",
"readFileSync",
"(",
"filename",
")",
")",
")",
"return"... | Get HTTP server configuration from JSON file.
@param {string} filename - The JSON filename.
@throws Will throw an error if invalid filename or JSON.
@return {Object} The HTTP server configuration. | [
"Get",
"HTTP",
"server",
"configuration",
"from",
"JSON",
"file",
"."
] | 81862084ef50cf9db6530b0da48cbe721355378f | https://github.com/playmedia/http-cli/blob/81862084ef50cf9db6530b0da48cbe721355378f/lib/config.js#L45-L54 |
31,058 | playmedia/http-cli | lib/config.js | saveToFile | function saveToFile(filename, cfg) {
// Use 'wx' flag to fails if filename exists
fs.writeFileSync(filename, JSON.stringify(cfg, null, 2), {flag: 'wx'})
} | javascript | function saveToFile(filename, cfg) {
// Use 'wx' flag to fails if filename exists
fs.writeFileSync(filename, JSON.stringify(cfg, null, 2), {flag: 'wx'})
} | [
"function",
"saveToFile",
"(",
"filename",
",",
"cfg",
")",
"{",
"// Use 'wx' flag to fails if filename exists",
"fs",
".",
"writeFileSync",
"(",
"filename",
",",
"JSON",
".",
"stringify",
"(",
"cfg",
",",
"null",
",",
"2",
")",
",",
"{",
"flag",
":",
"'wx'"... | Save HTTP server configuration to JSON file.
@param {string} filename - The JSON filename.
@param {Object} cfg - The HTTP server configuration.
@throws Will throw an error if filename exists. | [
"Save",
"HTTP",
"server",
"configuration",
"to",
"JSON",
"file",
"."
] | 81862084ef50cf9db6530b0da48cbe721355378f | https://github.com/playmedia/http-cli/blob/81862084ef50cf9db6530b0da48cbe721355378f/lib/config.js#L62-L65 |
31,059 | playmedia/http-cli | lib/config.js | loadFromOptions | function loadFromOptions(opts) {
var defCfg = loadDefault()
var cfg = opts.config ? loadFromFile(opts.config) : loadDefault()
// Command line config override file loaded config
for (var k in opts) {
defCfg.hasOwnProperty(k) && (defCfg[k] !== opts[k] && (cfg[k] = opts[k]))
}
return cfg
} | javascript | function loadFromOptions(opts) {
var defCfg = loadDefault()
var cfg = opts.config ? loadFromFile(opts.config) : loadDefault()
// Command line config override file loaded config
for (var k in opts) {
defCfg.hasOwnProperty(k) && (defCfg[k] !== opts[k] && (cfg[k] = opts[k]))
}
return cfg
} | [
"function",
"loadFromOptions",
"(",
"opts",
")",
"{",
"var",
"defCfg",
"=",
"loadDefault",
"(",
")",
"var",
"cfg",
"=",
"opts",
".",
"config",
"?",
"loadFromFile",
"(",
"opts",
".",
"config",
")",
":",
"loadDefault",
"(",
")",
"// Command line config overrid... | Get HTTP server configuration from command line options.
@param {Object} opts - The command line options.
@return {Object} The HTTP server configuration. | [
"Get",
"HTTP",
"server",
"configuration",
"from",
"command",
"line",
"options",
"."
] | 81862084ef50cf9db6530b0da48cbe721355378f | https://github.com/playmedia/http-cli/blob/81862084ef50cf9db6530b0da48cbe721355378f/lib/config.js#L72-L82 |
31,060 | mia-js/mia-js-core | lib/moduleLoader/lib/requireAll.js | function (options, iterationInfo) {
var files;
var modules = {};
var result = {};
// remember the starting directory
try {
files = fs.readdirSync(iterationInfo.dirName);
} catch (e) {
if (options.optional)
return {};
el... | javascript | function (options, iterationInfo) {
var files;
var modules = {};
var result = {};
// remember the starting directory
try {
files = fs.readdirSync(iterationInfo.dirName);
} catch (e) {
if (options.optional)
return {};
el... | [
"function",
"(",
"options",
",",
"iterationInfo",
")",
"{",
"var",
"files",
";",
"var",
"modules",
"=",
"{",
"}",
";",
"var",
"result",
"=",
"{",
"}",
";",
"// remember the starting directory",
"try",
"{",
"files",
"=",
"fs",
".",
"readdirSync",
"(",
"it... | Parses a directory and searches for options.module subdir. If found subdir is searched for required files
@param options
@param iterationInfo
@returns {{}} | [
"Parses",
"a",
"directory",
"and",
"searches",
"for",
"options",
".",
"module",
"subdir",
".",
"If",
"found",
"subdir",
"is",
"searched",
"for",
"required",
"files"
] | 77c976a72382fd0edef1144f9bea47d8c175c26b | https://github.com/mia-js/mia-js-core/blob/77c976a72382fd0edef1144f9bea47d8c175c26b/lib/moduleLoader/lib/requireAll.js#L100-L123 | |
31,061 | mia-js/mia-js-core | lib/moduleLoader/lib/requireAll.js | function (options, iterationInfo, modules) {
// filename filter
if (options.fileNameFilter) {
var match = iterationInfo.fileName.match(options.fileNameFilter);
if (!match) {
return;
}
}
// Filter spec.js files
var match = itera... | javascript | function (options, iterationInfo, modules) {
// filename filter
if (options.fileNameFilter) {
var match = iterationInfo.fileName.match(options.fileNameFilter);
if (!match) {
return;
}
}
// Filter spec.js files
var match = itera... | [
"function",
"(",
"options",
",",
"iterationInfo",
",",
"modules",
")",
"{",
"// filename filter",
"if",
"(",
"options",
".",
"fileNameFilter",
")",
"{",
"var",
"match",
"=",
"iterationInfo",
".",
"fileName",
".",
"match",
"(",
"options",
".",
"fileNameFilter",... | Process single file to module dictionary
@param options
@param fileName
@param modules | [
"Process",
"single",
"file",
"to",
"module",
"dictionary"
] | 77c976a72382fd0edef1144f9bea47d8c175c26b | https://github.com/mia-js/mia-js-core/blob/77c976a72382fd0edef1144f9bea47d8c175c26b/lib/moduleLoader/lib/requireAll.js#L181-L205 | |
31,062 | mia-js/mia-js-core | lib/moduleLoader/lib/requireAll.js | function (modules, options, iterationInfo) {
// load module into memory (unless `dontLoad` is true)
var module = true;
//default is options.dontLoad === false
if (options.dontLoad !== true) {
//if module is to be loaded
module = require(iterationInfo.absoluteFul... | javascript | function (modules, options, iterationInfo) {
// load module into memory (unless `dontLoad` is true)
var module = true;
//default is options.dontLoad === false
if (options.dontLoad !== true) {
//if module is to be loaded
module = require(iterationInfo.absoluteFul... | [
"function",
"(",
"modules",
",",
"options",
",",
"iterationInfo",
")",
"{",
"// load module into memory (unless `dontLoad` is true)",
"var",
"module",
"=",
"true",
";",
"//default is options.dontLoad === false",
"if",
"(",
"options",
".",
"dontLoad",
"!==",
"true",
")",... | Load single module
@param modules
@param options
@param iterationInfo | [
"Load",
"single",
"module"
] | 77c976a72382fd0edef1144f9bea47d8c175c26b | https://github.com/mia-js/mia-js-core/blob/77c976a72382fd0edef1144f9bea47d8c175c26b/lib/moduleLoader/lib/requireAll.js#L213-L285 | |
31,063 | mia-js/mia-js-core | lib/moduleLoader/lib/requireAll.js | function (options, iterationInfo) {
// Use the identity for the key name
var identity;
if (options.mode === 'list') {
identity = iterationInfo.relativeFullPath;
//identity = identity.toLowerCase();
//find and replace all containments of '/', ':' and '\' within... | javascript | function (options, iterationInfo) {
// Use the identity for the key name
var identity;
if (options.mode === 'list') {
identity = iterationInfo.relativeFullPath;
//identity = identity.toLowerCase();
//find and replace all containments of '/', ':' and '\' within... | [
"function",
"(",
"options",
",",
"iterationInfo",
")",
"{",
"// Use the identity for the key name",
"var",
"identity",
";",
"if",
"(",
"options",
".",
"mode",
"===",
"'list'",
")",
"{",
"identity",
"=",
"iterationInfo",
".",
"relativeFullPath",
";",
"//identity = ... | Generates identity for a module
@param options
@param iterationInfo
@returns {string} | [
"Generates",
"identity",
"for",
"a",
"module"
] | 77c976a72382fd0edef1144f9bea47d8c175c26b | https://github.com/mia-js/mia-js-core/blob/77c976a72382fd0edef1144f9bea47d8c175c26b/lib/moduleLoader/lib/requireAll.js#L293-L313 | |
31,064 | mia-js/mia-js-core | lib/moduleLoader/lib/requireAll.js | function (options, iterationInfo, modules) {
// Ignore explicitly excluded directories
if (options.excludeDirs) {
var match = iterationInfo.fileName.match(options.excludeDirs);
if (match)
return;
}
// Recursively call requireAll on each child dir... | javascript | function (options, iterationInfo, modules) {
// Ignore explicitly excluded directories
if (options.excludeDirs) {
var match = iterationInfo.fileName.match(options.excludeDirs);
if (match)
return;
}
// Recursively call requireAll on each child dir... | [
"function",
"(",
"options",
",",
"iterationInfo",
",",
"modules",
")",
"{",
"// Ignore explicitly excluded directories",
"if",
"(",
"options",
".",
"excludeDirs",
")",
"{",
"var",
"match",
"=",
"iterationInfo",
".",
"fileName",
".",
"match",
"(",
"options",
".",... | Processes one directory level
@param options :: general options
@param iterationInfo :: iteration options
@param modules :: object in which output will be loaded | [
"Processes",
"one",
"directory",
"level"
] | 77c976a72382fd0edef1144f9bea47d8c175c26b | https://github.com/mia-js/mia-js-core/blob/77c976a72382fd0edef1144f9bea47d8c175c26b/lib/moduleLoader/lib/requireAll.js#L321-L371 | |
31,065 | mia-js/mia-js-core | lib/logger/lib/logger.js | function (level, message, tag, data) {
var env = Shared.config('environment');
var levels = ['fatal', 'error', 'warn', 'info', 'debug', 'trace'];
var logLevelConfig = env.logLevel || "info";
if (logLevelConfig == "none") {
return;
}
var logLevel = levels.in... | javascript | function (level, message, tag, data) {
var env = Shared.config('environment');
var levels = ['fatal', 'error', 'warn', 'info', 'debug', 'trace'];
var logLevelConfig = env.logLevel || "info";
if (logLevelConfig == "none") {
return;
}
var logLevel = levels.in... | [
"function",
"(",
"level",
",",
"message",
",",
"tag",
",",
"data",
")",
"{",
"var",
"env",
"=",
"Shared",
".",
"config",
"(",
"'environment'",
")",
";",
"var",
"levels",
"=",
"[",
"'fatal'",
",",
"'error'",
",",
"'warn'",
",",
"'info'",
",",
"'debug'... | Write logging information
@param level => 'none', 'fatal', 'error', 'warn', 'info', 'debug', 'trace'
@param message = >Error message
@param tag => Tags of log info i.e. database, request. Default is 'default' or empty
@param data => Any data object
@private | [
"Write",
"logging",
"information"
] | 77c976a72382fd0edef1144f9bea47d8c175c26b | https://github.com/mia-js/mia-js-core/blob/77c976a72382fd0edef1144f9bea47d8c175c26b/lib/logger/lib/logger.js#L23-L82 | |
31,066 | mia-js/mia-js-core | lib/logger/lib/logger.js | function (obj, tag) {
tag = _.isArray(tag) ? tag.join(',') : tag;
tag = !_.isEmpty(tag) ? tag.toLowerCase() : 'default';
obj.trace = function (message, data) {
_logEvent("trace", message, tag, data);
};
obj.debug = function (message, data) {
_logEvent("d... | javascript | function (obj, tag) {
tag = _.isArray(tag) ? tag.join(',') : tag;
tag = !_.isEmpty(tag) ? tag.toLowerCase() : 'default';
obj.trace = function (message, data) {
_logEvent("trace", message, tag, data);
};
obj.debug = function (message, data) {
_logEvent("d... | [
"function",
"(",
"obj",
",",
"tag",
")",
"{",
"tag",
"=",
"_",
".",
"isArray",
"(",
"tag",
")",
"?",
"tag",
".",
"join",
"(",
"','",
")",
":",
"tag",
";",
"tag",
"=",
"!",
"_",
".",
"isEmpty",
"(",
"tag",
")",
"?",
"tag",
".",
"toLowerCase",
... | Provide log methods
@param obj
@param tag
@returns {*} | [
"Provide",
"log",
"methods"
] | 77c976a72382fd0edef1144f9bea47d8c175c26b | https://github.com/mia-js/mia-js-core/blob/77c976a72382fd0edef1144f9bea47d8c175c26b/lib/logger/lib/logger.js#L100-L129 | |
31,067 | AndreasPizsa/grunt-update-json | tasks/lib/update_json.js | expandField | function expandField(input, grunt){
var get = pointer(input);
return function(memo, fin, fout){
if(_.isString(fin)){
var match = fin.match(re.PATH_POINT);
// matched ...with a `$.` ...but not with a `\`
if(match && match[3] === '$.' && !match[1]){
// field name, starts with an ... | javascript | function expandField(input, grunt){
var get = pointer(input);
return function(memo, fin, fout){
if(_.isString(fin)){
var match = fin.match(re.PATH_POINT);
// matched ...with a `$.` ...but not with a `\`
if(match && match[3] === '$.' && !match[1]){
// field name, starts with an ... | [
"function",
"expandField",
"(",
"input",
",",
"grunt",
")",
"{",
"var",
"get",
"=",
"pointer",
"(",
"input",
")",
";",
"return",
"function",
"(",
"memo",
",",
"fin",
",",
"fout",
")",
"{",
"if",
"(",
"_",
".",
"isString",
"(",
"fin",
")",
")",
"{... | factory for a reduce function, bound to the input, that can get the value out of the input | [
"factory",
"for",
"a",
"reduce",
"function",
"bound",
"to",
"the",
"input",
"that",
"can",
"get",
"the",
"value",
"out",
"of",
"the",
"input"
] | c85f6575a039c665371ce411f0d47e2a264bb3b6 | https://github.com/AndreasPizsa/grunt-update-json/blob/c85f6575a039c665371ce411f0d47e2a264bb3b6/tasks/lib/update_json.js#L46-L82 |
31,068 | voxgig/seneca-hapi | hapi.js | action_handler | async function action_handler(req, h) {
const data = req.payload
const json = 'string' === typeof data ? tu.parseJSON(data) : data
if (json instanceof Error) {
throw json
}
const seneca = prepare_seneca(req, json)
const msg = tu.internalize_msg(seneca, json)
return await new Promise(... | javascript | async function action_handler(req, h) {
const data = req.payload
const json = 'string' === typeof data ? tu.parseJSON(data) : data
if (json instanceof Error) {
throw json
}
const seneca = prepare_seneca(req, json)
const msg = tu.internalize_msg(seneca, json)
return await new Promise(... | [
"async",
"function",
"action_handler",
"(",
"req",
",",
"h",
")",
"{",
"const",
"data",
"=",
"req",
".",
"payload",
"const",
"json",
"=",
"'string'",
"===",
"typeof",
"data",
"?",
"tu",
".",
"parseJSON",
"(",
"data",
")",
":",
"data",
"if",
"(",
"jso... | Convenience handler to call a seneca action directly from inbound POST JSON. | [
"Convenience",
"handler",
"to",
"call",
"a",
"seneca",
"action",
"directly",
"from",
"inbound",
"POST",
"JSON",
"."
] | 377c0e8c38bc2703686fcffa85a5999c93f9ef1c | https://github.com/voxgig/seneca-hapi/blob/377c0e8c38bc2703686fcffa85a5999c93f9ef1c/hapi.js#L64-L91 |
31,069 | mia-js/mia-js-core | lib/cronJobs/lib/jobManagementDbConnector.js | function () {
return ServerHeartbeatModel.find({
status: _statusActive
}).then(function (cursor) {
return Q.ninvoke(cursor, 'toArray').then(function (servers) {
var serverIds = [];
servers.map(function (value) {
serverIds.push(v... | javascript | function () {
return ServerHeartbeatModel.find({
status: _statusActive
}).then(function (cursor) {
return Q.ninvoke(cursor, 'toArray').then(function (servers) {
var serverIds = [];
servers.map(function (value) {
serverIds.push(v... | [
"function",
"(",
")",
"{",
"return",
"ServerHeartbeatModel",
".",
"find",
"(",
"{",
"status",
":",
"_statusActive",
"}",
")",
".",
"then",
"(",
"function",
"(",
"cursor",
")",
"{",
"return",
"Q",
".",
"ninvoke",
"(",
"cursor",
",",
"'toArray'",
")",
".... | Remove unknown serverIds from jobslist, can happen while server restart | [
"Remove",
"unknown",
"serverIds",
"from",
"jobslist",
"can",
"happen",
"while",
"server",
"restart"
] | 77c976a72382fd0edef1144f9bea47d8c175c26b | https://github.com/mia-js/mia-js-core/blob/77c976a72382fd0edef1144f9bea47d8c175c26b/lib/cronJobs/lib/jobManagementDbConnector.js#L301-L313 | |
31,070 | jbaicoianu/elation | components/utils/scripts/dust.js | function( input, chunk, context ){
// return given input if there is no dust reference to resolve
var output = input;
// dust compiles a string to function, if there are references
if( typeof input === "function"){
if( ( typeof input.isReference !== "undefined" ) && ( input.isReference === true ) ... | javascript | function( input, chunk, context ){
// return given input if there is no dust reference to resolve
var output = input;
// dust compiles a string to function, if there are references
if( typeof input === "function"){
if( ( typeof input.isReference !== "undefined" ) && ( input.isReference === true ) ... | [
"function",
"(",
"input",
",",
"chunk",
",",
"context",
")",
"{",
"// return given input if there is no dust reference to resolve",
"var",
"output",
"=",
"input",
";",
"// dust compiles a string to function, if there are references",
"if",
"(",
"typeof",
"input",
"===",
"\"... | Utility helping to resolve dust references in the given chunk | [
"Utility",
"helping",
"to",
"resolve",
"dust",
"references",
"in",
"the",
"given",
"chunk"
] | 5fb8824d8b7150c463daf2fe99c31716c6e8812f | https://github.com/jbaicoianu/elation/blob/5fb8824d8b7150c463daf2fe99c31716c6e8812f/components/utils/scripts/dust.js#L655-L674 | |
31,071 | jbaicoianu/elation | components/utils/scripts/dust.js | compactBuffers | function compactBuffers(context, node) {
var out = [node[0]], memo;
for (var i=1, len=node.length; i<len; i++) {
var res = dust.filterNode(context, node[i]);
if (res) {
if (res[0] === 'buffer') {
if (memo) {
memo[1] += res[1];
} else {
memo = res;
out.push... | javascript | function compactBuffers(context, node) {
var out = [node[0]], memo;
for (var i=1, len=node.length; i<len; i++) {
var res = dust.filterNode(context, node[i]);
if (res) {
if (res[0] === 'buffer') {
if (memo) {
memo[1] += res[1];
} else {
memo = res;
out.push... | [
"function",
"compactBuffers",
"(",
"context",
",",
"node",
")",
"{",
"var",
"out",
"=",
"[",
"node",
"[",
"0",
"]",
"]",
",",
"memo",
";",
"for",
"(",
"var",
"i",
"=",
"1",
",",
"len",
"=",
"node",
".",
"length",
";",
"i",
"<",
"len",
";",
"i... | Compacts consecutive buffer nodes into a single node | [
"Compacts",
"consecutive",
"buffer",
"nodes",
"into",
"a",
"single",
"node"
] | 5fb8824d8b7150c463daf2fe99c31716c6e8812f | https://github.com/jbaicoianu/elation/blob/5fb8824d8b7150c463daf2fe99c31716c6e8812f/components/utils/scripts/dust.js#L838-L857 |
31,072 | mia-js/mia-js-core | lib/utils/lib/ipAddressHelper.js | thisModule | function thisModule() {
var self = this;
/**
* Generate random hash value
* @returns {*}
*/
self.getClientIP = function (req) {
req = req || {};
req.connection = req.connection || {};
req.socket = req.socket || {};
req.client = req.client || {};
var ip... | javascript | function thisModule() {
var self = this;
/**
* Generate random hash value
* @returns {*}
*/
self.getClientIP = function (req) {
req = req || {};
req.connection = req.connection || {};
req.socket = req.socket || {};
req.client = req.client || {};
var ip... | [
"function",
"thisModule",
"(",
")",
"{",
"var",
"self",
"=",
"this",
";",
"/**\n * Generate random hash value\n * @returns {*}\n */",
"self",
".",
"getClientIP",
"=",
"function",
"(",
"req",
")",
"{",
"req",
"=",
"req",
"||",
"{",
"}",
";",
"req",
... | Determine Clients IP Address
@param err
@returns {*} | [
"Determine",
"Clients",
"IP",
"Address"
] | 77c976a72382fd0edef1144f9bea47d8c175c26b | https://github.com/mia-js/mia-js-core/blob/77c976a72382fd0edef1144f9bea47d8c175c26b/lib/utils/lib/ipAddressHelper.js#L7-L31 |
31,073 | AmpersandJS/ampersand-dom | ampersand-dom.js | function (el, cls) {
cls = getString(cls);
if (!cls) return;
if (Array.isArray(cls)) {
cls.forEach(function(c) {
dom.addClass(el, c);
});
} else if (el.classList) {
el.classList.add(cls);
} else {
if (!hasClass(el, c... | javascript | function (el, cls) {
cls = getString(cls);
if (!cls) return;
if (Array.isArray(cls)) {
cls.forEach(function(c) {
dom.addClass(el, c);
});
} else if (el.classList) {
el.classList.add(cls);
} else {
if (!hasClass(el, c... | [
"function",
"(",
"el",
",",
"cls",
")",
"{",
"cls",
"=",
"getString",
"(",
"cls",
")",
";",
"if",
"(",
"!",
"cls",
")",
"return",
";",
"if",
"(",
"Array",
".",
"isArray",
"(",
"cls",
")",
")",
"{",
"cls",
".",
"forEach",
"(",
"function",
"(",
... | optimize if we have classList | [
"optimize",
"if",
"we",
"have",
"classList"
] | 7a79f8a2a6c0bba16eb6d9f5e81295c0286aafa9 | https://github.com/AmpersandJS/ampersand-dom/blob/7a79f8a2a6c0bba16eb6d9f5e81295c0286aafa9/ampersand-dom.js#L7-L25 | |
31,074 | jbaicoianu/elation | components/utils/scripts/elation.js | function(name, container, args, events) {
/* handling for any default values if args are not specified */
var mergeDefaults = function(args, defaults) {
var args = args || {};
if (typeof defaults == 'object') {
for (var key in defaults) {
if (elation.utils.isNull(args[... | javascript | function(name, container, args, events) {
/* handling for any default values if args are not specified */
var mergeDefaults = function(args, defaults) {
var args = args || {};
if (typeof defaults == 'object') {
for (var key in defaults) {
if (elation.utils.isNull(args[... | [
"function",
"(",
"name",
",",
"container",
",",
"args",
",",
"events",
")",
"{",
"/* handling for any default values if args are not specified */",
"var",
"mergeDefaults",
"=",
"function",
"(",
"args",
",",
"defaults",
")",
"{",
"var",
"args",
"=",
"args",
"||",
... | At the top level, a component is just a function which checks to see if an instance with the given name exists already. If it doesn't we create it, and then we return a reference to the specified instance. | [
"At",
"the",
"top",
"level",
"a",
"component",
"is",
"just",
"a",
"function",
"which",
"checks",
"to",
"see",
"if",
"an",
"instance",
"with",
"the",
"given",
"name",
"exists",
"already",
".",
"If",
"it",
"doesn",
"t",
"we",
"create",
"it",
"and",
"then... | 5fb8824d8b7150c463daf2fe99c31716c6e8812f | https://github.com/jbaicoianu/elation/blob/5fb8824d8b7150c463daf2fe99c31716c6e8812f/components/utils/scripts/elation.js#L238-L322 | |
31,075 | healthsparq/ember-fountainhead | lib/parse-markdown.js | function(description) {
// Look for triple backtick code blocks flagged as `glimmer`;
// define end of block as triple backticks followed by a newline
let matches = description.match(/(```glimmer)(.|\n)*?```/gi);
if (matches && matches.length) {
matches.map(codeBlock => {
let blockEnd = codeBlock.len... | javascript | function(description) {
// Look for triple backtick code blocks flagged as `glimmer`;
// define end of block as triple backticks followed by a newline
let matches = description.match(/(```glimmer)(.|\n)*?```/gi);
if (matches && matches.length) {
matches.map(codeBlock => {
let blockEnd = codeBlock.len... | [
"function",
"(",
"description",
")",
"{",
"// Look for triple backtick code blocks flagged as `glimmer`;",
"// define end of block as triple backticks followed by a newline",
"let",
"matches",
"=",
"description",
".",
"match",
"(",
"/",
"(```glimmer)(.|\\n)*?```",
"/",
"gi",
")",... | Scans the description text for instances of markdown code blocks flagged
as `"glimmer"` syntax. If any such instances are found, they are copied,
stripped of their triple backticks and re-inserted into the
`templateString` immediately after the original declaration. This allows
for functional copies of your code exampl... | [
"Scans",
"the",
"description",
"text",
"for",
"instances",
"of",
"markdown",
"code",
"blocks",
"flagged",
"as",
"glimmer",
"syntax",
".",
"If",
"any",
"such",
"instances",
"are",
"found",
"they",
"are",
"copied",
"stripped",
"of",
"their",
"triple",
"backticks... | 3577546719b251385ca1093f812889590459205a | https://github.com/healthsparq/ember-fountainhead/blob/3577546719b251385ca1093f812889590459205a/lib/parse-markdown.js#L101-L115 | |
31,076 | jbaicoianu/elation | components/utils/htdocs/scripts/jsmart.js | obMerge | function obMerge(prefix, ob1, ob2 /*, ...*/)
{
for (var i=2; i<arguments.length; ++i)
{
for (var nm in arguments[i])
{
if (arguments[i].hasOwnProperty(nm) || typeof arguments[i][nm] == 'function')
{
if (typeof(arguments[i][... | javascript | function obMerge(prefix, ob1, ob2 /*, ...*/)
{
for (var i=2; i<arguments.length; ++i)
{
for (var nm in arguments[i])
{
if (arguments[i].hasOwnProperty(nm) || typeof arguments[i][nm] == 'function')
{
if (typeof(arguments[i][... | [
"function",
"obMerge",
"(",
"prefix",
",",
"ob1",
",",
"ob2",
"/*, ...*/",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"2",
";",
"i",
"<",
"arguments",
".",
"length",
";",
"++",
"i",
")",
"{",
"for",
"(",
"var",
"nm",
"in",
"arguments",
"[",
"i",
"]... | merges two or more objects into one and add prefix at the beginning of every property name at the top level
objects type is lost, only own properties copied | [
"merges",
"two",
"or",
"more",
"objects",
"into",
"one",
"and",
"add",
"prefix",
"at",
"the",
"beginning",
"of",
"every",
"property",
"name",
"at",
"the",
"top",
"level",
"objects",
"type",
"is",
"lost",
"only",
"own",
"properties",
"copied"
] | 5fb8824d8b7150c463daf2fe99c31716c6e8812f | https://github.com/jbaicoianu/elation/blob/5fb8824d8b7150c463daf2fe99c31716c6e8812f/components/utils/htdocs/scripts/jsmart.js#L17-L38 |
31,077 | jbaicoianu/elation | components/utils/htdocs/scripts/jsmart.js | function(e, s)
{
var parens = [];
e.tree.push(parens);
parens.parent = e.tree;
e.tree = parens;
} | javascript | function(e, s)
{
var parens = [];
e.tree.push(parens);
parens.parent = e.tree;
e.tree = parens;
} | [
"function",
"(",
"e",
",",
"s",
")",
"{",
"var",
"parens",
"=",
"[",
"]",
";",
"e",
".",
"tree",
".",
"push",
"(",
"parens",
")",
";",
"parens",
".",
"parent",
"=",
"e",
".",
"tree",
";",
"e",
".",
"tree",
"=",
"parens",
";",
"}"
] | expression in parentheses | [
"expression",
"in",
"parentheses"
] | 5fb8824d8b7150c463daf2fe99c31716c6e8812f | https://github.com/jbaicoianu/elation/blob/5fb8824d8b7150c463daf2fe99c31716c6e8812f/components/utils/htdocs/scripts/jsmart.js#L1093-L1099 | |
31,078 | mongodb-js/storage-mixin | lib/backends/errback.js | function(done) {
return {
success: function(res) {
done(null, res);
},
error: function(res, err) {
done(err);
}
};
} | javascript | function(done) {
return {
success: function(res) {
done(null, res);
},
error: function(res, err) {
done(err);
}
};
} | [
"function",
"(",
"done",
")",
"{",
"return",
"{",
"success",
":",
"function",
"(",
"res",
")",
"{",
"done",
"(",
"null",
",",
"res",
")",
";",
"}",
",",
"error",
":",
"function",
"(",
"res",
",",
"err",
")",
"{",
"done",
"(",
"err",
")",
";",
... | The opposite of wrapOptions, this helper wraps an errback
and returns an options object that calls the errback appropriately.
@param {Function} done
@return {Object} | [
"The",
"opposite",
"of",
"wrapOptions",
"this",
"helper",
"wraps",
"an",
"errback",
"and",
"returns",
"an",
"options",
"object",
"that",
"calls",
"the",
"errback",
"appropriately",
"."
] | 1f8c26e6db4738f6f502a9a3286d114364fe9ed8 | https://github.com/mongodb-js/storage-mixin/blob/1f8c26e6db4738f6f502a9a3286d114364fe9ed8/lib/backends/errback.js#L34-L43 | |
31,079 | knownasilya/interval | lib/interval.js | add | function add(base, addend) {
if (util.isDate(base)) {
return new Date(base.getTime() + interval(addend));
}
return interval(base) + interval(addend);
} | javascript | function add(base, addend) {
if (util.isDate(base)) {
return new Date(base.getTime() + interval(addend));
}
return interval(base) + interval(addend);
} | [
"function",
"add",
"(",
"base",
",",
"addend",
")",
"{",
"if",
"(",
"util",
".",
"isDate",
"(",
"base",
")",
")",
"{",
"return",
"new",
"Date",
"(",
"base",
".",
"getTime",
"(",
")",
"+",
"interval",
"(",
"addend",
")",
")",
";",
"}",
"return",
... | first parmater can be a date or an interval, second parameter has to be an interval returns the same type as the first parameter | [
"first",
"parmater",
"can",
"be",
"a",
"date",
"or",
"an",
"interval",
"second",
"parameter",
"has",
"to",
"be",
"an",
"interval",
"returns",
"the",
"same",
"type",
"as",
"the",
"first",
"parameter"
] | d8dd395944dc202f79031adeb3defe9296c5a7f8 | https://github.com/knownasilya/interval/blob/d8dd395944dc202f79031adeb3defe9296c5a7f8/lib/interval.js#L95-L100 |
31,080 | faucet-pipeline/faucet-pipeline-sass | lib/make-sass-renderer.js | renderSass | function renderSass(options) {
return new Promise((resolve, reject) => {
try {
// using synchronous rendering because it is faster
let result = sass.renderSync(options);
result.css = fixEOF(result.css);
resolve(result);
} catch(err) {
reject(err);
}
});
} | javascript | function renderSass(options) {
return new Promise((resolve, reject) => {
try {
// using synchronous rendering because it is faster
let result = sass.renderSync(options);
result.css = fixEOF(result.css);
resolve(result);
} catch(err) {
reject(err);
}
});
} | [
"function",
"renderSass",
"(",
"options",
")",
"{",
"return",
"new",
"Promise",
"(",
"(",
"resolve",
",",
"reject",
")",
"=>",
"{",
"try",
"{",
"// using synchronous rendering because it is faster",
"let",
"result",
"=",
"sass",
".",
"renderSync",
"(",
"options"... | promisified version of sass.render | [
"promisified",
"version",
"of",
"sass",
".",
"render"
] | a9c1e40671237abdef4939dfb07e8717bb187622 | https://github.com/faucet-pipeline/faucet-pipeline-sass/blob/a9c1e40671237abdef4939dfb07e8717bb187622/lib/make-sass-renderer.js#L29-L40 |
31,081 | jbaicoianu/elation | components/utils/scripts/sylvester.js | function(obj) {
if (obj.anchor) {
// obj is a plane or line
var P = this.elements.slice();
var C = obj.pointClosestTo(P).elements;
return Vector.create([C[0] + (C[0] - P[0]), C[1] + (C[1] - P[1]), C[2] + (C[2] - (P[2] || 0))]);
} else {
// obj is a point
var Q = obj.e... | javascript | function(obj) {
if (obj.anchor) {
// obj is a plane or line
var P = this.elements.slice();
var C = obj.pointClosestTo(P).elements;
return Vector.create([C[0] + (C[0] - P[0]), C[1] + (C[1] - P[1]), C[2] + (C[2] - (P[2] || 0))]);
} else {
// obj is a point
var Q = obj.e... | [
"function",
"(",
"obj",
")",
"{",
"if",
"(",
"obj",
".",
"anchor",
")",
"{",
"// obj is a plane or line\r",
"var",
"P",
"=",
"this",
".",
"elements",
".",
"slice",
"(",
")",
";",
"var",
"C",
"=",
"obj",
".",
"pointClosestTo",
"(",
"P",
")",
".",
"e... | Returns the result of reflecting the point in the given point, line or plane | [
"Returns",
"the",
"result",
"of",
"reflecting",
"the",
"point",
"in",
"the",
"given",
"point",
"line",
"or",
"plane"
] | 5fb8824d8b7150c463daf2fe99c31716c6e8812f | https://github.com/jbaicoianu/elation/blob/5fb8824d8b7150c463daf2fe99c31716c6e8812f/components/utils/scripts/sylvester.js#L264-L276 | |
31,082 | jbaicoianu/elation | components/utils/scripts/sylvester.js | function(obj) {
if (obj.normal) {
// obj is a plane
var A = this.anchor.elements, D = this.direction.elements;
var A1 = A[0], A2 = A[1], A3 = A[2], D1 = D[0], D2 = D[1], D3 = D[2];
var newA = this.anchor.reflectionIn(obj).elements;
// Add the line's direction vector to its anchor... | javascript | function(obj) {
if (obj.normal) {
// obj is a plane
var A = this.anchor.elements, D = this.direction.elements;
var A1 = A[0], A2 = A[1], A3 = A[2], D1 = D[0], D2 = D[1], D3 = D[2];
var newA = this.anchor.reflectionIn(obj).elements;
// Add the line's direction vector to its anchor... | [
"function",
"(",
"obj",
")",
"{",
"if",
"(",
"obj",
".",
"normal",
")",
"{",
"// obj is a plane\r",
"var",
"A",
"=",
"this",
".",
"anchor",
".",
"elements",
",",
"D",
"=",
"this",
".",
"direction",
".",
"elements",
";",
"var",
"A1",
"=",
"A",
"[",
... | Returns the line's reflection in the given point or line | [
"Returns",
"the",
"line",
"s",
"reflection",
"in",
"the",
"given",
"point",
"or",
"line"
] | 5fb8824d8b7150c463daf2fe99c31716c6e8812f | https://github.com/jbaicoianu/elation/blob/5fb8824d8b7150c463daf2fe99c31716c6e8812f/components/utils/scripts/sylvester.js#L973-L992 | |
31,083 | ericmatthys/grunt-changelog | tasks/changelog.js | getChanges | function getChanges(log, regex) {
var changes = [];
var match;
while ((match = regex.exec(log))) {
var change = '';
for (var i = 1, len = match.length; i < len; i++) {
change += match[i];
}
changes.push(change.trim());
}
return changes;
} | javascript | function getChanges(log, regex) {
var changes = [];
var match;
while ((match = regex.exec(log))) {
var change = '';
for (var i = 1, len = match.length; i < len; i++) {
change += match[i];
}
changes.push(change.trim());
}
return changes;
} | [
"function",
"getChanges",
"(",
"log",
",",
"regex",
")",
"{",
"var",
"changes",
"=",
"[",
"]",
";",
"var",
"match",
";",
"while",
"(",
"(",
"match",
"=",
"regex",
".",
"exec",
"(",
"log",
")",
")",
")",
"{",
"var",
"change",
"=",
"''",
";",
"fo... | Loop through each match and build the array of changes that will be passed to the template. | [
"Loop",
"through",
"each",
"match",
"and",
"build",
"the",
"array",
"of",
"changes",
"that",
"will",
"be",
"passed",
"to",
"the",
"template",
"."
] | 24bc2a0a5ba0bdfb3d46d4fbb10763181eab25e6 | https://github.com/ericmatthys/grunt-changelog/blob/24bc2a0a5ba0bdfb3d46d4fbb10763181eab25e6/tasks/changelog.js#L76-L91 |
31,084 | ericmatthys/grunt-changelog | tasks/changelog.js | getChangelog | function getChangelog(log) {
var data = {
date: moment().format('YYYY-MM-DD'),
features: getChanges(log, options.featureRegex),
fixes: getChanges(log, options.fixRegex)
};
return template(data);
} | javascript | function getChangelog(log) {
var data = {
date: moment().format('YYYY-MM-DD'),
features: getChanges(log, options.featureRegex),
fixes: getChanges(log, options.fixRegex)
};
return template(data);
} | [
"function",
"getChangelog",
"(",
"log",
")",
"{",
"var",
"data",
"=",
"{",
"date",
":",
"moment",
"(",
")",
".",
"format",
"(",
"'YYYY-MM-DD'",
")",
",",
"features",
":",
"getChanges",
"(",
"log",
",",
"options",
".",
"featureRegex",
")",
",",
"fixes",... | Generate the changelog using the templates defined in options. | [
"Generate",
"the",
"changelog",
"using",
"the",
"templates",
"defined",
"in",
"options",
"."
] | 24bc2a0a5ba0bdfb3d46d4fbb10763181eab25e6 | https://github.com/ericmatthys/grunt-changelog/blob/24bc2a0a5ba0bdfb3d46d4fbb10763181eab25e6/tasks/changelog.js#L94-L102 |
31,085 | ericmatthys/grunt-changelog | tasks/changelog.js | writeChangelog | function writeChangelog(changelog) {
var fileContents = null;
var firstLineFile = null;
var firstLineFileHeader = null;
var regex = null;
if (options.insertType && grunt.file.exists(options.dest)) {
fileContents = grunt.file.read(options.dest);
firstLineFile = fileContents... | javascript | function writeChangelog(changelog) {
var fileContents = null;
var firstLineFile = null;
var firstLineFileHeader = null;
var regex = null;
if (options.insertType && grunt.file.exists(options.dest)) {
fileContents = grunt.file.read(options.dest);
firstLineFile = fileContents... | [
"function",
"writeChangelog",
"(",
"changelog",
")",
"{",
"var",
"fileContents",
"=",
"null",
";",
"var",
"firstLineFile",
"=",
"null",
";",
"var",
"firstLineFileHeader",
"=",
"null",
";",
"var",
"regex",
"=",
"null",
";",
"if",
"(",
"options",
".",
"inser... | Write the changelog to the destination file. | [
"Write",
"the",
"changelog",
"to",
"the",
"destination",
"file",
"."
] | 24bc2a0a5ba0bdfb3d46d4fbb10763181eab25e6 | https://github.com/ericmatthys/grunt-changelog/blob/24bc2a0a5ba0bdfb3d46d4fbb10763181eab25e6/tasks/changelog.js#L105-L157 |
31,086 | mia-js/mia-js-core | lib/routesHandler/lib/initializeRoutes.js | function (preconditions) {
var errorCodesList = {
"500": ["InternalServerError"],
"400": [
"UnexpectedDefaultValue",
"UnexpectedType",
"MinLengthUnderachieved",
"MaxLengthExceeded",
"MinValueUnderachived",
... | javascript | function (preconditions) {
var errorCodesList = {
"500": ["InternalServerError"],
"400": [
"UnexpectedDefaultValue",
"UnexpectedType",
"MinLengthUnderachieved",
"MaxLengthExceeded",
"MinValueUnderachived",
... | [
"function",
"(",
"preconditions",
")",
"{",
"var",
"errorCodesList",
"=",
"{",
"\"500\"",
":",
"[",
"\"InternalServerError\"",
"]",
",",
"\"400\"",
":",
"[",
"\"UnexpectedDefaultValue\"",
",",
"\"UnexpectedType\"",
",",
"\"MinLengthUnderachieved\"",
",",
"\"MaxLengthE... | Returns a list of http codes defined in preconditions section in controller | [
"Returns",
"a",
"list",
"of",
"http",
"codes",
"defined",
"in",
"preconditions",
"section",
"in",
"controller"
] | 77c976a72382fd0edef1144f9bea47d8c175c26b | https://github.com/mia-js/mia-js-core/blob/77c976a72382fd0edef1144f9bea47d8c175c26b/lib/routesHandler/lib/initializeRoutes.js#L88-L132 | |
31,087 | mia-js/mia-js-core | lib/routesHandler/lib/initializeRoutes.js | function (attr, attrName) {
if (_.isObject(attr) && !_.isDate(attr) && !_.isBoolean(attr) && !_.isString(attr) && !_.isNumber(attr) && !_.isFunction(attr) && !_.isRegExp(attr) && !_.isArray(attr)) {
//attr = _removeAttributes();
for (var aIndex in attr) {
... | javascript | function (attr, attrName) {
if (_.isObject(attr) && !_.isDate(attr) && !_.isBoolean(attr) && !_.isString(attr) && !_.isNumber(attr) && !_.isFunction(attr) && !_.isRegExp(attr) && !_.isArray(attr)) {
//attr = _removeAttributes();
for (var aIndex in attr) {
... | [
"function",
"(",
"attr",
",",
"attrName",
")",
"{",
"if",
"(",
"_",
".",
"isObject",
"(",
"attr",
")",
"&&",
"!",
"_",
".",
"isDate",
"(",
"attr",
")",
"&&",
"!",
"_",
".",
"isBoolean",
"(",
"attr",
")",
"&&",
"!",
"_",
".",
"isString",
"(",
... | Remove attributes recursively | [
"Remove",
"attributes",
"recursively"
] | 77c976a72382fd0edef1144f9bea47d8c175c26b | https://github.com/mia-js/mia-js-core/blob/77c976a72382fd0edef1144f9bea47d8c175c26b/lib/routesHandler/lib/initializeRoutes.js#L148-L168 | |
31,088 | mia-js/mia-js-core | lib/routesHandler/lib/initializeRoutes.js | function (parametersList, parameters, section) {
if (parameters[section]) {
for (var name in parameters[section]) {
var addCondition = parameters[section][name];
if (parametersList[section] && parametersList[section][name]) {
/... | javascript | function (parametersList, parameters, section) {
if (parameters[section]) {
for (var name in parameters[section]) {
var addCondition = parameters[section][name];
if (parametersList[section] && parametersList[section][name]) {
/... | [
"function",
"(",
"parametersList",
",",
"parameters",
",",
"section",
")",
"{",
"if",
"(",
"parameters",
"[",
"section",
"]",
")",
"{",
"for",
"(",
"var",
"name",
"in",
"parameters",
"[",
"section",
"]",
")",
"{",
"var",
"addCondition",
"=",
"parameters"... | Parse preconditions parameters in section header, query, body | [
"Parse",
"preconditions",
"parameters",
"in",
"section",
"header",
"query",
"body"
] | 77c976a72382fd0edef1144f9bea47d8c175c26b | https://github.com/mia-js/mia-js-core/blob/77c976a72382fd0edef1144f9bea47d8c175c26b/lib/routesHandler/lib/initializeRoutes.js#L171-L215 | |
31,089 | mia-js/mia-js-core | lib/routesHandler/lib/initializeRoutes.js | function (req, res, next) {
if (!req.miajs.controllerDebugInfo) {
req.miajs.controllerDebugInfo = {};
}
if (controller.name && controller.version) {
req.miajs.controllerDebugInfo[controller.name + '_' + controller.version] = {'runtime': Date.now() - re... | javascript | function (req, res, next) {
if (!req.miajs.controllerDebugInfo) {
req.miajs.controllerDebugInfo = {};
}
if (controller.name && controller.version) {
req.miajs.controllerDebugInfo[controller.name + '_' + controller.version] = {'runtime': Date.now() - re... | [
"function",
"(",
"req",
",",
"res",
",",
"next",
")",
"{",
"if",
"(",
"!",
"req",
".",
"miajs",
".",
"controllerDebugInfo",
")",
"{",
"req",
".",
"miajs",
".",
"controllerDebugInfo",
"=",
"{",
"}",
";",
"}",
"if",
"(",
"controller",
".",
"name",
"&... | Measure runtime of controller | [
"Measure",
"runtime",
"of",
"controller"
] | 77c976a72382fd0edef1144f9bea47d8c175c26b | https://github.com/mia-js/mia-js-core/blob/77c976a72382fd0edef1144f9bea47d8c175c26b/lib/routesHandler/lib/initializeRoutes.js#L381-L389 | |
31,090 | mia-js/mia-js-core | lib/routesHandler/lib/initializeRoutes.js | function (routeConfig, methodValue) {
var rateLimits = [];
var environment = Shared.config("environment");
var globalRateLimit = environment.rateLimit;
if (globalRateLimit) {
if (globalRateLimit.interval && _.isNumber(globalRateLimit.interval) && parseInt(globalRateLimit.inte... | javascript | function (routeConfig, methodValue) {
var rateLimits = [];
var environment = Shared.config("environment");
var globalRateLimit = environment.rateLimit;
if (globalRateLimit) {
if (globalRateLimit.interval && _.isNumber(globalRateLimit.interval) && parseInt(globalRateLimit.inte... | [
"function",
"(",
"routeConfig",
",",
"methodValue",
")",
"{",
"var",
"rateLimits",
"=",
"[",
"]",
";",
"var",
"environment",
"=",
"Shared",
".",
"config",
"(",
"\"environment\"",
")",
";",
"var",
"globalRateLimit",
"=",
"environment",
".",
"rateLimit",
";",
... | Validate rate limits settings | [
"Validate",
"rate",
"limits",
"settings"
] | 77c976a72382fd0edef1144f9bea47d8c175c26b | https://github.com/mia-js/mia-js-core/blob/77c976a72382fd0edef1144f9bea47d8c175c26b/lib/routesHandler/lib/initializeRoutes.js#L459-L493 | |
31,091 | mia-js/mia-js-core | lib/routesHandler/lib/initializeRoutes.js | function (req, res, next) {
var ip = IPAddressHelper.getClientIP(req)
, route = req.miajs.route
, key = ip + route.path + route.method;
if (_.isEmpty(route.rateLimits)) {
next();
return;
}
RateLimiter.checkRateLimitsByKey(key, route.rateL... | javascript | function (req, res, next) {
var ip = IPAddressHelper.getClientIP(req)
, route = req.miajs.route
, key = ip + route.path + route.method;
if (_.isEmpty(route.rateLimits)) {
next();
return;
}
RateLimiter.checkRateLimitsByKey(key, route.rateL... | [
"function",
"(",
"req",
",",
"res",
",",
"next",
")",
"{",
"var",
"ip",
"=",
"IPAddressHelper",
".",
"getClientIP",
"(",
"req",
")",
",",
"route",
"=",
"req",
".",
"miajs",
".",
"route",
",",
"key",
"=",
"ip",
"+",
"route",
".",
"path",
"+",
"rou... | Route for rate limits check | [
"Route",
"for",
"rate",
"limits",
"check"
] | 77c976a72382fd0edef1144f9bea47d8c175c26b | https://github.com/mia-js/mia-js-core/blob/77c976a72382fd0edef1144f9bea47d8c175c26b/lib/routesHandler/lib/initializeRoutes.js#L497-L530 | |
31,092 | mia-js/mia-js-core | lib/rateLimiter/lib/rateLimiter.js | function (range) {
var coeff = 1000 * 60 * range;
return new Date(Math.ceil(new Date(Date.now()).getTime() / coeff) * coeff).getTime() / 1000;
} | javascript | function (range) {
var coeff = 1000 * 60 * range;
return new Date(Math.ceil(new Date(Date.now()).getTime() / coeff) * coeff).getTime() / 1000;
} | [
"function",
"(",
"range",
")",
"{",
"var",
"coeff",
"=",
"1000",
"*",
"60",
"*",
"range",
";",
"return",
"new",
"Date",
"(",
"Math",
".",
"ceil",
"(",
"new",
"Date",
"(",
"Date",
".",
"now",
"(",
")",
")",
".",
"getTime",
"(",
")",
"/",
"coeff"... | Calculate current time interval slot | [
"Calculate",
"current",
"time",
"interval",
"slot"
] | 77c976a72382fd0edef1144f9bea47d8c175c26b | https://github.com/mia-js/mia-js-core/blob/77c976a72382fd0edef1144f9bea47d8c175c26b/lib/rateLimiter/lib/rateLimiter.js#L21-L24 | |
31,093 | mia-js/mia-js-core | lib/rateLimiter/lib/rateLimiter.js | function (key, timeInterval, limit) {
//Validate rate limiter settings
if (!_.isNumber(timeInterval) || parseInt(timeInterval) <= 0 || !_.isNumber(limit) || parseInt(limit) <= 0) {
return Q.reject();
}
var cacheKey = Encryption.md5("MiaJSRateLimit" + key + _calculateCurrentTi... | javascript | function (key, timeInterval, limit) {
//Validate rate limiter settings
if (!_.isNumber(timeInterval) || parseInt(timeInterval) <= 0 || !_.isNumber(limit) || parseInt(limit) <= 0) {
return Q.reject();
}
var cacheKey = Encryption.md5("MiaJSRateLimit" + key + _calculateCurrentTi... | [
"function",
"(",
"key",
",",
"timeInterval",
",",
"limit",
")",
"{",
"//Validate rate limiter settings",
"if",
"(",
"!",
"_",
".",
"isNumber",
"(",
"timeInterval",
")",
"||",
"parseInt",
"(",
"timeInterval",
")",
"<=",
"0",
"||",
"!",
"_",
".",
"isNumber",... | Check global rate limits per ip | [
"Check",
"global",
"rate",
"limits",
"per",
"ip"
] | 77c976a72382fd0edef1144f9bea47d8c175c26b | https://github.com/mia-js/mia-js-core/blob/77c976a72382fd0edef1144f9bea47d8c175c26b/lib/rateLimiter/lib/rateLimiter.js#L27-L41 | |
31,094 | mia-js/mia-js-core | lib/rateLimiter/lib/rateLimiter.js | function (key, intervalSize, limit) {
var deferred = Q.defer()
, memcached = Shared.memcached();
if (!memcached) {
deferred.reject();
}
else {
//Get current rate for ip
memcached.get(key, function (err, value) {
if (err) {
... | javascript | function (key, intervalSize, limit) {
var deferred = Q.defer()
, memcached = Shared.memcached();
if (!memcached) {
deferred.reject();
}
else {
//Get current rate for ip
memcached.get(key, function (err, value) {
if (err) {
... | [
"function",
"(",
"key",
",",
"intervalSize",
",",
"limit",
")",
"{",
"var",
"deferred",
"=",
"Q",
".",
"defer",
"(",
")",
",",
"memcached",
"=",
"Shared",
".",
"memcached",
"(",
")",
";",
"if",
"(",
"!",
"memcached",
")",
"{",
"deferred",
".",
"rej... | Validate and increase current rate limit in memcache | [
"Validate",
"and",
"increase",
"current",
"rate",
"limit",
"in",
"memcache"
] | 77c976a72382fd0edef1144f9bea47d8c175c26b | https://github.com/mia-js/mia-js-core/blob/77c976a72382fd0edef1144f9bea47d8c175c26b/lib/rateLimiter/lib/rateLimiter.js#L44-L81 | |
31,095 | jbaicoianu/elation | components/utils/scripts/jit.js | function(e, win) {
var event = $.event.get(e, win);
var wheel = $.event.getWheel(event);
that.handleEvent('MouseWheel', e, win, wheel);
} | javascript | function(e, win) {
var event = $.event.get(e, win);
var wheel = $.event.getWheel(event);
that.handleEvent('MouseWheel', e, win, wheel);
} | [
"function",
"(",
"e",
",",
"win",
")",
"{",
"var",
"event",
"=",
"$",
".",
"event",
".",
"get",
"(",
"e",
",",
"win",
")",
";",
"var",
"wheel",
"=",
"$",
".",
"event",
".",
"getWheel",
"(",
"event",
")",
";",
"that",
".",
"handleEvent",
"(",
... | attach mousewheel event | [
"attach",
"mousewheel",
"event"
] | 5fb8824d8b7150c463daf2fe99c31716c6e8812f | https://github.com/jbaicoianu/elation/blob/5fb8824d8b7150c463daf2fe99c31716c6e8812f/components/utils/scripts/jit.js#L2037-L2041 | |
31,096 | jbaicoianu/elation | components/utils/scripts/jit.js | $E | function $E(tag, props) {
var elem = document.createElement(tag);
for(var p in props) {
if(typeof props[p] == "object") {
$.extend(elem[p], props[p]);
} else {
elem[p] = props[p];
}
}
if (tag == "canvas" && !supportsCanvas && G_vmlCanvasManager) {
elem = G_vmlCanv... | javascript | function $E(tag, props) {
var elem = document.createElement(tag);
for(var p in props) {
if(typeof props[p] == "object") {
$.extend(elem[p], props[p]);
} else {
elem[p] = props[p];
}
}
if (tag == "canvas" && !supportsCanvas && G_vmlCanvasManager) {
elem = G_vmlCanv... | [
"function",
"$E",
"(",
"tag",
",",
"props",
")",
"{",
"var",
"elem",
"=",
"document",
".",
"createElement",
"(",
"tag",
")",
";",
"for",
"(",
"var",
"p",
"in",
"props",
")",
"{",
"if",
"(",
"typeof",
"props",
"[",
"p",
"]",
"==",
"\"object\"",
")... | create element function | [
"create",
"element",
"function"
] | 5fb8824d8b7150c463daf2fe99c31716c6e8812f | https://github.com/jbaicoianu/elation/blob/5fb8824d8b7150c463daf2fe99c31716c6e8812f/components/utils/scripts/jit.js#L2719-L2732 |
31,097 | jbaicoianu/elation | components/utils/scripts/jit.js | getNodesToHide | function getNodesToHide(node) {
node = node || this.clickedNode;
if(!this.config.constrained) {
return [];
}
var Geom = this.geom;
var graph = this.graph;
var canvas = this.canvas;
var level = node._depth, nodeArray = [];
graph.eachNode(function(n) {
if(n... | javascript | function getNodesToHide(node) {
node = node || this.clickedNode;
if(!this.config.constrained) {
return [];
}
var Geom = this.geom;
var graph = this.graph;
var canvas = this.canvas;
var level = node._depth, nodeArray = [];
graph.eachNode(function(n) {
if(n... | [
"function",
"getNodesToHide",
"(",
"node",
")",
"{",
"node",
"=",
"node",
"||",
"this",
".",
"clickedNode",
";",
"if",
"(",
"!",
"this",
".",
"config",
".",
"constrained",
")",
"{",
"return",
"[",
"]",
";",
"}",
"var",
"Geom",
"=",
"this",
".",
"ge... | Nodes to contract | [
"Nodes",
"to",
"contract"
] | 5fb8824d8b7150c463daf2fe99c31716c6e8812f | https://github.com/jbaicoianu/elation/blob/5fb8824d8b7150c463daf2fe99c31716c6e8812f/components/utils/scripts/jit.js#L8113-L8143 |
31,098 | jbaicoianu/elation | components/utils/scripts/jit.js | getNodesToShow | function getNodesToShow(node) {
var nodeArray = [], config = this.config;
node = node || this.clickedNode;
this.clickedNode.eachLevel(0, config.levelsToShow, function(n) {
if(config.multitree && !('$orn' in n.data)
&& n.anySubnode(function(ch){ return ch.exist && !ch.d... | javascript | function getNodesToShow(node) {
var nodeArray = [], config = this.config;
node = node || this.clickedNode;
this.clickedNode.eachLevel(0, config.levelsToShow, function(n) {
if(config.multitree && !('$orn' in n.data)
&& n.anySubnode(function(ch){ return ch.exist && !ch.d... | [
"function",
"getNodesToShow",
"(",
"node",
")",
"{",
"var",
"nodeArray",
"=",
"[",
"]",
",",
"config",
"=",
"this",
".",
"config",
";",
"node",
"=",
"node",
"||",
"this",
".",
"clickedNode",
";",
"this",
".",
"clickedNode",
".",
"eachLevel",
"(",
"0",
... | Nodes to expand | [
"Nodes",
"to",
"expand"
] | 5fb8824d8b7150c463daf2fe99c31716c6e8812f | https://github.com/jbaicoianu/elation/blob/5fb8824d8b7150c463daf2fe99c31716c6e8812f/components/utils/scripts/jit.js#L8145-L8157 |
31,099 | primus/substream | substream.js | SubStream | function SubStream(stream, name, options) {
if (!(this instanceof SubStream)) return new SubStream(stream, name, options);
options = options || {};
this.readyState = stream.readyState; // Copy the current readyState.
this.stream = stream; // The underlaying stream.
this.name = nam... | javascript | function SubStream(stream, name, options) {
if (!(this instanceof SubStream)) return new SubStream(stream, name, options);
options = options || {};
this.readyState = stream.readyState; // Copy the current readyState.
this.stream = stream; // The underlaying stream.
this.name = nam... | [
"function",
"SubStream",
"(",
"stream",
",",
"name",
",",
"options",
")",
"{",
"if",
"(",
"!",
"(",
"this",
"instanceof",
"SubStream",
")",
")",
"return",
"new",
"SubStream",
"(",
"stream",
",",
"name",
",",
"options",
")",
";",
"options",
"=",
"option... | Streams provides a streaming, namespaced interface on top of a regular
stream.
Options:
- proxy: Array of addition events that need to be re-emitted.
@constructor
@param {Stream} stream The stream that needs we're streaming over.
@param {String} name The name of our stream.
@param {object} options SubStream configur... | [
"Streams",
"provides",
"a",
"streaming",
"namespaced",
"interface",
"on",
"top",
"of",
"a",
"regular",
"stream",
"."
] | 626792b746e1dc90b67a81045f442ee1f584c0ec | https://github.com/primus/substream/blob/626792b746e1dc90b67a81045f442ee1f584c0ec/substream.js#L25-L53 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.