id
int32
0
58k
repo
stringlengths
5
67
path
stringlengths
4
116
func_name
stringlengths
0
58
original_string
stringlengths
52
373k
language
stringclasses
1 value
code
stringlengths
52
373k
code_tokens
list
docstring
stringlengths
4
11.8k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
86
226
25,200
C2FO/patio
lib/associations/manyToMany.js
function () { if (!this.__joinTableDataset) { var ds = this.__joinTableDataset = this.model.dataset.db.from(this.joinTableName), model = this.model, options = this.__opts; var identifierInputMethod = isUndefined(options.identifierInputMethod) ? model.identifierInp...
javascript
function () { if (!this.__joinTableDataset) { var ds = this.__joinTableDataset = this.model.dataset.db.from(this.joinTableName), model = this.model, options = this.__opts; var identifierInputMethod = isUndefined(options.identifierInputMethod) ? model.identifierInp...
[ "function", "(", ")", "{", "if", "(", "!", "this", ".", "__joinTableDataset", ")", "{", "var", "ds", "=", "this", ".", "__joinTableDataset", "=", "this", ".", "model", ".", "dataset", ".", "db", ".", "from", "(", "this", ".", "joinTableName", ")", ",...
returns our join table model
[ "returns", "our", "join", "table", "model" ]
6dba197e468d36189cd74846c0cdbf0755a0ff8d
https://github.com/C2FO/patio/blob/6dba197e468d36189cd74846c0cdbf0755a0ff8d/lib/associations/manyToMany.js#L279-L292
25,201
C2FO/patio
lib/plugins/validation.js
function () { this.errors = {}; return flatten(this._static.validators.map(function runValidator(validator) { var col = validator.col, val = this.__values[validator.col], ret = validator.validate(val); this.errors[col] = ret; return ret; ...
javascript
function () { this.errors = {}; return flatten(this._static.validators.map(function runValidator(validator) { var col = validator.col, val = this.__values[validator.col], ret = validator.validate(val); this.errors[col] = ret; return ret; ...
[ "function", "(", ")", "{", "this", ".", "errors", "=", "{", "}", ";", "return", "flatten", "(", "this", ".", "_static", ".", "validators", ".", "map", "(", "function", "runValidator", "(", "validator", ")", "{", "var", "col", "=", "validator", ".", "...
Validates a model, returning an array of error messages for each invalid property. @return {String[]} an array of error messages for each invalid property.
[ "Validates", "a", "model", "returning", "an", "array", "of", "error", "messages", "for", "each", "invalid", "property", "." ]
6dba197e468d36189cd74846c0cdbf0755a0ff8d
https://github.com/C2FO/patio/blob/6dba197e468d36189cd74846c0cdbf0755a0ff8d/lib/plugins/validation.js#L416-L423
25,202
C2FO/patio
lib/plugins/validation.js
function (name) { this.__initValidation(); var ret; if (isFunction(name)) { name.call(this, this.__getValidator.bind(this)); ret = this; } else if (isString(name)) { ret = this.__getValidator(name); } else { ...
javascript
function (name) { this.__initValidation(); var ret; if (isFunction(name)) { name.call(this, this.__getValidator.bind(this)); ret = this; } else if (isString(name)) { ret = this.__getValidator(name); } else { ...
[ "function", "(", "name", ")", "{", "this", ".", "__initValidation", "(", ")", ";", "var", "ret", ";", "if", "(", "isFunction", "(", "name", ")", ")", "{", "name", ".", "call", "(", "this", ",", "this", ".", "__getValidator", ".", "bind", "(", "this...
Sets up validation for a model. To do single col validation {@code var Model = patio.addModel("validator", { plugins:[ValidatorPlugin] }); //this ensures column assignment Model.validate("col1").isDefined().isAlphaNumeric().hasLength(1, 10); //col2 does not have to be assigned but if it is it must match /hello/ig. Mo...
[ "Sets", "up", "validation", "for", "a", "model", "." ]
6dba197e468d36189cd74846c0cdbf0755a0ff8d
https://github.com/C2FO/patio/blob/6dba197e468d36189cd74846c0cdbf0755a0ff8d/lib/plugins/validation.js#L508-L520
25,203
donejs/done-ssr
zones/requests/xhr-cookies.js
function(httpMethod, xhrURL){ var cookie = headers["cookie"] || ""; // Monkey patch URL onto xhr for cookie origin checking in the send method. var reqURL = url.parse(xhrURL); this.__url = reqURL; if (options.auth && cookie) { var domainIsApproved = options.auth.domains.reduce(function(prev, domain...
javascript
function(httpMethod, xhrURL){ var cookie = headers["cookie"] || ""; // Monkey patch URL onto xhr for cookie origin checking in the send method. var reqURL = url.parse(xhrURL); this.__url = reqURL; if (options.auth && cookie) { var domainIsApproved = options.auth.domains.reduce(function(prev, domain...
[ "function", "(", "httpMethod", ",", "xhrURL", ")", "{", "var", "cookie", "=", "headers", "[", "\"cookie\"", "]", "||", "\"\"", ";", "// Monkey patch URL onto xhr for cookie origin checking in the send method.", "var", "reqURL", "=", "url", ".", "parse", "(", "xhrURL...
Override open to attach auth header if the domain is approved.
[ "Override", "open", "to", "attach", "auth", "header", "if", "the", "domain", "is", "approved", "." ]
2cdc7213c0fc5f17752132363df3c2f2dd5436f1
https://github.com/donejs/done-ssr/blob/2cdc7213c0fc5f17752132363df3c2f2dd5436f1/zones/requests/xhr-cookies.js#L18-L52
25,204
donejs/done-ssr
lib/util/resolve_url.js
resolveUrl
function resolveUrl(headers, relativeURL) { var path = headers[":path"] || ""; var baseUri = headers[":scheme"] + "://" + headers[":authority"] + path; var outURL; if (relativeURL && !fullUrlExp.test(relativeURL) ) { outURL = url.resolve(baseUri, relativeURL); } else { outURL = relativeURL; } return outURL;...
javascript
function resolveUrl(headers, relativeURL) { var path = headers[":path"] || ""; var baseUri = headers[":scheme"] + "://" + headers[":authority"] + path; var outURL; if (relativeURL && !fullUrlExp.test(relativeURL) ) { outURL = url.resolve(baseUri, relativeURL); } else { outURL = relativeURL; } return outURL;...
[ "function", "resolveUrl", "(", "headers", ",", "relativeURL", ")", "{", "var", "path", "=", "headers", "[", "\":path\"", "]", "||", "\"\"", ";", "var", "baseUri", "=", "headers", "[", "\":scheme\"", "]", "+", "\"://\"", "+", "headers", "[", "\":authority\"...
Resolve a URL to be a full URL relative to the requested page.
[ "Resolve", "a", "URL", "to", "be", "a", "full", "URL", "relative", "to", "the", "requested", "page", "." ]
2cdc7213c0fc5f17752132363df3c2f2dd5436f1
https://github.com/donejs/done-ssr/blob/2cdc7213c0fc5f17752132363df3c2f2dd5436f1/lib/util/resolve_url.js#L7-L18
25,205
ethereumjs/ethashjs
index.js
findLastSeed
function findLastSeed (epoc, cb2) { if (epoc === 0) { return cb2(ethUtil.zeros(32), 0) } self.cacheDB.get(epoc, self.dbOpts, function (err, data) { if (!err) { cb2(data.seed, epoc) } else { findLastSeed(epoc - 1, cb2) } }) }
javascript
function findLastSeed (epoc, cb2) { if (epoc === 0) { return cb2(ethUtil.zeros(32), 0) } self.cacheDB.get(epoc, self.dbOpts, function (err, data) { if (!err) { cb2(data.seed, epoc) } else { findLastSeed(epoc - 1, cb2) } }) }
[ "function", "findLastSeed", "(", "epoc", ",", "cb2", ")", "{", "if", "(", "epoc", "===", "0", ")", "{", "return", "cb2", "(", "ethUtil", ".", "zeros", "(", "32", ")", ",", "0", ")", "}", "self", ".", "cacheDB", ".", "get", "(", "epoc", ",", "se...
gives the seed the first epoc found
[ "gives", "the", "seed", "the", "first", "epoc", "found" ]
f88973ec6ca9954dc7b67bca13e74bf10f19dba6
https://github.com/ethereumjs/ethashjs/blob/f88973ec6ca9954dc7b67bca13e74bf10f19dba6/index.js#L110-L122
25,206
nimiq/keyguard-next
tools/functions.js
listDirectories
function listDirectories(dirPath) { return fs.readdirSync(dirPath).filter( /** * @param {string} file * @returns {boolean} * */ file => fs.statSync(path.join(dirPath, file)).isDirectory(), ); }
javascript
function listDirectories(dirPath) { return fs.readdirSync(dirPath).filter( /** * @param {string} file * @returns {boolean} * */ file => fs.statSync(path.join(dirPath, file)).isDirectory(), ); }
[ "function", "listDirectories", "(", "dirPath", ")", "{", "return", "fs", ".", "readdirSync", "(", "dirPath", ")", ".", "filter", "(", "/**\n * @param {string} file\n * @returns {boolean}\n * */", "file", "=>", "fs", ".", "statSync", "(", "path", ...
List directories in a directory @param {string} dirPath - Directory to search @returns {string[]}
[ "List", "directories", "in", "a", "directory" ]
5e0aaca8b6cec2058b4e2b26a8dda00ba63b141a
https://github.com/nimiq/keyguard-next/blob/5e0aaca8b6cec2058b4e2b26a8dda00ba63b141a/tools/functions.js#L10-L18
25,207
nimiq/keyguard-next
tools/functions.js
findDependencies
function findDependencies(startFile, class2Path, deps) { // Create a new regex object to reset the readIndex const depRegEx = /global ([a-zA-Z0-9,\s]+) \*/g; // Get global variable const contents = fs.readFileSync(startFile).toString(); /** @type {string[]} */ let fileDeps = []; let fileDep...
javascript
function findDependencies(startFile, class2Path, deps) { // Create a new regex object to reset the readIndex const depRegEx = /global ([a-zA-Z0-9,\s]+) \*/g; // Get global variable const contents = fs.readFileSync(startFile).toString(); /** @type {string[]} */ let fileDeps = []; let fileDep...
[ "function", "findDependencies", "(", "startFile", ",", "class2Path", ",", "deps", ")", "{", "// Create a new regex object to reset the readIndex", "const", "depRegEx", "=", "/", "global ([a-zA-Z0-9,\\s]+) \\*", "/", "g", ";", "// Get global variable", "const", "contents", ...
Recursively collect class dependencies from files' global definitions. @param {string} startFile @param {object} class2Path @param {string[]} deps @returns {string[]}
[ "Recursively", "collect", "class", "dependencies", "from", "files", "global", "definitions", "." ]
5e0aaca8b6cec2058b4e2b26a8dda00ba63b141a
https://github.com/nimiq/keyguard-next/blob/5e0aaca8b6cec2058b4e2b26a8dda00ba63b141a/tools/functions.js#L68-L101
25,208
nimiq/keyguard-next
tools/functions.js
findScripts
function findScripts(indexPath) { const scriptRegEx = /<script.+src="(.+)".*?>/g; const contents = fs.readFileSync(indexPath).toString(); /** @type {string[]} */ const scripts = []; let scriptMatch; while ((scriptMatch = scriptRegEx.exec(contents)) !== null) { // eslint-disable-line no-cond-as...
javascript
function findScripts(indexPath) { const scriptRegEx = /<script.+src="(.+)".*?>/g; const contents = fs.readFileSync(indexPath).toString(); /** @type {string[]} */ const scripts = []; let scriptMatch; while ((scriptMatch = scriptRegEx.exec(contents)) !== null) { // eslint-disable-line no-cond-as...
[ "function", "findScripts", "(", "indexPath", ")", "{", "const", "scriptRegEx", "=", "/", "<script.+src=\"(.+)\".*?>", "/", "g", ";", "const", "contents", "=", "fs", ".", "readFileSync", "(", "indexPath", ")", ".", "toString", "(", ")", ";", "/** @type {string[...
Retrieve all script pathes from an HTML file @param {string} indexPath @returns {string[]}
[ "Retrieve", "all", "script", "pathes", "from", "an", "HTML", "file" ]
5e0aaca8b6cec2058b4e2b26a8dda00ba63b141a
https://github.com/nimiq/keyguard-next/blob/5e0aaca8b6cec2058b4e2b26a8dda00ba63b141a/tools/functions.js#L109-L123
25,209
GitbookIO/plugin-exercises
assets/exercises.js
function(data, eventType) { switch(eventType) { case 'progress': // Update UI loading bar break; case 'timeout': finish(new Error(data)); break; case 'result': ...
javascript
function(data, eventType) { switch(eventType) { case 'progress': // Update UI loading bar break; case 'timeout': finish(new Error(data)); break; case 'result': ...
[ "function", "(", "data", ",", "eventType", ")", "{", "switch", "(", "eventType", ")", "{", "case", "'progress'", ":", "// Update UI loading bar", "break", ";", "case", "'timeout'", ":", "finish", "(", "new", "Error", "(", "data", ")", ")", ";", "break", ...
Handles all our events
[ "Handles", "all", "our", "events" ]
b29094b2794a6dff5b2f77d99299244284b7cb92
https://github.com/GitbookIO/plugin-exercises/blob/b29094b2794a6dff5b2f77d99299244284b7cb92/assets/exercises.js#L28-L60
25,210
GitbookIO/plugin-exercises
assets/exercises.js
function($exercise) { var codeSolution = $exercise.find(".code-solution").text(); var codeValidation = $exercise.find(".code-validation").text(); var codeContext = $exercise.find(".code-context").text(); var editor = ace.edit($exercise.find(".editor").get(0)); editor.setTheme("a...
javascript
function($exercise) { var codeSolution = $exercise.find(".code-solution").text(); var codeValidation = $exercise.find(".code-validation").text(); var codeContext = $exercise.find(".code-context").text(); var editor = ace.edit($exercise.find(".editor").get(0)); editor.setTheme("a...
[ "function", "(", "$exercise", ")", "{", "var", "codeSolution", "=", "$exercise", ".", "find", "(", "\".code-solution\"", ")", ".", "text", "(", ")", ";", "var", "codeValidation", "=", "$exercise", ".", "find", "(", "\".code-validation\"", ")", ".", "text", ...
Bind an exercise Add code editor, bind interractions
[ "Bind", "an", "exercise", "Add", "code", "editor", "bind", "interractions" ]
b29094b2794a6dff5b2f77d99299244284b7cb92
https://github.com/GitbookIO/plugin-exercises/blob/b29094b2794a6dff5b2f77d99299244284b7cb92/assets/exercises.js#L101-L139
25,211
nimiq/keyguard-next
src/lib/QrScannerWorker.js
reorderFinderPatterns
function reorderFinderPatterns(pattern1, pattern2, pattern3) { // Find distances between pattern centers const oneTwoDistance = distance(pattern1, pattern2); const twoThreeDistance = distance(pattern2, pattern3); const oneThreeDistance = distance(pattern1, pattern3); let bottomLe...
javascript
function reorderFinderPatterns(pattern1, pattern2, pattern3) { // Find distances between pattern centers const oneTwoDistance = distance(pattern1, pattern2); const twoThreeDistance = distance(pattern2, pattern3); const oneThreeDistance = distance(pattern1, pattern3); let bottomLe...
[ "function", "reorderFinderPatterns", "(", "pattern1", ",", "pattern2", ",", "pattern3", ")", "{", "// Find distances between pattern centers", "const", "oneTwoDistance", "=", "distance", "(", "pattern1", ",", "pattern2", ")", ";", "const", "twoThreeDistance", "=", "di...
Takes three finder patterns and organizes them into topLeft, topRight, etc
[ "Takes", "three", "finder", "patterns", "and", "organizes", "them", "into", "topLeft", "topRight", "etc" ]
5e0aaca8b6cec2058b4e2b26a8dda00ba63b141a
https://github.com/nimiq/keyguard-next/blob/5e0aaca8b6cec2058b4e2b26a8dda00ba63b141a/src/lib/QrScannerWorker.js#L2456-L2481
25,212
nimiq/keyguard-next
src/lib/QrScannerWorker.js
countBlackWhiteRun
function countBlackWhiteRun(origin, end, matrix, length) { const rise = end.y - origin.y; const run = end.x - origin.x; const towardsEnd = countBlackWhiteRunTowardsPoint(origin, end, matrix, Math.ceil(length / 2)); const awayFromEnd = countBlackWhiteRunTowardsPoint(origin, { x: origin.x ...
javascript
function countBlackWhiteRun(origin, end, matrix, length) { const rise = end.y - origin.y; const run = end.x - origin.x; const towardsEnd = countBlackWhiteRunTowardsPoint(origin, end, matrix, Math.ceil(length / 2)); const awayFromEnd = countBlackWhiteRunTowardsPoint(origin, { x: origin.x ...
[ "function", "countBlackWhiteRun", "(", "origin", ",", "end", ",", "matrix", ",", "length", ")", "{", "const", "rise", "=", "end", ".", "y", "-", "origin", ".", "y", ";", "const", "run", "=", "end", ".", "x", "-", "origin", ".", "x", ";", "const", ...
Takes an origin point and an end point and counts the sizes of the black white run in the origin point along the line that intersects with the end point. Returns an array of elements, representing the pixel sizes of the black white run. Takes a length which represents the number of switches from black to white to look ...
[ "Takes", "an", "origin", "point", "and", "an", "end", "point", "and", "counts", "the", "sizes", "of", "the", "black", "white", "run", "in", "the", "origin", "point", "along", "the", "line", "that", "intersects", "with", "the", "end", "point", ".", "Retur...
5e0aaca8b6cec2058b4e2b26a8dda00ba63b141a
https://github.com/nimiq/keyguard-next/blob/5e0aaca8b6cec2058b4e2b26a8dda00ba63b141a/src/lib/QrScannerWorker.js#L2569-L2576
25,213
nimiq/keyguard-next
src/lib/QrScannerWorker.js
scoreBlackWhiteRun
function scoreBlackWhiteRun(sequence, ratios) { const averageSize = sum(sequence) / sum(ratios); let error = 0; ratios.forEach((ratio, i) => { error += Math.pow((sequence[i] - ratio * averageSize), 2); }); return { averageSize, error }; }
javascript
function scoreBlackWhiteRun(sequence, ratios) { const averageSize = sum(sequence) / sum(ratios); let error = 0; ratios.forEach((ratio, i) => { error += Math.pow((sequence[i] - ratio * averageSize), 2); }); return { averageSize, error }; }
[ "function", "scoreBlackWhiteRun", "(", "sequence", ",", "ratios", ")", "{", "const", "averageSize", "=", "sum", "(", "sequence", ")", "/", "sum", "(", "ratios", ")", ";", "let", "error", "=", "0", ";", "ratios", ".", "forEach", "(", "(", "ratio", ",", ...
Takes in a black white run and an array of expected ratios. Returns the average size of the run as well as the "error" - that is the amount the run diverges from the expected ratio
[ "Takes", "in", "a", "black", "white", "run", "and", "an", "array", "of", "expected", "ratios", ".", "Returns", "the", "average", "size", "of", "the", "run", "as", "well", "as", "the", "error", "-", "that", "is", "the", "amount", "the", "run", "diverges...
5e0aaca8b6cec2058b4e2b26a8dda00ba63b141a
https://github.com/nimiq/keyguard-next/blob/5e0aaca8b6cec2058b4e2b26a8dda00ba63b141a/src/lib/QrScannerWorker.js#L2579-L2586
25,214
ChaosGroup/json-ws
lib/client/index.js
RpcTunnel
function RpcTunnel(url, sslSettings) { var self = this; if (! (this instanceof RpcTunnel)) { return new RpcTunnel(url, sslSettings); } this.transports = {}; if (!url) { throw new Error('Missing url parameter, which should be either a URL or client transport.') } var transport = null; if (typeo...
javascript
function RpcTunnel(url, sslSettings) { var self = this; if (! (this instanceof RpcTunnel)) { return new RpcTunnel(url, sslSettings); } this.transports = {}; if (!url) { throw new Error('Missing url parameter, which should be either a URL or client transport.') } var transport = null; if (typeo...
[ "function", "RpcTunnel", "(", "url", ",", "sslSettings", ")", "{", "var", "self", "=", "this", ";", "if", "(", "!", "(", "this", "instanceof", "RpcTunnel", ")", ")", "{", "return", "new", "RpcTunnel", "(", "url", ",", "sslSettings", ")", ";", "}", "t...
Client RPC tunnel
[ "Client", "RPC", "tunnel" ]
26609fba655f053ad4d014ef92e5d901a9a6b6fa
https://github.com/ChaosGroup/json-ws/blob/26609fba655f053ad4d014ef92e5d901a9a6b6fa/lib/client/index.js#L22-L71
25,215
webgme/webgme-cli
src/mixins/Enableable/RemoveFromPlugin/RemoveFromPlugin.js
function () { // Call base class' constructor. PluginBase.call(this); this.pluginMetadata = { name: 'ComponentDisabler', version: '2.0.0', configStructure: [ { name: 'field', displayName: 'Field', description...
javascript
function () { // Call base class' constructor. PluginBase.call(this); this.pluginMetadata = { name: 'ComponentDisabler', version: '2.0.0', configStructure: [ { name: 'field', displayName: 'Field', description...
[ "function", "(", ")", "{", "// Call base class' constructor.", "PluginBase", ".", "call", "(", "this", ")", ";", "this", ".", "pluginMetadata", "=", "{", "name", ":", "'ComponentDisabler'", ",", "version", ":", "'2.0.0'", ",", "configStructure", ":", "[", "{",...
Initializes a new instance of RemoveFromPlugin. @class @augments {PluginBase} @classdesc This class represents the plugin RemoveFromPlugin. @constructor
[ "Initializes", "a", "new", "instance", "of", "RemoveFromPlugin", "." ]
a2f587ab050f50856692eae1167b9fbdf0da003c
https://github.com/webgme/webgme-cli/blob/a2f587ab050f50856692eae1167b9fbdf0da003c/src/mixins/Enableable/RemoveFromPlugin/RemoveFromPlugin.js#L22-L43
25,216
ChaosGroup/json-ws
lib/get-language-proxy.js
getLanguageProxy
function getLanguageProxy(options) { // Try and find if one is available const proxyScript = path.resolve(__dirname, '..', 'proxies', options.language + '.ejs'); return new Promise(function(resolve, reject) { fs.stat(proxyScript, function(err) { if (err) { return reject(err); } ejs.renderFile( p...
javascript
function getLanguageProxy(options) { // Try and find if one is available const proxyScript = path.resolve(__dirname, '..', 'proxies', options.language + '.ejs'); return new Promise(function(resolve, reject) { fs.stat(proxyScript, function(err) { if (err) { return reject(err); } ejs.renderFile( p...
[ "function", "getLanguageProxy", "(", "options", ")", "{", "// Try and find if one is available", "const", "proxyScript", "=", "path", ".", "resolve", "(", "__dirname", ",", "'..'", ",", "'proxies'", ",", "options", ".", "language", "+", "'.ejs'", ")", ";", "retu...
Return a language proxy for the specified service instance and @param options @param options.serviceInstance {object} JSON-WS service instance @param options.language {string} target language, e.g. "JavaScript" or "Python" @param [options.localName] {string} the name of the proxy class. Defaults to "Proxy" @returns {ob...
[ "Return", "a", "language", "proxy", "for", "the", "specified", "service", "instance", "and" ]
26609fba655f053ad4d014ef92e5d901a9a6b6fa
https://github.com/ChaosGroup/json-ws/blob/26609fba655f053ad4d014ef92e5d901a9a6b6fa/lib/get-language-proxy.js#L16-L44
25,217
nodules/luster
lib/configuration/check.js
checkConfiguration
function checkConfiguration(conf) { let failedChecks = 0; for (const path of Object.keys(CHECKS)) { // @todo avoid try..catch try { checkProperty(path, get(conf, path), CHECKS[path]); } catch (error) { LusterConfigurationError.ensureError(error).log(); ...
javascript
function checkConfiguration(conf) { let failedChecks = 0; for (const path of Object.keys(CHECKS)) { // @todo avoid try..catch try { checkProperty(path, get(conf, path), CHECKS[path]); } catch (error) { LusterConfigurationError.ensureError(error).log(); ...
[ "function", "checkConfiguration", "(", "conf", ")", "{", "let", "failedChecks", "=", "0", ";", "for", "(", "const", "path", "of", "Object", ".", "keys", "(", "CHECKS", ")", ")", "{", "// @todo avoid try..catch", "try", "{", "checkProperty", "(", "path", ",...
Validate configuration object using descriptions from CHECKS const @param {Object} conf configuration object @returns {Number} of failed checks
[ "Validate", "configuration", "object", "using", "descriptions", "from", "CHECKS", "const" ]
420afc09fdc63872e42e6a38c51e0cf9946d75c7
https://github.com/nodules/luster/blob/420afc09fdc63872e42e6a38c51e0cf9946d75c7/lib/configuration/check.js#L84-L98
25,218
nodules/luster
lib/cluster_process.js
extendResolvePath
function extendResolvePath(basedir) { // using module internals isn't good, but restarting with corrected NODE_PATH looks more ugly, IMO module.paths.push(basedir); const _basedir = basedir.split('/'), size = basedir.length; let i = 0; while (size > i++) { const modulesPath = _base...
javascript
function extendResolvePath(basedir) { // using module internals isn't good, but restarting with corrected NODE_PATH looks more ugly, IMO module.paths.push(basedir); const _basedir = basedir.split('/'), size = basedir.length; let i = 0; while (size > i++) { const modulesPath = _base...
[ "function", "extendResolvePath", "(", "basedir", ")", "{", "// using module internals isn't good, but restarting with corrected NODE_PATH looks more ugly, IMO", "module", ".", "paths", ".", "push", "(", "basedir", ")", ";", "const", "_basedir", "=", "basedir", ".", "split",...
Add `basedir`, `node_modules` contained in the `basedir` and its ancestors to `module.paths` @param {String} basedir
[ "Add", "basedir", "node_modules", "contained", "in", "the", "basedir", "and", "its", "ancestors", "to", "module", ".", "paths" ]
420afc09fdc63872e42e6a38c51e0cf9946d75c7
https://github.com/nodules/luster/blob/420afc09fdc63872e42e6a38c51e0cf9946d75c7/lib/cluster_process.js#L23-L38
25,219
multiformats/js-multihashing-async
src/index.js
Multihashing
async function Multihashing (buf, alg, length) { const digest = await Multihashing.digest(buf, alg, length) return multihash.encode(digest, alg, length) }
javascript
async function Multihashing (buf, alg, length) { const digest = await Multihashing.digest(buf, alg, length) return multihash.encode(digest, alg, length) }
[ "async", "function", "Multihashing", "(", "buf", ",", "alg", ",", "length", ")", "{", "const", "digest", "=", "await", "Multihashing", ".", "digest", "(", "buf", ",", "alg", ",", "length", ")", "return", "multihash", ".", "encode", "(", "digest", ",", ...
Hash the given `buf` using the algorithm specified by `alg`. @param {Buffer} buf - The value to hash. @param {number|string} alg - The algorithm to use eg 'sha1' @param {number} [length] - Optionally trim the result to this length. @returns {Promise<Buffer>}
[ "Hash", "the", "given", "buf", "using", "the", "algorithm", "specified", "by", "alg", "." ]
865e9caf9dcdbcdf12d0008129e3b062528317d5
https://github.com/multiformats/js-multihashing-async/blob/865e9caf9dcdbcdf12d0008129e3b062528317d5/src/index.js#L15-L18
25,220
edx/frontend-auth
src/AuthenticatedAPIClient/axiosConfig.js
applyAxiosDefaults
function applyAxiosDefaults(authenticatedAPIClient) { /* eslint-disable no-param-reassign */ authenticatedAPIClient.defaults.withCredentials = true; authenticatedAPIClient.defaults.headers.common['USE-JWT-COOKIE'] = true; /* eslint-enable no-param-reassign */ }
javascript
function applyAxiosDefaults(authenticatedAPIClient) { /* eslint-disable no-param-reassign */ authenticatedAPIClient.defaults.withCredentials = true; authenticatedAPIClient.defaults.headers.common['USE-JWT-COOKIE'] = true; /* eslint-enable no-param-reassign */ }
[ "function", "applyAxiosDefaults", "(", "authenticatedAPIClient", ")", "{", "/* eslint-disable no-param-reassign */", "authenticatedAPIClient", ".", "defaults", ".", "withCredentials", "=", "true", ";", "authenticatedAPIClient", ".", "defaults", ".", "headers", ".", "common"...
Apply default configuration options to the Axios HTTP client.
[ "Apply", "default", "configuration", "options", "to", "the", "Axios", "HTTP", "client", "." ]
e64a48d45373f299b7899a58050dcd82cb76ee55
https://github.com/edx/frontend-auth/blob/e64a48d45373f299b7899a58050dcd82cb76ee55/src/AuthenticatedAPIClient/axiosConfig.js#L13-L18
25,221
edx/frontend-auth
src/AuthenticatedAPIClient/axiosConfig.js
ensureCsrfToken
function ensureCsrfToken(request) { const originalRequest = request; const method = request.method.toUpperCase(); const isCsrfExempt = authenticatedAPIClient.isCsrfExempt(originalRequest.url); if (!isCsrfExempt && CSRF_PROTECTED_METHODS.includes(method)) { const url = new Url(request.url); c...
javascript
function ensureCsrfToken(request) { const originalRequest = request; const method = request.method.toUpperCase(); const isCsrfExempt = authenticatedAPIClient.isCsrfExempt(originalRequest.url); if (!isCsrfExempt && CSRF_PROTECTED_METHODS.includes(method)) { const url = new Url(request.url); c...
[ "function", "ensureCsrfToken", "(", "request", ")", "{", "const", "originalRequest", "=", "request", ";", "const", "method", "=", "request", ".", "method", ".", "toUpperCase", "(", ")", ";", "const", "isCsrfExempt", "=", "authenticatedAPIClient", ".", "isCsrfExe...
Ensure we have a CSRF token header when making POST, PUT, and DELETE requests.
[ "Ensure", "we", "have", "a", "CSRF", "token", "header", "when", "making", "POST", "PUT", "and", "DELETE", "requests", "." ]
e64a48d45373f299b7899a58050dcd82cb76ee55
https://github.com/edx/frontend-auth/blob/e64a48d45373f299b7899a58050dcd82cb76ee55/src/AuthenticatedAPIClient/axiosConfig.js#L25-L58
25,222
edx/frontend-auth
src/AuthenticatedAPIClient/axiosConfig.js
ensureValidJWTCookie
function ensureValidJWTCookie(request) { const originalRequest = request; const isAuthUrl = authenticatedAPIClient.isAuthUrl(originalRequest.url); const accessToken = authenticatedAPIClient.getDecodedAccessToken(); const tokenExpired = authenticatedAPIClient.isAccessTokenExpired(accessToken); if (is...
javascript
function ensureValidJWTCookie(request) { const originalRequest = request; const isAuthUrl = authenticatedAPIClient.isAuthUrl(originalRequest.url); const accessToken = authenticatedAPIClient.getDecodedAccessToken(); const tokenExpired = authenticatedAPIClient.isAccessTokenExpired(accessToken); if (is...
[ "function", "ensureValidJWTCookie", "(", "request", ")", "{", "const", "originalRequest", "=", "request", ";", "const", "isAuthUrl", "=", "authenticatedAPIClient", ".", "isAuthUrl", "(", "originalRequest", ".", "url", ")", ";", "const", "accessToken", "=", "authen...
Ensure the browser has an unexpired JWT cookie before making API requests. This will attempt to refresh the JWT cookie if a valid refresh token cookie exists.
[ "Ensure", "the", "browser", "has", "an", "unexpired", "JWT", "cookie", "before", "making", "API", "requests", "." ]
e64a48d45373f299b7899a58050dcd82cb76ee55
https://github.com/edx/frontend-auth/blob/e64a48d45373f299b7899a58050dcd82cb76ee55/src/AuthenticatedAPIClient/axiosConfig.js#L65-L105
25,223
edx/frontend-auth
src/AuthenticatedAPIClient/axiosConfig.js
handleUnauthorizedAPIResponse
function handleUnauthorizedAPIResponse(error) { const response = error && error.response; const errorStatus = response && response.status; const requestUrl = response && response.config && response.config.url; const requestIsTokenRefresh = requestUrl === authenticatedAPIClient.refreshAccessTokenEndpoint...
javascript
function handleUnauthorizedAPIResponse(error) { const response = error && error.response; const errorStatus = response && response.status; const requestUrl = response && response.config && response.config.url; const requestIsTokenRefresh = requestUrl === authenticatedAPIClient.refreshAccessTokenEndpoint...
[ "function", "handleUnauthorizedAPIResponse", "(", "error", ")", "{", "const", "response", "=", "error", "&&", "error", ".", "response", ";", "const", "errorStatus", "=", "response", "&&", "response", ".", "status", ";", "const", "requestUrl", "=", "response", ...
Log errors and info for unauthorized API responses
[ "Log", "errors", "and", "info", "for", "unauthorized", "API", "responses" ]
e64a48d45373f299b7899a58050dcd82cb76ee55
https://github.com/edx/frontend-auth/blob/e64a48d45373f299b7899a58050dcd82cb76ee55/src/AuthenticatedAPIClient/axiosConfig.js#L108-L128
25,224
PerimeterX/perimeterx-node-core
lib/pxapi.js
callServer
function callServer(ctx, config, callback) { const ip = ctx.ip; const fullUrl = ctx.fullUrl; const vid = ctx.vid || ''; const pxhd = ctx.pxhd || ''; const vidSource = ctx.vidSource || ''; const uuid = ctx.uuid || ''; const uri = ctx.uri || '/'; const headers = pxUtil.formatHeaders(ctx.he...
javascript
function callServer(ctx, config, callback) { const ip = ctx.ip; const fullUrl = ctx.fullUrl; const vid = ctx.vid || ''; const pxhd = ctx.pxhd || ''; const vidSource = ctx.vidSource || ''; const uuid = ctx.uuid || ''; const uri = ctx.uri || '/'; const headers = pxUtil.formatHeaders(ctx.he...
[ "function", "callServer", "(", "ctx", ",", "config", ",", "callback", ")", "{", "const", "ip", "=", "ctx", ".", "ip", ";", "const", "fullUrl", "=", "ctx", ".", "fullUrl", ";", "const", "vid", "=", "ctx", ".", "vid", "||", "''", ";", "const", "pxhd"...
callServer - call the perimeterx api server to receive a score for a given user. @param {Object} ctx - current request context @param {Function} callback - callback function.
[ "callServer", "-", "call", "the", "perimeterx", "api", "server", "to", "receive", "a", "score", "for", "a", "given", "user", "." ]
281815ffe8913ffdd0916ed507323c88e29f3896
https://github.com/PerimeterX/perimeterx-node-core/blob/281815ffe8913ffdd0916ed507323c88e29f3896/lib/pxapi.js#L13-L96
25,225
PerimeterX/perimeterx-node-core
lib/pxapi.js
evalByServerCall
function evalByServerCall(ctx, config, callback) { if (!ctx.ip || !ctx.headers) { config.logger.error('perimeterx score evaluation failed. bad parameters.'); return callback(config.SCORE_EVALUATE_ACTION.UNEXPECTED_RESULT); } config.logger.debug(`Evaluating Risk API request, call reason: ${ct...
javascript
function evalByServerCall(ctx, config, callback) { if (!ctx.ip || !ctx.headers) { config.logger.error('perimeterx score evaluation failed. bad parameters.'); return callback(config.SCORE_EVALUATE_ACTION.UNEXPECTED_RESULT); } config.logger.debug(`Evaluating Risk API request, call reason: ${ct...
[ "function", "evalByServerCall", "(", "ctx", ",", "config", ",", "callback", ")", "{", "if", "(", "!", "ctx", ".", "ip", "||", "!", "ctx", ".", "headers", ")", "{", "config", ".", "logger", ".", "error", "(", "'perimeterx score evaluation failed. bad paramete...
evalByServerCall - main server to server function, execute a server call for score and process its value to make blocking decisions. ' @param {Object} ctx - current request context. @param {Function} callback - callback function.
[ "evalByServerCall", "-", "main", "server", "to", "server", "function", "execute", "a", "server", "call", "for", "score", "and", "process", "its", "value", "to", "make", "blocking", "decisions", "." ]
281815ffe8913ffdd0916ed507323c88e29f3896
https://github.com/PerimeterX/perimeterx-node-core/blob/281815ffe8913ffdd0916ed507323c88e29f3896/lib/pxapi.js#L104-L142
25,226
PerimeterX/perimeterx-node-core
lib/pxapi.js
isBadRiskScore
function isBadRiskScore(res, ctx, config) { if (!res || !pxUtil.verifyDefined(res.score) || !res.action) { ctx.passReason = config.PASS_REASON.INVALID_RESPONSE; return -1; } const score = res.score; ctx.score = score; ctx.uuid = res.uuid; if (score >= config.BLOCKING_SCORE) { ...
javascript
function isBadRiskScore(res, ctx, config) { if (!res || !pxUtil.verifyDefined(res.score) || !res.action) { ctx.passReason = config.PASS_REASON.INVALID_RESPONSE; return -1; } const score = res.score; ctx.score = score; ctx.uuid = res.uuid; if (score >= config.BLOCKING_SCORE) { ...
[ "function", "isBadRiskScore", "(", "res", ",", "ctx", ",", "config", ")", "{", "if", "(", "!", "res", "||", "!", "pxUtil", ".", "verifyDefined", "(", "res", ".", "score", ")", "||", "!", "res", ".", "action", ")", "{", "ctx", ".", "passReason", "="...
isBadRiskScore - processing response score and return a block indicator. @param {object} res - perimeterx response object. @param {object} ctx - current request context. @return {Number} indicator to the validity of the cookie. -1 response object is not valid 0 response valid with bad score 1 response valid with good...
[ "isBadRiskScore", "-", "processing", "response", "score", "and", "return", "a", "block", "indicator", "." ]
281815ffe8913ffdd0916ed507323c88e29f3896
https://github.com/PerimeterX/perimeterx-node-core/blob/281815ffe8913ffdd0916ed507323c88e29f3896/lib/pxapi.js#L156-L174
25,227
PerimeterX/perimeterx-node-core
lib/pxcookie.js
pxCookieFactory
function pxCookieFactory(ctx, config) { if (ctx.cookieOrigin === 'cookie') { return (ctx.cookies['_px3'] ? new CookieV3(ctx, config, config.logger) : new CookieV1(ctx, config, config.logger)); } else { return (ctx.cookies['_px3'] ? new TokenV3(ctx, config, ctx.cookies['_px3'], config.logger) : n...
javascript
function pxCookieFactory(ctx, config) { if (ctx.cookieOrigin === 'cookie') { return (ctx.cookies['_px3'] ? new CookieV3(ctx, config, config.logger) : new CookieV1(ctx, config, config.logger)); } else { return (ctx.cookies['_px3'] ? new TokenV3(ctx, config, ctx.cookies['_px3'], config.logger) : n...
[ "function", "pxCookieFactory", "(", "ctx", ",", "config", ")", "{", "if", "(", "ctx", ".", "cookieOrigin", "===", "'cookie'", ")", "{", "return", "(", "ctx", ".", "cookies", "[", "'_px3'", "]", "?", "new", "CookieV3", "(", "ctx", ",", "config", ",", ...
Factory method for creating PX Cookie object according to cookie version and type found on the request
[ "Factory", "method", "for", "creating", "PX", "Cookie", "object", "according", "to", "cookie", "version", "and", "type", "found", "on", "the", "request" ]
281815ffe8913ffdd0916ed507323c88e29f3896
https://github.com/PerimeterX/perimeterx-node-core/blob/281815ffe8913ffdd0916ed507323c88e29f3896/lib/pxcookie.js#L98-L104
25,228
PerimeterX/perimeterx-node-core
lib/pxutil.js
prepareCustomParams
function prepareCustomParams(config, dict) { const customParams = { 'custom_param1': '', 'custom_param2': '', 'custom_param3': '', 'custom_param4': '', 'custom_param5': '', 'custom_param6': '', 'custom_param7': '', 'custom_param8': '', 'custom_...
javascript
function prepareCustomParams(config, dict) { const customParams = { 'custom_param1': '', 'custom_param2': '', 'custom_param3': '', 'custom_param4': '', 'custom_param5': '', 'custom_param6': '', 'custom_param7': '', 'custom_param8': '', 'custom_...
[ "function", "prepareCustomParams", "(", "config", ",", "dict", ")", "{", "const", "customParams", "=", "{", "'custom_param1'", ":", "''", ",", "'custom_param2'", ":", "''", ",", "'custom_param3'", ":", "''", ",", "'custom_param4'", ":", "''", ",", "'custom_par...
prepareCustomParams - if there's a enrich custom params handler configured on startup, it will populate to @dict with the proper custom params @param {pxconfig} config - The config object of the application @param {object} dict - the object that should be populated with the custom params
[ "prepareCustomParams", "-", "if", "there", "s", "a", "enrich", "custom", "params", "handler", "configured", "on", "startup", "it", "will", "populate", "to" ]
281815ffe8913ffdd0916ed507323c88e29f3896
https://github.com/PerimeterX/perimeterx-node-core/blob/281815ffe8913ffdd0916ed507323c88e29f3896/lib/pxutil.js#L143-L164
25,229
PerimeterX/perimeterx-node-core
lib/pxproxy.js
getCaptcha
function getCaptcha(req, config, ip, reversePrefix, cb) { let res = {}; if (!config.FIRST_PARTY_ENABLED) { res = { status: 200, header: {key: 'Content-Type', value:'application/javascript'}, body: '' }; return cb(null, res); } else { const ...
javascript
function getCaptcha(req, config, ip, reversePrefix, cb) { let res = {}; if (!config.FIRST_PARTY_ENABLED) { res = { status: 200, header: {key: 'Content-Type', value:'application/javascript'}, body: '' }; return cb(null, res); } else { const ...
[ "function", "getCaptcha", "(", "req", ",", "config", ",", "ip", ",", "reversePrefix", ",", "cb", ")", "{", "let", "res", "=", "{", "}", ";", "if", "(", "!", "config", ".", "FIRST_PARTY_ENABLED", ")", "{", "res", "=", "{", "status", ":", "200", ",",...
getClient - process the proxy request to get the captcha script file from PX servers. @param {object} req - the request object. @param {object} config - the PerimeterX config object. @param {string} ip - the ip that initiated the call. @param {string} reversePrefix - the prefix of the xhr request. @param {function} cb...
[ "getClient", "-", "process", "the", "proxy", "request", "to", "get", "the", "captcha", "script", "file", "from", "PX", "servers", "." ]
281815ffe8913ffdd0916ed507323c88e29f3896
https://github.com/PerimeterX/perimeterx-node-core/blob/281815ffe8913ffdd0916ed507323c88e29f3896/lib/pxproxy.js#L18-L55
25,230
PerimeterX/perimeterx-node-core
lib/pxproxy.js
getClient
function getClient(req, config, ip, cb) { let res = {}; if (!config.FIRST_PARTY_ENABLED) { res = { status: 200, header: {key: 'Content-Type', value:'application/javascript'}, body: '' }; return cb(null, res); } else { const clientRequestUri...
javascript
function getClient(req, config, ip, cb) { let res = {}; if (!config.FIRST_PARTY_ENABLED) { res = { status: 200, header: {key: 'Content-Type', value:'application/javascript'}, body: '' }; return cb(null, res); } else { const clientRequestUri...
[ "function", "getClient", "(", "req", ",", "config", ",", "ip", ",", "cb", ")", "{", "let", "res", "=", "{", "}", ";", "if", "(", "!", "config", ".", "FIRST_PARTY_ENABLED", ")", "{", "res", "=", "{", "status", ":", "200", ",", "header", ":", "{", ...
getClient - process the proxy request to get the client file from PX servers. @param {object} req - the request object. @param {object} config - the PerimeterX config object. @param {string} ip - the ip that initiated the call. @param {function} cb - the callback function to call at the end of the process. @return {f...
[ "getClient", "-", "process", "the", "proxy", "request", "to", "get", "the", "client", "file", "from", "PX", "servers", "." ]
281815ffe8913ffdd0916ed507323c88e29f3896
https://github.com/PerimeterX/perimeterx-node-core/blob/281815ffe8913ffdd0916ed507323c88e29f3896/lib/pxproxy.js#L68-L103
25,231
PerimeterX/perimeterx-node-core
lib/pxhttpc.js
callServer
function callServer(data, headers, uri, callType, config, callback) { callback = callback || ((err) => { err && config.logger.debug(`callServer default callback. Error: ${err}`); }); const callData = { 'url': `https://${config.SERVER_HOST}${uri}`, 'data': JSON.stringify(data), 'headers':...
javascript
function callServer(data, headers, uri, callType, config, callback) { callback = callback || ((err) => { err && config.logger.debug(`callServer default callback. Error: ${err}`); }); const callData = { 'url': `https://${config.SERVER_HOST}${uri}`, 'data': JSON.stringify(data), 'headers':...
[ "function", "callServer", "(", "data", ",", "headers", ",", "uri", ",", "callType", ",", "config", ",", "callback", ")", "{", "callback", "=", "callback", "||", "(", "(", "err", ")", "=>", "{", "err", "&&", "config", ".", "logger", ".", "debug", "(",...
callServer - call the perimeterx servers. @param {Object} data - data object to pass as POST body @param {Object} headers - http request headers @param {string} uri - px servers endpoint uri @param {string} callType - indication for a query or activities sending @param {Function} callback - callback function.
[ "callServer", "-", "call", "the", "perimeterx", "servers", "." ]
281815ffe8913ffdd0916ed507323c88e29f3896
https://github.com/PerimeterX/perimeterx-node-core/blob/281815ffe8913ffdd0916ed507323c88e29f3896/lib/pxhttpc.js#L18-L63
25,232
blackbaud/skyux-cli
lib/npm-install.js
npmInstall
function npmInstall(settings) { const message = logger.promise('Running npm install (can take several minutes)'); const installArgs = {}; if (settings) { if (settings.path) { installArgs.cwd = settings.path; } if (settings.stdio) { installArgs.stdio = settings.stdio; } } const ...
javascript
function npmInstall(settings) { const message = logger.promise('Running npm install (can take several minutes)'); const installArgs = {}; if (settings) { if (settings.path) { installArgs.cwd = settings.path; } if (settings.stdio) { installArgs.stdio = settings.stdio; } } const ...
[ "function", "npmInstall", "(", "settings", ")", "{", "const", "message", "=", "logger", ".", "promise", "(", "'Running npm install (can take several minutes)'", ")", ";", "const", "installArgs", "=", "{", "}", ";", "if", "(", "settings", ")", "{", "if", "(", ...
Runs npm install for a specific package @name npmInstall
[ "Runs", "npm", "install", "for", "a", "specific", "package" ]
c579986da0cfebbe74d584781d2db9dc9524d7d2
https://github.com/blackbaud/skyux-cli/blob/c579986da0cfebbe74d584781d2db9dc9524d7d2/lib/npm-install.js#L11-L40
25,233
omrilotan/mono
packages/eslint-plugin-log/spec.js
mock
function mock(_module, _exports) { delete require.cache[require.resolve(_module)]; require(_module); _exports && (require.cache[require.resolve(_module)].exports = _exports); return require(_module); }
javascript
function mock(_module, _exports) { delete require.cache[require.resolve(_module)]; require(_module); _exports && (require.cache[require.resolve(_module)].exports = _exports); return require(_module); }
[ "function", "mock", "(", "_module", ",", "_exports", ")", "{", "delete", "require", ".", "cache", "[", "require", ".", "resolve", "(", "_module", ")", "]", ";", "require", "(", "_module", ")", ";", "_exports", "&&", "(", "require", ".", "cache", "[", ...
Mock e module's exports @param {String} _module Module route @param {Any} _exports Anything you'd like that module to export @return {Any} The module's exports
[ "Mock", "e", "module", "s", "exports" ]
16c37c9584167f556d3d449cd1eeea4511278bf7
https://github.com/omrilotan/mono/blob/16c37c9584167f556d3d449cd1eeea4511278bf7/packages/eslint-plugin-log/spec.js#L10-L15
25,234
omrilotan/mono
packages/upgradable/lib/start/index.js
later
function later (info) { process.stdin.resume(); const action = start.bind(null, info); process.on('SIGINT', action); process.on('SIGTERM', action); (function wait () { if (beenthere) { return; } setTimeout(wait, EVENT_LOOP); }()); }
javascript
function later (info) { process.stdin.resume(); const action = start.bind(null, info); process.on('SIGINT', action); process.on('SIGTERM', action); (function wait () { if (beenthere) { return; } setTimeout(wait, EVENT_LOOP); }()); }
[ "function", "later", "(", "info", ")", "{", "process", ".", "stdin", ".", "resume", "(", ")", ";", "const", "action", "=", "start", ".", "bind", "(", "null", ",", "info", ")", ";", "process", ".", "on", "(", "'SIGINT'", ",", "action", ")", ";", "...
Perform the checks paralelly, only inform user on signal interrupt @param {Info} info Information about the package @return {undefined} no return value
[ "Perform", "the", "checks", "paralelly", "only", "inform", "user", "on", "signal", "interrupt" ]
16c37c9584167f556d3d449cd1eeea4511278bf7
https://github.com/omrilotan/mono/blob/16c37c9584167f556d3d449cd1eeea4511278bf7/packages/upgradable/lib/start/index.js#L78-L91
25,235
omrilotan/mono
packages/upgradable/lib/start/index.js
start
async function start ({latest, message, name, version}) { if (beenthere) { return; } beenthere = true; console.log( // eslint-disable-line no-console box({ latest, message, name, version, }) ); const Confirm = require('prompt-confirm'); const confirmed = await new Confirm( `install ${name....
javascript
async function start ({latest, message, name, version}) { if (beenthere) { return; } beenthere = true; console.log( // eslint-disable-line no-console box({ latest, message, name, version, }) ); const Confirm = require('prompt-confirm'); const confirmed = await new Confirm( `install ${name....
[ "async", "function", "start", "(", "{", "latest", ",", "message", ",", "name", ",", "version", "}", ")", "{", "if", "(", "beenthere", ")", "{", "return", ";", "}", "beenthere", "=", "true", ";", "console", ".", "log", "(", "// eslint-disable-line no-cons...
Start checking for upgrades @param {Info} info Information about the package @returns {undefined} No return value
[ "Start", "checking", "for", "upgrades" ]
16c37c9584167f556d3d449cd1eeea4511278bf7
https://github.com/omrilotan/mono/blob/16c37c9584167f556d3d449cd1eeea4511278bf7/packages/upgradable/lib/start/index.js#L98-L125
25,236
omrilotan/mono
packages/upgradable/lib/start/index.js
box
function box ({latest, message, name, version}) { const lines = [ `You are running ${name.yellow} version ${version.yellow}`, `The latest version is ${latest.green}`, ]; if (message) { lines.push(message.bold.italic); } return boxt( lines.join('\n'), { 'align': 'left', 'theme': 'round', } ); }
javascript
function box ({latest, message, name, version}) { const lines = [ `You are running ${name.yellow} version ${version.yellow}`, `The latest version is ${latest.green}`, ]; if (message) { lines.push(message.bold.italic); } return boxt( lines.join('\n'), { 'align': 'left', 'theme': 'round', } ); }
[ "function", "box", "(", "{", "latest", ",", "message", ",", "name", ",", "version", "}", ")", "{", "const", "lines", "=", "[", "`", "${", "name", ".", "yellow", "}", "${", "version", ".", "yellow", "}", "`", ",", "`", "${", "latest", ".", "green"...
A "boxed" message to user letting them know of our upgrade intentions @param {Info} info Information about the package @return {String} Message to user
[ "A", "boxed", "message", "to", "user", "letting", "them", "know", "of", "our", "upgrade", "intentions" ]
16c37c9584167f556d3d449cd1eeea4511278bf7
https://github.com/omrilotan/mono/blob/16c37c9584167f556d3d449cd1eeea4511278bf7/packages/upgradable/lib/start/index.js#L132-L149
25,237
omrilotan/mono
packages/chunkalyse/bin/chunkalyse.js
getStats
function getStats({_: [file]} = {}) { const route = resolve(process.cwd(), file); try { return require(route); } catch (error) { console.error(`The file "${route}" could not be properly parsed.`); process.exit(1); } }
javascript
function getStats({_: [file]} = {}) { const route = resolve(process.cwd(), file); try { return require(route); } catch (error) { console.error(`The file "${route}" could not be properly parsed.`); process.exit(1); } }
[ "function", "getStats", "(", "{", "_", ":", "[", "file", "]", "}", "=", "{", "}", ")", "{", "const", "route", "=", "resolve", "(", "process", ".", "cwd", "(", ")", ",", "file", ")", ";", "try", "{", "return", "require", "(", "route", ")", ";", ...
Read stats json file @param {String[]} options._[file] stats file @return {Object}
[ "Read", "stats", "json", "file" ]
16c37c9584167f556d3d449cd1eeea4511278bf7
https://github.com/omrilotan/mono/blob/16c37c9584167f556d3d449cd1eeea4511278bf7/packages/chunkalyse/bin/chunkalyse.js#L50-L59
25,238
omrilotan/mono
packages/chunkalyse/bin/chunkalyse.js
start
function start(stats, {f, format = 'human'} = {}) { try { const result = chunkalyse(stats); let output; switch (f || format) { case 'json': output = JSON.stringify(result, null, 2); break; case 'human': default: output = require('../lib/humanise')(result); } console.log(output); } cat...
javascript
function start(stats, {f, format = 'human'} = {}) { try { const result = chunkalyse(stats); let output; switch (f || format) { case 'json': output = JSON.stringify(result, null, 2); break; case 'human': default: output = require('../lib/humanise')(result); } console.log(output); } cat...
[ "function", "start", "(", "stats", ",", "{", "f", ",", "format", "=", "'human'", "}", "=", "{", "}", ")", "{", "try", "{", "const", "result", "=", "chunkalyse", "(", "stats", ")", ";", "let", "output", ";", "switch", "(", "f", "||", "format", ")"...
Get the chunks and print them @param {Object} stats no return value
[ "Get", "the", "chunks", "and", "print", "them" ]
16c37c9584167f556d3d449cd1eeea4511278bf7
https://github.com/omrilotan/mono/blob/16c37c9584167f556d3d449cd1eeea4511278bf7/packages/chunkalyse/bin/chunkalyse.js#L66-L85
25,239
omrilotan/mono
packages/dangerfile/index.js
create
async function create(sourcedir) { const target = join(sourcedir, FILENAME); const exists = await exist(target); const source = exists ? target : join(__dirname, FILENAME) ; const content = await readFile(source); await writeFile(primed, content.toString()); return exists ? 'Creating a new Dangerfile' ...
javascript
async function create(sourcedir) { const target = join(sourcedir, FILENAME); const exists = await exist(target); const source = exists ? target : join(__dirname, FILENAME) ; const content = await readFile(source); await writeFile(primed, content.toString()); return exists ? 'Creating a new Dangerfile' ...
[ "async", "function", "create", "(", "sourcedir", ")", "{", "const", "target", "=", "join", "(", "sourcedir", ",", "FILENAME", ")", ";", "const", "exists", "=", "await", "exist", "(", "target", ")", ";", "const", "source", "=", "exists", "?", "target", ...
Create a dangerfile @param {String} target [description] @return {[type]} [description]
[ "Create", "a", "dangerfile" ]
16c37c9584167f556d3d449cd1eeea4511278bf7
https://github.com/omrilotan/mono/blob/16c37c9584167f556d3d449cd1eeea4511278bf7/packages/dangerfile/index.js#L42-L58
25,240
omrilotan/mono
packages/dangerfile/index.js
run
async function run() { try { await execute('./node_modules/.bin/danger ci', { pipe: true }); return false; } catch (error) { // don't throw yet } await execute('npm i danger --no-save', { pipe: true }); await execute('./node_modules/.bin/danger ci', { pipe: true }); return true; }
javascript
async function run() { try { await execute('./node_modules/.bin/danger ci', { pipe: true }); return false; } catch (error) { // don't throw yet } await execute('npm i danger --no-save', { pipe: true }); await execute('./node_modules/.bin/danger ci', { pipe: true }); return true; }
[ "async", "function", "run", "(", ")", "{", "try", "{", "await", "execute", "(", "'./node_modules/.bin/danger ci'", ",", "{", "pipe", ":", "true", "}", ")", ";", "return", "false", ";", "}", "catch", "(", "error", ")", "{", "// don't throw yet", "}", "awa...
Install danger and run it @return {Boolean}
[ "Install", "danger", "and", "run", "it" ]
16c37c9584167f556d3d449cd1eeea4511278bf7
https://github.com/omrilotan/mono/blob/16c37c9584167f556d3d449cd1eeea4511278bf7/packages/dangerfile/index.js#L64-L75
25,241
omrilotan/mono
packages/paraphrase/index.js
replace
function replace(haystack, needle) { const replacement = options.resolve ? notate(data, needle.trim()) : data[needle.trim()]; return VALID_RESULT_TYPES.includes(typeof replacement) ? replacement : options.clean ? '' : haystack; }
javascript
function replace(haystack, needle) { const replacement = options.resolve ? notate(data, needle.trim()) : data[needle.trim()]; return VALID_RESULT_TYPES.includes(typeof replacement) ? replacement : options.clean ? '' : haystack; }
[ "function", "replace", "(", "haystack", ",", "needle", ")", "{", "const", "replacement", "=", "options", ".", "resolve", "?", "notate", "(", "data", ",", "needle", ".", "trim", "(", ")", ")", ":", "data", "[", "needle", ".", "trim", "(", ")", "]", ...
Replace method build with internal reference to the passed in data structure @param {String} haystack The full string match @param {String} needle The content to identify as data member @return {String} Found value
[ "Replace", "method", "build", "with", "internal", "reference", "to", "the", "passed", "in", "data", "structure" ]
16c37c9584167f556d3d449cd1eeea4511278bf7
https://github.com/omrilotan/mono/blob/16c37c9584167f556d3d449cd1eeea4511278bf7/packages/paraphrase/index.js#L63-L67
25,242
blackbaud/skyux-cli
lib/help.js
getHelpTopic
function getHelpTopic(topic) { let filename = getFilename(topic); if (!fs.existsSync(filename)) { filename = getFilename('help'); } return fs.readFileSync(filename).toString(); }
javascript
function getHelpTopic(topic) { let filename = getFilename(topic); if (!fs.existsSync(filename)) { filename = getFilename('help'); } return fs.readFileSync(filename).toString(); }
[ "function", "getHelpTopic", "(", "topic", ")", "{", "let", "filename", "=", "getFilename", "(", "topic", ")", ";", "if", "(", "!", "fs", ".", "existsSync", "(", "filename", ")", ")", "{", "filename", "=", "getFilename", "(", "'help'", ")", ";", "}", ...
Returns the corresponding help text for a given topic.
[ "Returns", "the", "corresponding", "help", "text", "for", "a", "given", "topic", "." ]
c579986da0cfebbe74d584781d2db9dc9524d7d2
https://github.com/blackbaud/skyux-cli/blob/c579986da0cfebbe74d584781d2db9dc9524d7d2/lib/help.js#L15-L23
25,243
blackbaud/skyux-cli
lib/help.js
getHelp
function getHelp(argv) { const version = require('./version').getVersion(); logger.info(` *********************************************************************** * SKY UX App Builder ${version} * * Usage: skyux [command] [options] * * Help: s...
javascript
function getHelp(argv) { const version = require('./version').getVersion(); logger.info(` *********************************************************************** * SKY UX App Builder ${version} * * Usage: skyux [command] [options] * * Help: s...
[ "function", "getHelp", "(", "argv", ")", "{", "const", "version", "=", "require", "(", "'./version'", ")", ".", "getVersion", "(", ")", ";", "logger", ".", "info", "(", "`", "${", "version", "}", "`", ")", ";", "logger", ".", "info", "(", "getHelpTop...
Displays the help information. @name getHelp
[ "Displays", "the", "help", "information", "." ]
c579986da0cfebbe74d584781d2db9dc9524d7d2
https://github.com/blackbaud/skyux-cli/blob/c579986da0cfebbe74d584781d2db9dc9524d7d2/lib/help.js#L29-L43
25,244
omrilotan/mono
packages/abuser/index.js
clean
function clean(route) { // Resolve module location from given path const filename = _require.resolve(route); // Escape if this module is not present in cache if (!_require.cache[filename]) { return; } // Remove all children from memory, recursively shidu(filename); // Remove module from memory as ...
javascript
function clean(route) { // Resolve module location from given path const filename = _require.resolve(route); // Escape if this module is not present in cache if (!_require.cache[filename]) { return; } // Remove all children from memory, recursively shidu(filename); // Remove module from memory as ...
[ "function", "clean", "(", "route", ")", "{", "// Resolve module location from given path", "const", "filename", "=", "_require", ".", "resolve", "(", "route", ")", ";", "// Escape if this module is not present in cache", "if", "(", "!", "_require", ".", "cache", "[", ...
Clean up a module from cache @param {String} route @return {undefined}
[ "Clean", "up", "a", "module", "from", "cache" ]
16c37c9584167f556d3d449cd1eeea4511278bf7
https://github.com/omrilotan/mono/blob/16c37c9584167f556d3d449cd1eeea4511278bf7/packages/abuser/index.js#L16-L30
25,245
omrilotan/mono
packages/abuser/index.js
override
function override(route, thing) { // Resolve module location from given path const filename = _require.resolve(route); // Load it into memory _require(filename); // Override exports with new value _require.cache[filename].exports = thing; // Return exports value return _require(filename); }
javascript
function override(route, thing) { // Resolve module location from given path const filename = _require.resolve(route); // Load it into memory _require(filename); // Override exports with new value _require.cache[filename].exports = thing; // Return exports value return _require(filename); }
[ "function", "override", "(", "route", ",", "thing", ")", "{", "// Resolve module location from given path", "const", "filename", "=", "_require", ".", "resolve", "(", "route", ")", ";", "// Load it into memory", "_require", "(", "filename", ")", ";", "// Override ex...
Override a module with any given thing @param {String} route @param {Any} thing @return {Any} New exports of the module
[ "Override", "a", "module", "with", "any", "given", "thing" ]
16c37c9584167f556d3d449cd1eeea4511278bf7
https://github.com/omrilotan/mono/blob/16c37c9584167f556d3d449cd1eeea4511278bf7/packages/abuser/index.js#L38-L51
25,246
omrilotan/mono
packages/abuser/index.js
reset
function reset(route) { // Resolve module location from given path const filename = _require.resolve(route); // Load it into memory _require(filename); // Remove all children from memory, recursively shidu(filename); // Remove module from memory as well delete _require.cache[filename]; // Return ...
javascript
function reset(route) { // Resolve module location from given path const filename = _require.resolve(route); // Load it into memory _require(filename); // Remove all children from memory, recursively shidu(filename); // Remove module from memory as well delete _require.cache[filename]; // Return ...
[ "function", "reset", "(", "route", ")", "{", "// Resolve module location from given path", "const", "filename", "=", "_require", ".", "resolve", "(", "route", ")", ";", "// Load it into memory", "_require", "(", "filename", ")", ";", "// Remove all children from memory,...
Reset a module @param {String} route @return {Any}
[ "Reset", "a", "module" ]
16c37c9584167f556d3d449cd1eeea4511278bf7
https://github.com/omrilotan/mono/blob/16c37c9584167f556d3d449cd1eeea4511278bf7/packages/abuser/index.js#L58-L74
25,247
omrilotan/mono
packages/abuser/index.js
shidu
function shidu(filename) { const parent = require.cache[filename]; if (!parent) { return; } // If there are children - iterate over them parent.children .map( ({filename}) => filename ) .forEach( child => { // Load child to memory require(child); // Remove all of its children from mem...
javascript
function shidu(filename) { const parent = require.cache[filename]; if (!parent) { return; } // If there are children - iterate over them parent.children .map( ({filename}) => filename ) .forEach( child => { // Load child to memory require(child); // Remove all of its children from mem...
[ "function", "shidu", "(", "filename", ")", "{", "const", "parent", "=", "require", ".", "cache", "[", "filename", "]", ";", "if", "(", "!", "parent", ")", "{", "return", ";", "}", "// If there are children - iterate over them", "parent", ".", "children", "."...
Remove all children from cache as well @param {String} parent @return {undefined}
[ "Remove", "all", "children", "from", "cache", "as", "well" ]
16c37c9584167f556d3d449cd1eeea4511278bf7
https://github.com/omrilotan/mono/blob/16c37c9584167f556d3d449cd1eeea4511278bf7/packages/abuser/index.js#L84-L109
25,248
blackbaud/skyux-cli
index.js
getGlobs
function getGlobs() { // Look globally and locally for matching glob pattern const dirs = [ `${process.cwd()}/node_modules/`, // local (where they ran the command from) `${__dirname}/..`, // global, if scoped package (where this code exists) `${__dirname}/../..`, // global, if not scoped package ]; ...
javascript
function getGlobs() { // Look globally and locally for matching glob pattern const dirs = [ `${process.cwd()}/node_modules/`, // local (where they ran the command from) `${__dirname}/..`, // global, if scoped package (where this code exists) `${__dirname}/../..`, // global, if not scoped package ]; ...
[ "function", "getGlobs", "(", ")", "{", "// Look globally and locally for matching glob pattern", "const", "dirs", "=", "[", "`", "${", "process", ".", "cwd", "(", ")", "}", "`", ",", "// local (where they ran the command from)", "`", "${", "__dirname", "}", "`", "...
Returns results of glob.sync from specified directory and our glob pattern. @returns {Array} Array of matching patterns
[ "Returns", "results", "of", "glob", ".", "sync", "from", "specified", "directory", "and", "our", "glob", "pattern", "." ]
c579986da0cfebbe74d584781d2db9dc9524d7d2
https://github.com/blackbaud/skyux-cli/blob/c579986da0cfebbe74d584781d2db9dc9524d7d2/index.js#L13-L37
25,249
blackbaud/skyux-cli
index.js
getModulesAnswered
function getModulesAnswered(command, argv, globs) { let modulesCalled = {}; let modulesAnswered = []; globs.forEach(pkg => { const dirName = path.dirname(pkg); let pkgJson = {}; let module; try { module = require(dirName); pkgJson = require(pkg); } catch (err) { logger.verb...
javascript
function getModulesAnswered(command, argv, globs) { let modulesCalled = {}; let modulesAnswered = []; globs.forEach(pkg => { const dirName = path.dirname(pkg); let pkgJson = {}; let module; try { module = require(dirName); pkgJson = require(pkg); } catch (err) { logger.verb...
[ "function", "getModulesAnswered", "(", "command", ",", "argv", ",", "globs", ")", "{", "let", "modulesCalled", "=", "{", "}", ";", "let", "modulesAnswered", "=", "[", "]", ";", "globs", ".", "forEach", "(", "pkg", "=>", "{", "const", "dirName", "=", "p...
Iterates over the given modules. @param {string} command @param {Object} argv @param {Array} globs @returns {Array} modulesAnswered
[ "Iterates", "over", "the", "given", "modules", "." ]
c579986da0cfebbe74d584781d2db9dc9524d7d2
https://github.com/blackbaud/skyux-cli/blob/c579986da0cfebbe74d584781d2db9dc9524d7d2/index.js#L46-L80
25,250
blackbaud/skyux-cli
index.js
invokeCommandError
function invokeCommandError(command, isInternalCommand) { if (isInternalCommand) { return; } const cwd = process.cwd(); logger.error(`No modules found for ${command}`); if (cwd.indexOf('skyux-spa') === -1) { logger.error(`Are you in a SKY UX SPA directory?`); } else if (!fs.existsSync('./node_mod...
javascript
function invokeCommandError(command, isInternalCommand) { if (isInternalCommand) { return; } const cwd = process.cwd(); logger.error(`No modules found for ${command}`); if (cwd.indexOf('skyux-spa') === -1) { logger.error(`Are you in a SKY UX SPA directory?`); } else if (!fs.existsSync('./node_mod...
[ "function", "invokeCommandError", "(", "command", ",", "isInternalCommand", ")", "{", "if", "(", "isInternalCommand", ")", "{", "return", ";", "}", "const", "cwd", "=", "process", ".", "cwd", "(", ")", ";", "logger", ".", "error", "(", "`", "${", "comman...
Log fatal error and exit. This method is called even for internal commands. In those cases, there isn't actually an error. @param {string} command @param {boolean} isInternalCommand
[ "Log", "fatal", "error", "and", "exit", ".", "This", "method", "is", "called", "even", "for", "internal", "commands", ".", "In", "those", "cases", "there", "isn", "t", "actually", "an", "error", "." ]
c579986da0cfebbe74d584781d2db9dc9524d7d2
https://github.com/blackbaud/skyux-cli/blob/c579986da0cfebbe74d584781d2db9dc9524d7d2/index.js#L89-L105
25,251
blackbaud/skyux-cli
index.js
invokeCommand
function invokeCommand(command, argv, isInternalCommand) { const globs = getGlobs(); if (globs.length === 0) { return invokeCommandError(command, isInternalCommand); } const modulesAnswered = getModulesAnswered(command, argv, globs); const modulesAnsweredLength = modulesAnswered.length; if (modulesA...
javascript
function invokeCommand(command, argv, isInternalCommand) { const globs = getGlobs(); if (globs.length === 0) { return invokeCommandError(command, isInternalCommand); } const modulesAnswered = getModulesAnswered(command, argv, globs); const modulesAnsweredLength = modulesAnswered.length; if (modulesA...
[ "function", "invokeCommand", "(", "command", ",", "argv", ",", "isInternalCommand", ")", "{", "const", "globs", "=", "getGlobs", "(", ")", ";", "if", "(", "globs", ".", "length", "===", "0", ")", "{", "return", "invokeCommandError", "(", "command", ",", ...
search for a command in the modules and invoke it if found. If not found, log a fatal error. @param {string} command @param {Object} argv @param {boolean} isInternalCommand
[ "search", "for", "a", "command", "in", "the", "modules", "and", "invoke", "it", "if", "found", ".", "If", "not", "found", "log", "a", "fatal", "error", "." ]
c579986da0cfebbe74d584781d2db9dc9524d7d2
https://github.com/blackbaud/skyux-cli/blob/c579986da0cfebbe74d584781d2db9dc9524d7d2/index.js#L114-L135
25,252
blackbaud/skyux-cli
index.js
getCommand
function getCommand(argv) { let command = argv._[0] || 'help'; // Allow shorthand "-v" for version if (argv.v) { command = 'version'; } // Allow shorthand "-h" for help if (argv.h) { command = 'help'; } return command; }
javascript
function getCommand(argv) { let command = argv._[0] || 'help'; // Allow shorthand "-v" for version if (argv.v) { command = 'version'; } // Allow shorthand "-h" for help if (argv.h) { command = 'help'; } return command; }
[ "function", "getCommand", "(", "argv", ")", "{", "let", "command", "=", "argv", ".", "_", "[", "0", "]", "||", "'help'", ";", "// Allow shorthand \"-v\" for version", "if", "(", "argv", ".", "v", ")", "{", "command", "=", "'version'", ";", "}", "// Allow...
Determines the correct command based on the argv param. @param {Object} argv
[ "Determines", "the", "correct", "command", "based", "on", "the", "argv", "param", "." ]
c579986da0cfebbe74d584781d2db9dc9524d7d2
https://github.com/blackbaud/skyux-cli/blob/c579986da0cfebbe74d584781d2db9dc9524d7d2/index.js#L141-L155
25,253
blackbaud/skyux-cli
index.js
processArgv
function processArgv(argv) { let command = getCommand(argv); let isInternalCommand = true; logger.info(`SKY UX processing command ${command}`); switch (command) { case 'version': require('./lib/version').logVersion(argv); break; case 'new': require('./lib/new')(argv); break; ...
javascript
function processArgv(argv) { let command = getCommand(argv); let isInternalCommand = true; logger.info(`SKY UX processing command ${command}`); switch (command) { case 'version': require('./lib/version').logVersion(argv); break; case 'new': require('./lib/new')(argv); break; ...
[ "function", "processArgv", "(", "argv", ")", "{", "let", "command", "=", "getCommand", "(", "argv", ")", ";", "let", "isInternalCommand", "=", "true", ";", "logger", ".", "info", "(", "`", "${", "command", "}", "`", ")", ";", "switch", "(", "command", ...
Processes an argv object. Reads package.json if it exists. @name processArgv @param [Object] argv
[ "Processes", "an", "argv", "object", ".", "Reads", "package", ".", "json", "if", "it", "exists", "." ]
c579986da0cfebbe74d584781d2db9dc9524d7d2
https://github.com/blackbaud/skyux-cli/blob/c579986da0cfebbe74d584781d2db9dc9524d7d2/index.js#L163-L187
25,254
omrilotan/mono
packages/selenium-chrome-clear-cache/index.js
getSlot
function getSlot(name) { const main = document.querySelector('settings-ui').shadowRoot.children.container.children.main; const settings = findTag(main.shadowRoot.children, 'SETTINGS-BASIC-PAGE'); const advancedPage = settings.shadowRoot.children.advancedPage; const [page] = [...advancedPage.children].find(i => ...
javascript
function getSlot(name) { const main = document.querySelector('settings-ui').shadowRoot.children.container.children.main; const settings = findTag(main.shadowRoot.children, 'SETTINGS-BASIC-PAGE'); const advancedPage = settings.shadowRoot.children.advancedPage; const [page] = [...advancedPage.children].find(i => ...
[ "function", "getSlot", "(", "name", ")", "{", "const", "main", "=", "document", ".", "querySelector", "(", "'settings-ui'", ")", ".", "shadowRoot", ".", "children", ".", "container", ".", "children", ".", "main", ";", "const", "settings", "=", "findTag", "...
Find UI "slot" @param {String} name @return {DOMElement}
[ "Find", "UI", "slot" ]
16c37c9584167f556d3d449cd1eeea4511278bf7
https://github.com/omrilotan/mono/blob/16c37c9584167f556d3d449cd1eeea4511278bf7/packages/selenium-chrome-clear-cache/index.js#L46-L54
25,255
omrilotan/mono
packages/stdline/index.js
update
function update(message) { clearLine(stdout, 0); // Clear current STDOUT line cursorTo(stdout, 0); // Place cursor at the start stdout.write(message.toString()); }
javascript
function update(message) { clearLine(stdout, 0); // Clear current STDOUT line cursorTo(stdout, 0); // Place cursor at the start stdout.write(message.toString()); }
[ "function", "update", "(", "message", ")", "{", "clearLine", "(", "stdout", ",", "0", ")", ";", "// Clear current STDOUT line", "cursorTo", "(", "stdout", ",", "0", ")", ";", "// Place cursor at the start", "stdout", ".", "write", "(", "message", ".", "toStrin...
Update current STDOUT line @param {String} message no return value
[ "Update", "current", "STDOUT", "line" ]
16c37c9584167f556d3d449cd1eeea4511278bf7
https://github.com/omrilotan/mono/blob/16c37c9584167f556d3d449cd1eeea4511278bf7/packages/stdline/index.js#L22-L26
25,256
queicherius/gw2api-client
src/endpoints/account-blob.js
accountGuilds
function accountGuilds (client) { return client.account().get().then(account => { if (!account.guild_leader) { return [] } let requests = account.guild_leader.map(id => wrap(() => guildData(id))) return flow.parallel(requests) }) function guildData (id) { let requests = { data: w...
javascript
function accountGuilds (client) { return client.account().get().then(account => { if (!account.guild_leader) { return [] } let requests = account.guild_leader.map(id => wrap(() => guildData(id))) return flow.parallel(requests) }) function guildData (id) { let requests = { data: w...
[ "function", "accountGuilds", "(", "client", ")", "{", "return", "client", ".", "account", "(", ")", ".", "get", "(", ")", ".", "then", "(", "account", "=>", "{", "if", "(", "!", "account", ".", "guild_leader", ")", "{", "return", "[", "]", "}", "le...
Get the guild data accessible for the account
[ "Get", "the", "guild", "data", "accessible", "for", "the", "account" ]
a5a2f6bab89425bbbcf33eec73b7440cec5f312f
https://github.com/queicherius/gw2api-client/blob/a5a2f6bab89425bbbcf33eec73b7440cec5f312f/src/endpoints/account-blob.js#L51-L74
25,257
queicherius/gw2api-client
src/endpoints/account-blob.js
filterBetaCharacters
function filterBetaCharacters (characters) { /* istanbul ignore next */ if (!characters) { return null } return characters.filter(x => !x.flags || !x.flags.includes('Beta')) }
javascript
function filterBetaCharacters (characters) { /* istanbul ignore next */ if (!characters) { return null } return characters.filter(x => !x.flags || !x.flags.includes('Beta')) }
[ "function", "filterBetaCharacters", "(", "characters", ")", "{", "/* istanbul ignore next */", "if", "(", "!", "characters", ")", "{", "return", "null", "}", "return", "characters", ".", "filter", "(", "x", "=>", "!", "x", ".", "flags", "||", "!", "x", "."...
Filter out beta characters from the total account blob, since they are technically not part of the actual live account and live on a different server
[ "Filter", "out", "beta", "characters", "from", "the", "total", "account", "blob", "since", "they", "are", "technically", "not", "part", "of", "the", "actual", "live", "account", "and", "live", "on", "a", "different", "server" ]
a5a2f6bab89425bbbcf33eec73b7440cec5f312f
https://github.com/queicherius/gw2api-client/blob/a5a2f6bab89425bbbcf33eec73b7440cec5f312f/src/endpoints/account-blob.js#L78-L85
25,258
queicherius/gw2api-client
src/endpoints/account-blob.js
unflatten
function unflatten (object) { let result = {} for (let key in object) { _set(result, key, object[key]) } return result }
javascript
function unflatten (object) { let result = {} for (let key in object) { _set(result, key, object[key]) } return result }
[ "function", "unflatten", "(", "object", ")", "{", "let", "result", "=", "{", "}", "for", "(", "let", "key", "in", "object", ")", "{", "_set", "(", "result", ",", "key", ",", "object", "[", "key", "]", ")", "}", "return", "result", "}" ]
Unflatten an object with keys describing a nested structure
[ "Unflatten", "an", "object", "with", "keys", "describing", "a", "nested", "structure" ]
a5a2f6bab89425bbbcf33eec73b7440cec5f312f
https://github.com/queicherius/gw2api-client/blob/a5a2f6bab89425bbbcf33eec73b7440cec5f312f/src/endpoints/account-blob.js#L109-L117
25,259
ShuyunFF2E/ccms-components
src/common/utils/style-helper/index.js
adjustTop
function adjustTop(placements, containerPosition, initialHeight, currentHeight) { if (placements.indexOf('top') !== -1 && initialHeight !== currentHeight) { return { top: containerPosition.top - currentHeight }; } }
javascript
function adjustTop(placements, containerPosition, initialHeight, currentHeight) { if (placements.indexOf('top') !== -1 && initialHeight !== currentHeight) { return { top: containerPosition.top - currentHeight }; } }
[ "function", "adjustTop", "(", "placements", ",", "containerPosition", ",", "initialHeight", ",", "currentHeight", ")", "{", "if", "(", "placements", ".", "indexOf", "(", "'top'", ")", "!==", "-", "1", "&&", "initialHeight", "!==", "currentHeight", ")", "{", ...
Provides a way to adjust the top positioning after first render to correctly align element to top after content rendering causes resized element height @param {array} placements - The array of strings of classes element should have. @param {object} containerPosition - The object with container position information @pa...
[ "Provides", "a", "way", "to", "adjust", "the", "top", "positioning", "after", "first", "render", "to", "correctly", "align", "element", "to", "top", "after", "content", "rendering", "causes", "resized", "element", "height" ]
a20faae817661e3da0f84b8856894891255e4a8e
https://github.com/ShuyunFF2E/ccms-components/blob/a20faae817661e3da0f84b8856894891255e4a8e/src/common/utils/style-helper/index.js#L238-L244
25,260
vmarchaud/pm2-githook
index.js
function (opts) { if (!(this instanceof Worker)) { return new Worker(opts); } this.opts = opts; this.port = this.opts.port || 8888; this.apps = opts.apps; if (typeof (this.apps) !== 'object') { this.apps = JSON.parse(this.apps); } this.server = http.createServer(this._handleHttp.bind(this)); ...
javascript
function (opts) { if (!(this instanceof Worker)) { return new Worker(opts); } this.opts = opts; this.port = this.opts.port || 8888; this.apps = opts.apps; if (typeof (this.apps) !== 'object') { this.apps = JSON.parse(this.apps); } this.server = http.createServer(this._handleHttp.bind(this)); ...
[ "function", "(", "opts", ")", "{", "if", "(", "!", "(", "this", "instanceof", "Worker", ")", ")", "{", "return", "new", "Worker", "(", "opts", ")", ";", "}", "this", ".", "opts", "=", "opts", ";", "this", ".", "port", "=", "this", ".", "opts", ...
Constructor of our worker @param {object} opts The options @returns {Worker} The instance of our worker @constructor
[ "Constructor", "of", "our", "worker" ]
101dcbbff20216678fc456862bff0f8c1788c068
https://github.com/vmarchaud/pm2-githook/blob/101dcbbff20216678fc456862bff0f8c1788c068/index.js#L38-L53
25,261
vmarchaud/pm2-githook
index.js
logCallback
function logCallback(cb, message) { var wrappedArgs = Array.prototype.slice.call(arguments); return function (err, data) { if (err) return cb(err); wrappedArgs.shift(); console.log.apply(console, wrappedArgs); cb(); } }
javascript
function logCallback(cb, message) { var wrappedArgs = Array.prototype.slice.call(arguments); return function (err, data) { if (err) return cb(err); wrappedArgs.shift(); console.log.apply(console, wrappedArgs); cb(); } }
[ "function", "logCallback", "(", "cb", ",", "message", ")", "{", "var", "wrappedArgs", "=", "Array", ".", "prototype", ".", "slice", ".", "call", "(", "arguments", ")", ";", "return", "function", "(", "err", ",", "data", ")", "{", "if", "(", "err", ")...
Executes the callback, but in case of success shows a message. Also accepts extra arguments to pass to console.log. Example: logCallback(next, '% worked perfect', appName) @param {Function} cb The callback to be called @param {string} message The message to show if success @returns {Function} The callback wrapped
[ "Executes", "the", "callback", "but", "in", "case", "of", "success", "shows", "a", "message", ".", "Also", "accepts", "extra", "arguments", "to", "pass", "to", "console", ".", "log", "." ]
101dcbbff20216678fc456862bff0f8c1788c068
https://github.com/vmarchaud/pm2-githook/blob/101dcbbff20216678fc456862bff0f8c1788c068/index.js#L286-L295
25,262
vmarchaud/pm2-githook
index.js
reqToAppName
function reqToAppName(req) { var targetName = null; try { targetName = req.url.split('/').pop(); } catch (e) {} return targetName || null; }
javascript
function reqToAppName(req) { var targetName = null; try { targetName = req.url.split('/').pop(); } catch (e) {} return targetName || null; }
[ "function", "reqToAppName", "(", "req", ")", "{", "var", "targetName", "=", "null", ";", "try", "{", "targetName", "=", "req", ".", "url", ".", "split", "(", "'/'", ")", ".", "pop", "(", ")", ";", "}", "catch", "(", "e", ")", "{", "}", "return", ...
Given a request, returns the name of the target App. Example: Call to 34.23.34.54:3000/api-2 Will return 'api-2' @param req The request to be analysed @returns {string|null} The name of the app, or null if not found.
[ "Given", "a", "request", "returns", "the", "name", "of", "the", "target", "App", "." ]
101dcbbff20216678fc456862bff0f8c1788c068
https://github.com/vmarchaud/pm2-githook/blob/101dcbbff20216678fc456862bff0f8c1788c068/index.js#L307-L313
25,263
queicherius/gw2api-client
src/endpoints/account.js
isStaleDailyData
async function isStaleDailyData (endpointInstance) { const account = await new AccountEndpoint(endpointInstance).schema('2019-03-26').get() return new Date(account.last_modified) < resetTime.getLastDailyReset() }
javascript
async function isStaleDailyData (endpointInstance) { const account = await new AccountEndpoint(endpointInstance).schema('2019-03-26').get() return new Date(account.last_modified) < resetTime.getLastDailyReset() }
[ "async", "function", "isStaleDailyData", "(", "endpointInstance", ")", "{", "const", "account", "=", "await", "new", "AccountEndpoint", "(", "endpointInstance", ")", ".", "schema", "(", "'2019-03-26'", ")", ".", "get", "(", ")", "return", "new", "Date", "(", ...
Stale data can happen if the last account update was before the last daily reset
[ "Stale", "data", "can", "happen", "if", "the", "last", "account", "update", "was", "before", "the", "last", "daily", "reset" ]
a5a2f6bab89425bbbcf33eec73b7440cec5f312f
https://github.com/queicherius/gw2api-client/blob/a5a2f6bab89425bbbcf33eec73b7440cec5f312f/src/endpoints/account.js#L424-L427
25,264
queicherius/gw2api-client
src/endpoints/account.js
isStaleWeeklyData
async function isStaleWeeklyData (endpointInstance) { const account = await new AccountEndpoint(endpointInstance).schema('2019-03-26').get() return new Date(account.last_modified) < resetTime.getLastWeeklyReset() }
javascript
async function isStaleWeeklyData (endpointInstance) { const account = await new AccountEndpoint(endpointInstance).schema('2019-03-26').get() return new Date(account.last_modified) < resetTime.getLastWeeklyReset() }
[ "async", "function", "isStaleWeeklyData", "(", "endpointInstance", ")", "{", "const", "account", "=", "await", "new", "AccountEndpoint", "(", "endpointInstance", ")", ".", "schema", "(", "'2019-03-26'", ")", ".", "get", "(", ")", "return", "new", "Date", "(", ...
Stale data can happen if the last account update was before the last weekly reset
[ "Stale", "data", "can", "happen", "if", "the", "last", "account", "update", "was", "before", "the", "last", "weekly", "reset" ]
a5a2f6bab89425bbbcf33eec73b7440cec5f312f
https://github.com/queicherius/gw2api-client/blob/a5a2f6bab89425bbbcf33eec73b7440cec5f312f/src/endpoints/account.js#L430-L433
25,265
canjs/can-component
can-component.js
createViewModel
function createViewModel(initialData, hasDataBinding, bindingState) { if(bindingState && bindingState.isSettingOnViewModel === true) { // If we are setting a value like `x:from="y"`, // we need to make a variable scope. newScope = tagData.scope.addLetContext(initialData); return newScope._context; ...
javascript
function createViewModel(initialData, hasDataBinding, bindingState) { if(bindingState && bindingState.isSettingOnViewModel === true) { // If we are setting a value like `x:from="y"`, // we need to make a variable scope. newScope = tagData.scope.addLetContext(initialData); return newScope._context; ...
[ "function", "createViewModel", "(", "initialData", ",", "hasDataBinding", ",", "bindingState", ")", "{", "if", "(", "bindingState", "&&", "bindingState", ".", "isSettingOnViewModel", "===", "true", ")", "{", "// If we are setting a value like `x:from=\"y\"`,", "// we need...
`createViewModel` is used to create the ViewModel that the bindings will operate on.
[ "createViewModel", "is", "used", "to", "create", "the", "ViewModel", "that", "the", "bindings", "will", "operate", "on", "." ]
bd4595ff2b7c6f2310750a5a4fa676768cf07c81
https://github.com/canjs/can-component/blob/bd4595ff2b7c6f2310750a5a4fa676768cf07c81/can-component.js#L86-L99
25,266
Travix-International/ui
packages/travix-ui-kit/components/spinner/spinner.js
Spinner
function Spinner(props) { warnAboutDeprecatedProp(props.mods, 'mods', 'className'); const { className, size } = props; const mods = props.mods ? props.mods.slice() : []; mods.push(`size_${size}`); const classes = classnames(getClassNamesWithMods('ui-spinner', mods), className); /* eslint-disable max-len...
javascript
function Spinner(props) { warnAboutDeprecatedProp(props.mods, 'mods', 'className'); const { className, size } = props; const mods = props.mods ? props.mods.slice() : []; mods.push(`size_${size}`); const classes = classnames(getClassNamesWithMods('ui-spinner', mods), className); /* eslint-disable max-len...
[ "function", "Spinner", "(", "props", ")", "{", "warnAboutDeprecatedProp", "(", "props", ".", "mods", ",", "'mods'", ",", "'className'", ")", ";", "const", "{", "className", ",", "size", "}", "=", "props", ";", "const", "mods", "=", "props", ".", "mods", ...
General Spinner component.
[ "General", "Spinner", "component", "." ]
f5a4446c10c039c726393ac3256183b1ecac85d1
https://github.com/Travix-International/ui/blob/f5a4446c10c039c726393ac3256183b1ecac85d1/packages/travix-ui-kit/components/spinner/spinner.js#L9-L118
25,267
Travix-International/ui
packages/travix-ui-kit/components/button/button.js
Button
function Button(props) { warnAboutDeprecatedProp(props.mods, 'mods', 'className'); const { children, className, dataAttrs = {}, disabled, href, id, onClick, onMouseUp, size, type, variation, } = props; const restProps = getDataAttributes(dataAttrs); const mods = pr...
javascript
function Button(props) { warnAboutDeprecatedProp(props.mods, 'mods', 'className'); const { children, className, dataAttrs = {}, disabled, href, id, onClick, onMouseUp, size, type, variation, } = props; const restProps = getDataAttributes(dataAttrs); const mods = pr...
[ "function", "Button", "(", "props", ")", "{", "warnAboutDeprecatedProp", "(", "props", ".", "mods", ",", "'mods'", ",", "'className'", ")", ";", "const", "{", "children", ",", "className", ",", "dataAttrs", "=", "{", "}", ",", "disabled", ",", "href", ",...
General Button component. Use when you need button or a link that looks like button
[ "General", "Button", "component", ".", "Use", "when", "you", "need", "button", "or", "a", "link", "that", "looks", "like", "button" ]
f5a4446c10c039c726393ac3256183b1ecac85d1
https://github.com/Travix-International/ui/blob/f5a4446c10c039c726393ac3256183b1ecac85d1/packages/travix-ui-kit/components/button/button.js#L15-L94
25,268
Travix-International/ui
packages/themes/index.js
getThemeFiles
function getThemeFiles({ brand, affiliate }) { return [ path.join(__dirname, '/themes/_default.yaml'), path.join(__dirname, `/themes/${brand}/_default.yaml`), path.join(__dirname, `/themes/${brand}/${affiliate.toUpperCase()}/_default.yaml`) ].filter(fs.existsSync); }
javascript
function getThemeFiles({ brand, affiliate }) { return [ path.join(__dirname, '/themes/_default.yaml'), path.join(__dirname, `/themes/${brand}/_default.yaml`), path.join(__dirname, `/themes/${brand}/${affiliate.toUpperCase()}/_default.yaml`) ].filter(fs.existsSync); }
[ "function", "getThemeFiles", "(", "{", "brand", ",", "affiliate", "}", ")", "{", "return", "[", "path", ".", "join", "(", "__dirname", ",", "'/themes/_default.yaml'", ")", ",", "path", ".", "join", "(", "__dirname", ",", "`", "${", "brand", "}", "`", "...
Get theme files in YAML format @param {Object} options @param {string} options.brand - cheaptickets @param {string} options.affiliate - NL @return {String}
[ "Get", "theme", "files", "in", "YAML", "format" ]
f5a4446c10c039c726393ac3256183b1ecac85d1
https://github.com/Travix-International/ui/blob/f5a4446c10c039c726393ac3256183b1ecac85d1/packages/themes/index.js#L11-L17
25,269
Travix-International/ui
packages/travix-ui-kit/components/calendar/calendar.js
processProps
function processProps(props) { const { initialDates, maxDate, minDate, selectionType, multiplemode } = props; const maxLimit = maxDate ? normalizeDate(getUTCDate(maxDate), 23, 59, 59, 999) : null; let renderDate = (initialDates && initialDates.length && initialDates[0]) ? getUTCDate(initialDates[0]) : new Date()...
javascript
function processProps(props) { const { initialDates, maxDate, minDate, selectionType, multiplemode } = props; const maxLimit = maxDate ? normalizeDate(getUTCDate(maxDate), 23, 59, 59, 999) : null; let renderDate = (initialDates && initialDates.length && initialDates[0]) ? getUTCDate(initialDates[0]) : new Date()...
[ "function", "processProps", "(", "props", ")", "{", "const", "{", "initialDates", ",", "maxDate", ",", "minDate", ",", "selectionType", ",", "multiplemode", "}", "=", "props", ";", "const", "maxLimit", "=", "maxDate", "?", "normalizeDate", "(", "getUTCDate", ...
Processes the given props and the existing state and returns a new state. @function processProps @param {Object} props Props to base the new state on. @param {Object} state (Existing) state to be based on for the existing values. @return {Object} New state to be set/used. @static
[ "Processes", "the", "given", "props", "and", "the", "existing", "state", "and", "returns", "a", "new", "state", "." ]
f5a4446c10c039c726393ac3256183b1ecac85d1
https://github.com/Travix-International/ui/blob/f5a4446c10c039c726393ac3256183b1ecac85d1/packages/travix-ui-kit/components/calendar/calendar.js#L31-L87
25,270
Travix-International/ui
packages/theme-builder/src/processors/js.js
parseExpressions
function parseExpressions(obj, proto) { const parsedObj = Object.assign(Object.create(proto), obj); Object.keys(obj).forEach((key) => { const value = obj[key]; const fn = isObject(value) ? parseExpressions : applyTransforms; try { parsedObj[key] = fn(value, parsedObj); } catch (err) { th...
javascript
function parseExpressions(obj, proto) { const parsedObj = Object.assign(Object.create(proto), obj); Object.keys(obj).forEach((key) => { const value = obj[key]; const fn = isObject(value) ? parseExpressions : applyTransforms; try { parsedObj[key] = fn(value, parsedObj); } catch (err) { th...
[ "function", "parseExpressions", "(", "obj", ",", "proto", ")", "{", "const", "parsedObj", "=", "Object", ".", "assign", "(", "Object", ".", "create", "(", "proto", ")", ",", "obj", ")", ";", "Object", ".", "keys", "(", "obj", ")", ".", "forEach", "("...
This function will walk a object tree and apply transformations on it @param {Object} obj @param {Object} the parent object
[ "This", "function", "will", "walk", "a", "object", "tree", "and", "apply", "transformations", "on", "it" ]
f5a4446c10c039c726393ac3256183b1ecac85d1
https://github.com/Travix-International/ui/blob/f5a4446c10c039c726393ac3256183b1ecac85d1/packages/theme-builder/src/processors/js.js#L37-L50
25,271
Travix-International/ui
packages/travix-ui-kit/components/_helpers.js
getDataAttributes
function getDataAttributes(attributes) { if (!attributes) { return {}; } return Object.keys(attributes).reduce((ret, key) => { ret[`data-${key.toLowerCase()}`] = attributes[key]; return ret; }, {}); }
javascript
function getDataAttributes(attributes) { if (!attributes) { return {}; } return Object.keys(attributes).reduce((ret, key) => { ret[`data-${key.toLowerCase()}`] = attributes[key]; return ret; }, {}); }
[ "function", "getDataAttributes", "(", "attributes", ")", "{", "if", "(", "!", "attributes", ")", "{", "return", "{", "}", ";", "}", "return", "Object", ".", "keys", "(", "attributes", ")", ".", "reduce", "(", "(", "ret", ",", "key", ")", "=>", "{", ...
Creates an object of data-attributes based on another given attributes' object. @param {Object} attributes Attributes to be added to a component as a data-* @return {Object} Returns an object with the attributes properly prefixed with 'data-'
[ "Creates", "an", "object", "of", "data", "-", "attributes", "based", "on", "another", "given", "attributes", "object", "." ]
f5a4446c10c039c726393ac3256183b1ecac85d1
https://github.com/Travix-International/ui/blob/f5a4446c10c039c726393ac3256183b1ecac85d1/packages/travix-ui-kit/components/_helpers.js#L29-L38
25,272
Travix-International/ui
packages/travix-ui-kit/components/_helpers.js
normalizeDate
function normalizeDate(dateObject, hours = 0, minutes = 0, seconds = 0, milliseconds = 0) { dateObject.setHours(hours); dateObject.setMinutes(minutes); dateObject.setSeconds(seconds); dateObject.setMilliseconds(milliseconds); return dateObject; }
javascript
function normalizeDate(dateObject, hours = 0, minutes = 0, seconds = 0, milliseconds = 0) { dateObject.setHours(hours); dateObject.setMinutes(minutes); dateObject.setSeconds(seconds); dateObject.setMilliseconds(milliseconds); return dateObject; }
[ "function", "normalizeDate", "(", "dateObject", ",", "hours", "=", "0", ",", "minutes", "=", "0", ",", "seconds", "=", "0", ",", "milliseconds", "=", "0", ")", "{", "dateObject", ".", "setHours", "(", "hours", ")", ";", "dateObject", ".", "setMinutes", ...
Receives a date object and normalizes it to the proper hours, minutes, seconds and milliseconds. @method normalizeDate @param {Date} dateObject Date object to be normalized. @param {Number} hours Value to set the hours to. Defaults to 0 @param {Number} minutes Value to set the minutes to. Defaults to 0 @param {Number}...
[ "Receives", "a", "date", "object", "and", "normalizes", "it", "to", "the", "proper", "hours", "minutes", "seconds", "and", "milliseconds", "." ]
f5a4446c10c039c726393ac3256183b1ecac85d1
https://github.com/Travix-International/ui/blob/f5a4446c10c039c726393ac3256183b1ecac85d1/packages/travix-ui-kit/components/_helpers.js#L66-L72
25,273
Travix-International/ui
packages/travix-ui-kit/components/_helpers.js
ejectOtherProps
function ejectOtherProps(props, propTypes) { const propTypesKeys = Object.keys(propTypes); return Object.keys(props) .filter(x => propTypesKeys.indexOf(x) === -1) .reduce((prev, item) => { return { ...prev, [item]: props[item] }; }, {}); }
javascript
function ejectOtherProps(props, propTypes) { const propTypesKeys = Object.keys(propTypes); return Object.keys(props) .filter(x => propTypesKeys.indexOf(x) === -1) .reduce((prev, item) => { return { ...prev, [item]: props[item] }; }, {}); }
[ "function", "ejectOtherProps", "(", "props", ",", "propTypes", ")", "{", "const", "propTypesKeys", "=", "Object", ".", "keys", "(", "propTypes", ")", ";", "return", "Object", ".", "keys", "(", "props", ")", ".", "filter", "(", "x", "=>", "propTypesKeys", ...
Eject real custom users props from props @method ejectOtherProps @param {Object} props conponent props. @param {Object} propTypes conponent props types. @return {Object} custom props.
[ "Eject", "real", "custom", "users", "props", "from", "props" ]
f5a4446c10c039c726393ac3256183b1ecac85d1
https://github.com/Travix-International/ui/blob/f5a4446c10c039c726393ac3256183b1ecac85d1/packages/travix-ui-kit/components/_helpers.js#L82-L89
25,274
Travix-International/ui
packages/travix-ui-kit/components/_helpers.js
warnAboutDeprecatedProp
function warnAboutDeprecatedProp(propValue, oldPropName, newPropName) { if (propValue !== undefined) { console.warn(`[DEPRECATED] the property "${oldPropName}" has been deprecated, use "${newPropName}" instead`); } }
javascript
function warnAboutDeprecatedProp(propValue, oldPropName, newPropName) { if (propValue !== undefined) { console.warn(`[DEPRECATED] the property "${oldPropName}" has been deprecated, use "${newPropName}" instead`); } }
[ "function", "warnAboutDeprecatedProp", "(", "propValue", ",", "oldPropName", ",", "newPropName", ")", "{", "if", "(", "propValue", "!==", "undefined", ")", "{", "console", ".", "warn", "(", "`", "${", "oldPropName", "}", "${", "newPropName", "}", "`", ")", ...
Warn about usage of deprecated prop @method warnAboutDeprecatedProp @param {Any} propValue value of deprecated prop. @param {String} oldPropName deprecated prop name. @param {String} newPropName new prop name.
[ "Warn", "about", "usage", "of", "deprecated", "prop" ]
f5a4446c10c039c726393ac3256183b1ecac85d1
https://github.com/Travix-International/ui/blob/f5a4446c10c039c726393ac3256183b1ecac85d1/packages/travix-ui-kit/components/_helpers.js#L99-L103
25,275
Travix-International/ui
packages/travix-ui-kit/components/list/list.js
List
function List(props) { warnAboutDeprecatedProp(props.mods, 'mods', 'className'); const { align, className, dataAttrs, hideBullets, items, } = props; const mods = props.mods ? props.mods.slice() : []; mods.push(`align_${align}`); if (hideBullets) { mods.push("no-bullets"); } ...
javascript
function List(props) { warnAboutDeprecatedProp(props.mods, 'mods', 'className'); const { align, className, dataAttrs, hideBullets, items, } = props; const mods = props.mods ? props.mods.slice() : []; mods.push(`align_${align}`); if (hideBullets) { mods.push("no-bullets"); } ...
[ "function", "List", "(", "props", ")", "{", "warnAboutDeprecatedProp", "(", "props", ".", "mods", ",", "'mods'", ",", "'className'", ")", ";", "const", "{", "align", ",", "className", ",", "dataAttrs", ",", "hideBullets", ",", "items", ",", "}", "=", "pr...
General List component. Use when you need to display array of elements
[ "General", "List", "component", ".", "Use", "when", "you", "need", "to", "display", "array", "of", "elements" ]
f5a4446c10c039c726393ac3256183b1ecac85d1
https://github.com/Travix-International/ui/blob/f5a4446c10c039c726393ac3256183b1ecac85d1/packages/travix-ui-kit/components/list/list.js#L10-L42
25,276
Travix-International/ui
packages/travix-ui-kit/components/checkbox/checkbox.js
Checkbox
function Checkbox(props) { warnAboutDeprecatedProp(props.mods, 'mods', 'className'); const { checked, children, className, dataAttrs = {}, disabled, inputDataAttrs = {}, name, onChange, } = props; const dataAttributes = getDataAttributes(dataAttrs); const inputDataAttributes ...
javascript
function Checkbox(props) { warnAboutDeprecatedProp(props.mods, 'mods', 'className'); const { checked, children, className, dataAttrs = {}, disabled, inputDataAttrs = {}, name, onChange, } = props; const dataAttributes = getDataAttributes(dataAttrs); const inputDataAttributes ...
[ "function", "Checkbox", "(", "props", ")", "{", "warnAboutDeprecatedProp", "(", "props", ".", "mods", ",", "'mods'", ",", "'className'", ")", ";", "const", "{", "checked", ",", "children", ",", "className", ",", "dataAttrs", "=", "{", "}", ",", "disabled",...
Checkbox component.
[ "Checkbox", "component", "." ]
f5a4446c10c039c726393ac3256183b1ecac85d1
https://github.com/Travix-International/ui/blob/f5a4446c10c039c726393ac3256183b1ecac85d1/packages/travix-ui-kit/components/checkbox/checkbox.js#L11-L53
25,277
Travix-International/ui
packages/css-themes-polyfill/src/index.js
parseExternalLink
function parseExternalLink(elem) { var path = elem.href; elem.setAttribute('data-parsed', true); var rawFile = new XMLHttpRequest(); rawFile.open('GET', path, true); rawFile.onreadystatechange = function processStylesFile() { if (rawFile.readyState === 4 && (rawFile.status === 200 || rawFile.s...
javascript
function parseExternalLink(elem) { var path = elem.href; elem.setAttribute('data-parsed', true); var rawFile = new XMLHttpRequest(); rawFile.open('GET', path, true); rawFile.onreadystatechange = function processStylesFile() { if (rawFile.readyState === 4 && (rawFile.status === 200 || rawFile.s...
[ "function", "parseExternalLink", "(", "elem", ")", "{", "var", "path", "=", "elem", ".", "href", ";", "elem", ".", "setAttribute", "(", "'data-parsed'", ",", "true", ")", ";", "var", "rawFile", "=", "new", "XMLHttpRequest", "(", ")", ";", "rawFile", ".",...
Load and parse external Link tags
[ "Load", "and", "parse", "external", "Link", "tags" ]
f5a4446c10c039c726393ac3256183b1ecac85d1
https://github.com/Travix-International/ui/blob/f5a4446c10c039c726393ac3256183b1ecac85d1/packages/css-themes-polyfill/src/index.js#L19-L33
25,278
cozy/cozy-bar
src/lib/realtime.js
initializeRealtime
async function initializeRealtime({ getApp, onCreate, onDelete, url, token }) { const realtimeConfig = { token, url } try { realtime .subscribe(realtimeConfig, APPS_DOCTYPE) .onCreate(async app => { // Fetch directly the app to get attributes `related` as well. let fullApp t...
javascript
async function initializeRealtime({ getApp, onCreate, onDelete, url, token }) { const realtimeConfig = { token, url } try { realtime .subscribe(realtimeConfig, APPS_DOCTYPE) .onCreate(async app => { // Fetch directly the app to get attributes `related` as well. let fullApp t...
[ "async", "function", "initializeRealtime", "(", "{", "getApp", ",", "onCreate", ",", "onDelete", ",", "url", ",", "token", "}", ")", "{", "const", "realtimeConfig", "=", "{", "token", ",", "url", "}", "try", "{", "realtime", ".", "subscribe", "(", "realt...
Initialize realtime sockets @private @param {object} @returns {Promise}
[ "Initialize", "realtime", "sockets" ]
0db02c97cada3f11193a95a250587eda4f284df1
https://github.com/cozy/cozy-bar/blob/0db02c97cada3f11193a95a250587eda4f284df1/src/lib/realtime.js#L12-L39
25,279
cozy/cozy-bar
src/lib/stack-internal.js
cozyFetchJSON
function cozyFetchJSON(cozy, method, path, body) { const requestOptions = Object.assign({}, fetchOptions(), { method }) requestOptions.headers['Accept'] = 'application/json' if (method !== 'GET' && method !== 'HEAD' && body !== undefined) { if (requestOptions.headers['Content-Type']) { requestOpti...
javascript
function cozyFetchJSON(cozy, method, path, body) { const requestOptions = Object.assign({}, fetchOptions(), { method }) requestOptions.headers['Accept'] = 'application/json' if (method !== 'GET' && method !== 'HEAD' && body !== undefined) { if (requestOptions.headers['Content-Type']) { requestOpti...
[ "function", "cozyFetchJSON", "(", "cozy", ",", "method", ",", "path", ",", "body", ")", "{", "const", "requestOptions", "=", "Object", ".", "assign", "(", "{", "}", ",", "fetchOptions", "(", ")", ",", "{", "method", "}", ")", "requestOptions", ".", "he...
fetch function with the same interface than in cozy-client-js
[ "fetch", "function", "with", "the", "same", "interface", "than", "in", "cozy", "-", "client", "-", "js" ]
0db02c97cada3f11193a95a250587eda4f284df1
https://github.com/cozy/cozy-bar/blob/0db02c97cada3f11193a95a250587eda4f284df1/src/lib/stack-internal.js#L62-L80
25,280
mongodb-js/connection-model
lib/model.js
function(attrs) { if (!attrs.ssl || includes(['NONE', 'UNVALIDATED', 'IFAVAILABLE', 'SYSTEMCA'], attrs.ssl)) { return; } if (attrs.ssl === 'SERVER' && !attrs.ssl_ca) { throw new TypeError('ssl_ca is required when ssl is SERVER.'); } else if (attrs.ssl === 'ALL') { if (!attrs.ssl_ca) { ...
javascript
function(attrs) { if (!attrs.ssl || includes(['NONE', 'UNVALIDATED', 'IFAVAILABLE', 'SYSTEMCA'], attrs.ssl)) { return; } if (attrs.ssl === 'SERVER' && !attrs.ssl_ca) { throw new TypeError('ssl_ca is required when ssl is SERVER.'); } else if (attrs.ssl === 'ALL') { if (!attrs.ssl_ca) { ...
[ "function", "(", "attrs", ")", "{", "if", "(", "!", "attrs", ".", "ssl", "||", "includes", "(", "[", "'NONE'", ",", "'UNVALIDATED'", ",", "'IFAVAILABLE'", ",", "'SYSTEMCA'", "]", ",", "attrs", ".", "ssl", ")", ")", "{", "return", ";", "}", "if", "(...
Enforce constraints for SSL. @param {Object} attrs - Incoming attributes.
[ "Enforce", "constraints", "for", "SSL", "." ]
1e58ed4da67c44acd0f631881bffceb2d4d614e6
https://github.com/mongodb-js/connection-model/blob/1e58ed4da67c44acd0f631881bffceb2d4d614e6/lib/model.js#L928-L947
25,281
mongodb-js/connection-model
lib/model.js
function(attrs) { if (attrs.authentication !== 'KERBEROS') { if (attrs.kerberos_service_name) { throw new TypeError(format( 'The kerberos_service_name field does not apply when ' + 'using %s for authentication.', attrs.authentication)); } if (attrs.kerberos_principal) {...
javascript
function(attrs) { if (attrs.authentication !== 'KERBEROS') { if (attrs.kerberos_service_name) { throw new TypeError(format( 'The kerberos_service_name field does not apply when ' + 'using %s for authentication.', attrs.authentication)); } if (attrs.kerberos_principal) {...
[ "function", "(", "attrs", ")", "{", "if", "(", "attrs", ".", "authentication", "!==", "'KERBEROS'", ")", "{", "if", "(", "attrs", ".", "kerberos_service_name", ")", "{", "throw", "new", "TypeError", "(", "format", "(", "'The kerberos_service_name field does not ...
Enforce constraints for Kerberos. @param {Object} attrs - Incoming attributes.
[ "Enforce", "constraints", "for", "Kerberos", "." ]
1e58ed4da67c44acd0f631881bffceb2d4d614e6
https://github.com/mongodb-js/connection-model/blob/1e58ed4da67c44acd0f631881bffceb2d4d614e6/lib/model.js#L967-L993
25,282
mongodb-js/connection-model
lib/connect.js
validateURL
function validateURL(model, done) { var url = model.driver_url; parseURL(url, {}, function(err, result) { // URL parsing errors are just generic `Error` instances // so overwrite name so mongodb-js-server will know // the message is safe to display. if (err) { err.name = 'MongoError'; } ...
javascript
function validateURL(model, done) { var url = model.driver_url; parseURL(url, {}, function(err, result) { // URL parsing errors are just generic `Error` instances // so overwrite name so mongodb-js-server will know // the message is safe to display. if (err) { err.name = 'MongoError'; } ...
[ "function", "validateURL", "(", "model", ",", "done", ")", "{", "var", "url", "=", "model", ".", "driver_url", ";", "parseURL", "(", "url", ",", "{", "}", ",", "function", "(", "err", ",", "result", ")", "{", "// URL parsing errors are just generic `Error` i...
Make sure the driver doesn't puke on the URL and cause an uncaughtException. @param {Connection} model @param {Function} done
[ "Make", "sure", "the", "driver", "doesn", "t", "puke", "on", "the", "URL", "and", "cause", "an", "uncaughtException", "." ]
1e58ed4da67c44acd0f631881bffceb2d4d614e6
https://github.com/mongodb-js/connection-model/blob/1e58ed4da67c44acd0f631881bffceb2d4d614e6/lib/connect.js#L74-L85
25,283
ihh/bracery
lambda/bracery-util.js
httpsRequest
async function httpsRequest (opts, formData) { return new Promise ((resolve, reject) => { let req = https.request (opts, (res) => { let data = ''; res.on('data', (chunk) => { data += chunk; }); res.on('end', () => { resolve ([res, data]); }); }); if (formData) req.write (f...
javascript
async function httpsRequest (opts, formData) { return new Promise ((resolve, reject) => { let req = https.request (opts, (res) => { let data = ''; res.on('data', (chunk) => { data += chunk; }); res.on('end', () => { resolve ([res, data]); }); }); if (formData) req.write (f...
[ "async", "function", "httpsRequest", "(", "opts", ",", "formData", ")", "{", "return", "new", "Promise", "(", "(", "resolve", ",", "reject", ")", "=>", "{", "let", "req", "=", "https", ".", "request", "(", "opts", ",", "(", "res", ")", "=>", "{", "...
async https.request
[ "async", "https", ".", "request" ]
ad52f4be347b5c0c07da38b647f9fd2854aee96a
https://github.com/ihh/bracery/blob/ad52f4be347b5c0c07da38b647f9fd2854aee96a/lambda/bracery-util.js#L119-L133
25,284
ihh/bracery
src/parsetree.js
makeFuncArgTree
function makeFuncArgTree (pt, args, makeSymbolName, forceBraces, allowNakedSymbol) { var noBraces = !forceBraces && args.length === 1 && (args[0].type === 'func' || args[0].type === 'lookup' || args[0].type === 'alt' || (allowNakedSymbol && isPlainSymExpr(args[0]))) return [noBraces ? '' : leftBraceChar, pt.makeRhs...
javascript
function makeFuncArgTree (pt, args, makeSymbolName, forceBraces, allowNakedSymbol) { var noBraces = !forceBraces && args.length === 1 && (args[0].type === 'func' || args[0].type === 'lookup' || args[0].type === 'alt' || (allowNakedSymbol && isPlainSymExpr(args[0]))) return [noBraces ? '' : leftBraceChar, pt.makeRhs...
[ "function", "makeFuncArgTree", "(", "pt", ",", "args", ",", "makeSymbolName", ",", "forceBraces", ",", "allowNakedSymbol", ")", "{", "var", "noBraces", "=", "!", "forceBraces", "&&", "args", ".", "length", "===", "1", "&&", "(", "args", "[", "0", "]", "....
Misc text rendering
[ "Misc", "text", "rendering" ]
ad52f4be347b5c0c07da38b647f9fd2854aee96a
https://github.com/ihh/bracery/blob/ad52f4be347b5c0c07da38b647f9fd2854aee96a/src/parsetree.js#L647-L650
25,285
ihh/bracery
src/parsetree.js
function (next) { // next can be a function or another thenable if (typeof(next.then) === 'function') // thenable? return next // next is a function, so call it var nextResult = next.apply (next, result) if (nextResult && typeof(nextResult.then) !== '...
javascript
function (next) { // next can be a function or another thenable if (typeof(next.then) === 'function') // thenable? return next // next is a function, so call it var nextResult = next.apply (next, result) if (nextResult && typeof(nextResult.then) !== '...
[ "function", "(", "next", ")", "{", "// next can be a function or another thenable", "if", "(", "typeof", "(", "next", ".", "then", ")", "===", "'function'", ")", "// thenable?", "return", "next", "// next is a function, so call it", "var", "nextResult", "=", "next", ...
for debugging inspection
[ "for", "debugging", "inspection" ]
ad52f4be347b5c0c07da38b647f9fd2854aee96a
https://github.com/ihh/bracery/blob/ad52f4be347b5c0c07da38b647f9fd2854aee96a/src/parsetree.js#L902-L911
25,286
ihh/bracery
src/parsetree.js
makeRhsExpansionPromise
function makeRhsExpansionPromise (config) { var pt = this var rhs = config.rhs || this.sampleParseTree (config.parsedRhsText || parseRhs (config.rhsText), config) var resolve = config.sync ? syncPromiseResolve : Promise.resolve.bind(Promise) var maxLength = config.maxLength || pt.maxLength var maxNodes = conf...
javascript
function makeRhsExpansionPromise (config) { var pt = this var rhs = config.rhs || this.sampleParseTree (config.parsedRhsText || parseRhs (config.rhsText), config) var resolve = config.sync ? syncPromiseResolve : Promise.resolve.bind(Promise) var maxLength = config.maxLength || pt.maxLength var maxNodes = conf...
[ "function", "makeRhsExpansionPromise", "(", "config", ")", "{", "var", "pt", "=", "this", "var", "rhs", "=", "config", ".", "rhs", "||", "this", ".", "sampleParseTree", "(", "config", ".", "parsedRhsText", "||", "parseRhs", "(", "config", ".", "rhsText", "...
makeRhsExpansionPromise is the main method for asynchronously expanding a template that may already have been partially expanded using sampleParseTree.
[ "makeRhsExpansionPromise", "is", "the", "main", "method", "for", "asynchronously", "expanding", "a", "template", "that", "may", "already", "have", "been", "partially", "expanded", "using", "sampleParseTree", "." ]
ad52f4be347b5c0c07da38b647f9fd2854aee96a
https://github.com/ihh/bracery/blob/ad52f4be347b5c0c07da38b647f9fd2854aee96a/src/parsetree.js#L1069-L1098
25,287
ihh/bracery
src/parsetree.js
pseudoRotateArray
function pseudoRotateArray (a, rng) { var halfLen = a.length / 2, insertAfter = Math.ceil(halfLen) + Math.floor (rng() * Math.floor(halfLen)) var result = a.slice(1) result.splice (insertAfter, 0, a[0]) return result }
javascript
function pseudoRotateArray (a, rng) { var halfLen = a.length / 2, insertAfter = Math.ceil(halfLen) + Math.floor (rng() * Math.floor(halfLen)) var result = a.slice(1) result.splice (insertAfter, 0, a[0]) return result }
[ "function", "pseudoRotateArray", "(", "a", ",", "rng", ")", "{", "var", "halfLen", "=", "a", ".", "length", "/", "2", ",", "insertAfter", "=", "Math", ".", "ceil", "(", "halfLen", ")", "+", "Math", ".", "floor", "(", "rng", "(", ")", "*", "Math", ...
pseudoRotateArray moves first item to somewhere in the back half
[ "pseudoRotateArray", "moves", "first", "item", "to", "somewhere", "in", "the", "back", "half" ]
ad52f4be347b5c0c07da38b647f9fd2854aee96a
https://github.com/ihh/bracery/blob/ad52f4be347b5c0c07da38b647f9fd2854aee96a/src/parsetree.js#L1214-L1219
25,288
ihh/bracery
src/parsetree.js
capitalize
function capitalize (text) { return text .replace (/^([^A-Za-z]*)([a-z])/, function (m, g1, g2) { return g1 + g2.toUpperCase() }) .replace (/([\.\!\?]\s*)([a-z])/g, function (m, g1, g2) { return g1 + g2.toUpperCase() }) }
javascript
function capitalize (text) { return text .replace (/^([^A-Za-z]*)([a-z])/, function (m, g1, g2) { return g1 + g2.toUpperCase() }) .replace (/([\.\!\?]\s*)([a-z])/g, function (m, g1, g2) { return g1 + g2.toUpperCase() }) }
[ "function", "capitalize", "(", "text", ")", "{", "return", "text", ".", "replace", "(", "/", "^([^A-Za-z]*)([a-z])", "/", ",", "function", "(", "m", ",", "g1", ",", "g2", ")", "{", "return", "g1", "+", "g2", ".", "toUpperCase", "(", ")", "}", ")", ...
Capitalization of first letters in sentences
[ "Capitalization", "of", "first", "letters", "in", "sentences" ]
ad52f4be347b5c0c07da38b647f9fd2854aee96a
https://github.com/ihh/bracery/blob/ad52f4be347b5c0c07da38b647f9fd2854aee96a/src/parsetree.js#L2462-L2466
25,289
ihh/bracery
src/parsetree.js
textToWords
function textToWords (text) { return text.toLowerCase() .replace(/[^a-z\s]/g,'') // these are the phoneme characters we keep .replace(/\s+/g,' ').replace(/^ /,'').replace(/ $/,'') // collapse all runs of space & remove start/end space .split(' '); }
javascript
function textToWords (text) { return text.toLowerCase() .replace(/[^a-z\s]/g,'') // these are the phoneme characters we keep .replace(/\s+/g,' ').replace(/^ /,'').replace(/ $/,'') // collapse all runs of space & remove start/end space .split(' '); }
[ "function", "textToWords", "(", "text", ")", "{", "return", "text", ".", "toLowerCase", "(", ")", ".", "replace", "(", "/", "[^a-z\\s]", "/", "g", ",", "''", ")", "// these are the phoneme characters we keep", ".", "replace", "(", "/", "\\s+", "/", "g", ",...
Text to words
[ "Text", "to", "words" ]
ad52f4be347b5c0c07da38b647f9fd2854aee96a
https://github.com/ihh/bracery/blob/ad52f4be347b5c0c07da38b647f9fd2854aee96a/src/parsetree.js#L2485-L2490
25,290
nodules/susanin
dist/susanin.js
function(params, sep, eq) { var query = '', value, typeOf, tmpArray, i, size, key; if ( ! params) { return query; } sep || (sep = '&'); eq || (eq = '='); for (key in params) { if (hasOwnProp.call(p...
javascript
function(params, sep, eq) { var query = '', value, typeOf, tmpArray, i, size, key; if ( ! params) { return query; } sep || (sep = '&'); eq || (eq = '='); for (key in params) { if (hasOwnProp.call(p...
[ "function", "(", "params", ",", "sep", ",", "eq", ")", "{", "var", "query", "=", "''", ",", "value", ",", "typeOf", ",", "tmpArray", ",", "i", ",", "size", ",", "key", ";", "if", "(", "!", "params", ")", "{", "return", "query", ";", "}", "sep",...
Build querystring from object @link http://nodejs.org/api/querystring.html#querystring_querystring_stringify_obj_sep_eq @param {Object} params @param {String} [sep='&'] @param {String} [eq='='] @returns {String}
[ "Build", "querystring", "from", "object" ]
3023be76df0b6be130bfe968d346d388ef37c715
https://github.com/nodules/susanin/blob/3023be76df0b6be130bfe968d346d388ef37c715/dist/susanin.js#L96-L128
25,291
dcodeIO/PSON
src/PSON/ProgressivePair.js
function(dict, options) { Pair.call(this); this.encoder = new Encoder(dict, true, options); this.decoder = new Decoder(dict, true, options); }
javascript
function(dict, options) { Pair.call(this); this.encoder = new Encoder(dict, true, options); this.decoder = new Decoder(dict, true, options); }
[ "function", "(", "dict", ",", "options", ")", "{", "Pair", ".", "call", "(", "this", ")", ";", "this", ".", "encoder", "=", "new", "Encoder", "(", "dict", ",", "true", ",", "options", ")", ";", "this", ".", "decoder", "=", "new", "Decoder", "(", ...
Constructs a new progressive PSON encoder and decoder pair. @exports PSON.ProgressivePair @class A progressive PSON encoder and decoder pair. @param {Array.<string>=} dict Initial dictionary @param {Object.<string,*>=} options Options @constructor @extends PSON.Pair
[ "Constructs", "a", "new", "progressive", "PSON", "encoder", "and", "decoder", "pair", "." ]
be3bb7c10260c4bf7d57aec57e98937d950e938d
https://github.com/dcodeIO/PSON/blob/be3bb7c10260c4bf7d57aec57e98937d950e938d/src/PSON/ProgressivePair.js#L15-L20
25,292
dcodeIO/PSON
dist/PSON.js
function(dict, progressive, options) { /** * Dictionary hash. * @type {Object.<string,number>} */ this.dict = {}; /** * Next dictionary index. * @type {number} */ ...
javascript
function(dict, progressive, options) { /** * Dictionary hash. * @type {Object.<string,number>} */ this.dict = {}; /** * Next dictionary index. * @type {number} */ ...
[ "function", "(", "dict", ",", "progressive", ",", "options", ")", "{", "/**\n * Dictionary hash.\n * @type {Object.<string,number>}\n */", "this", ".", "dict", "=", "{", "}", ";", "/**\n * Next dictionary index.\n ...
Constructs a new PSON Encoder. @exports PSON.Encoder @class A PSON Encoder. @param {Array.<string>=} dict Initial dictionary @param {boolean} progressive Whether this is a progressive or a static encoder @param {Object.<string,*>=} options Options @constructor
[ "Constructs", "a", "new", "PSON", "Encoder", "." ]
be3bb7c10260c4bf7d57aec57e98937d950e938d
https://github.com/dcodeIO/PSON/blob/be3bb7c10260c4bf7d57aec57e98937d950e938d/dist/PSON.js#L103-L133
25,293
dcodeIO/PSON
dist/PSON.js
function(dict, progressive, options) { /** * Dictionary array. * @type {Array.<string>} */ this.dict = (dict && Array.isArray(dict)) ? dict : []; /** * Whether this is a progressive or a static decoder....
javascript
function(dict, progressive, options) { /** * Dictionary array. * @type {Array.<string>} */ this.dict = (dict && Array.isArray(dict)) ? dict : []; /** * Whether this is a progressive or a static decoder....
[ "function", "(", "dict", ",", "progressive", ",", "options", ")", "{", "/**\n * Dictionary array.\n * @type {Array.<string>}\n */", "this", ".", "dict", "=", "(", "dict", "&&", "Array", ".", "isArray", "(", "dict", ")", ")...
Constructs a new PSON Decoder. @exports PSON.Decoder @class A PSON Decoder. @param {Array.<string>} dict Initial dictionary values @param {boolean} progressive Whether this is a progressive or a static decoder @param {Object.<string,*>=} options Options @constructor
[ "Constructs", "a", "new", "PSON", "Decoder", "." ]
be3bb7c10260c4bf7d57aec57e98937d950e938d
https://github.com/dcodeIO/PSON/blob/be3bb7c10260c4bf7d57aec57e98937d950e938d/dist/PSON.js#L298-L317
25,294
kalabox/kalabox
docs/js/extra.js
determineSelectedBranch
function determineSelectedBranch() { var branch = 'stable', path = window.location.pathname; // path is like /en/<branch>/<lang>/build/ -> extract 'lang' // split[0] is an '' because the path starts with the separator branch = path.split('/')[2]; return branch; }
javascript
function determineSelectedBranch() { var branch = 'stable', path = window.location.pathname; // path is like /en/<branch>/<lang>/build/ -> extract 'lang' // split[0] is an '' because the path starts with the separator branch = path.split('/')[2]; return branch; }
[ "function", "determineSelectedBranch", "(", ")", "{", "var", "branch", "=", "'stable'", ",", "path", "=", "window", ".", "location", ".", "pathname", ";", "// path is like /en/<branch>/<lang>/build/ -> extract 'lang'", "// split[0] is an '' because the path starts with the sepa...
Analyzes the URL of the current page to find out what the selected GitHub branch is. It's usually part of the location path. The code needs to distinguish between running MkDocs standalone and docs served from RTD. If no valid branch could be determined 'dev' returned. @returns GitHub branch name
[ "Analyzes", "the", "URL", "of", "the", "current", "page", "to", "find", "out", "what", "the", "selected", "GitHub", "branch", "is", ".", "It", "s", "usually", "part", "of", "the", "location", "path", ".", "The", "code", "needs", "to", "distinguish", "bet...
c8d3e66fe33645e5973b138f4b8403f96abe90e8
https://github.com/kalabox/kalabox/blob/c8d3e66fe33645e5973b138f4b8403f96abe90e8/docs/js/extra.js#L32-L38
25,295
kalabox/kalabox
lib/app/registry.js
appsAreEqual
function appsAreEqual(x, y) { function pp(o) { return JSON.stringify(o); } var xs = pp(x); var ys = pp(y); return xs === ys; }
javascript
function appsAreEqual(x, y) { function pp(o) { return JSON.stringify(o); } var xs = pp(x); var ys = pp(y); return xs === ys; }
[ "function", "appsAreEqual", "(", "x", ",", "y", ")", "{", "function", "pp", "(", "o", ")", "{", "return", "JSON", ".", "stringify", "(", "o", ")", ";", "}", "var", "xs", "=", "pp", "(", "x", ")", ";", "var", "ys", "=", "pp", "(", "y", ")", ...
Returns true if two apps are equal.
[ "Returns", "true", "if", "two", "apps", "are", "equal", "." ]
c8d3e66fe33645e5973b138f4b8403f96abe90e8
https://github.com/kalabox/kalabox/blob/c8d3e66fe33645e5973b138f4b8403f96abe90e8/lib/app/registry.js#L31-L38
25,296
kalabox/kalabox
lib/app/registry.js
existsInCache
function existsInCache(x, cache) { var found = _.find(cache, function(y) { return appsAreEqual(x, y); }); return !!found; }
javascript
function existsInCache(x, cache) { var found = _.find(cache, function(y) { return appsAreEqual(x, y); }); return !!found; }
[ "function", "existsInCache", "(", "x", ",", "cache", ")", "{", "var", "found", "=", "_", ".", "find", "(", "cache", ",", "function", "(", "y", ")", "{", "return", "appsAreEqual", "(", "x", ",", "y", ")", ";", "}", ")", ";", "return", "!", "!", ...
Returns true if app already exists in cache.
[ "Returns", "true", "if", "app", "already", "exists", "in", "cache", "." ]
c8d3e66fe33645e5973b138f4b8403f96abe90e8
https://github.com/kalabox/kalabox/blob/c8d3e66fe33645e5973b138f4b8403f96abe90e8/lib/app/registry.js#L41-L46
25,297
kalabox/kalabox
lib/app/registry.js
function(app) { if (!appCache.good) { appCache.good = []; } if (!existsInCache(app, appCache.good)) { appCache.good.push(app); } }
javascript
function(app) { if (!appCache.good) { appCache.good = []; } if (!existsInCache(app, appCache.good)) { appCache.good.push(app); } }
[ "function", "(", "app", ")", "{", "if", "(", "!", "appCache", ".", "good", ")", "{", "appCache", ".", "good", "=", "[", "]", ";", "}", "if", "(", "!", "existsInCache", "(", "app", ",", "appCache", ".", "good", ")", ")", "{", "appCache", ".", "g...
Cache an appDir by appName in data store.
[ "Cache", "an", "appDir", "by", "appName", "in", "data", "store", "." ]
c8d3e66fe33645e5973b138f4b8403f96abe90e8
https://github.com/kalabox/kalabox/blob/c8d3e66fe33645e5973b138f4b8403f96abe90e8/lib/app/registry.js#L49-L56
25,298
kalabox/kalabox
lib/app/registry.js
function(app) { if (!appCache.bad) { appCache.bad = []; } if (!existsInCache(app, appCache.bad)) { appCache.bad.push(app); } }
javascript
function(app) { if (!appCache.bad) { appCache.bad = []; } if (!existsInCache(app, appCache.bad)) { appCache.bad.push(app); } }
[ "function", "(", "app", ")", "{", "if", "(", "!", "appCache", ".", "bad", ")", "{", "appCache", ".", "bad", "=", "[", "]", ";", "}", "if", "(", "!", "existsInCache", "(", "app", ",", "appCache", ".", "bad", ")", ")", "{", "appCache", ".", "bad"...
Cache an appDir by appName in bad app data store.
[ "Cache", "an", "appDir", "by", "appName", "in", "bad", "app", "data", "store", "." ]
c8d3e66fe33645e5973b138f4b8403f96abe90e8
https://github.com/kalabox/kalabox/blob/c8d3e66fe33645e5973b138f4b8403f96abe90e8/lib/app/registry.js#L59-L66
25,299
kalabox/kalabox
lib/app/registry.js
function() { var globalConfig = getGlobalConfig(); // Read contents of app registry file. return Promise.fromNode(function(cb) { fs.readFile(globalConfig.appRegistry, {encoding: 'utf8'}, cb); }) // Parse contents and return app dirs. .then(function(data) { var json = JSON.parse(data); if (json)...
javascript
function() { var globalConfig = getGlobalConfig(); // Read contents of app registry file. return Promise.fromNode(function(cb) { fs.readFile(globalConfig.appRegistry, {encoding: 'utf8'}, cb); }) // Parse contents and return app dirs. .then(function(data) { var json = JSON.parse(data); if (json)...
[ "function", "(", ")", "{", "var", "globalConfig", "=", "getGlobalConfig", "(", ")", ";", "// Read contents of app registry file.", "return", "Promise", ".", "fromNode", "(", "function", "(", "cb", ")", "{", "fs", ".", "readFile", "(", "globalConfig", ".", "app...
Read from app registry file.
[ "Read", "from", "app", "registry", "file", "." ]
c8d3e66fe33645e5973b138f4b8403f96abe90e8
https://github.com/kalabox/kalabox/blob/c8d3e66fe33645e5973b138f4b8403f96abe90e8/lib/app/registry.js#L79-L104