id
int32
0
58k
repo
stringlengths
5
67
path
stringlengths
4
116
func_name
stringlengths
0
58
original_string
stringlengths
52
373k
language
stringclasses
1 value
code
stringlengths
52
373k
code_tokens
list
docstring
stringlengths
4
11.8k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
86
226
31,200
basisjs/basisjs-tools-build
lib/extract/js/index.js
function(token, this_, args){ //fconsole.log('getNamespace', arguments); var namespace = args[0]; if (namespace && namespace.type == 'Literal') { var ns = getNamespace(namespace.value); token.obj = ns.obj; token.ref_ = ns.ref_; if (args[1]) ...
javascript
function(token, this_, args){ //fconsole.log('getNamespace', arguments); var namespace = args[0]; if (namespace && namespace.type == 'Literal') { var ns = getNamespace(namespace.value); token.obj = ns.obj; token.ref_ = ns.ref_; if (args[1]) ...
[ "function", "(", "token", ",", "this_", ",", "args", ")", "{", "//fconsole.log('getNamespace', arguments);", "var", "namespace", "=", "args", "[", "0", "]", ";", "if", "(", "namespace", "&&", "namespace", ".", "type", "==", "'Literal'", ")", "{", "var", "n...
basis.namespace
[ "basis", ".", "namespace" ]
177018ab31b225cddb6a184693fe4746512e7af1
https://github.com/basisjs/basisjs-tools-build/blob/177018ab31b225cddb6a184693fe4746512e7af1/lib/extract/js/index.js#L626-L637
31,201
CartoDB/tangram-cartocss
src/translate.js
getReferenceIndexedByCSS
function getReferenceIndexedByCSS(ref) { var newRef = {}; for (var symb in ref.symbolizers) { for (var property in ref.symbolizers[symb]) { newRef[ref.symbolizers[symb][property].css] = ref.symbolizers[symb][property]; } } return newRef; }
javascript
function getReferenceIndexedByCSS(ref) { var newRef = {}; for (var symb in ref.symbolizers) { for (var property in ref.symbolizers[symb]) { newRef[ref.symbolizers[symb][property].css] = ref.symbolizers[symb][property]; } } return newRef; }
[ "function", "getReferenceIndexedByCSS", "(", "ref", ")", "{", "var", "newRef", "=", "{", "}", ";", "for", "(", "var", "symb", "in", "ref", ".", "symbolizers", ")", "{", "for", "(", "var", "property", "in", "ref", ".", "symbolizers", "[", "symb", "]", ...
getReferenceIndexedByCSS returns a reference based on ref indexed by the CSS property name instead of the reference original property name it does a shallow copy of each property, therefore, it's possible to change the returned reference by changing the original one, don't do it
[ "getReferenceIndexedByCSS", "returns", "a", "reference", "based", "on", "ref", "indexed", "by", "the", "CSS", "property", "name", "instead", "of", "the", "reference", "original", "property", "name", "it", "does", "a", "shallow", "copy", "of", "each", "property",...
df5f15c01d24bb284510dbf7cf464c5c26059e4d
https://github.com/CartoDB/tangram-cartocss/blob/df5f15c01d24bb284510dbf7cf464c5c26059e4d/src/translate.js#L6-L14
31,202
CartoDB/tangram-cartocss
src/translate.js
getOpacityOverride
function getOpacityOverride(sceneDrawGroup, isFill) { var opacity; if (isFill) { opacity = sceneDrawGroup._hidden['opacity:fill']; } else { opacity = sceneDrawGroup._hidden['opacity:outline']; } if (sceneDrawGroup._hidden['opacity:general'] !== undefined) { opacity = sceneDra...
javascript
function getOpacityOverride(sceneDrawGroup, isFill) { var opacity; if (isFill) { opacity = sceneDrawGroup._hidden['opacity:fill']; } else { opacity = sceneDrawGroup._hidden['opacity:outline']; } if (sceneDrawGroup._hidden['opacity:general'] !== undefined) { opacity = sceneDra...
[ "function", "getOpacityOverride", "(", "sceneDrawGroup", ",", "isFill", ")", "{", "var", "opacity", ";", "if", "(", "isFill", ")", "{", "opacity", "=", "sceneDrawGroup", ".", "_hidden", "[", "'opacity:fill'", "]", ";", "}", "else", "{", "opacity", "=", "sc...
Returns the final opacity override selecting between fill-opacity and outline-opacity. Returned value can be a float or a function string to be called at Tangram's runtime if the override is active A falseable value will be returned if the override is not active
[ "Returns", "the", "final", "opacity", "override", "selecting", "between", "fill", "-", "opacity", "and", "outline", "-", "opacity", ".", "Returned", "value", "can", "be", "a", "float", "or", "a", "function", "string", "to", "be", "called", "at", "Tangram", ...
df5f15c01d24bb284510dbf7cf464c5c26059e4d
https://github.com/CartoDB/tangram-cartocss/blob/df5f15c01d24bb284510dbf7cf464c5c26059e4d/src/translate.js#L40-L51
31,203
CartoDB/tangram-cartocss
src/translate.js
getFunctionFromDefaultAndShaderValue
function getFunctionFromDefaultAndShaderValue(sceneDrawGroup, ccssProperty, defaultValue, shaderValue) { if (referenceCSS[ccssProperty].type === 'color') { defaultValue = `'${color.normalize(defaultValue, tangramReference)}'`; } var fn = `var _value=${defaultValue};`; shaderValue.js.forEach(func...
javascript
function getFunctionFromDefaultAndShaderValue(sceneDrawGroup, ccssProperty, defaultValue, shaderValue) { if (referenceCSS[ccssProperty].type === 'color') { defaultValue = `'${color.normalize(defaultValue, tangramReference)}'`; } var fn = `var _value=${defaultValue};`; shaderValue.js.forEach(func...
[ "function", "getFunctionFromDefaultAndShaderValue", "(", "sceneDrawGroup", ",", "ccssProperty", ",", "defaultValue", ",", "shaderValue", ")", "{", "if", "(", "referenceCSS", "[", "ccssProperty", "]", ".", "type", "===", "'color'", ")", "{", "defaultValue", "=", "`...
Returns a function string that sets the value to the default one and then executes the shader value code
[ "Returns", "a", "function", "string", "that", "sets", "the", "value", "to", "the", "default", "one", "and", "then", "executes", "the", "shader", "value", "code" ]
df5f15c01d24bb284510dbf7cf464c5c26059e4d
https://github.com/CartoDB/tangram-cartocss/blob/df5f15c01d24bb284510dbf7cf464c5c26059e4d/src/translate.js#L84-L103
31,204
CartoDB/tangram-cartocss
src/translate.js
translateValue
function translateValue(sceneDrawGroup, ccssProperty, ccssValue) { if (ccssProperty.indexOf('comp-op') >= 0) { switch (ccssValue) { case 'src-over': return 'overlay'; case 'plus': return 'add'; default: return ccssValue; ...
javascript
function translateValue(sceneDrawGroup, ccssProperty, ccssValue) { if (ccssProperty.indexOf('comp-op') >= 0) { switch (ccssValue) { case 'src-over': return 'overlay'; case 'plus': return 'add'; default: return ccssValue; ...
[ "function", "translateValue", "(", "sceneDrawGroup", ",", "ccssProperty", ",", "ccssValue", ")", "{", "if", "(", "ccssProperty", ".", "indexOf", "(", "'comp-op'", ")", ">=", "0", ")", "{", "switch", "(", "ccssValue", ")", "{", "case", "'src-over'", ":", "r...
Translates a ccssValue from the reference standard to the Tangram standard
[ "Translates", "a", "ccssValue", "from", "the", "reference", "standard", "to", "the", "Tangram", "standard" ]
df5f15c01d24bb284510dbf7cf464c5c26059e4d
https://github.com/CartoDB/tangram-cartocss/blob/df5f15c01d24bb284510dbf7cf464c5c26059e4d/src/translate.js#L106-L127
31,205
CartoDB/tangram-cartocss
src/translate.js
getFilterFn
function getFilterFn(layer, symbolizer) { const symbolizers = Object.keys(layer.shader) .filter(property => layer.shader[property].symbolizer === symbolizer); //No need to set a callback when at least one property is not filtered (i.e. it always activates the symbolizer) const alwaysActive = symbol...
javascript
function getFilterFn(layer, symbolizer) { const symbolizers = Object.keys(layer.shader) .filter(property => layer.shader[property].symbolizer === symbolizer); //No need to set a callback when at least one property is not filtered (i.e. it always activates the symbolizer) const alwaysActive = symbol...
[ "function", "getFilterFn", "(", "layer", ",", "symbolizer", ")", "{", "const", "symbolizers", "=", "Object", ".", "keys", "(", "layer", ".", "shader", ")", ".", "filter", "(", "property", "=>", "layer", ".", "shader", "[", "property", "]", ".", "symboliz...
Returns a function string that dynamically filters symbolizer based on conditional properties
[ "Returns", "a", "function", "string", "that", "dynamically", "filters", "symbolizer", "based", "on", "conditional", "properties" ]
df5f15c01d24bb284510dbf7cf464c5c26059e4d
https://github.com/CartoDB/tangram-cartocss/blob/df5f15c01d24bb284510dbf7cf464c5c26059e4d/src/translate.js#L165-L183
31,206
stealjs/steal-conditional
conditional.js
getGlob
function getGlob() { if (isNode) { return loader.import("@node-require", { name: module.id }) .then(function(nodeRequire) { return nodeRequire("glob"); }); } return Promise.resolve(); }
javascript
function getGlob() { if (isNode) { return loader.import("@node-require", { name: module.id }) .then(function(nodeRequire) { return nodeRequire("glob"); }); } return Promise.resolve(); }
[ "function", "getGlob", "(", ")", "{", "if", "(", "isNode", ")", "{", "return", "loader", ".", "import", "(", "\"@node-require\"", ",", "{", "name", ":", "module", ".", "id", "}", ")", ".", "then", "(", "function", "(", "nodeRequire", ")", "{", "retur...
get some node modules through @node-require which is a noop in the browser
[ "get", "some", "node", "modules", "through" ]
04e1c363d5af183aef52c6cb5a75762ca69fc5bf
https://github.com/stealjs/steal-conditional/blob/04e1c363d5af183aef52c6cb5a75762ca69fc5bf/conditional.js#L36-L45
31,207
stealjs/steal-conditional
conditional.js
getModuleName
function getModuleName(nameWithConditional, variation) { var modName; var conditionIndex = nameWithConditional.search(conditionalRegEx); // look for any "/" after the condition var lastSlashIndex = nameWithConditional.indexOf("/", nameWithConditional.indexOf("}")); // substitution of a folder name ...
javascript
function getModuleName(nameWithConditional, variation) { var modName; var conditionIndex = nameWithConditional.search(conditionalRegEx); // look for any "/" after the condition var lastSlashIndex = nameWithConditional.indexOf("/", nameWithConditional.indexOf("}")); // substitution of a folder name ...
[ "function", "getModuleName", "(", "nameWithConditional", ",", "variation", ")", "{", "var", "modName", ";", "var", "conditionIndex", "=", "nameWithConditional", ".", "search", "(", "conditionalRegEx", ")", ";", "// look for any \"/\" after the condition", "var", "lastSl...
Returns the bundle module name for a string substitution @param {string} nameWithConditional The module identifier including the condition @param {string} variation A match of the glob pattern @return {string} The bundle module name
[ "Returns", "the", "bundle", "module", "name", "for", "a", "string", "substitution" ]
04e1c363d5af183aef52c6cb5a75762ca69fc5bf
https://github.com/stealjs/steal-conditional/blob/04e1c363d5af183aef52c6cb5a75762ca69fc5bf/conditional.js#L57-L74
31,208
stealjs/steal-conditional
conditional.js
function(m) { var conditionValue = (typeof m === "object") ? readMemberExpression(conditionExport, m) : m; if (substitution) { if (typeof conditionValue !== "string") { throw new TypeError( "The condition value for " + conditionalMatch[0] + " doesn't resolve to a ...
javascript
function(m) { var conditionValue = (typeof m === "object") ? readMemberExpression(conditionExport, m) : m; if (substitution) { if (typeof conditionValue !== "string") { throw new TypeError( "The condition value for " + conditionalMatch[0] + " doesn't resolve to a ...
[ "function", "(", "m", ")", "{", "var", "conditionValue", "=", "(", "typeof", "m", "===", "\"object\"", ")", "?", "readMemberExpression", "(", "conditionExport", ",", "m", ")", ":", "m", ";", "if", "(", "substitution", ")", "{", "if", "(", "typeof", "co...
!steal-remove-end
[ "!steal", "-", "remove", "-", "end" ]
04e1c363d5af183aef52c6cb5a75762ca69fc5bf
https://github.com/stealjs/steal-conditional/blob/04e1c363d5af183aef52c6cb5a75762ca69fc5bf/conditional.js#L341-L381
31,209
jose-pleonasm/py-logging
core/Handler.js
Handler
function Handler(level) { level = level || Logger.NOTSET; if (Logger.getLevelName(level) === '') { throw new Error('Argument 1 of Handler.constructor has unsupported' + ' value \'' + level + '\''); } Filterer.call(this); /** * @private * @type {number} */ this._level = level; /** * @private * ...
javascript
function Handler(level) { level = level || Logger.NOTSET; if (Logger.getLevelName(level) === '') { throw new Error('Argument 1 of Handler.constructor has unsupported' + ' value \'' + level + '\''); } Filterer.call(this); /** * @private * @type {number} */ this._level = level; /** * @private * ...
[ "function", "Handler", "(", "level", ")", "{", "level", "=", "level", "||", "Logger", ".", "NOTSET", ";", "if", "(", "Logger", ".", "getLevelName", "(", "level", ")", "===", "''", ")", "{", "throw", "new", "Error", "(", "'Argument 1 of Handler.constructor ...
An abstract handler. @constructor Handler @extends Filterer @param {number} [level=NOTSET]
[ "An", "abstract", "handler", "." ]
598f41284311ea6a837d4ba56236301abe689b09
https://github.com/jose-pleonasm/py-logging/blob/598f41284311ea6a837d4ba56236301abe689b09/core/Handler.js#L12-L33
31,210
sasaplus1/ltsv.js
cjs/parser.js
baseParse
function baseParse(text, strict) { const lines = String(text).replace(/(?:\r?\n)+$/, '').split(/\r?\n/); const records = []; for (let i = 0, len = lines.length; i < len; ++i) { records[i] = baseParseLine(lines[i], strict); } return records; }
javascript
function baseParse(text, strict) { const lines = String(text).replace(/(?:\r?\n)+$/, '').split(/\r?\n/); const records = []; for (let i = 0, len = lines.length; i < len; ++i) { records[i] = baseParseLine(lines[i], strict); } return records; }
[ "function", "baseParse", "(", "text", ",", "strict", ")", "{", "const", "lines", "=", "String", "(", "text", ")", ".", "replace", "(", "/", "(?:\\r?\\n)+$", "/", ",", "''", ")", ".", "split", "(", "/", "\\r?\\n", "/", ")", ";", "const", "records", ...
parse LTSV text. @private @param {string} text @param {boolean} strict @returns {Object[]}
[ "parse", "LTSV", "text", "." ]
66eb96de5957905260864912e796f08e49ff222c
https://github.com/sasaplus1/ltsv.js/blob/66eb96de5957905260864912e796f08e49ff222c/cjs/parser.js#L61-L70
31,211
sasaplus1/ltsv.js
cjs/parser.js
baseParseLine
function baseParseLine(line, strict) { const fields = String(line).replace(/(?:\r?\n)+$/, '').split('\t'); const record = {}; for (let i = 0, len = fields.length; i < len; ++i) { const _splitField = splitField(fields[i], strict), label = _splitField.label, value = _splitField.value; ...
javascript
function baseParseLine(line, strict) { const fields = String(line).replace(/(?:\r?\n)+$/, '').split('\t'); const record = {}; for (let i = 0, len = fields.length; i < len; ++i) { const _splitField = splitField(fields[i], strict), label = _splitField.label, value = _splitField.value; ...
[ "function", "baseParseLine", "(", "line", ",", "strict", ")", "{", "const", "fields", "=", "String", "(", "line", ")", ".", "replace", "(", "/", "(?:\\r?\\n)+$", "/", ",", "''", ")", ".", "split", "(", "'\\t'", ")", ";", "const", "record", "=", "{", ...
parse LTSV record. @private @param {string} line @param {boolean} strict @returns {Object}
[ "parse", "LTSV", "record", "." ]
66eb96de5957905260864912e796f08e49ff222c
https://github.com/sasaplus1/ltsv.js/blob/66eb96de5957905260864912e796f08e49ff222c/cjs/parser.js#L81-L94
31,212
darrylwest/simple-node-db
examples/create-new-order.js
function(params) { const order = this; if (!params) { params = {}; } // the standards attributes this.id = params.id; this.dateCreated = params.dateCreated; this.lastUpdated = params.lastUpdated; this.version = params.version; this.customer = params.customer; this.orde...
javascript
function(params) { const order = this; if (!params) { params = {}; } // the standards attributes this.id = params.id; this.dateCreated = params.dateCreated; this.lastUpdated = params.lastUpdated; this.version = params.version; this.customer = params.customer; this.orde...
[ "function", "(", "params", ")", "{", "const", "order", "=", "this", ";", "if", "(", "!", "params", ")", "{", "params", "=", "{", "}", ";", "}", "// the standards attributes", "this", ".", "id", "=", "params", ".", "id", ";", "this", ".", "dateCreated...
define the Order and Order Item objects
[ "define", "the", "Order", "and", "Order", "Item", "objects" ]
a456a653ef062a07bd6c5217c46000ac00ecf408
https://github.com/darrylwest/simple-node-db/blob/a456a653ef062a07bd6c5217c46000ac00ecf408/examples/create-new-order.js#L15-L43
31,213
bootprint/customize
index.js
customOverrider
function customOverrider (a, b, propertyName) { if (b == null) { return a } if (a == null) { // Invoke default overrider return undefined } // Some objects have custom overriders if (b._customize_custom_overrider && b._customize_custom_overrider instanceof Function) { return b._customize_c...
javascript
function customOverrider (a, b, propertyName) { if (b == null) { return a } if (a == null) { // Invoke default overrider return undefined } // Some objects have custom overriders if (b._customize_custom_overrider && b._customize_custom_overrider instanceof Function) { return b._customize_c...
[ "function", "customOverrider", "(", "a", ",", "b", ",", "propertyName", ")", "{", "if", "(", "b", "==", "null", ")", "{", "return", "a", "}", "if", "(", "a", "==", "null", ")", "{", "// Invoke default overrider", "return", "undefined", "}", "// Some obje...
Customize has predefined override rules for merging configs. * If the overriding object has a `_customize_custom_overrider` function-property, it isk called to perform the merger. * Arrays are concatenated * Promises are resolved and the results are merged @param a the overridden value @param b the overriding value ...
[ "Customize", "has", "predefined", "override", "rules", "for", "merging", "configs", "." ]
0ea0c2c7a600cb6f4ea310e7c0a07f02ce8add18
https://github.com/bootprint/customize/blob/0ea0c2c7a600cb6f4ea310e7c0a07f02ce8add18/index.js#L343-L371
31,214
cronvel/kung-fig
lib/kfgCommon.js
MultiLine
function MultiLine( type , fold , applicable , options ) { this.type = type ; this.fold = !! fold ; this.applicable = !! applicable ; this.options = options ; this.lines = [] ; }
javascript
function MultiLine( type , fold , applicable , options ) { this.type = type ; this.fold = !! fold ; this.applicable = !! applicable ; this.options = options ; this.lines = [] ; }
[ "function", "MultiLine", "(", "type", ",", "fold", ",", "applicable", ",", "options", ")", "{", "this", ".", "type", "=", "type", ";", "this", ".", "fold", "=", "!", "!", "fold", ";", "this", ".", "applicable", "=", "!", "!", "applicable", ";", "th...
An object to ease multi-line scalar values
[ "An", "object", "to", "ease", "multi", "-", "line", "scalar", "values" ]
a862c37237a283b4c0a4a5ff0bde6617d77104eb
https://github.com/cronvel/kung-fig/blob/a862c37237a283b4c0a4a5ff0bde6617d77104eb/lib/kfgCommon.js#L47-L53
31,215
cloudkick/whiskey
lib/common.js
function(callback) { self._getConnection(function(err, connection) { if (err) { callback(new Error('Unable to establish connection with the master ' + 'process')); return; } self._connection = connection; callback(); }); }
javascript
function(callback) { self._getConnection(function(err, connection) { if (err) { callback(new Error('Unable to establish connection with the master ' + 'process')); return; } self._connection = connection; callback(); }); }
[ "function", "(", "callback", ")", "{", "self", ".", "_getConnection", "(", "function", "(", "err", ",", "connection", ")", "{", "if", "(", "err", ")", "{", "callback", "(", "new", "Error", "(", "'Unable to establish connection with the master '", "+", "'proces...
Obtain the connection
[ "Obtain", "the", "connection" ]
25739d420526bc78881493b335a5174a0fb56e8f
https://github.com/cloudkick/whiskey/blob/25739d420526bc78881493b335a5174a0fb56e8f/lib/common.js#L333-L344
31,216
cloudkick/whiskey
lib/common.js
function(callback) { var errName; try { if (self._covered) { // If coverage is request, we want the testModule to reference the // code instrumented by istanbul in lib-cov/ instead of any local code in lib/. // This passage looks for variables assigned to by require('li...
javascript
function(callback) { var errName; try { if (self._covered) { // If coverage is request, we want the testModule to reference the // code instrumented by istanbul in lib-cov/ instead of any local code in lib/. // This passage looks for variables assigned to by require('li...
[ "function", "(", "callback", ")", "{", "var", "errName", ";", "try", "{", "if", "(", "self", ".", "_covered", ")", "{", "// If coverage is request, we want the testModule to reference the", "// code instrumented by istanbul in lib-cov/ instead of any local code in lib/.", "// T...
Require the test file
[ "Require", "the", "test", "file" ]
25739d420526bc78881493b335a5174a0fb56e8f
https://github.com/cloudkick/whiskey/blob/25739d420526bc78881493b335a5174a0fb56e8f/lib/common.js#L357-L417
31,217
cloudkick/whiskey
lib/common.js
function(callback) { var queue; if (exportedFunctionsNames.length === 0) { callback(); return; } function taskFunc(task, callback) { var setUpFunc = task.setUpFunc, tearDownFunc = task.tearDownFunc; async.waterfall([ function runSetUp(callback) { ...
javascript
function(callback) { var queue; if (exportedFunctionsNames.length === 0) { callback(); return; } function taskFunc(task, callback) { var setUpFunc = task.setUpFunc, tearDownFunc = task.tearDownFunc; async.waterfall([ function runSetUp(callback) { ...
[ "function", "(", "callback", ")", "{", "var", "queue", ";", "if", "(", "exportedFunctionsNames", ".", "length", "===", "0", ")", "{", "callback", "(", ")", ";", "return", ";", "}", "function", "taskFunc", "(", "task", ",", "callback", ")", "{", "var", ...
Run the tests
[ "Run", "the", "tests" ]
25739d420526bc78881493b335a5174a0fb56e8f
https://github.com/cloudkick/whiskey/blob/25739d420526bc78881493b335a5174a0fb56e8f/lib/common.js#L432-L497
31,218
cloudkick/whiskey
lib/common.js
function (actualArgs, expectedArgs) { var i; if (actualArgs.length !== expectedArgs.length) { return false; } for (i = 0; i < expectedArgs.length; i++) { if (actualArgs[i] !== expectedArgs[i]) { return false; } } return true; }
javascript
function (actualArgs, expectedArgs) { var i; if (actualArgs.length !== expectedArgs.length) { return false; } for (i = 0; i < expectedArgs.length; i++) { if (actualArgs[i] !== expectedArgs[i]) { return false; } } return true; }
[ "function", "(", "actualArgs", ",", "expectedArgs", ")", "{", "var", "i", ";", "if", "(", "actualArgs", ".", "length", "!==", "expectedArgs", ".", "length", ")", "{", "return", "false", ";", "}", "for", "(", "i", "=", "0", ";", "i", "<", "expectedArg...
checks the actual args match the expected args
[ "checks", "the", "actual", "args", "match", "the", "expected", "args" ]
25739d420526bc78881493b335a5174a0fb56e8f
https://github.com/cloudkick/whiskey/blob/25739d420526bc78881493b335a5174a0fb56e8f/lib/common.js#L714-L725
31,219
basisjs/basisjs-tools-build
lib/build/js/makePackages.js
buildDep
function buildDep(file, pkg){ var files = []; if (file.processed || file.package != pkg) return files; file.processed = true; for (var i = 0, depFile; depFile = file.deps[i++];) files.push.apply(files, buildDep(depFile, file.package)); files.push(file); return files; }
javascript
function buildDep(file, pkg){ var files = []; if (file.processed || file.package != pkg) return files; file.processed = true; for (var i = 0, depFile; depFile = file.deps[i++];) files.push.apply(files, buildDep(depFile, file.package)); files.push(file); return files; }
[ "function", "buildDep", "(", "file", ",", "pkg", ")", "{", "var", "files", "=", "[", "]", ";", "if", "(", "file", ".", "processed", "||", "file", ".", "package", "!=", "pkg", ")", "return", "files", ";", "file", ".", "processed", "=", "true", ";", ...
make require file list
[ "make", "require", "file", "list" ]
177018ab31b225cddb6a184693fe4746512e7af1
https://github.com/basisjs/basisjs-tools-build/blob/177018ab31b225cddb6a184693fe4746512e7af1/lib/build/js/makePackages.js#L41-L55
31,220
somesocks/vet
dist/utils/assert.js
assert
function assert (validator, message) { message = messageBuilder(message || 'vet/utils/assert error!'); if (isFunction(validator)) { return function() { var args = arguments; if (validator.apply(this, args)) { return true; } else { throw new Error(message.apply(this, args)); } }; } else if (!...
javascript
function assert (validator, message) { message = messageBuilder(message || 'vet/utils/assert error!'); if (isFunction(validator)) { return function() { var args = arguments; if (validator.apply(this, args)) { return true; } else { throw new Error(message.apply(this, args)); } }; } else if (!...
[ "function", "assert", "(", "validator", ",", "message", ")", "{", "message", "=", "messageBuilder", "(", "message", "||", "'vet/utils/assert error!'", ")", ";", "if", "(", "isFunction", "(", "validator", ")", ")", "{", "return", "function", "(", ")", "{", ...
Wraps a validator, and throws an error if it returns false. This is useful for some code that expects assertion-style validation. @param validator - the validator to wrap @param message - an optional message string to pass into the error @returns a function that returns null if the arguments pass validation, or throws...
[ "Wraps", "a", "validator", "and", "throws", "an", "error", "if", "it", "returns", "false", "." ]
4557abeb6a8b470cb4a5823a2cc802c825ef29ef
https://github.com/somesocks/vet/blob/4557abeb6a8b470cb4a5823a2cc802c825ef29ef/dist/utils/assert.js#L20-L38
31,221
cloudkick/whiskey
lib/coverage.js
coverage
function coverage(data, type) { var comparisionFunc; var n = 0; function isCovered(val) { return (val > 0); } function isMissed(val) { return !isCovered(val); } if (type === 'covered') { comparisionFunc = isCovered; } else if (type === 'missed') { comparisionFunc = isMissed; } e...
javascript
function coverage(data, type) { var comparisionFunc; var n = 0; function isCovered(val) { return (val > 0); } function isMissed(val) { return !isCovered(val); } if (type === 'covered') { comparisionFunc = isCovered; } else if (type === 'missed') { comparisionFunc = isMissed; } e...
[ "function", "coverage", "(", "data", ",", "type", ")", "{", "var", "comparisionFunc", ";", "var", "n", "=", "0", ";", "function", "isCovered", "(", "val", ")", "{", "return", "(", "val", ">", "0", ")", ";", "}", "function", "isMissed", "(", "val", ...
Total coverage for the given file data. @param {Array} data @return {Type}
[ "Total", "coverage", "for", "the", "given", "file", "data", "." ]
25739d420526bc78881493b335a5174a0fb56e8f
https://github.com/cloudkick/whiskey/blob/25739d420526bc78881493b335a5174a0fb56e8f/lib/coverage.js#L90-L121
31,222
cloudkick/whiskey
lib/coverage.js
aggregateCoverage
function aggregateCoverage(files) { var i, len, file, content, results; var resultsObj = getEmptyResultObject(); for (i = 0, len = files.length; i < len; i++) { file = files[i]; content = JSON.parse(fs.readFileSync(file).toString()); resultsObj = populateCoverage(resultsObj, content); } return r...
javascript
function aggregateCoverage(files) { var i, len, file, content, results; var resultsObj = getEmptyResultObject(); for (i = 0, len = files.length; i < len; i++) { file = files[i]; content = JSON.parse(fs.readFileSync(file).toString()); resultsObj = populateCoverage(resultsObj, content); } return r...
[ "function", "aggregateCoverage", "(", "files", ")", "{", "var", "i", ",", "len", ",", "file", ",", "content", ",", "results", ";", "var", "resultsObj", "=", "getEmptyResultObject", "(", ")", ";", "for", "(", "i", "=", "0", ",", "len", "=", "files", "...
Read multiple coverage files and return aggregated coverage.
[ "Read", "multiple", "coverage", "files", "and", "return", "aggregated", "coverage", "." ]
25739d420526bc78881493b335a5174a0fb56e8f
https://github.com/cloudkick/whiskey/blob/25739d420526bc78881493b335a5174a0fb56e8f/lib/coverage.js#L218-L229
31,223
GMOD/bgzf-filehandle
src/unzip.js
pakoUnzip
async function pakoUnzip(inputData) { let strm let pos = 0 let i = 0 const chunks = [] let inflator do { const remainingInput = inputData.slice(pos) inflator = new Inflate() strm = inflator.strm inflator.push(remainingInput, Z_SYNC_FLUSH) if (inflator.err) throw new Error(inflator.msg) ...
javascript
async function pakoUnzip(inputData) { let strm let pos = 0 let i = 0 const chunks = [] let inflator do { const remainingInput = inputData.slice(pos) inflator = new Inflate() strm = inflator.strm inflator.push(remainingInput, Z_SYNC_FLUSH) if (inflator.err) throw new Error(inflator.msg) ...
[ "async", "function", "pakoUnzip", "(", "inputData", ")", "{", "let", "strm", "let", "pos", "=", "0", "let", "i", "=", "0", "const", "chunks", "=", "[", "]", "let", "inflator", "do", "{", "const", "remainingInput", "=", "inputData", ".", "slice", "(", ...
browserify-zlib, which is the zlib shim used by default in webpacked code, does not properly uncompress bgzf chunks that contain more than one bgzf block, so export an unzip function that uses pako directly if we are running in a browser.
[ "browserify", "-", "zlib", "which", "is", "the", "zlib", "shim", "used", "by", "default", "in", "webpacked", "code", "does", "not", "properly", "uncompress", "bgzf", "chunks", "that", "contain", "more", "than", "one", "bgzf", "block", "so", "export", "an", ...
a43ddc0bc00b5610472de6ac5214ae50602be12e
https://github.com/GMOD/bgzf-filehandle/blob/a43ddc0bc00b5610472de6ac5214ae50602be12e/src/unzip.js#L12-L32
31,224
cloudkick/whiskey
lib/process_runner/runner.js
sink
function sink(modulename, level, message, obj) { term.puts(sprintf('[green]%s[/green]: %s', modulename, message)); }
javascript
function sink(modulename, level, message, obj) { term.puts(sprintf('[green]%s[/green]: %s', modulename, message)); }
[ "function", "sink", "(", "modulename", ",", "level", ",", "message", ",", "obj", ")", "{", "term", ".", "puts", "(", "sprintf", "(", "'[green]%s[/green]: %s'", ",", "modulename", ",", "message", ")", ")", ";", "}" ]
Set up logging
[ "Set", "up", "logging" ]
25739d420526bc78881493b335a5174a0fb56e8f
https://github.com/cloudkick/whiskey/blob/25739d420526bc78881493b335a5174a0fb56e8f/lib/process_runner/runner.js#L34-L36
31,225
Ivshti/name-to-imdb
providers/cinemeta.js
indexEntry
function indexEntry(entry) { if (entry.year) entry.year = parseInt(entry.year.toString().split("-")[0]); // first year for series var n = helpers.simplifyName(entry); if (!meta[n]) meta[n] = []; meta[n].push(entry); byImdb[entry.imdb_id] = entry; }
javascript
function indexEntry(entry) { if (entry.year) entry.year = parseInt(entry.year.toString().split("-")[0]); // first year for series var n = helpers.simplifyName(entry); if (!meta[n]) meta[n] = []; meta[n].push(entry); byImdb[entry.imdb_id] = entry; }
[ "function", "indexEntry", "(", "entry", ")", "{", "if", "(", "entry", ".", "year", ")", "entry", ".", "year", "=", "parseInt", "(", "entry", ".", "year", ".", "toString", "(", ")", ".", "split", "(", "\"-\"", ")", "[", "0", "]", ")", ";", "// fir...
Index entry in our in-mem index
[ "Index", "entry", "in", "our", "in", "-", "mem", "index" ]
529bcdf7ac034915991f4d2bac677f01f12cb647
https://github.com/Ivshti/name-to-imdb/blob/529bcdf7ac034915991f4d2bac677f01f12cb647/providers/cinemeta.js#L11-L17
31,226
warehouseai/cdnup
file.js
File
function File(retries, cdn, options) { options = options || {}; this.backoff = new Backoff({ min: 100, max: 20000 }); this.mime = options.mime || {}; this.retries = retries || 5; this.client = cdn.client; this.cdn = cdn; }
javascript
function File(retries, cdn, options) { options = options || {}; this.backoff = new Backoff({ min: 100, max: 20000 }); this.mime = options.mime || {}; this.retries = retries || 5; this.client = cdn.client; this.cdn = cdn; }
[ "function", "File", "(", "retries", ",", "cdn", ",", "options", ")", "{", "options", "=", "options", "||", "{", "}", ";", "this", ".", "backoff", "=", "new", "Backoff", "(", "{", "min", ":", "100", ",", "max", ":", "20000", "}", ")", ";", "this",...
Representation of a single file operation for the CDN. @constructor @param {Number} retries Amount of retries. @param {CDNUp} cdn CDN reference. @param {Object} options Additional configuration. @api private
[ "Representation", "of", "a", "single", "file", "operation", "for", "the", "CDN", "." ]
208e90b8236fdd52d8f90685522ef56047a30fc4
https://github.com/warehouseai/cdnup/blob/208e90b8236fdd52d8f90685522ef56047a30fc4/file.js#L21-L29
31,227
jonschlinkert/map-schema
lib/field.js
Field
function Field(type, config) { if (utils.typeOf(type) === 'object') { config = type; type = null; } if (!utils.isObject(config)) { throw new TypeError('expected config to be an object'); } this.types = type || config.type || config.types || []; this.types = typeof this.types === 'string' ?...
javascript
function Field(type, config) { if (utils.typeOf(type) === 'object') { config = type; type = null; } if (!utils.isObject(config)) { throw new TypeError('expected config to be an object'); } this.types = type || config.type || config.types || []; this.types = typeof this.types === 'string' ?...
[ "function", "Field", "(", "type", ",", "config", ")", "{", "if", "(", "utils", ".", "typeOf", "(", "type", ")", "===", "'object'", ")", "{", "config", "=", "type", ";", "type", "=", "null", ";", "}", "if", "(", "!", "utils", ".", "isObject", "(",...
Create a new `Field` of the given `type` to validate against, and optional `config` object. ```js var field = new Field('string', { normalize: function(val) { // do stuff to `val` return val; } }); ``` @param {String|Array} `type` One more JavaScript native types to use for validation. @param {Object} `config` @api pu...
[ "Create", "a", "new", "Field", "of", "the", "given", "type", "to", "validate", "against", "and", "optional", "config", "object", "." ]
08e11847e83ab91aa7460f6ee2249a64967a5d29
https://github.com/jonschlinkert/map-schema/blob/08e11847e83ab91aa7460f6ee2249a64967a5d29/lib/field.js#L28-L63
31,228
rrharvey/grunt-file-blocks
lib/block.js
function (obj, other) { var notIn = {}; for (var key in obj) { if (other[key] === undefined) { notIn[key] = true; } } return _.keys(notIn); }
javascript
function (obj, other) { var notIn = {}; for (var key in obj) { if (other[key] === undefined) { notIn[key] = true; } } return _.keys(notIn); }
[ "function", "(", "obj", ",", "other", ")", "{", "var", "notIn", "=", "{", "}", ";", "for", "(", "var", "key", "in", "obj", ")", "{", "if", "(", "other", "[", "key", "]", "===", "undefined", ")", "{", "notIn", "[", "key", "]", "=", "true", ";"...
Find keys that exist in the specified object that don't exist in the other object.
[ "Find", "keys", "that", "exist", "in", "the", "specified", "object", "that", "don", "t", "exist", "in", "the", "other", "object", "." ]
c1e3bfcb33df76ca820de580da3864085bfaed44
https://github.com/rrharvey/grunt-file-blocks/blob/c1e3bfcb33df76ca820de580da3864085bfaed44/lib/block.js#L8-L16
31,229
somesocks/vet
dist/numbers/isBetween.js
isBetween
function isBetween(lower, upper) { return function (val) { return isNumber(val) && val > lower && val < upper; } }
javascript
function isBetween(lower, upper) { return function (val) { return isNumber(val) && val > lower && val < upper; } }
[ "function", "isBetween", "(", "lower", ",", "upper", ")", "{", "return", "function", "(", "val", ")", "{", "return", "isNumber", "(", "val", ")", "&&", "val", ">", "lower", "&&", "val", "<", "upper", ";", "}", "}" ]
Checks to see if a value is a negative number @param {number} lower - the lower boundary value to check against @param {number} upper - the upper boundary value to check against @returns {function} - a validator function @memberof vet.numbers
[ "Checks", "to", "see", "if", "a", "value", "is", "a", "negative", "number" ]
4557abeb6a8b470cb4a5823a2cc802c825ef29ef
https://github.com/somesocks/vet/blob/4557abeb6a8b470cb4a5823a2cc802c825ef29ef/dist/numbers/isBetween.js#L11-L15
31,230
taskcluster/dockerode-process
docker_process.js
DockerProc
function DockerProc(docker, config) { EventEmitter.call(this); this.docker = docker; this._createConfig = config.create; this._startConfig = config.start; this.stdout = new streams.PassThrough(); this.stderr = new streams.PassThrough(); }
javascript
function DockerProc(docker, config) { EventEmitter.call(this); this.docker = docker; this._createConfig = config.create; this._startConfig = config.start; this.stdout = new streams.PassThrough(); this.stderr = new streams.PassThrough(); }
[ "function", "DockerProc", "(", "docker", ",", "config", ")", "{", "EventEmitter", ".", "call", "(", "this", ")", ";", "this", ".", "docker", "=", "docker", ";", "this", ".", "_createConfig", "=", "config", ".", "create", ";", "this", ".", "_startConfig",...
Loosely modeled on node's own child_process object thought the interface to get the child process is different.
[ "Loosely", "modeled", "on", "node", "s", "own", "child_process", "object", "thought", "the", "interface", "to", "get", "the", "child", "process", "is", "different", "." ]
f0ac2d8215f7c3ac513425a92a8f1d9edacc4f4e
https://github.com/taskcluster/dockerode-process/blob/f0ac2d8215f7c3ac513425a92a8f1d9edacc4f4e/docker_process.js#L27-L36
31,231
taskcluster/dockerode-process
docker_process.js
function(options) { options = options || {}; if (!('pull' in options)) options.pull = true; // no pull means no extra stream processing... if (!options.pull) return this._run(); return new Promise(function(accept, reject) { // pull the image (or use on in the cache and output status in stdou...
javascript
function(options) { options = options || {}; if (!('pull' in options)) options.pull = true; // no pull means no extra stream processing... if (!options.pull) return this._run(); return new Promise(function(accept, reject) { // pull the image (or use on in the cache and output status in stdou...
[ "function", "(", "options", ")", "{", "options", "=", "options", "||", "{", "}", ";", "if", "(", "!", "(", "'pull'", "in", "options", ")", ")", "options", ".", "pull", "=", "true", ";", "// no pull means no extra stream processing...", "if", "(", "!", "o...
Run the docker process and resolve the promise on complete. @param {Object} options for running the container. @param {Boolean} [options.pull=true] when true pull the image and prepend the download details to stdout.
[ "Run", "the", "docker", "process", "and", "resolve", "the", "promise", "on", "complete", "." ]
f0ac2d8215f7c3ac513425a92a8f1d9edacc4f4e
https://github.com/taskcluster/dockerode-process/blob/f0ac2d8215f7c3ac513425a92a8f1d9edacc4f4e/docker_process.js#L130-L151
31,232
taskcluster/dockerode-process
docker_process.js
function() { var that = this; this.killed = true; if (this.started) { this.container.kill(); } else { this.once('container start', function() { that.container.kill(); }); } }
javascript
function() { var that = this; this.killed = true; if (this.started) { this.container.kill(); } else { this.once('container start', function() { that.container.kill(); }); } }
[ "function", "(", ")", "{", "var", "that", "=", "this", ";", "this", ".", "killed", "=", "true", ";", "if", "(", "this", ".", "started", ")", "{", "this", ".", "container", ".", "kill", "(", ")", ";", "}", "else", "{", "this", ".", "once", "(", ...
Kill docker container
[ "Kill", "docker", "container" ]
f0ac2d8215f7c3ac513425a92a8f1d9edacc4f4e
https://github.com/taskcluster/dockerode-process/blob/f0ac2d8215f7c3ac513425a92a8f1d9edacc4f4e/docker_process.js#L154-L164
31,233
somesocks/vet
dist/utils/returns.js
returns
function returns(func, validator, message) { message = messageBuilder(message || 'vet/utils/returns error!'); return function _returnsInstance() { var args = arguments; var result = func.apply(this, arguments); if (validator(result)) { return result; } else { throw new Error(message.call(this, result)...
javascript
function returns(func, validator, message) { message = messageBuilder(message || 'vet/utils/returns error!'); return function _returnsInstance() { var args = arguments; var result = func.apply(this, arguments); if (validator(result)) { return result; } else { throw new Error(message.call(this, result)...
[ "function", "returns", "(", "func", ",", "validator", ",", "message", ")", "{", "message", "=", "messageBuilder", "(", "message", "||", "'vet/utils/returns error!'", ")", ";", "return", "function", "_returnsInstance", "(", ")", "{", "var", "args", "=", "argume...
Wraps a function in a validator which checks its return value, and throws an error if the return value is bad. @param func - the function to wrap @param validator - the validator function. This gets passed the return value @param message - an optional message string to pass into the error thrown @returns a wrapped fu...
[ "Wraps", "a", "function", "in", "a", "validator", "which", "checks", "its", "return", "value", "and", "throws", "an", "error", "if", "the", "return", "value", "is", "bad", "." ]
4557abeb6a8b470cb4a5823a2cc802c825ef29ef
https://github.com/somesocks/vet/blob/4557abeb6a8b470cb4a5823a2cc802c825ef29ef/dist/utils/returns.js#L18-L31
31,234
feedhenry/fh-amqp-js
lib/amqpjs.js
setupConn
function setupConn(connectCfg, options) { var conn = amqp.createConnection(connectCfg, options); conn.on('ready', function() { debug('received ready event from node-amqp'); var eventName = 'connection'; //Ready event will be emitted when re-connected. //To keep backward compatible, only ...
javascript
function setupConn(connectCfg, options) { var conn = amqp.createConnection(connectCfg, options); conn.on('ready', function() { debug('received ready event from node-amqp'); var eventName = 'connection'; //Ready event will be emitted when re-connected. //To keep backward compatible, only ...
[ "function", "setupConn", "(", "connectCfg", ",", "options", ")", "{", "var", "conn", "=", "amqp", ".", "createConnection", "(", "connectCfg", ",", "options", ")", ";", "conn", ".", "on", "(", "'ready'", ",", "function", "(", ")", "{", "debug", "(", "'r...
Private functions Setup the connection @param {Object} connectCfg AMQP connection configurations. @param {Object} options AMQP connection options. See https://github.com/postwait/node-amqp#connection-options-and-url for the format of the connectCfg and options
[ "Private", "functions", "Setup", "the", "connection" ]
611adf62f661e4d42066f1c4d5a39dd8692ec720
https://github.com/feedhenry/fh-amqp-js/blob/611adf62f661e4d42066f1c4d5a39dd8692ec720/lib/amqpjs.js#L323-L364
31,235
feedhenry/fh-amqp-js
lib/amqpjs.js
autoSubscribe
function autoSubscribe() { //re-add pending subscribers if (_pendingSubscribers.length > 0) { async.each(_pendingSubscribers, function(sub, callback) { debug('Add pending subscriber', sub); self.subscribeToTopic(sub.exchange, sub.queue, sub.filter, sub.subscriber, sub.opts, function(err) {...
javascript
function autoSubscribe() { //re-add pending subscribers if (_pendingSubscribers.length > 0) { async.each(_pendingSubscribers, function(sub, callback) { debug('Add pending subscriber', sub); self.subscribeToTopic(sub.exchange, sub.queue, sub.filter, sub.subscriber, sub.opts, function(err) {...
[ "function", "autoSubscribe", "(", ")", "{", "//re-add pending subscribers", "if", "(", "_pendingSubscribers", ".", "length", ">", "0", ")", "{", "async", ".", "each", "(", "_pendingSubscribers", ",", "function", "(", "sub", ",", "callback", ")", "{", "debug", ...
Re-add subscriber functions that are created when there is no connection
[ "Re", "-", "add", "subscriber", "functions", "that", "are", "created", "when", "there", "is", "no", "connection" ]
611adf62f661e4d42066f1c4d5a39dd8692ec720
https://github.com/feedhenry/fh-amqp-js/blob/611adf62f661e4d42066f1c4d5a39dd8692ec720/lib/amqpjs.js#L369-L389
31,236
feedhenry/fh-amqp-js
lib/amqpjs.js
publishCachedMessages
function publishCachedMessages() { if (_cachedPublishMessages.length > 0) { async.each(_cachedPublishMessages, function(message, callback) { debug('republish message', message); self.publishTopic(message.exchange, message.topic, message.message, message.options, function(err) { if (e...
javascript
function publishCachedMessages() { if (_cachedPublishMessages.length > 0) { async.each(_cachedPublishMessages, function(message, callback) { debug('republish message', message); self.publishTopic(message.exchange, message.topic, message.message, message.options, function(err) { if (e...
[ "function", "publishCachedMessages", "(", ")", "{", "if", "(", "_cachedPublishMessages", ".", "length", ">", "0", ")", "{", "async", ".", "each", "(", "_cachedPublishMessages", ",", "function", "(", "message", ",", "callback", ")", "{", "debug", "(", "'repub...
Re-publish messages that received when there is no connection
[ "Re", "-", "publish", "messages", "that", "received", "when", "there", "is", "no", "connection" ]
611adf62f661e4d42066f1c4d5a39dd8692ec720
https://github.com/feedhenry/fh-amqp-js/blob/611adf62f661e4d42066f1c4d5a39dd8692ec720/lib/amqpjs.js#L394-L412
31,237
cloudkick/whiskey
lib/extern/optparse/lib/optparse.js
filter_email
function filter_email(value) { var m = EMAIL_RE.exec(value); if(m == null) throw OptError('Excpeted an email address.'); return m[1]; }
javascript
function filter_email(value) { var m = EMAIL_RE.exec(value); if(m == null) throw OptError('Excpeted an email address.'); return m[1]; }
[ "function", "filter_email", "(", "value", ")", "{", "var", "m", "=", "EMAIL_RE", ".", "exec", "(", "value", ")", ";", "if", "(", "m", "==", "null", ")", "throw", "OptError", "(", "'Excpeted an email address.'", ")", ";", "return", "m", "[", "1", "]", ...
Switch argument filter that expects an email address. An exception is throwed if the criteria doesn`t match.
[ "Switch", "argument", "filter", "that", "expects", "an", "email", "address", ".", "An", "exception", "is", "throwed", "if", "the", "criteria", "doesn", "t", "match", "." ]
25739d420526bc78881493b335a5174a0fb56e8f
https://github.com/cloudkick/whiskey/blob/25739d420526bc78881493b335a5174a0fb56e8f/lib/extern/optparse/lib/optparse.js#L56-L60
31,238
cloudkick/whiskey
lib/extern/optparse/lib/optparse.js
build_rules
function build_rules(filters, arr) { var rules = []; for(var i=0; i<arr.length; i++) { var r = arr[i], rule if(!contains_expr(r)) throw OptError('Rule MUST contain an option.'); switch(r.length) { case 1: rule = build_rule(filters, r[0]); break...
javascript
function build_rules(filters, arr) { var rules = []; for(var i=0; i<arr.length; i++) { var r = arr[i], rule if(!contains_expr(r)) throw OptError('Rule MUST contain an option.'); switch(r.length) { case 1: rule = build_rule(filters, r[0]); break...
[ "function", "build_rules", "(", "filters", ",", "arr", ")", "{", "var", "rules", "=", "[", "]", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "arr", ".", "length", ";", "i", "++", ")", "{", "var", "r", "=", "arr", "[", "i", "]", ","...
Buildes rules from a switches collection. The switches collection is defined when constructing a new OptionParser object.
[ "Buildes", "rules", "from", "a", "switches", "collection", ".", "The", "switches", "collection", "is", "defined", "when", "constructing", "a", "new", "OptionParser", "object", "." ]
25739d420526bc78881493b335a5174a0fb56e8f
https://github.com/cloudkick/whiskey/blob/25739d420526bc78881493b335a5174a0fb56e8f/lib/extern/optparse/lib/optparse.js#L73-L98
31,239
cloudkick/whiskey
lib/extern/optparse/lib/optparse.js
extend
function extend(dest, src) { var result = dest; for(var n in src) { result[n] = src[n]; } return result; }
javascript
function extend(dest, src) { var result = dest; for(var n in src) { result[n] = src[n]; } return result; }
[ "function", "extend", "(", "dest", ",", "src", ")", "{", "var", "result", "=", "dest", ";", "for", "(", "var", "n", "in", "src", ")", "{", "result", "[", "n", "]", "=", "src", "[", "n", "]", ";", "}", "return", "result", ";", "}" ]
Extends destination object with members of source object
[ "Extends", "destination", "object", "with", "members", "of", "source", "object" ]
25739d420526bc78881493b335a5174a0fb56e8f
https://github.com/cloudkick/whiskey/blob/25739d420526bc78881493b335a5174a0fb56e8f/lib/extern/optparse/lib/optparse.js#L149-L155
31,240
cloudkick/whiskey
lib/extern/optparse/lib/optparse.js
spaces
function spaces(arg1, arg2) { var l, builder = []; if(arg1.constructor === Number) { l = arg1; } else { if(arg1.length == arg2) return arg1; l = arg2 - arg1.length; builder.push(arg1); } while(l-- > 0) builder.push(' '); return builder.join(''); }
javascript
function spaces(arg1, arg2) { var l, builder = []; if(arg1.constructor === Number) { l = arg1; } else { if(arg1.length == arg2) return arg1; l = arg2 - arg1.length; builder.push(arg1); } while(l-- > 0) builder.push(' '); return builder.join(''); }
[ "function", "spaces", "(", "arg1", ",", "arg2", ")", "{", "var", "l", ",", "builder", "=", "[", "]", ";", "if", "(", "arg1", ".", "constructor", "===", "Number", ")", "{", "l", "=", "arg1", ";", "}", "else", "{", "if", "(", "arg1", ".", "length...
Appends spaces to match specified number of chars
[ "Appends", "spaces", "to", "match", "specified", "number", "of", "chars" ]
25739d420526bc78881493b335a5174a0fb56e8f
https://github.com/cloudkick/whiskey/blob/25739d420526bc78881493b335a5174a0fb56e8f/lib/extern/optparse/lib/optparse.js#L158-L169
31,241
cloudkick/whiskey
lib/extern/optparse/lib/optparse.js
function(value, fn) { if(value.constructor === Function ) { this.default_handler = value; } else if(value.constructor === Number) { this.on_args[value] = fn; } else { this.on_switches[value] = fn; } }
javascript
function(value, fn) { if(value.constructor === Function ) { this.default_handler = value; } else if(value.constructor === Number) { this.on_args[value] = fn; } else { this.on_switches[value] = fn; } }
[ "function", "(", "value", ",", "fn", ")", "{", "if", "(", "value", ".", "constructor", "===", "Function", ")", "{", "this", ".", "default_handler", "=", "value", ";", "}", "else", "if", "(", "value", ".", "constructor", "===", "Number", ")", "{", "th...
Adds args and switchs handler.
[ "Adds", "args", "and", "switchs", "handler", "." ]
25739d420526bc78881493b335a5174a0fb56e8f
https://github.com/cloudkick/whiskey/blob/25739d420526bc78881493b335a5174a0fb56e8f/lib/extern/optparse/lib/optparse.js#L203-L211
31,242
cloudkick/whiskey
lib/extern/optparse/lib/optparse.js
function(args) { var result = [], callback; var rules = build_rules(this.filters, this._rules); var tokens = args.concat([]); var token; while(this._halt == false && (token = tokens.shift())) { if(LONG_SWITCH_RE.test(token) || SHORT_SWITCH_RE.test(token)) { ...
javascript
function(args) { var result = [], callback; var rules = build_rules(this.filters, this._rules); var tokens = args.concat([]); var token; while(this._halt == false && (token = tokens.shift())) { if(LONG_SWITCH_RE.test(token) || SHORT_SWITCH_RE.test(token)) { ...
[ "function", "(", "args", ")", "{", "var", "result", "=", "[", "]", ",", "callback", ";", "var", "rules", "=", "build_rules", "(", "this", ".", "filters", ",", "this", ".", "_rules", ")", ";", "var", "tokens", "=", "args", ".", "concat", "(", "[", ...
Parses specified args. Returns remaining arguments.
[ "Parses", "specified", "args", ".", "Returns", "remaining", "arguments", "." ]
25739d420526bc78881493b335a5174a0fb56e8f
https://github.com/cloudkick/whiskey/blob/25739d420526bc78881493b335a5174a0fb56e8f/lib/extern/optparse/lib/optparse.js#L222-L266
31,243
cloudkick/whiskey
lib/extern/optparse/lib/optparse.js
function() { var builder = [this.banner, '', this.options_title], shorts = false, longest = 0, rule; var rules = build_rules(this.filters, this._rules); for(var i = 0; i < rules.length; i++) { rule = rules[i]; // Quick-analyze the options. if(rule....
javascript
function() { var builder = [this.banner, '', this.options_title], shorts = false, longest = 0, rule; var rules = build_rules(this.filters, this._rules); for(var i = 0; i < rules.length; i++) { rule = rules[i]; // Quick-analyze the options. if(rule....
[ "function", "(", ")", "{", "var", "builder", "=", "[", "this", ".", "banner", ",", "''", ",", "this", ".", "options_title", "]", ",", "shorts", "=", "false", ",", "longest", "=", "0", ",", "rule", ";", "var", "rules", "=", "build_rules", "(", "this...
Returns a string representation of this OptionParser instance.
[ "Returns", "a", "string", "representation", "of", "this", "OptionParser", "instance", "." ]
25739d420526bc78881493b335a5174a0fb56e8f
https://github.com/cloudkick/whiskey/blob/25739d420526bc78881493b335a5174a0fb56e8f/lib/extern/optparse/lib/optparse.js#L282-L303
31,244
somesocks/vet
dist/strings/matches.js
matches
function matches(regex) { return function(val) { regex.lastIndex = 0; return isString(val) && regex.test(val); }; }
javascript
function matches(regex) { return function(val) { regex.lastIndex = 0; return isString(val) && regex.test(val); }; }
[ "function", "matches", "(", "regex", ")", "{", "return", "function", "(", "val", ")", "{", "regex", ".", "lastIndex", "=", "0", ";", "return", "isString", "(", "val", ")", "&&", "regex", ".", "test", "(", "val", ")", ";", "}", ";", "}" ]
Builds a function that checks to see if a value matches a regular expression @param regex - the regular expression to check against @returns a function that takes in a value val, and returns true if it is a string that matches regex @memberof vet.strings
[ "Builds", "a", "function", "that", "checks", "to", "see", "if", "a", "value", "matches", "a", "regular", "expression" ]
4557abeb6a8b470cb4a5823a2cc802c825ef29ef
https://github.com/somesocks/vet/blob/4557abeb6a8b470cb4a5823a2cc802c825ef29ef/dist/strings/matches.js#L10-L15
31,245
cheminfo-js/netcdf-gcms
src/index.js
netcdfGcms
function netcdfGcms(data, options = {}) { let reader = new NetCDFReader(data); const globalAttributes = reader.globalAttributes; let instrument_mfr = reader.getDataVariableAsString('instrument_mfr'); let dataset_origin = reader.attributeExists('dataset_origin'); let mass_values = reader.dataVariableExists('m...
javascript
function netcdfGcms(data, options = {}) { let reader = new NetCDFReader(data); const globalAttributes = reader.globalAttributes; let instrument_mfr = reader.getDataVariableAsString('instrument_mfr'); let dataset_origin = reader.attributeExists('dataset_origin'); let mass_values = reader.dataVariableExists('m...
[ "function", "netcdfGcms", "(", "data", ",", "options", "=", "{", "}", ")", "{", "let", "reader", "=", "new", "NetCDFReader", "(", "data", ")", ";", "const", "globalAttributes", "=", "reader", ".", "globalAttributes", ";", "let", "instrument_mfr", "=", "rea...
Reads a NetCDF file and returns a formatted JSON with the data from it @param {ArrayBuffer} data - ArrayBuffer or any Typed Array (including Node.js' Buffer from v4) with the data @param {object} [options={}] @param {boolean} [options.meta] - add meta information @param {boolean} [options.variables] -add variables info...
[ "Reads", "a", "NetCDF", "file", "and", "returns", "a", "formatted", "JSON", "with", "the", "data", "from", "it" ]
f2d2207d1af02528b5fb4c392122a8461cb5d7f1
https://github.com/cheminfo-js/netcdf-gcms/blob/f2d2207d1af02528b5fb4c392122a8461cb5d7f1/src/index.js#L20-L67
31,246
yodaiken/dolphinsr
dist/bundle.js
getCardId
function getCardId(o) { return o.master + '#' + o.combination.front.join(',') + '@' + o.combination.back.join(','); }
javascript
function getCardId(o) { return o.master + '#' + o.combination.front.join(',') + '@' + o.combination.back.join(','); }
[ "function", "getCardId", "(", "o", ")", "{", "return", "o", ".", "master", "+", "'#'", "+", "o", ".", "combination", ".", "front", ".", "join", "(", "','", ")", "+", "'@'", "+", "o", ".", "combination", ".", "back", ".", "join", "(", "','", ")", ...
numbers are indexes on master.fields
[ "numbers", "are", "indexes", "on", "master", ".", "fields" ]
5a833fdb1d9d6b87ed48a9599ebb1ee17cc67ca8
https://github.com/yodaiken/dolphinsr/blob/5a833fdb1d9d6b87ed48a9599ebb1ee17cc67ca8/dist/bundle.js#L19-L21
31,247
yodaiken/dolphinsr
dist/bundle.js
addReview
function addReview(reviews, review) { if (!reviews.length) { return [review]; } var i = reviews.length - 1; for (; i >= 0; i -= 1) { if (reviews[i].ts <= review.ts) { break; } } var newReviews = reviews.slice(0); newReviews.splice(i + 1, 0, review); return newReviews; }
javascript
function addReview(reviews, review) { if (!reviews.length) { return [review]; } var i = reviews.length - 1; for (; i >= 0; i -= 1) { if (reviews[i].ts <= review.ts) { break; } } var newReviews = reviews.slice(0); newReviews.splice(i + 1, 0, review); return newReviews; }
[ "function", "addReview", "(", "reviews", ",", "review", ")", "{", "if", "(", "!", "reviews", ".", "length", ")", "{", "return", "[", "review", "]", ";", "}", "var", "i", "=", "reviews", ".", "length", "-", "1", ";", "for", "(", ";", "i", ">=", ...
This function only works if reviews is always sorted by timestamp
[ "This", "function", "only", "works", "if", "reviews", "is", "always", "sorted", "by", "timestamp" ]
5a833fdb1d9d6b87ed48a9599ebb1ee17cc67ca8
https://github.com/yodaiken/dolphinsr/blob/5a833fdb1d9d6b87ed48a9599ebb1ee17cc67ca8/dist/bundle.js#L43-L59
31,248
appcelerator/appc-logger
lib/logger.js
searchForArrowCloudLogDir
function searchForArrowCloudLogDir() { if (isWritable('/ctlog')) { return '/ctlog'; } if (process.env.HOME && isWritable(path.join(process.env.HOME, 'ctlog'))) { return path.join(process.env.HOME, 'ctlog'); } if (process.env.USERPROFILE && isWritable(path.join(process.env.USERPROFILE, 'ctlog'))) { return pat...
javascript
function searchForArrowCloudLogDir() { if (isWritable('/ctlog')) { return '/ctlog'; } if (process.env.HOME && isWritable(path.join(process.env.HOME, 'ctlog'))) { return path.join(process.env.HOME, 'ctlog'); } if (process.env.USERPROFILE && isWritable(path.join(process.env.USERPROFILE, 'ctlog'))) { return pat...
[ "function", "searchForArrowCloudLogDir", "(", ")", "{", "if", "(", "isWritable", "(", "'/ctlog'", ")", ")", "{", "return", "'/ctlog'", ";", "}", "if", "(", "process", ".", "env", ".", "HOME", "&&", "isWritable", "(", "path", ".", "join", "(", "process", ...
istanbul ignore next Looks through the filesystem for a writable spot to which we can write the logs. @returns {string}
[ "istanbul", "ignore", "next", "Looks", "through", "the", "filesystem", "for", "a", "writable", "spot", "to", "which", "we", "can", "write", "the", "logs", "." ]
7ded47e93f7c59de4dbd83e61cff5be890ae17fa
https://github.com/appcelerator/appc-logger/blob/7ded47e93f7c59de4dbd83e61cff5be890ae17fa/lib/logger.js#L17-L31
31,249
appcelerator/appc-logger
lib/logger.js
isWritable
function isWritable(dir) { debug('checking if ' + dir + ' is writable'); try { if (!fs.existsSync(dir)) { debug(' - it does not exist yet, attempting to create it'); fs.mkdirSync(dir); } if (fs.accessSync) { fs.accessSync(dir, fs.W_OK); } else { debug(' - fs.accessSync is not available, falling ba...
javascript
function isWritable(dir) { debug('checking if ' + dir + ' is writable'); try { if (!fs.existsSync(dir)) { debug(' - it does not exist yet, attempting to create it'); fs.mkdirSync(dir); } if (fs.accessSync) { fs.accessSync(dir, fs.W_OK); } else { debug(' - fs.accessSync is not available, falling ba...
[ "function", "isWritable", "(", "dir", ")", "{", "debug", "(", "'checking if '", "+", "dir", "+", "' is writable'", ")", ";", "try", "{", "if", "(", "!", "fs", ".", "existsSync", "(", "dir", ")", ")", "{", "debug", "(", "' - it does not exist yet, attemptin...
istanbul ignore next Checks if a directory is writable, returning a boolean or throwing an exception, depending on the arguments. @param {string} dir The directory to check. @returns {boolean} Whether or not the directory is writable.
[ "istanbul", "ignore", "next", "Checks", "if", "a", "directory", "is", "writable", "returning", "a", "boolean", "or", "throwing", "an", "exception", "depending", "on", "the", "arguments", "." ]
7ded47e93f7c59de4dbd83e61cff5be890ae17fa
https://github.com/appcelerator/appc-logger/blob/7ded47e93f7c59de4dbd83e61cff5be890ae17fa/lib/logger.js#L39-L60
31,250
appcelerator/appc-logger
lib/logger.js
getPort
function getPort(req) { if (req.connection && req.connection.localPort) { return req.connection.localPort.toString(); } const host = req.headers && req.headers.host; let protocolSrc = 80; if (host && ((host.match(/:/g) || []).length) === 1) { const possiblePort = host.split(':')[1]; protocolSrc = isN...
javascript
function getPort(req) { if (req.connection && req.connection.localPort) { return req.connection.localPort.toString(); } const host = req.headers && req.headers.host; let protocolSrc = 80; if (host && ((host.match(/:/g) || []).length) === 1) { const possiblePort = host.split(':')[1]; protocolSrc = isN...
[ "function", "getPort", "(", "req", ")", "{", "if", "(", "req", ".", "connection", "&&", "req", ".", "connection", ".", "localPort", ")", "{", "return", "req", ".", "connection", ".", "localPort", ".", "toString", "(", ")", ";", "}", "const", "host", ...
derive the port if its in the host string. @param {Object} req a express req object @return {string} string representation of port
[ "derive", "the", "port", "if", "its", "in", "the", "host", "string", "." ]
7ded47e93f7c59de4dbd83e61cff5be890ae17fa
https://github.com/appcelerator/appc-logger/blob/7ded47e93f7c59de4dbd83e61cff5be890ae17fa/lib/logger.js#L217-L228
31,251
appcelerator/appc-logger
lib/logger.js
getStatus
function getStatus (res) { let status; const statusCode = res.statusCode; if (statusCode) { status = Math.floor(statusCode / 100) * 100; } switch (status) { case 100: case 200: case 300: return 'success'; default: return 'failure'; } }
javascript
function getStatus (res) { let status; const statusCode = res.statusCode; if (statusCode) { status = Math.floor(statusCode / 100) * 100; } switch (status) { case 100: case 200: case 300: return 'success'; default: return 'failure'; } }
[ "function", "getStatus", "(", "res", ")", "{", "let", "status", ";", "const", "statusCode", "=", "res", ".", "statusCode", ";", "if", "(", "statusCode", ")", "{", "status", "=", "Math", ".", "floor", "(", "statusCode", "/", "100", ")", "*", "100", ";...
derive the status string from the status code @param {Object} res express res object @return {string} success or error string
[ "derive", "the", "status", "string", "from", "the", "status", "code" ]
7ded47e93f7c59de4dbd83e61cff5be890ae17fa
https://github.com/appcelerator/appc-logger/blob/7ded47e93f7c59de4dbd83e61cff5be890ae17fa/lib/logger.js#L234-L248
31,252
appcelerator/appc-logger
lib/logger.js
isWhitelisted
function isWhitelisted(url) { return options.adiPathFilter.some(function (route) { return url.substr(0, route.length) === route; }); }
javascript
function isWhitelisted(url) { return options.adiPathFilter.some(function (route) { return url.substr(0, route.length) === route; }); }
[ "function", "isWhitelisted", "(", "url", ")", "{", "return", "options", ".", "adiPathFilter", ".", "some", "(", "function", "(", "route", ")", "{", "return", "url", ".", "substr", "(", "0", ",", "route", ".", "length", ")", "===", "route", ";", "}", ...
Determine whether a certain URL is whitelisted based off the prefix @param {string} url URL to check @return {boolean} Is the URL in the whitelist
[ "Determine", "whether", "a", "certain", "URL", "is", "whitelisted", "based", "off", "the", "prefix" ]
7ded47e93f7c59de4dbd83e61cff5be890ae17fa
https://github.com/appcelerator/appc-logger/blob/7ded47e93f7c59de4dbd83e61cff5be890ae17fa/lib/logger.js#L263-L267
31,253
appcelerator/appc-logger
lib/logger.js
createDefaultLogger
function createDefaultLogger(options) { const ConsoleLogger = require('./console'), consoleLogger = new ConsoleLogger(options), config = _.mergeWith({ name: 'logger', streams: [ { level: options && options.level || 'trace', type: 'raw', stream: consoleLogger } ] }, options, functi...
javascript
function createDefaultLogger(options) { const ConsoleLogger = require('./console'), consoleLogger = new ConsoleLogger(options), config = _.mergeWith({ name: 'logger', streams: [ { level: options && options.level || 'trace', type: 'raw', stream: consoleLogger } ] }, options, functi...
[ "function", "createDefaultLogger", "(", "options", ")", "{", "const", "ConsoleLogger", "=", "require", "(", "'./console'", ")", ",", "consoleLogger", "=", "new", "ConsoleLogger", "(", "options", ")", ",", "config", "=", "_", ".", "mergeWith", "(", "{", "name...
Create a default logger @param {Object} options - options @returns {Object}
[ "Create", "a", "default", "logger" ]
7ded47e93f7c59de4dbd83e61cff5be890ae17fa
https://github.com/appcelerator/appc-logger/blob/7ded47e93f7c59de4dbd83e61cff5be890ae17fa/lib/logger.js#L447-L491
31,254
Metatavu/kunta-api-spec
javascript-generated/src/api/CodesApi.js
function(apiClient) { this.apiClient = apiClient || ApiClient.instance; /** * Finds a code * Finds a code * @param {String} codeId Id of the code * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/Code} */ this.findCode = funct...
javascript
function(apiClient) { this.apiClient = apiClient || ApiClient.instance; /** * Finds a code * Finds a code * @param {String} codeId Id of the code * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/Code} */ this.findCode = funct...
[ "function", "(", "apiClient", ")", "{", "this", ".", "apiClient", "=", "apiClient", "||", "ApiClient", ".", "instance", ";", "/**\n * Finds a code\n * Finds a code\n * @param {String} codeId Id of the code\n * @return {Promise} a {@link https://www.promisejs.org/|Promis...
Codes service. @module api/CodesApi @version 0.0.139 Constructs a new CodesApi. @alias module:api/CodesApi @class @param {module:ApiClient} apiClient Optional API client implementation to use, default to {@link module:ApiClient#instance} if unspecified.
[ "Codes", "service", "." ]
4daa78ccd8c50736c2af2cc625b6237539f3b43a
https://github.com/Metatavu/kunta-api-spec/blob/4daa78ccd8c50736c2af2cc625b6237539f3b43a/javascript-generated/src/api/CodesApi.js#L55-L141
31,255
appcelerator/appc-logger
lib/console.js
ConsoleLogger
function ConsoleLogger(options) { EventEmitter.call(this); this.options = options || {}; // allow use to customize if they want the label or not this.prefix = this.options.prefix === undefined ? true : this.options.prefix; this.showcr = this.options.showcr === undefined ? true : this.options.showcr; this.showtab ...
javascript
function ConsoleLogger(options) { EventEmitter.call(this); this.options = options || {}; // allow use to customize if they want the label or not this.prefix = this.options.prefix === undefined ? true : this.options.prefix; this.showcr = this.options.showcr === undefined ? true : this.options.showcr; this.showtab ...
[ "function", "ConsoleLogger", "(", "options", ")", "{", "EventEmitter", ".", "call", "(", "this", ")", ";", "this", ".", "options", "=", "options", "||", "{", "}", ";", "// allow use to customize if they want the label or not", "this", ".", "prefix", "=", "this",...
Console logging functionality @param {Object} options - options
[ "Console", "logging", "functionality" ]
7ded47e93f7c59de4dbd83e61cff5be890ae17fa
https://github.com/appcelerator/appc-logger/blob/7ded47e93f7c59de4dbd83e61cff5be890ae17fa/lib/console.js#L25-L46
31,256
mWater/mwater-forms
lib/ResponseAnswersComponent.js
isLoadNeeded
function isLoadNeeded(newProps, oldProps) { return !_.isEqual(newProps.formDesign, oldProps.formDesign) || !_.isEqual(newProps.data, oldProps.data); }
javascript
function isLoadNeeded(newProps, oldProps) { return !_.isEqual(newProps.formDesign, oldProps.formDesign) || !_.isEqual(newProps.data, oldProps.data); }
[ "function", "isLoadNeeded", "(", "newProps", ",", "oldProps", ")", "{", "return", "!", "_", ".", "isEqual", "(", "newProps", ".", "formDesign", ",", "oldProps", ".", "formDesign", ")", "||", "!", "_", ".", "isEqual", "(", "newProps", ".", "data", ",", ...
Check if form design or data are different
[ "Check", "if", "form", "design", "or", "data", "are", "different" ]
8c707c285ae0e6fa9aaa065471fa8a0e9e43d40c
https://github.com/mWater/mwater-forms/blob/8c707c285ae0e6fa9aaa065471fa8a0e9e43d40c/lib/ResponseAnswersComponent.js#L47-L49
31,257
Metatavu/kunta-api-spec
javascript-generated/src/api/OrganizationsApi.js
function(apiClient) { this.apiClient = apiClient || ApiClient.instance; /** * Find organization * Find organization * @param {String} organizationId organization id * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/Organization} *...
javascript
function(apiClient) { this.apiClient = apiClient || ApiClient.instance; /** * Find organization * Find organization * @param {String} organizationId organization id * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/Organization} *...
[ "function", "(", "apiClient", ")", "{", "this", ".", "apiClient", "=", "apiClient", "||", "ApiClient", ".", "instance", ";", "/**\n * Find organization\n * Find organization\n * @param {String} organizationId organization id\n * @return {Promise} a {@link https://www.pr...
Organizations service. @module api/OrganizationsApi @version 0.0.139 Constructs a new OrganizationsApi. @alias module:api/OrganizationsApi @class @param {module:ApiClient} apiClient Optional API client implementation to use, default to {@link module:ApiClient#instance} if unspecified.
[ "Organizations", "service", "." ]
4daa78ccd8c50736c2af2cc625b6237539f3b43a
https://github.com/Metatavu/kunta-api-spec/blob/4daa78ccd8c50736c2af2cc625b6237539f3b43a/javascript-generated/src/api/OrganizationsApi.js#L55-L143
31,258
appcelerator/appc-logger
lib/index.js
createLogger
function createLogger(fn) { return function () { var args = [], self = this, c; for (c = 0; c < arguments.length; c++) { args[c] = logger.specialObjectClone(arguments[c]); } return fn.apply(self, args); }; }
javascript
function createLogger(fn) { return function () { var args = [], self = this, c; for (c = 0; c < arguments.length; c++) { args[c] = logger.specialObjectClone(arguments[c]); } return fn.apply(self, args); }; }
[ "function", "createLogger", "(", "fn", ")", "{", "return", "function", "(", ")", "{", "var", "args", "=", "[", "]", ",", "self", "=", "this", ",", "c", ";", "for", "(", "c", "=", "0", ";", "c", "<", "arguments", ".", "length", ";", "c", "++", ...
create a log adapter that will handle masking @param {Function} fn [description] @return {Function} [description]
[ "create", "a", "log", "adapter", "that", "will", "handle", "masking" ]
7ded47e93f7c59de4dbd83e61cff5be890ae17fa
https://github.com/appcelerator/appc-logger/blob/7ded47e93f7c59de4dbd83e61cff5be890ae17fa/lib/index.js#L20-L30
31,259
Metatavu/kunta-api-spec
javascript-generated/src/api/FragmentsApi.js
function(apiClient) { this.apiClient = apiClient || ApiClient.instance; /** * Finds organizations page fragment * Finds single organization page fragment * @param {String} organizationId Organization id * @param {String} fragmentId fragment id * @return {Promise} a {@link https://ww...
javascript
function(apiClient) { this.apiClient = apiClient || ApiClient.instance; /** * Finds organizations page fragment * Finds single organization page fragment * @param {String} organizationId Organization id * @param {String} fragmentId fragment id * @return {Promise} a {@link https://ww...
[ "function", "(", "apiClient", ")", "{", "this", ".", "apiClient", "=", "apiClient", "||", "ApiClient", ".", "instance", ";", "/**\n * Finds organizations page fragment\n * Finds single organization page fragment \n * @param {String} organizationId Organization id\n * @p...
Fragments service. @module api/FragmentsApi @version 0.0.139 Constructs a new FragmentsApi. @alias module:api/FragmentsApi @class @param {module:ApiClient} apiClient Optional API client implementation to use, default to {@link module:ApiClient#instance} if unspecified.
[ "Fragments", "service", "." ]
4daa78ccd8c50736c2af2cc625b6237539f3b43a
https://github.com/Metatavu/kunta-api-spec/blob/4daa78ccd8c50736c2af2cc625b6237539f3b43a/javascript-generated/src/api/FragmentsApi.js#L55-L145
31,260
canjs/can-compute
proto-compute.js
function() { canReflect.onValue( observation, updater,"notify"); if (observation.hasOwnProperty("_value")) {// can-observation 4.1+ compute.value = observation._value; } else {// can-observation < 4.1 compute.value = observation.value; } }
javascript
function() { canReflect.onValue( observation, updater,"notify"); if (observation.hasOwnProperty("_value")) {// can-observation 4.1+ compute.value = observation._value; } else {// can-observation < 4.1 compute.value = observation.value; } }
[ "function", "(", ")", "{", "canReflect", ".", "onValue", "(", "observation", ",", "updater", ",", "\"notify\"", ")", ";", "if", "(", "observation", ".", "hasOwnProperty", "(", "\"_value\"", ")", ")", "{", "// can-observation 4.1+", "compute", ".", "value", "...
Call `onchanged` when any source observables change.
[ "Call", "onchanged", "when", "any", "source", "observables", "change", "." ]
ac271cf6a68ec936e2f7992df2bb9bc1f5a7cf36
https://github.com/canjs/can-compute/blob/ac271cf6a68ec936e2f7992df2bb9bc1f5a7cf36/proto-compute.js#L147-L154
31,261
Metatavu/kunta-api-spec
javascript-generated/src/api/PhoneServiceChannelsApi.js
function(apiClient) { this.apiClient = apiClient || ApiClient.instance; /** * Finds a phone service channel by id * Finds a phone service channel by id * @param {String} phoneServiceChannelId Phone service channel id * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with d...
javascript
function(apiClient) { this.apiClient = apiClient || ApiClient.instance; /** * Finds a phone service channel by id * Finds a phone service channel by id * @param {String} phoneServiceChannelId Phone service channel id * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with d...
[ "function", "(", "apiClient", ")", "{", "this", ".", "apiClient", "=", "apiClient", "||", "ApiClient", ".", "instance", ";", "/**\n * Finds a phone service channel by id\n * Finds a phone service channel by id\n * @param {String} phoneServiceChannelId Phone service channel ...
PhoneServiceChannels service. @module api/PhoneServiceChannelsApi @version 0.0.139 Constructs a new PhoneServiceChannelsApi. @alias module:api/PhoneServiceChannelsApi @class @param {module:ApiClient} apiClient Optional API client implementation to use, default to {@link module:ApiClient#instance} if unspecified.
[ "PhoneServiceChannels", "service", "." ]
4daa78ccd8c50736c2af2cc625b6237539f3b43a
https://github.com/Metatavu/kunta-api-spec/blob/4daa78ccd8c50736c2af2cc625b6237539f3b43a/javascript-generated/src/api/PhoneServiceChannelsApi.js#L55-L185
31,262
appcelerator/appc-logger
lib/problem.js
ProblemLogger
function ProblemLogger(options) { options = options || {}; ConsoleLogger.call(this); const tmpdir = require('os').tmpdir(); this.filename = path.join(tmpdir, 'logger-' + (+new Date()) + '.log'); this.name = options.problemLogName || ((options.name || 'problem') + '.log'); this.stream = fs.createWriteStream(this.f...
javascript
function ProblemLogger(options) { options = options || {}; ConsoleLogger.call(this); const tmpdir = require('os').tmpdir(); this.filename = path.join(tmpdir, 'logger-' + (+new Date()) + '.log'); this.name = options.problemLogName || ((options.name || 'problem') + '.log'); this.stream = fs.createWriteStream(this.f...
[ "function", "ProblemLogger", "(", "options", ")", "{", "options", "=", "options", "||", "{", "}", ";", "ConsoleLogger", ".", "call", "(", "this", ")", ";", "const", "tmpdir", "=", "require", "(", "'os'", ")", ".", "tmpdir", "(", ")", ";", "this", "."...
Logger stream that will only write out a log file if the process exits non-zero in the current directory @param {Object} options - options @constructor
[ "Logger", "stream", "that", "will", "only", "write", "out", "a", "log", "file", "if", "the", "process", "exits", "non", "-", "zero", "in", "the", "current", "directory" ]
7ded47e93f7c59de4dbd83e61cff5be890ae17fa
https://github.com/appcelerator/appc-logger/blob/7ded47e93f7c59de4dbd83e61cff5be890ae17fa/lib/problem.js#L19-L28
31,263
appcelerator/appc-logger
lib/problem.js
closeStreams
function closeStreams(exitCode) { // default is 0 if not specified exitCode = exitCode === undefined ? 0 : exitCode; if (streams.length) { streams.forEach(function (logger) { logger.write({ level: bunyan.TRACE, msg: util.format('exited with code %d', exitCode) }); logger.stream.end(); // jscs:disable jsD...
javascript
function closeStreams(exitCode) { // default is 0 if not specified exitCode = exitCode === undefined ? 0 : exitCode; if (streams.length) { streams.forEach(function (logger) { logger.write({ level: bunyan.TRACE, msg: util.format('exited with code %d', exitCode) }); logger.stream.end(); // jscs:disable jsD...
[ "function", "closeStreams", "(", "exitCode", ")", "{", "// default is 0 if not specified", "exitCode", "=", "exitCode", "===", "undefined", "?", "0", ":", "exitCode", ";", "if", "(", "streams", ".", "length", ")", "{", "streams", ".", "forEach", "(", "function...
Close the stream @param {number} exitCode - numeric entry code
[ "Close", "the", "stream" ]
7ded47e93f7c59de4dbd83e61cff5be890ae17fa
https://github.com/appcelerator/appc-logger/blob/7ded47e93f7c59de4dbd83e61cff5be890ae17fa/lib/problem.js#L59-L71
31,264
noodlefrenzy/node-amqp10
lib/session.js
function(l) { debug('Attaching link ' + l.name + ':' + l.handle + ' after begin received'); if (l.state() !== 'attached' && l.state() !== 'attaching') l.attach(); }
javascript
function(l) { debug('Attaching link ' + l.name + ':' + l.handle + ' after begin received'); if (l.state() !== 'attached' && l.state() !== 'attaching') l.attach(); }
[ "function", "(", "l", ")", "{", "debug", "(", "'Attaching link '", "+", "l", ".", "name", "+", "':'", "+", "l", ".", "handle", "+", "' after begin received'", ")", ";", "if", "(", "l", ".", "state", "(", ")", "!==", "'attached'", "&&", "l", ".", "s...
attach all links
[ "attach", "all", "links" ]
f5c2aa570830a8dd454e89ed3f4222fc7953fcf7
https://github.com/noodlefrenzy/node-amqp10/blob/f5c2aa570830a8dd454e89ed3f4222fc7953fcf7/lib/session.js#L441-L444
31,265
noodlefrenzy/node-amqp10
lib/frames.js
role
function role(value) { if (typeof value === 'boolean') return value; if (value !== 'sender' && value !== 'receiver') throw new errors.EncodingError(value, 'invalid role'); return (value === 'sender') ? false : true; }
javascript
function role(value) { if (typeof value === 'boolean') return value; if (value !== 'sender' && value !== 'receiver') throw new errors.EncodingError(value, 'invalid role'); return (value === 'sender') ? false : true; }
[ "function", "role", "(", "value", ")", "{", "if", "(", "typeof", "value", "===", "'boolean'", ")", "return", "value", ";", "if", "(", "value", "!==", "'sender'", "&&", "value", "!==", "'receiver'", ")", "throw", "new", "errors", ".", "EncodingError", "("...
restricted type helpers
[ "restricted", "type", "helpers" ]
f5c2aa570830a8dd454e89ed3f4222fc7953fcf7
https://github.com/noodlefrenzy/node-amqp10/blob/f5c2aa570830a8dd454e89ed3f4222fc7953fcf7/lib/frames.js#L154-L161
31,266
noodlefrenzy/node-amqp10
lib/types.js
listBuilder
function listBuilder(list, bufb, codec, width) { if (!Array.isArray(list)) { throw new errors.EncodingError(list, 'Unsure how to encode non-array as list'); } if (!width && list.length === 0) { bufb.appendUInt8(0x45); return; } // Encode all elements into a temp buffer to allow us to front-load ...
javascript
function listBuilder(list, bufb, codec, width) { if (!Array.isArray(list)) { throw new errors.EncodingError(list, 'Unsure how to encode non-array as list'); } if (!width && list.length === 0) { bufb.appendUInt8(0x45); return; } // Encode all elements into a temp buffer to allow us to front-load ...
[ "function", "listBuilder", "(", "list", ",", "bufb", ",", "codec", ",", "width", ")", "{", "if", "(", "!", "Array", ".", "isArray", "(", "list", ")", ")", "{", "throw", "new", "errors", ".", "EncodingError", "(", "list", ",", "'Unsure how to encode non-a...
Decoder methods decode an incoming buffer into an appropriate concrete JS entity. @function decoder @param {Buffer} buf Buffer to decode, stripped of prefix code (e.g. 0xA1 0x03 'foo' would have the 0xA1 stripped) @param {Codec} [codec] If needed, the codec to decode sub-values for composite types. @ret...
[ "Decoder", "methods", "decode", "an", "incoming", "buffer", "into", "an", "appropriate", "concrete", "JS", "entity", "." ]
f5c2aa570830a8dd454e89ed3f4222fc7953fcf7
https://github.com/noodlefrenzy/node-amqp10/blob/f5c2aa570830a8dd454e89ed3f4222fc7953fcf7/lib/types.js#L99-L129
31,267
noodlefrenzy/node-amqp10
lib/types.js
mapBuilder
function mapBuilder(map, bufb, codec, width) { if (typeof map !== 'object') { throw new errors.EncodingError(map, 'Unsure how to encode non-object as map'); } if (Array.isArray(map)) { throw new errors.EncodingError(map, 'Unsure how to encode array as map'); } var keys = Object.keys(map); if (!wid...
javascript
function mapBuilder(map, bufb, codec, width) { if (typeof map !== 'object') { throw new errors.EncodingError(map, 'Unsure how to encode non-object as map'); } if (Array.isArray(map)) { throw new errors.EncodingError(map, 'Unsure how to encode array as map'); } var keys = Object.keys(map); if (!wid...
[ "function", "mapBuilder", "(", "map", ",", "bufb", ",", "codec", ",", "width", ")", "{", "if", "(", "typeof", "map", "!==", "'object'", ")", "{", "throw", "new", "errors", ".", "EncodingError", "(", "map", ",", "'Unsure how to encode non-object as map'", ")"...
A map is encoded as a compound value where the constituent elements form alternating key value pairs. <pre> item 0 item 1 item n-1 item n +-------+-------+----+---------+---------+ | key 1 | val 1 | .. | key n/2 | val n/2 | +-------+-------+----+---------+---------+ </pre> Map encodings must contain an even...
[ "A", "map", "is", "encoded", "as", "a", "compound", "value", "where", "the", "constituent", "elements", "form", "alternating", "key", "value", "pairs", "." ]
f5c2aa570830a8dd454e89ed3f4222fc7953fcf7
https://github.com/noodlefrenzy/node-amqp10/blob/f5c2aa570830a8dd454e89ed3f4222fc7953fcf7/lib/types.js#L270-L310
31,268
noodlefrenzy/node-amqp10
lib/utilities.js
assertArguments
function assertArguments(options, argnames) { if (!argnames) return; if (!options) throw new TypeError('missing arguments: ' + argnames); argnames.forEach(function (argname) { if (!options.hasOwnProperty(argname)) { throw new TypeError('missing argument: ' + argname); } }); }
javascript
function assertArguments(options, argnames) { if (!argnames) return; if (!options) throw new TypeError('missing arguments: ' + argnames); argnames.forEach(function (argname) { if (!options.hasOwnProperty(argname)) { throw new TypeError('missing argument: ' + argname); } }); }
[ "function", "assertArguments", "(", "options", ",", "argnames", ")", "{", "if", "(", "!", "argnames", ")", "return", ";", "if", "(", "!", "options", ")", "throw", "new", "TypeError", "(", "'missing arguments: '", "+", "argnames", ")", ";", "argnames", ".",...
Convenience method to assert that a given options object contains the required arguments. @param options @param argnames
[ "Convenience", "method", "to", "assert", "that", "a", "given", "options", "object", "contains", "the", "required", "arguments", "." ]
f5c2aa570830a8dd454e89ed3f4222fc7953fcf7
https://github.com/noodlefrenzy/node-amqp10/blob/f5c2aa570830a8dd454e89ed3f4222fc7953fcf7/lib/utilities.js#L87-L95
31,269
noodlefrenzy/node-amqp10
lib/sasl/sasl.js
Sasl
function Sasl(mechanism, handler) { if (!mechanism || !handler) { throw new errors.NotImplementedError('Need both the mechanism and the handler'); } this.mechanism = mechanism; this.handler = handler; this.receivedHeader = false; }
javascript
function Sasl(mechanism, handler) { if (!mechanism || !handler) { throw new errors.NotImplementedError('Need both the mechanism and the handler'); } this.mechanism = mechanism; this.handler = handler; this.receivedHeader = false; }
[ "function", "Sasl", "(", "mechanism", ",", "handler", ")", "{", "if", "(", "!", "mechanism", "||", "!", "handler", ")", "{", "throw", "new", "errors", ".", "NotImplementedError", "(", "'Need both the mechanism and the handler'", ")", ";", "}", "this", ".", "...
Currently, only supports SASL ANONYMOUS or PLAIN @constructor
[ "Currently", "only", "supports", "SASL", "ANONYMOUS", "or", "PLAIN" ]
f5c2aa570830a8dd454e89ed3f4222fc7953fcf7
https://github.com/noodlefrenzy/node-amqp10/blob/f5c2aa570830a8dd454e89ed3f4222fc7953fcf7/lib/sasl/sasl.js#L21-L28
31,270
noodlefrenzy/node-amqp10
lib/policies/policy.js
Policy
function Policy(overrides) { if (!(this instanceof Policy)) return new Policy(overrides); u.defaults(this, overrides, { /** * support subjects in link names with the following characteristics: * receiver: "amq.topic/news", means a filter on the ReceiverLink will be made * for messa...
javascript
function Policy(overrides) { if (!(this instanceof Policy)) return new Policy(overrides); u.defaults(this, overrides, { /** * support subjects in link names with the following characteristics: * receiver: "amq.topic/news", means a filter on the ReceiverLink will be made * for messa...
[ "function", "Policy", "(", "overrides", ")", "{", "if", "(", "!", "(", "this", "instanceof", "Policy", ")", ")", "return", "new", "Policy", "(", "overrides", ")", ";", "u", ".", "defaults", "(", "this", ",", "overrides", ",", "{", "/**\n * support su...
The default policy for amqp10 clients @class @param {object} overrides override values for the default policy
[ "The", "default", "policy", "for", "amqp10", "clients" ]
f5c2aa570830a8dd454e89ed3f4222fc7953fcf7
https://github.com/noodlefrenzy/node-amqp10/blob/f5c2aa570830a8dd454e89ed3f4222fc7953fcf7/lib/policies/policy.js#L25-L187
31,271
imonology/scalra
modules/reporting.js
function (onDone) { // store what to do after connected // NOTE: may be called repeatedly (if initial attempts fail or disconnect happens) if (typeof onDone === 'function') l_onConnect = onDone; if (l_ip_port === undefined) { LOG.warn('not init (or already disposed), cannot connect to server'); return; } ...
javascript
function (onDone) { // store what to do after connected // NOTE: may be called repeatedly (if initial attempts fail or disconnect happens) if (typeof onDone === 'function') l_onConnect = onDone; if (l_ip_port === undefined) { LOG.warn('not init (or already disposed), cannot connect to server'); return; } ...
[ "function", "(", "onDone", ")", "{", "// store what to do after connected", "// NOTE: may be called repeatedly (if initial attempts fail or disconnect happens)", "if", "(", "typeof", "onDone", "===", "'function'", ")", "l_onConnect", "=", "onDone", ";", "if", "(", "l_ip_port"...
connect to remote server
[ "connect", "to", "remote", "server" ]
0cf7377d02bf1e6beb90d6821c144eefb89feaa9
https://github.com/imonology/scalra/blob/0cf7377d02bf1e6beb90d6821c144eefb89feaa9/modules/reporting.js#L278-L309
31,272
imonology/scalra
handlers/system.js
function (latest_log) { if (latest_log !== null && latest_log.type !== "SYSTEM_DOWN") { LOG.warn("server crashed last time", 'handlers.system'); LOG.event("SYSTEM_CRASHED", SR.Settings.SERVER_INFO); } LOG.event("SYSTEM_UP", SR.Settings.SERVER_INFO); }
javascript
function (latest_log) { if (latest_log !== null && latest_log.type !== "SYSTEM_DOWN") { LOG.warn("server crashed last time", 'handlers.system'); LOG.event("SYSTEM_CRASHED", SR.Settings.SERVER_INFO); } LOG.event("SYSTEM_UP", SR.Settings.SERVER_INFO); }
[ "function", "(", "latest_log", ")", "{", "if", "(", "latest_log", "!==", "null", "&&", "latest_log", ".", "type", "!==", "\"SYSTEM_DOWN\"", ")", "{", "LOG", ".", "warn", "(", "\"server crashed last time\"", ",", "'handlers.system'", ")", ";", "LOG", ".", "ev...
perform event log
[ "perform", "event", "log" ]
0cf7377d02bf1e6beb90d6821c144eefb89feaa9
https://github.com/imonology/scalra/blob/0cf7377d02bf1e6beb90d6821c144eefb89feaa9/handlers/system.js#L248-L255
31,273
imonology/scalra
extension/socketio.js
function () { if (queue.length > 0) { if (queue.length % 500 === 0) LOG.warn('socketio queue: ' + queue.length); var item = queue.shift(); socket.busy = true; socket.emit('SRR', item); } }
javascript
function () { if (queue.length > 0) { if (queue.length % 500 === 0) LOG.warn('socketio queue: ' + queue.length); var item = queue.shift(); socket.busy = true; socket.emit('SRR', item); } }
[ "function", "(", ")", "{", "if", "(", "queue", ".", "length", ">", "0", ")", "{", "if", "(", "queue", ".", "length", "%", "500", "===", "0", ")", "LOG", ".", "warn", "(", "'socketio queue: '", "+", "queue", ".", "length", ")", ";", "var", "item",...
check if message queue has something to send
[ "check", "if", "message", "queue", "has", "something", "to", "send" ]
0cf7377d02bf1e6beb90d6821c144eefb89feaa9
https://github.com/imonology/scalra/blob/0cf7377d02bf1e6beb90d6821c144eefb89feaa9/extension/socketio.js#L132-L141
31,274
imonology/scalra
core/log_manager.js
function () { SR.fs.close(l_logs[log_id].fd, function () { console.log(l_name + '::l_closeLog::' + SR.Tags.YELLOW + 'LogID=' + log_id + ' closed.' + SR.Tags.ERREND); delete l_logs[log_id]; onDone(log_id); } ); }
javascript
function () { SR.fs.close(l_logs[log_id].fd, function () { console.log(l_name + '::l_closeLog::' + SR.Tags.YELLOW + 'LogID=' + log_id + ' closed.' + SR.Tags.ERREND); delete l_logs[log_id]; onDone(log_id); } ); }
[ "function", "(", ")", "{", "SR", ".", "fs", ".", "close", "(", "l_logs", "[", "log_id", "]", ".", "fd", ",", "function", "(", ")", "{", "console", ".", "log", "(", "l_name", "+", "'::l_closeLog::'", "+", "SR", ".", "Tags", ".", "YELLOW", "+", "'L...
perform actual file close
[ "perform", "actual", "file", "close" ]
0cf7377d02bf1e6beb90d6821c144eefb89feaa9
https://github.com/imonology/scalra/blob/0cf7377d02bf1e6beb90d6821c144eefb89feaa9/core/log_manager.js#L243-L252
31,275
imonology/scalra
extension/location.js
function (appID, locationID) { // check if location exists if (l_locations.hasOwnProperty(locationID) === false) { LOG.error('locationID: ' + locationID + ' does not exist', 'addApp'); return; } // check if already exists, ignore action if already exists if (l_apps.hasOwnProperty(a...
javascript
function (appID, locationID) { // check if location exists if (l_locations.hasOwnProperty(locationID) === false) { LOG.error('locationID: ' + locationID + ' does not exist', 'addApp'); return; } // check if already exists, ignore action if already exists if (l_apps.hasOwnProperty(a...
[ "function", "(", "appID", ",", "locationID", ")", "{", "// check if location exists", "if", "(", "l_locations", ".", "hasOwnProperty", "(", "locationID", ")", "===", "false", ")", "{", "LOG", ".", "error", "(", "'locationID: '", "+", "locationID", "+", "' does...
add a new app
[ "add", "a", "new", "app" ]
0cf7377d02bf1e6beb90d6821c144eefb89feaa9
https://github.com/imonology/scalra/blob/0cf7377d02bf1e6beb90d6821c144eefb89feaa9/extension/location.js#L113-L136
31,276
imonology/scalra
modules/express.js
function (upload) { if (!upload || !upload.path || !upload.name || !upload.size) { LOG.error('upload object incomplete:', l_name); return; } // record basic file info var arr = upload.path.split('/'); var upload_name = arr[arr.length-1]; var filename = (preserve_name ...
javascript
function (upload) { if (!upload || !upload.path || !upload.name || !upload.size) { LOG.error('upload object incomplete:', l_name); return; } // record basic file info var arr = upload.path.split('/'); var upload_name = arr[arr.length-1]; var filename = (preserve_name ...
[ "function", "(", "upload", ")", "{", "if", "(", "!", "upload", "||", "!", "upload", ".", "path", "||", "!", "upload", ".", "name", "||", "!", "upload", ".", "size", ")", "{", "LOG", ".", "error", "(", "'upload object incomplete:'", ",", "l_name", ")"...
modify uploaded file to have original filename
[ "modify", "uploaded", "file", "to", "have", "original", "filename" ]
0cf7377d02bf1e6beb90d6821c144eefb89feaa9
https://github.com/imonology/scalra/blob/0cf7377d02bf1e6beb90d6821c144eefb89feaa9/modules/express.js#L181-L208
31,277
imonology/scalra
core/execute.js
function (id) { LOG.warn('server started: ' + server_type, l_name); // check if we should notify start server request for (var i=0; i < l_pendingStart.length; i++) { var task = l_pendingStart[i]; if (task.server_type !== server_type) { continue; } LOG.warn('pending type matched: ' +...
javascript
function (id) { LOG.warn('server started: ' + server_type, l_name); // check if we should notify start server request for (var i=0; i < l_pendingStart.length; i++) { var task = l_pendingStart[i]; if (task.server_type !== server_type) { continue; } LOG.warn('pending type matched: ' +...
[ "function", "(", "id", ")", "{", "LOG", ".", "warn", "(", "'server started: '", "+", "server_type", ",", "l_name", ")", ";", "// check if we should notify start server request", "for", "(", "var", "i", "=", "0", ";", "i", "<", "l_pendingStart", ".", "length", ...
notify if a server process has started
[ "notify", "if", "a", "server", "process", "has", "started" ]
0cf7377d02bf1e6beb90d6821c144eefb89feaa9
https://github.com/imonology/scalra/blob/0cf7377d02bf1e6beb90d6821c144eefb89feaa9/core/execute.js#L107-L157
31,278
imonology/scalra
core/execute.js
function (exec_path, onExec) { var onFound = function () { // if file found, execute directly // store starting path args.exec_path = exec_path; LOG.warn('starting ' + size + ' [' + server_type + '] servers', l_name); // store an entry for the callback when all servers are started as reque...
javascript
function (exec_path, onExec) { var onFound = function () { // if file found, execute directly // store starting path args.exec_path = exec_path; LOG.warn('starting ' + size + ' [' + server_type + '] servers', l_name); // store an entry for the callback when all servers are started as reque...
[ "function", "(", "exec_path", ",", "onExec", ")", "{", "var", "onFound", "=", "function", "(", ")", "{", "// if file found, execute directly", "// store starting path", "args", ".", "exec_path", "=", "exec_path", ";", "LOG", ".", "warn", "(", "'starting '", "+",...
try to execute on a given path
[ "try", "to", "execute", "on", "a", "given", "path" ]
0cf7377d02bf1e6beb90d6821c144eefb89feaa9
https://github.com/imonology/scalra/blob/0cf7377d02bf1e6beb90d6821c144eefb89feaa9/core/execute.js#L175-L220
31,279
particle-iot/particle-commands
src/cmd/api.js
convertApiError
function convertApiError(err) { if (err.error && err.error.response && err.error.response.text) { const obj = JSON.parse(err.error.response.text); if (obj.errors && obj.errors.length) { err = { message: obj.errors[0].message, error:err.error }; } } return err; }
javascript
function convertApiError(err) { if (err.error && err.error.response && err.error.response.text) { const obj = JSON.parse(err.error.response.text); if (obj.errors && obj.errors.length) { err = { message: obj.errors[0].message, error:err.error }; } } return err; }
[ "function", "convertApiError", "(", "err", ")", "{", "if", "(", "err", ".", "error", "&&", "err", ".", "error", ".", "response", "&&", "err", ".", "error", ".", "response", ".", "text", ")", "{", "const", "obj", "=", "JSON", ".", "parse", "(", "err...
Converts an error thrown by the API to a simpler object containing a `message` property. @param {object} err The error raised by the API. @returns {object} With message and error properties.
[ "Converts", "an", "error", "thrown", "by", "the", "API", "to", "a", "simpler", "object", "containing", "a", "message", "property", "." ]
012252e0faef5f4ee21aa3b36c58eace7296a633
https://github.com/particle-iot/particle-commands/blob/012252e0faef5f4ee21aa3b36c58eace7296a633/src/cmd/api.js#L9-L17
31,280
imonology/scalra
core/comm.js
function (area, layer) { // check if layer exists if (l_layers.hasOwnProperty(layer) === false) return []; // get all current subscriptions at this layer var subs = l_layers[layer]; // prepare list of connection of subscribers matching / covering the area var connections = []; // check each subscriptio...
javascript
function (area, layer) { // check if layer exists if (l_layers.hasOwnProperty(layer) === false) return []; // get all current subscriptions at this layer var subs = l_layers[layer]; // prepare list of connection of subscribers matching / covering the area var connections = []; // check each subscriptio...
[ "function", "(", "area", ",", "layer", ")", "{", "// check if layer exists", "if", "(", "l_layers", ".", "hasOwnProperty", "(", "layer", ")", "===", "false", ")", "return", "[", "]", ";", "// get all current subscriptions at this layer", "var", "subs", "=", "l_l...
find a list of subscribers covering a given point or area
[ "find", "a", "list", "of", "subscribers", "covering", "a", "given", "point", "or", "area" ]
0cf7377d02bf1e6beb90d6821c144eefb89feaa9
https://github.com/imonology/scalra/blob/0cf7377d02bf1e6beb90d6821c144eefb89feaa9/core/comm.js#L261-L283
31,281
imonology/scalra
core/event_manager.js
function (event) { // if event is not from socket, no need to queue // TODO: remove connection-specific code from here if (event.conn.type !== 'socket') return true; var socket = event.conn.connector; // if no mechanism to store (such as from a bot), just ignore // TODO: this is not clean if (typeof socket....
javascript
function (event) { // if event is not from socket, no need to queue // TODO: remove connection-specific code from here if (event.conn.type !== 'socket') return true; var socket = event.conn.connector; // if no mechanism to store (such as from a bot), just ignore // TODO: this is not clean if (typeof socket....
[ "function", "(", "event", ")", "{", "// if event is not from socket, no need to queue", "// TODO: remove connection-specific code from here", "if", "(", "event", ".", "conn", ".", "type", "!==", "'socket'", ")", "return", "true", ";", "var", "socket", "=", "event", "....
function to store a event pending to send
[ "function", "to", "store", "a", "event", "pending", "to", "send" ]
0cf7377d02bf1e6beb90d6821c144eefb89feaa9
https://github.com/imonology/scalra/blob/0cf7377d02bf1e6beb90d6821c144eefb89feaa9/core/event_manager.js#L93-L123
31,282
imonology/scalra
core/event_manager.js
function (event) { // check if connection object exists if (typeof event.conn === 'undefined') { LOG.error('no connection records, cannot respond to request', l_name); return false; } // if no mechanism to store (such as from a bot), just ignore // TODO: cleaner approach? if (event.conn.type !== 'socket' ||...
javascript
function (event) { // check if connection object exists if (typeof event.conn === 'undefined') { LOG.error('no connection records, cannot respond to request', l_name); return false; } // if no mechanism to store (such as from a bot), just ignore // TODO: cleaner approach? if (event.conn.type !== 'socket' ||...
[ "function", "(", "event", ")", "{", "// check if connection object exists", "if", "(", "typeof", "event", ".", "conn", "===", "'undefined'", ")", "{", "LOG", ".", "error", "(", "'no connection records, cannot respond to request'", ",", "l_name", ")", ";", "return", ...
opposite of queueEvent
[ "opposite", "of", "queueEvent" ]
0cf7377d02bf1e6beb90d6821c144eefb89feaa9
https://github.com/imonology/scalra/blob/0cf7377d02bf1e6beb90d6821c144eefb89feaa9/core/event_manager.js#L126-L154
31,283
imonology/scalra
core/REST/server.js
function (req, res) { LOG.warn('handle_request'); // attach custom res methods (borrowed from express) res = UTIL.mixin(res, response); LOG.sys('HTTP req received, header', 'SR.REST'); LOG.sys(req.headers, 'SR.REST'); var content_type = req.headers['content-type']; // NOTE: multi-part needs to be ha...
javascript
function (req, res) { LOG.warn('handle_request'); // attach custom res methods (borrowed from express) res = UTIL.mixin(res, response); LOG.sys('HTTP req received, header', 'SR.REST'); LOG.sys(req.headers, 'SR.REST'); var content_type = req.headers['content-type']; // NOTE: multi-part needs to be ha...
[ "function", "(", "req", ",", "res", ")", "{", "LOG", ".", "warn", "(", "'handle_request'", ")", ";", "// attach custom res methods (borrowed from express)", "res", "=", "UTIL", ".", "mixin", "(", "res", ",", "response", ")", ";", "LOG", ".", "sys", "(", "'...
main place to receive HTTP-related requests
[ "main", "place", "to", "receive", "HTTP", "-", "related", "requests" ]
0cf7377d02bf1e6beb90d6821c144eefb89feaa9
https://github.com/imonology/scalra/blob/0cf7377d02bf1e6beb90d6821c144eefb89feaa9/core/REST/server.js#L34-L93
31,284
imonology/scalra
extension/user.js
function (account, data, conn) { //if (l_logins.hasOwnProperty(account) === true) //return false; // check if user's unique data exists if (typeof data.data !== 'object') { LOG.error('data field does not exist, cannot add login data'); return false; } LOG.warn('account: ' + account + ' data:', 'addLogin...
javascript
function (account, data, conn) { //if (l_logins.hasOwnProperty(account) === true) //return false; // check if user's unique data exists if (typeof data.data !== 'object') { LOG.error('data field does not exist, cannot add login data'); return false; } LOG.warn('account: ' + account + ' data:', 'addLogin...
[ "function", "(", "account", ",", "data", ",", "conn", ")", "{", "//if (l_logins.hasOwnProperty(account) === true)", "//return false;", "// check if user's unique data exists", "if", "(", "typeof", "data", ".", "data", "!==", "'object'", ")", "{", "LOG", ".", "error", ...
store & remove user data to cache
[ "store", "&", "remove", "user", "data", "to", "cache" ]
0cf7377d02bf1e6beb90d6821c144eefb89feaa9
https://github.com/imonology/scalra/blob/0cf7377d02bf1e6beb90d6821c144eefb89feaa9/extension/user.js#L88-L132
31,285
imonology/scalra
extension/user.js
function (error) { if (error) { var err = new Error("set custom data for account [" + account + "] fail"); err.name = "setUser Error"; LOG.error('set custom data for account [' + account + '] fail', 'user'); UTIL.safeCall(onDone, err); } else { LOG.warn('set custom data for account [' + account + ...
javascript
function (error) { if (error) { var err = new Error("set custom data for account [" + account + "] fail"); err.name = "setUser Error"; LOG.error('set custom data for account [' + account + '] fail', 'user'); UTIL.safeCall(onDone, err); } else { LOG.warn('set custom data for account [' + account + ...
[ "function", "(", "error", ")", "{", "if", "(", "error", ")", "{", "var", "err", "=", "new", "Error", "(", "\"set custom data for account [\"", "+", "account", "+", "\"] fail\"", ")", ";", "err", ".", "name", "=", "\"setUser Error\"", ";", "LOG", ".", "er...
perform DB write-back
[ "perform", "DB", "write", "-", "back" ]
0cf7377d02bf1e6beb90d6821c144eefb89feaa9
https://github.com/imonology/scalra/blob/0cf7377d02bf1e6beb90d6821c144eefb89feaa9/extension/user.js#L526-L538
31,286
imonology/scalra
extension/user.js
function (uid, token) { // TODO: check if local account already exists, or replace existing one // multiple accounts storable for one local server // NOTE: field name is a variable // ref: http://stackoverflow.com/questions/11133912/how-to-use-a-variable-as-a-field-name-in-mongodb-native-findandmodify ...
javascript
function (uid, token) { // TODO: check if local account already exists, or replace existing one // multiple accounts storable for one local server // NOTE: field name is a variable // ref: http://stackoverflow.com/questions/11133912/how-to-use-a-variable-as-a-field-name-in-mongodb-native-findandmodify ...
[ "function", "(", "uid", ",", "token", ")", "{", "// TODO: check if local account already exists, or replace existing one", "// multiple accounts storable for one local server", "// NOTE: field name is a variable", "// ref: http://stackoverflow.com/questions/11133912/how-to-use-a-variable-as-a-fi...
build callback to store local account if it's verified
[ "build", "callback", "to", "store", "local", "account", "if", "it", "s", "verified" ]
0cf7377d02bf1e6beb90d6821c144eefb89feaa9
https://github.com/imonology/scalra/blob/0cf7377d02bf1e6beb90d6821c144eefb89feaa9/extension/user.js#L691-L712
31,287
imonology/scalra
extension/user.js
function (error) { if (error) { var err = new Error(error.toString()); err.name = "l_createToken Error"; UTIL.safeCall(onDone, err); } else { LOG.warn('pass_token [' + token + '] stored'); UTIL.safeCall(onDone, null, token); } }
javascript
function (error) { if (error) { var err = new Error(error.toString()); err.name = "l_createToken Error"; UTIL.safeCall(onDone, err); } else { LOG.warn('pass_token [' + token + '] stored'); UTIL.safeCall(onDone, null, token); } }
[ "function", "(", "error", ")", "{", "if", "(", "error", ")", "{", "var", "err", "=", "new", "Error", "(", "error", ".", "toString", "(", ")", ")", ";", "err", ".", "name", "=", "\"l_createToken Error\"", ";", "UTIL", ".", "safeCall", "(", "onDone", ...
store token back to DB
[ "store", "token", "back", "to", "DB" ]
0cf7377d02bf1e6beb90d6821c144eefb89feaa9
https://github.com/imonology/scalra/blob/0cf7377d02bf1e6beb90d6821c144eefb89feaa9/extension/user.js#L750-L760
31,288
imonology/scalra
core/handler.js
function (msgtype, event) { // we only forward for non-SR user-defined events at lobby if (SR.Settings.SERVER_INFO.type !== 'lobby' || msgtype.startsWith('SR')) return false; // check if we're lobby and same-name app servers are available var list = SR.AppConn.queryAppServers(); LOG.sys('check forward...
javascript
function (msgtype, event) { // we only forward for non-SR user-defined events at lobby if (SR.Settings.SERVER_INFO.type !== 'lobby' || msgtype.startsWith('SR')) return false; // check if we're lobby and same-name app servers are available var list = SR.AppConn.queryAppServers(); LOG.sys('check forward...
[ "function", "(", "msgtype", ",", "event", ")", "{", "// we only forward for non-SR user-defined events at lobby", "if", "(", "SR", ".", "Settings", ".", "SERVER_INFO", ".", "type", "!==", "'lobby'", "||", "msgtype", ".", "startsWith", "(", "'SR'", ")", ")", "ret...
check if an event should be forwarded to another app server for execution
[ "check", "if", "an", "event", "should", "be", "forwarded", "to", "another", "app", "server", "for", "execution" ]
0cf7377d02bf1e6beb90d6821c144eefb89feaa9
https://github.com/imonology/scalra/blob/0cf7377d02bf1e6beb90d6821c144eefb89feaa9/core/handler.js#L287-L319
31,289
imonology/scalra
core/handler.js
function (response_type, event) { LOG.sys('handling event response [' + response_type + ']', l_name); // go over each registered callback function and see which one responds for (var i=0; i < l_responders[response_type].length; i++) { // find the callback with matching client id // call callback and s...
javascript
function (response_type, event) { LOG.sys('handling event response [' + response_type + ']', l_name); // go over each registered callback function and see which one responds for (var i=0; i < l_responders[response_type].length; i++) { // find the callback with matching client id // call callback and s...
[ "function", "(", "response_type", ",", "event", ")", "{", "LOG", ".", "sys", "(", "'handling event response ['", "+", "response_type", "+", "']'", ",", "l_name", ")", ";", "// go over each registered callback function and see which one responds", "for", "(", "var", "i...
notify that a response to a particular event is received
[ "notify", "that", "a", "response", "to", "a", "particular", "event", "is", "received" ]
0cf7377d02bf1e6beb90d6821c144eefb89feaa9
https://github.com/imonology/scalra/blob/0cf7377d02bf1e6beb90d6821c144eefb89feaa9/core/handler.js#L632-L652
31,290
imonology/scalra
extension/proxy.js
function (e, req, res, host) { LOG.error('proxy error for host: ' + host + '. remove from active proxy list:', 'SR.Proxy'); LOG.error(e, 'SR.Proxy'); // remove proxy info from list delete l_proxies[host]; // notify for proxy failure UTIL.safeCall(onProxyFail, host); // send back to client about t...
javascript
function (e, req, res, host) { LOG.error('proxy error for host: ' + host + '. remove from active proxy list:', 'SR.Proxy'); LOG.error(e, 'SR.Proxy'); // remove proxy info from list delete l_proxies[host]; // notify for proxy failure UTIL.safeCall(onProxyFail, host); // send back to client about t...
[ "function", "(", "e", ",", "req", ",", "res", ",", "host", ")", "{", "LOG", ".", "error", "(", "'proxy error for host: '", "+", "host", "+", "'. remove from active proxy list:'", ",", "'SR.Proxy'", ")", ";", "LOG", ".", "error", "(", "e", ",", "'SR.Proxy'"...
same error handling for both HTTP or WebSocket proxies
[ "same", "error", "handling", "for", "both", "HTTP", "or", "WebSocket", "proxies" ]
0cf7377d02bf1e6beb90d6821c144eefb89feaa9
https://github.com/imonology/scalra/blob/0cf7377d02bf1e6beb90d6821c144eefb89feaa9/extension/proxy.js#L223-L238
31,291
imonology/scalra
core/job_queue.js
JobQueue
function JobQueue(para) { this.queue = []; this.curr = 0; this.all_passed = true; this.timeout = ((typeof para === 'object' && typeof para.timeout === 'number') ? para.timeout : 0); }
javascript
function JobQueue(para) { this.queue = []; this.curr = 0; this.all_passed = true; this.timeout = ((typeof para === 'object' && typeof para.timeout === 'number') ? para.timeout : 0); }
[ "function", "JobQueue", "(", "para", ")", "{", "this", ".", "queue", "=", "[", "]", ";", "this", ".", "curr", "=", "0", ";", "this", ".", "all_passed", "=", "true", ";", "this", ".", "timeout", "=", "(", "(", "typeof", "para", "===", "'object'", ...
object-based JobQueue functions
[ "object", "-", "based", "JobQueue", "functions" ]
0cf7377d02bf1e6beb90d6821c144eefb89feaa9
https://github.com/imonology/scalra/blob/0cf7377d02bf1e6beb90d6821c144eefb89feaa9/core/job_queue.js#L127-L132
31,292
imonology/scalra
core/job_queue.js
function () { if (item.done === false) { LOG.error('job timeout! please check if the job calls onDone eventually. ' + (item.name ? '[' + item.name + ']' : ''), l_name); // force this job be done onJobDone(false); } }
javascript
function () { if (item.done === false) { LOG.error('job timeout! please check if the job calls onDone eventually. ' + (item.name ? '[' + item.name + ']' : ''), l_name); // force this job be done onJobDone(false); } }
[ "function", "(", ")", "{", "if", "(", "item", ".", "done", "===", "false", ")", "{", "LOG", ".", "error", "(", "'job timeout! please check if the job calls onDone eventually. '", "+", "(", "item", ".", "name", "?", "'['", "+", "item", ".", "name", "+", "']...
if the job does not finish in time
[ "if", "the", "job", "does", "not", "finish", "in", "time" ]
0cf7377d02bf1e6beb90d6821c144eefb89feaa9
https://github.com/imonology/scalra/blob/0cf7377d02bf1e6beb90d6821c144eefb89feaa9/core/job_queue.js#L195-L202
31,293
imonology/scalra
entry/handler.js
function (list) { for (var i=0; i < list.length; i++) { for (var j=0; j < l_entries.length; j++) { if (list[i] === l_entries[j]) { l_entries.splice(j, 1); break; } } } }
javascript
function (list) { for (var i=0; i < list.length; i++) { for (var j=0; j < l_entries.length; j++) { if (list[i] === l_entries[j]) { l_entries.splice(j, 1); break; } } } }
[ "function", "(", "list", ")", "{", "for", "(", "var", "i", "=", "0", ";", "i", "<", "list", ".", "length", ";", "i", "++", ")", "{", "for", "(", "var", "j", "=", "0", ";", "j", "<", "l_entries", ".", "length", ";", "j", "++", ")", "{", "i...
remove entry from list
[ "remove", "entry", "from", "list" ]
0cf7377d02bf1e6beb90d6821c144eefb89feaa9
https://github.com/imonology/scalra/blob/0cf7377d02bf1e6beb90d6821c144eefb89feaa9/entry/handler.js#L29-L39
31,294
imonology/scalra
demo/web/logic.js
getInput
function getInput() { var account = document.getElementById('account').value; var email = (document.getElementById('email') ? document.getElementById('email').value : ''); var password = document.getElementById('password').value; return {account: account, email: email, password: password}; }
javascript
function getInput() { var account = document.getElementById('account').value; var email = (document.getElementById('email') ? document.getElementById('email').value : ''); var password = document.getElementById('password').value; return {account: account, email: email, password: password}; }
[ "function", "getInput", "(", ")", "{", "var", "account", "=", "document", ".", "getElementById", "(", "'account'", ")", ".", "value", ";", "var", "email", "=", "(", "document", ".", "getElementById", "(", "'email'", ")", "?", "document", ".", "getElementBy...
retrieve account & password from HTML elements
[ "retrieve", "account", "&", "password", "from", "HTML", "elements" ]
0cf7377d02bf1e6beb90d6821c144eefb89feaa9
https://github.com/imonology/scalra/blob/0cf7377d02bf1e6beb90d6821c144eefb89feaa9/demo/web/logic.js#L44-L51
31,295
imonology/scalra
handlers/login.js
function (err, data) { if (err) { LOG.warn(err.toString()); } else { for (var server in data.accounts) { LOG.warn('local server: ' + server); var user_list = data.accounts[server]; for (var uid in user_list) { var token = user_list[uid]; LOG.warn('local uid: ' + uid + ' token: ' + tok...
javascript
function (err, data) { if (err) { LOG.warn(err.toString()); } else { for (var server in data.accounts) { LOG.warn('local server: ' + server); var user_list = data.accounts[server]; for (var uid in user_list) { var token = user_list[uid]; LOG.warn('local uid: ' + uid + ' token: ' + tok...
[ "function", "(", "err", ",", "data", ")", "{", "if", "(", "err", ")", "{", "LOG", ".", "warn", "(", "err", ".", "toString", "(", ")", ")", ";", "}", "else", "{", "for", "(", "var", "server", "in", "data", ".", "accounts", ")", "{", "LOG", "."...
get all local accounts & perform login
[ "get", "all", "local", "accounts", "&", "perform", "login" ]
0cf7377d02bf1e6beb90d6821c144eefb89feaa9
https://github.com/imonology/scalra/blob/0cf7377d02bf1e6beb90d6821c144eefb89feaa9/handlers/login.js#L29-L45
31,296
imonology/scalra
handlers/login.js
function (server, uid, token) { try { // convert uid to number if not already if (typeof uid === 'string') uid = parseInt(uid); } catch (e) { LOG.error('uid cannot be parsed as integer...', 'login.send_remote_login'); return false; } SR.User.loginLocal(server, uid, token, function (result) { // NO...
javascript
function (server, uid, token) { try { // convert uid to number if not already if (typeof uid === 'string') uid = parseInt(uid); } catch (e) { LOG.error('uid cannot be parsed as integer...', 'login.send_remote_login'); return false; } SR.User.loginLocal(server, uid, token, function (result) { // NO...
[ "function", "(", "server", ",", "uid", ",", "token", ")", "{", "try", "{", "// convert uid to number if not already", "if", "(", "typeof", "uid", "===", "'string'", ")", "uid", "=", "parseInt", "(", "uid", ")", ";", "}", "catch", "(", "e", ")", "{", "L...
send login info for local server
[ "send", "login", "info", "for", "local", "server" ]
0cf7377d02bf1e6beb90d6821c144eefb89feaa9
https://github.com/imonology/scalra/blob/0cf7377d02bf1e6beb90d6821c144eefb89feaa9/handlers/login.js#L50-L73
31,297
imonology/scalra
handlers/login.js
function (login_id, session, data) { // acknowledge as 'logined' l_loginID[login_id] = data.account; // init session session['_account'] = data.account; // TODO: needs to fix this, should read "groups" from DB session['_groups'] = data.groups; session['_permissions'] = data.permissions; session['lastStatu...
javascript
function (login_id, session, data) { // acknowledge as 'logined' l_loginID[login_id] = data.account; // init session session['_account'] = data.account; // TODO: needs to fix this, should read "groups" from DB session['_groups'] = data.groups; session['_permissions'] = data.permissions; session['lastStatu...
[ "function", "(", "login_id", ",", "session", ",", "data", ")", "{", "// acknowledge as 'logined'\t", "l_loginID", "[", "login_id", "]", "=", "data", ".", "account", ";", "// init session", "session", "[", "'_account'", "]", "=", "data", ".", "account", ";", ...
initialize session content based on registered or logined user data
[ "initialize", "session", "content", "based", "on", "registered", "or", "logined", "user", "data" ]
0cf7377d02bf1e6beb90d6821c144eefb89feaa9
https://github.com/imonology/scalra/blob/0cf7377d02bf1e6beb90d6821c144eefb89feaa9/handlers/login.js#L193-L208
31,298
imonology/scalra
handlers/login.js
function (err, result) { // if login is successful, we record the user's account in cache if (err) { LOG.warn(err.toString()); result = {code: err.code, msg: err.message}; } else { if (result.code === 0) { LOG.warn('login success, result: '); LOG.warn(result); var data = { account: u...
javascript
function (err, result) { // if login is successful, we record the user's account in cache if (err) { LOG.warn(err.toString()); result = {code: err.code, msg: err.message}; } else { if (result.code === 0) { LOG.warn('login success, result: '); LOG.warn(result); var data = { account: u...
[ "function", "(", "err", ",", "result", ")", "{", "// if login is successful, we record the user's account in cache", "if", "(", "err", ")", "{", "LOG", ".", "warn", "(", "err", ".", "toString", "(", ")", ")", ";", "result", "=", "{", "code", ":", "err", "....
otherwise perform local login
[ "otherwise", "perform", "local", "login" ]
0cf7377d02bf1e6beb90d6821c144eefb89feaa9
https://github.com/imonology/scalra/blob/0cf7377d02bf1e6beb90d6821c144eefb89feaa9/handlers/login.js#L320-L379
31,299
imonology/scalra
handlers/login.js
function (arg) { if ( ! arg.allow ){ return; } var exist = false; for (var i in data.allow) { if (data.allow[i] === arg.allow) { exist = true; } } if ( exist === false ) { data.allow[data.allow.length] = arg.allow; } }
javascript
function (arg) { if ( ! arg.allow ){ return; } var exist = false; for (var i in data.allow) { if (data.allow[i] === arg.allow) { exist = true; } } if ( exist === false ) { data.allow[data.allow.length] = arg.allow; } }
[ "function", "(", "arg", ")", "{", "if", "(", "!", "arg", ".", "allow", ")", "{", "return", ";", "}", "var", "exist", "=", "false", ";", "for", "(", "var", "i", "in", "data", ".", "allow", ")", "{", "if", "(", "data", ".", "allow", "[", "i", ...
level exists, to modify this level
[ "level", "exists", "to", "modify", "this", "level" ]
0cf7377d02bf1e6beb90d6821c144eefb89feaa9
https://github.com/imonology/scalra/blob/0cf7377d02bf1e6beb90d6821c144eefb89feaa9/handlers/login.js#L694-L708