repo
stringlengths
5
67
path
stringlengths
4
116
func_name
stringlengths
0
58
original_string
stringlengths
52
373k
language
stringclasses
1 value
code
stringlengths
52
373k
code_tokens
list
docstring
stringlengths
4
11.8k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
86
226
partition
stringclasses
1 value
jasonrojas/node-captions
lib/srt.js
function(filedata, callback) { var lines; lines = filedata.toString().split(/(?:\r\n|\r|\n)/gm); if (module.exports.verify(lines)) { return callback(undefined, lines); } return callback('INVALID_SRT_FORMAT'); }
javascript
function(filedata, callback) { var lines; lines = filedata.toString().split(/(?:\r\n|\r|\n)/gm); if (module.exports.verify(lines)) { return callback(undefined, lines); } return callback('INVALID_SRT_FORMAT'); }
[ "function", "(", "filedata", ",", "callback", ")", "{", "var", "lines", ";", "lines", "=", "filedata", ".", "toString", "(", ")", ".", "split", "(", "/", "(?:\\r\\n|\\r|\\n)", "/", "gm", ")", ";", "if", "(", "module", ".", "exports", ".", "verify", "...
Parses srt captions, errors if format is invalid @function @param {string} filedata - String of caption data @param {callback} callback - function to call when complete @public
[ "Parses", "srt", "captions", "errors", "if", "format", "is", "invalid" ]
4b7fd97dd36ea14bff393781f1d609644bcd61a3
https://github.com/jasonrojas/node-captions/blob/4b7fd97dd36ea14bff393781f1d609644bcd61a3/lib/srt.js#L91-L98
train
jasonrojas/node-captions
lib/srt.js
function(data) { var json = {}, index = 0, id, text, startTimeMicro, durationMicro, invalidText = /^\s+$/, endTimeMicro, time, lastNonEmptyLine; function getLastNonEmptyLine(linesArray) { ...
javascript
function(data) { var json = {}, index = 0, id, text, startTimeMicro, durationMicro, invalidText = /^\s+$/, endTimeMicro, time, lastNonEmptyLine; function getLastNonEmptyLine(linesArray) { ...
[ "function", "(", "data", ")", "{", "var", "json", "=", "{", "}", ",", "index", "=", "0", ",", "id", ",", "text", ",", "startTimeMicro", ",", "durationMicro", ",", "invalidText", "=", "/", "^\\s+$", "/", ",", "endTimeMicro", ",", "time", ",", "lastNon...
converts SRT to JSON format @function @param {array} data - output from read usually @public
[ "converts", "SRT", "to", "JSON", "format" ]
4b7fd97dd36ea14bff393781f1d609644bcd61a3
https://github.com/jasonrojas/node-captions/blob/4b7fd97dd36ea14bff393781f1d609644bcd61a3/lib/srt.js#L116-L183
train
jasonrojas/node-captions
lib/srt.js
function(timestamp) { if (!timestamp) { return; } //TODO check this //var secondsPerStamp = 1.001, var timesplit = timestamp.replace(',', ':').split(':'); return (parseInt(timesplit[0], 10) * 3600 + parseInt(timesplit[1], 10) * 60 + par...
javascript
function(timestamp) { if (!timestamp) { return; } //TODO check this //var secondsPerStamp = 1.001, var timesplit = timestamp.replace(',', ':').split(':'); return (parseInt(timesplit[0], 10) * 3600 + parseInt(timesplit[1], 10) * 60 + par...
[ "function", "(", "timestamp", ")", "{", "if", "(", "!", "timestamp", ")", "{", "return", ";", "}", "//TODO check this", "//var secondsPerStamp = 1.001,", "var", "timesplit", "=", "timestamp", ".", "replace", "(", "','", ",", "':'", ")", ".", "split", "(", ...
translates timestamp to microseconds @function @param {string} timestamp - string timestamp from srt file @public
[ "translates", "timestamp", "to", "microseconds" ]
4b7fd97dd36ea14bff393781f1d609644bcd61a3
https://github.com/jasonrojas/node-captions/blob/4b7fd97dd36ea14bff393781f1d609644bcd61a3/lib/srt.js#L190-L202
train
jasonrojas/node-captions
lib/srt.js
function(text) { return macros.cleanMacros(text.replace(/\n/g, '{break}').replace(/<i>/g, '{italic}').replace(/<\/i>/g, '{end-italic}')); }
javascript
function(text) { return macros.cleanMacros(text.replace(/\n/g, '{break}').replace(/<i>/g, '{italic}').replace(/<\/i>/g, '{end-italic}')); }
[ "function", "(", "text", ")", "{", "return", "macros", ".", "cleanMacros", "(", "text", ".", "replace", "(", "/", "\\n", "/", "g", ",", "'{break}'", ")", ".", "replace", "(", "/", "<i>", "/", "g", ",", "'{italic}'", ")", ".", "replace", "(", "/", ...
converts SRT stylings to macros @function @param {string} text - text to render macros for @public
[ "converts", "SRT", "stylings", "to", "macros" ]
4b7fd97dd36ea14bff393781f1d609644bcd61a3
https://github.com/jasonrojas/node-captions/blob/4b7fd97dd36ea14bff393781f1d609644bcd61a3/lib/srt.js#L209-L211
train
raveljs/ravel
lib/util/redis_session_store.js
finishBasicPromise
function finishBasicPromise (resolve, reject) { return (err, res) => { if (err) { return reject(err); } else { return resolve(res); } }; }
javascript
function finishBasicPromise (resolve, reject) { return (err, res) => { if (err) { return reject(err); } else { return resolve(res); } }; }
[ "function", "finishBasicPromise", "(", "resolve", ",", "reject", ")", "{", "return", "(", "err", ",", "res", ")", "=>", "{", "if", "(", "err", ")", "{", "return", "reject", "(", "err", ")", ";", "}", "else", "{", "return", "resolve", "(", "res", ")...
Shorthand for adapting callbacks to `Promise`s. @param {Function} resolve - A resolve function. @param {Function} reject - A reject function. @private
[ "Shorthand", "for", "adapting", "callbacks", "to", "Promise", "s", "." ]
f2a03283479c94443cf94cd00d9ac720645e05fc
https://github.com/raveljs/ravel/blob/f2a03283479c94443cf94cd00d9ac720645e05fc/lib/util/redis_session_store.js#L13-L21
train
raveljs/ravel
lib/core/routes.js
initRoutes
function initRoutes (ravelInstance, koaRouter) { const proto = Object.getPrototypeOf(this); // handle class-level @mapping decorators const classMeta = Metadata.getClassMeta(proto, '@mapping', Object.create(null)); for (const r of Object.keys(classMeta)) { buildRoute(ravelInstance, this, koaRouter, r, class...
javascript
function initRoutes (ravelInstance, koaRouter) { const proto = Object.getPrototypeOf(this); // handle class-level @mapping decorators const classMeta = Metadata.getClassMeta(proto, '@mapping', Object.create(null)); for (const r of Object.keys(classMeta)) { buildRoute(ravelInstance, this, koaRouter, r, class...
[ "function", "initRoutes", "(", "ravelInstance", ",", "koaRouter", ")", "{", "const", "proto", "=", "Object", ".", "getPrototypeOf", "(", "this", ")", ";", "// handle class-level @mapping decorators", "const", "classMeta", "=", "Metadata", ".", "getClassMeta", "(", ...
Initializer for this `Routes` class. @param {Ravel} ravelInstance - Instance of a Ravel app. @param {Object} koaRouter - Instance of koa-router. @private
[ "Initializer", "for", "this", "Routes", "class", "." ]
f2a03283479c94443cf94cd00d9ac720645e05fc
https://github.com/raveljs/ravel/blob/f2a03283479c94443cf94cd00d9ac720645e05fc/lib/core/routes.js#L141-L158
train
appcues/snabbdom-virtualize
src/nodes.js
getClasses
function getClasses(element) { const className = element.className; const classes = {}; if (className !== null && className.length > 0) { className.split(' ').forEach((className) => { if (className.trim().length) { classes[className.trim()] = true; } }...
javascript
function getClasses(element) { const className = element.className; const classes = {}; if (className !== null && className.length > 0) { className.split(' ').forEach((className) => { if (className.trim().length) { classes[className.trim()] = true; } }...
[ "function", "getClasses", "(", "element", ")", "{", "const", "className", "=", "element", ".", "className", ";", "const", "classes", "=", "{", "}", ";", "if", "(", "className", "!==", "null", "&&", "className", ".", "length", ">", "0", ")", "{", "class...
Builds the class object for the VNode.
[ "Builds", "the", "class", "object", "for", "the", "VNode", "." ]
f3fd12de0911ed575751e5c13f94c3ffc6d795c4
https://github.com/appcues/snabbdom-virtualize/blob/f3fd12de0911ed575751e5c13f94c3ffc6d795c4/src/nodes.js#L85-L96
train
appcues/snabbdom-virtualize
src/nodes.js
getStyle
function getStyle(element) { const style = element.style; const styles = {}; for (let i = 0; i < style.length; i++) { const name = style.item(i); const transformedName = transformName(name); styles[transformedName] = style.getPropertyValue(name); } return styles; }
javascript
function getStyle(element) { const style = element.style; const styles = {}; for (let i = 0; i < style.length; i++) { const name = style.item(i); const transformedName = transformName(name); styles[transformedName] = style.getPropertyValue(name); } return styles; }
[ "function", "getStyle", "(", "element", ")", "{", "const", "style", "=", "element", ".", "style", ";", "const", "styles", "=", "{", "}", ";", "for", "(", "let", "i", "=", "0", ";", "i", "<", "style", ".", "length", ";", "i", "++", ")", "{", "co...
Builds the style object for the VNode.
[ "Builds", "the", "style", "object", "for", "the", "VNode", "." ]
f3fd12de0911ed575751e5c13f94c3ffc6d795c4
https://github.com/appcues/snabbdom-virtualize/blob/f3fd12de0911ed575751e5c13f94c3ffc6d795c4/src/nodes.js#L99-L108
train
raveljs/ravel
lib/core/params.js
function (value) { const IllegalValue = this.$err.IllegalValue; if (typeof value !== 'string') { return value; } const result = value.replace(ENVVAR_PATTERN, function () { const varname = arguments[1]; if (process.env[varname] === undefined) { throw new IllegalValue(`Environmen...
javascript
function (value) { const IllegalValue = this.$err.IllegalValue; if (typeof value !== 'string') { return value; } const result = value.replace(ENVVAR_PATTERN, function () { const varname = arguments[1]; if (process.env[varname] === undefined) { throw new IllegalValue(`Environmen...
[ "function", "(", "value", ")", "{", "const", "IllegalValue", "=", "this", ".", "$err", ".", "IllegalValue", ";", "if", "(", "typeof", "value", "!==", "'string'", ")", "{", "return", "value", ";", "}", "const", "result", "=", "value", ".", "replace", "(...
Interpolates config values with the values of the environment variables of the process. @private @param {any} value - The value specified for a parameter; possibly an environment variable.
[ "Interpolates", "config", "values", "with", "the", "values", "of", "the", "environment", "variables", "of", "the", "process", "." ]
f2a03283479c94443cf94cd00d9ac720645e05fc
https://github.com/raveljs/ravel/blob/f2a03283479c94443cf94cd00d9ac720645e05fc/lib/core/params.js#L30-L44
train
duereg/normalize-object
src/normalize-object.js
normalize
function normalize(obj, caseType = 'camel') { let ret = obj; const method = methods[caseType]; if (Array.isArray(obj)) { ret = []; let i = 0; while (i < obj.length) { ret.push(normalize(obj[i], caseType)); ++i; } } else if (isPlainObject(obj)) { ret = {}; // eslint-disable-...
javascript
function normalize(obj, caseType = 'camel') { let ret = obj; const method = methods[caseType]; if (Array.isArray(obj)) { ret = []; let i = 0; while (i < obj.length) { ret.push(normalize(obj[i], caseType)); ++i; } } else if (isPlainObject(obj)) { ret = {}; // eslint-disable-...
[ "function", "normalize", "(", "obj", ",", "caseType", "=", "'camel'", ")", "{", "let", "ret", "=", "obj", ";", "const", "method", "=", "methods", "[", "caseType", "]", ";", "if", "(", "Array", ".", "isArray", "(", "obj", ")", ")", "{", "ret", "=", ...
Normalize all keys of `obj` recursively. @param {Object} obj to normalize @param {String} caseType type of case to convert object to @return {Object} @api public
[ "Normalize", "all", "keys", "of", "obj", "recursively", "." ]
21768211e549b3b85f1a9432d79692738c590ef5
https://github.com/duereg/normalize-object/blob/21768211e549b3b85f1a9432d79692738c590ef5/src/normalize-object.js#L17-L38
train
raveljs/ravel
lib/core/module.js
connectHandlers
function connectHandlers (decorator, event) { const handlers = Metadata.getClassMeta(Object.getPrototypeOf(self), decorator, Object.create(null)); for (const f of Object.keys(handlers)) { ravelInstance.once(event, (...args) => { ravelInstance.$log.trace(`${name}: Invoking ${decorator} ${f}`); ...
javascript
function connectHandlers (decorator, event) { const handlers = Metadata.getClassMeta(Object.getPrototypeOf(self), decorator, Object.create(null)); for (const f of Object.keys(handlers)) { ravelInstance.once(event, (...args) => { ravelInstance.$log.trace(`${name}: Invoking ${decorator} ${f}`); ...
[ "function", "connectHandlers", "(", "decorator", ",", "event", ")", "{", "const", "handlers", "=", "Metadata", ".", "getClassMeta", "(", "Object", ".", "getPrototypeOf", "(", "self", ")", ",", "decorator", ",", "Object", ".", "create", "(", "null", ")", ")...
connect any Ravel lifecycle handlers to the appropriate events
[ "connect", "any", "Ravel", "lifecycle", "handlers", "to", "the", "appropriate", "events" ]
f2a03283479c94443cf94cd00d9ac720645e05fc
https://github.com/raveljs/ravel/blob/f2a03283479c94443cf94cd00d9ac720645e05fc/lib/core/module.js#L21-L29
train
apathetic/scrollify
dist/scrollify.es6.js
translateX
function translateX(progress) { var to = (this.options.to !== undefined) ? this.options.to : 0; var from = (this.options.from !== undefined) ? this.options.from : 0; var offset = (to - from) * progress + from; this.transforms.position[0] = offset; }
javascript
function translateX(progress) { var to = (this.options.to !== undefined) ? this.options.to : 0; var from = (this.options.from !== undefined) ? this.options.from : 0; var offset = (to - from) * progress + from; this.transforms.position[0] = offset; }
[ "function", "translateX", "(", "progress", ")", "{", "var", "to", "=", "(", "this", ".", "options", ".", "to", "!==", "undefined", ")", "?", "this", ".", "options", ".", "to", ":", "0", ";", "var", "from", "=", "(", "this", ".", "options", ".", "...
Translate an element along the X-axis. @param {Float} progress Current progress data of the scene, between 0 and 1. @this {Object} @return {void}
[ "Translate", "an", "element", "along", "the", "X", "-", "axis", "." ]
9aa7b5405f65d0e2cf15e648d647a56f9c4f2d45
https://github.com/apathetic/scrollify/blob/9aa7b5405f65d0e2cf15e648d647a56f9c4f2d45/dist/scrollify.es6.js#L656-L662
train
apathetic/scrollify
dist/scrollify.es6.js
scale
function scale(progress) { var to = (this.options.to !== undefined) ? this.options.to : 1; var from = (this.options.from !== undefined) ? this.options.from : this.transforms.scale[0]; var scale = (to - from) * progress + from; this.transforms.scale[0] = scale; this.transforms.scale[1] = scale; }
javascript
function scale(progress) { var to = (this.options.to !== undefined) ? this.options.to : 1; var from = (this.options.from !== undefined) ? this.options.from : this.transforms.scale[0]; var scale = (to - from) * progress + from; this.transforms.scale[0] = scale; this.transforms.scale[1] = scale; }
[ "function", "scale", "(", "progress", ")", "{", "var", "to", "=", "(", "this", ".", "options", ".", "to", "!==", "undefined", ")", "?", "this", ".", "options", ".", "to", ":", "1", ";", "var", "from", "=", "(", "this", ".", "options", ".", "from"...
Uniformly scale an element along both axis'. @param {Float} progress Current progress data of the scene, between 0 and 1. @this {Object} @return {void}
[ "Uniformly", "scale", "an", "element", "along", "both", "axis", "." ]
9aa7b5405f65d0e2cf15e648d647a56f9c4f2d45
https://github.com/apathetic/scrollify/blob/9aa7b5405f65d0e2cf15e648d647a56f9c4f2d45/dist/scrollify.es6.js#L706-L713
train
apathetic/scrollify
dist/scrollify.es6.js
fade
function fade(progress) { var to = (this.options.to !== undefined) ? this.options.to : 0; var from = (this.options.from !== undefined) ? this.options.from : 1; var opacity = (to - from) * progress + from; this.element.style.opacity = opacity; }
javascript
function fade(progress) { var to = (this.options.to !== undefined) ? this.options.to : 0; var from = (this.options.from !== undefined) ? this.options.from : 1; var opacity = (to - from) * progress + from; this.element.style.opacity = opacity; }
[ "function", "fade", "(", "progress", ")", "{", "var", "to", "=", "(", "this", ".", "options", ".", "to", "!==", "undefined", ")", "?", "this", ".", "options", ".", "to", ":", "0", ";", "var", "from", "=", "(", "this", ".", "options", ".", "from",...
Update an element's opacity. @param {Float} progress Current progress data of the scene, between 0 and 1. @this {Object} @return {void}
[ "Update", "an", "element", "s", "opacity", "." ]
9aa7b5405f65d0e2cf15e648d647a56f9c4f2d45
https://github.com/apathetic/scrollify/blob/9aa7b5405f65d0e2cf15e648d647a56f9c4f2d45/dist/scrollify.es6.js#L721-L727
train
apathetic/scrollify
dist/scrollify.es6.js
blur
function blur(progress) { var to = (this.options.to !== undefined) ? this.options.to : 0; var from = (this.options.from !== undefined) ? this.options.from : 0; var amount = (to - from) * progress + from; this.element.style.filter = 'blur(' + amount + 'px)'; }
javascript
function blur(progress) { var to = (this.options.to !== undefined) ? this.options.to : 0; var from = (this.options.from !== undefined) ? this.options.from : 0; var amount = (to - from) * progress + from; this.element.style.filter = 'blur(' + amount + 'px)'; }
[ "function", "blur", "(", "progress", ")", "{", "var", "to", "=", "(", "this", ".", "options", ".", "to", "!==", "undefined", ")", "?", "this", ".", "options", ".", "to", ":", "0", ";", "var", "from", "=", "(", "this", ".", "options", ".", "from",...
Update an element's blur. @param {Float} progress Current progress of the scene, between 0 and 1. @this {Object} @return {void}
[ "Update", "an", "element", "s", "blur", "." ]
9aa7b5405f65d0e2cf15e648d647a56f9c4f2d45
https://github.com/apathetic/scrollify/blob/9aa7b5405f65d0e2cf15e648d647a56f9c4f2d45/dist/scrollify.es6.js#L735-L741
train
apathetic/scrollify
dist/scrollify.es6.js
parallax
function parallax(progress) { var range = this.options.range || 0; var offset = progress * range; // TODO add provision for speed as well this.transforms.position[1] = offset; // just vertical for now }
javascript
function parallax(progress) { var range = this.options.range || 0; var offset = progress * range; // TODO add provision for speed as well this.transforms.position[1] = offset; // just vertical for now }
[ "function", "parallax", "(", "progress", ")", "{", "var", "range", "=", "this", ".", "options", ".", "range", "||", "0", ";", "var", "offset", "=", "progress", "*", "range", ";", "// TODO add provision for speed as well", "this", ".", "transforms", ".", "pos...
Parallax an element. @param {Float} progress Current progress data of the scene, between 0 and 1. @this {Object} @return {void}
[ "Parallax", "an", "element", "." ]
9aa7b5405f65d0e2cf15e648d647a56f9c4f2d45
https://github.com/apathetic/scrollify/blob/9aa7b5405f65d0e2cf15e648d647a56f9c4f2d45/dist/scrollify.es6.js#L749-L754
train
apathetic/scrollify
dist/scrollify.es6.js
toggle
function toggle(progress) { var opts = this.options; var element = this.element; var times = Object.keys(opts); times.forEach(function(time) { var css = opts[time]; if (progress > time) { element.classList.add(css); } else { element.classList.remove(css); } }); }
javascript
function toggle(progress) { var opts = this.options; var element = this.element; var times = Object.keys(opts); times.forEach(function(time) { var css = opts[time]; if (progress > time) { element.classList.add(css); } else { element.classList.remove(css); } }); }
[ "function", "toggle", "(", "progress", ")", "{", "var", "opts", "=", "this", ".", "options", ";", "var", "element", "=", "this", ".", "element", ";", "var", "times", "=", "Object", ".", "keys", "(", "opts", ")", ";", "times", ".", "forEach", "(", "...
Toggle a class on or off. @param {Float} progress: Current progress data of the scene, between 0 and 1. @this {Object} @return {void}
[ "Toggle", "a", "class", "on", "or", "off", "." ]
9aa7b5405f65d0e2cf15e648d647a56f9c4f2d45
https://github.com/apathetic/scrollify/blob/9aa7b5405f65d0e2cf15e648d647a56f9c4f2d45/dist/scrollify.es6.js#L762-L776
train
bpmn-io/bpmn-questionnaire
lib/components/Diagram.js
Diagram
function Diagram(index, options, question) { this.index = index; this.options = options; this.question = question; this.element = createElement(h('li.list-group-item', { style: { width: '100%', height: '500px' } })); this.viewer; if (options.xml) { // Load XML this.xml...
javascript
function Diagram(index, options, question) { this.index = index; this.options = options; this.question = question; this.element = createElement(h('li.list-group-item', { style: { width: '100%', height: '500px' } })); this.viewer; if (options.xml) { // Load XML this.xml...
[ "function", "Diagram", "(", "index", ",", "options", ",", "question", ")", "{", "this", ".", "index", "=", "index", ";", "this", ".", "options", "=", "options", ";", "this", ".", "question", "=", "question", ";", "this", ".", "element", "=", "createEle...
Diagram component. @param {number} index - Index of question. @param {Object} options - Options. @param {Object} question - Reference to the Question instance.
[ "Diagram", "component", "." ]
1f4dc63272f99a491a7ce2a5db7c1d56c3e82132
https://github.com/bpmn-io/bpmn-questionnaire/blob/1f4dc63272f99a491a7ce2a5db7c1d56c3e82132/lib/components/Diagram.js#L25-L73
train
raveljs/ravel
lib/util/kvstore.js
createClient
function createClient (ravelInstance, restrict = true) { const localRedis = ravelInstance.get('redis port') === undefined || ravelInstance.get('redis host') === undefined; ravelInstance.on('post init', () => { ravelInstance.$log.info(localRedis ? 'Using in-memory key-value store. Please do not scale this ...
javascript
function createClient (ravelInstance, restrict = true) { const localRedis = ravelInstance.get('redis port') === undefined || ravelInstance.get('redis host') === undefined; ravelInstance.on('post init', () => { ravelInstance.$log.info(localRedis ? 'Using in-memory key-value store. Please do not scale this ...
[ "function", "createClient", "(", "ravelInstance", ",", "restrict", "=", "true", ")", "{", "const", "localRedis", "=", "ravelInstance", ".", "get", "(", "'redis port'", ")", "===", "undefined", "||", "ravelInstance", ".", "get", "(", "'redis host'", ")", "===",...
Returns a fresh connection to Redis. @param {Ravel} ravelInstance - An instance of a Ravel app. @param {boolean} restrict - Iff true, disable `exit`, `subcribe`, `psubscribe`, `unsubscribe` and `punsubscribe`. @returns {Object} Returns a fresh connection to Redis. @private
[ "Returns", "a", "fresh", "connection", "to", "Redis", "." ]
f2a03283479c94443cf94cd00d9ac720645e05fc
https://github.com/raveljs/ravel/blob/f2a03283479c94443cf94cd00d9ac720645e05fc/lib/util/kvstore.js#L52-L107
train
bpmn-io/bpmn-questionnaire
lib/BpmnQuestionnaire.js
BpmnQuestionnaire
function BpmnQuestionnaire(options) { // Check if options was provided if (!options) { throw new Error('No options provided'); } if (has(options, 'questionnaireJson')) { this.questionnaireJson = options.questionnaireJson; } else { // Report error throw new Error('No questionnaire specified'...
javascript
function BpmnQuestionnaire(options) { // Check if options was provided if (!options) { throw new Error('No options provided'); } if (has(options, 'questionnaireJson')) { this.questionnaireJson = options.questionnaireJson; } else { // Report error throw new Error('No questionnaire specified'...
[ "function", "BpmnQuestionnaire", "(", "options", ")", "{", "// Check if options was provided", "if", "(", "!", "options", ")", "{", "throw", "new", "Error", "(", "'No options provided'", ")", ";", "}", "if", "(", "has", "(", "options", ",", "'questionnaireJson'"...
Creates a new instance of a questionnaire and appends it to a container element. @constructor @param {Object} options - Options. @param {Object} options.questionnaireJson - Questionnaire. @param {Object} options.types - Types. @param {Object|string} - options.container - Element or ID of element that's going to contai...
[ "Creates", "a", "new", "instance", "of", "a", "questionnaire", "and", "appends", "it", "to", "a", "container", "element", "." ]
1f4dc63272f99a491a7ce2a5db7c1d56c3e82132
https://github.com/bpmn-io/bpmn-questionnaire/blob/1f4dc63272f99a491a7ce2a5db7c1d56c3e82132/lib/BpmnQuestionnaire.js#L42-L152
train
bpmn-io/bpmn-questionnaire
lib/BpmnQuestionnaire.js
function (index, options, questionnaire) { this.index = index; this.options = options; this.questionnaire = questionnaire; if (options.diagram) { this.diagram = new Diagram(index, options.diagram, this); } // Initial state is immutable this.initState = Immutable({ ...
javascript
function (index, options, questionnaire) { this.index = index; this.options = options; this.questionnaire = questionnaire; if (options.diagram) { this.diagram = new Diagram(index, options.diagram, this); } // Initial state is immutable this.initState = Immutable({ ...
[ "function", "(", "index", ",", "options", ",", "questionnaire", ")", "{", "this", ".", "index", "=", "index", ";", "this", ".", "options", "=", "options", ";", "this", ".", "questionnaire", "=", "questionnaire", ";", "if", "(", "options", ".", "diagram",...
Contructor function that serves as a base for every type. Methods and properties defined in spec will be assigned to the prototype of this constructor. @param {number} index - Index of question inside the array of questions. @param {Object} options - Object containing the actual question. @param {Object} questionnaire...
[ "Contructor", "function", "that", "serves", "as", "a", "base", "for", "every", "type", ".", "Methods", "and", "properties", "defined", "in", "spec", "will", "be", "assigned", "to", "the", "prototype", "of", "this", "constructor", "." ]
1f4dc63272f99a491a7ce2a5db7c1d56c3e82132
https://github.com/bpmn-io/bpmn-questionnaire/blob/1f4dc63272f99a491a7ce2a5db7c1d56c3e82132/lib/BpmnQuestionnaire.js#L360-L390
train
cmrigney/fast-xml2js
index.js
parseString
function parseString(xml, cb) { return fastxml2js.parseString(xml, function(err, data) { //So that it's asynchronous process.nextTick(function() { cb(err, data); }); }); }
javascript
function parseString(xml, cb) { return fastxml2js.parseString(xml, function(err, data) { //So that it's asynchronous process.nextTick(function() { cb(err, data); }); }); }
[ "function", "parseString", "(", "xml", ",", "cb", ")", "{", "return", "fastxml2js", ".", "parseString", "(", "xml", ",", "function", "(", "err", ",", "data", ")", "{", "//So that it's asynchronous", "process", ".", "nextTick", "(", "function", "(", ")", "{...
Callback after xml is parsed @callback parseCallback @param {string} err Error string describing an error that occurred @param {object} obj Resulting parsed JS object Parses an XML string into a JS object @param {string} xml @param {parseCallback} cb
[ "Callback", "after", "xml", "is", "parsed" ]
65b235b04eb0af386f61c59b4fb50063142a1653
https://github.com/cmrigney/fast-xml2js/blob/65b235b04eb0af386f61c59b4fb50063142a1653/index.js#L15-L22
train
crucialfelix/supercolliderjs
src/dryads/middleware/scserver.js
_callIfFn
function _callIfFn(thing, context, properties) { return _.isFunction(thing) ? thing(context, properties) : thing; }
javascript
function _callIfFn(thing, context, properties) { return _.isFunction(thing) ? thing(context, properties) : thing; }
[ "function", "_callIfFn", "(", "thing", ",", "context", ",", "properties", ")", "{", "return", "_", ".", "isFunction", "(", "thing", ")", "?", "thing", "(", "context", ",", "properties", ")", ":", "thing", ";", "}" ]
If its a Function then call it with context and properties @private
[ "If", "its", "a", "Function", "then", "call", "it", "with", "context", "and", "properties" ]
77a26c02cf1cdfe5b86699810ab46c6c315f975c
https://github.com/crucialfelix/supercolliderjs/blob/77a26c02cf1cdfe5b86699810ab46c6c315f975c/src/dryads/middleware/scserver.js#L141-L143
train
YogaGlo/grunt-docker-compose
tasks/dockerCompose.js
servicesRunning
function servicesRunning() { var composeArgs = ['ps']; // If we're tailing just the main service's logs, then we only check that service if (service === '<%= dockerCompose.options.mainService %>') { composeArgs.push(grunt.config.get('dockerCompose.options.mainService')); } // get the stdout of dock...
javascript
function servicesRunning() { var composeArgs = ['ps']; // If we're tailing just the main service's logs, then we only check that service if (service === '<%= dockerCompose.options.mainService %>') { composeArgs.push(grunt.config.get('dockerCompose.options.mainService')); } // get the stdout of dock...
[ "function", "servicesRunning", "(", ")", "{", "var", "composeArgs", "=", "[", "'ps'", "]", ";", "// If we're tailing just the main service's logs, then we only check that service", "if", "(", "service", "===", "'<%= dockerCompose.options.mainService %>'", ")", "{", "composeAr...
do we have any services running?
[ "do", "we", "have", "any", "services", "running?" ]
6c7f0ab9133d2b049a3497eb05f11f83fbd8c73d
https://github.com/YogaGlo/grunt-docker-compose/blob/6c7f0ab9133d2b049a3497eb05f11f83fbd8c73d/tasks/dockerCompose.js#L253-L279
train
elo7/async-define
async-define.js
_define
function _define(/* <exports>, name, dependencies, factory */) { var // extract arguments argv = arguments, argc = argv.length, // extract arguments from function call - (exports?, name?, modules?, factory) exports = argv[argc ...
javascript
function _define(/* <exports>, name, dependencies, factory */) { var // extract arguments argv = arguments, argc = argv.length, // extract arguments from function call - (exports?, name?, modules?, factory) exports = argv[argc ...
[ "function", "_define", "(", "/* <exports>, name, dependencies, factory */", ")", "{", "var", "// extract arguments", "argv", "=", "arguments", ",", "argc", "=", "argv", ".", "length", ",", "// extract arguments from function call - (exports?, name?, modules?, factory)", "export...
the 'define' function
[ "the", "define", "function" ]
33d411de98c8004de4ffe1c6515643fc8ae5e192
https://github.com/elo7/async-define/blob/33d411de98c8004de4ffe1c6515643fc8ae5e192/async-define.js#L95-L176
train
nymag/dom
index.js
matches
function matches(node, selector) { var parent, matches, i; if (node.matches) { return node.matches(selector); } else { parent = node.parentElement; matches = parent ? parent.querySelectorAll(selector) : []; i = 0; while (matches[i] && matches[i] !== node) { i++; } return !!match...
javascript
function matches(node, selector) { var parent, matches, i; if (node.matches) { return node.matches(selector); } else { parent = node.parentElement; matches = parent ? parent.querySelectorAll(selector) : []; i = 0; while (matches[i] && matches[i] !== node) { i++; } return !!match...
[ "function", "matches", "(", "node", ",", "selector", ")", "{", "var", "parent", ",", "matches", ",", "i", ";", "if", "(", "node", ".", "matches", ")", "{", "return", "node", ".", "matches", "(", "selector", ")", ";", "}", "else", "{", "parent", "="...
Returns true if the element would be selected by the specified selector. Essentially a polyfill, but necessary for `closest`. @param {Node} node preferably an Element for better performance, but it will accept any Node. @param {string} selector @returns {boolean}
[ "Returns", "true", "if", "the", "element", "would", "be", "selected", "by", "the", "specified", "selector", ".", "Essentially", "a", "polyfill", "but", "necessary", "for", "closest", "." ]
1f69f55d70e6764f46f4d092fc90d16d23ec8e0b
https://github.com/nymag/dom/blob/1f69f55d70e6764f46f4d092fc90d16d23ec8e0b/index.js#L81-L95
train
nymag/dom
index.js
closest
function closest(node, parentSelector) { var cursor = node; if (!parentSelector || typeof parentSelector !== 'string') { throw new Error('Please specify a selector to match against!'); } while (cursor && !matches(cursor, parentSelector)) { cursor = cursor.parentNode; } if (!cursor) { return n...
javascript
function closest(node, parentSelector) { var cursor = node; if (!parentSelector || typeof parentSelector !== 'string') { throw new Error('Please specify a selector to match against!'); } while (cursor && !matches(cursor, parentSelector)) { cursor = cursor.parentNode; } if (!cursor) { return n...
[ "function", "closest", "(", "node", ",", "parentSelector", ")", "{", "var", "cursor", "=", "node", ";", "if", "(", "!", "parentSelector", "||", "typeof", "parentSelector", "!==", "'string'", ")", "{", "throw", "new", "Error", "(", "'Please specify a selector t...
get closest element that matches selector starting with the element itself and traversing up through parents. @param {Element} node @param {string} parentSelector @return {Element|null}
[ "get", "closest", "element", "that", "matches", "selector", "starting", "with", "the", "element", "itself", "and", "traversing", "up", "through", "parents", "." ]
1f69f55d70e6764f46f4d092fc90d16d23ec8e0b
https://github.com/nymag/dom/blob/1f69f55d70e6764f46f4d092fc90d16d23ec8e0b/index.js#L103-L119
train
nymag/dom
index.js
wrapElements
function wrapElements(els, wrapper) { var wrapperEl = document.createElement(wrapper); // make sure elements are in an array if (els instanceof HTMLElement) { els = [els]; } else { els = Array.prototype.slice.call(els); } _each(els, function (el) { // put it into the wrapper, remove it from it...
javascript
function wrapElements(els, wrapper) { var wrapperEl = document.createElement(wrapper); // make sure elements are in an array if (els instanceof HTMLElement) { els = [els]; } else { els = Array.prototype.slice.call(els); } _each(els, function (el) { // put it into the wrapper, remove it from it...
[ "function", "wrapElements", "(", "els", ",", "wrapper", ")", "{", "var", "wrapperEl", "=", "document", ".", "createElement", "(", "wrapper", ")", ";", "// make sure elements are in an array", "if", "(", "els", "instanceof", "HTMLElement", ")", "{", "els", "=", ...
wrap elements in another element @param {NodeList|Element} els @param {string} wrapper @returns {Element} wrapperEl
[ "wrap", "elements", "in", "another", "element" ]
1f69f55d70e6764f46f4d092fc90d16d23ec8e0b
https://github.com/nymag/dom/blob/1f69f55d70e6764f46f4d092fc90d16d23ec8e0b/index.js#L178-L196
train
nymag/dom
index.js
unwrapElements
function unwrapElements(parent, wrapper) { var el = wrapper.childNodes[0]; // ok, so this looks weird, right? // turns out, appending nodes to another node will remove them // from the live NodeList, so we can keep iterating over the // first item in that list and grab all of them. Nice! while (el) { p...
javascript
function unwrapElements(parent, wrapper) { var el = wrapper.childNodes[0]; // ok, so this looks weird, right? // turns out, appending nodes to another node will remove them // from the live NodeList, so we can keep iterating over the // first item in that list and grab all of them. Nice! while (el) { p...
[ "function", "unwrapElements", "(", "parent", ",", "wrapper", ")", "{", "var", "el", "=", "wrapper", ".", "childNodes", "[", "0", "]", ";", "// ok, so this looks weird, right?", "// turns out, appending nodes to another node will remove them", "// from the live NodeList, so we...
unwrap elements from another element @param {Element} parent @param {Element} wrapper
[ "unwrap", "elements", "from", "another", "element" ]
1f69f55d70e6764f46f4d092fc90d16d23ec8e0b
https://github.com/nymag/dom/blob/1f69f55d70e6764f46f4d092fc90d16d23ec8e0b/index.js#L203-L216
train
nymag/dom
index.js
createRemoveNodeHandler
function createRemoveNodeHandler(el, fn) { return function (mutations, observer) { mutations.forEach(function (mutation) { if (_includes(mutation.removedNodes, el)) { fn(); observer.disconnect(); } }); }; }
javascript
function createRemoveNodeHandler(el, fn) { return function (mutations, observer) { mutations.forEach(function (mutation) { if (_includes(mutation.removedNodes, el)) { fn(); observer.disconnect(); } }); }; }
[ "function", "createRemoveNodeHandler", "(", "el", ",", "fn", ")", "{", "return", "function", "(", "mutations", ",", "observer", ")", "{", "mutations", ".", "forEach", "(", "function", "(", "mutation", ")", "{", "if", "(", "_includes", "(", "mutation", ".",...
Create a remove node handler that runs fn and removes the observer. @param {Element} el @param {Function} fn @returns {Function}
[ "Create", "a", "remove", "node", "handler", "that", "runs", "fn", "and", "removes", "the", "observer", "." ]
1f69f55d70e6764f46f4d092fc90d16d23ec8e0b
https://github.com/nymag/dom/blob/1f69f55d70e6764f46f4d092fc90d16d23ec8e0b/index.js#L224-L233
train
nymag/dom
index.js
getPos
function getPos(el) { var rect = el.getBoundingClientRect(), scrollY = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop; return { top: rect.top + scrollY, bottom: rect.top + rect.height + scrollY, height: rect.height }; }
javascript
function getPos(el) { var rect = el.getBoundingClientRect(), scrollY = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop; return { top: rect.top + scrollY, bottom: rect.top + rect.height + scrollY, height: rect.height }; }
[ "function", "getPos", "(", "el", ")", "{", "var", "rect", "=", "el", ".", "getBoundingClientRect", "(", ")", ",", "scrollY", "=", "window", ".", "pageYOffset", "||", "document", ".", "documentElement", ".", "scrollTop", "||", "document", ".", "body", ".", ...
Get the position of a DOM element @param {Element} el @return {object}
[ "Get", "the", "position", "of", "a", "DOM", "element" ]
1f69f55d70e6764f46f4d092fc90d16d23ec8e0b
https://github.com/nymag/dom/blob/1f69f55d70e6764f46f4d092fc90d16d23ec8e0b/index.js#L252-L261
train
ShoppinPal/vend-nodejs-sdk
lib/utils.js
function(tokenService, domainPrefix) { var tokenUrl = tokenService.replace(/\{DOMAIN_PREFIX\}/, domainPrefix); log.debug('token Url: '+ tokenUrl); return tokenUrl; }
javascript
function(tokenService, domainPrefix) { var tokenUrl = tokenService.replace(/\{DOMAIN_PREFIX\}/, domainPrefix); log.debug('token Url: '+ tokenUrl); return tokenUrl; }
[ "function", "(", "tokenService", ",", "domainPrefix", ")", "{", "var", "tokenUrl", "=", "tokenService", ".", "replace", "(", "/", "\\{DOMAIN_PREFIX\\}", "/", ",", "domainPrefix", ")", ";", "log", ".", "debug", "(", "'token Url: '", "+", "tokenUrl", ")", ";",...
If tokenService already has a domainPrefix set because the API consumer passed in a full URL instead of a substitutable one ... then the replace acts as a no-op. @param tokenService @param domain_prefix @returns {*|XML|string|void}
[ "If", "tokenService", "already", "has", "a", "domainPrefix", "set", "because", "the", "API", "consumer", "passed", "in", "a", "full", "URL", "instead", "of", "a", "substitutable", "one", "...", "then", "the", "replace", "acts", "as", "a", "no", "-", "op", ...
7ba24d12b5e68f9e364725fbcdfaff483d81a47c
https://github.com/ShoppinPal/vend-nodejs-sdk/blob/7ba24d12b5e68f9e364725fbcdfaff483d81a47c/lib/utils.js#L66-L70
train
gethuman/pancakes
lib/factories/adapter.factory.js
AdapterFactory
function AdapterFactory(injector) { if (!injector.adapters) { return; } var me = this; this.adapterMap = {}; _.each(injector.adapterMap, function (adapterName, adapterType) { var adapter = injector.adapters[adapterName]; if (adapter) { me.adapterMap[adapterType + 'adapter'] ...
javascript
function AdapterFactory(injector) { if (!injector.adapters) { return; } var me = this; this.adapterMap = {}; _.each(injector.adapterMap, function (adapterName, adapterType) { var adapter = injector.adapters[adapterName]; if (adapter) { me.adapterMap[adapterType + 'adapter'] ...
[ "function", "AdapterFactory", "(", "injector", ")", "{", "if", "(", "!", "injector", ".", "adapters", ")", "{", "return", ";", "}", "var", "me", "=", "this", ";", "this", ".", "adapterMap", "=", "{", "}", ";", "_", ".", "each", "(", "injector", "."...
Initialize the cache @param injector @constructor
[ "Initialize", "the", "cache" ]
86b89ae2f0ac68f86cd5ff66421677b3aa290857
https://github.com/gethuman/pancakes/blob/86b89ae2f0ac68f86cd5ff66421677b3aa290857/lib/factories/adapter.factory.js#L14-L25
train
gethuman/pancakes
lib/utensils.js
getCamelCase
function getCamelCase(filePath) { if (!filePath) { return ''; } // clip off everything by after the last slash and the .js filePath = filePath.substring(filePath.lastIndexOf(delim) + 1); if (filePath.substring(filePath.length - 3) === '.js') { filePath = filePath.substring(0, fileP...
javascript
function getCamelCase(filePath) { if (!filePath) { return ''; } // clip off everything by after the last slash and the .js filePath = filePath.substring(filePath.lastIndexOf(delim) + 1); if (filePath.substring(filePath.length - 3) === '.js') { filePath = filePath.substring(0, fileP...
[ "function", "getCamelCase", "(", "filePath", ")", "{", "if", "(", "!", "filePath", ")", "{", "return", "''", ";", "}", "// clip off everything by after the last slash and the .js", "filePath", "=", "filePath", ".", "substring", "(", "filePath", ".", "lastIndexOf", ...
Get module name from a full file path. This is done by removing the parent dirs and replacing dot naming with camelCase @param filePath Full file path to a pancakes module @return {String} The name of the module.
[ "Get", "module", "name", "from", "a", "full", "file", "path", ".", "This", "is", "done", "by", "removing", "the", "parent", "dirs", "and", "replacing", "dot", "naming", "with", "camelCase" ]
86b89ae2f0ac68f86cd5ff66421677b3aa290857
https://github.com/gethuman/pancakes/blob/86b89ae2f0ac68f86cd5ff66421677b3aa290857/lib/utensils.js#L31-L59
train
gethuman/pancakes
lib/utensils.js
getPascalCase
function getPascalCase(filePath) { var camelCase = getCamelCase(filePath); return camelCase.substring(0, 1).toUpperCase() + camelCase.substring(1); }
javascript
function getPascalCase(filePath) { var camelCase = getCamelCase(filePath); return camelCase.substring(0, 1).toUpperCase() + camelCase.substring(1); }
[ "function", "getPascalCase", "(", "filePath", ")", "{", "var", "camelCase", "=", "getCamelCase", "(", "filePath", ")", ";", "return", "camelCase", ".", "substring", "(", "0", ",", "1", ")", ".", "toUpperCase", "(", ")", "+", "camelCase", ".", "substring", ...
Get the Pascal Case for a given path @param filePath @returns {string}
[ "Get", "the", "Pascal", "Case", "for", "a", "given", "path" ]
86b89ae2f0ac68f86cd5ff66421677b3aa290857
https://github.com/gethuman/pancakes/blob/86b89ae2f0ac68f86cd5ff66421677b3aa290857/lib/utensils.js#L66-L69
train
gethuman/pancakes
lib/utensils.js
getModulePath
function getModulePath(filePath, fileName) { if (isJavaScript(fileName)) { fileName = fileName.substring(0, fileName.length - 3); } return filePath + '/' + fileName; }
javascript
function getModulePath(filePath, fileName) { if (isJavaScript(fileName)) { fileName = fileName.substring(0, fileName.length - 3); } return filePath + '/' + fileName; }
[ "function", "getModulePath", "(", "filePath", ",", "fileName", ")", "{", "if", "(", "isJavaScript", "(", "fileName", ")", ")", "{", "fileName", "=", "fileName", ".", "substring", "(", "0", ",", "fileName", ".", "length", "-", "3", ")", ";", "}", "retur...
Get the module path that will be used with the require @param filePath @param fileName @returns {string}
[ "Get", "the", "module", "path", "that", "will", "be", "used", "with", "the", "require" ]
86b89ae2f0ac68f86cd5ff66421677b3aa290857
https://github.com/gethuman/pancakes/blob/86b89ae2f0ac68f86cd5ff66421677b3aa290857/lib/utensils.js#L101-L107
train
gethuman/pancakes
lib/utensils.js
parseIfJson
function parseIfJson(val) { if (_.isString(val)) { val = val.trim(); if (val.substring(0, 1) === '{' && val.substring(val.length - 1) === '}') { try { val = JSON.parse(val); } catch (ex) { /* eslint no-console:0 */ c...
javascript
function parseIfJson(val) { if (_.isString(val)) { val = val.trim(); if (val.substring(0, 1) === '{' && val.substring(val.length - 1) === '}') { try { val = JSON.parse(val); } catch (ex) { /* eslint no-console:0 */ c...
[ "function", "parseIfJson", "(", "val", ")", "{", "if", "(", "_", ".", "isString", "(", "val", ")", ")", "{", "val", "=", "val", ".", "trim", "(", ")", ";", "if", "(", "val", ".", "substring", "(", "0", ",", "1", ")", "===", "'{'", "&&", "val"...
If a value is a string of json, parse it out into an object @param val @returns {*}
[ "If", "a", "value", "is", "a", "string", "of", "json", "parse", "it", "out", "into", "an", "object" ]
86b89ae2f0ac68f86cd5ff66421677b3aa290857
https://github.com/gethuman/pancakes/blob/86b89ae2f0ac68f86cd5ff66421677b3aa290857/lib/utensils.js#L114-L128
train
gethuman/pancakes
lib/utensils.js
chainPromises
function chainPromises(calls, val) { if (!calls || !calls.length) { return Q.when(val); } return calls.reduce(Q.when, Q.when(val)); }
javascript
function chainPromises(calls, val) { if (!calls || !calls.length) { return Q.when(val); } return calls.reduce(Q.when, Q.when(val)); }
[ "function", "chainPromises", "(", "calls", ",", "val", ")", "{", "if", "(", "!", "calls", "||", "!", "calls", ".", "length", ")", "{", "return", "Q", ".", "when", "(", "val", ")", ";", "}", "return", "calls", ".", "reduce", "(", "Q", ".", "when",...
Simple function for chaining an array of promise functions. Every function in the promise chain needs to be uniform and accept the same input parameter. This is used for a number of things, but most importantly for the service call chain by API. @param calls Functions that should all take in a value and return a promi...
[ "Simple", "function", "for", "chaining", "an", "array", "of", "promise", "functions", ".", "Every", "function", "in", "the", "promise", "chain", "needs", "to", "be", "uniform", "and", "accept", "the", "same", "input", "parameter", ".", "This", "is", "used", ...
86b89ae2f0ac68f86cd5ff66421677b3aa290857
https://github.com/gethuman/pancakes/blob/86b89ae2f0ac68f86cd5ff66421677b3aa290857/lib/utensils.js#L139-L142
train
gethuman/pancakes
lib/utensils.js
checksum
function checksum(str) { crcTbl = crcTbl || makeCRCTable(); /* jslint bitwise: true */ var crc = 0 ^ (-1); for (var i = 0; i < str.length; i++) { crc = (crc >>> 8) ^ crcTbl[(crc ^ str.charCodeAt(i)) & 0xFF]; } return (crc ^ (-1)) >>> 0; }
javascript
function checksum(str) { crcTbl = crcTbl || makeCRCTable(); /* jslint bitwise: true */ var crc = 0 ^ (-1); for (var i = 0; i < str.length; i++) { crc = (crc >>> 8) ^ crcTbl[(crc ^ str.charCodeAt(i)) & 0xFF]; } return (crc ^ (-1)) >>> 0; }
[ "function", "checksum", "(", "str", ")", "{", "crcTbl", "=", "crcTbl", "||", "makeCRCTable", "(", ")", ";", "/* jslint bitwise: true */", "var", "crc", "=", "0", "^", "(", "-", "1", ")", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "str", ...
Generate a checkum for a string @param str @returns {number}
[ "Generate", "a", "checkum", "for", "a", "string" ]
86b89ae2f0ac68f86cd5ff66421677b3aa290857
https://github.com/gethuman/pancakes/blob/86b89ae2f0ac68f86cd5ff66421677b3aa290857/lib/utensils.js#L195-L206
train
gethuman/pancakes
lib/dependency.injector.js
DependencyInjector
function DependencyInjector(opts) { var rootDefault = p.join(__dirname, '../../..'); this.rootDir = opts.rootDir || rootDefault; // project base dir (default is a guess) this.require = opts.require || require; // we need require from the project this.container = opts....
javascript
function DependencyInjector(opts) { var rootDefault = p.join(__dirname, '../../..'); this.rootDir = opts.rootDir || rootDefault; // project base dir (default is a guess) this.require = opts.require || require; // we need require from the project this.container = opts....
[ "function", "DependencyInjector", "(", "opts", ")", "{", "var", "rootDefault", "=", "p", ".", "join", "(", "__dirname", ",", "'../../..'", ")", ";", "this", ".", "rootDir", "=", "opts", ".", "rootDir", "||", "rootDefault", ";", "// project base dir (default is...
Initialize the injector with input options @param opts @constructor
[ "Initialize", "the", "injector", "with", "input", "options" ]
86b89ae2f0ac68f86cd5ff66421677b3aa290857
https://github.com/gethuman/pancakes/blob/86b89ae2f0ac68f86cd5ff66421677b3aa290857/lib/dependency.injector.js#L27-L42
train
gethuman/pancakes
lib/dependency.injector.js
loadFactories
function loadFactories(opts) { this.flapjackFactory = new FlapjackFactory(this); return [ new InternalObjFactory(this), new AdapterFactory(this), new ServiceFactory(this), new ModelFactory(this), new UipartFactory(this), this.flapj...
javascript
function loadFactories(opts) { this.flapjackFactory = new FlapjackFactory(this); return [ new InternalObjFactory(this), new AdapterFactory(this), new ServiceFactory(this), new ModelFactory(this), new UipartFactory(this), this.flapj...
[ "function", "loadFactories", "(", "opts", ")", "{", "this", ".", "flapjackFactory", "=", "new", "FlapjackFactory", "(", "this", ")", ";", "return", "[", "new", "InternalObjFactory", "(", "this", ")", ",", "new", "AdapterFactory", "(", "this", ")", ",", "ne...
Load all the factories @returns {Array}
[ "Load", "all", "the", "factories" ]
86b89ae2f0ac68f86cd5ff66421677b3aa290857
https://github.com/gethuman/pancakes/blob/86b89ae2f0ac68f86cd5ff66421677b3aa290857/lib/dependency.injector.js#L74-L87
train
gethuman/pancakes
lib/dependency.injector.js
loadMappings
function loadMappings(rootDir, paths) { var mappings = {}, i, j, fullPath, fileNames, fileName, path, name, val; if (!paths) { return mappings; } for (i = 0; i < paths.length; i++) { path = paths[i]; fullPath = rootDir + '/' + path; // i...
javascript
function loadMappings(rootDir, paths) { var mappings = {}, i, j, fullPath, fileNames, fileName, path, name, val; if (!paths) { return mappings; } for (i = 0; i < paths.length; i++) { path = paths[i]; fullPath = rootDir + '/' + path; // i...
[ "function", "loadMappings", "(", "rootDir", ",", "paths", ")", "{", "var", "mappings", "=", "{", "}", ",", "i", ",", "j", ",", "fullPath", ",", "fileNames", ",", "fileName", ",", "path", ",", "name", ",", "val", ";", "if", "(", "!", "paths", ")", ...
Based on a given directory, get the mappings of camelCase name for a given file to the file's relative path from the app root. @param rootDir @param paths @returns {{}} The mappings of param name to location
[ "Based", "on", "a", "given", "directory", "get", "the", "mappings", "of", "camelCase", "name", "for", "a", "given", "file", "to", "the", "file", "s", "relative", "path", "from", "the", "app", "root", "." ]
86b89ae2f0ac68f86cd5ff66421677b3aa290857
https://github.com/gethuman/pancakes/blob/86b89ae2f0ac68f86cd5ff66421677b3aa290857/lib/dependency.injector.js#L122-L160
train
gethuman/pancakes
lib/dependency.injector.js
exists
function exists(modulePath, options) { if (this.aliases[modulePath]) { modulePath = this.aliases[modulePath]; } var len = this.factories.length - 1; // -1 because we don't want the default factory for (var i = 0; this.factories && i < len; i++) { if (this.factor...
javascript
function exists(modulePath, options) { if (this.aliases[modulePath]) { modulePath = this.aliases[modulePath]; } var len = this.factories.length - 1; // -1 because we don't want the default factory for (var i = 0; this.factories && i < len; i++) { if (this.factor...
[ "function", "exists", "(", "modulePath", ",", "options", ")", "{", "if", "(", "this", ".", "aliases", "[", "modulePath", "]", ")", "{", "modulePath", "=", "this", ".", "aliases", "[", "modulePath", "]", ";", "}", "var", "len", "=", "this", ".", "fact...
Determine if an @param modulePath @param options @returns {boolean}
[ "Determine", "if", "an" ]
86b89ae2f0ac68f86cd5ff66421677b3aa290857
https://github.com/gethuman/pancakes/blob/86b89ae2f0ac68f86cd5ff66421677b3aa290857/lib/dependency.injector.js#L168-L182
train
gethuman/pancakes
lib/dependency.injector.js
loadModule
function loadModule(modulePath, moduleStack, options) { var newModule, i; options = options || {}; // if modulePath is null return null if (!modulePath) { return null; } // if actual flapjack sent in as the module path then switch things around so modulePath...
javascript
function loadModule(modulePath, moduleStack, options) { var newModule, i; options = options || {}; // if modulePath is null return null if (!modulePath) { return null; } // if actual flapjack sent in as the module path then switch things around so modulePath...
[ "function", "loadModule", "(", "modulePath", ",", "moduleStack", ",", "options", ")", "{", "var", "newModule", ",", "i", ";", "options", "=", "options", "||", "{", "}", ";", "// if modulePath is null return null", "if", "(", "!", "modulePath", ")", "{", "ret...
Load a module using the pancakes injector. The injector relies on a number of factories to do the actual injection. The first factory that can handle a given modulePath input attempts to generate an object or return something from cache that can then be returned back to the caller. @param modulePath Path to module @pa...
[ "Load", "a", "module", "using", "the", "pancakes", "injector", ".", "The", "injector", "relies", "on", "a", "number", "of", "factories", "to", "do", "the", "actual", "injection", ".", "The", "first", "factory", "that", "can", "handle", "a", "given", "modul...
86b89ae2f0ac68f86cd5ff66421677b3aa290857
https://github.com/gethuman/pancakes/blob/86b89ae2f0ac68f86cd5ff66421677b3aa290857/lib/dependency.injector.js#L193-L245
train
gethuman/pancakes
lib/dependency.injector.js
injectFlapjack
function injectFlapjack(flapjack, moduleStack, options) { options = options || {}; // if server is false, then return null var moduleInfo = annotations.getModuleInfo(flapjack); if (moduleInfo && moduleInfo.server === false && !options.test) { return null; } ...
javascript
function injectFlapjack(flapjack, moduleStack, options) { options = options || {}; // if server is false, then return null var moduleInfo = annotations.getModuleInfo(flapjack); if (moduleInfo && moduleInfo.server === false && !options.test) { return null; } ...
[ "function", "injectFlapjack", "(", "flapjack", ",", "moduleStack", ",", "options", ")", "{", "options", "=", "options", "||", "{", "}", ";", "// if server is false, then return null", "var", "moduleInfo", "=", "annotations", ".", "getModuleInfo", "(", "flapjack", ...
Given a flapjack load all the params and instantiated it. This fn is used by the FlapjackFactory and ModulePluginFactory. @param flapjack @param moduleStack @param options @returns {*}
[ "Given", "a", "flapjack", "load", "all", "the", "params", "and", "instantiated", "it", ".", "This", "fn", "is", "used", "by", "the", "FlapjackFactory", "and", "ModulePluginFactory", "." ]
86b89ae2f0ac68f86cd5ff66421677b3aa290857
https://github.com/gethuman/pancakes/blob/86b89ae2f0ac68f86cd5ff66421677b3aa290857/lib/dependency.injector.js#L256-L295
train
gethuman/pancakes
lib/factories/module.plugin.factory.js
loadModulePlugins
function loadModulePlugins(modulePlugins) { var serverModules = {}; var me = this; // add modules from each plugin to the serverModules map _.each(modulePlugins, function (modulePlugin) { _.extend(serverModules, me.loadModules(modulePlugin.rootDir, modulePlugin.serverModuleD...
javascript
function loadModulePlugins(modulePlugins) { var serverModules = {}; var me = this; // add modules from each plugin to the serverModules map _.each(modulePlugins, function (modulePlugin) { _.extend(serverModules, me.loadModules(modulePlugin.rootDir, modulePlugin.serverModuleD...
[ "function", "loadModulePlugins", "(", "modulePlugins", ")", "{", "var", "serverModules", "=", "{", "}", ";", "var", "me", "=", "this", ";", "// add modules from each plugin to the serverModules map", "_", ".", "each", "(", "modulePlugins", ",", "function", "(", "m...
Loop through each plugin and add each module to a map @param modulePlugins
[ "Loop", "through", "each", "plugin", "and", "add", "each", "module", "to", "a", "map" ]
86b89ae2f0ac68f86cd5ff66421677b3aa290857
https://github.com/gethuman/pancakes/blob/86b89ae2f0ac68f86cd5ff66421677b3aa290857/lib/factories/module.plugin.factory.js#L31-L41
train
gethuman/pancakes
lib/factories/module.plugin.factory.js
loadModules
function loadModules(rootDir, paths) { var serverModules = {}; var me = this; // return empty object if no rootDir or paths if (!rootDir || !paths) { return serverModules; } // loop through paths and load all modules in those directories _.each(paths, function (relative...
javascript
function loadModules(rootDir, paths) { var serverModules = {}; var me = this; // return empty object if no rootDir or paths if (!rootDir || !paths) { return serverModules; } // loop through paths and load all modules in those directories _.each(paths, function (relative...
[ "function", "loadModules", "(", "rootDir", ",", "paths", ")", "{", "var", "serverModules", "=", "{", "}", ";", "var", "me", "=", "this", ";", "// return empty object if no rootDir or paths", "if", "(", "!", "rootDir", "||", "!", "paths", ")", "{", "return", ...
Recursively go through dirs and add modules to a server modules map that is returned @param rootDir @param paths @returns {*}
[ "Recursively", "go", "through", "dirs", "and", "add", "modules", "to", "a", "server", "modules", "map", "that", "is", "returned" ]
86b89ae2f0ac68f86cd5ff66421677b3aa290857
https://github.com/gethuman/pancakes/blob/86b89ae2f0ac68f86cd5ff66421677b3aa290857/lib/factories/module.plugin.factory.js#L49-L84
train
gethuman/pancakes
lib/api.route.handler.js
traverseFilters
function traverseFilters(config, levels, levelIdx) { var lastIdx = levels.length - 1; var val, filters; if (!config || levelIdx > lastIdx) { return null; } val = config[levels[levelIdx]]; if (levelIdx === lastIdx) { if (val) { return val; } else { ...
javascript
function traverseFilters(config, levels, levelIdx) { var lastIdx = levels.length - 1; var val, filters; if (!config || levelIdx > lastIdx) { return null; } val = config[levels[levelIdx]]; if (levelIdx === lastIdx) { if (val) { return val; } else { ...
[ "function", "traverseFilters", "(", "config", ",", "levels", ",", "levelIdx", ")", "{", "var", "lastIdx", "=", "levels", ".", "length", "-", "1", ";", "var", "val", ",", "filters", ";", "if", "(", "!", "config", "||", "levelIdx", ">", "lastIdx", ")", ...
Recurse through the filter config to get the right filter values @param config @param levels @param levelIdx @returns {*}
[ "Recurse", "through", "the", "filter", "config", "to", "get", "the", "right", "filter", "values" ]
86b89ae2f0ac68f86cd5ff66421677b3aa290857
https://github.com/gethuman/pancakes/blob/86b89ae2f0ac68f86cd5ff66421677b3aa290857/lib/api.route.handler.js#L27-L51
train
gethuman/pancakes
lib/api.route.handler.js
getFilters
function getFilters(resourceName, adapterName, operation) { var filterConfig = injector.loadModule('filterConfig'); var filters = { before: [], after: [] }; if (!filterConfig) { return filters; } var levels = [resourceName, adapterName, operation, 'before']; filters.before = (traverseFilters(filte...
javascript
function getFilters(resourceName, adapterName, operation) { var filterConfig = injector.loadModule('filterConfig'); var filters = { before: [], after: [] }; if (!filterConfig) { return filters; } var levels = [resourceName, adapterName, operation, 'before']; filters.before = (traverseFilters(filte...
[ "function", "getFilters", "(", "resourceName", ",", "adapterName", ",", "operation", ")", "{", "var", "filterConfig", "=", "injector", ".", "loadModule", "(", "'filterConfig'", ")", ";", "var", "filters", "=", "{", "before", ":", "[", "]", ",", "after", ":...
Get before and after filters based on the current request and the filter config @param resourceName @param adapterName @param operation @returns {{}}
[ "Get", "before", "and", "after", "filters", "based", "on", "the", "current", "request", "and", "the", "filter", "config" ]
86b89ae2f0ac68f86cd5ff66421677b3aa290857
https://github.com/gethuman/pancakes/blob/86b89ae2f0ac68f86cd5ff66421677b3aa290857/lib/api.route.handler.js#L60-L77
train
gethuman/pancakes
lib/api.route.handler.js
processApiCall
function processApiCall(resource, operation, requestParams) { var service = injector.loadModule(utensils.getCamelCase(resource.name + '.service')); var adapterName = resource.adapters.api; // remove the keys that start with onBehalfOf _.each(requestParams, function (val, key) { if (key.indexOf(...
javascript
function processApiCall(resource, operation, requestParams) { var service = injector.loadModule(utensils.getCamelCase(resource.name + '.service')); var adapterName = resource.adapters.api; // remove the keys that start with onBehalfOf _.each(requestParams, function (val, key) { if (key.indexOf(...
[ "function", "processApiCall", "(", "resource", ",", "operation", ",", "requestParams", ")", "{", "var", "service", "=", "injector", ".", "loadModule", "(", "utensils", ".", "getCamelCase", "(", "resource", ".", "name", "+", "'.service'", ")", ")", ";", "var"...
Process an API call. This method is called from the server plugin. Basically, the server plugin is in charge of taking the API request initially and translating the input values from the web framework specific format to the pancakes format. Then the server plugin calls this method with the generic pancancakes values. ...
[ "Process", "an", "API", "call", ".", "This", "method", "is", "called", "from", "the", "server", "plugin", ".", "Basically", "the", "server", "plugin", "is", "in", "charge", "of", "taking", "the", "API", "request", "initially", "and", "translating", "the", ...
86b89ae2f0ac68f86cd5ff66421677b3aa290857
https://github.com/gethuman/pancakes/blob/86b89ae2f0ac68f86cd5ff66421677b3aa290857/lib/api.route.handler.js#L89-L125
train
gethuman/pancakes
lib/web.route.handler.js
loadInlineCss
function loadInlineCss(rootDir, apps) { _.each(apps, function (app, appName) { _.each(app.routes, function (route) { var filePath = rootDir + '/app/' + appName + '/inline/' + route.name + '.css'; if (route.inline && fs.existsSync(filePath)) { inlineCssCache[appName + ...
javascript
function loadInlineCss(rootDir, apps) { _.each(apps, function (app, appName) { _.each(app.routes, function (route) { var filePath = rootDir + '/app/' + appName + '/inline/' + route.name + '.css'; if (route.inline && fs.existsSync(filePath)) { inlineCssCache[appName + ...
[ "function", "loadInlineCss", "(", "rootDir", ",", "apps", ")", "{", "_", ".", "each", "(", "apps", ",", "function", "(", "app", ",", "appName", ")", "{", "_", ".", "each", "(", "app", ".", "routes", ",", "function", "(", "route", ")", "{", "var", ...
Load all inline css files from the file system @param rootDir @param apps
[ "Load", "all", "inline", "css", "files", "from", "the", "file", "system" ]
86b89ae2f0ac68f86cd5ff66421677b3aa290857
https://github.com/gethuman/pancakes/blob/86b89ae2f0ac68f86cd5ff66421677b3aa290857/lib/web.route.handler.js#L39-L48
train
gethuman/pancakes
lib/web.route.handler.js
convertUrlSegmentToRegex
function convertUrlSegmentToRegex(segment) { // if it has this format "{stuff}" - then it's regex-y var beginIdx = segment.indexOf('{'); var endIdx = segment.indexOf('}'); if (beginIdx < 0) { return segment; } // if capturing regex and trim trailing "}" // this could be a named re...
javascript
function convertUrlSegmentToRegex(segment) { // if it has this format "{stuff}" - then it's regex-y var beginIdx = segment.indexOf('{'); var endIdx = segment.indexOf('}'); if (beginIdx < 0) { return segment; } // if capturing regex and trim trailing "}" // this could be a named re...
[ "function", "convertUrlSegmentToRegex", "(", "segment", ")", "{", "// if it has this format \"{stuff}\" - then it's regex-y", "var", "beginIdx", "=", "segment", ".", "indexOf", "(", "'{'", ")", ";", "var", "endIdx", "=", "segment", ".", "indexOf", "(", "'}'", ")", ...
Convert a segment of URL to a regex pattern for full URL casting below @param segment @returns string A segment as a URL pattern string
[ "Convert", "a", "segment", "of", "URL", "to", "a", "regex", "pattern", "for", "full", "URL", "casting", "below" ]
86b89ae2f0ac68f86cd5ff66421677b3aa290857
https://github.com/gethuman/pancakes/blob/86b89ae2f0ac68f86cd5ff66421677b3aa290857/lib/web.route.handler.js#L55-L83
train
gethuman/pancakes
lib/web.route.handler.js
getTokenValuesFromUrl
function getTokenValuesFromUrl(pattern, url) { var tokenValues = {}, urlSegments = url.split('/'); pattern.split('/').forEach(function (segment, idx) { // this has this form {stuff}, so let's dig var beginIdx = segment.indexOf('{'); var endIdx = segment.indexOf('}'); va...
javascript
function getTokenValuesFromUrl(pattern, url) { var tokenValues = {}, urlSegments = url.split('/'); pattern.split('/').forEach(function (segment, idx) { // this has this form {stuff}, so let's dig var beginIdx = segment.indexOf('{'); var endIdx = segment.indexOf('}'); va...
[ "function", "getTokenValuesFromUrl", "(", "pattern", ",", "url", ")", "{", "var", "tokenValues", "=", "{", "}", ",", "urlSegments", "=", "url", ".", "split", "(", "'/'", ")", ";", "pattern", ".", "split", "(", "'/'", ")", ".", "forEach", "(", "function...
Use a given pattern to extract tokens from a given URL @param pattern @param url @returns {{}}
[ "Use", "a", "given", "pattern", "to", "extract", "tokens", "from", "a", "given", "URL" ]
86b89ae2f0ac68f86cd5ff66421677b3aa290857
https://github.com/gethuman/pancakes/blob/86b89ae2f0ac68f86cd5ff66421677b3aa290857/lib/web.route.handler.js#L129-L161
train
gethuman/pancakes
lib/web.route.handler.js
getRouteInfo
function getRouteInfo(appName, urlRequest, query, lang, user, referrer) { var activeUser = user ? { _id: user._id, name: user.username, role: user.role, user: user } : {}; // if route info already in cache, return it var cacheKey = appName + '||' + lang + '||' + urlRequ...
javascript
function getRouteInfo(appName, urlRequest, query, lang, user, referrer) { var activeUser = user ? { _id: user._id, name: user.username, role: user.role, user: user } : {}; // if route info already in cache, return it var cacheKey = appName + '||' + lang + '||' + urlRequ...
[ "function", "getRouteInfo", "(", "appName", ",", "urlRequest", ",", "query", ",", "lang", ",", "user", ",", "referrer", ")", "{", "var", "activeUser", "=", "user", "?", "{", "_id", ":", "user", ".", "_id", ",", "name", ":", "user", ".", "username", "...
Get info for particular route @param appName @param urlRequest @param query @param lang @param user @param referrer @returns {{}} The routeInfo for a particular request
[ "Get", "info", "for", "particular", "route" ]
86b89ae2f0ac68f86cd5ff66421677b3aa290857
https://github.com/gethuman/pancakes/blob/86b89ae2f0ac68f86cd5ff66421677b3aa290857/lib/web.route.handler.js#L208-L269
train
gethuman/pancakes
lib/web.route.handler.js
setDefaults
function setDefaults(model, defaults) { if (!defaults) { return; } _.each(defaults, function (value, key) { if (model[key] === undefined) { model[key] = value; } }); }
javascript
function setDefaults(model, defaults) { if (!defaults) { return; } _.each(defaults, function (value, key) { if (model[key] === undefined) { model[key] = value; } }); }
[ "function", "setDefaults", "(", "model", ",", "defaults", ")", "{", "if", "(", "!", "defaults", ")", "{", "return", ";", "}", "_", ".", "each", "(", "defaults", ",", "function", "(", "value", ",", "key", ")", "{", "if", "(", "model", "[", "key", ...
If a default value doesn't exist in the model, set it @param model @param defaults
[ "If", "a", "default", "value", "doesn", "t", "exist", "in", "the", "model", "set", "it" ]
86b89ae2f0ac68f86cd5ff66421677b3aa290857
https://github.com/gethuman/pancakes/blob/86b89ae2f0ac68f86cd5ff66421677b3aa290857/lib/web.route.handler.js#L276-L284
train
gethuman/pancakes
lib/web.route.handler.js
getInitialModel
function getInitialModel(routeInfo, page) { var initModelDeps = { appName: routeInfo.appName, tokens: routeInfo.tokens, routeInfo: routeInfo, defaults: page.defaults, activeUser: routeInfo.activeUser || {}, currentScope: {} }; // if no model, just r...
javascript
function getInitialModel(routeInfo, page) { var initModelDeps = { appName: routeInfo.appName, tokens: routeInfo.tokens, routeInfo: routeInfo, defaults: page.defaults, activeUser: routeInfo.activeUser || {}, currentScope: {} }; // if no model, just r...
[ "function", "getInitialModel", "(", "routeInfo", ",", "page", ")", "{", "var", "initModelDeps", "=", "{", "appName", ":", "routeInfo", ".", "appName", ",", "tokens", ":", "routeInfo", ".", "tokens", ",", "routeInfo", ":", "routeInfo", ",", "defaults", ":", ...
Get the initial model for a given page @param routeInfo @param page
[ "Get", "the", "initial", "model", "for", "a", "given", "page" ]
86b89ae2f0ac68f86cd5ff66421677b3aa290857
https://github.com/gethuman/pancakes/blob/86b89ae2f0ac68f86cd5ff66421677b3aa290857/lib/web.route.handler.js#L291-L312
train
gethuman/pancakes
lib/web.route.handler.js
processWebRequest
function processWebRequest(routeInfo, callbacks) { var appName = routeInfo.appName; var serverOnly = !!routeInfo.query.server; var page = injector.loadModule('app/' + appName + '/pages/' + routeInfo.name + '.page'); // get the callbacks var serverPreprocessing = callbacks.serverPreprocessing || fun...
javascript
function processWebRequest(routeInfo, callbacks) { var appName = routeInfo.appName; var serverOnly = !!routeInfo.query.server; var page = injector.loadModule('app/' + appName + '/pages/' + routeInfo.name + '.page'); // get the callbacks var serverPreprocessing = callbacks.serverPreprocessing || fun...
[ "function", "processWebRequest", "(", "routeInfo", ",", "callbacks", ")", "{", "var", "appName", "=", "routeInfo", ".", "appName", ";", "var", "serverOnly", "=", "!", "!", "routeInfo", ".", "query", ".", "server", ";", "var", "page", "=", "injector", ".", ...
This function is called by the server plugin when we have a request and we need to process it. The plugin should handle translating the server platform specific values into our routeInfo @param routeInfo @param callbacks
[ "This", "function", "is", "called", "by", "the", "server", "plugin", "when", "we", "have", "a", "request", "and", "we", "need", "to", "process", "it", ".", "The", "plugin", "should", "handle", "translating", "the", "server", "platform", "specific", "values",...
86b89ae2f0ac68f86cd5ff66421677b3aa290857
https://github.com/gethuman/pancakes/blob/86b89ae2f0ac68f86cd5ff66421677b3aa290857/lib/web.route.handler.js#L322-L368
train
gethuman/pancakes
lib/transformers/transformer.factory.js
generateTransformer
function generateTransformer(name, transformerFns, templateDir, pluginOptions) { var Transformer = function () {}; var transformer = new Transformer(); // add function mixins to the transformer _.extend(transformer, transformerFns, baseTransformer, annotationHelper, utensils, pluginOptions); // a...
javascript
function generateTransformer(name, transformerFns, templateDir, pluginOptions) { var Transformer = function () {}; var transformer = new Transformer(); // add function mixins to the transformer _.extend(transformer, transformerFns, baseTransformer, annotationHelper, utensils, pluginOptions); // a...
[ "function", "generateTransformer", "(", "name", ",", "transformerFns", ",", "templateDir", ",", "pluginOptions", ")", "{", "var", "Transformer", "=", "function", "(", ")", "{", "}", ";", "var", "transformer", "=", "new", "Transformer", "(", ")", ";", "// add...
Generate a transformer object based off the input params @param name @param transformerFns @param templateDir @param pluginOptions
[ "Generate", "a", "transformer", "object", "based", "off", "the", "input", "params" ]
86b89ae2f0ac68f86cd5ff66421677b3aa290857
https://github.com/gethuman/pancakes/blob/86b89ae2f0ac68f86cd5ff66421677b3aa290857/lib/transformers/transformer.factory.js#L20-L36
train
gethuman/pancakes
lib/transformers/transformer.factory.js
getTransformer
function getTransformer(name, clientPlugin, pluginOptions) { // if in cache, just return it if (cache[name]) { return cache[name]; } var transformers = clientPlugin.transformers; var templateDir = clientPlugin.templateDir; // if no transformer, throw error if (!transformers[name]) { throw new...
javascript
function getTransformer(name, clientPlugin, pluginOptions) { // if in cache, just return it if (cache[name]) { return cache[name]; } var transformers = clientPlugin.transformers; var templateDir = clientPlugin.templateDir; // if no transformer, throw error if (!transformers[name]) { throw new...
[ "function", "getTransformer", "(", "name", ",", "clientPlugin", ",", "pluginOptions", ")", "{", "// if in cache, just return it", "if", "(", "cache", "[", "name", "]", ")", "{", "return", "cache", "[", "name", "]", ";", "}", "var", "transformers", "=", "clie...
Get a particular transformer from cache or generate it @param name @param clientPlugin @param pluginOptions
[ "Get", "a", "particular", "transformer", "from", "cache", "or", "generate", "it" ]
86b89ae2f0ac68f86cd5ff66421677b3aa290857
https://github.com/gethuman/pancakes/blob/86b89ae2f0ac68f86cd5ff66421677b3aa290857/lib/transformers/transformer.factory.js#L44-L62
train
gethuman/pancakes
lib/pancakes.js
init
function init(opts) { opts = opts || {}; // include pancakes instance into options that we pass to plugins opts.pluginOptions = opts.pluginOptions || {}; opts.pluginOptions.pancakes = exports; injector = new DependencyInjector(opts); var ClientPlugin = opts.clientPlugin; var ServerPlugin =...
javascript
function init(opts) { opts = opts || {}; // include pancakes instance into options that we pass to plugins opts.pluginOptions = opts.pluginOptions || {}; opts.pluginOptions.pancakes = exports; injector = new DependencyInjector(opts); var ClientPlugin = opts.clientPlugin; var ServerPlugin =...
[ "function", "init", "(", "opts", ")", "{", "opts", "=", "opts", "||", "{", "}", ";", "// include pancakes instance into options that we pass to plugins", "opts", ".", "pluginOptions", "=", "opts", ".", "pluginOptions", "||", "{", "}", ";", "opts", ".", "pluginOp...
For now this is just a passthrough to the injector's init function @param opts
[ "For", "now", "this", "is", "just", "a", "passthrough", "to", "the", "injector", "s", "init", "function" ]
86b89ae2f0ac68f86cd5ff66421677b3aa290857
https://github.com/gethuman/pancakes/blob/86b89ae2f0ac68f86cd5ff66421677b3aa290857/lib/pancakes.js#L24-L40
train
gethuman/pancakes
lib/pancakes.js
initContainer
function initContainer(opts) { var apps, appDir; container = opts.container; // if batch, preload that dir container === 'batch' ? opts.preload.push('batch') : opts.preload.push('middleware'); if (container === 'webserver') { appDir = path.join(opts.rootDir, '/app'); ...
javascript
function initContainer(opts) { var apps, appDir; container = opts.container; // if batch, preload that dir container === 'batch' ? opts.preload.push('batch') : opts.preload.push('middleware'); if (container === 'webserver') { appDir = path.join(opts.rootDir, '/app'); ...
[ "function", "initContainer", "(", "opts", ")", "{", "var", "apps", ",", "appDir", ";", "container", "=", "opts", ".", "container", ";", "// if batch, preload that dir", "container", "===", "'batch'", "?", "opts", ".", "preload", ".", "push", "(", "'batch'", ...
Convenience function for apps to use. Calls init after setting some values. @param opts
[ "Convenience", "function", "for", "apps", "to", "use", ".", "Calls", "init", "after", "setting", "some", "values", "." ]
86b89ae2f0ac68f86cd5ff66421677b3aa290857
https://github.com/gethuman/pancakes/blob/86b89ae2f0ac68f86cd5ff66421677b3aa290857/lib/pancakes.js#L48-L70
train
gethuman/pancakes
lib/pancakes.js
requireModule
function requireModule(filePath, refreshFlag) { if (refreshFlag) { delete injector.require.cache[filePath]; } return injector.require(filePath); }
javascript
function requireModule(filePath, refreshFlag) { if (refreshFlag) { delete injector.require.cache[filePath]; } return injector.require(filePath); }
[ "function", "requireModule", "(", "filePath", ",", "refreshFlag", ")", "{", "if", "(", "refreshFlag", ")", "{", "delete", "injector", ".", "require", ".", "cache", "[", "filePath", "]", ";", "}", "return", "injector", ".", "require", "(", "filePath", ")", ...
Use the injector require which should be passed in during initialization @param filePath @param refreshFlag @returns {injector.require|*|require}
[ "Use", "the", "injector", "require", "which", "should", "be", "passed", "in", "during", "initialization" ]
86b89ae2f0ac68f86cd5ff66421677b3aa290857
https://github.com/gethuman/pancakes/blob/86b89ae2f0ac68f86cd5ff66421677b3aa290857/lib/pancakes.js#L78-L83
train
gethuman/pancakes
lib/pancakes.js
getService
function getService(name) { if (name.indexOf('.') >= 0) { name = utils.getCamelCase(name); } if (!name.match(/^.*Service$/)) { name += 'Service'; } return cook(name); }
javascript
function getService(name) { if (name.indexOf('.') >= 0) { name = utils.getCamelCase(name); } if (!name.match(/^.*Service$/)) { name += 'Service'; } return cook(name); }
[ "function", "getService", "(", "name", ")", "{", "if", "(", "name", ".", "indexOf", "(", "'.'", ")", ">=", "0", ")", "{", "name", "=", "utils", ".", "getCamelCase", "(", "name", ")", ";", "}", "if", "(", "!", "name", ".", "match", "(", "/", "^....
Get the service for a given resource name @param name
[ "Get", "the", "service", "for", "a", "given", "resource", "name" ]
86b89ae2f0ac68f86cd5ff66421677b3aa290857
https://github.com/gethuman/pancakes/blob/86b89ae2f0ac68f86cd5ff66421677b3aa290857/lib/pancakes.js#L98-L108
train
gethuman/pancakes
lib/pancakes.js
transform
function transform(flapjack, pluginOptions, runtimeOptions) { var name = runtimeOptions.transformer; var transformer = transformerFactory.getTransformer(name, clientPlugin, pluginOptions); var options = _.extend({}, pluginOptions, runtimeOptions); return transformer.transform(flapjack, options); }
javascript
function transform(flapjack, pluginOptions, runtimeOptions) { var name = runtimeOptions.transformer; var transformer = transformerFactory.getTransformer(name, clientPlugin, pluginOptions); var options = _.extend({}, pluginOptions, runtimeOptions); return transformer.transform(flapjack, options); }
[ "function", "transform", "(", "flapjack", ",", "pluginOptions", ",", "runtimeOptions", ")", "{", "var", "name", "=", "runtimeOptions", ".", "transformer", ";", "var", "transformer", "=", "transformerFactory", ".", "getTransformer", "(", "name", ",", "clientPlugin"...
Use the transformer factory to find a transformer and return the generated code @param flapjack @param pluginOptions @param runtimeOptions @returns {*}
[ "Use", "the", "transformer", "factory", "to", "find", "a", "transformer", "and", "return", "the", "generated", "code" ]
86b89ae2f0ac68f86cd5ff66421677b3aa290857
https://github.com/gethuman/pancakes/blob/86b89ae2f0ac68f86cd5ff66421677b3aa290857/lib/pancakes.js#L138-L143
train
creationix/topcube
sampleapp/www/todos.js
function(e) { var tooltip = this.$(".ui-tooltip-top"); var val = this.input.val(); tooltip.fadeOut(); if (this.tooltipTimeout) clearTimeout(this.tooltipTimeout); if (val == '' || val == this.input.attr('placeholder')) return; var show = function(){ tooltip.show().fadeIn(); }; t...
javascript
function(e) { var tooltip = this.$(".ui-tooltip-top"); var val = this.input.val(); tooltip.fadeOut(); if (this.tooltipTimeout) clearTimeout(this.tooltipTimeout); if (val == '' || val == this.input.attr('placeholder')) return; var show = function(){ tooltip.show().fadeIn(); }; t...
[ "function", "(", "e", ")", "{", "var", "tooltip", "=", "this", ".", "$", "(", "\".ui-tooltip-top\"", ")", ";", "var", "val", "=", "this", ".", "input", ".", "val", "(", ")", ";", "tooltip", ".", "fadeOut", "(", ")", ";", "if", "(", "this", ".", ...
Lazily show the tooltip that tells you to press `enter` to save a new todo item, after one second.
[ "Lazily", "show", "the", "tooltip", "that", "tells", "you", "to", "press", "enter", "to", "save", "a", "new", "todo", "item", "after", "one", "second", "." ]
96ff0177bf8f490cabd78eb7b63be6b1bc126d23
https://github.com/creationix/topcube/blob/96ff0177bf8f490cabd78eb7b63be6b1bc126d23/sampleapp/www/todos.js#L241-L249
train
gethuman/pancakes
lib/factories/uipart.factory.js
getUiPart
function getUiPart(modulePath, options) { var rootDir = this.injector.rootDir; var tplDir = (options && options.tplDir) || 'dist' + delim + 'tpls'; var pathParts = modulePath.split(delim); var appName = pathParts[1]; var len = modulePath.length; var filePath, fullModulePa...
javascript
function getUiPart(modulePath, options) { var rootDir = this.injector.rootDir; var tplDir = (options && options.tplDir) || 'dist' + delim + 'tpls'; var pathParts = modulePath.split(delim); var appName = pathParts[1]; var len = modulePath.length; var filePath, fullModulePa...
[ "function", "getUiPart", "(", "modulePath", ",", "options", ")", "{", "var", "rootDir", "=", "this", ".", "injector", ".", "rootDir", ";", "var", "tplDir", "=", "(", "options", "&&", "options", ".", "tplDir", ")", "||", "'dist'", "+", "delim", "+", "'t...
Get a UI Part @param modulePath @param options @returns {*}
[ "Get", "a", "UI", "Part" ]
86b89ae2f0ac68f86cd5ff66421677b3aa290857
https://github.com/gethuman/pancakes/blob/86b89ae2f0ac68f86cd5ff66421677b3aa290857/lib/factories/uipart.factory.js#L55-L97
train
gethuman/pancakes
lib/factories/service.factory.js
ServiceFactory
function ServiceFactory(injector) { this.cache = {}; this.injector = injector || {}; // if we are in debug mode, then add the debug handler var pattern = this.injector.debugPattern || '*.*.*.*.*'; var handler = this.injector.debugHandler || debugHandler; if (this.injector.debug) { event...
javascript
function ServiceFactory(injector) { this.cache = {}; this.injector = injector || {}; // if we are in debug mode, then add the debug handler var pattern = this.injector.debugPattern || '*.*.*.*.*'; var handler = this.injector.debugHandler || debugHandler; if (this.injector.debug) { event...
[ "function", "ServiceFactory", "(", "injector", ")", "{", "this", ".", "cache", "=", "{", "}", ";", "this", ".", "injector", "=", "injector", "||", "{", "}", ";", "// if we are in debug mode, then add the debug handler", "var", "pattern", "=", "this", ".", "inj...
Simple function to clear the cache @param injector @constructor
[ "Simple", "function", "to", "clear", "the", "cache" ]
86b89ae2f0ac68f86cd5ff66421677b3aa290857
https://github.com/gethuman/pancakes/blob/86b89ae2f0ac68f86cd5ff66421677b3aa290857/lib/factories/service.factory.js#L20-L30
train
gethuman/pancakes
lib/factories/service.factory.js
isCandidate
function isCandidate(modulePath) { modulePath = modulePath || ''; var len = modulePath.length; return modulePath.indexOf('/') < 0 && len > 7 && modulePath.substring(modulePath.length - 7) === 'Service'; }
javascript
function isCandidate(modulePath) { modulePath = modulePath || ''; var len = modulePath.length; return modulePath.indexOf('/') < 0 && len > 7 && modulePath.substring(modulePath.length - 7) === 'Service'; }
[ "function", "isCandidate", "(", "modulePath", ")", "{", "modulePath", "=", "modulePath", "||", "''", ";", "var", "len", "=", "modulePath", ".", "length", ";", "return", "modulePath", ".", "indexOf", "(", "'/'", ")", "<", "0", "&&", "len", ">", "7", "&&...
Candidate if no slash and the modulePath ends in 'Service' @param modulePath @returns {boolean}
[ "Candidate", "if", "no", "slash", "and", "the", "modulePath", "ends", "in", "Service" ]
86b89ae2f0ac68f86cd5ff66421677b3aa290857
https://github.com/gethuman/pancakes/blob/86b89ae2f0ac68f86cd5ff66421677b3aa290857/lib/factories/service.factory.js#L39-L44
train
gethuman/pancakes
lib/factories/service.factory.js
getServiceInfo
function getServiceInfo(serviceName, adapterMap) { var serviceInfo = { serviceName: serviceName }; var serviceParts = utils.splitCamelCase(serviceName); // turn oneTwoThree into ['one', 'two', 'three'] var nbrParts = serviceParts.length; // first check to see if the second to last part...
javascript
function getServiceInfo(serviceName, adapterMap) { var serviceInfo = { serviceName: serviceName }; var serviceParts = utils.splitCamelCase(serviceName); // turn oneTwoThree into ['one', 'two', 'three'] var nbrParts = serviceParts.length; // first check to see if the second to last part...
[ "function", "getServiceInfo", "(", "serviceName", ",", "adapterMap", ")", "{", "var", "serviceInfo", "=", "{", "serviceName", ":", "serviceName", "}", ";", "var", "serviceParts", "=", "utils", ".", "splitCamelCase", "(", "serviceName", ")", ";", "// turn oneTwoT...
Figure out information about the service based on the module path and the adapter map @param serviceName @param adapterMap @returns {{}}
[ "Figure", "out", "information", "about", "the", "service", "based", "on", "the", "module", "path", "and", "the", "adapter", "map" ]
86b89ae2f0ac68f86cd5ff66421677b3aa290857
https://github.com/gethuman/pancakes/blob/86b89ae2f0ac68f86cd5ff66421677b3aa290857/lib/factories/service.factory.js#L90-L109
train
gethuman/pancakes
lib/factories/service.factory.js
getResource
function getResource(serviceInfo, moduleStack) { var resourceName = serviceInfo.resourceName; var resourcePath = '/resources/' + resourceName + '/' + resourceName + '.resource'; return this.loadIfExists(resourcePath, moduleStack, 'Could not find resource file'); }
javascript
function getResource(serviceInfo, moduleStack) { var resourceName = serviceInfo.resourceName; var resourcePath = '/resources/' + resourceName + '/' + resourceName + '.resource'; return this.loadIfExists(resourcePath, moduleStack, 'Could not find resource file'); }
[ "function", "getResource", "(", "serviceInfo", ",", "moduleStack", ")", "{", "var", "resourceName", "=", "serviceInfo", ".", "resourceName", ";", "var", "resourcePath", "=", "'/resources/'", "+", "resourceName", "+", "'/'", "+", "resourceName", "+", "'.resource'",...
Get a resource based on the @param serviceInfo @param moduleStack @returns {{}} A resource object
[ "Get", "a", "resource", "based", "on", "the" ]
86b89ae2f0ac68f86cd5ff66421677b3aa290857
https://github.com/gethuman/pancakes/blob/86b89ae2f0ac68f86cd5ff66421677b3aa290857/lib/factories/service.factory.js#L117-L121
train
gethuman/pancakes
lib/factories/service.factory.js
getAdapter
function getAdapter(serviceInfo, resource, moduleStack) { var adapterName = serviceInfo.adapterName; // if adapter name is 'service' and there is a default, switch to the default if (adapterName === 'service' && resource.adapters[this.injector.container]) { adapterName = serviceInfo...
javascript
function getAdapter(serviceInfo, resource, moduleStack) { var adapterName = serviceInfo.adapterName; // if adapter name is 'service' and there is a default, switch to the default if (adapterName === 'service' && resource.adapters[this.injector.container]) { adapterName = serviceInfo...
[ "function", "getAdapter", "(", "serviceInfo", ",", "resource", ",", "moduleStack", ")", "{", "var", "adapterName", "=", "serviceInfo", ".", "adapterName", ";", "// if adapter name is 'service' and there is a default, switch to the default", "if", "(", "adapterName", "===", ...
Get a adapter based on the service info and what exists on the file system @param serviceInfo @param resource @param moduleStack
[ "Get", "a", "adapter", "based", "on", "the", "service", "info", "and", "what", "exists", "on", "the", "file", "system" ]
86b89ae2f0ac68f86cd5ff66421677b3aa290857
https://github.com/gethuman/pancakes/blob/86b89ae2f0ac68f86cd5ff66421677b3aa290857/lib/factories/service.factory.js#L130-L160
train
gethuman/pancakes
lib/factories/service.factory.js
loadIfExists
function loadIfExists(path, moduleStack, errMsg) { var servicesDir = this.injector.servicesDir; var servicesFullPath = this.injector.rootDir + '/' + servicesDir; // if the file doesn't exist, either throw an error (if msg passed in), else just return null if (!fs.existsSync(p.join(servi...
javascript
function loadIfExists(path, moduleStack, errMsg) { var servicesDir = this.injector.servicesDir; var servicesFullPath = this.injector.rootDir + '/' + servicesDir; // if the file doesn't exist, either throw an error (if msg passed in), else just return null if (!fs.existsSync(p.join(servi...
[ "function", "loadIfExists", "(", "path", ",", "moduleStack", ",", "errMsg", ")", "{", "var", "servicesDir", "=", "this", ".", "injector", ".", "servicesDir", ";", "var", "servicesFullPath", "=", "this", ".", "injector", ".", "rootDir", "+", "'/'", "+", "se...
Load a module if it exists @param path @param moduleStack @param errMsg @returns {*}
[ "Load", "a", "module", "if", "it", "exists" ]
86b89ae2f0ac68f86cd5ff66421677b3aa290857
https://github.com/gethuman/pancakes/blob/86b89ae2f0ac68f86cd5ff66421677b3aa290857/lib/factories/service.factory.js#L169-L185
train
gethuman/pancakes
lib/factories/service.factory.js
putItAllTogether
function putItAllTogether(serviceInfo, resource, adapter) { var me = this; var debug = this.injector.debug; // loop through the methods _.each(resource.methods[serviceInfo.adapterName], function (method) { if (!adapter[method]) { return; } ...
javascript
function putItAllTogether(serviceInfo, resource, adapter) { var me = this; var debug = this.injector.debug; // loop through the methods _.each(resource.methods[serviceInfo.adapterName], function (method) { if (!adapter[method]) { return; } ...
[ "function", "putItAllTogether", "(", "serviceInfo", ",", "resource", ",", "adapter", ")", "{", "var", "me", "=", "this", ";", "var", "debug", "=", "this", ".", "injector", ".", "debug", ";", "// loop through the methods", "_", ".", "each", "(", "resource", ...
Take all the objects involved with a service and put them all together. The final service is really just an instance of an adapter with each method enhanced to have various filters added @param serviceInfo @param resource @param adapter @returns {{}}
[ "Take", "all", "the", "objects", "involved", "with", "a", "service", "and", "put", "them", "all", "together", ".", "The", "final", "service", "is", "really", "just", "an", "instance", "of", "an", "adapter", "with", "each", "method", "enhanced", "to", "have...
86b89ae2f0ac68f86cd5ff66421677b3aa290857
https://github.com/gethuman/pancakes/blob/86b89ae2f0ac68f86cd5ff66421677b3aa290857/lib/factories/service.factory.js#L196-L261
train
gethuman/pancakes
lib/factories/service.factory.js
emitEvent
function emitEvent(payload, eventNameBase, debugParams) { // create a copy of the payload so that nothing modifies the original object try { payload = JSON.parse(JSON.stringify(payload)); } catch (err) { /* eslint no-console:0 */ console.log('issue pa...
javascript
function emitEvent(payload, eventNameBase, debugParams) { // create a copy of the payload so that nothing modifies the original object try { payload = JSON.parse(JSON.stringify(payload)); } catch (err) { /* eslint no-console:0 */ console.log('issue pa...
[ "function", "emitEvent", "(", "payload", ",", "eventNameBase", ",", "debugParams", ")", "{", "// create a copy of the payload so that nothing modifies the original object", "try", "{", "payload", "=", "JSON", ".", "parse", "(", "JSON", ".", "stringify", "(", "payload", ...
This is used to get an mock filter which will be sending out events @param payload @param eventNameBase @param debugParams
[ "This", "is", "used", "to", "get", "an", "mock", "filter", "which", "will", "be", "sending", "out", "events" ]
86b89ae2f0ac68f86cd5ff66421677b3aa290857
https://github.com/gethuman/pancakes/blob/86b89ae2f0ac68f86cd5ff66421677b3aa290857/lib/factories/service.factory.js#L269-L294
train
gethuman/pancakes
lib/factories/service.factory.js
validateRequestParams
function validateRequestParams(req, resource, method, adapter) { req = req || {}; var params = resource.params || {}; var methodParams = _.extend({}, params[method], params[adapter + '.' + method] ); var requiredParams = methodParams.required || []; var eitherorParams = methodPa...
javascript
function validateRequestParams(req, resource, method, adapter) { req = req || {}; var params = resource.params || {}; var methodParams = _.extend({}, params[method], params[adapter + '.' + method] ); var requiredParams = methodParams.required || []; var eitherorParams = methodPa...
[ "function", "validateRequestParams", "(", "req", ",", "resource", ",", "method", ",", "adapter", ")", "{", "req", "=", "req", "||", "{", "}", ";", "var", "params", "=", "resource", ".", "params", "||", "{", "}", ";", "var", "methodParams", "=", "_", ...
Used within a service to validate the input params @param req @param resource @param method @param adapter @returns {*}
[ "Used", "within", "a", "service", "to", "validate", "the", "input", "params" ]
86b89ae2f0ac68f86cd5ff66421677b3aa290857
https://github.com/gethuman/pancakes/blob/86b89ae2f0ac68f86cd5ff66421677b3aa290857/lib/factories/service.factory.js#L304-L371
train
telefonicaid/logops
lib/logops.js
logWrap
function logWrap(level) { return function log() { let context, message, args, trace, err; if (arguments[0] instanceof Error) { // log.<level>(err, ...) context = API.getContext(); args = Array.prototype.slice.call(arguments, 1); if (!args.length) { // log.<leve...
javascript
function logWrap(level) { return function log() { let context, message, args, trace, err; if (arguments[0] instanceof Error) { // log.<level>(err, ...) context = API.getContext(); args = Array.prototype.slice.call(arguments, 1); if (!args.length) { // log.<leve...
[ "function", "logWrap", "(", "level", ")", "{", "return", "function", "log", "(", ")", "{", "let", "context", ",", "message", ",", "args", ",", "trace", ",", "err", ";", "if", "(", "arguments", "[", "0", "]", "instanceof", "Error", ")", "{", "// log.<...
Internal private function that implements a decorator to all the level functions. @param {String} level one of ['DEBUG', 'INFO', 'WARN', 'ERROR', 'FATAL']
[ "Internal", "private", "function", "that", "implements", "a", "decorator", "to", "all", "the", "level", "functions", "." ]
6023d75b3531ed1bb3abe171679234f9519be082
https://github.com/telefonicaid/logops/blob/6023d75b3531ed1bb3abe171679234f9519be082/lib/logops.js#L45-L80
train
telefonicaid/logops
lib/logops.js
setLevel
function setLevel(level) { opts.level = level; let logLevelIndex = levels.indexOf(opts.level.toUpperCase()); levels.forEach((logLevel) => { let fn; if (logLevelIndex <= levels.indexOf(logLevel)) { fn = logWrap(logLevel); } else { fn = noop; } API[logLevel.toLow...
javascript
function setLevel(level) { opts.level = level; let logLevelIndex = levels.indexOf(opts.level.toUpperCase()); levels.forEach((logLevel) => { let fn; if (logLevelIndex <= levels.indexOf(logLevel)) { fn = logWrap(logLevel); } else { fn = noop; } API[logLevel.toLow...
[ "function", "setLevel", "(", "level", ")", "{", "opts", ".", "level", "=", "level", ";", "let", "logLevelIndex", "=", "levels", ".", "indexOf", "(", "opts", ".", "level", ".", "toUpperCase", "(", ")", ")", ";", "levels", ".", "forEach", "(", "(", "lo...
Sets the enabled logging level. All the disabled logging methods are replaced by a noop, so there is not any performance penalty at production using an undesired level @param {String} level
[ "Sets", "the", "enabled", "logging", "level", ".", "All", "the", "disabled", "logging", "methods", "are", "replaced", "by", "a", "noop", "so", "there", "is", "not", "any", "performance", "penalty", "at", "production", "using", "an", "undesired", "level" ]
6023d75b3531ed1bb3abe171679234f9519be082
https://github.com/telefonicaid/logops/blob/6023d75b3531ed1bb3abe171679234f9519be082/lib/logops.js#L89-L102
train
telefonicaid/logops
lib/logops.js
merge
function merge(obj1, obj2) { var res = {}, attrname; for (attrname in obj1) { res[attrname] = obj1[attrname]; } for (attrname in obj2) { res[attrname] = obj2[attrname]; } return res; }
javascript
function merge(obj1, obj2) { var res = {}, attrname; for (attrname in obj1) { res[attrname] = obj1[attrname]; } for (attrname in obj2) { res[attrname] = obj2[attrname]; } return res; }
[ "function", "merge", "(", "obj1", ",", "obj2", ")", "{", "var", "res", "=", "{", "}", ",", "attrname", ";", "for", "(", "attrname", "in", "obj1", ")", "{", "res", "[", "attrname", "]", "=", "obj1", "[", "attrname", "]", ";", "}", "for", "(", "a...
Merges accesible properties in two objects. obj2 takes precedence when common properties are found @param {Object} obj1 @param {Object} obj2 @returns {{}} The merged, new, object
[ "Merges", "accesible", "properties", "in", "two", "objects", ".", "obj2", "takes", "precedence", "when", "common", "properties", "are", "found" ]
6023d75b3531ed1bb3abe171679234f9519be082
https://github.com/telefonicaid/logops/blob/6023d75b3531ed1bb3abe171679234f9519be082/lib/logops.js#L266-L276
train
gethuman/pancakes
lib/transformers/base.transformer.js
loadUIPart
function loadUIPart(appName, filePath) { var idx = filePath.indexOf(delim + appName + delim); var modulePath = filePath.substring(idx - 3); return this.pancakes.cook(modulePath); }
javascript
function loadUIPart(appName, filePath) { var idx = filePath.indexOf(delim + appName + delim); var modulePath = filePath.substring(idx - 3); return this.pancakes.cook(modulePath); }
[ "function", "loadUIPart", "(", "appName", ",", "filePath", ")", "{", "var", "idx", "=", "filePath", ".", "indexOf", "(", "delim", "+", "appName", "+", "delim", ")", ";", "var", "modulePath", "=", "filePath", ".", "substring", "(", "idx", "-", "3", ")",...
Load the UI part @param appName @param filePath @returns {injector.require|*|require}
[ "Load", "the", "UI", "part" ]
86b89ae2f0ac68f86cd5ff66421677b3aa290857
https://github.com/gethuman/pancakes/blob/86b89ae2f0ac68f86cd5ff66421677b3aa290857/lib/transformers/base.transformer.js#L24-L28
train
gethuman/pancakes
lib/transformers/base.transformer.js
setTemplate
function setTemplate(transformDir, templateName, clientType) { clientType = clientType ? (clientType + '.') : ''; if (templateCache[templateName]) { this.template = templateCache[templateName]; } else { var fileName = transformDir + '/' + clientType + templateName + '.template'; ...
javascript
function setTemplate(transformDir, templateName, clientType) { clientType = clientType ? (clientType + '.') : ''; if (templateCache[templateName]) { this.template = templateCache[templateName]; } else { var fileName = transformDir + '/' + clientType + templateName + '.template'; ...
[ "function", "setTemplate", "(", "transformDir", ",", "templateName", ",", "clientType", ")", "{", "clientType", "=", "clientType", "?", "(", "clientType", "+", "'.'", ")", ":", "''", ";", "if", "(", "templateCache", "[", "templateName", "]", ")", "{", "thi...
Get a dot template @param transformDir @param templateName @param clientType
[ "Get", "a", "dot", "template" ]
86b89ae2f0ac68f86cd5ff66421677b3aa290857
https://github.com/gethuman/pancakes/blob/86b89ae2f0ac68f86cd5ff66421677b3aa290857/lib/transformers/base.transformer.js#L65-L82
train
gethuman/pancakes
lib/transformers/base.transformer.js
getParamInfo
function getParamInfo(params, aliases) { var paramInfo = { converted: [], list: [], ngrefs: [] }; _.each(params, function (param) { var mappedVal = aliases[param] || param; if (mappedVal === 'angular') { paramInfo.ngrefs.push(param); } else { paramInfo.li...
javascript
function getParamInfo(params, aliases) { var paramInfo = { converted: [], list: [], ngrefs: [] }; _.each(params, function (param) { var mappedVal = aliases[param] || param; if (mappedVal === 'angular') { paramInfo.ngrefs.push(param); } else { paramInfo.li...
[ "function", "getParamInfo", "(", "params", ",", "aliases", ")", "{", "var", "paramInfo", "=", "{", "converted", ":", "[", "]", ",", "list", ":", "[", "]", ",", "ngrefs", ":", "[", "]", "}", ";", "_", ".", "each", "(", "params", ",", "function", "...
Take a list of params and create an object that contains the param list and converted values which will be used in templates @param params @param aliases @returns {{converted: Array, list: Array}}
[ "Take", "a", "list", "of", "params", "and", "create", "an", "object", "that", "contains", "the", "param", "list", "and", "converted", "values", "which", "will", "be", "used", "in", "templates" ]
86b89ae2f0ac68f86cd5ff66421677b3aa290857
https://github.com/gethuman/pancakes/blob/86b89ae2f0ac68f86cd5ff66421677b3aa290857/lib/transformers/base.transformer.js#L92-L107
train
gethuman/pancakes
lib/transformers/base.transformer.js
getFilteredParamInfo
function getFilteredParamInfo(flapjack, options) { if (!flapjack) { return {}; } var aliases = this.getClientAliases(flapjack, options); var params = this.getParameters(flapjack) || []; params = params.filter(function (param) { return ['$scope', 'defaults', 'initialModel'].indexOf(param) < 0; ...
javascript
function getFilteredParamInfo(flapjack, options) { if (!flapjack) { return {}; } var aliases = this.getClientAliases(flapjack, options); var params = this.getParameters(flapjack) || []; params = params.filter(function (param) { return ['$scope', 'defaults', 'initialModel'].indexOf(param) < 0; ...
[ "function", "getFilteredParamInfo", "(", "flapjack", ",", "options", ")", "{", "if", "(", "!", "flapjack", ")", "{", "return", "{", "}", ";", "}", "var", "aliases", "=", "this", ".", "getClientAliases", "(", "flapjack", ",", "options", ")", ";", "var", ...
Get the parameter info for a given flajack @param flapjack @param options @returns {*|{converted: Array, list: Array}|{}}
[ "Get", "the", "parameter", "info", "for", "a", "given", "flajack" ]
86b89ae2f0ac68f86cd5ff66421677b3aa290857
https://github.com/gethuman/pancakes/blob/86b89ae2f0ac68f86cd5ff66421677b3aa290857/lib/transformers/base.transformer.js#L115-L125
train
gethuman/pancakes
lib/transformers/base.transformer.js
getModuleBody
function getModuleBody(flapjack) { if (!flapjack) { return ''; } var str = flapjack.toString(); var openingCurly = str.indexOf('{'); var closingCurly = str.lastIndexOf('}'); // if can't find the opening or closing curly, just return the entire string if (openingCurly < 0 || closingCurly < 0) {...
javascript
function getModuleBody(flapjack) { if (!flapjack) { return ''; } var str = flapjack.toString(); var openingCurly = str.indexOf('{'); var closingCurly = str.lastIndexOf('}'); // if can't find the opening or closing curly, just return the entire string if (openingCurly < 0 || closingCurly < 0) {...
[ "function", "getModuleBody", "(", "flapjack", ")", "{", "if", "(", "!", "flapjack", ")", "{", "return", "''", ";", "}", "var", "str", "=", "flapjack", ".", "toString", "(", ")", ";", "var", "openingCurly", "=", "str", ".", "indexOf", "(", "'{'", ")",...
Get the core logic within a module without the function declaration, parameters, etc. Essentially everything inside the curly brackets. @param flapjack The pancakes module @return {String}
[ "Get", "the", "core", "logic", "within", "a", "module", "without", "the", "function", "declaration", "parameters", "etc", ".", "Essentially", "everything", "inside", "the", "curly", "brackets", "." ]
86b89ae2f0ac68f86cd5ff66421677b3aa290857
https://github.com/gethuman/pancakes/blob/86b89ae2f0ac68f86cd5ff66421677b3aa290857/lib/transformers/base.transformer.js#L133-L147
train
kartotherian/core
lib/sources.js
updateInfo
function updateInfo(info, override, source, sourceId) { if (source) { if (source.minzoom !== undefined) { // eslint-disable-next-line no-param-reassign info.minzoom = source.minzoom; } if (source.maxzoom !== undefined) { // eslint-disable-next-line no-param-reassign info.maxzoom = ...
javascript
function updateInfo(info, override, source, sourceId) { if (source) { if (source.minzoom !== undefined) { // eslint-disable-next-line no-param-reassign info.minzoom = source.minzoom; } if (source.maxzoom !== undefined) { // eslint-disable-next-line no-param-reassign info.maxzoom = ...
[ "function", "updateInfo", "(", "info", ",", "override", ",", "source", ",", "sourceId", ")", "{", "if", "(", "source", ")", "{", "if", "(", "source", ".", "minzoom", "!==", "undefined", ")", "{", "// eslint-disable-next-line no-param-reassign", "info", ".", ...
Override top-level values in the info object with the ones from override object, or delete on null @param {object} info @param {object} override @param {object} [source] if given, sets min/max zoom @param {string} [sourceId]
[ "Override", "top", "-", "level", "values", "in", "the", "info", "object", "with", "the", "ones", "from", "override", "object", "or", "delete", "on", "null" ]
fb9f696816a08d782f5444364432f1fd79f4d56f
https://github.com/kartotherian/core/blob/fb9f696816a08d782f5444364432f1fd79f4d56f/lib/sources.js#L116-L144
train
querycert/qcert
doc/demo/evalWorker.js
qcertEval
function qcertEval(inputConfig) { console.log("qcertEval chosen"); var handler = function(result) { console.log("Compiler returned"); console.log(result); postMessage(result.eval); console.log("reply message posted"); // Each spawned worker is designed to be used once close(); } qcertWhiskDispatch(inpu...
javascript
function qcertEval(inputConfig) { console.log("qcertEval chosen"); var handler = function(result) { console.log("Compiler returned"); console.log(result); postMessage(result.eval); console.log("reply message posted"); // Each spawned worker is designed to be used once close(); } qcertWhiskDispatch(inpu...
[ "function", "qcertEval", "(", "inputConfig", ")", "{", "console", ".", "log", "(", "\"qcertEval chosen\"", ")", ";", "var", "handler", "=", "function", "(", "result", ")", "{", "console", ".", "log", "(", "\"Compiler returned\"", ")", ";", "console", ".", ...
qcert intermediate language evaluation
[ "qcert", "intermediate", "language", "evaluation" ]
092ed55d08bf0f720fed9d07d172afc169e84576
https://github.com/querycert/qcert/blob/092ed55d08bf0f720fed9d07d172afc169e84576/doc/demo/evalWorker.js#L39-L51
train
gethuman/pancakes
lib/annotation.helper.js
getAnnotationInfo
function getAnnotationInfo(name, fn, isArray) { if (!fn) { return null; } var str = fn.toString(); var rgx = new RegExp('(?:@' + name + '\\()(.*)(?:\\))'); var matches = rgx.exec(str); if (!matches || matches.length < 2) { return null; } var annotation = matches[1]; if (isAr...
javascript
function getAnnotationInfo(name, fn, isArray) { if (!fn) { return null; } var str = fn.toString(); var rgx = new RegExp('(?:@' + name + '\\()(.*)(?:\\))'); var matches = rgx.exec(str); if (!matches || matches.length < 2) { return null; } var annotation = matches[1]; if (isAr...
[ "function", "getAnnotationInfo", "(", "name", ",", "fn", ",", "isArray", ")", "{", "if", "(", "!", "fn", ")", "{", "return", "null", ";", "}", "var", "str", "=", "fn", ".", "toString", "(", ")", ";", "var", "rgx", "=", "new", "RegExp", "(", "'(?:...
Get any annotation that follows the same format @param name @param fn @param isArray @returns {*}
[ "Get", "any", "annotation", "that", "follows", "the", "same", "format" ]
86b89ae2f0ac68f86cd5ff66421677b3aa290857
https://github.com/gethuman/pancakes/blob/86b89ae2f0ac68f86cd5ff66421677b3aa290857/lib/annotation.helper.js#L17-L54
train
gethuman/pancakes
lib/annotation.helper.js
getAliases
function getAliases(name, flapjack) { var moduleInfo = getModuleInfo(flapjack) || {}; var aliases = moduleInfo[name] || {}; return aliases === true ? {} : aliases; }
javascript
function getAliases(name, flapjack) { var moduleInfo = getModuleInfo(flapjack) || {}; var aliases = moduleInfo[name] || {}; return aliases === true ? {} : aliases; }
[ "function", "getAliases", "(", "name", ",", "flapjack", ")", "{", "var", "moduleInfo", "=", "getModuleInfo", "(", "flapjack", ")", "||", "{", "}", ";", "var", "aliases", "=", "moduleInfo", "[", "name", "]", "||", "{", "}", ";", "return", "aliases", "==...
Get either the client or server param mapping @param name [client|server] @param flapjack @return {{}}
[ "Get", "either", "the", "client", "or", "server", "param", "mapping" ]
86b89ae2f0ac68f86cd5ff66421677b3aa290857
https://github.com/gethuman/pancakes/blob/86b89ae2f0ac68f86cd5ff66421677b3aa290857/lib/annotation.helper.js#L73-L77
train
gethuman/pancakes
lib/annotation.helper.js
getServerAliases
function getServerAliases(flapjack, options) { options = options || {}; var aliases = getAliases('server', flapjack); var serverAliases = options && options.serverAliases; return _.extend({}, aliases, serverAliases); }
javascript
function getServerAliases(flapjack, options) { options = options || {}; var aliases = getAliases('server', flapjack); var serverAliases = options && options.serverAliases; return _.extend({}, aliases, serverAliases); }
[ "function", "getServerAliases", "(", "flapjack", ",", "options", ")", "{", "options", "=", "options", "||", "{", "}", ";", "var", "aliases", "=", "getAliases", "(", "'server'", ",", "flapjack", ")", ";", "var", "serverAliases", "=", "options", "&&", "optio...
Get the Server param mappings @param flapjack @param options @return {{}}
[ "Get", "the", "Server", "param", "mappings" ]
86b89ae2f0ac68f86cd5ff66421677b3aa290857
https://github.com/gethuman/pancakes/blob/86b89ae2f0ac68f86cd5ff66421677b3aa290857/lib/annotation.helper.js#L85-L90
train
gethuman/pancakes
lib/annotation.helper.js
getClientAliases
function getClientAliases(flapjack, options) { options = options || {}; var aliases = getAliases('client', flapjack); return _.extend({}, aliases, options.clientAliases); }
javascript
function getClientAliases(flapjack, options) { options = options || {}; var aliases = getAliases('client', flapjack); return _.extend({}, aliases, options.clientAliases); }
[ "function", "getClientAliases", "(", "flapjack", ",", "options", ")", "{", "options", "=", "options", "||", "{", "}", ";", "var", "aliases", "=", "getAliases", "(", "'client'", ",", "flapjack", ")", ";", "return", "_", ".", "extend", "(", "{", "}", ","...
Get the client param mapping @param flapjack @param options @return {{}}
[ "Get", "the", "client", "param", "mapping" ]
86b89ae2f0ac68f86cd5ff66421677b3aa290857
https://github.com/gethuman/pancakes/blob/86b89ae2f0ac68f86cd5ff66421677b3aa290857/lib/annotation.helper.js#L98-L102
train
gethuman/pancakes
lib/annotation.helper.js
getParameters
function getParameters(flapjack) { if (!_.isFunction(flapjack)) { throw new Error('Flapjack not a function ' + JSON.stringify(flapjack)); } var str = flapjack.toString(); var pattern = /(?:\()([^\)]*)(?:\))/; var matches = pattern.exec(str); if (matches === null || matches.length < 2)...
javascript
function getParameters(flapjack) { if (!_.isFunction(flapjack)) { throw new Error('Flapjack not a function ' + JSON.stringify(flapjack)); } var str = flapjack.toString(); var pattern = /(?:\()([^\)]*)(?:\))/; var matches = pattern.exec(str); if (matches === null || matches.length < 2)...
[ "function", "getParameters", "(", "flapjack", ")", "{", "if", "(", "!", "_", ".", "isFunction", "(", "flapjack", ")", ")", "{", "throw", "new", "Error", "(", "'Flapjack not a function '", "+", "JSON", ".", "stringify", "(", "flapjack", ")", ")", ";", "}"...
Get the function parameters for a given pancakes module @param flapjack The pancakes module @return {Array}
[ "Get", "the", "function", "parameters", "for", "a", "given", "pancakes", "module" ]
86b89ae2f0ac68f86cd5ff66421677b3aa290857
https://github.com/gethuman/pancakes/blob/86b89ae2f0ac68f86cd5ff66421677b3aa290857/lib/annotation.helper.js#L110-L134
train
gethuman/pancakes
lib/factories/model.factory.js
getResourceNames
function getResourceNames() { var resourceNames = {}; var resourcesDir = this.injector.rootDir + '/' + this.injector.servicesDir + '/resources'; if (!fs.existsSync(path.normalize(resourcesDir))) { return resourceNames; } var names = fs.readdirSync(path.normalize(res...
javascript
function getResourceNames() { var resourceNames = {}; var resourcesDir = this.injector.rootDir + '/' + this.injector.servicesDir + '/resources'; if (!fs.existsSync(path.normalize(resourcesDir))) { return resourceNames; } var names = fs.readdirSync(path.normalize(res...
[ "function", "getResourceNames", "(", ")", "{", "var", "resourceNames", "=", "{", "}", ";", "var", "resourcesDir", "=", "this", ".", "injector", ".", "rootDir", "+", "'/'", "+", "this", ".", "injector", ".", "servicesDir", "+", "'/resources'", ";", "if", ...
Get all the resources into memory @returns {{}}
[ "Get", "all", "the", "resources", "into", "memory" ]
86b89ae2f0ac68f86cd5ff66421677b3aa290857
https://github.com/gethuman/pancakes/blob/86b89ae2f0ac68f86cd5ff66421677b3aa290857/lib/factories/model.factory.js#L33-L49
train
gethuman/pancakes
lib/factories/model.factory.js
getModel
function getModel(service, mixins) { // model constructor takes in data and saves it along with the model mixins var Model = function (data) { _.extend(this, data, mixins); }; if (service.save) { Model.prototype.save = function () { if (this._id)...
javascript
function getModel(service, mixins) { // model constructor takes in data and saves it along with the model mixins var Model = function (data) { _.extend(this, data, mixins); }; if (service.save) { Model.prototype.save = function () { if (this._id)...
[ "function", "getModel", "(", "service", ",", "mixins", ")", "{", "// model constructor takes in data and saves it along with the model mixins", "var", "Model", "=", "function", "(", "data", ")", "{", "_", ".", "extend", "(", "this", ",", "data", ",", "mixins", ")"...
Get a model based on a service and resource @param service @param mixins @returns {Model}
[ "Get", "a", "model", "based", "on", "a", "service", "and", "resource" ]
86b89ae2f0ac68f86cd5ff66421677b3aa290857
https://github.com/gethuman/pancakes/blob/86b89ae2f0ac68f86cd5ff66421677b3aa290857/lib/factories/model.factory.js#L73-L115
train
gethuman/pancakes
lib/factories/model.factory.js
create
function create(modulePath, moduleStack) { // first check the cache to see if we already loaded it if (this.cache[modulePath]) { return this.cache[modulePath]; } // try to get the resource for this module var resource; if (this.resources[modulePath]) { ...
javascript
function create(modulePath, moduleStack) { // first check the cache to see if we already loaded it if (this.cache[modulePath]) { return this.cache[modulePath]; } // try to get the resource for this module var resource; if (this.resources[modulePath]) { ...
[ "function", "create", "(", "modulePath", ",", "moduleStack", ")", "{", "// first check the cache to see if we already loaded it", "if", "(", "this", ".", "cache", "[", "modulePath", "]", ")", "{", "return", "this", ".", "cache", "[", "modulePath", "]", ";", "}",...
Create a model @param modulePath @param moduleStack
[ "Create", "a", "model" ]
86b89ae2f0ac68f86cd5ff66421677b3aa290857
https://github.com/gethuman/pancakes/blob/86b89ae2f0ac68f86cd5ff66421677b3aa290857/lib/factories/model.factory.js#L122-L149
train
gethuman/pancakes
lib/factories/internal.object.factory.js
InternalObjectFactory
function InternalObjectFactory(injector) { this.injector = injector; this.internalObjects = { resources: true, reactors: true, adapters: true, appConfigs: true, eventBus: eventBus, chainPromises: utils.chainPromises }; }
javascript
function InternalObjectFactory(injector) { this.injector = injector; this.internalObjects = { resources: true, reactors: true, adapters: true, appConfigs: true, eventBus: eventBus, chainPromises: utils.chainPromises }; }
[ "function", "InternalObjectFactory", "(", "injector", ")", "{", "this", ".", "injector", "=", "injector", ";", "this", ".", "internalObjects", "=", "{", "resources", ":", "true", ",", "reactors", ":", "true", ",", "adapters", ":", "true", ",", "appConfigs", ...
Constructor doesn't currently do anything @constructor
[ "Constructor", "doesn", "t", "currently", "do", "anything" ]
86b89ae2f0ac68f86cd5ff66421677b3aa290857
https://github.com/gethuman/pancakes/blob/86b89ae2f0ac68f86cd5ff66421677b3aa290857/lib/factories/internal.object.factory.js#L18-L28
train
gethuman/pancakes
lib/factories/internal.object.factory.js
loadResources
function loadResources() { var resources = {}; var resourcesDir = path.join(this.injector.rootDir, this.injector.servicesDir + '/resources'); if (!fs.existsSync(resourcesDir)) { return resources; } var me = this; var resourceNames = fs.readdirSync(resources...
javascript
function loadResources() { var resources = {}; var resourcesDir = path.join(this.injector.rootDir, this.injector.servicesDir + '/resources'); if (!fs.existsSync(resourcesDir)) { return resources; } var me = this; var resourceNames = fs.readdirSync(resources...
[ "function", "loadResources", "(", ")", "{", "var", "resources", "=", "{", "}", ";", "var", "resourcesDir", "=", "path", ".", "join", "(", "this", ".", "injector", ".", "rootDir", ",", "this", ".", "injector", ".", "servicesDir", "+", "'/resources'", ")",...
Load all resources into an object that can be injected @returns {{}}
[ "Load", "all", "resources", "into", "an", "object", "that", "can", "be", "injected" ]
86b89ae2f0ac68f86cd5ff66421677b3aa290857
https://github.com/gethuman/pancakes/blob/86b89ae2f0ac68f86cd5ff66421677b3aa290857/lib/factories/internal.object.factory.js#L36-L55
train
gethuman/pancakes
lib/factories/internal.object.factory.js
loadAdapters
function loadAdapters() { var adapters = {}; var adaptersDir = path.join(this.injector.rootDir, this.injector.servicesDir + '/adapters'); if (!fs.existsSync(adaptersDir)) { return this.injector.adapters || {}; } var me = this; var adapterNames = fs.readdirSy...
javascript
function loadAdapters() { var adapters = {}; var adaptersDir = path.join(this.injector.rootDir, this.injector.servicesDir + '/adapters'); if (!fs.existsSync(adaptersDir)) { return this.injector.adapters || {}; } var me = this; var adapterNames = fs.readdirSy...
[ "function", "loadAdapters", "(", ")", "{", "var", "adapters", "=", "{", "}", ";", "var", "adaptersDir", "=", "path", ".", "join", "(", "this", ".", "injector", ".", "rootDir", ",", "this", ".", "injector", ".", "servicesDir", "+", "'/adapters'", ")", "...
Load all adapters into an object that can be injected @returns {{}}
[ "Load", "all", "adapters", "into", "an", "object", "that", "can", "be", "injected" ]
86b89ae2f0ac68f86cd5ff66421677b3aa290857
https://github.com/gethuman/pancakes/blob/86b89ae2f0ac68f86cd5ff66421677b3aa290857/lib/factories/internal.object.factory.js#L61-L85
train
gethuman/pancakes
lib/factories/internal.object.factory.js
loadReactors
function loadReactors() { var reactors = {}; var reactorsDir = path.join(this.injector.rootDir, this.injector.servicesDir + '/reactors'); if (!fs.existsSync(reactorsDir)) { return reactors; } var me = this; var reactorNames = fs.readdirSync(reactorsDir); ...
javascript
function loadReactors() { var reactors = {}; var reactorsDir = path.join(this.injector.rootDir, this.injector.servicesDir + '/reactors'); if (!fs.existsSync(reactorsDir)) { return reactors; } var me = this; var reactorNames = fs.readdirSync(reactorsDir); ...
[ "function", "loadReactors", "(", ")", "{", "var", "reactors", "=", "{", "}", ";", "var", "reactorsDir", "=", "path", ".", "join", "(", "this", ".", "injector", ".", "rootDir", ",", "this", ".", "injector", ".", "servicesDir", "+", "'/reactors'", ")", "...
Load all reactors into an object that can be injected @returns {{}}
[ "Load", "all", "reactors", "into", "an", "object", "that", "can", "be", "injected" ]
86b89ae2f0ac68f86cd5ff66421677b3aa290857
https://github.com/gethuman/pancakes/blob/86b89ae2f0ac68f86cd5ff66421677b3aa290857/lib/factories/internal.object.factory.js#L91-L111
train
gethuman/pancakes
lib/factories/internal.object.factory.js
loadAppConfigs
function loadAppConfigs() { var appConfigs = {}; var appDir = path.join(this.injector.rootDir, '/app'); if (!fs.existsSync(appDir)) { return appConfigs; } var me = this; var appNames = fs.readdirSync(appDir); _.each(appNames, function (appName) { ...
javascript
function loadAppConfigs() { var appConfigs = {}; var appDir = path.join(this.injector.rootDir, '/app'); if (!fs.existsSync(appDir)) { return appConfigs; } var me = this; var appNames = fs.readdirSync(appDir); _.each(appNames, function (appName) { ...
[ "function", "loadAppConfigs", "(", ")", "{", "var", "appConfigs", "=", "{", "}", ";", "var", "appDir", "=", "path", ".", "join", "(", "this", ".", "injector", ".", "rootDir", ",", "'/app'", ")", ";", "if", "(", "!", "fs", ".", "existsSync", "(", "a...
Load all app configs into an object that can be injected @returns {{}}
[ "Load", "all", "app", "configs", "into", "an", "object", "that", "can", "be", "injected" ]
86b89ae2f0ac68f86cd5ff66421677b3aa290857
https://github.com/gethuman/pancakes/blob/86b89ae2f0ac68f86cd5ff66421677b3aa290857/lib/factories/internal.object.factory.js#L117-L133
train
gethuman/pancakes
lib/factories/internal.object.factory.js
create
function create(objectName) { // for resources we need to load them the first time they are referenced if (objectName === 'resources' && this.internalObjects[objectName] === true) { this.internalObjects[objectName] = this.loadResources(); } // for reactors we need to load t...
javascript
function create(objectName) { // for resources we need to load them the first time they are referenced if (objectName === 'resources' && this.internalObjects[objectName] === true) { this.internalObjects[objectName] = this.loadResources(); } // for reactors we need to load t...
[ "function", "create", "(", "objectName", ")", "{", "// for resources we need to load them the first time they are referenced", "if", "(", "objectName", "===", "'resources'", "&&", "this", ".", "internalObjects", "[", "objectName", "]", "===", "true", ")", "{", "this", ...
Very simply use require to get the object @param objectName @returns {{}}
[ "Very", "simply", "use", "require", "to", "get", "the", "object" ]
86b89ae2f0ac68f86cd5ff66421677b3aa290857
https://github.com/gethuman/pancakes/blob/86b89ae2f0ac68f86cd5ff66421677b3aa290857/lib/factories/internal.object.factory.js#L154-L177
train
telefonicaid/logops
lib/formatters.js
formatDevTrace
function formatDevTrace(level, context, message, args, err) { var str, mainMessage = util.format.apply(global, [message].concat(args)), printStack = API.stacktracesWith.indexOf(level) > -1, errCommomMessage = err && (err.name + ': ' + err.message), isErrorLoggingWithoutMessage = mainMessage ==...
javascript
function formatDevTrace(level, context, message, args, err) { var str, mainMessage = util.format.apply(global, [message].concat(args)), printStack = API.stacktracesWith.indexOf(level) > -1, errCommomMessage = err && (err.name + ': ' + err.message), isErrorLoggingWithoutMessage = mainMessage ==...
[ "function", "formatDevTrace", "(", "level", ",", "context", ",", "message", ",", "args", ",", "err", ")", "{", "var", "str", ",", "mainMessage", "=", "util", ".", "format", ".", "apply", "(", "global", ",", "[", "message", "]", ".", "concat", "(", "a...
Formats a trace message with some nice TTY colors @param {String} level One of the following values ['DEBUG', 'INFO', 'WARN', 'ERROR', 'FATAL'] @param {Object} context Additional information to add to the trace @param {String} message The main message to be added to the trace @param {Array} args More arguments provide...
[ "Formats", "a", "trace", "message", "with", "some", "nice", "TTY", "colors" ]
6023d75b3531ed1bb3abe171679234f9519be082
https://github.com/telefonicaid/logops/blob/6023d75b3531ed1bb3abe171679234f9519be082/lib/formatters.js#L68-L107
train