repo
stringlengths
5
67
path
stringlengths
4
116
func_name
stringlengths
0
58
original_string
stringlengths
52
373k
language
stringclasses
1 value
code
stringlengths
52
373k
code_tokens
list
docstring
stringlengths
4
11.8k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
86
226
partition
stringclasses
1 value
C2FO/comb
lib/base/string.js
format
function format(str, obj) { if (obj instanceof Array) { var i = 0, len = obj.length; //find the matches return str.replace(FORMAT_REGEX, function (m, format, type) { var replacer, ret; if (i < len) { replacer = obj[i++]; } else { ...
javascript
function format(str, obj) { if (obj instanceof Array) { var i = 0, len = obj.length; //find the matches return str.replace(FORMAT_REGEX, function (m, format, type) { var replacer, ret; if (i < len) { replacer = obj[i++]; } else { ...
[ "function", "format", "(", "str", ",", "obj", ")", "{", "if", "(", "obj", "instanceof", "Array", ")", "{", "var", "i", "=", "0", ",", "len", "=", "obj", ".", "length", ";", "//find the matches", "return", "str", ".", "replace", "(", "FORMAT_REGEX", "...
Formats a string with the specified format Format `String`s ``` comb.string.format("%s", "Hello"); // "Hello" comb.string.format("%10s", "Hello"); // " Hello" comb.string.format("%-10s", "Hello"); // ""Hello "" comb.string.format('%.10s', "Hello"); //".....Hello" comb.string.format('%-!10s', "Hello"); //"Hell...
[ "Formats", "a", "string", "with", "the", "specified", "format" ]
c230d025b5af98a0f6ce07e7d0db0a3fa07f1fb9
https://github.com/C2FO/comb/blob/c230d025b5af98a0f6ce07e7d0db0a3fa07f1fb9/lib/base/string.js#L326-L397
train
C2FO/comb
lib/base/string.js
style
function style(str, options) { var ret = str; if (options) { if (ret instanceof Array) { ret = ret.map(function (s) { return style(s, options); }); } else if (options instanceof Array) { options.forEach(function (option) { ret =...
javascript
function style(str, options) { var ret = str; if (options) { if (ret instanceof Array) { ret = ret.map(function (s) { return style(s, options); }); } else if (options instanceof Array) { options.forEach(function (option) { ret =...
[ "function", "style", "(", "str", ",", "options", ")", "{", "var", "ret", "=", "str", ";", "if", "(", "options", ")", "{", "if", "(", "ret", "instanceof", "Array", ")", "{", "ret", "=", "ret", ".", "map", "(", "function", "(", "s", ")", "{", "re...
Styles a string according to the specified styles. @example //style a string red comb.string.style('myStr', 'red'); //style a string red and bold comb.string.style('myStr', ['red', bold]); @param {String} str The string to style. @param {String|Array} styles the style or styles to apply to a string. options include :...
[ "Styles", "a", "string", "according", "to", "the", "specified", "styles", "." ]
c230d025b5af98a0f6ce07e7d0db0a3fa07f1fb9
https://github.com/C2FO/comb/blob/c230d025b5af98a0f6ce07e7d0db0a3fa07f1fb9/lib/base/string.js#L473-L489
train
C2FO/comb
lib/base/functions.js
applyFirst
function applyFirst(method, args) { args = Array.prototype.slice.call(arguments).slice(1); if (!isString(method) && !isFunction(method)) { throw new Error(method + " must be the name of a property or function to execute"); } if (isString(method)) { return function () { var sc...
javascript
function applyFirst(method, args) { args = Array.prototype.slice.call(arguments).slice(1); if (!isString(method) && !isFunction(method)) { throw new Error(method + " must be the name of a property or function to execute"); } if (isString(method)) { return function () { var sc...
[ "function", "applyFirst", "(", "method", ",", "args", ")", "{", "args", "=", "Array", ".", "prototype", ".", "slice", ".", "call", "(", "arguments", ")", ".", "slice", "(", "1", ")", ";", "if", "(", "!", "isString", "(", "method", ")", "&&", "!", ...
Binds a method to the scope of the first argument. This is useful if you have async actions and you just want to run a method or retrieve a property on the object. ``` var arr = [], push = comb.applyFirst("push"), length = comb.applyFirst("length"); push(arr, 1, 2,3,4); console.log(length(arr)); //4 console.log(arr);...
[ "Binds", "a", "method", "to", "the", "scope", "of", "the", "first", "argument", "." ]
c230d025b5af98a0f6ce07e7d0db0a3fa07f1fb9
https://github.com/C2FO/comb/blob/c230d025b5af98a0f6ce07e7d0db0a3fa07f1fb9/lib/base/functions.js#L97-L120
train
julesfern/spahql
doc-html/src/javascripts/pdoc/prototype.js
each
function each(iterator) { for (var i = 0, length = this.length; i < length; i++) iterator(this[i]); }
javascript
function each(iterator) { for (var i = 0, length = this.length; i < length; i++) iterator(this[i]); }
[ "function", "each", "(", "iterator", ")", "{", "for", "(", "var", "i", "=", "0", ",", "length", "=", "this", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "iterator", "(", "this", "[", "i", "]", ")", ";", "}" ]
use native browser JS 1.6 implementation if available
[ "use", "native", "browser", "JS", "1", ".", "6", "implementation", "if", "available" ]
f2eff34e59f5af2e6a48f11f59f99c223b4a2be8
https://github.com/julesfern/spahql/blob/f2eff34e59f5af2e6a48f11f59f99c223b4a2be8/doc-html/src/javascripts/pdoc/prototype.js#L968-L971
train
C2FO/comb
lib/async.js
asyncForEach
function asyncForEach(promise, iterator, scope, limit) { return asyncArray(asyncLoop(promise, iterator, scope, limit).chain(function (results) { return results.arr; })); }
javascript
function asyncForEach(promise, iterator, scope, limit) { return asyncArray(asyncLoop(promise, iterator, scope, limit).chain(function (results) { return results.arr; })); }
[ "function", "asyncForEach", "(", "promise", ",", "iterator", ",", "scope", ",", "limit", ")", "{", "return", "asyncArray", "(", "asyncLoop", "(", "promise", ",", "iterator", ",", "scope", ",", "limit", ")", ".", "chain", "(", "function", "(", "results", ...
Loops through the results of an promise. The promise can return an array or just a single item. ``` function asyncArr(){ var ret = new comb.Promise(); process.nextTick(ret.callback.bind(ret, [1,2,3,4,5]); return ret.promise; } comb.async.forEach(asyncArr(), function(){ //do something with it }).then(function(arr){ co...
[ "Loops", "through", "the", "results", "of", "an", "promise", ".", "The", "promise", "can", "return", "an", "array", "or", "just", "a", "single", "item", "." ]
c230d025b5af98a0f6ce07e7d0db0a3fa07f1fb9
https://github.com/C2FO/comb/blob/c230d025b5af98a0f6ce07e7d0db0a3fa07f1fb9/lib/async.js#L160-L164
train
C2FO/comb
lib/async.js
asyncMap
function asyncMap(promise, iterator, scope, limit) { return asyncArray(asyncLoop(promise, iterator, scope, limit).chain(function (results) { return results.loopResults; })); }
javascript
function asyncMap(promise, iterator, scope, limit) { return asyncArray(asyncLoop(promise, iterator, scope, limit).chain(function (results) { return results.loopResults; })); }
[ "function", "asyncMap", "(", "promise", ",", "iterator", ",", "scope", ",", "limit", ")", "{", "return", "asyncArray", "(", "asyncLoop", "(", "promise", ",", "iterator", ",", "scope", ",", "limit", ")", ".", "chain", "(", "function", "(", "results", ")",...
Loops through the results of an promise resolving with the return value of the iterator function. The promise can return an array or just a single item. ``` function asyncArr(){ var ret = new comb.Promise(); process.nextTick(ret.callback.bind(ret, [1,2,3,4,5]); return ret.promise; } comb.async.map(asyncArr(), functio...
[ "Loops", "through", "the", "results", "of", "an", "promise", "resolving", "with", "the", "return", "value", "of", "the", "iterator", "function", ".", "The", "promise", "can", "return", "an", "array", "or", "just", "a", "single", "item", "." ]
c230d025b5af98a0f6ce07e7d0db0a3fa07f1fb9
https://github.com/C2FO/comb/blob/c230d025b5af98a0f6ce07e7d0db0a3fa07f1fb9/lib/async.js#L209-L213
train
C2FO/comb
lib/async.js
asyncFilter
function asyncFilter(promise, iterator, scope, limit) { return asyncArray(asyncLoop(promise, iterator, scope, limit).chain(function (results) { var loopResults = results.loopResults, resultArr = results.arr; return (isArray(resultArr) ? resultArr : [resultArr]).filter(function (res, i) { ...
javascript
function asyncFilter(promise, iterator, scope, limit) { return asyncArray(asyncLoop(promise, iterator, scope, limit).chain(function (results) { var loopResults = results.loopResults, resultArr = results.arr; return (isArray(resultArr) ? resultArr : [resultArr]).filter(function (res, i) { ...
[ "function", "asyncFilter", "(", "promise", ",", "iterator", ",", "scope", ",", "limit", ")", "{", "return", "asyncArray", "(", "asyncLoop", "(", "promise", ",", "iterator", ",", "scope", ",", "limit", ")", ".", "chain", "(", "function", "(", "results", "...
Loops through the results of an promise resolving with the filtered array. The promise can return an array or just a single item. ``` function asyncArr(){ var ret = new comb.Promise(); process.nextTick(ret.callback.bind(ret, [1,2,3,4,5]); return ret.promise; } comb.async.filter(asyncArr(), function(item){ return item...
[ "Loops", "through", "the", "results", "of", "an", "promise", "resolving", "with", "the", "filtered", "array", ".", "The", "promise", "can", "return", "an", "array", "or", "just", "a", "single", "item", "." ]
c230d025b5af98a0f6ce07e7d0db0a3fa07f1fb9
https://github.com/C2FO/comb/blob/c230d025b5af98a0f6ce07e7d0db0a3fa07f1fb9/lib/async.js#L258-L265
train
C2FO/comb
lib/async.js
asyncEvery
function asyncEvery(promise, iterator, scope, limit) { return asyncArray(asyncLoop(promise, iterator, scope, limit).chain(function (results) { return results.loopResults.every(function (res) { return !!res; }); })); }
javascript
function asyncEvery(promise, iterator, scope, limit) { return asyncArray(asyncLoop(promise, iterator, scope, limit).chain(function (results) { return results.loopResults.every(function (res) { return !!res; }); })); }
[ "function", "asyncEvery", "(", "promise", ",", "iterator", ",", "scope", ",", "limit", ")", "{", "return", "asyncArray", "(", "asyncLoop", "(", "promise", ",", "iterator", ",", "scope", ",", "limit", ")", ".", "chain", "(", "function", "(", "results", ")...
Loops through the results of an promise resolving with true if every item passed, false otherwise. The promise can return an array or just a single item. ``` function asyncArr(){ var ret = new comb.Promise(); process.nextTick(ret.callback.bind(ret, [1,2,3,4,5]); return ret.promise; } comb.async.every(asyncArr(), func...
[ "Loops", "through", "the", "results", "of", "an", "promise", "resolving", "with", "true", "if", "every", "item", "passed", "false", "otherwise", ".", "The", "promise", "can", "return", "an", "array", "or", "just", "a", "single", "item", "." ]
c230d025b5af98a0f6ce07e7d0db0a3fa07f1fb9
https://github.com/C2FO/comb/blob/c230d025b5af98a0f6ce07e7d0db0a3fa07f1fb9/lib/async.js#L310-L316
train
C2FO/comb
lib/async.js
asyncSome
function asyncSome(promise, iterator, scope, limit) { return asyncArray(asyncLoop(promise, iterator, scope, limit).chain(function (results) { return results.loopResults.some(function (res) { return !!res; }); })); }
javascript
function asyncSome(promise, iterator, scope, limit) { return asyncArray(asyncLoop(promise, iterator, scope, limit).chain(function (results) { return results.loopResults.some(function (res) { return !!res; }); })); }
[ "function", "asyncSome", "(", "promise", ",", "iterator", ",", "scope", ",", "limit", ")", "{", "return", "asyncArray", "(", "asyncLoop", "(", "promise", ",", "iterator", ",", "scope", ",", "limit", ")", ".", "chain", "(", "function", "(", "results", ")"...
Loops through the results of an promise resolving with true if some items passed, false otherwise. The promise can return an array or just a single item. ``` function asyncArr(){ var ret = new comb.Promise(); process.nextTick(ret.callback.bind(ret, [1,2,3,4,5]); return ret.promise; } comb.async.some(asyncArr(), funct...
[ "Loops", "through", "the", "results", "of", "an", "promise", "resolving", "with", "true", "if", "some", "items", "passed", "false", "otherwise", ".", "The", "promise", "can", "return", "an", "array", "or", "just", "a", "single", "item", "." ]
c230d025b5af98a0f6ce07e7d0db0a3fa07f1fb9
https://github.com/C2FO/comb/blob/c230d025b5af98a0f6ce07e7d0db0a3fa07f1fb9/lib/async.js#L360-L366
train
C2FO/comb
lib/async.js
asyncZip
function asyncZip() { return asyncArray(when.apply(null, argsToArray(arguments)).chain(function (result) { return zip.apply(array, normalizeResult(result).map(function (arg) { return isArray(arg) ? arg : [arg]; })); })); }
javascript
function asyncZip() { return asyncArray(when.apply(null, argsToArray(arguments)).chain(function (result) { return zip.apply(array, normalizeResult(result).map(function (arg) { return isArray(arg) ? arg : [arg]; })); })); }
[ "function", "asyncZip", "(", ")", "{", "return", "asyncArray", "(", "when", ".", "apply", "(", "null", ",", "argsToArray", "(", "arguments", ")", ")", ".", "chain", "(", "function", "(", "result", ")", "{", "return", "zip", ".", "apply", "(", "array", ...
Zips results from promises into an array. ``` function asyncArr(){ var ret = new comb.Promise(); process.nextTick(ret.callback.bind(ret, [1,2,3,4,5]); return ret.promise; } comb.async.zip(asyncArr(), asyncArr()).then(function(zipped){ console.log(zipped); //[[1,1],[2,2],[3,3], [4,4], [5,5]] }); comb.async.array(asyn...
[ "Zips", "results", "from", "promises", "into", "an", "array", "." ]
c230d025b5af98a0f6ce07e7d0db0a3fa07f1fb9
https://github.com/C2FO/comb/blob/c230d025b5af98a0f6ce07e7d0db0a3fa07f1fb9/lib/async.js#L394-L400
train
peerlibrary/node-xml4js
lib/validator.js
function (namespaces, defaultNamespace, name) { var self = this; assert(namespaces); assert(name); if (/^\{.+\}/.test(name)) { return name; } else if (/:/.test(name)) { var parts = name.split(':'); assert(parts.length === 2, parts); if (!namespaces[parts[0]]) { t...
javascript
function (namespaces, defaultNamespace, name) { var self = this; assert(namespaces); assert(name); if (/^\{.+\}/.test(name)) { return name; } else if (/:/.test(name)) { var parts = name.split(':'); assert(parts.length === 2, parts); if (!namespaces[parts[0]]) { t...
[ "function", "(", "namespaces", ",", "defaultNamespace", ",", "name", ")", "{", "var", "self", "=", "this", ";", "assert", "(", "namespaces", ")", ";", "assert", "(", "name", ")", ";", "if", "(", "/", "^\\{.+\\}", "/", ".", "test", "(", "name", ")", ...
Similar to XsdSchema.namespacedName, just using arguments
[ "Similar", "to", "XsdSchema", ".", "namespacedName", "just", "using", "arguments" ]
fe24c3105c3a22e7285443af364fab9dea2d7ed8
https://github.com/peerlibrary/node-xml4js/blob/fe24c3105c3a22e7285443af364fab9dea2d7ed8/lib/validator.js#L266-L288
train
PatrickJS/angular-intercom
angular-intercom.js
createScript
function createScript(url, appID) { if (!document) { return; } var script = document.createElement('script'); script.type = 'text/javascript'; script.async = true; script.src = url+appID; // Attach the script tag to the document head var s = document.getElementsByTagName('head')[0]; s.ap...
javascript
function createScript(url, appID) { if (!document) { return; } var script = document.createElement('script'); script.type = 'text/javascript'; script.async = true; script.src = url+appID; // Attach the script tag to the document head var s = document.getElementsByTagName('head')[0]; s.ap...
[ "function", "createScript", "(", "url", ",", "appID", ")", "{", "if", "(", "!", "document", ")", "{", "return", ";", "}", "var", "script", "=", "document", ".", "createElement", "(", "'script'", ")", ";", "script", ".", "type", "=", "'text/javascript'", ...
Create a script tag with moment as the source and call our onScriptLoad callback when it has been loaded
[ "Create", "a", "script", "tag", "with", "moment", "as", "the", "source", "and", "call", "our", "onScriptLoad", "callback", "when", "it", "has", "been", "loaded" ]
60198a6c5abb1a388a3582e43b0255e9c6b3666e
https://github.com/PatrickJS/angular-intercom/blob/60198a6c5abb1a388a3582e43b0255e9c6b3666e/angular-intercom.js#L62-L71
train
ClickerMonkey/SemanticUI-Angular
angular-semantic-ui.js
function() { if ( !(scope.model instanceof Array) ) { scope.model = scope.model ? [ scope.model ] : []; } return scope.model; }
javascript
function() { if ( !(scope.model instanceof Array) ) { scope.model = scope.model ? [ scope.model ] : []; } return scope.model; }
[ "function", "(", ")", "{", "if", "(", "!", "(", "scope", ".", "model", "instanceof", "Array", ")", ")", "{", "scope", ".", "model", "=", "scope", ".", "model", "?", "[", "scope", ".", "model", "]", ":", "[", "]", ";", "}", "return", "scope", "....
Returns the model on the scope, converting it to an array if it's not one.
[ "Returns", "the", "model", "on", "the", "scope", "converting", "it", "to", "an", "array", "if", "it", "s", "not", "one", "." ]
b4b89a288535e56d61c3c8e86e47b84495d5d76d
https://github.com/ClickerMonkey/SemanticUI-Angular/blob/b4b89a288535e56d61c3c8e86e47b84495d5d76d/angular-semantic-ui.js#L1328-L1333
train
ClickerMonkey/SemanticUI-Angular
angular-semantic-ui.js
SemanticPopup
function SemanticPopup(SemanticPopupLink) { return { restrict: 'A', scope: { /* Required */ smPopup: '=', /* Optional */ smPopupTitle: '=', smPopupHtml: '=', smPopupPosition: '@', smPopupVariation: '@', smPopupSettings: '=', smP...
javascript
function SemanticPopup(SemanticPopupLink) { return { restrict: 'A', scope: { /* Required */ smPopup: '=', /* Optional */ smPopupTitle: '=', smPopupHtml: '=', smPopupPosition: '@', smPopupVariation: '@', smPopupSettings: '=', smP...
[ "function", "SemanticPopup", "(", "SemanticPopupLink", ")", "{", "return", "{", "restrict", ":", "'A'", ",", "scope", ":", "{", "/* Required */", "smPopup", ":", "'='", ",", "/* Optional */", "smPopupTitle", ":", "'='", ",", "smPopupHtml", ":", "'='", ",", "...
An attribute directive which displays a popup for this element.
[ "An", "attribute", "directive", "which", "displays", "a", "popup", "for", "this", "element", "." ]
b4b89a288535e56d61c3c8e86e47b84495d5d76d
https://github.com/ClickerMonkey/SemanticUI-Angular/blob/b4b89a288535e56d61c3c8e86e47b84495d5d76d/angular-semantic-ui.js#L1856-L1883
train
ClickerMonkey/SemanticUI-Angular
angular-semantic-ui.js
SemanticPopupInline
function SemanticPopupInline(SemanticPopupInlineLink) { return { restrict: 'A', scope: { /* Optional */ smPopupInline: '=', smPopupInlineOnInit: '=', /* Events */ smPopupInlineOnCreate: '=', smPopupInlineOnRemove: '=', smPopupInlineOnShow: '=',...
javascript
function SemanticPopupInline(SemanticPopupInlineLink) { return { restrict: 'A', scope: { /* Optional */ smPopupInline: '=', smPopupInlineOnInit: '=', /* Events */ smPopupInlineOnCreate: '=', smPopupInlineOnRemove: '=', smPopupInlineOnShow: '=',...
[ "function", "SemanticPopupInline", "(", "SemanticPopupInlineLink", ")", "{", "return", "{", "restrict", ":", "'A'", ",", "scope", ":", "{", "/* Optional */", "smPopupInline", ":", "'='", ",", "smPopupInlineOnInit", ":", "'='", ",", "/* Events */", "smPopupInlineOnCr...
An attribute directive to show the detached popup which follows this element.
[ "An", "attribute", "directive", "to", "show", "the", "detached", "popup", "which", "follows", "this", "element", "." ]
b4b89a288535e56d61c3c8e86e47b84495d5d76d
https://github.com/ClickerMonkey/SemanticUI-Angular/blob/b4b89a288535e56d61c3c8e86e47b84495d5d76d/angular-semantic-ui.js#L1918-L1939
train
ClickerMonkey/SemanticUI-Angular
angular-semantic-ui.js
SemanticPopupDisplay
function SemanticPopupDisplay(SemanticPopupDisplayLink) { return { restrict: 'A', scope: { /* Required */ smPopupDisplay: '@', /* Optional */ smPopupDisplaySettings: '=', smPopupDisplayOnInit: '=', /* Events */ smPopupDisplayOnCreate: '=', ...
javascript
function SemanticPopupDisplay(SemanticPopupDisplayLink) { return { restrict: 'A', scope: { /* Required */ smPopupDisplay: '@', /* Optional */ smPopupDisplaySettings: '=', smPopupDisplayOnInit: '=', /* Events */ smPopupDisplayOnCreate: '=', ...
[ "function", "SemanticPopupDisplay", "(", "SemanticPopupDisplayLink", ")", "{", "return", "{", "restrict", ":", "'A'", ",", "scope", ":", "{", "/* Required */", "smPopupDisplay", ":", "'@'", ",", "/* Optional */", "smPopupDisplaySettings", ":", "'='", ",", "smPopupDi...
An attribute directive to show a detached popup over this element given it's name.
[ "An", "attribute", "directive", "to", "show", "a", "detached", "popup", "over", "this", "element", "given", "it", "s", "name", "." ]
b4b89a288535e56d61c3c8e86e47b84495d5d76d
https://github.com/ClickerMonkey/SemanticUI-Angular/blob/b4b89a288535e56d61c3c8e86e47b84495d5d76d/angular-semantic-ui.js#L1969-L1992
train
dvdln/jsonpath-object-transform
lib/jsonpath-object-transform.js
walk
function walk(data, path, result, key) { var fn; switch (type(path)) { case 'string': fn = seekSingle; break; case 'array': fn = seekArray; break; case 'object': fn = seekObject; break; } if (fn) { fn(data, path, result, key); ...
javascript
function walk(data, path, result, key) { var fn; switch (type(path)) { case 'string': fn = seekSingle; break; case 'array': fn = seekArray; break; case 'object': fn = seekObject; break; } if (fn) { fn(data, path, result, key); ...
[ "function", "walk", "(", "data", ",", "path", ",", "result", ",", "key", ")", "{", "var", "fn", ";", "switch", "(", "type", "(", "path", ")", ")", "{", "case", "'string'", ":", "fn", "=", "seekSingle", ";", "break", ";", "case", "'array'", ":", "...
Step through data object and apply path transforms. @param {object} data @param {object} path @param {object} result @param {string} key
[ "Step", "through", "data", "object", "and", "apply", "path", "transforms", "." ]
e33f4f143976db3c2a52439ff42a5e1982e2defe
https://github.com/dvdln/jsonpath-object-transform/blob/e33f4f143976db3c2a52439ff42a5e1982e2defe/lib/jsonpath-object-transform.js#L34-L54
train
dvdln/jsonpath-object-transform
lib/jsonpath-object-transform.js
seekSingle
function seekSingle(data, pathStr, result, key) { if(pathStr.indexOf('$') < 0){ result[key] = pathStr; }else{ var seek = jsonPath.eval(data, pathStr) || []; result[key] = seek.length ? seek[0] : undefined; } }
javascript
function seekSingle(data, pathStr, result, key) { if(pathStr.indexOf('$') < 0){ result[key] = pathStr; }else{ var seek = jsonPath.eval(data, pathStr) || []; result[key] = seek.length ? seek[0] : undefined; } }
[ "function", "seekSingle", "(", "data", ",", "pathStr", ",", "result", ",", "key", ")", "{", "if", "(", "pathStr", ".", "indexOf", "(", "'$'", ")", "<", "0", ")", "{", "result", "[", "key", "]", "=", "pathStr", ";", "}", "else", "{", "var", "seek"...
Get single property from data object. @param {object} data @param {string} pathStr @param {object} result @param {string} key
[ "Get", "single", "property", "from", "data", "object", "." ]
e33f4f143976db3c2a52439ff42a5e1982e2defe
https://github.com/dvdln/jsonpath-object-transform/blob/e33f4f143976db3c2a52439ff42a5e1982e2defe/lib/jsonpath-object-transform.js#L74-L82
train
dvdln/jsonpath-object-transform
lib/jsonpath-object-transform.js
seekArray
function seekArray(data, pathArr, result, key) { var subpath = pathArr[1]; var path = pathArr[0]; var seek = jsonPath.eval(data, path) || []; if (seek.length && subpath) { result = result[key] = []; seek[0].forEach(function(item, index) { walk(item, subpath, result, index); }...
javascript
function seekArray(data, pathArr, result, key) { var subpath = pathArr[1]; var path = pathArr[0]; var seek = jsonPath.eval(data, path) || []; if (seek.length && subpath) { result = result[key] = []; seek[0].forEach(function(item, index) { walk(item, subpath, result, index); }...
[ "function", "seekArray", "(", "data", ",", "pathArr", ",", "result", ",", "key", ")", "{", "var", "subpath", "=", "pathArr", "[", "1", "]", ";", "var", "path", "=", "pathArr", "[", "0", "]", ";", "var", "seek", "=", "jsonPath", ".", "eval", "(", ...
Get array of properties from data object. @param {object} data @param {array} pathArr @param {object} result @param {string} key
[ "Get", "array", "of", "properties", "from", "data", "object", "." ]
e33f4f143976db3c2a52439ff42a5e1982e2defe
https://github.com/dvdln/jsonpath-object-transform/blob/e33f4f143976db3c2a52439ff42a5e1982e2defe/lib/jsonpath-object-transform.js#L92-L106
train
dvdln/jsonpath-object-transform
lib/jsonpath-object-transform.js
seekObject
function seekObject(data, pathObj, result, key) { if (typeof key !== 'undefined') { result = result[key] = {}; } Object.keys(pathObj).forEach(function(name) { walk(data, pathObj[name], result, name); }); }
javascript
function seekObject(data, pathObj, result, key) { if (typeof key !== 'undefined') { result = result[key] = {}; } Object.keys(pathObj).forEach(function(name) { walk(data, pathObj[name], result, name); }); }
[ "function", "seekObject", "(", "data", ",", "pathObj", ",", "result", ",", "key", ")", "{", "if", "(", "typeof", "key", "!==", "'undefined'", ")", "{", "result", "=", "result", "[", "key", "]", "=", "{", "}", ";", "}", "Object", ".", "keys", "(", ...
Get object property from data object. @param {object} data @param {object} pathObj @param {object} result @param {string} key
[ "Get", "object", "property", "from", "data", "object", "." ]
e33f4f143976db3c2a52439ff42a5e1982e2defe
https://github.com/dvdln/jsonpath-object-transform/blob/e33f4f143976db3c2a52439ff42a5e1982e2defe/lib/jsonpath-object-transform.js#L116-L124
train
mixmaxhq/electron-editor-context-menu
src/index.js
function(selection, mainTemplate, suggestionsTemplate) { selection = defaults({}, selection, { isMisspelled: false, spellingSuggestions: [] }); var template = getTemplate(mainTemplate, DEFAULT_MAIN_TPL); var suggestionsTpl = getTemplate(suggestionsTemplate, DEFAULT_SUGGESTIONS_TPL); if (selection.i...
javascript
function(selection, mainTemplate, suggestionsTemplate) { selection = defaults({}, selection, { isMisspelled: false, spellingSuggestions: [] }); var template = getTemplate(mainTemplate, DEFAULT_MAIN_TPL); var suggestionsTpl = getTemplate(suggestionsTemplate, DEFAULT_SUGGESTIONS_TPL); if (selection.i...
[ "function", "(", "selection", ",", "mainTemplate", ",", "suggestionsTemplate", ")", "{", "selection", "=", "defaults", "(", "{", "}", ",", "selection", ",", "{", "isMisspelled", ":", "false", ",", "spellingSuggestions", ":", "[", "]", "}", ")", ";", "var",...
Builds a context menu suitable for showing in a text editor. @param {Object=} selection - An object describing the current text selection. @property {Boolean=false} isMisspelled - `true` if the selection is misspelled, `false` if it is spelled correctly or is not text. @property {Array<String>=[]} spellingSuggestions ...
[ "Builds", "a", "context", "menu", "suitable", "for", "showing", "in", "a", "text", "editor", "." ]
dbb3474f0767304a7fb5a7f50e36c0b34ef1de03
https://github.com/mixmaxhq/electron-editor-context-menu/blob/dbb3474f0767304a7fb5a7f50e36c0b34ef1de03/src/index.js#L83-L112
train
xdenser/node-firebird-libfbclient
samples/fileman/static/elfinder/elfinder.full.js
resize
function resize(w, h) { w && self.view.win.width(w); h && self.view.nav.add(self.view.cwd).height(h); }
javascript
function resize(w, h) { w && self.view.win.width(w); h && self.view.nav.add(self.view.cwd).height(h); }
[ "function", "resize", "(", "w", ",", "h", ")", "{", "w", "&&", "self", ".", "view", ".", "win", ".", "width", "(", "w", ")", ";", "h", "&&", "self", ".", "view", ".", "nav", ".", "add", "(", "self", ".", "view", ".", "cwd", ")", ".", "heigh...
Resize file manager @param Number width @param Number height
[ "Resize", "file", "manager" ]
455c5e023b979d68e41ef8946dbdc9abd0a6e2d0
https://github.com/xdenser/node-firebird-libfbclient/blob/455c5e023b979d68e41ef8946dbdc9abd0a6e2d0/samples/fileman/static/elfinder/elfinder.full.js#L550-L553
train
xdenser/node-firebird-libfbclient
samples/fileman/static/elfinder/elfinder.full.js
dialogResize
function dialogResize() { resize(null, self.dialog.height()-self.view.tlb.parent().height()-($.browser.msie ? 47 : 32)) }
javascript
function dialogResize() { resize(null, self.dialog.height()-self.view.tlb.parent().height()-($.browser.msie ? 47 : 32)) }
[ "function", "dialogResize", "(", ")", "{", "resize", "(", "null", ",", "self", ".", "dialog", ".", "height", "(", ")", "-", "self", ".", "view", ".", "tlb", ".", "parent", "(", ")", ".", "height", "(", ")", "-", "(", "$", ".", "browser", ".", "...
Resize file manager in dialog window while it resize
[ "Resize", "file", "manager", "in", "dialog", "window", "while", "it", "resize" ]
455c5e023b979d68e41ef8946dbdc9abd0a6e2d0
https://github.com/xdenser/node-firebird-libfbclient/blob/455c5e023b979d68e41ef8946dbdc9abd0a6e2d0/samples/fileman/static/elfinder/elfinder.full.js#L559-L561
train
xdenser/node-firebird-libfbclient
samples/fileman/static/elfinder/elfinder.full.js
reset
function reset() { self.media.hide().empty(); self.win.attr('class', 'el-finder-ql').css('z-index', self.fm.zIndex); self.title.empty(); self.ico.removeAttr('style').show(); self.add.hide().empty(); self._hash = ''; }
javascript
function reset() { self.media.hide().empty(); self.win.attr('class', 'el-finder-ql').css('z-index', self.fm.zIndex); self.title.empty(); self.ico.removeAttr('style').show(); self.add.hide().empty(); self._hash = ''; }
[ "function", "reset", "(", ")", "{", "self", ".", "media", ".", "hide", "(", ")", ".", "empty", "(", ")", ";", "self", ".", "win", ".", "attr", "(", "'class'", ",", "'el-finder-ql'", ")", ".", "css", "(", "'z-index'", ",", "self", ".", "fm", ".", ...
Clean quickLook window DOM elements
[ "Clean", "quickLook", "window", "DOM", "elements" ]
455c5e023b979d68e41ef8946dbdc9abd0a6e2d0
https://github.com/xdenser/node-firebird-libfbclient/blob/455c5e023b979d68e41ef8946dbdc9abd0a6e2d0/samples/fileman/static/elfinder/elfinder.full.js#L2728-L2735
train
xdenser/node-firebird-libfbclient
samples/fileman/static/elfinder/elfinder.full.js
update
function update() { var f = self.fm.getSelected(0); reset(); self._hash = f.hash; self.title.text(f.name); self.win.addClass(self.fm.view.mime2class(f.mime)); self.name.text(f.name); self.kind.text(self.fm.view.mime2kind(f.link ? 'symlink' : f.mime)); self.size.text(self.fm.view.formatSize(f.size)); ...
javascript
function update() { var f = self.fm.getSelected(0); reset(); self._hash = f.hash; self.title.text(f.name); self.win.addClass(self.fm.view.mime2class(f.mime)); self.name.text(f.name); self.kind.text(self.fm.view.mime2kind(f.link ? 'symlink' : f.mime)); self.size.text(self.fm.view.formatSize(f.size)); ...
[ "function", "update", "(", ")", "{", "var", "f", "=", "self", ".", "fm", ".", "getSelected", "(", "0", ")", ";", "reset", "(", ")", ";", "self", ".", "_hash", "=", "f", ".", "hash", ";", "self", ".", "title", ".", "text", "(", "f", ".", "name...
Update quickLook window content
[ "Update", "quickLook", "window", "content" ]
455c5e023b979d68e41ef8946dbdc9abd0a6e2d0
https://github.com/xdenser/node-firebird-libfbclient/blob/455c5e023b979d68e41ef8946dbdc9abd0a6e2d0/samples/fileman/static/elfinder/elfinder.full.js#L2740-L2769
train
xdenser/node-firebird-libfbclient
samples/fileman/static/elfinder/elfinder.full.js
moveSelection
function moveSelection(forward, reset) { var p, _p, cur; if (!$('[key]', self.cwd).length) { return; } if (self.fm.selected.length == 0) { p = $('[key]:'+(forward ? 'first' : 'last'), self.cwd); self.fm.select(p); } else if (reset) { p = $('.ui-selected:'+(forward ? 'last' : 'first'), self....
javascript
function moveSelection(forward, reset) { var p, _p, cur; if (!$('[key]', self.cwd).length) { return; } if (self.fm.selected.length == 0) { p = $('[key]:'+(forward ? 'first' : 'last'), self.cwd); self.fm.select(p); } else if (reset) { p = $('.ui-selected:'+(forward ? 'last' : 'first'), self....
[ "function", "moveSelection", "(", "forward", ",", "reset", ")", "{", "var", "p", ",", "_p", ",", "cur", ";", "if", "(", "!", "$", "(", "'[key]'", ",", "self", ".", "cwd", ")", ".", "length", ")", "{", "return", ";", "}", "if", "(", "self", ".",...
Move selection in current dir @param Boolean move forward? @param Boolean clear current selection?
[ "Move", "selection", "in", "current", "dir" ]
455c5e023b979d68e41ef8946dbdc9abd0a6e2d0
https://github.com/xdenser/node-firebird-libfbclient/blob/455c5e023b979d68e41ef8946dbdc9abd0a6e2d0/samples/fileman/static/elfinder/elfinder.full.js#L3277-L3327
train
DevExpress/testcafe-legacy-api
src/compiler/tools/uglify-js/lib/consolidator.js
function(oExpression, sIdentifierName) { fCountPrimaryExpression( EPrimaryExpressionCategories.N_IDENTIFIER_NAMES, EValuePrefixes.S_STRING + sIdentifierName); return ['dot', oWalker.walk(oExpression), sIdentifierName]; }
javascript
function(oExpression, sIdentifierName) { fCountPrimaryExpression( EPrimaryExpressionCategories.N_IDENTIFIER_NAMES, EValuePrefixes.S_STRING + sIdentifierName); return ['dot', oWalker.walk(oExpression), sIdentifierName]; }
[ "function", "(", "oExpression", ",", "sIdentifierName", ")", "{", "fCountPrimaryExpression", "(", "EPrimaryExpressionCategories", ".", "N_IDENTIFIER_NAMES", ",", "EValuePrefixes", ".", "S_STRING", "+", "sIdentifierName", ")", ";", "return", "[", "'dot'", ",", "oWalker...
Increments the count of the number of occurrences of the String value that is equivalent to the sequence of terminal symbols that constitute the encountered identifier name. @param {!TSyntacticCodeUnit} oExpression The nonterminal MemberExpression. @param {string} sIdentifierName The identifier name used as the propert...
[ "Increments", "the", "count", "of", "the", "number", "of", "occurrences", "of", "the", "String", "value", "that", "is", "equivalent", "to", "the", "sequence", "of", "terminal", "symbols", "that", "constitute", "the", "encountered", "identifier", "name", "." ]
97c5dcfe46fb6a43efd2cc571bb1aa8c654c1947
https://github.com/DevExpress/testcafe-legacy-api/blob/97c5dcfe46fb6a43efd2cc571bb1aa8c654c1947/src/compiler/tools/uglify-js/lib/consolidator.js#L401-L406
train
DevExpress/testcafe-legacy-api
src/compiler/tools/uglify-js/lib/consolidator.js
function(oExpression, sIdentifierName) { /** * The prefixed String value that is equivalent to the * sequence of terminal symbols that constitute the * encountered identifier name. * @type {string} */ ...
javascript
function(oExpression, sIdentifierName) { /** * The prefixed String value that is equivalent to the * sequence of terminal symbols that constitute the * encountered identifier name. * @type {string} */ ...
[ "function", "(", "oExpression", ",", "sIdentifierName", ")", "{", "/**\n * The prefixed String value that is equivalent to the\n * sequence of terminal symbols that constitute the\n * encountered identifier name.\n * @type {st...
If the String value that is equivalent to the sequence of terminal symbols that constitute the encountered identifier name is worthwhile, a syntactic conversion from the dot notation to the bracket notation ensues with that sequence being substituted by an identifier name to which the value is assigned. Applies to prop...
[ "If", "the", "String", "value", "that", "is", "equivalent", "to", "the", "sequence", "of", "terminal", "symbols", "that", "constitute", "the", "encountered", "identifier", "name", "is", "worthwhile", "a", "syntactic", "conversion", "from", "the", "dot", "notatio...
97c5dcfe46fb6a43efd2cc571bb1aa8c654c1947
https://github.com/DevExpress/testcafe-legacy-api/blob/97c5dcfe46fb6a43efd2cc571bb1aa8c654c1947/src/compiler/tools/uglify-js/lib/consolidator.js#L685-L702
train
DevExpress/testcafe-legacy-api
src/compiler/tools/uglify-js/lib/consolidator.js
function(sIdentifier) { /** * The prefixed representation String of the identifier. * @type {string} */ var sPrefixed = EValuePrefixes.S_SYMBOLIC + sIdentifier; return [ 'name', ...
javascript
function(sIdentifier) { /** * The prefixed representation String of the identifier. * @type {string} */ var sPrefixed = EValuePrefixes.S_SYMBOLIC + sIdentifier; return [ 'name', ...
[ "function", "(", "sIdentifier", ")", "{", "/**\n * The prefixed representation String of the identifier.\n * @type {string}\n */", "var", "sPrefixed", "=", "EValuePrefixes", ".", "S_SYMBOLIC", "+", "sIdentifier", ";", "return", ...
If the encountered identifier is a null or Boolean literal and its value is worthwhile, the identifier is substituted by an identifier name to which that value is assigned. Applies to identifier names. @param {string} sIdentifier The identifier encountered. @return {!Array} A syntactic code unit that is equivalent to t...
[ "If", "the", "encountered", "identifier", "is", "a", "null", "or", "Boolean", "literal", "and", "its", "value", "is", "worthwhile", "the", "identifier", "is", "substituted", "by", "an", "identifier", "name", "to", "which", "that", "value", "is", "assigned", ...
97c5dcfe46fb6a43efd2cc571bb1aa8c654c1947
https://github.com/DevExpress/testcafe-legacy-api/blob/97c5dcfe46fb6a43efd2cc571bb1aa8c654c1947/src/compiler/tools/uglify-js/lib/consolidator.js#L713-L727
train
DevExpress/testcafe-legacy-api
src/compiler/tools/uglify-js/lib/consolidator.js
function(sStringValue) { /** * The prefixed representation String of the primitive value * of the literal. * @type {string} */ var sPrefixed = EValuePrefixes.S_STRING + sStringVal...
javascript
function(sStringValue) { /** * The prefixed representation String of the primitive value * of the literal. * @type {string} */ var sPrefixed = EValuePrefixes.S_STRING + sStringVal...
[ "function", "(", "sStringValue", ")", "{", "/**\n * The prefixed representation String of the primitive value\n * of the literal.\n * @type {string}\n */", "var", "sPrefixed", "=", "EValuePrefixes", ".", "S_STRING", ...
If the encountered String value is worthwhile, it is substituted by an identifier name to which that value is assigned. Applies to String values. @param {string} sStringValue The String value of the string literal encountered. @return {!Array} A syntactic code unit that is equivalent to the one encountered. @see TPrimi...
[ "If", "the", "encountered", "String", "value", "is", "worthwhile", "it", "is", "substituted", "by", "an", "identifier", "name", "to", "which", "that", "value", "is", "assigned", ".", "Applies", "to", "String", "values", "." ]
97c5dcfe46fb6a43efd2cc571bb1aa8c654c1947
https://github.com/DevExpress/testcafe-legacy-api/blob/97c5dcfe46fb6a43efd2cc571bb1aa8c654c1947/src/compiler/tools/uglify-js/lib/consolidator.js#L739-L754
train
iVis-at-Bilkent/cytoscape.js-grid-guide
src/alignment.js
moveTopDown
function moveTopDown(node, dx, dy) { var nodes = node.union(node.descendants()); nodes.filter(":childless").positions(function (node, i) { if(typeof node === "number") { node = i; } var pos = node.position(); return { x: pos....
javascript
function moveTopDown(node, dx, dy) { var nodes = node.union(node.descendants()); nodes.filter(":childless").positions(function (node, i) { if(typeof node === "number") { node = i; } var pos = node.position(); return { x: pos....
[ "function", "moveTopDown", "(", "node", ",", "dx", ",", "dy", ")", "{", "var", "nodes", "=", "node", ".", "union", "(", "node", ".", "descendants", "(", ")", ")", ";", "nodes", ".", "filter", "(", "\":childless\"", ")", ".", "positions", "(", "functi...
Needed because parent nodes cannot be moved in Cytoscape.js < v3.2
[ "Needed", "because", "parent", "nodes", "cannot", "be", "moved", "in", "Cytoscape", ".", "js", "<", "v3", ".", "2" ]
9649d89aafd702b097456adccdcf0395a818907d
https://github.com/iVis-at-Bilkent/cytoscape.js-grid-guide/blob/9649d89aafd702b097456adccdcf0395a818907d/src/alignment.js#L4-L17
train
forsigner/node-pngdefry
lib/index.js
getOutputDir
function getOutputDir(output) { var arr = output.split(path.sep); arr.pop(); return arr.join(path.sep); }
javascript
function getOutputDir(output) { var arr = output.split(path.sep); arr.pop(); return arr.join(path.sep); }
[ "function", "getOutputDir", "(", "output", ")", "{", "var", "arr", "=", "output", ".", "split", "(", "path", ".", "sep", ")", ";", "arr", ".", "pop", "(", ")", ";", "return", "arr", ".", "join", "(", "path", ".", "sep", ")", ";", "}" ]
get output directory from original output @param {string} output @return {string} outputDir @private
[ "get", "output", "directory", "from", "original", "output" ]
a6c0e501afb36b11af3db8f5afa59bfed71377a8
https://github.com/forsigner/node-pngdefry/blob/a6c0e501afb36b11af3db8f5afa59bfed71377a8/lib/index.js#L31-L35
train
forsigner/node-pngdefry
lib/index.js
getOutputFilePath
function getOutputFilePath(input, outputDir, suffix) { var inputArr = input.split(path.sep); var originFileName = inputArr[inputArr.length - 1]; var newFileName = originFileName.replace(/\.png$/, suffix + '.png'); var outputFilePath = path.join(outputDir, newFileName); return outputFilePath; }
javascript
function getOutputFilePath(input, outputDir, suffix) { var inputArr = input.split(path.sep); var originFileName = inputArr[inputArr.length - 1]; var newFileName = originFileName.replace(/\.png$/, suffix + '.png'); var outputFilePath = path.join(outputDir, newFileName); return outputFilePath; }
[ "function", "getOutputFilePath", "(", "input", ",", "outputDir", ",", "suffix", ")", "{", "var", "inputArr", "=", "input", ".", "split", "(", "path", ".", "sep", ")", ";", "var", "originFileName", "=", "inputArr", "[", "inputArr", ".", "length", "-", "1"...
get temp output file path with our suffix @param {string} output @return {string} outputDir @return {string} suffix @return {string} outputFilePath @private
[ "get", "temp", "output", "file", "path", "with", "our", "suffix" ]
a6c0e501afb36b11af3db8f5afa59bfed71377a8
https://github.com/forsigner/node-pngdefry/blob/a6c0e501afb36b11af3db8f5afa59bfed71377a8/lib/index.js#L45-L51
train
marcuswestin/fin
engines/redis/storage.js
getBytes
function getBytes(key, callback) { this.redisClient.get(key, function(err, valueBytes) { if (err) { return callback(err) } if (!valueBytes) { return callback(null, null) } callback(null, valueBytes.toString()) }) }
javascript
function getBytes(key, callback) { this.redisClient.get(key, function(err, valueBytes) { if (err) { return callback(err) } if (!valueBytes) { return callback(null, null) } callback(null, valueBytes.toString()) }) }
[ "function", "getBytes", "(", "key", ",", "callback", ")", "{", "this", ".", "redisClient", ".", "get", "(", "key", ",", "function", "(", "err", ",", "valueBytes", ")", "{", "if", "(", "err", ")", "{", "return", "callback", "(", "err", ")", "}", "if...
Returns a string
[ "Returns", "a", "string" ]
25060c404fdc8f3baf9c99ebc89fa0cb04cbfb05
https://github.com/marcuswestin/fin/blob/25060c404fdc8f3baf9c99ebc89fa0cb04cbfb05/engines/redis/storage.js#L43-L49
train
warehouseai/smart-private-npm
lib/npm-proxy.js
onDecision
function onDecision(err, target) { // // If there was no target then this is a 404 by definition // even if it exists in the public registry because of a // potential whitelist. // if (err || !target) { return self.notFound(req, res, err || { message: 'Unknown pkg: ' + pkg }); } /...
javascript
function onDecision(err, target) { // // If there was no target then this is a 404 by definition // even if it exists in the public registry because of a // potential whitelist. // if (err || !target) { return self.notFound(req, res, err || { message: 'Unknown pkg: ' + pkg }); } /...
[ "function", "onDecision", "(", "err", ",", "target", ")", "{", "//", "// If there was no target then this is a 404 by definition", "// even if it exists in the public registry because of a", "// potential whitelist.", "//", "if", "(", "err", "||", "!", "target", ")", "{", "...
Proxy or serve not found based on the decision
[ "Proxy", "or", "serve", "not", "found", "based", "on", "the", "decision" ]
c5e1f2bc62fbb51f6ee56f93ec6e24753849c9b7
https://github.com/warehouseai/smart-private-npm/blob/c5e1f2bc62fbb51f6ee56f93ec6e24753849c9b7/lib/npm-proxy.js#L245-L269
train
sassoftware/restaf
src/serverCalls/index.js
implicitGrant
function implicitGrant (iconfig) { /* */ let link = iconfig.link ; window.location.href = `${iconfig.host + link.href}?response_type=${link.responseType}&client_id=${iconfig.clientID}`; return new Promise.resolve() }
javascript
function implicitGrant (iconfig) { /* */ let link = iconfig.link ; window.location.href = `${iconfig.host + link.href}?response_type=${link.responseType}&client_id=${iconfig.clientID}`; return new Promise.resolve() }
[ "function", "implicitGrant", "(", "iconfig", ")", "{", "/* */", "let", "link", "=", "iconfig", ".", "link", ";", "window", ".", "location", ".", "href", "=", "`", "${", "iconfig", ".", "host", "+", "link", ".", "href", "}", "${", "link", ".", "respon...
Code below is for experimenting.
[ "Code", "below", "is", "for", "experimenting", "." ]
fc3122184ab8cf32dd431f0b832b87d156873d0b
https://github.com/sassoftware/restaf/blob/fc3122184ab8cf32dd431f0b832b87d156873d0b/src/serverCalls/index.js#L282-L289
train
sassoftware/restaf
src/store/apiSubmit.js
apiSubmit
async function apiSubmit (store, iroute, payload, delay, jobContext, onCompletion, progress){ if (progress) { progress('pending', jobContext); } let job = await iapiCall(store, iroute, API_CALL, payload, 0, null, null, jobContext); if (job.links('state'...
javascript
async function apiSubmit (store, iroute, payload, delay, jobContext, onCompletion, progress){ if (progress) { progress('pending', jobContext); } let job = await iapiCall(store, iroute, API_CALL, payload, 0, null, null, jobContext); if (job.links('state'...
[ "async", "function", "apiSubmit", "(", "store", ",", "iroute", ",", "payload", ",", "delay", ",", "jobContext", ",", "onCompletion", ",", "progress", ")", "{", "if", "(", "progress", ")", "{", "progress", "(", "'pending'", ",", "jobContext", ")", ";", "}...
store, iroute, actionType, payload, delay, eventHandler, parentRoute, jobContext
[ "store", "iroute", "actionType", "payload", "delay", "eventHandler", "parentRoute", "jobContext" ]
fc3122184ab8cf32dd431f0b832b87d156873d0b
https://github.com/sassoftware/restaf/blob/fc3122184ab8cf32dd431f0b832b87d156873d0b/src/store/apiSubmit.js#L26-L43
train
m19c/gulp-run
command.js
Command
function Command(command, options) { var previousPath; this.command = command; // We're on Windows if `process.platform` starts with "win", i.e. "win32". this.isWindows = (process.platform.lastIndexOf('win') === 0); // the cwd and environment of the command are the same as the main node // process by def...
javascript
function Command(command, options) { var previousPath; this.command = command; // We're on Windows if `process.platform` starts with "win", i.e. "win32". this.isWindows = (process.platform.lastIndexOf('win') === 0); // the cwd and environment of the command are the same as the main node // process by def...
[ "function", "Command", "(", "command", ",", "options", ")", "{", "var", "previousPath", ";", "this", ".", "command", "=", "command", ";", "// We're on Windows if `process.platform` starts with \"win\", i.e. \"win32\".", "this", ".", "isWindows", "=", "(", "process", "...
Creates a new `gulp-run` command. @param {string} command @param {object} options
[ "Creates", "a", "new", "gulp", "-", "run", "command", "." ]
f58b6dbeb2d9f1c21579a7654d28ce6764f3a541
https://github.com/m19c/gulp-run/blob/f58b6dbeb2d9f1c21579a7654d28ce6764f3a541/command.js#L16-L38
train
m19c/gulp-run
index.js
GulpRunner
function GulpRunner(template, options) { if (!(this instanceof GulpRunner)) { return new GulpRunner(template, options); } this.command = new Command(template, options || {}); Transform.call(this, { objectMode: true }); }
javascript
function GulpRunner(template, options) { if (!(this instanceof GulpRunner)) { return new GulpRunner(template, options); } this.command = new Command(template, options || {}); Transform.call(this, { objectMode: true }); }
[ "function", "GulpRunner", "(", "template", ",", "options", ")", "{", "if", "(", "!", "(", "this", "instanceof", "GulpRunner", ")", ")", "{", "return", "new", "GulpRunner", "(", "template", ",", "options", ")", ";", "}", "this", ".", "command", "=", "ne...
Creates a GulpRunner. A GulpRunner is a Vinyl transform stream that spawns a child process to transform the file. A separate process is spawned to handle each file passing through the stream. @param {string} template @param {object} options
[ "Creates", "a", "GulpRunner", "." ]
f58b6dbeb2d9f1c21579a7654d28ce6764f3a541
https://github.com/m19c/gulp-run/blob/f58b6dbeb2d9f1c21579a7654d28ce6764f3a541/index.js#L20-L27
train
gruntjs/grunt-init
tasks/init.js
function(arg1) { if (arg1 == null) { return null; } var args = [name, 'root'].concat(grunt.util.toArray(arguments)); return helpers.getFile.apply(helpers, args); }
javascript
function(arg1) { if (arg1 == null) { return null; } var args = [name, 'root'].concat(grunt.util.toArray(arguments)); return helpers.getFile.apply(helpers, args); }
[ "function", "(", "arg1", ")", "{", "if", "(", "arg1", "==", "null", ")", "{", "return", "null", ";", "}", "var", "args", "=", "[", "name", ",", "'root'", "]", ".", "concat", "(", "grunt", ".", "util", ".", "toArray", "(", "arguments", ")", ")", ...
Search init template paths for filename.
[ "Search", "init", "template", "paths", "for", "filename", "." ]
cbec886f26dce52d19c828df3fed031ce9767663
https://github.com/gruntjs/grunt-init/blob/cbec886f26dce52d19c828df3fed031ce9767663/tasks/init.js#L342-L346
train
gruntjs/grunt-init
tasks/init.js
function(files, licenses) { licenses.forEach(function(license) { var fileobj = helpers.expand({filter: 'isFile'}, 'licenses/LICENSE-' + license)[0]; if(fileobj) { files['LICENSE-' + license] = fileobj.rel; } }); }
javascript
function(files, licenses) { licenses.forEach(function(license) { var fileobj = helpers.expand({filter: 'isFile'}, 'licenses/LICENSE-' + license)[0]; if(fileobj) { files['LICENSE-' + license] = fileobj.rel; } }); }
[ "function", "(", "files", ",", "licenses", ")", "{", "licenses", ".", "forEach", "(", "function", "(", "license", ")", "{", "var", "fileobj", "=", "helpers", ".", "expand", "(", "{", "filter", ":", "'isFile'", "}", ",", "'licenses/LICENSE-'", "+", "licen...
Given some number of licenses, add properly-named license files to the files object.
[ "Given", "some", "number", "of", "licenses", "add", "properly", "-", "named", "license", "files", "to", "the", "files", "object", "." ]
cbec886f26dce52d19c828df3fed031ce9767663
https://github.com/gruntjs/grunt-init/blob/cbec886f26dce52d19c828df3fed031ce9767663/tasks/init.js#L351-L358
train
gruntjs/grunt-init
tasks/init.js
function(srcpath, destpath, options) { // Destpath is optional. if (typeof destpath !== 'string') { options = destpath; destpath = srcpath; } // Ensure srcpath is absolute. if (!grunt.file.isPathAbsolute(srcpath)) { srcpath = init.srcpath(srcpath); ...
javascript
function(srcpath, destpath, options) { // Destpath is optional. if (typeof destpath !== 'string') { options = destpath; destpath = srcpath; } // Ensure srcpath is absolute. if (!grunt.file.isPathAbsolute(srcpath)) { srcpath = init.srcpath(srcpath); ...
[ "function", "(", "srcpath", ",", "destpath", ",", "options", ")", "{", "// Destpath is optional.", "if", "(", "typeof", "destpath", "!==", "'string'", ")", "{", "options", "=", "destpath", ";", "destpath", "=", "srcpath", ";", "}", "// Ensure srcpath is absolute...
Given an absolute or relative source path, and an optional relative destination path, copy a file, optionally processing it through the passed callback.
[ "Given", "an", "absolute", "or", "relative", "source", "path", "and", "an", "optional", "relative", "destination", "path", "copy", "a", "file", "optionally", "processing", "it", "through", "the", "passed", "callback", "." ]
cbec886f26dce52d19c828df3fed031ce9767663
https://github.com/gruntjs/grunt-init/blob/cbec886f26dce52d19c828df3fed031ce9767663/tasks/init.js#L362-L384
train
gruntjs/grunt-init
tasks/init.js
function(files, props, options) { options = _.defaults(options || {}, { process: function(contents) { return grunt.template.process(contents, {data: props, delimiters: 'init'}); } }); Object.keys(files).forEach(function(destpath) { var o = Object.create(...
javascript
function(files, props, options) { options = _.defaults(options || {}, { process: function(contents) { return grunt.template.process(contents, {data: props, delimiters: 'init'}); } }); Object.keys(files).forEach(function(destpath) { var o = Object.create(...
[ "function", "(", "files", ",", "props", ",", "options", ")", "{", "options", "=", "_", ".", "defaults", "(", "options", "||", "{", "}", ",", "{", "process", ":", "function", "(", "contents", ")", "{", "return", "grunt", ".", "template", ".", "process...
Iterate over all files in the passed object, copying the source file to the destination, processing the contents.
[ "Iterate", "over", "all", "files", "in", "the", "passed", "object", "copying", "the", "source", "file", "to", "the", "destination", "processing", "the", "contents", "." ]
cbec886f26dce52d19c828df3fed031ce9767663
https://github.com/gruntjs/grunt-init/blob/cbec886f26dce52d19c828df3fed031ce9767663/tasks/init.js#L387-L409
train
vskosp/vsGoogleAutocomplete
dist/vs-autocomplete-validator.js
Validator
function Validator(validatorsNamesList) { // add default embedded validator name validatorsNamesList.unshift('vsGooglePlace'); this._embeddedValidators = vsEmbeddedValidatorsInjector.get(validatorsNamesList); this.error = {}; this.valid = true; }
javascript
function Validator(validatorsNamesList) { // add default embedded validator name validatorsNamesList.unshift('vsGooglePlace'); this._embeddedValidators = vsEmbeddedValidatorsInjector.get(validatorsNamesList); this.error = {}; this.valid = true; }
[ "function", "Validator", "(", "validatorsNamesList", ")", "{", "// add default embedded validator name", "validatorsNamesList", ".", "unshift", "(", "'vsGooglePlace'", ")", ";", "this", ".", "_embeddedValidators", "=", "vsEmbeddedValidatorsInjector", ".", "get", "(", "val...
Class making validator associated with vsGoogleAutocomplete controller. @constructor @param {Array.<string>} validatorsNamesList - List of embedded validator names.
[ "Class", "making", "validator", "associated", "with", "vsGoogleAutocomplete", "controller", "." ]
4ec8b242904d3a94761f4278989f161c910f71ac
https://github.com/vskosp/vsGoogleAutocomplete/blob/4ec8b242904d3a94761f4278989f161c910f71ac/dist/vs-autocomplete-validator.js#L60-L67
train
vskosp/vsGoogleAutocomplete
dist/vs-autocomplete-validator.js
parseValidatorNames
function parseValidatorNames(attrs) { var attrValue = attrs.vsAutocompleteValidator, validatorNames = (attrValue!=="") ? attrValue.trim().split(',') : []; // normalize validator names for (var i = 0; i < validatorNames.length; i++) { validatorNames[i] = attrs.$normalize(validatorNames[i]); } return va...
javascript
function parseValidatorNames(attrs) { var attrValue = attrs.vsAutocompleteValidator, validatorNames = (attrValue!=="") ? attrValue.trim().split(',') : []; // normalize validator names for (var i = 0; i < validatorNames.length; i++) { validatorNames[i] = attrs.$normalize(validatorNames[i]); } return va...
[ "function", "parseValidatorNames", "(", "attrs", ")", "{", "var", "attrValue", "=", "attrs", ".", "vsAutocompleteValidator", ",", "validatorNames", "=", "(", "attrValue", "!==", "\"\"", ")", "?", "attrValue", ".", "trim", "(", ")", ".", "split", "(", "','", ...
Parse validator names from attribute. @param {$compile.directive.Attributes} attrs Element attributes @return {Array.<string>} Returns array of normalized validator names.
[ "Parse", "validator", "names", "from", "attribute", "." ]
4ec8b242904d3a94761f4278989f161c910f71ac
https://github.com/vskosp/vsGoogleAutocomplete/blob/4ec8b242904d3a94761f4278989f161c910f71ac/dist/vs-autocomplete-validator.js#L126-L136
train
mongodb-js/extended-json
lib/serialize.js
serialize
function serialize(value) { if (Array.isArray(value) === true) { return serializeArray(value); } if (isObject(value) === false) { return serializePrimitive(value); } return serializeObject(value); }
javascript
function serialize(value) { if (Array.isArray(value) === true) { return serializeArray(value); } if (isObject(value) === false) { return serializePrimitive(value); } return serializeObject(value); }
[ "function", "serialize", "(", "value", ")", "{", "if", "(", "Array", ".", "isArray", "(", "value", ")", "===", "true", ")", "{", "return", "serializeArray", "(", "value", ")", ";", "}", "if", "(", "isObject", "(", "value", ")", "===", "false", ")", ...
Format values with extra extended json type data. @param {Any} value - What to wrap as a `{$<type>: <encoded>}` object. @return {Any} @api private
[ "Format", "values", "with", "extra", "extended", "json", "type", "data", "." ]
3116e58531c504d9c9f1c6a5f53c24bb7d1ec65f
https://github.com/mongodb-js/extended-json/blob/3116e58531c504d9c9f1c6a5f53c24bb7d1ec65f/lib/serialize.js#L44-L52
train
canjs/can-compile
example/js/components/todo-app.js
function () { var filter = can.route.attr('filter'); return this.todos.filter(function (todo) { if (filter === 'completed') { return todo.attr('complete'); } if (filter === 'active') { return !todo.attr('complete'); } return true; }); }
javascript
function () { var filter = can.route.attr('filter'); return this.todos.filter(function (todo) { if (filter === 'completed') { return todo.attr('complete'); } if (filter === 'active') { return !todo.attr('complete'); } return true; }); }
[ "function", "(", ")", "{", "var", "filter", "=", "can", ".", "route", ".", "attr", "(", "'filter'", ")", ";", "return", "this", ".", "todos", ".", "filter", "(", "function", "(", "todo", ")", "{", "if", "(", "filter", "===", "'completed'", ")", "{"...
Returns a list of Todos filtered based on the route
[ "Returns", "a", "list", "of", "Todos", "filtered", "based", "on", "the", "route" ]
56c05e2b5f5dc441fa5ce00a499386ef1e992a2a
https://github.com/canjs/can-compile/blob/56c05e2b5f5dc441fa5ce00a499386ef1e992a2a/example/js/components/todo-app.js#L27-L40
train
canjs/can-compile
example/dist/production.js
function(el, val) { if (val == null || val === "") { el.removeAttribute("src"); return null; } else { el.setAttribute("src", val); return val; ...
javascript
function(el, val) { if (val == null || val === "") { el.removeAttribute("src"); return null; } else { el.setAttribute("src", val); return val; ...
[ "function", "(", "el", ",", "val", ")", "{", "if", "(", "val", "==", "null", "||", "val", "===", "\"\"", ")", "{", "el", ".", "removeAttribute", "(", "\"src\"", ")", ";", "return", "null", ";", "}", "else", "{", "el", ".", "setAttribute", "(", "\...
For the `src` attribute we are using a setter function to prevent values such as an empty string or null from being set. An `img` tag attempts to fetch the `src` when it is set, so we need to prevent that from happening by removing the attribute instead.
[ "For", "the", "src", "attribute", "we", "are", "using", "a", "setter", "function", "to", "prevent", "values", "such", "as", "an", "empty", "string", "or", "null", "from", "being", "set", ".", "An", "img", "tag", "attempts", "to", "fetch", "the", "src", ...
56c05e2b5f5dc441fa5ce00a499386ef1e992a2a
https://github.com/canjs/can-compile/blob/56c05e2b5f5dc441fa5ce00a499386ef1e992a2a/example/dist/production.js#L9149-L9157
train
canjs/can-compile
example/dist/production.js
function() { if (arguments.length === 0 && can.Control && this instanceof can.Control) { return can.Control.prototype.on.call(this); } else { return can.addEvent.apply(this, arguments); } }
javascript
function() { if (arguments.length === 0 && can.Control && this instanceof can.Control) { return can.Control.prototype.on.call(this); } else { return can.addEvent.apply(this, arguments); } }
[ "function", "(", ")", "{", "if", "(", "arguments", ".", "length", "===", "0", "&&", "can", ".", "Control", "&&", "this", "instanceof", "can", ".", "Control", ")", "{", "return", "can", ".", "Control", ".", "prototype", ".", "on", ".", "call", "(", ...
Event method aliases
[ "Event", "method", "aliases" ]
56c05e2b5f5dc441fa5ce00a499386ef1e992a2a
https://github.com/canjs/can-compile/blob/56c05e2b5f5dc441fa5ce00a499386ef1e992a2a/example/dist/production.js#L9461-L9467
train
canjs/can-compile
example/dist/production.js
function(fullName, klass, proto) { // Figure out what was passed and normalize it. if (typeof fullName !== 'string') { proto = klass; klass = fullName; fullName = null; } ...
javascript
function(fullName, klass, proto) { // Figure out what was passed and normalize it. if (typeof fullName !== 'string') { proto = klass; klass = fullName; fullName = null; } ...
[ "function", "(", "fullName", ",", "klass", ",", "proto", ")", "{", "// Figure out what was passed and normalize it.", "if", "(", "typeof", "fullName", "!==", "'string'", ")", "{", "proto", "=", "klass", ";", "klass", "=", "fullName", ";", "fullName", "=", "nul...
Extends classes.
[ "Extends", "classes", "." ]
56c05e2b5f5dc441fa5ce00a499386ef1e992a2a
https://github.com/canjs/can-compile/blob/56c05e2b5f5dc441fa5ce00a499386ef1e992a2a/example/dist/production.js#L10667-L10749
train
canjs/can-compile
example/dist/production.js
function() { for (var cid in madeMap) { if (madeMap[cid].added) { delete madeMap[cid].obj._cid; } } madeMap = null; }
javascript
function() { for (var cid in madeMap) { if (madeMap[cid].added) { delete madeMap[cid].obj._cid; } } madeMap = null; }
[ "function", "(", ")", "{", "for", "(", "var", "cid", "in", "madeMap", ")", "{", "if", "(", "madeMap", "[", "cid", "]", ".", "added", ")", "{", "delete", "madeMap", "[", "cid", "]", ".", "obj", ".", "_cid", ";", "}", "}", "madeMap", "=", "null",...
Clears out map of converted objects.
[ "Clears", "out", "map", "of", "converted", "objects", "." ]
56c05e2b5f5dc441fa5ce00a499386ef1e992a2a
https://github.com/canjs/can-compile/blob/56c05e2b5f5dc441fa5ce00a499386ef1e992a2a/example/dist/production.js#L11306-L11313
train
canjs/can-compile
example/dist/production.js
function() { var computes = this.constructor._computes; this._computedBindings = {}; for (var i = 0, len = computes.length, prop; i < len; i++) { prop = computes[i]; // Make the context of the compute the curren...
javascript
function() { var computes = this.constructor._computes; this._computedBindings = {}; for (var i = 0, len = computes.length, prop; i < len; i++) { prop = computes[i]; // Make the context of the compute the curren...
[ "function", "(", ")", "{", "var", "computes", "=", "this", ".", "constructor", ".", "_computes", ";", "this", ".", "_computedBindings", "=", "{", "}", ";", "for", "(", "var", "i", "=", "0", ",", "len", "=", "computes", ".", "length", ",", "prop", "...
Sets up computed properties on a Map.
[ "Sets", "up", "computed", "properties", "on", "a", "Map", "." ]
56c05e2b5f5dc441fa5ce00a499386ef1e992a2a
https://github.com/canjs/can-compile/blob/56c05e2b5f5dc441fa5ce00a499386ef1e992a2a/example/dist/production.js#L11517-L11530
train
canjs/can-compile
example/dist/production.js
function(ev, attr, how, newVal, oldVal) { // when a change happens, create the named event. can.batch.trigger(this, { type: attr, batchNum: ev.batchNum }, [newVal, oldVal]); if (h...
javascript
function(ev, attr, how, newVal, oldVal) { // when a change happens, create the named event. can.batch.trigger(this, { type: attr, batchNum: ev.batchNum }, [newVal, oldVal]); if (h...
[ "function", "(", "ev", ",", "attr", ",", "how", ",", "newVal", ",", "oldVal", ")", "{", "// when a change happens, create the named event.", "can", ".", "batch", ".", "trigger", "(", "this", ",", "{", "type", ":", "attr", ",", "batchNum", ":", "ev", ".", ...
`change`event handler.
[ "change", "event", "handler", "." ]
56c05e2b5f5dc441fa5ce00a499386ef1e992a2a
https://github.com/canjs/can-compile/blob/56c05e2b5f5dc441fa5ce00a499386ef1e992a2a/example/dist/production.js#L11539-L11552
train
canjs/can-compile
example/dist/production.js
function(attr, how, newVal, oldVal) { can.batch.trigger(this, "change", can.makeArray(arguments)); }
javascript
function(attr, how, newVal, oldVal) { can.batch.trigger(this, "change", can.makeArray(arguments)); }
[ "function", "(", "attr", ",", "how", ",", "newVal", ",", "oldVal", ")", "{", "can", ".", "batch", ".", "trigger", "(", "this", ",", "\"change\"", ",", "can", ".", "makeArray", "(", "arguments", ")", ")", ";", "}" ]
Trigger a change event.
[ "Trigger", "a", "change", "event", "." ]
56c05e2b5f5dc441fa5ce00a499386ef1e992a2a
https://github.com/canjs/can-compile/blob/56c05e2b5f5dc441fa5ce00a499386ef1e992a2a/example/dist/production.js#L11554-L11556
train
canjs/can-compile
example/dist/production.js
function(callback) { var data = this.__get(); for (var prop in data) { if (data.hasOwnProperty(prop)) { callback(data[prop], prop); } } }
javascript
function(callback) { var data = this.__get(); for (var prop in data) { if (data.hasOwnProperty(prop)) { callback(data[prop], prop); } } }
[ "function", "(", "callback", ")", "{", "var", "data", "=", "this", ".", "__get", "(", ")", ";", "for", "(", "var", "prop", "in", "data", ")", "{", "if", "(", "data", ".", "hasOwnProperty", "(", "prop", ")", ")", "{", "callback", "(", "data", "[",...
Iterator that does not trigger live binding.
[ "Iterator", "that", "does", "not", "trigger", "live", "binding", "." ]
56c05e2b5f5dc441fa5ce00a499386ef1e992a2a
https://github.com/canjs/can-compile/blob/56c05e2b5f5dc441fa5ce00a499386ef1e992a2a/example/dist/production.js#L11558-L11565
train
canjs/can-compile
example/dist/production.js
function(prop, current) { if (prop in this._data) { // Delete the property from `_data` and the Map // as long as it isn't part of the Map's prototype. delete this._data[prop]; if (!(prop in this.construc...
javascript
function(prop, current) { if (prop in this._data) { // Delete the property from `_data` and the Map // as long as it isn't part of the Map's prototype. delete this._data[prop]; if (!(prop in this.construc...
[ "function", "(", "prop", ",", "current", ")", "{", "if", "(", "prop", "in", "this", ".", "_data", ")", "{", "// Delete the property from `_data` and the Map", "// as long as it isn't part of the Map's prototype.", "delete", "this", ".", "_data", "[", "prop", "]", ";...
Remove a property.
[ "Remove", "a", "property", "." ]
56c05e2b5f5dc441fa5ce00a499386ef1e992a2a
https://github.com/canjs/can-compile/blob/56c05e2b5f5dc441fa5ce00a499386ef1e992a2a/example/dist/production.js#L11614-L11626
train
canjs/can-compile
example/dist/production.js
function(value, prop) { // If we are getting an object. if (!(value instanceof can.Map) && can.Map.helpers.canMakeObserve(value)) { var cached = getMapFromObject(value); if (cached) { return cached; ...
javascript
function(value, prop) { // If we are getting an object. if (!(value instanceof can.Map) && can.Map.helpers.canMakeObserve(value)) { var cached = getMapFromObject(value); if (cached) { return cached; ...
[ "function", "(", "value", ",", "prop", ")", "{", "// If we are getting an object.", "if", "(", "!", "(", "value", "instanceof", "can", ".", "Map", ")", "&&", "can", ".", "Map", ".", "helpers", ".", "canMakeObserve", "(", "value", ")", ")", "{", "var", ...
converts the value into an observable if needed
[ "converts", "the", "value", "into", "an", "observable", "if", "needed" ]
56c05e2b5f5dc441fa5ce00a499386ef1e992a2a
https://github.com/canjs/can-compile/blob/56c05e2b5f5dc441fa5ce00a499386ef1e992a2a/example/dist/production.js#L11672-L11689
train
canjs/can-compile
example/dist/production.js
function(updater) { for (var name in readInfo.observed) { var ob = readInfo.observed[name]; ob.obj.unbind(ob.event, onchanged); } }
javascript
function(updater) { for (var name in readInfo.observed) { var ob = readInfo.observed[name]; ob.obj.unbind(ob.event, onchanged); } }
[ "function", "(", "updater", ")", "{", "for", "(", "var", "name", "in", "readInfo", ".", "observed", ")", "{", "var", "ob", "=", "readInfo", ".", "observed", "[", "name", "]", ";", "ob", ".", "obj", ".", "unbind", "(", "ob", ".", "event", ",", "on...
Remove handler for the compute
[ "Remove", "handler", "for", "the", "compute" ]
56c05e2b5f5dc441fa5ce00a499386ef1e992a2a
https://github.com/canjs/can-compile/blob/56c05e2b5f5dc441fa5ce00a499386ef1e992a2a/example/dist/production.js#L12397-L12402
train
canjs/can-compile
example/dist/production.js
function(newValue, oldValue, batchNum) { setCached(newValue); updateOnChange(computed, newValue, oldValue, batchNum); }
javascript
function(newValue, oldValue, batchNum) { setCached(newValue); updateOnChange(computed, newValue, oldValue, batchNum); }
[ "function", "(", "newValue", ",", "oldValue", ",", "batchNum", ")", "{", "setCached", "(", "newValue", ")", ";", "updateOnChange", "(", "computed", ",", "newValue", ",", "oldValue", ",", "batchNum", ")", ";", "}" ]
The computed object
[ "The", "computed", "object" ]
56c05e2b5f5dc441fa5ce00a499386ef1e992a2a
https://github.com/canjs/can-compile/blob/56c05e2b5f5dc441fa5ce00a499386ef1e992a2a/example/dist/production.js#L12449-L12452
train
canjs/can-compile
example/dist/production.js
function() { for (var i = 0, len = computes.length; i < len; i++) { computes[i].unbind('change', k); } computes = null; }
javascript
function() { for (var i = 0, len = computes.length; i < len; i++) { computes[i].unbind('change', k); } computes = null; }
[ "function", "(", ")", "{", "for", "(", "var", "i", "=", "0", ",", "len", "=", "computes", ".", "length", ";", "i", "<", "len", ";", "i", "++", ")", "{", "computes", "[", "i", "]", ".", "unbind", "(", "'change'", ",", "k", ")", ";", "}", "co...
A list of temporarily bound computes
[ "A", "list", "of", "temporarily", "bound", "computes" ]
56c05e2b5f5dc441fa5ce00a499386ef1e992a2a
https://github.com/canjs/can-compile/blob/56c05e2b5f5dc441fa5ce00a499386ef1e992a2a/example/dist/production.js#L12677-L12682
train
canjs/can-compile
example/dist/production.js
function(parentValue, nameIndex) { if (nameIndex > defaultPropertyDepth) { defaultObserve = currentObserve; defaultReads = currentReads; ...
javascript
function(parentValue, nameIndex) { if (nameIndex > defaultPropertyDepth) { defaultObserve = currentObserve; defaultReads = currentReads; ...
[ "function", "(", "parentValue", ",", "nameIndex", ")", "{", "if", "(", "nameIndex", ">", "defaultPropertyDepth", ")", "{", "defaultObserve", "=", "currentObserve", ";", "defaultReads", "=", "currentReads", ";", "defaultPropertyDepth", "=", "nameIndex", ";", "defau...
Called when we were unable to find a value.
[ "Called", "when", "we", "were", "unable", "to", "find", "a", "value", "." ]
56c05e2b5f5dc441fa5ce00a499386ef1e992a2a
https://github.com/canjs/can-compile/blob/56c05e2b5f5dc441fa5ce00a499386ef1e992a2a/example/dist/production.js#L13034-L13044
train
canjs/can-compile
example/dist/production.js
function() { if (!tornDown) { tornDown = true; unbind(data); can.unbind.call(el, 'removed', teardown); } return true; }
javascript
function() { if (!tornDown) { tornDown = true; unbind(data); can.unbind.call(el, 'removed', teardown); } return true; }
[ "function", "(", ")", "{", "if", "(", "!", "tornDown", ")", "{", "tornDown", "=", "true", ";", "unbind", "(", "data", ")", ";", "can", ".", "unbind", ".", "call", "(", "el", ",", "'removed'", ",", "teardown", ")", ";", "}", "return", "true", ";",...
Removing an element can call teardown which unregister the nodeList which calls teardown
[ "Removing", "an", "element", "can", "call", "teardown", "which", "unregister", "the", "nodeList", "which", "calls", "teardown" ]
56c05e2b5f5dc441fa5ce00a499386ef1e992a2a
https://github.com/canjs/can-compile/blob/56c05e2b5f5dc441fa5ce00a499386ef1e992a2a/example/dist/production.js#L14373-L14380
train
canjs/can-compile
example/dist/production.js
function(expr, options) { var value; // if it's a function, wrap its value in a compute // that will only change values from true to false if (can.isFunction(expr)) { value = can.compute.truthy(expr)(); ...
javascript
function(expr, options) { var value; // if it's a function, wrap its value in a compute // that will only change values from true to false if (can.isFunction(expr)) { value = can.compute.truthy(expr)(); ...
[ "function", "(", "expr", ",", "options", ")", "{", "var", "value", ";", "// if it's a function, wrap its value in a compute", "// that will only change values from true to false", "if", "(", "can", ".", "isFunction", "(", "expr", ")", ")", "{", "value", "=", "can", ...
Implements the `if` built-in helper.
[ "Implements", "the", "if", "built", "-", "in", "helper", "." ]
56c05e2b5f5dc441fa5ce00a499386ef1e992a2a
https://github.com/canjs/can-compile/blob/56c05e2b5f5dc441fa5ce00a499386ef1e992a2a/example/dist/production.js#L15826-L15841
train
canjs/can-compile
example/dist/production.js
function(expr, options) { var fn = options.fn; options.fn = options.inverse; options.inverse = fn; return Mustache._helpers['if'].fn.apply(this, arguments); }
javascript
function(expr, options) { var fn = options.fn; options.fn = options.inverse; options.inverse = fn; return Mustache._helpers['if'].fn.apply(this, arguments); }
[ "function", "(", "expr", ",", "options", ")", "{", "var", "fn", "=", "options", ".", "fn", ";", "options", ".", "fn", "=", "options", ".", "inverse", ";", "options", ".", "inverse", "=", "fn", ";", "return", "Mustache", ".", "_helpers", "[", "'if'", ...
Implements the `unless` built-in helper.
[ "Implements", "the", "unless", "built", "-", "in", "helper", "." ]
56c05e2b5f5dc441fa5ce00a499386ef1e992a2a
https://github.com/canjs/can-compile/blob/56c05e2b5f5dc441fa5ce00a499386ef1e992a2a/example/dist/production.js#L15844-L15849
train
canjs/can-compile
example/dist/production.js
function(expr, options) { // Check if this is a list or a compute that resolves to a list, and setup // the incremental live-binding // First, see what we are dealing with. It's ok to read the compute // because can.view.text is only tem...
javascript
function(expr, options) { // Check if this is a list or a compute that resolves to a list, and setup // the incremental live-binding // First, see what we are dealing with. It's ok to read the compute // because can.view.text is only tem...
[ "function", "(", "expr", ",", "options", ")", "{", "// Check if this is a list or a compute that resolves to a list, and setup", "// the incremental live-binding ", "// First, see what we are dealing with. It's ok to read the compute", "// because can.view.text is only temporarily binding to wh...
Implements the `each` built-in helper.
[ "Implements", "the", "each", "built", "-", "in", "helper", "." ]
56c05e2b5f5dc441fa5ce00a499386ef1e992a2a
https://github.com/canjs/can-compile/blob/56c05e2b5f5dc441fa5ce00a499386ef1e992a2a/example/dist/production.js#L15853-L15908
train
canjs/can-compile
example/dist/production.js
function(expr, options) { var ctx = expr; expr = Mustache.resolve(expr); if ( !! expr) { return options.fn(ctx); } }
javascript
function(expr, options) { var ctx = expr; expr = Mustache.resolve(expr); if ( !! expr) { return options.fn(ctx); } }
[ "function", "(", "expr", ",", "options", ")", "{", "var", "ctx", "=", "expr", ";", "expr", "=", "Mustache", ".", "resolve", "(", "expr", ")", ";", "if", "(", "!", "!", "expr", ")", "{", "return", "options", ".", "fn", "(", "ctx", ")", ";", "}",...
Implements the `with` built-in helper.
[ "Implements", "the", "with", "built", "-", "in", "helper", "." ]
56c05e2b5f5dc441fa5ce00a499386ef1e992a2a
https://github.com/canjs/can-compile/blob/56c05e2b5f5dc441fa5ce00a499386ef1e992a2a/example/dist/production.js#L15911-L15917
train
canjs/can-compile
example/dist/production.js
function(id, src) { return "can.Mustache(function(" + ARG_NAMES + ") { " + new Mustache({ text: src, name: id }) .template.out + " })"; }
javascript
function(id, src) { return "can.Mustache(function(" + ARG_NAMES + ") { " + new Mustache({ text: src, name: id }) .template.out + " })"; }
[ "function", "(", "id", ",", "src", ")", "{", "return", "\"can.Mustache(function(\"", "+", "ARG_NAMES", "+", "\") { \"", "+", "new", "Mustache", "(", "{", "text", ":", "src", ",", "name", ":", "id", "}", ")", ".", "template", ".", "out", "+", "\" })\"",...
Returns a `function` that renders the view.
[ "Returns", "a", "function", "that", "renders", "the", "view", "." ]
56c05e2b5f5dc441fa5ce00a499386ef1e992a2a
https://github.com/canjs/can-compile/blob/56c05e2b5f5dc441fa5ce00a499386ef1e992a2a/example/dist/production.js#L15941-L15947
train
canjs/can-compile
example/dist/production.js
function(value) { if (value[0] === "{" && value[value.length - 1] === "}") { return value.substr(1, value.length - 2); } return value; }
javascript
function(value) { if (value[0] === "{" && value[value.length - 1] === "}") { return value.substr(1, value.length - 2); } return value; }
[ "function", "(", "value", ")", "{", "if", "(", "value", "[", "0", "]", "===", "\"{\"", "&&", "value", "[", "value", ".", "length", "-", "1", "]", "===", "\"}\"", ")", "{", "return", "value", ".", "substr", "(", "1", ",", "value", ".", "length", ...
Function for determining of an element is contenteditable
[ "Function", "for", "determining", "of", "an", "element", "is", "contenteditable" ]
56c05e2b5f5dc441fa5ce00a499386ef1e992a2a
https://github.com/canjs/can-compile/blob/56c05e2b5f5dc441fa5ce00a499386ef1e992a2a/example/dist/production.js#L15996-L16001
train
canjs/can-compile
example/dist/production.js
function(ev) { // The attribute value, representing the name of the method to call (i.e. can-submit="foo" foo is the // name of the method) var attr = removeCurly(el.getAttribute(attributeName)), scopeData = data.scope.read(attr, { ...
javascript
function(ev) { // The attribute value, representing the name of the method to call (i.e. can-submit="foo" foo is the // name of the method) var attr = removeCurly(el.getAttribute(attributeName)), scopeData = data.scope.read(attr, { ...
[ "function", "(", "ev", ")", "{", "// The attribute value, representing the name of the method to call (i.e. can-submit=\"foo\" foo is the ", "// name of the method)", "var", "attr", "=", "removeCurly", "(", "el", ".", "getAttribute", "(", "attributeName", ")", ")", ",", "scop...
the attribute name is the function to call
[ "the", "attribute", "name", "is", "the", "function", "to", "call" ]
56c05e2b5f5dc441fa5ce00a499386ef1e992a2a
https://github.com/canjs/can-compile/blob/56c05e2b5f5dc441fa5ce00a499386ef1e992a2a/example/dist/production.js#L16116-L16125
train
canjs/can-compile
example/dist/production.js
function() { // Get an array of the currently selected values var value = this.get(), currentValue = this.options.value(); // If the compute is a string, set its value to the joined version of the values array (i.e. "fo...
javascript
function() { // Get an array of the currently selected values var value = this.get(), currentValue = this.options.value(); // If the compute is a string, set its value to the joined version of the values array (i.e. "fo...
[ "function", "(", ")", "{", "// Get an array of the currently selected values", "var", "value", "=", "this", ".", "get", "(", ")", ",", "currentValue", "=", "this", ".", "options", ".", "value", "(", ")", ";", "// If the compute is a string, set its value to the joined...
Called when the user changes this input in any way.
[ "Called", "when", "the", "user", "changes", "this", "input", "in", "any", "way", "." ]
56c05e2b5f5dc441fa5ce00a499386ef1e992a2a
https://github.com/canjs/can-compile/blob/56c05e2b5f5dc441fa5ce00a499386ef1e992a2a/example/dist/production.js#L16283-L16302
train
canjs/can-compile
example/dist/production.js
function(ev, newVal) { scopePropertyUpdating = name; componentScope.attr(name, newVal); scopePropertyUpdating = null; }
javascript
function(ev, newVal) { scopePropertyUpdating = name; componentScope.attr(name, newVal); scopePropertyUpdating = null; }
[ "function", "(", "ev", ",", "newVal", ")", "{", "scopePropertyUpdating", "=", "name", ";", "componentScope", ".", "attr", "(", "name", ",", "newVal", ")", ";", "scopePropertyUpdating", "=", "null", ";", "}" ]
bind on this, check it's value, if it has dependencies
[ "bind", "on", "this", "check", "it", "s", "value", "if", "it", "has", "dependencies" ]
56c05e2b5f5dc441fa5ce00a499386ef1e992a2a
https://github.com/canjs/can-compile/blob/56c05e2b5f5dc441fa5ce00a499386ef1e992a2a/example/dist/production.js#L16447-L16451
train
canjs/can-compile
example/dist/production.js
function(name) { var parseName = "parse" + can.capitalize(name); return function(data) { // If there's a `parse...` function, use its output. if (this[parseName]) { data = this[parseName].apply(this, arguments); } ...
javascript
function(name) { var parseName = "parse" + can.capitalize(name); return function(data) { // If there's a `parse...` function, use its output. if (this[parseName]) { data = this[parseName].apply(this, arguments); } ...
[ "function", "(", "name", ")", "{", "var", "parseName", "=", "\"parse\"", "+", "can", ".", "capitalize", "(", "name", ")", ";", "return", "function", "(", "data", ")", "{", "// If there's a `parse...` function, use its output.", "if", "(", "this", "[", "parseNa...
Returns a function that knows how to prepare data from `findAll` or `findOne` calls. `name` should be either `model` or `models`.
[ "Returns", "a", "function", "that", "knows", "how", "to", "prepare", "data", "from", "findAll", "or", "findOne", "calls", ".", "name", "should", "be", "either", "model", "or", "models", "." ]
56c05e2b5f5dc441fa5ce00a499386ef1e992a2a
https://github.com/canjs/can-compile/blob/56c05e2b5f5dc441fa5ce00a499386ef1e992a2a/example/dist/production.js#L17307-L17317
train
canjs/can-compile
example/dist/production.js
function() { if (!can.route.currentBinding) { can.route._call("bind"); can.route.bind("change", onRouteDataChange); can.route.currentBinding = can.route.defaultBinding; } }
javascript
function() { if (!can.route.currentBinding) { can.route._call("bind"); can.route.bind("change", onRouteDataChange); can.route.currentBinding = can.route.defaultBinding; } }
[ "function", "(", ")", "{", "if", "(", "!", "can", ".", "route", ".", "currentBinding", ")", "{", "can", ".", "route", ".", "_call", "(", "\"bind\"", ")", ";", "can", ".", "route", ".", "bind", "(", "\"change\"", ",", "onRouteDataChange", ")", ";", ...
we need to be able to easily kick off calling setState teardown whatever is there turn on a particular binding called when the route is ready
[ "we", "need", "to", "be", "able", "to", "easily", "kick", "off", "calling", "setState", "teardown", "whatever", "is", "there", "turn", "on", "a", "particular", "binding", "called", "when", "the", "route", "is", "ready" ]
56c05e2b5f5dc441fa5ce00a499386ef1e992a2a
https://github.com/canjs/can-compile/blob/56c05e2b5f5dc441fa5ce00a499386ef1e992a2a/example/dist/production.js#L17833-L17839
train
canjs/can-compile
example/dist/production.js
function() { var args = can.makeArray(arguments), prop = args.shift(), binding = can.route.bindings[can.route.currentBinding || can.route.defaultBinding], method = binding[prop]; if (method.apply) { ...
javascript
function() { var args = can.makeArray(arguments), prop = args.shift(), binding = can.route.bindings[can.route.currentBinding || can.route.defaultBinding], method = binding[prop]; if (method.apply) { ...
[ "function", "(", ")", "{", "var", "args", "=", "can", ".", "makeArray", "(", "arguments", ")", ",", "prop", "=", "args", ".", "shift", "(", ")", ",", "binding", "=", "can", ".", "route", ".", "bindings", "[", "can", ".", "route", ".", "currentBindi...
a helper to get stuff from the current or default bindings
[ "a", "helper", "to", "get", "stuff", "from", "the", "current", "or", "default", "bindings" ]
56c05e2b5f5dc441fa5ce00a499386ef1e992a2a
https://github.com/canjs/can-compile/blob/56c05e2b5f5dc441fa5ce00a499386ef1e992a2a/example/dist/production.js#L17850-L17860
train
component/toidentifier
index.js
toIdentifier
function toIdentifier (str) { return str .split(' ') .map(function (token) { return token.slice(0, 1).toUpperCase() + token.slice(1) }) .join('') .replace(/[^ _0-9a-z]/gi, '') }
javascript
function toIdentifier (str) { return str .split(' ') .map(function (token) { return token.slice(0, 1).toUpperCase() + token.slice(1) }) .join('') .replace(/[^ _0-9a-z]/gi, '') }
[ "function", "toIdentifier", "(", "str", ")", "{", "return", "str", ".", "split", "(", "' '", ")", ".", "map", "(", "function", "(", "token", ")", "{", "return", "token", ".", "slice", "(", "0", ",", "1", ")", ".", "toUpperCase", "(", ")", "+", "t...
Trasform the given string into a JavaScript identifier @param {string} str @returns {string} @public
[ "Trasform", "the", "given", "string", "into", "a", "JavaScript", "identifier" ]
8c09cba5e530de7d74b087ea66740c0e4a5af02b
https://github.com/component/toidentifier/blob/8c09cba5e530de7d74b087ea66740c0e4a5af02b/index.js#L22-L30
train
canjs/can-compile
gulp.js
runCompile
function runCompile(file, options) { if (!file) { throw new PluginError('can-compile', 'Missing file option for can-compile'); } var templatePaths = [], latestFile; options = options || {}; function bufferStream (file, enc, cb) { // ignore empty files if (file.isNull()) { cb(); ...
javascript
function runCompile(file, options) { if (!file) { throw new PluginError('can-compile', 'Missing file option for can-compile'); } var templatePaths = [], latestFile; options = options || {}; function bufferStream (file, enc, cb) { // ignore empty files if (file.isNull()) { cb(); ...
[ "function", "runCompile", "(", "file", ",", "options", ")", "{", "if", "(", "!", "file", ")", "{", "throw", "new", "PluginError", "(", "'can-compile'", ",", "'Missing file option for can-compile'", ")", ";", "}", "var", "templatePaths", "=", "[", "]", ",", ...
file can be a vinyl file object or a string when a string it will construct a new one
[ "file", "can", "be", "a", "vinyl", "file", "object", "or", "a", "string", "when", "a", "string", "it", "will", "construct", "a", "new", "one" ]
56c05e2b5f5dc441fa5ce00a499386ef1e992a2a
https://github.com/canjs/can-compile/blob/56c05e2b5f5dc441fa5ce00a499386ef1e992a2a/gulp.js#L12-L81
train
GluuFederation/oxd-node
oxd-node/utility.js
oxdSocketRequest
function oxdSocketRequest(port, host, params, command, callback) { // OXD data let data = { command, params }; // Create socket object const client = new net.Socket(); // Initiate a connection on a given socket. client.connect(port, host, () => { data = JSON.stringify(data); console.log(...
javascript
function oxdSocketRequest(port, host, params, command, callback) { // OXD data let data = { command, params }; // Create socket object const client = new net.Socket(); // Initiate a connection on a given socket. client.connect(port, host, () => { data = JSON.stringify(data); console.log(...
[ "function", "oxdSocketRequest", "(", "port", ",", "host", ",", "params", ",", "command", ",", "callback", ")", "{", "// OXD data", "let", "data", "=", "{", "command", ",", "params", "}", ";", "// Create socket object", "const", "client", "=", "new", "net", ...
Function for oxd-server socket manipulation @param {int} port - OXD port number for oxd-server @param {int} host - URL of the oxd-server @param {object} params - List of parameters to request oxd-server command @param {string} command - OXD Command name @param {function} callback - Callback response function
[ "Function", "for", "oxd", "-", "server", "socket", "manipulation" ]
b8d794fcb65bfc7c33364695b8875ef5fa555a06
https://github.com/GluuFederation/oxd-node/blob/b8d794fcb65bfc7c33364695b8875ef5fa555a06/oxd-node/utility.js#L12-L58
train
ujjwalguptaofficial/sqlweb
examples/simple example/scripts/index.js
showTableData
function showTableData() { connection.runSql('select * from Student').then(function (students) { var HtmlString = ""; students.forEach(function (student) { HtmlString += "<tr ItemId=" + student.Id + "><td>" + student.Name + "</td><td>" + student.Gender + "...
javascript
function showTableData() { connection.runSql('select * from Student').then(function (students) { var HtmlString = ""; students.forEach(function (student) { HtmlString += "<tr ItemId=" + student.Id + "><td>" + student.Name + "</td><td>" + student.Gender + "...
[ "function", "showTableData", "(", ")", "{", "connection", ".", "runSql", "(", "'select * from Student'", ")", ".", "then", "(", "function", "(", "students", ")", "{", "var", "HtmlString", "=", "\"\"", ";", "students", ".", "forEach", "(", "function", "(", ...
This function refreshes the table
[ "This", "function", "refreshes", "the", "table" ]
51fa7dbb53076ef2b0eff87c4bcedafcc0ec3f29
https://github.com/ujjwalguptaofficial/sqlweb/blob/51fa7dbb53076ef2b0eff87c4bcedafcc0ec3f29/examples/simple example/scripts/index.js#L86-L102
train
TooTallNate/node-icy
lib/client.js
Client
function Client (options, cb) { if (typeof options == 'string') options = url.parse(options) var req; if (options.protocol == "https:") req = https.request(options); else req = http.request(options); // add the "Icy-MetaData" header req.setHeader('Icy-MetaData', '1'); if ('function' == ty...
javascript
function Client (options, cb) { if (typeof options == 'string') options = url.parse(options) var req; if (options.protocol == "https:") req = https.request(options); else req = http.request(options); // add the "Icy-MetaData" header req.setHeader('Icy-MetaData', '1'); if ('function' == ty...
[ "function", "Client", "(", "options", ",", "cb", ")", "{", "if", "(", "typeof", "options", "==", "'string'", ")", "options", "=", "url", ".", "parse", "(", "options", ")", "var", "req", ";", "if", "(", "options", ".", "protocol", "==", "\"https:\"", ...
The `Client` class is a subclass of the `http.ClientRequest` object. It adds a stream preprocessor to make "ICY" responses work. This is only needed because of the strictness of node's HTTP parser. I'll volley for ICY to be supported (or at least configurable) in the http header for the JavaScript HTTP rewrite (v0.12 ...
[ "The", "Client", "class", "is", "a", "subclass", "of", "the", "http", ".", "ClientRequest", "object", "." ]
1c7278102d66b2cb52bc6dc0b3f2101c4cfdfee6
https://github.com/TooTallNate/node-icy/blob/1c7278102d66b2cb52bc6dc0b3f2101c4cfdfee6/lib/client.js#L39-L60
train
TooTallNate/node-icy
lib/client.js
icyOnResponse
function icyOnResponse (res) { debug('request "response" event'); var s = res; var metaint = res.headers['icy-metaint']; if (metaint) { debug('got metaint: %d', metaint); s = new Reader(metaint); res.pipe(s); s.res = res; Object.keys(res).forEach(function (k) { if ('_' === k[0]) ret...
javascript
function icyOnResponse (res) { debug('request "response" event'); var s = res; var metaint = res.headers['icy-metaint']; if (metaint) { debug('got metaint: %d', metaint); s = new Reader(metaint); res.pipe(s); s.res = res; Object.keys(res).forEach(function (k) { if ('_' === k[0]) ret...
[ "function", "icyOnResponse", "(", "res", ")", "{", "debug", "(", "'request \"response\" event'", ")", ";", "var", "s", "=", "res", ";", "var", "metaint", "=", "res", ".", "headers", "[", "'icy-metaint'", "]", ";", "if", "(", "metaint", ")", "{", "debug",...
"response" event listener. @api private
[ "response", "event", "listener", "." ]
1c7278102d66b2cb52bc6dc0b3f2101c4cfdfee6
https://github.com/TooTallNate/node-icy/blob/1c7278102d66b2cb52bc6dc0b3f2101c4cfdfee6/lib/client.js#L68-L90
train
TooTallNate/node-icy
lib/client.js
proxy
function proxy (stream, key) { if (key in stream) { debug('not proxying prop "%s" because it already exists on target stream', key); return; } function get () { return stream.res[key]; } function set (v) { return stream.res[key] = v; } Object.defineProperty(stream, key, { configurable...
javascript
function proxy (stream, key) { if (key in stream) { debug('not proxying prop "%s" because it already exists on target stream', key); return; } function get () { return stream.res[key]; } function set (v) { return stream.res[key] = v; } Object.defineProperty(stream, key, { configurable...
[ "function", "proxy", "(", "stream", ",", "key", ")", "{", "if", "(", "key", "in", "stream", ")", "{", "debug", "(", "'not proxying prop \"%s\" because it already exists on target stream'", ",", "key", ")", ";", "return", ";", "}", "function", "get", "(", ")", ...
Proxies "key" from `stream` to `stream.res`. @api private
[ "Proxies", "key", "from", "stream", "to", "stream", ".", "res", "." ]
1c7278102d66b2cb52bc6dc0b3f2101c4cfdfee6
https://github.com/TooTallNate/node-icy/blob/1c7278102d66b2cb52bc6dc0b3f2101c4cfdfee6/lib/client.js#L113-L131
train
TooTallNate/node-icy
lib/stringify.js
stringify
function stringify (obj) { var s = []; Object.keys(obj).forEach(function (key) { s.push(key); s.push('=\''); s.push(obj[key]); s.push('\';'); }); return s.join(''); }
javascript
function stringify (obj) { var s = []; Object.keys(obj).forEach(function (key) { s.push(key); s.push('=\''); s.push(obj[key]); s.push('\';'); }); return s.join(''); }
[ "function", "stringify", "(", "obj", ")", "{", "var", "s", "=", "[", "]", ";", "Object", ".", "keys", "(", "obj", ")", ".", "forEach", "(", "function", "(", "key", ")", "{", "s", ".", "push", "(", "key", ")", ";", "s", ".", "push", "(", "'=\\...
Takes an Object and converts it into an ICY metadata string. @param {Object} obj @return {String} @api public
[ "Takes", "an", "Object", "and", "converts", "it", "into", "an", "ICY", "metadata", "string", "." ]
1c7278102d66b2cb52bc6dc0b3f2101c4cfdfee6
https://github.com/TooTallNate/node-icy/blob/1c7278102d66b2cb52bc6dc0b3f2101c4cfdfee6/lib/stringify.js#L16-L25
train
TooTallNate/node-icy
examples/client.js
onMetadata
function onMetadata (metadata) { metadata = icy.parse(metadata); console.error('METADATA EVENT:'); console.error(metadata); }
javascript
function onMetadata (metadata) { metadata = icy.parse(metadata); console.error('METADATA EVENT:'); console.error(metadata); }
[ "function", "onMetadata", "(", "metadata", ")", "{", "metadata", "=", "icy", ".", "parse", "(", "metadata", ")", ";", "console", ".", "error", "(", "'METADATA EVENT:'", ")", ";", "console", ".", "error", "(", "metadata", ")", ";", "}" ]
Invoked for every "metadata" event from the `res` stream.
[ "Invoked", "for", "every", "metadata", "event", "from", "the", "res", "stream", "." ]
1c7278102d66b2cb52bc6dc0b3f2101c4cfdfee6
https://github.com/TooTallNate/node-icy/blob/1c7278102d66b2cb52bc6dc0b3f2101c4cfdfee6/examples/client.js#L50-L54
train
TooTallNate/node-icy
lib/preprocessor.js
preprocessor
function preprocessor (socket) { debug('setting up "data" preprocessor'); function ondata (chunk) { // TODO: don't be lazy, buffer if needed... assert(chunk.length >= 3, 'buffer too small! ' + chunk.length); if (/icy/i.test(chunk.slice(0, 3))) { debug('got ICY response!'); var b = new Buffe...
javascript
function preprocessor (socket) { debug('setting up "data" preprocessor'); function ondata (chunk) { // TODO: don't be lazy, buffer if needed... assert(chunk.length >= 3, 'buffer too small! ' + chunk.length); if (/icy/i.test(chunk.slice(0, 3))) { debug('got ICY response!'); var b = new Buffe...
[ "function", "preprocessor", "(", "socket", ")", "{", "debug", "(", "'setting up \"data\" preprocessor'", ")", ";", "function", "ondata", "(", "chunk", ")", "{", "// TODO: don't be lazy, buffer if needed...", "assert", "(", "chunk", ".", "length", ">=", "3", ",", "...
This all really... really.. sucks...
[ "This", "all", "really", "...", "really", "..", "sucks", "..." ]
1c7278102d66b2cb52bc6dc0b3f2101c4cfdfee6
https://github.com/TooTallNate/node-icy/blob/1c7278102d66b2cb52bc6dc0b3f2101c4cfdfee6/lib/preprocessor.js#L25-L82
train
hypery2k/galenframework-cli
core/postinstall.js
writeLocationFile
function writeLocationFile(location) { log.info('Writing location.js file'); if (process.platform === 'win32') { location = location.replace(/\\/g, '\\\\'); } fs.writeFileSync(path.join(libPath, 'location.js'), 'module.exports.location = \'' + location + '\';'); }
javascript
function writeLocationFile(location) { log.info('Writing location.js file'); if (process.platform === 'win32') { location = location.replace(/\\/g, '\\\\'); } fs.writeFileSync(path.join(libPath, 'location.js'), 'module.exports.location = \'' + location + '\';'); }
[ "function", "writeLocationFile", "(", "location", ")", "{", "log", ".", "info", "(", "'Writing location.js file'", ")", ";", "if", "(", "process", ".", "platform", "===", "'win32'", ")", "{", "location", "=", "location", ".", "replace", "(", "/", "\\\\", "...
Save the destination directory back @param {string} location - path of the directory
[ "Save", "the", "destination", "directory", "back" ]
eb18499201779bdef072cbad67bb8ce0360980cb
https://github.com/hypery2k/galenframework-cli/blob/eb18499201779bdef072cbad67bb8ce0360980cb/core/postinstall.js#L157-L164
train
hypery2k/galenframework-cli
core/postinstall.js
findSuitableTempDirectory
function findSuitableTempDirectory(npmConf) { const now = Date.now(); const candidateTmpDirs = [ process.env.TMPDIR || process.env.TEMP || npmConf.get('tmp'), path.join(process.cwd(), 'tmp', '/tmp') ]; for (let i = 0; i < candidateTmpDirs.length; i++) { const candidatePath = path.join(candida...
javascript
function findSuitableTempDirectory(npmConf) { const now = Date.now(); const candidateTmpDirs = [ process.env.TMPDIR || process.env.TEMP || npmConf.get('tmp'), path.join(process.cwd(), 'tmp', '/tmp') ]; for (let i = 0; i < candidateTmpDirs.length; i++) { const candidatePath = path.join(candida...
[ "function", "findSuitableTempDirectory", "(", "npmConf", ")", "{", "const", "now", "=", "Date", ".", "now", "(", ")", ";", "const", "candidateTmpDirs", "=", "[", "process", ".", "env", ".", "TMPDIR", "||", "process", ".", "env", ".", "TEMP", "||", "npmCo...
Function to find an writable temp directory @param {object} npmConf - current NPM configuration @returns {string} representing suitable temp directory @function
[ "Function", "to", "find", "an", "writable", "temp", "directory" ]
eb18499201779bdef072cbad67bb8ce0360980cb
https://github.com/hypery2k/galenframework-cli/blob/eb18499201779bdef072cbad67bb8ce0360980cb/core/postinstall.js#L183-L210
train
hypery2k/galenframework-cli
core/postinstall.js
getRequestOptions
function getRequestOptions(conf) { const strictSSL = conf.get('strict-ssl'); let options = { uri: downloadUrl, encoding: null, // Get response as a buffer followRedirect: true, // The default download path redirects to a CDN URL. headers: {}, strictSSL: strictSSL }; let proxyUrl = conf.get...
javascript
function getRequestOptions(conf) { const strictSSL = conf.get('strict-ssl'); let options = { uri: downloadUrl, encoding: null, // Get response as a buffer followRedirect: true, // The default download path redirects to a CDN URL. headers: {}, strictSSL: strictSSL }; let proxyUrl = conf.get...
[ "function", "getRequestOptions", "(", "conf", ")", "{", "const", "strictSSL", "=", "conf", ".", "get", "(", "'strict-ssl'", ")", ";", "let", "options", "=", "{", "uri", ":", "downloadUrl", ",", "encoding", ":", "null", ",", "// Get response as a buffer", "fo...
Create request opions object @param {object} conf - current NPM config @returns {{uri: string, encoding: null, followRedirect: boolean, headers: {}, strictSSL: *}} @function
[ "Create", "request", "opions", "object" ]
eb18499201779bdef072cbad67bb8ce0360980cb
https://github.com/hypery2k/galenframework-cli/blob/eb18499201779bdef072cbad67bb8ce0360980cb/core/postinstall.js#L218-L255
train
hypery2k/galenframework-cli
core/postinstall.js
requestBinary
function requestBinary(requestOptions, filePath) { const deferred = kew.defer(); const writePath = filePath + '-download-' + Date.now(); log.info('Receiving...'); let bar = null; requestProgress(request(requestOptions, (error, response, body) => { log.info(''); if (!error && response.statusCode === 2...
javascript
function requestBinary(requestOptions, filePath) { const deferred = kew.defer(); const writePath = filePath + '-download-' + Date.now(); log.info('Receiving...'); let bar = null; requestProgress(request(requestOptions, (error, response, body) => { log.info(''); if (!error && response.statusCode === 2...
[ "function", "requestBinary", "(", "requestOptions", ",", "filePath", ")", "{", "const", "deferred", "=", "kew", ".", "defer", "(", ")", ";", "const", "writePath", "=", "filePath", "+", "'-download-'", "+", "Date", ".", "now", "(", ")", ";", "log", ".", ...
Downloads binary file @param {object} requestOptions - to use for HTTP call @param {string} filePath - download URL @returns {*} @function
[ "Downloads", "binary", "file" ]
eb18499201779bdef072cbad67bb8ce0360980cb
https://github.com/hypery2k/galenframework-cli/blob/eb18499201779bdef072cbad67bb8ce0360980cb/core/postinstall.js#L264-L309
train
hypery2k/galenframework-cli
core/postinstall.js
extractDownload
function extractDownload(filePath, requestOptions, retry) { const deferred = kew.defer(); // extract to a unique directory in case multiple processes are // installing and extracting at once const extractedPath = filePath + '-extract-' + Date.now(); let options = { cwd: extractedPath }; fs.mkdirsSync(extra...
javascript
function extractDownload(filePath, requestOptions, retry) { const deferred = kew.defer(); // extract to a unique directory in case multiple processes are // installing and extracting at once const extractedPath = filePath + '-extract-' + Date.now(); let options = { cwd: extractedPath }; fs.mkdirsSync(extra...
[ "function", "extractDownload", "(", "filePath", ",", "requestOptions", ",", "retry", ")", "{", "const", "deferred", "=", "kew", ".", "defer", "(", ")", ";", "// extract to a unique directory in case multiple processes are", "// installing and extracting at once", "const", ...
Extracts the given Archive @param {string} filePath - path of the ZIP archive to extract @param {object} requestOptions - request options for retry attempt @param {boolean} retry - set to true if it's already an retry attempt @returns {*} - path of the extracted archive content @function
[ "Extracts", "the", "given", "Archive" ]
eb18499201779bdef072cbad67bb8ce0360980cb
https://github.com/hypery2k/galenframework-cli/blob/eb18499201779bdef072cbad67bb8ce0360980cb/core/postinstall.js#L319-L363
train
hypery2k/galenframework-cli
core/postinstall.js
copyIntoPlace
function copyIntoPlace(extractedPath, targetPath) { log.info('Removing', targetPath); return kew.nfcall(fs.remove, targetPath).then(function () { // Look for the extracted directory, so we can rename it. const files = fs.readdirSync(extractedPath); for (let i = 0; i < files.length; i++) { const fi...
javascript
function copyIntoPlace(extractedPath, targetPath) { log.info('Removing', targetPath); return kew.nfcall(fs.remove, targetPath).then(function () { // Look for the extracted directory, so we can rename it. const files = fs.readdirSync(extractedPath); for (let i = 0; i < files.length; i++) { const fi...
[ "function", "copyIntoPlace", "(", "extractedPath", ",", "targetPath", ")", "{", "log", ".", "info", "(", "'Removing'", ",", "targetPath", ")", ";", "return", "kew", ".", "nfcall", "(", "fs", ".", "remove", ",", "targetPath", ")", ".", "then", "(", "funct...
Helper function to move folder contents to target directory @param {string} extractedPath - source directory path @param {string} targetPath - target directory path @returns {string} {!Promise.<RESULT>} promise for chaing @function
[ "Helper", "function", "to", "move", "folder", "contents", "to", "target", "directory" ]
eb18499201779bdef072cbad67bb8ce0360980cb
https://github.com/hypery2k/galenframework-cli/blob/eb18499201779bdef072cbad67bb8ce0360980cb/core/postinstall.js#L372-L387
train
Azure/azure-openapi-validator
gulpfile.js
getPathVariableName
function getPathVariableName() { // windows calls it's path 'Path' usually, but this is not guaranteed. if (process.platform === 'win32') { for (const key of Object.keys(process.env)) if (key.match(/^PATH$/i)) return key; return 'Path'; } return "PATH"; }
javascript
function getPathVariableName() { // windows calls it's path 'Path' usually, but this is not guaranteed. if (process.platform === 'win32') { for (const key of Object.keys(process.env)) if (key.match(/^PATH$/i)) return key; return 'Path'; } return "PATH"; }
[ "function", "getPathVariableName", "(", ")", "{", "// windows calls it's path 'Path' usually, but this is not guaranteed.", "if", "(", "process", ".", "platform", "===", "'win32'", ")", "{", "for", "(", "const", "key", "of", "Object", ".", "keys", "(", "process", "....
add .bin to PATH
[ "add", ".", "bin", "to", "PATH" ]
10ae24980631f9eae638e58f3953c38c6f8a852f
https://github.com/Azure/azure-openapi-validator/blob/10ae24980631f9eae638e58f3953c38c6f8a852f/gulpfile.js#L14-L23
train
clay/amphora-storage-postgres
services/db.js
put
function put(key, value, testCacheEnabled) { const cacheEnabled = testCacheEnabled || CACHE_ENABLED; return postgres.put(key, value) .then((res) => { // persist to cache only if cache is set up/enabled, return postgres result regardless if (cacheEnabled) { return redis.put(key, value).then(...
javascript
function put(key, value, testCacheEnabled) { const cacheEnabled = testCacheEnabled || CACHE_ENABLED; return postgres.put(key, value) .then((res) => { // persist to cache only if cache is set up/enabled, return postgres result regardless if (cacheEnabled) { return redis.put(key, value).then(...
[ "function", "put", "(", "key", ",", "value", ",", "testCacheEnabled", ")", "{", "const", "cacheEnabled", "=", "testCacheEnabled", "||", "CACHE_ENABLED", ";", "return", "postgres", ".", "put", "(", "key", ",", "value", ")", ".", "then", "(", "(", "res", "...
Write a single value to cache and db @param {String} key @param {Object} value @param {Boolean} testCacheEnabled used for tests @return {Promise}
[ "Write", "a", "single", "value", "to", "cache", "and", "db" ]
4279f932eed660737f5e2565d8e6cc3349d2776b
https://github.com/clay/amphora-storage-postgres/blob/4279f932eed660737f5e2565d8e6cc3349d2776b/services/db.js#L16-L28
train
clay/amphora-storage-postgres
services/db.js
get
function get(key) { return redis.get(key) .then(data => { if (isUri(key)) return data; return JSON.parse(data); // Parse non-uri data to match Postgres }) .catch(() => postgres.get(key)); }
javascript
function get(key) { return redis.get(key) .then(data => { if (isUri(key)) return data; return JSON.parse(data); // Parse non-uri data to match Postgres }) .catch(() => postgres.get(key)); }
[ "function", "get", "(", "key", ")", "{", "return", "redis", ".", "get", "(", "key", ")", ".", "then", "(", "data", "=>", "{", "if", "(", "isUri", "(", "key", ")", ")", "return", "data", ";", "return", "JSON", ".", "parse", "(", "data", ")", ";"...
Return a value from the db or cache. Must return a Object, not stringified JSON @param {String} key @return {Promise}
[ "Return", "a", "value", "from", "the", "db", "or", "cache", ".", "Must", "return", "a", "Object", "not", "stringified", "JSON" ]
4279f932eed660737f5e2565d8e6cc3349d2776b
https://github.com/clay/amphora-storage-postgres/blob/4279f932eed660737f5e2565d8e6cc3349d2776b/services/db.js#L37-L44
train
clay/amphora-storage-postgres
services/db.js
batch
function batch(ops, testCacheEnabled) { const cacheEnabled = testCacheEnabled || CACHE_ENABLED; return postgres.batch(ops) .then((res) => { if (cacheEnabled) { return redis.batch(ops).then(() => res); } return res; }); }
javascript
function batch(ops, testCacheEnabled) { const cacheEnabled = testCacheEnabled || CACHE_ENABLED; return postgres.batch(ops) .then((res) => { if (cacheEnabled) { return redis.batch(ops).then(() => res); } return res; }); }
[ "function", "batch", "(", "ops", ",", "testCacheEnabled", ")", "{", "const", "cacheEnabled", "=", "testCacheEnabled", "||", "CACHE_ENABLED", ";", "return", "postgres", ".", "batch", "(", "ops", ")", ".", "then", "(", "(", "res", ")", "=>", "{", "if", "("...
Process a whole group of saves @param {Array} ops @param {Boolean} testCacheEnabled used for tests @return {Promise}
[ "Process", "a", "whole", "group", "of", "saves" ]
4279f932eed660737f5e2565d8e6cc3349d2776b
https://github.com/clay/amphora-storage-postgres/blob/4279f932eed660737f5e2565d8e6cc3349d2776b/services/db.js#L53-L64
train
clay/amphora-storage-postgres
postgres/client.js
createDBIfNotExists
function createDBIfNotExists() { const tmpClient = knexLib({ client: 'pg', connection: { host: POSTGRES_HOST, user: POSTGRES_USER, password: POSTGRES_PASSWORD, database: 'postgres', port: POSTGRES_PORT }, pool: { min: CONNECTION_POOL_MIN, max: CONNECTION_POOL_MAX } }); ...
javascript
function createDBIfNotExists() { const tmpClient = knexLib({ client: 'pg', connection: { host: POSTGRES_HOST, user: POSTGRES_USER, password: POSTGRES_PASSWORD, database: 'postgres', port: POSTGRES_PORT }, pool: { min: CONNECTION_POOL_MIN, max: CONNECTION_POOL_MAX } }); ...
[ "function", "createDBIfNotExists", "(", ")", "{", "const", "tmpClient", "=", "knexLib", "(", "{", "client", ":", "'pg'", ",", "connection", ":", "{", "host", ":", "POSTGRES_HOST", ",", "user", ":", "POSTGRES_USER", ",", "password", ":", "POSTGRES_PASSWORD", ...
Connect to the default DB and create the Clay DB. Once the DB has been made the connection can be killed and we can try to re-connect to the Clay DB @returns {Promise}
[ "Connect", "to", "the", "default", "DB", "and", "create", "the", "Clay", "DB", ".", "Once", "the", "DB", "has", "been", "made", "the", "connection", "can", "be", "killed", "and", "we", "can", "try", "to", "re", "-", "connect", "to", "the", "Clay", "D...
4279f932eed660737f5e2565d8e6cc3349d2776b
https://github.com/clay/amphora-storage-postgres/blob/4279f932eed660737f5e2565d8e6cc3349d2776b/postgres/client.js#L21-L38
train
clay/amphora-storage-postgres
postgres/client.js
connect
function connect() { log('debug', `Connecting to Postgres at ${POSTGRES_HOST}:${POSTGRES_PORT}`); knex = knexLib({ client: 'pg', connection: { host: POSTGRES_HOST, user: POSTGRES_USER, password: POSTGRES_PASSWORD, database: POSTGRES_DB, port: POSTGRES_PORT }, pool: { m...
javascript
function connect() { log('debug', `Connecting to Postgres at ${POSTGRES_HOST}:${POSTGRES_PORT}`); knex = knexLib({ client: 'pg', connection: { host: POSTGRES_HOST, user: POSTGRES_USER, password: POSTGRES_PASSWORD, database: POSTGRES_DB, port: POSTGRES_PORT }, pool: { m...
[ "function", "connect", "(", ")", "{", "log", "(", "'debug'", ",", "`", "${", "POSTGRES_HOST", "}", "${", "POSTGRES_PORT", "}", "`", ")", ";", "knex", "=", "knexLib", "(", "{", "client", ":", "'pg'", ",", "connection", ":", "{", "host", ":", "POSTGRES...
Connect to the DB. We need to do a quick check to see if we're actually connected to the Clay DB. If we aren't, connect to default and then use that connection to create the Clay DB. @returns {Promise}
[ "Connect", "to", "the", "DB", ".", "We", "need", "to", "do", "a", "quick", "check", "to", "see", "if", "we", "re", "actually", "connected", "to", "the", "Clay", "DB", ".", "If", "we", "aren", "t", "connect", "to", "default", "and", "then", "use", "...
4279f932eed660737f5e2565d8e6cc3349d2776b
https://github.com/clay/amphora-storage-postgres/blob/4279f932eed660737f5e2565d8e6cc3349d2776b/postgres/client.js#L48-L66
train
clay/amphora-storage-postgres
postgres/client.js
get
function get(key) { const dataProp = 'data'; return baseQuery(key) .select(dataProp) .where('id', key) .then(pullValFromRows(key, dataProp)); }
javascript
function get(key) { const dataProp = 'data'; return baseQuery(key) .select(dataProp) .where('id', key) .then(pullValFromRows(key, dataProp)); }
[ "function", "get", "(", "key", ")", "{", "const", "dataProp", "=", "'data'", ";", "return", "baseQuery", "(", "key", ")", ".", "select", "(", "dataProp", ")", ".", "where", "(", "'id'", ",", "key", ")", ".", "then", "(", "pullValFromRows", "(", "key"...
Retrieve a single entry from the DB @param {String} key @return {Promise}
[ "Retrieve", "a", "single", "entry", "from", "the", "DB" ]
4279f932eed660737f5e2565d8e6cc3349d2776b
https://github.com/clay/amphora-storage-postgres/blob/4279f932eed660737f5e2565d8e6cc3349d2776b/postgres/client.js#L99-L106
train
clay/amphora-storage-postgres
postgres/client.js
put
function put(key, value) { const { schema, table } = findSchemaAndTable(key), map = columnToValueMap('id', key); // create the value map // add data to the map columnToValueMap('data', wrapInObject(key, parseOrNot(value)), map); let url; if (isUri(key)) { url = decode(key.split('/_uris/').pop()); ...
javascript
function put(key, value) { const { schema, table } = findSchemaAndTable(key), map = columnToValueMap('id', key); // create the value map // add data to the map columnToValueMap('data', wrapInObject(key, parseOrNot(value)), map); let url; if (isUri(key)) { url = decode(key.split('/_uris/').pop()); ...
[ "function", "put", "(", "key", ",", "value", ")", "{", "const", "{", "schema", ",", "table", "}", "=", "findSchemaAndTable", "(", "key", ")", ",", "map", "=", "columnToValueMap", "(", "'id'", ",", "key", ")", ";", "// create the value map", "// add data to...
Insert a row into the DB @param {String} key @param {Object} value @return {Promise}
[ "Insert", "a", "row", "into", "the", "DB" ]
4279f932eed660737f5e2565d8e6cc3349d2776b
https://github.com/clay/amphora-storage-postgres/blob/4279f932eed660737f5e2565d8e6cc3349d2776b/postgres/client.js#L131-L150
train
clay/amphora-storage-postgres
postgres/client.js
patch
function patch(prop) { return (key, value) => { const { schema, table } = findSchemaAndTable(key); return raw('UPDATE ?? SET ?? = ?? || ? WHERE id = ?', [`${schema ? `${schema}.` : ''}${table}`, prop, prop, JSON.stringify(value), key]); }; }
javascript
function patch(prop) { return (key, value) => { const { schema, table } = findSchemaAndTable(key); return raw('UPDATE ?? SET ?? = ?? || ? WHERE id = ?', [`${schema ? `${schema}.` : ''}${table}`, prop, prop, JSON.stringify(value), key]); }; }
[ "function", "patch", "(", "prop", ")", "{", "return", "(", "key", ",", "value", ")", "=>", "{", "const", "{", "schema", ",", "table", "}", "=", "findSchemaAndTable", "(", "key", ")", ";", "return", "raw", "(", "'UPDATE ?? SET ?? = ?? || ? WHERE id = ?'", "...
Returns a function that handles data patching based on the curried prop. @param {String} prop @return {Function}
[ "Returns", "a", "function", "that", "handles", "data", "patching", "based", "on", "the", "curried", "prop", "." ]
4279f932eed660737f5e2565d8e6cc3349d2776b
https://github.com/clay/amphora-storage-postgres/blob/4279f932eed660737f5e2565d8e6cc3349d2776b/postgres/client.js#L157-L163
train
clay/amphora-storage-postgres
postgres/client.js
createReadStream
function createReadStream(options) { const { prefix, values, keys } = options, transform = TransformStream(options), selects = []; if (keys) selects.push('id'); if (values) selects.push('data'); baseQuery(prefix) .select(...selects) .where('id', 'like', `${prefix}%`) .pipe(transform); r...
javascript
function createReadStream(options) { const { prefix, values, keys } = options, transform = TransformStream(options), selects = []; if (keys) selects.push('id'); if (values) selects.push('data'); baseQuery(prefix) .select(...selects) .where('id', 'like', `${prefix}%`) .pipe(transform); r...
[ "function", "createReadStream", "(", "options", ")", "{", "const", "{", "prefix", ",", "values", ",", "keys", "}", "=", "options", ",", "transform", "=", "TransformStream", "(", "options", ")", ",", "selects", "=", "[", "]", ";", "if", "(", "keys", ")"...
Return a readable stream of query results from the db @param {Object} options @return {Stream}
[ "Return", "a", "readable", "stream", "of", "query", "results", "from", "the", "db" ]
4279f932eed660737f5e2565d8e6cc3349d2776b
https://github.com/clay/amphora-storage-postgres/blob/4279f932eed660737f5e2565d8e6cc3349d2776b/postgres/client.js#L240-L254
train