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
28,200
KleeGroup/focus-core
src/site-description/builder.js
_processHeaders
function _processHeaders(siteDesc, prefix) { if (!siteDesc.headers) { return; } //console.log('headers', siteDesc.headers, 'prefix', prefix); let headers = siteDesc.headers; let isInSiteStructure = false; if (siteDescriptionReader.checkParams(siteDesc.requiredParams)) { isInSiteStructure = true; } for (let i in headers) { _processElement(headers[i], prefix, { isInSiteStructure: isInSiteStructure }); } }
javascript
function _processHeaders(siteDesc, prefix) { if (!siteDesc.headers) { return; } //console.log('headers', siteDesc.headers, 'prefix', prefix); let headers = siteDesc.headers; let isInSiteStructure = false; if (siteDescriptionReader.checkParams(siteDesc.requiredParams)) { isInSiteStructure = true; } for (let i in headers) { _processElement(headers[i], prefix, { isInSiteStructure: isInSiteStructure }); } }
[ "function", "_processHeaders", "(", "siteDesc", ",", "prefix", ")", "{", "if", "(", "!", "siteDesc", ".", "headers", ")", "{", "return", ";", "}", "//console.log('headers', siteDesc.headers, 'prefix', prefix);", "let", "headers", "=", "siteDesc", ".", "headers", ";", "let", "isInSiteStructure", "=", "false", ";", "if", "(", "siteDescriptionReader", ".", "checkParams", "(", "siteDesc", ".", "requiredParams", ")", ")", "{", "isInSiteStructure", "=", "true", ";", "}", "for", "(", "let", "i", "in", "headers", ")", "{", "_processElement", "(", "headers", "[", "i", "]", ",", "prefix", ",", "{", "isInSiteStructure", ":", "isInSiteStructure", "}", ")", ";", "}", "}" ]
Process the deaders element of the site description element.
[ "Process", "the", "deaders", "element", "of", "the", "site", "description", "element", "." ]
6ce70638e0c5acdd25830a14ce3b154f84a17405
https://github.com/KleeGroup/focus-core/blob/6ce70638e0c5acdd25830a14ce3b154f84a17405/src/site-description/builder.js#L26-L40
28,201
KleeGroup/focus-core
src/site-description/builder.js
_processPages
function _processPages(siteDesc, prefix) { if (siteDesc.pages !== undefined && siteDesc.pages !== null) { //console.log('pages', siteDesc.pages, 'prefix', prefix); for (let i in siteDesc.pages) { _processElement(siteDesc.pages[i], prefix); } } }
javascript
function _processPages(siteDesc, prefix) { if (siteDesc.pages !== undefined && siteDesc.pages !== null) { //console.log('pages', siteDesc.pages, 'prefix', prefix); for (let i in siteDesc.pages) { _processElement(siteDesc.pages[i], prefix); } } }
[ "function", "_processPages", "(", "siteDesc", ",", "prefix", ")", "{", "if", "(", "siteDesc", ".", "pages", "!==", "undefined", "&&", "siteDesc", ".", "pages", "!==", "null", ")", "{", "//console.log('pages', siteDesc.pages, 'prefix', prefix);", "for", "(", "let", "i", "in", "siteDesc", ".", "pages", ")", "{", "_processElement", "(", "siteDesc", ".", "pages", "[", "i", "]", ",", "prefix", ")", ";", "}", "}", "}" ]
Process the pages element of the site description.
[ "Process", "the", "pages", "element", "of", "the", "site", "description", "." ]
6ce70638e0c5acdd25830a14ce3b154f84a17405
https://github.com/KleeGroup/focus-core/blob/6ce70638e0c5acdd25830a14ce3b154f84a17405/src/site-description/builder.js#L43-L51
28,202
KleeGroup/focus-core
src/site-description/builder.js
_processRoute
function _processRoute(siteDesc, prefix, options) { options = options || {}; //if (siteDesc.roles !== undefined && siteDesc.url !== undefined) //console.log('route', siteDesc.url, 'prefix', prefix); if (userHelper.hasRole(siteDesc.roles)) { let route = { roles: siteDesc.roles, name: prefix, route: siteDesc.url, regex: routeToRegExp(siteDesc.url), requiredParams: siteDesc.requiredParams }; //Call the Backbone.history.handlers.... //console.log('*****************'); //console.log('ROute name: ',route.route); //console.log('Route handler name : ', findRouteName(route.route.substring(1))); routes[findRouteName(route.route.substring(1))] = route; if (options.isInSiteStructure) { siteStructure[prefix] = route; } } }
javascript
function _processRoute(siteDesc, prefix, options) { options = options || {}; //if (siteDesc.roles !== undefined && siteDesc.url !== undefined) //console.log('route', siteDesc.url, 'prefix', prefix); if (userHelper.hasRole(siteDesc.roles)) { let route = { roles: siteDesc.roles, name: prefix, route: siteDesc.url, regex: routeToRegExp(siteDesc.url), requiredParams: siteDesc.requiredParams }; //Call the Backbone.history.handlers.... //console.log('*****************'); //console.log('ROute name: ',route.route); //console.log('Route handler name : ', findRouteName(route.route.substring(1))); routes[findRouteName(route.route.substring(1))] = route; if (options.isInSiteStructure) { siteStructure[prefix] = route; } } }
[ "function", "_processRoute", "(", "siteDesc", ",", "prefix", ",", "options", ")", "{", "options", "=", "options", "||", "{", "}", ";", "//if (siteDesc.roles !== undefined && siteDesc.url !== undefined)", "//console.log('route', siteDesc.url, 'prefix', prefix);", "if", "(", "userHelper", ".", "hasRole", "(", "siteDesc", ".", "roles", ")", ")", "{", "let", "route", "=", "{", "roles", ":", "siteDesc", ".", "roles", ",", "name", ":", "prefix", ",", "route", ":", "siteDesc", ".", "url", ",", "regex", ":", "routeToRegExp", "(", "siteDesc", ".", "url", ")", ",", "requiredParams", ":", "siteDesc", ".", "requiredParams", "}", ";", "//Call the Backbone.history.handlers....", "//console.log('*****************');", "//console.log('ROute name: ',route.route);", "//console.log('Route handler name : ', findRouteName(route.route.substring(1)));", "routes", "[", "findRouteName", "(", "route", ".", "route", ".", "substring", "(", "1", ")", ")", "]", "=", "route", ";", "if", "(", "options", ".", "isInSiteStructure", ")", "{", "siteStructure", "[", "prefix", "]", "=", "route", ";", "}", "}", "}" ]
Process the route part of the site description element.
[ "Process", "the", "route", "part", "of", "the", "site", "description", "element", "." ]
6ce70638e0c5acdd25830a14ce3b154f84a17405
https://github.com/KleeGroup/focus-core/blob/6ce70638e0c5acdd25830a14ce3b154f84a17405/src/site-description/builder.js#L54-L76
28,203
KleeGroup/focus-core
src/site-description/builder.js
processSiteDescription
function processSiteDescription(options) { options = options || {}; if (!siteDescriptionReader.isProcessed() || options.isForceProcess) { siteDescription = siteDescriptionReader.getSite(); regenerateRoutes(); return siteDescription; } return false; }
javascript
function processSiteDescription(options) { options = options || {}; if (!siteDescriptionReader.isProcessed() || options.isForceProcess) { siteDescription = siteDescriptionReader.getSite(); regenerateRoutes(); return siteDescription; } return false; }
[ "function", "processSiteDescription", "(", "options", ")", "{", "options", "=", "options", "||", "{", "}", ";", "if", "(", "!", "siteDescriptionReader", ".", "isProcessed", "(", ")", "||", "options", ".", "isForceProcess", ")", "{", "siteDescription", "=", "siteDescriptionReader", ".", "getSite", "(", ")", ";", "regenerateRoutes", "(", ")", ";", "return", "siteDescription", ";", "}", "return", "false", ";", "}" ]
Process the siteDescription if necessary.
[ "Process", "the", "siteDescription", "if", "necessary", "." ]
6ce70638e0c5acdd25830a14ce3b154f84a17405
https://github.com/KleeGroup/focus-core/blob/6ce70638e0c5acdd25830a14ce3b154f84a17405/src/site-description/builder.js#L149-L157
28,204
KleeGroup/focus-core
src/reference/builder.js
loadListByName
function loadListByName(listName, args, skipCache = false) { checkIsString('listName', listName); const configurationElement = getElement(listName); if (typeof configurationElement !== 'function') { throw new Error(`You are trying to load the reference list: ${listName} which does not have a list configure.`); } let now = _getTimeStamp(); if (cache[listName] && (now - cache[listName].timeStamp) < getCacheDuration() && !skipCache) { _deletePromiseWaiting(listName); //console.info('data served from cache', listName, cache[listName].value); return Promise.resolve(cache[listName].value); } //Call the service, the service must return a promise. return configurationElement(args) .then((data) => { return _cacheData(listName, data) }); }
javascript
function loadListByName(listName, args, skipCache = false) { checkIsString('listName', listName); const configurationElement = getElement(listName); if (typeof configurationElement !== 'function') { throw new Error(`You are trying to load the reference list: ${listName} which does not have a list configure.`); } let now = _getTimeStamp(); if (cache[listName] && (now - cache[listName].timeStamp) < getCacheDuration() && !skipCache) { _deletePromiseWaiting(listName); //console.info('data served from cache', listName, cache[listName].value); return Promise.resolve(cache[listName].value); } //Call the service, the service must return a promise. return configurationElement(args) .then((data) => { return _cacheData(listName, data) }); }
[ "function", "loadListByName", "(", "listName", ",", "args", ",", "skipCache", "=", "false", ")", "{", "checkIsString", "(", "'listName'", ",", "listName", ")", ";", "const", "configurationElement", "=", "getElement", "(", "listName", ")", ";", "if", "(", "typeof", "configurationElement", "!==", "'function'", ")", "{", "throw", "new", "Error", "(", "`", "${", "listName", "}", "`", ")", ";", "}", "let", "now", "=", "_getTimeStamp", "(", ")", ";", "if", "(", "cache", "[", "listName", "]", "&&", "(", "now", "-", "cache", "[", "listName", "]", ".", "timeStamp", ")", "<", "getCacheDuration", "(", ")", "&&", "!", "skipCache", ")", "{", "_deletePromiseWaiting", "(", "listName", ")", ";", "//console.info('data served from cache', listName, cache[listName].value);", "return", "Promise", ".", "resolve", "(", "cache", "[", "listName", "]", ".", "value", ")", ";", "}", "//Call the service, the service must return a promise.", "return", "configurationElement", "(", "args", ")", ".", "then", "(", "(", "data", ")", "=>", "{", "return", "_cacheData", "(", "listName", ",", "data", ")", "}", ")", ";", "}" ]
Load a reference with its list name. It calls the service which must have been registered. Load a list by name. @param {string} listName - The name of the list to load. @param {object} args - Argument to provide to the function.
[ "Load", "a", "reference", "with", "its", "list", "name", ".", "It", "calls", "the", "service", "which", "must", "have", "been", "registered", ".", "Load", "a", "list", "by", "name", "." ]
6ce70638e0c5acdd25830a14ce3b154f84a17405
https://github.com/KleeGroup/focus-core/blob/6ce70638e0c5acdd25830a14ce3b154f84a17405/src/reference/builder.js#L51-L68
28,205
KleeGroup/focus-core
src/reference/builder.js
getAutoCompleteServiceQuery
function getAutoCompleteServiceQuery(listName) { return (query) => { loadListByName(listName, query.term).then((results) => { query.callback(results); }); }; }
javascript
function getAutoCompleteServiceQuery(listName) { return (query) => { loadListByName(listName, query.term).then((results) => { query.callback(results); }); }; }
[ "function", "getAutoCompleteServiceQuery", "(", "listName", ")", "{", "return", "(", "query", ")", "=>", "{", "loadListByName", "(", "listName", ",", "query", ".", "term", ")", ".", "then", "(", "(", "results", ")", "=>", "{", "query", ".", "callback", "(", "results", ")", ";", "}", ")", ";", "}", ";", "}" ]
Get a function to trigger in autocomplete case. The function will trigger a promise. @param {string} listName - Name of the list.
[ "Get", "a", "function", "to", "trigger", "in", "autocomplete", "case", ".", "The", "function", "will", "trigger", "a", "promise", "." ]
6ce70638e0c5acdd25830a14ce3b154f84a17405
https://github.com/KleeGroup/focus-core/blob/6ce70638e0c5acdd25830a14ce3b154f84a17405/src/reference/builder.js#L93-L99
28,206
eXigentCoder/krpc-node
utilities/generate-services.js
documentParam
function documentParam(param, paramDictionary, procedureOrService) { let typeString = getTypeStringFromCode(param.type, null, param); let name = getParamName(param); let options = { type: param.type, paramDictionary: paramDictionary, paramName: name }; let description = getParamDescription(options); if (description !== '') { return ' * @param ' + typeString + ' ' + name + ' - ' + description; } return ' * @param ' + typeString + ' ' + name; }
javascript
function documentParam(param, paramDictionary, procedureOrService) { let typeString = getTypeStringFromCode(param.type, null, param); let name = getParamName(param); let options = { type: param.type, paramDictionary: paramDictionary, paramName: name }; let description = getParamDescription(options); if (description !== '') { return ' * @param ' + typeString + ' ' + name + ' - ' + description; } return ' * @param ' + typeString + ' ' + name; }
[ "function", "documentParam", "(", "param", ",", "paramDictionary", ",", "procedureOrService", ")", "{", "let", "typeString", "=", "getTypeStringFromCode", "(", "param", ".", "type", ",", "null", ",", "param", ")", ";", "let", "name", "=", "getParamName", "(", "param", ")", ";", "let", "options", "=", "{", "type", ":", "param", ".", "type", ",", "paramDictionary", ":", "paramDictionary", ",", "paramName", ":", "name", "}", ";", "let", "description", "=", "getParamDescription", "(", "options", ")", ";", "if", "(", "description", "!==", "''", ")", "{", "return", "' * @param '", "+", "typeString", "+", "' '", "+", "name", "+", "' - '", "+", "description", ";", "}", "return", "' * @param '", "+", "typeString", "+", "' '", "+", "name", ";", "}" ]
passing in the param is useful for debugging eslint-disable-next-line no-unused-vars
[ "passing", "in", "the", "param", "is", "useful", "for", "debugging", "eslint", "-", "disable", "-", "next", "-", "line", "no", "-", "unused", "-", "vars" ]
ebad306bd756d6bf78b5d6fd9deee503287667fa
https://github.com/eXigentCoder/krpc-node/blob/ebad306bd756d6bf78b5d6fd9deee503287667fa/utilities/generate-services.js#L140-L153
28,207
KleeGroup/focus-core
src/definition/domain/container.js
setDomains
function setDomains(newDomains) { if (!isObject(newDomains)) { throw new InvalidException('newDomains should be an object', newDomains); } domainsMap = domainsMap.merge(newDomains); }
javascript
function setDomains(newDomains) { if (!isObject(newDomains)) { throw new InvalidException('newDomains should be an object', newDomains); } domainsMap = domainsMap.merge(newDomains); }
[ "function", "setDomains", "(", "newDomains", ")", "{", "if", "(", "!", "isObject", "(", "newDomains", ")", ")", "{", "throw", "new", "InvalidException", "(", "'newDomains should be an object'", ",", "newDomains", ")", ";", "}", "domainsMap", "=", "domainsMap", ".", "merge", "(", "newDomains", ")", ";", "}" ]
Set new domains. @param {object} newDomains - New domains to set. à
[ "Set", "new", "domains", "." ]
6ce70638e0c5acdd25830a14ce3b154f84a17405
https://github.com/KleeGroup/focus-core/blob/6ce70638e0c5acdd25830a14ce3b154f84a17405/src/definition/domain/container.js#L28-L33
28,208
KleeGroup/focus-core
src/definition/domain/container.js
setDomain
function setDomain(domain) { checkIsObject('domain', domain); checkIsString('doamin.name', domain.name); //test domain, domain.name domainsMap = domainsMap.set(domain.name, domain); }
javascript
function setDomain(domain) { checkIsObject('domain', domain); checkIsString('doamin.name', domain.name); //test domain, domain.name domainsMap = domainsMap.set(domain.name, domain); }
[ "function", "setDomain", "(", "domain", ")", "{", "checkIsObject", "(", "'domain'", ",", "domain", ")", ";", "checkIsString", "(", "'doamin.name'", ",", "domain", ".", "name", ")", ";", "//test domain, domain.name", "domainsMap", "=", "domainsMap", ".", "set", "(", "domain", ".", "name", ",", "domain", ")", ";", "}" ]
Set a domain. @param {object} domain - Object structure of the domain.
[ "Set", "a", "domain", "." ]
6ce70638e0c5acdd25830a14ce3b154f84a17405
https://github.com/KleeGroup/focus-core/blob/6ce70638e0c5acdd25830a14ce3b154f84a17405/src/definition/domain/container.js#L40-L45
28,209
KleeGroup/focus-core
src/definition/domain/container.js
getDomain
function getDomain(domainName) { if (!isString(domainName)) { throw new InvalidException('domaiName should extists and be a string', domainName); } if (!domainsMap.has(domainName)) { console.warn(`You are trying to access a non existing domain: ${domainName}`); return Immutable.Map({}); } return domainsMap.get(domainName); }
javascript
function getDomain(domainName) { if (!isString(domainName)) { throw new InvalidException('domaiName should extists and be a string', domainName); } if (!domainsMap.has(domainName)) { console.warn(`You are trying to access a non existing domain: ${domainName}`); return Immutable.Map({}); } return domainsMap.get(domainName); }
[ "function", "getDomain", "(", "domainName", ")", "{", "if", "(", "!", "isString", "(", "domainName", ")", ")", "{", "throw", "new", "InvalidException", "(", "'domaiName should extists and be a string'", ",", "domainName", ")", ";", "}", "if", "(", "!", "domainsMap", ".", "has", "(", "domainName", ")", ")", "{", "console", ".", "warn", "(", "`", "${", "domainName", "}", "`", ")", ";", "return", "Immutable", ".", "Map", "(", "{", "}", ")", ";", "}", "return", "domainsMap", ".", "get", "(", "domainName", ")", ";", "}" ]
Get a domain given a name. @param {string} domainName - name of the domain. @return {object} - The domain object.
[ "Get", "a", "domain", "given", "a", "name", "." ]
6ce70638e0c5acdd25830a14ce3b154f84a17405
https://github.com/KleeGroup/focus-core/blob/6ce70638e0c5acdd25830a14ce3b154f84a17405/src/definition/domain/container.js#L52-L61
28,210
KleeGroup/focus-core
src/network/error-parsing.js
configure
function configure(options) { if (options && isArray(options.globalMessages)) { globalMessages = options.globalMessages; } if (options && isObject(options.errorTypes)) { errorTypes = options.errorTypes; } }
javascript
function configure(options) { if (options && isArray(options.globalMessages)) { globalMessages = options.globalMessages; } if (options && isObject(options.errorTypes)) { errorTypes = options.errorTypes; } }
[ "function", "configure", "(", "options", ")", "{", "if", "(", "options", "&&", "isArray", "(", "options", ".", "globalMessages", ")", ")", "{", "globalMessages", "=", "options", ".", "globalMessages", ";", "}", "if", "(", "options", "&&", "isObject", "(", "options", ".", "errorTypes", ")", ")", "{", "errorTypes", "=", "options", ".", "errorTypes", ";", "}", "}" ]
Configure the global messages and the error types. @param {object} options object containing global messages or error types
[ "Configure", "the", "global", "messages", "and", "the", "error", "types", "." ]
6ce70638e0c5acdd25830a14ce3b154f84a17405
https://github.com/KleeGroup/focus-core/blob/6ce70638e0c5acdd25830a14ce3b154f84a17405/src/network/error-parsing.js#L56-L63
28,211
KleeGroup/focus-core
src/network/error-parsing.js
_formatParameters
function _formatParameters(parameters) { let options = {}, formatter, value; for (let prop in parameters) { if (parameters.hasOwnProperty(prop)) { if (parameters[prop].domain) { let domain = getDomains()[parameters[prop].domain]; formatter = domain ? domain.format : undefined; } else { formatter = undefined; } value = formatter && formatter.value ? formatter.value(parameters[prop].value) : parameters[prop].value; options[prop] = value; } } return options; }
javascript
function _formatParameters(parameters) { let options = {}, formatter, value; for (let prop in parameters) { if (parameters.hasOwnProperty(prop)) { if (parameters[prop].domain) { let domain = getDomains()[parameters[prop].domain]; formatter = domain ? domain.format : undefined; } else { formatter = undefined; } value = formatter && formatter.value ? formatter.value(parameters[prop].value) : parameters[prop].value; options[prop] = value; } } return options; }
[ "function", "_formatParameters", "(", "parameters", ")", "{", "let", "options", "=", "{", "}", ",", "formatter", ",", "value", ";", "for", "(", "let", "prop", "in", "parameters", ")", "{", "if", "(", "parameters", ".", "hasOwnProperty", "(", "prop", ")", ")", "{", "if", "(", "parameters", "[", "prop", "]", ".", "domain", ")", "{", "let", "domain", "=", "getDomains", "(", ")", "[", "parameters", "[", "prop", "]", ".", "domain", "]", ";", "formatter", "=", "domain", "?", "domain", ".", "format", ":", "undefined", ";", "}", "else", "{", "formatter", "=", "undefined", ";", "}", "value", "=", "formatter", "&&", "formatter", ".", "value", "?", "formatter", ".", "value", "(", "parameters", "[", "prop", "]", ".", "value", ")", ":", "parameters", "[", "prop", "]", ".", "value", ";", "options", "[", "prop", "]", "=", "value", ";", "}", "}", "return", "options", ";", "}" ]
Template an error message with parameters. @param {object} parameters - The parameters to format. @return {object} - The formated parameters.
[ "Template", "an", "error", "message", "with", "parameters", "." ]
6ce70638e0c5acdd25830a14ce3b154f84a17405
https://github.com/KleeGroup/focus-core/blob/6ce70638e0c5acdd25830a14ce3b154f84a17405/src/network/error-parsing.js#L70-L86
28,212
KleeGroup/focus-core
src/network/error-parsing.js
_treatGlobalErrors
function _treatGlobalErrors(responseJSON, options) { options = options || {}; const allMessagesTypes = options.globalMessages || globalMessages; if (responseJSON !== undefined) { let globalMessagesContainer = []; let messages = responseJSON; //Looping through all messages types. allMessagesTypes.forEach((globalMessageConf) => { //Treat all the globals let msgs = messages[globalMessageConf.name]; if (msgs) { globalMessagesContainer = [...globalMessagesContainer, ...msgs]; //To remove _treatGlobalMessagesPerType(msgs, globalMessageConf.type); } }); return globalMessagesContainer; } return null; }
javascript
function _treatGlobalErrors(responseJSON, options) { options = options || {}; const allMessagesTypes = options.globalMessages || globalMessages; if (responseJSON !== undefined) { let globalMessagesContainer = []; let messages = responseJSON; //Looping through all messages types. allMessagesTypes.forEach((globalMessageConf) => { //Treat all the globals let msgs = messages[globalMessageConf.name]; if (msgs) { globalMessagesContainer = [...globalMessagesContainer, ...msgs]; //To remove _treatGlobalMessagesPerType(msgs, globalMessageConf.type); } }); return globalMessagesContainer; } return null; }
[ "function", "_treatGlobalErrors", "(", "responseJSON", ",", "options", ")", "{", "options", "=", "options", "||", "{", "}", ";", "const", "allMessagesTypes", "=", "options", ".", "globalMessages", "||", "globalMessages", ";", "if", "(", "responseJSON", "!==", "undefined", ")", "{", "let", "globalMessagesContainer", "=", "[", "]", ";", "let", "messages", "=", "responseJSON", ";", "//Looping through all messages types.", "allMessagesTypes", ".", "forEach", "(", "(", "globalMessageConf", ")", "=>", "{", "//Treat all the globals", "let", "msgs", "=", "messages", "[", "globalMessageConf", ".", "name", "]", ";", "if", "(", "msgs", ")", "{", "globalMessagesContainer", "=", "[", "...", "globalMessagesContainer", ",", "...", "msgs", "]", ";", "//To remove", "_treatGlobalMessagesPerType", "(", "msgs", ",", "globalMessageConf", ".", "type", ")", ";", "}", "}", ")", ";", "return", "globalMessagesContainer", ";", "}", "return", "null", ";", "}" ]
Treat the global errors. @param {object} responseJSON - Treat the global errors. @param {object} options - Options for error handling.{isDisplay:[true/false], globalMessages: [{type: "error", name: "propertyName"}]} @return {array} array of all treated message
[ "Treat", "the", "global", "errors", "." ]
6ce70638e0c5acdd25830a14ce3b154f84a17405
https://github.com/KleeGroup/focus-core/blob/6ce70638e0c5acdd25830a14ce3b154f84a17405/src/network/error-parsing.js#L117-L136
28,213
KleeGroup/focus-core
src/network/error-parsing.js
_treatEntityDetail
function _treatEntityDetail(fieldErrors) { return Object.keys(fieldErrors || {}).reduce( (res, field) => { res[field] = translate(fieldErrors[field]); return res; }, {}); }
javascript
function _treatEntityDetail(fieldErrors) { return Object.keys(fieldErrors || {}).reduce( (res, field) => { res[field] = translate(fieldErrors[field]); return res; }, {}); }
[ "function", "_treatEntityDetail", "(", "fieldErrors", ")", "{", "return", "Object", ".", "keys", "(", "fieldErrors", "||", "{", "}", ")", ".", "reduce", "(", "(", "res", ",", "field", ")", "=>", "{", "res", "[", "field", "]", "=", "translate", "(", "fieldErrors", "[", "field", "]", ")", ";", "return", "res", ";", "}", ",", "{", "}", ")", ";", "}" ]
Treat an object of error by translating every error content. @param {object} fieldErrors an object with key for fieldName, and values as error keys in i18n. @returns {object} a new object, with translated error
[ "Treat", "an", "object", "of", "error", "by", "translating", "every", "error", "content", "." ]
6ce70638e0c5acdd25830a14ce3b154f84a17405
https://github.com/KleeGroup/focus-core/blob/6ce70638e0c5acdd25830a14ce3b154f84a17405/src/network/error-parsing.js#L144-L150
28,214
KleeGroup/focus-core
src/network/error-parsing.js
_treatEntityExceptions
function _treatEntityExceptions(responseJSON = {}, options) { const { node } = options; const fieldJSONError = responseJSON.fieldErrors || {}; let fieldErrors = {}; if (isArray(node)) { node.forEach((nd) => { fieldErrors[nd] = _treatEntityDetail(fieldJSONError[nd]); }); } else { fieldErrors = _treatEntityDetail(fieldJSONError); } return fieldErrors; }
javascript
function _treatEntityExceptions(responseJSON = {}, options) { const { node } = options; const fieldJSONError = responseJSON.fieldErrors || {}; let fieldErrors = {}; if (isArray(node)) { node.forEach((nd) => { fieldErrors[nd] = _treatEntityDetail(fieldJSONError[nd]); }); } else { fieldErrors = _treatEntityDetail(fieldJSONError); } return fieldErrors; }
[ "function", "_treatEntityExceptions", "(", "responseJSON", "=", "{", "}", ",", "options", ")", "{", "const", "{", "node", "}", "=", "options", ";", "const", "fieldJSONError", "=", "responseJSON", ".", "fieldErrors", "||", "{", "}", ";", "let", "fieldErrors", "=", "{", "}", ";", "if", "(", "isArray", "(", "node", ")", ")", "{", "node", ".", "forEach", "(", "(", "nd", ")", "=>", "{", "fieldErrors", "[", "nd", "]", "=", "_treatEntityDetail", "(", "fieldJSONError", "[", "nd", "]", ")", ";", "}", ")", ";", "}", "else", "{", "fieldErrors", "=", "_treatEntityDetail", "(", "fieldJSONError", ")", ";", "}", "return", "fieldErrors", ";", "}" ]
Treat the response json of an error. @param {object} responseJSON The json response from the server. @param {object} options The options containing the model. {model: Backbone.Model} @return {object} The constructed object from the error response.
[ "Treat", "the", "response", "json", "of", "an", "error", "." ]
6ce70638e0c5acdd25830a14ce3b154f84a17405
https://github.com/KleeGroup/focus-core/blob/6ce70638e0c5acdd25830a14ce3b154f84a17405/src/network/error-parsing.js#L158-L169
28,215
KleeGroup/focus-core
src/network/error-parsing.js
_treatBadRequestExceptions
function _treatBadRequestExceptions(responseJSON = {}, options) { responseJSON.type = responseJSON.type || errorTypes.entity; if (responseJSON.type !== undefined) { switch (responseJSON.type) { case errorTypes.entity: return _treatEntityExceptions(responseJSON, options); case errorTypes.collection: return _treatCollectionExceptions(responseJSON, options); default: break; } } return null; }
javascript
function _treatBadRequestExceptions(responseJSON = {}, options) { responseJSON.type = responseJSON.type || errorTypes.entity; if (responseJSON.type !== undefined) { switch (responseJSON.type) { case errorTypes.entity: return _treatEntityExceptions(responseJSON, options); case errorTypes.collection: return _treatCollectionExceptions(responseJSON, options); default: break; } } return null; }
[ "function", "_treatBadRequestExceptions", "(", "responseJSON", "=", "{", "}", ",", "options", ")", "{", "responseJSON", ".", "type", "=", "responseJSON", ".", "type", "||", "errorTypes", ".", "entity", ";", "if", "(", "responseJSON", ".", "type", "!==", "undefined", ")", "{", "switch", "(", "responseJSON", ".", "type", ")", "{", "case", "errorTypes", ".", "entity", ":", "return", "_treatEntityExceptions", "(", "responseJSON", ",", "options", ")", ";", "case", "errorTypes", ".", "collection", ":", "return", "_treatCollectionExceptions", "(", "responseJSON", ",", "options", ")", ";", "default", ":", "break", ";", "}", "}", "return", "null", ";", "}" ]
Treat with all the custom exception @param {object} responseJSON - Response from the server. @param {object} options - Options for the exceptions teratement such as the {model: modelVar}. @return {object} - The parsed error response.
[ "Treat", "with", "all", "the", "custom", "exception" ]
6ce70638e0c5acdd25830a14ce3b154f84a17405
https://github.com/KleeGroup/focus-core/blob/6ce70638e0c5acdd25830a14ce3b154f84a17405/src/network/error-parsing.js#L186-L199
28,216
KleeGroup/focus-core
src/network/error-parsing.js
manageResponseErrors
function manageResponseErrors(responseErrors, options) { return { globals: _treatGlobalErrors(responseErrors), fields: _handleStatusError(responseErrors, options) }; }
javascript
function manageResponseErrors(responseErrors, options) { return { globals: _treatGlobalErrors(responseErrors), fields: _handleStatusError(responseErrors, options) }; }
[ "function", "manageResponseErrors", "(", "responseErrors", ",", "options", ")", "{", "return", "{", "globals", ":", "_treatGlobalErrors", "(", "responseErrors", ")", ",", "fields", ":", "_handleStatusError", "(", "responseErrors", ",", "options", ")", "}", ";", "}" ]
Transform errors send by API to application errors. Dispatch depending on the response http code. @param {object} responseErrors Errors from fetch call @param {object} options Options for the exceptions teratement such as the model, {model: modelVar}. @return {object} The parsed error response.
[ "Transform", "errors", "send", "by", "API", "to", "application", "errors", ".", "Dispatch", "depending", "on", "the", "response", "http", "code", "." ]
6ce70638e0c5acdd25830a14ce3b154f84a17405
https://github.com/KleeGroup/focus-core/blob/6ce70638e0c5acdd25830a14ce3b154f84a17405/src/network/error-parsing.js#L226-L232
28,217
KleeGroup/focus-core
src/definition/entity/container.js
getEntityConfiguration
function getEntityConfiguration(nodePath, extendedEntityConfiguration) { //If a node is specified get the direct sub conf. if (nodePath) { return _getNode(nodePath, extendedEntityConfiguration).toJS(); } return entitiesMap.toJS(); }
javascript
function getEntityConfiguration(nodePath, extendedEntityConfiguration) { //If a node is specified get the direct sub conf. if (nodePath) { return _getNode(nodePath, extendedEntityConfiguration).toJS(); } return entitiesMap.toJS(); }
[ "function", "getEntityConfiguration", "(", "nodePath", ",", "extendedEntityConfiguration", ")", "{", "//If a node is specified get the direct sub conf.", "if", "(", "nodePath", ")", "{", "return", "_getNode", "(", "nodePath", ",", "extendedEntityConfiguration", ")", ".", "toJS", "(", ")", ";", "}", "return", "entitiesMap", ".", "toJS", "(", ")", ";", "}" ]
Get all entityDefinition in a JS Structure. @param {string} - The node path (with .). @param {object} extendedEntityConfiguration - The object to extend the config. @return {object} - The entity configuration from a given path.
[ "Get", "all", "entityDefinition", "in", "a", "JS", "Structure", "." ]
6ce70638e0c5acdd25830a14ce3b154f84a17405
https://github.com/KleeGroup/focus-core/blob/6ce70638e0c5acdd25830a14ce3b154f84a17405/src/definition/entity/container.js#L24-L30
28,218
KleeGroup/focus-core
src/definition/entity/container.js
_getNode
function _getNode(nodePath, extendedConfiguration) { checkIsString('nodePath', nodePath); if (!entitiesMap.hasIn(nodePath.split(SEPARATOR))) { console.warn(` It seems the definition your are trying to use does not exists in the entity definitions of your project. The definition you want is ${nodePath} and the definition map is: `, entitiesMap.toJS() ); throw new Error('Wrong definition path given, see waning for more details'); } let conf = entitiesMap.getIn(nodePath.split(SEPARATOR)); if (extendedConfiguration) { checkIsObject(extendedConfiguration); conf = conf.mergeDeep(extendedConfiguration); } return conf; }
javascript
function _getNode(nodePath, extendedConfiguration) { checkIsString('nodePath', nodePath); if (!entitiesMap.hasIn(nodePath.split(SEPARATOR))) { console.warn(` It seems the definition your are trying to use does not exists in the entity definitions of your project. The definition you want is ${nodePath} and the definition map is: `, entitiesMap.toJS() ); throw new Error('Wrong definition path given, see waning for more details'); } let conf = entitiesMap.getIn(nodePath.split(SEPARATOR)); if (extendedConfiguration) { checkIsObject(extendedConfiguration); conf = conf.mergeDeep(extendedConfiguration); } return conf; }
[ "function", "_getNode", "(", "nodePath", ",", "extendedConfiguration", ")", "{", "checkIsString", "(", "'nodePath'", ",", "nodePath", ")", ";", "if", "(", "!", "entitiesMap", ".", "hasIn", "(", "nodePath", ".", "split", "(", "SEPARATOR", ")", ")", ")", "{", "console", ".", "warn", "(", "`", "${", "nodePath", "}", "`", ",", "entitiesMap", ".", "toJS", "(", ")", ")", ";", "throw", "new", "Error", "(", "'Wrong definition path given, see waning for more details'", ")", ";", "}", "let", "conf", "=", "entitiesMap", ".", "getIn", "(", "nodePath", ".", "split", "(", "SEPARATOR", ")", ")", ";", "if", "(", "extendedConfiguration", ")", "{", "checkIsObject", "(", "extendedConfiguration", ")", ";", "conf", "=", "conf", ".", "mergeDeep", "(", "extendedConfiguration", ")", ";", "}", "return", "conf", ";", "}" ]
Get a node configuration given a node path "obj.prop.subProp". @param {string} nodePath - The node path you want to get. @param {object} extendedConfiguration - The object to extend the config. @return {object} - The node configuration.
[ "Get", "a", "node", "configuration", "given", "a", "node", "path", "obj", ".", "prop", ".", "subProp", "." ]
6ce70638e0c5acdd25830a14ce3b154f84a17405
https://github.com/KleeGroup/focus-core/blob/6ce70638e0c5acdd25830a14ce3b154f84a17405/src/definition/entity/container.js#L48-L64
28,219
eXigentCoder/krpc-node
lib/encoders.js
encodeEnum
function encodeEnum(enumDefinition) { /** * Takes in a string value and using the provided enum definition encodes it as a `sInt` stored in a [ByteBuffer]{@link https://www.npmjs.com/package/bytebuffer} object for use with the protobufjs library. * @param value - The value to encode. * @throws {Error} If the provided value was not found in the enum definition * @return {ByteBuffer|void} */ return function encodeValueBasedOnEnum(value) { let buffer = new ByteBuffer(); if (value === null) { return buffer; } let foundEnumVal; Object.keys(enumDefinition).some(function(key) { let enumValue = enumDefinition[key].toLowerCase(); if (enumValue === value.toLowerCase()) { foundEnumVal = Number(key); return true; } return false; }); if (!Number.isInteger(foundEnumVal)) { throw Error( `Invalid enum value ${value}, should have been one of ${JSON.stringify( enumDefinition )}` ); } return encodeSInt32(foundEnumVal); }; }
javascript
function encodeEnum(enumDefinition) { /** * Takes in a string value and using the provided enum definition encodes it as a `sInt` stored in a [ByteBuffer]{@link https://www.npmjs.com/package/bytebuffer} object for use with the protobufjs library. * @param value - The value to encode. * @throws {Error} If the provided value was not found in the enum definition * @return {ByteBuffer|void} */ return function encodeValueBasedOnEnum(value) { let buffer = new ByteBuffer(); if (value === null) { return buffer; } let foundEnumVal; Object.keys(enumDefinition).some(function(key) { let enumValue = enumDefinition[key].toLowerCase(); if (enumValue === value.toLowerCase()) { foundEnumVal = Number(key); return true; } return false; }); if (!Number.isInteger(foundEnumVal)) { throw Error( `Invalid enum value ${value}, should have been one of ${JSON.stringify( enumDefinition )}` ); } return encodeSInt32(foundEnumVal); }; }
[ "function", "encodeEnum", "(", "enumDefinition", ")", "{", "/**\n * Takes in a string value and using the provided enum definition encodes it as a `sInt` stored in a [ByteBuffer]{@link https://www.npmjs.com/package/bytebuffer} object for use with the protobufjs library.\n * @param value - The value to encode.\n * @throws {Error} If the provided value was not found in the enum definition\n * @return {ByteBuffer|void}\n */", "return", "function", "encodeValueBasedOnEnum", "(", "value", ")", "{", "let", "buffer", "=", "new", "ByteBuffer", "(", ")", ";", "if", "(", "value", "===", "null", ")", "{", "return", "buffer", ";", "}", "let", "foundEnumVal", ";", "Object", ".", "keys", "(", "enumDefinition", ")", ".", "some", "(", "function", "(", "key", ")", "{", "let", "enumValue", "=", "enumDefinition", "[", "key", "]", ".", "toLowerCase", "(", ")", ";", "if", "(", "enumValue", "===", "value", ".", "toLowerCase", "(", ")", ")", "{", "foundEnumVal", "=", "Number", "(", "key", ")", ";", "return", "true", ";", "}", "return", "false", ";", "}", ")", ";", "if", "(", "!", "Number", ".", "isInteger", "(", "foundEnumVal", ")", ")", "{", "throw", "Error", "(", "`", "${", "value", "}", "${", "JSON", ".", "stringify", "(", "enumDefinition", ")", "}", "`", ")", ";", "}", "return", "encodeSInt32", "(", "foundEnumVal", ")", ";", "}", ";", "}" ]
Returns a function that can be used to encode a string as the specific enum value. @param {object} enumDefinition - The key-value enum object. Keys should be numbers, values should be strings. @return {Function} The [function](#encodeValueBasedOnEnum) that will do the encoding.
[ "Returns", "a", "function", "that", "can", "be", "used", "to", "encode", "a", "string", "as", "the", "specific", "enum", "value", "." ]
ebad306bd756d6bf78b5d6fd9deee503287667fa
https://github.com/eXigentCoder/krpc-node/blob/ebad306bd756d6bf78b5d6fd9deee503287667fa/lib/encoders.js#L130-L160
28,220
KleeGroup/focus-core
src/util/function/rename.js
renameFunction
function renameFunction(func, newName) { // eslint-disable-next-line no-unused-vars const prop = Object.getOwnPropertyDescriptor(func, 'name'); if (prop) { const { value, ...others } = prop; Object.defineProperty(func, 'name', { value: newName, ...others }); } }
javascript
function renameFunction(func, newName) { // eslint-disable-next-line no-unused-vars const prop = Object.getOwnPropertyDescriptor(func, 'name'); if (prop) { const { value, ...others } = prop; Object.defineProperty(func, 'name', { value: newName, ...others }); } }
[ "function", "renameFunction", "(", "func", ",", "newName", ")", "{", "// eslint-disable-next-line no-unused-vars", "const", "prop", "=", "Object", ".", "getOwnPropertyDescriptor", "(", "func", ",", "'name'", ")", ";", "if", "(", "prop", ")", "{", "const", "{", "value", ",", "...", "others", "}", "=", "prop", ";", "Object", ".", "defineProperty", "(", "func", ",", "'name'", ",", "{", "value", ":", "newName", ",", "...", "others", "}", ")", ";", "}", "}" ]
Rename a function to a new name, for call stack and debugging @param {Function} func the function to rename @param {String} newName the new name
[ "Rename", "a", "function", "to", "a", "new", "name", "for", "call", "stack", "and", "debugging" ]
6ce70638e0c5acdd25830a14ce3b154f84a17405
https://github.com/KleeGroup/focus-core/blob/6ce70638e0c5acdd25830a14ce3b154f84a17405/src/util/function/rename.js#L9-L16
28,221
eXigentCoder/krpc-node
lib/client.js
addStream
async function addStream(call, propertyPath, addStreamCallback) { return _addStream(client, call, propertyPath, addStreamCallback); }
javascript
async function addStream(call, propertyPath, addStreamCallback) { return _addStream(client, call, propertyPath, addStreamCallback); }
[ "async", "function", "addStream", "(", "call", ",", "propertyPath", ",", "addStreamCallback", ")", "{", "return", "_addStream", "(", "client", ",", "call", ",", "propertyPath", ",", "addStreamCallback", ")", ";", "}" ]
This callback that is called after attempting to add a call to the stream @callback addStreamCallback @param {null|Error} error Lets the caller know if there was an error adding the call to the stream @param {stream} The stream that was added Adds an call to the continuous update stream. @name addStream @param {procedureCall} procedureCall The call to add to the stream @param {string} propertyPath A unique name to represent the call @param {addStreamCallback} [callback] the callback function to execute when the operation has ended @returns {Promise.<stream>} The stream that was added
[ "This", "callback", "that", "is", "called", "after", "attempting", "to", "add", "a", "call", "to", "the", "stream" ]
ebad306bd756d6bf78b5d6fd9deee503287667fa
https://github.com/eXigentCoder/krpc-node/blob/ebad306bd756d6bf78b5d6fd9deee503287667fa/lib/client.js#L223-L225
28,222
eXigentCoder/krpc-node
lib/client.js
close
async function close(callback) { await closeStream(client.stream); await closeStream(client.rpc); if (callback) { return callback(); } }
javascript
async function close(callback) { await closeStream(client.stream); await closeStream(client.rpc); if (callback) { return callback(); } }
[ "async", "function", "close", "(", "callback", ")", "{", "await", "closeStream", "(", "client", ".", "stream", ")", ";", "await", "closeStream", "(", "client", ".", "rpc", ")", ";", "if", "(", "callback", ")", "{", "return", "callback", "(", ")", ";", "}", "}" ]
Closes both the stream and rpc socket connection to the server. Should be called to free up resources and end the event loop. @name close @param {function} [callback] The callback to execute after closing. @returns {Promise.<void>}
[ "Closes", "both", "the", "stream", "and", "rpc", "socket", "connection", "to", "the", "server", ".", "Should", "be", "called", "to", "free", "up", "resources", "and", "end", "the", "event", "loop", "." ]
ebad306bd756d6bf78b5d6fd9deee503287667fa
https://github.com/eXigentCoder/krpc-node/blob/ebad306bd756d6bf78b5d6fd9deee503287667fa/lib/client.js#L247-L253
28,223
KleeGroup/focus-core
src/store/reference/definition.js
buildReferenceDefinition
function buildReferenceDefinition() { //Read the current configuration in the reference config. let referenceConf = refConfigAccessor.get(); //Warn the user if empty. if (!referenceConf || isEmpty(referenceConf)) { console.warn('You did not set any reference list in the reference configuration, see Focus.reference.config.set.'); } //Build an object from the keys. return Object.keys(referenceConf).reduce((acc, elt) => { acc[elt] = elt; return acc; }, {}); }
javascript
function buildReferenceDefinition() { //Read the current configuration in the reference config. let referenceConf = refConfigAccessor.get(); //Warn the user if empty. if (!referenceConf || isEmpty(referenceConf)) { console.warn('You did not set any reference list in the reference configuration, see Focus.reference.config.set.'); } //Build an object from the keys. return Object.keys(referenceConf).reduce((acc, elt) => { acc[elt] = elt; return acc; }, {}); }
[ "function", "buildReferenceDefinition", "(", ")", "{", "//Read the current configuration in the reference config.", "let", "referenceConf", "=", "refConfigAccessor", ".", "get", "(", ")", ";", "//Warn the user if empty.", "if", "(", "!", "referenceConf", "||", "isEmpty", "(", "referenceConf", ")", ")", "{", "console", ".", "warn", "(", "'You did not set any reference list in the reference configuration, see Focus.reference.config.set.'", ")", ";", "}", "//Build an object from the keys.", "return", "Object", ".", "keys", "(", "referenceConf", ")", ".", "reduce", "(", "(", "acc", ",", "elt", ")", "=>", "{", "acc", "[", "elt", "]", "=", "elt", ";", "return", "acc", ";", "}", ",", "{", "}", ")", ";", "}" ]
Build the reference definition from the keys registered into the definitions. @returns {object} - The reference definition.
[ "Build", "the", "reference", "definition", "from", "the", "keys", "registered", "into", "the", "definitions", "." ]
6ce70638e0c5acdd25830a14ce3b154f84a17405
https://github.com/KleeGroup/focus-core/blob/6ce70638e0c5acdd25830a14ce3b154f84a17405/src/store/reference/definition.js#L8-L20
28,224
KleeGroup/focus-core
src/definition/entity/builder.js
_buildFieldInformation
function _buildFieldInformation(fieldPath) { const fieldConf = entityContainer.getFieldConfiguration(fieldPath); const immutableFieldConf = Immutable.Map(fieldConf); //Maybe add a domain check existance let { domain } = fieldConf; return domainContainer.get(domain).mergeDeep(immutableFieldConf); }
javascript
function _buildFieldInformation(fieldPath) { const fieldConf = entityContainer.getFieldConfiguration(fieldPath); const immutableFieldConf = Immutable.Map(fieldConf); //Maybe add a domain check existance let { domain } = fieldConf; return domainContainer.get(domain).mergeDeep(immutableFieldConf); }
[ "function", "_buildFieldInformation", "(", "fieldPath", ")", "{", "const", "fieldConf", "=", "entityContainer", ".", "getFieldConfiguration", "(", "fieldPath", ")", ";", "const", "immutableFieldConf", "=", "Immutable", ".", "Map", "(", "fieldConf", ")", ";", "//Maybe add a domain check existance", "let", "{", "domain", "}", "=", "fieldConf", ";", "return", "domainContainer", ".", "get", "(", "domain", ")", ".", "mergeDeep", "(", "immutableFieldConf", ")", ";", "}" ]
Build the field informations. @param {string} fieldPath - The field path. @return {Immutable.Map} - The immutable field description.
[ "Build", "the", "field", "informations", "." ]
6ce70638e0c5acdd25830a14ce3b154f84a17405
https://github.com/KleeGroup/focus-core/blob/6ce70638e0c5acdd25830a14ce3b154f84a17405/src/definition/entity/builder.js#L49-L55
28,225
KleeGroup/focus-core
src/definition/entity/builder.js
getEntityInformations
function getEntityInformations(entityName, complementaryInformation) { checkIsString('entityName', entityName); checkIsObject('complementaryInformation', complementaryInformation); const key = entityName.split(SEPARATOR); if (!computedEntityContainer.hasIn(key)) { _buildEntityInformation(entityName); } return computedEntityContainer.get(entityName).mergeDeep(complementaryInformation).toJS(); }
javascript
function getEntityInformations(entityName, complementaryInformation) { checkIsString('entityName', entityName); checkIsObject('complementaryInformation', complementaryInformation); const key = entityName.split(SEPARATOR); if (!computedEntityContainer.hasIn(key)) { _buildEntityInformation(entityName); } return computedEntityContainer.get(entityName).mergeDeep(complementaryInformation).toJS(); }
[ "function", "getEntityInformations", "(", "entityName", ",", "complementaryInformation", ")", "{", "checkIsString", "(", "'entityName'", ",", "entityName", ")", ";", "checkIsObject", "(", "'complementaryInformation'", ",", "complementaryInformation", ")", ";", "const", "key", "=", "entityName", ".", "split", "(", "SEPARATOR", ")", ";", "if", "(", "!", "computedEntityContainer", ".", "hasIn", "(", "key", ")", ")", "{", "_buildEntityInformation", "(", "entityName", ")", ";", "}", "return", "computedEntityContainer", ".", "get", "(", "entityName", ")", ".", "mergeDeep", "(", "complementaryInformation", ")", ".", "toJS", "(", ")", ";", "}" ]
Get the entity information from the entity name and given the extended informations. @param {string} entityName - The name of the entity. @param {object} complementaryInformation - Additional information on the entity. @return {object} - The entity informations from the entity name.
[ "Get", "the", "entity", "information", "from", "the", "entity", "name", "and", "given", "the", "extended", "informations", "." ]
6ce70638e0c5acdd25830a14ce3b154f84a17405
https://github.com/KleeGroup/focus-core/blob/6ce70638e0c5acdd25830a14ce3b154f84a17405/src/definition/entity/builder.js#L63-L71
28,226
KleeGroup/focus-core
src/definition/entity/builder.js
getFieldInformations
function getFieldInformations(fieldName, complementaryInformation) { checkIsString('fieldName', fieldName); checkIsObject('complementaryInformation', complementaryInformation); const fieldPath = fieldName.split(SEPARATOR); if (computedEntityContainer.hasIn(fieldPath)) { return computedEntityContainer.getIn(fieldPath).toJS(); } return _buildFieldInformation(fieldPath).mergeDeep(complementaryInformation).toJS(); }
javascript
function getFieldInformations(fieldName, complementaryInformation) { checkIsString('fieldName', fieldName); checkIsObject('complementaryInformation', complementaryInformation); const fieldPath = fieldName.split(SEPARATOR); if (computedEntityContainer.hasIn(fieldPath)) { return computedEntityContainer.getIn(fieldPath).toJS(); } return _buildFieldInformation(fieldPath).mergeDeep(complementaryInformation).toJS(); }
[ "function", "getFieldInformations", "(", "fieldName", ",", "complementaryInformation", ")", "{", "checkIsString", "(", "'fieldName'", ",", "fieldName", ")", ";", "checkIsObject", "(", "'complementaryInformation'", ",", "complementaryInformation", ")", ";", "const", "fieldPath", "=", "fieldName", ".", "split", "(", "SEPARATOR", ")", ";", "if", "(", "computedEntityContainer", ".", "hasIn", "(", "fieldPath", ")", ")", "{", "return", "computedEntityContainer", ".", "getIn", "(", "fieldPath", ")", ".", "toJS", "(", ")", ";", "}", "return", "_buildFieldInformation", "(", "fieldPath", ")", ".", "mergeDeep", "(", "complementaryInformation", ")", ".", "toJS", "(", ")", ";", "}" ]
Get the field informations. @param {string} fieldName - name or path of the field. @param {object} complementaryInformation - Additional informations to extend the domain informations. @return {object} - The builded field informations.
[ "Get", "the", "field", "informations", "." ]
6ce70638e0c5acdd25830a14ce3b154f84a17405
https://github.com/KleeGroup/focus-core/blob/6ce70638e0c5acdd25830a14ce3b154f84a17405/src/definition/entity/builder.js#L79-L87
28,227
christianalfoni/flux-react
gulpfile.js
function (options) { // This bundle is for our application var bundler = browserify({ debug: options.debug, // Need that sourcemapping standalone: 'flux-react', // These options are just for Watchify cache: {}, packageCache: {}, fullPaths: options.watch }) .require(require.resolve('./src/main.js'), { entry: true }) .external('react'); // The actual rebundle process var rebundle = function () { var start = Date.now(); bundler.bundle() .on('error', gutil.log) .pipe(source(options.name)) .pipe(gulpif(options.uglify, streamify(uglify()))) .pipe(gulp.dest(options.dest)) .pipe(notify(function () { // Fix for requirejs var fs = require('fs'); var file = fs.readFileSync(options.dest + '/' + options.name).toString(); file = file.replace('define([],e)', 'define(["react"],e)'); fs.writeFileSync(options.dest + '/' + options.name, file); console.log('Built in ' + (Date.now() - start) + 'ms'); })); }; // Fire up Watchify when developing if (options.watch) { bundler = watchify(bundler); bundler.on('update', rebundle); } return rebundle(); }
javascript
function (options) { // This bundle is for our application var bundler = browserify({ debug: options.debug, // Need that sourcemapping standalone: 'flux-react', // These options are just for Watchify cache: {}, packageCache: {}, fullPaths: options.watch }) .require(require.resolve('./src/main.js'), { entry: true }) .external('react'); // The actual rebundle process var rebundle = function () { var start = Date.now(); bundler.bundle() .on('error', gutil.log) .pipe(source(options.name)) .pipe(gulpif(options.uglify, streamify(uglify()))) .pipe(gulp.dest(options.dest)) .pipe(notify(function () { // Fix for requirejs var fs = require('fs'); var file = fs.readFileSync(options.dest + '/' + options.name).toString(); file = file.replace('define([],e)', 'define(["react"],e)'); fs.writeFileSync(options.dest + '/' + options.name, file); console.log('Built in ' + (Date.now() - start) + 'ms'); })); }; // Fire up Watchify when developing if (options.watch) { bundler = watchify(bundler); bundler.on('update', rebundle); } return rebundle(); }
[ "function", "(", "options", ")", "{", "// This bundle is for our application", "var", "bundler", "=", "browserify", "(", "{", "debug", ":", "options", ".", "debug", ",", "// Need that sourcemapping", "standalone", ":", "'flux-react'", ",", "// These options are just for Watchify", "cache", ":", "{", "}", ",", "packageCache", ":", "{", "}", ",", "fullPaths", ":", "options", ".", "watch", "}", ")", ".", "require", "(", "require", ".", "resolve", "(", "'./src/main.js'", ")", ",", "{", "entry", ":", "true", "}", ")", ".", "external", "(", "'react'", ")", ";", "// The actual rebundle process", "var", "rebundle", "=", "function", "(", ")", "{", "var", "start", "=", "Date", ".", "now", "(", ")", ";", "bundler", ".", "bundle", "(", ")", ".", "on", "(", "'error'", ",", "gutil", ".", "log", ")", ".", "pipe", "(", "source", "(", "options", ".", "name", ")", ")", ".", "pipe", "(", "gulpif", "(", "options", ".", "uglify", ",", "streamify", "(", "uglify", "(", ")", ")", ")", ")", ".", "pipe", "(", "gulp", ".", "dest", "(", "options", ".", "dest", ")", ")", ".", "pipe", "(", "notify", "(", "function", "(", ")", "{", "// Fix for requirejs", "var", "fs", "=", "require", "(", "'fs'", ")", ";", "var", "file", "=", "fs", ".", "readFileSync", "(", "options", ".", "dest", "+", "'/'", "+", "options", ".", "name", ")", ".", "toString", "(", ")", ";", "file", "=", "file", ".", "replace", "(", "'define([],e)'", ",", "'define([\"react\"],e)'", ")", ";", "fs", ".", "writeFileSync", "(", "options", ".", "dest", "+", "'/'", "+", "options", ".", "name", ",", "file", ")", ";", "console", ".", "log", "(", "'Built in '", "+", "(", "Date", ".", "now", "(", ")", "-", "start", ")", "+", "'ms'", ")", ";", "}", ")", ")", ";", "}", ";", "// Fire up Watchify when developing", "if", "(", "options", ".", "watch", ")", "{", "bundler", "=", "watchify", "(", "bundler", ")", ";", "bundler", ".", "on", "(", "'update'", ",", "rebundle", ")", ";", "}", "return", "rebundle", "(", ")", ";", "}" ]
The task that handles both development and deployment
[ "The", "task", "that", "handles", "both", "development", "and", "deployment" ]
17e120ec53734fe86e9a19a79e4f18bd3c6773b6
https://github.com/christianalfoni/flux-react/blob/17e120ec53734fe86e9a19a79e4f18bd3c6773b6/gulpfile.js#L14-L56
28,228
christianalfoni/flux-react
gulpfile.js
function () { var start = Date.now(); bundler.bundle() .on('error', gutil.log) .pipe(source(options.name)) .pipe(gulpif(options.uglify, streamify(uglify()))) .pipe(gulp.dest(options.dest)) .pipe(notify(function () { // Fix for requirejs var fs = require('fs'); var file = fs.readFileSync(options.dest + '/' + options.name).toString(); file = file.replace('define([],e)', 'define(["react"],e)'); fs.writeFileSync(options.dest + '/' + options.name, file); console.log('Built in ' + (Date.now() - start) + 'ms'); })); }
javascript
function () { var start = Date.now(); bundler.bundle() .on('error', gutil.log) .pipe(source(options.name)) .pipe(gulpif(options.uglify, streamify(uglify()))) .pipe(gulp.dest(options.dest)) .pipe(notify(function () { // Fix for requirejs var fs = require('fs'); var file = fs.readFileSync(options.dest + '/' + options.name).toString(); file = file.replace('define([],e)', 'define(["react"],e)'); fs.writeFileSync(options.dest + '/' + options.name, file); console.log('Built in ' + (Date.now() - start) + 'ms'); })); }
[ "function", "(", ")", "{", "var", "start", "=", "Date", ".", "now", "(", ")", ";", "bundler", ".", "bundle", "(", ")", ".", "on", "(", "'error'", ",", "gutil", ".", "log", ")", ".", "pipe", "(", "source", "(", "options", ".", "name", ")", ")", ".", "pipe", "(", "gulpif", "(", "options", ".", "uglify", ",", "streamify", "(", "uglify", "(", ")", ")", ")", ")", ".", "pipe", "(", "gulp", ".", "dest", "(", "options", ".", "dest", ")", ")", ".", "pipe", "(", "notify", "(", "function", "(", ")", "{", "// Fix for requirejs", "var", "fs", "=", "require", "(", "'fs'", ")", ";", "var", "file", "=", "fs", ".", "readFileSync", "(", "options", ".", "dest", "+", "'/'", "+", "options", ".", "name", ")", ".", "toString", "(", ")", ";", "file", "=", "file", ".", "replace", "(", "'define([],e)'", ",", "'define([\"react\"],e)'", ")", ";", "fs", ".", "writeFileSync", "(", "options", ".", "dest", "+", "'/'", "+", "options", ".", "name", ",", "file", ")", ";", "console", ".", "log", "(", "'Built in '", "+", "(", "Date", ".", "now", "(", ")", "-", "start", ")", "+", "'ms'", ")", ";", "}", ")", ")", ";", "}" ]
The actual rebundle process
[ "The", "actual", "rebundle", "process" ]
17e120ec53734fe86e9a19a79e4f18bd3c6773b6
https://github.com/christianalfoni/flux-react/blob/17e120ec53734fe86e9a19a79e4f18bd3c6773b6/gulpfile.js#L27-L46
28,229
voidqk/polybooljs
lib/segment-selector.js
select
function select(segments, selection, buildLog){ var result = []; segments.forEach(function(seg){ var index = (seg.myFill.above ? 8 : 0) + (seg.myFill.below ? 4 : 0) + ((seg.otherFill && seg.otherFill.above) ? 2 : 0) + ((seg.otherFill && seg.otherFill.below) ? 1 : 0); if (selection[index] !== 0){ // copy the segment to the results, while also calculating the fill status result.push({ id: buildLog ? buildLog.segmentId() : -1, start: seg.start, end: seg.end, myFill: { above: selection[index] === 1, // 1 if filled above below: selection[index] === 2 // 2 if filled below }, otherFill: null }); } }); if (buildLog) buildLog.selected(result); return result; }
javascript
function select(segments, selection, buildLog){ var result = []; segments.forEach(function(seg){ var index = (seg.myFill.above ? 8 : 0) + (seg.myFill.below ? 4 : 0) + ((seg.otherFill && seg.otherFill.above) ? 2 : 0) + ((seg.otherFill && seg.otherFill.below) ? 1 : 0); if (selection[index] !== 0){ // copy the segment to the results, while also calculating the fill status result.push({ id: buildLog ? buildLog.segmentId() : -1, start: seg.start, end: seg.end, myFill: { above: selection[index] === 1, // 1 if filled above below: selection[index] === 2 // 2 if filled below }, otherFill: null }); } }); if (buildLog) buildLog.selected(result); return result; }
[ "function", "select", "(", "segments", ",", "selection", ",", "buildLog", ")", "{", "var", "result", "=", "[", "]", ";", "segments", ".", "forEach", "(", "function", "(", "seg", ")", "{", "var", "index", "=", "(", "seg", ".", "myFill", ".", "above", "?", "8", ":", "0", ")", "+", "(", "seg", ".", "myFill", ".", "below", "?", "4", ":", "0", ")", "+", "(", "(", "seg", ".", "otherFill", "&&", "seg", ".", "otherFill", ".", "above", ")", "?", "2", ":", "0", ")", "+", "(", "(", "seg", ".", "otherFill", "&&", "seg", ".", "otherFill", ".", "below", ")", "?", "1", ":", "0", ")", ";", "if", "(", "selection", "[", "index", "]", "!==", "0", ")", "{", "// copy the segment to the results, while also calculating the fill status", "result", ".", "push", "(", "{", "id", ":", "buildLog", "?", "buildLog", ".", "segmentId", "(", ")", ":", "-", "1", ",", "start", ":", "seg", ".", "start", ",", "end", ":", "seg", ".", "end", ",", "myFill", ":", "{", "above", ":", "selection", "[", "index", "]", "===", "1", ",", "// 1 if filled above", "below", ":", "selection", "[", "index", "]", "===", "2", "// 2 if filled below", "}", ",", "otherFill", ":", "null", "}", ")", ";", "}", "}", ")", ";", "if", "(", "buildLog", ")", "buildLog", ".", "selected", "(", "result", ")", ";", "return", "result", ";", "}" ]
filter a list of segments based on boolean operations
[ "filter", "a", "list", "of", "segments", "based", "on", "boolean", "operations" ]
7d12dd3368e5fb3a1a9d2b84a964962cc8ba71b1
https://github.com/voidqk/polybooljs/blob/7d12dd3368e5fb3a1a9d2b84a964962cc8ba71b1/lib/segment-selector.js#L9-L36
28,230
dowjones/react-cellblock
example/modules/Nav.js
split
function split(arr, size) { var out = []; var sizes = []; var where = size - 1; var ptr = 0; var i, j; for (i = arr.length - 1; i >= 0; i--) { sizes[where] = (sizes[where] || 0) + 1; if (--where === -1) where = size - 1; } for (i = 0; i < size; i++) { for (j = 0; j < sizes[i]; j++) { if (j === 0) out[i] = [arr[ptr]]; else out[i].push(arr[ptr]); ptr++; } } return out; }
javascript
function split(arr, size) { var out = []; var sizes = []; var where = size - 1; var ptr = 0; var i, j; for (i = arr.length - 1; i >= 0; i--) { sizes[where] = (sizes[where] || 0) + 1; if (--where === -1) where = size - 1; } for (i = 0; i < size; i++) { for (j = 0; j < sizes[i]; j++) { if (j === 0) out[i] = [arr[ptr]]; else out[i].push(arr[ptr]); ptr++; } } return out; }
[ "function", "split", "(", "arr", ",", "size", ")", "{", "var", "out", "=", "[", "]", ";", "var", "sizes", "=", "[", "]", ";", "var", "where", "=", "size", "-", "1", ";", "var", "ptr", "=", "0", ";", "var", "i", ",", "j", ";", "for", "(", "i", "=", "arr", ".", "length", "-", "1", ";", "i", ">=", "0", ";", "i", "--", ")", "{", "sizes", "[", "where", "]", "=", "(", "sizes", "[", "where", "]", "||", "0", ")", "+", "1", ";", "if", "(", "--", "where", "===", "-", "1", ")", "where", "=", "size", "-", "1", ";", "}", "for", "(", "i", "=", "0", ";", "i", "<", "size", ";", "i", "++", ")", "{", "for", "(", "j", "=", "0", ";", "j", "<", "sizes", "[", "i", "]", ";", "j", "++", ")", "{", "if", "(", "j", "===", "0", ")", "out", "[", "i", "]", "=", "[", "arr", "[", "ptr", "]", "]", ";", "else", "out", "[", "i", "]", ".", "push", "(", "arr", "[", "ptr", "]", ")", ";", "ptr", "++", ";", "}", "}", "return", "out", ";", "}" ]
A function to arrange the buttons into a certain number of rows no matter the number
[ "A", "function", "to", "arrange", "the", "buttons", "into", "a", "certain", "number", "of", "rows", "no", "matter", "the", "number" ]
6a94199f5ef4309137686fa1827beb00bce13459
https://github.com/dowjones/react-cellblock/blob/6a94199f5ef4309137686fa1827beb00bce13459/example/modules/Nav.js#L37-L58
28,231
RMLio/yarrrml-parser
lib/normalize-rml.js
writeNormalizeRml
function writeNormalizeRml(store, writer) { normalizeRml(store, function () { let parsedBlankSubjects = {}; writeBlanks(store, parsedBlankSubjects); let quads = store.getQuads(); quads.forEach(function (quad) { if (parsedBlankSubjects[quad.subject]) { return; } if (parsedBlankSubjects[quad.object]) { writer.addQuad(quad.subject, quad.predicate, writer.blank(parsedBlankSubjects[quad.object])); return; } writer.addTriple(quad); }); }); }
javascript
function writeNormalizeRml(store, writer) { normalizeRml(store, function () { let parsedBlankSubjects = {}; writeBlanks(store, parsedBlankSubjects); let quads = store.getQuads(); quads.forEach(function (quad) { if (parsedBlankSubjects[quad.subject]) { return; } if (parsedBlankSubjects[quad.object]) { writer.addQuad(quad.subject, quad.predicate, writer.blank(parsedBlankSubjects[quad.object])); return; } writer.addTriple(quad); }); }); }
[ "function", "writeNormalizeRml", "(", "store", ",", "writer", ")", "{", "normalizeRml", "(", "store", ",", "function", "(", ")", "{", "let", "parsedBlankSubjects", "=", "{", "}", ";", "writeBlanks", "(", "store", ",", "parsedBlankSubjects", ")", ";", "let", "quads", "=", "store", ".", "getQuads", "(", ")", ";", "quads", ".", "forEach", "(", "function", "(", "quad", ")", "{", "if", "(", "parsedBlankSubjects", "[", "quad", ".", "subject", "]", ")", "{", "return", ";", "}", "if", "(", "parsedBlankSubjects", "[", "quad", ".", "object", "]", ")", "{", "writer", ".", "addQuad", "(", "quad", ".", "subject", ",", "quad", ".", "predicate", ",", "writer", ".", "blank", "(", "parsedBlankSubjects", "[", "quad", ".", "object", "]", ")", ")", ";", "return", ";", "}", "writer", ".", "addTriple", "(", "quad", ")", ";", "}", ")", ";", "}", ")", ";", "}" ]
normalize RML quads in the store, by modifying the existing store, and then write them semi-pretty using the writer. @param store N3.Store @param writer N3.Writer
[ "normalize", "RML", "quads", "in", "the", "store", "by", "modifying", "the", "existing", "store", "and", "then", "write", "them", "semi", "-", "pretty", "using", "the", "writer", "." ]
d8426127131649d0f7bd2708c73486b35ef261c7
https://github.com/RMLio/yarrrml-parser/blob/d8426127131649d0f7bd2708c73486b35ef261c7/lib/normalize-rml.js#L16-L32
28,232
skolmer/i18n-tag-schema
lib/logging.js
log
function log(logger, message, type) { if(!logger) return if(logger.toConsole) { if (console.group) console.group('i18n-tag-schema') const log = console[type] || console.log log(message) if (console.groupEnd) console.groupEnd() } else { const log = logger[type] if(log) log(message) } }
javascript
function log(logger, message, type) { if(!logger) return if(logger.toConsole) { if (console.group) console.group('i18n-tag-schema') const log = console[type] || console.log log(message) if (console.groupEnd) console.groupEnd() } else { const log = logger[type] if(log) log(message) } }
[ "function", "log", "(", "logger", ",", "message", ",", "type", ")", "{", "if", "(", "!", "logger", ")", "return", "if", "(", "logger", ".", "toConsole", ")", "{", "if", "(", "console", ".", "group", ")", "console", ".", "group", "(", "'i18n-tag-schema'", ")", "const", "log", "=", "console", "[", "type", "]", "||", "console", ".", "log", "log", "(", "message", ")", "if", "(", "console", ".", "groupEnd", ")", "console", ".", "groupEnd", "(", ")", "}", "else", "{", "const", "log", "=", "logger", "[", "type", "]", "if", "(", "log", ")", "log", "(", "message", ")", "}", "}" ]
Logging helper function @param {Object} logger - The logger object. @param {any} message - The message to log. @param {string} [type=log] - The type of the log function.
[ "Logging", "helper", "function" ]
bb403d09767e0cd900468c4dcf926ee1725c8627
https://github.com/skolmer/i18n-tag-schema/blob/bb403d09767e0cd900468c4dcf926ee1725c8627/lib/logging.js#L8-L19
28,233
bleupen/halacious
lib/representation.js
Representation
function Representation(factory, self, entity, root) { this._halacious = factory._halacious; this.factory = factory; this.request = factory._request; this._root = root || this; this.self = self.href; this._links = { self: self }; this._embedded = {}; this._namespaces = {}; this._props = {}; this._ignore = {}; this.entity = entity; }
javascript
function Representation(factory, self, entity, root) { this._halacious = factory._halacious; this.factory = factory; this.request = factory._request; this._root = root || this; this.self = self.href; this._links = { self: self }; this._embedded = {}; this._namespaces = {}; this._props = {}; this._ignore = {}; this.entity = entity; }
[ "function", "Representation", "(", "factory", ",", "self", ",", "entity", ",", "root", ")", "{", "this", ".", "_halacious", "=", "factory", ".", "_halacious", ";", "this", ".", "factory", "=", "factory", ";", "this", ".", "request", "=", "factory", ".", "_request", ";", "this", ".", "_root", "=", "root", "||", "this", ";", "this", ".", "self", "=", "self", ".", "href", ";", "this", ".", "_links", "=", "{", "self", ":", "self", "}", ";", "this", ".", "_embedded", "=", "{", "}", ";", "this", ".", "_namespaces", "=", "{", "}", ";", "this", ".", "_props", "=", "{", "}", ";", "this", ".", "_ignore", "=", "{", "}", ";", "this", ".", "entity", "=", "entity", ";", "}" ]
A HAL wrapper interface around an entity. Provides an api for adding new links and recursively embedding child entities. @param factory @param self @param entity @param root @constructor
[ "A", "HAL", "wrapper", "interface", "around", "an", "entity", ".", "Provides", "an", "api", "for", "adding", "new", "links", "and", "recursively", "embedding", "child", "entities", "." ]
91e4f8128d6ecd2a6de318536a91aeda6b95daa5
https://github.com/bleupen/halacious/blob/91e4f8128d6ecd2a6de318536a91aeda6b95daa5/lib/representation.js#L18-L30
28,234
robhil/grunt-protractor-cucumber-html-report
lib/html_formatter.js
toHtmlEntities
function toHtmlEntities(str) { str = str || ''; return str.replace(/./gm, function(s) { return "&#" + s.charCodeAt(0) + ";"; }); }
javascript
function toHtmlEntities(str) { str = str || ''; return str.replace(/./gm, function(s) { return "&#" + s.charCodeAt(0) + ";"; }); }
[ "function", "toHtmlEntities", "(", "str", ")", "{", "str", "=", "str", "||", "''", ";", "return", "str", ".", "replace", "(", "/", ".", "/", "gm", ",", "function", "(", "s", ")", "{", "return", "\"&#\"", "+", "s", ".", "charCodeAt", "(", "0", ")", "+", "\";\"", ";", "}", ")", ";", "}" ]
Convert html tags to html entites @param str @returns {XML|string|*|void}
[ "Convert", "html", "tags", "to", "html", "entites" ]
f8a73deb642c7bd97bc11da8c38656abadcd19cd
https://github.com/robhil/grunt-protractor-cucumber-html-report/blob/f8a73deb642c7bd97bc11da8c38656abadcd19cd/lib/html_formatter.js#L28-L33
28,235
robhil/grunt-protractor-cucumber-html-report
lib/html_formatter.js
isEmptyBeforeStep
function isEmptyBeforeStep(step) { return step.keyword.trim() === 'Before' && step.name === undefined && step.embeddings === undefined; }
javascript
function isEmptyBeforeStep(step) { return step.keyword.trim() === 'Before' && step.name === undefined && step.embeddings === undefined; }
[ "function", "isEmptyBeforeStep", "(", "step", ")", "{", "return", "step", ".", "keyword", ".", "trim", "(", ")", "===", "'Before'", "&&", "step", ".", "name", "===", "undefined", "&&", "step", ".", "embeddings", "===", "undefined", ";", "}" ]
Checks if the step is an empty Before step @param step - object which contains step data @returns boolean
[ "Checks", "if", "the", "step", "is", "an", "empty", "Before", "step" ]
f8a73deb642c7bd97bc11da8c38656abadcd19cd
https://github.com/robhil/grunt-protractor-cucumber-html-report/blob/f8a73deb642c7bd97bc11da8c38656abadcd19cd/lib/html_formatter.js#L40-L42
28,236
robhil/grunt-protractor-cucumber-html-report
lib/html_formatter.js
isEmptyAfterStep
function isEmptyAfterStep(step) { return step.keyword.trim() === 'After' && step.name === undefined && step.embeddings === undefined; }
javascript
function isEmptyAfterStep(step) { return step.keyword.trim() === 'After' && step.name === undefined && step.embeddings === undefined; }
[ "function", "isEmptyAfterStep", "(", "step", ")", "{", "return", "step", ".", "keyword", ".", "trim", "(", ")", "===", "'After'", "&&", "step", ".", "name", "===", "undefined", "&&", "step", ".", "embeddings", "===", "undefined", ";", "}" ]
Checks if the step is an empty After step @param step - object which contains step data @returns boolean
[ "Checks", "if", "the", "step", "is", "an", "empty", "After", "step" ]
f8a73deb642c7bd97bc11da8c38656abadcd19cd
https://github.com/robhil/grunt-protractor-cucumber-html-report/blob/f8a73deb642c7bd97bc11da8c38656abadcd19cd/lib/html_formatter.js#L49-L51
28,237
robhil/grunt-protractor-cucumber-html-report
lib/html_formatter.js
isAfterStepWithScreenshot
function isAfterStepWithScreenshot(step) { return step.keyword.trim() === 'After' && step.embeddings && step.embeddings[0] && step.embeddings[0].mime_type === 'image/png'; }
javascript
function isAfterStepWithScreenshot(step) { return step.keyword.trim() === 'After' && step.embeddings && step.embeddings[0] && step.embeddings[0].mime_type === 'image/png'; }
[ "function", "isAfterStepWithScreenshot", "(", "step", ")", "{", "return", "step", ".", "keyword", ".", "trim", "(", ")", "===", "'After'", "&&", "step", ".", "embeddings", "&&", "step", ".", "embeddings", "[", "0", "]", "&&", "step", ".", "embeddings", "[", "0", "]", ".", "mime_type", "===", "'image/png'", ";", "}" ]
Checks if the step is an After step containing a screenshot @param step - object which contains step data @returns boolean
[ "Checks", "if", "the", "step", "is", "an", "After", "step", "containing", "a", "screenshot" ]
f8a73deb642c7bd97bc11da8c38656abadcd19cd
https://github.com/robhil/grunt-protractor-cucumber-html-report/blob/f8a73deb642c7bd97bc11da8c38656abadcd19cd/lib/html_formatter.js#L58-L60
28,238
robhil/grunt-protractor-cucumber-html-report
lib/html_formatter.js
getScenarioContainer
function getScenarioContainer(scenarios) { var template = grunt.file.read(templates.scenarioContainerTemplate), scenarioContainer; scenarioContainer = grunt.template.process(template, { data: { scenarios: scenarios } }); return scenarioContainer; }
javascript
function getScenarioContainer(scenarios) { var template = grunt.file.read(templates.scenarioContainerTemplate), scenarioContainer; scenarioContainer = grunt.template.process(template, { data: { scenarios: scenarios } }); return scenarioContainer; }
[ "function", "getScenarioContainer", "(", "scenarios", ")", "{", "var", "template", "=", "grunt", ".", "file", ".", "read", "(", "templates", ".", "scenarioContainerTemplate", ")", ",", "scenarioContainer", ";", "scenarioContainer", "=", "grunt", ".", "template", ".", "process", "(", "template", ",", "{", "data", ":", "{", "scenarios", ":", "scenarios", "}", "}", ")", ";", "return", "scenarioContainer", ";", "}" ]
Return html code with all scenarios @param scenarios @returns {*}
[ "Return", "html", "code", "with", "all", "scenarios" ]
f8a73deb642c7bd97bc11da8c38656abadcd19cd
https://github.com/robhil/grunt-protractor-cucumber-html-report/blob/f8a73deb642c7bd97bc11da8c38656abadcd19cd/lib/html_formatter.js#L103-L112
28,239
robhil/grunt-protractor-cucumber-html-report
lib/html_formatter.js
getScenario
function getScenario(scenario, isPassed, steps) { var template = grunt.file.read(templates.scenarioTemplate), scenarioTemplate; scenarioTemplate = grunt.template.process(template, { data: { status: isPassed ? statuses.PASSED : statuses.FAILED, name: scenario.keyword + ': ' + scenario.name, steps: steps } }); return scenarioTemplate; }
javascript
function getScenario(scenario, isPassed, steps) { var template = grunt.file.read(templates.scenarioTemplate), scenarioTemplate; scenarioTemplate = grunt.template.process(template, { data: { status: isPassed ? statuses.PASSED : statuses.FAILED, name: scenario.keyword + ': ' + scenario.name, steps: steps } }); return scenarioTemplate; }
[ "function", "getScenario", "(", "scenario", ",", "isPassed", ",", "steps", ")", "{", "var", "template", "=", "grunt", ".", "file", ".", "read", "(", "templates", ".", "scenarioTemplate", ")", ",", "scenarioTemplate", ";", "scenarioTemplate", "=", "grunt", ".", "template", ".", "process", "(", "template", ",", "{", "data", ":", "{", "status", ":", "isPassed", "?", "statuses", ".", "PASSED", ":", "statuses", ".", "FAILED", ",", "name", ":", "scenario", ".", "keyword", "+", "': '", "+", "scenario", ".", "name", ",", "steps", ":", "steps", "}", "}", ")", ";", "return", "scenarioTemplate", ";", "}" ]
Return html code of scenario element based on scenario template @param scenario - object which contains step data @param isPassed = flag which is true when all steps in scenario are passed otherwise is false @returns string
[ "Return", "html", "code", "of", "scenario", "element", "based", "on", "scenario", "template" ]
f8a73deb642c7bd97bc11da8c38656abadcd19cd
https://github.com/robhil/grunt-protractor-cucumber-html-report/blob/f8a73deb642c7bd97bc11da8c38656abadcd19cd/lib/html_formatter.js#L131-L143
28,240
robhil/grunt-protractor-cucumber-html-report
lib/html_formatter.js
getFeature
function getFeature(feature, scenariosNumberInFeature, passedScenariosNumberInFeature, stepsNumberInFeature, passedStepsInFeature) { var template = grunt.file.read(templates.featureTemplate), featureTemplate; featureTemplate = grunt.template.process(template, { data: { name: feature.name, scenariosNumberInFeature: scenariosNumberInFeature, passedScenariosNumberInFeature: passedScenariosNumberInFeature, stepsNumberInFeature: stepsNumberInFeature, passedStepsInFeature: passedStepsInFeature } }); return featureTemplate; }
javascript
function getFeature(feature, scenariosNumberInFeature, passedScenariosNumberInFeature, stepsNumberInFeature, passedStepsInFeature) { var template = grunt.file.read(templates.featureTemplate), featureTemplate; featureTemplate = grunt.template.process(template, { data: { name: feature.name, scenariosNumberInFeature: scenariosNumberInFeature, passedScenariosNumberInFeature: passedScenariosNumberInFeature, stepsNumberInFeature: stepsNumberInFeature, passedStepsInFeature: passedStepsInFeature } }); return featureTemplate; }
[ "function", "getFeature", "(", "feature", ",", "scenariosNumberInFeature", ",", "passedScenariosNumberInFeature", ",", "stepsNumberInFeature", ",", "passedStepsInFeature", ")", "{", "var", "template", "=", "grunt", ".", "file", ".", "read", "(", "templates", ".", "featureTemplate", ")", ",", "featureTemplate", ";", "featureTemplate", "=", "grunt", ".", "template", ".", "process", "(", "template", ",", "{", "data", ":", "{", "name", ":", "feature", ".", "name", ",", "scenariosNumberInFeature", ":", "scenariosNumberInFeature", ",", "passedScenariosNumberInFeature", ":", "passedScenariosNumberInFeature", ",", "stepsNumberInFeature", ":", "stepsNumberInFeature", ",", "passedStepsInFeature", ":", "passedStepsInFeature", "}", "}", ")", ";", "return", "featureTemplate", ";", "}" ]
Return html code of feature element based on feature template @param feature - object which contains feature data @returns {*}
[ "Return", "html", "code", "of", "feature", "element", "based", "on", "feature", "template" ]
f8a73deb642c7bd97bc11da8c38656abadcd19cd
https://github.com/robhil/grunt-protractor-cucumber-html-report/blob/f8a73deb642c7bd97bc11da8c38656abadcd19cd/lib/html_formatter.js#L150-L165
28,241
robhil/grunt-protractor-cucumber-html-report
lib/html_formatter.js
getHeader
function getHeader(scenariosNumber, passedScenarios, stepsNumber, passedSteps, elapsedTime) { var template = grunt.file.read(templates.headerTemplate), header = grunt.template.process(template, { data: { status: areTestsPassed(scenariosNumber, passedScenarios) ? 'passed' : 'failed', scenariosSummary: scenariosNumber + ' scenarios ' + '(' + passedScenarios + ' passed)', stepsSummary: stepsNumber + ' steps ' + '(' + passedSteps + ' passed)', reportDate: getCurrentDate(), reportTitle: reportTitle, elapsedTime: elapsedTime } }); return header; }
javascript
function getHeader(scenariosNumber, passedScenarios, stepsNumber, passedSteps, elapsedTime) { var template = grunt.file.read(templates.headerTemplate), header = grunt.template.process(template, { data: { status: areTestsPassed(scenariosNumber, passedScenarios) ? 'passed' : 'failed', scenariosSummary: scenariosNumber + ' scenarios ' + '(' + passedScenarios + ' passed)', stepsSummary: stepsNumber + ' steps ' + '(' + passedSteps + ' passed)', reportDate: getCurrentDate(), reportTitle: reportTitle, elapsedTime: elapsedTime } }); return header; }
[ "function", "getHeader", "(", "scenariosNumber", ",", "passedScenarios", ",", "stepsNumber", ",", "passedSteps", ",", "elapsedTime", ")", "{", "var", "template", "=", "grunt", ".", "file", ".", "read", "(", "templates", ".", "headerTemplate", ")", ",", "header", "=", "grunt", ".", "template", ".", "process", "(", "template", ",", "{", "data", ":", "{", "status", ":", "areTestsPassed", "(", "scenariosNumber", ",", "passedScenarios", ")", "?", "'passed'", ":", "'failed'", ",", "scenariosSummary", ":", "scenariosNumber", "+", "' scenarios '", "+", "'('", "+", "passedScenarios", "+", "' passed)'", ",", "stepsSummary", ":", "stepsNumber", "+", "' steps '", "+", "'('", "+", "passedSteps", "+", "' passed)'", ",", "reportDate", ":", "getCurrentDate", "(", ")", ",", "reportTitle", ":", "reportTitle", ",", "elapsedTime", ":", "elapsedTime", "}", "}", ")", ";", "return", "header", ";", "}" ]
Return header html code based on header template @param scenariosNumber @param passedScenarios @param stepsNumber @param passedSteps @returns {*}
[ "Return", "header", "html", "code", "based", "on", "header", "template" ]
f8a73deb642c7bd97bc11da8c38656abadcd19cd
https://github.com/robhil/grunt-protractor-cucumber-html-report/blob/f8a73deb642c7bd97bc11da8c38656abadcd19cd/lib/html_formatter.js#L185-L198
28,242
robhil/grunt-protractor-cucumber-html-report
lib/html_formatter.js
generateHTML
function generateHTML(testResults) { var stepsHtml = '', header = '', isPassed = false, passedScenarios = 0, passedSteps = 0, stepsNumber = 0, scenariosNumber = 0, scenariosNumberInFeature = 0, passedScenariosNumberInFeature = 0, stepsNumberInFeature = 0, passedStepsInFeature = 0, scenariosHtml = '', element, step, stepDuration = 0; html = ''; for (var i = 0; i < testResults.length; i++) { scenariosNumberInFeature = 0; passedScenariosNumberInFeature = 0; stepsNumberInFeature = 0; passedStepsInFeature = 0; scenariosHtml = ''; if (testResults[i].elements) { for (var j = 0; j < testResults[i].elements.length; j++) { element = testResults[i].elements[j]; if (element.type === 'scenario') { scenariosNumber++; scenariosNumberInFeature++; stepsHtml = ''; isPassed = true; for (var k = 0; k < testResults[i].elements[j].steps.length; k++) { step = testResults[i].elements[j].steps[k]; if (isEmptyAfterStep(step) || isEmptyBeforeStep(step)) { continue; } if (isAfterStepWithScreenshot(step)) { stepsHtml += getAfterScreenshotStep(step); } else { stepsHtml += getStep(step); stepDuration += (step.result.duration ? step.result.duration : 0); stepsNumber++; stepsNumberInFeature++; if (step.result.status !== statuses.PASSED) { isPassed = false; } else if (step.result.status === statuses.PASSED) { passedSteps++; passedStepsInFeature++; } } } if (isPassed) { passedScenarios++; passedScenariosNumberInFeature++; } scenariosHtml += getScenarioContainer(getScenario(element, isPassed, stepsHtml)); } } } html += getFeatureWithScenarios(getFeature(testResults[i], scenariosNumberInFeature, passedScenariosNumberInFeature, stepsNumberInFeature, passedStepsInFeature) + scenariosHtml); } header = getHeader(scenariosNumber, passedScenarios, stepsNumber, passedSteps, calculateDuration(stepDuration)); return header + html; }
javascript
function generateHTML(testResults) { var stepsHtml = '', header = '', isPassed = false, passedScenarios = 0, passedSteps = 0, stepsNumber = 0, scenariosNumber = 0, scenariosNumberInFeature = 0, passedScenariosNumberInFeature = 0, stepsNumberInFeature = 0, passedStepsInFeature = 0, scenariosHtml = '', element, step, stepDuration = 0; html = ''; for (var i = 0; i < testResults.length; i++) { scenariosNumberInFeature = 0; passedScenariosNumberInFeature = 0; stepsNumberInFeature = 0; passedStepsInFeature = 0; scenariosHtml = ''; if (testResults[i].elements) { for (var j = 0; j < testResults[i].elements.length; j++) { element = testResults[i].elements[j]; if (element.type === 'scenario') { scenariosNumber++; scenariosNumberInFeature++; stepsHtml = ''; isPassed = true; for (var k = 0; k < testResults[i].elements[j].steps.length; k++) { step = testResults[i].elements[j].steps[k]; if (isEmptyAfterStep(step) || isEmptyBeforeStep(step)) { continue; } if (isAfterStepWithScreenshot(step)) { stepsHtml += getAfterScreenshotStep(step); } else { stepsHtml += getStep(step); stepDuration += (step.result.duration ? step.result.duration : 0); stepsNumber++; stepsNumberInFeature++; if (step.result.status !== statuses.PASSED) { isPassed = false; } else if (step.result.status === statuses.PASSED) { passedSteps++; passedStepsInFeature++; } } } if (isPassed) { passedScenarios++; passedScenariosNumberInFeature++; } scenariosHtml += getScenarioContainer(getScenario(element, isPassed, stepsHtml)); } } } html += getFeatureWithScenarios(getFeature(testResults[i], scenariosNumberInFeature, passedScenariosNumberInFeature, stepsNumberInFeature, passedStepsInFeature) + scenariosHtml); } header = getHeader(scenariosNumber, passedScenarios, stepsNumber, passedSteps, calculateDuration(stepDuration)); return header + html; }
[ "function", "generateHTML", "(", "testResults", ")", "{", "var", "stepsHtml", "=", "''", ",", "header", "=", "''", ",", "isPassed", "=", "false", ",", "passedScenarios", "=", "0", ",", "passedSteps", "=", "0", ",", "stepsNumber", "=", "0", ",", "scenariosNumber", "=", "0", ",", "scenariosNumberInFeature", "=", "0", ",", "passedScenariosNumberInFeature", "=", "0", ",", "stepsNumberInFeature", "=", "0", ",", "passedStepsInFeature", "=", "0", ",", "scenariosHtml", "=", "''", ",", "element", ",", "step", ",", "stepDuration", "=", "0", ";", "html", "=", "''", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "testResults", ".", "length", ";", "i", "++", ")", "{", "scenariosNumberInFeature", "=", "0", ";", "passedScenariosNumberInFeature", "=", "0", ";", "stepsNumberInFeature", "=", "0", ";", "passedStepsInFeature", "=", "0", ";", "scenariosHtml", "=", "''", ";", "if", "(", "testResults", "[", "i", "]", ".", "elements", ")", "{", "for", "(", "var", "j", "=", "0", ";", "j", "<", "testResults", "[", "i", "]", ".", "elements", ".", "length", ";", "j", "++", ")", "{", "element", "=", "testResults", "[", "i", "]", ".", "elements", "[", "j", "]", ";", "if", "(", "element", ".", "type", "===", "'scenario'", ")", "{", "scenariosNumber", "++", ";", "scenariosNumberInFeature", "++", ";", "stepsHtml", "=", "''", ";", "isPassed", "=", "true", ";", "for", "(", "var", "k", "=", "0", ";", "k", "<", "testResults", "[", "i", "]", ".", "elements", "[", "j", "]", ".", "steps", ".", "length", ";", "k", "++", ")", "{", "step", "=", "testResults", "[", "i", "]", ".", "elements", "[", "j", "]", ".", "steps", "[", "k", "]", ";", "if", "(", "isEmptyAfterStep", "(", "step", ")", "||", "isEmptyBeforeStep", "(", "step", ")", ")", "{", "continue", ";", "}", "if", "(", "isAfterStepWithScreenshot", "(", "step", ")", ")", "{", "stepsHtml", "+=", "getAfterScreenshotStep", "(", "step", ")", ";", "}", "else", "{", "stepsHtml", "+=", "getStep", "(", "step", ")", ";", "stepDuration", "+=", "(", "step", ".", "result", ".", "duration", "?", "step", ".", "result", ".", "duration", ":", "0", ")", ";", "stepsNumber", "++", ";", "stepsNumberInFeature", "++", ";", "if", "(", "step", ".", "result", ".", "status", "!==", "statuses", ".", "PASSED", ")", "{", "isPassed", "=", "false", ";", "}", "else", "if", "(", "step", ".", "result", ".", "status", "===", "statuses", ".", "PASSED", ")", "{", "passedSteps", "++", ";", "passedStepsInFeature", "++", ";", "}", "}", "}", "if", "(", "isPassed", ")", "{", "passedScenarios", "++", ";", "passedScenariosNumberInFeature", "++", ";", "}", "scenariosHtml", "+=", "getScenarioContainer", "(", "getScenario", "(", "element", ",", "isPassed", ",", "stepsHtml", ")", ")", ";", "}", "}", "}", "html", "+=", "getFeatureWithScenarios", "(", "getFeature", "(", "testResults", "[", "i", "]", ",", "scenariosNumberInFeature", ",", "passedScenariosNumberInFeature", ",", "stepsNumberInFeature", ",", "passedStepsInFeature", ")", "+", "scenariosHtml", ")", ";", "}", "header", "=", "getHeader", "(", "scenariosNumber", ",", "passedScenarios", ",", "stepsNumber", ",", "passedSteps", ",", "calculateDuration", "(", "stepDuration", ")", ")", ";", "return", "header", "+", "html", ";", "}" ]
Generate html code which contains all elements needed to generate reports @param testResults @returns {string}
[ "Generate", "html", "code", "which", "contains", "all", "elements", "needed", "to", "generate", "reports" ]
f8a73deb642c7bd97bc11da8c38656abadcd19cd
https://github.com/robhil/grunt-protractor-cucumber-html-report/blob/f8a73deb642c7bd97bc11da8c38656abadcd19cd/lib/html_formatter.js#L221-L289
28,243
robhil/grunt-protractor-cucumber-html-report
lib/html_formatter.js
generateReport
function generateReport(html) { var template = grunt.file.read(templates.reportTemplate); return grunt.template.process(template, { data: { scenarios: html } }); }
javascript
function generateReport(html) { var template = grunt.file.read(templates.reportTemplate); return grunt.template.process(template, { data: { scenarios: html } }); }
[ "function", "generateReport", "(", "html", ")", "{", "var", "template", "=", "grunt", ".", "file", ".", "read", "(", "templates", ".", "reportTemplate", ")", ";", "return", "grunt", ".", "template", ".", "process", "(", "template", ",", "{", "data", ":", "{", "scenarios", ":", "html", "}", "}", ")", ";", "}" ]
Generate report from report template @param html - concatenated all elements @returns string which contains html code of report
[ "Generate", "report", "from", "report", "template" ]
f8a73deb642c7bd97bc11da8c38656abadcd19cd
https://github.com/robhil/grunt-protractor-cucumber-html-report/blob/f8a73deb642c7bd97bc11da8c38656abadcd19cd/lib/html_formatter.js#L305-L312
28,244
testiumjs/testium-core
lib/driver-factory.js
strictEqualityResolver
function strictEqualityResolver() { var knownValues = []; function resolveMemoKey(value) { if (knownValues.indexOf(value) === -1) { knownValues.push(value); } return '' + _.indexOf(knownValues, value); } return resolveMemoKey; }
javascript
function strictEqualityResolver() { var knownValues = []; function resolveMemoKey(value) { if (knownValues.indexOf(value) === -1) { knownValues.push(value); } return '' + _.indexOf(knownValues, value); } return resolveMemoKey; }
[ "function", "strictEqualityResolver", "(", ")", "{", "var", "knownValues", "=", "[", "]", ";", "function", "resolveMemoKey", "(", "value", ")", "{", "if", "(", "knownValues", ".", "indexOf", "(", "value", ")", "===", "-", "1", ")", "{", "knownValues", ".", "push", "(", "value", ")", ";", "}", "return", "''", "+", "_", ".", "indexOf", "(", "knownValues", ",", "value", ")", ";", "}", "return", "resolveMemoKey", ";", "}" ]
We want to memo based on strict equality, not based on string-value
[ "We", "want", "to", "memo", "based", "on", "strict", "equality", "not", "based", "on", "string", "-", "value" ]
a3c9f877ccc2ce70ce9385a858293043828fef6d
https://github.com/testiumjs/testium-core/blob/a3c9f877ccc2ce70ce9385a858293043828fef6d/lib/driver-factory.js#L63-L72
28,245
bleupen/halacious
examples/programmatic-route.js
function (rep, next) { rep.entity.items.forEach(function (item) { var embed = rep.embed('item', './' + item.id, item); if (item.googlePlusId) { embed.link('home', 'http://plus.google.com/' + item.googlePlusId); embed.ignore('googlePlusId'); } }); rep.ignore('items'); // dont forget to call next! next(); }
javascript
function (rep, next) { rep.entity.items.forEach(function (item) { var embed = rep.embed('item', './' + item.id, item); if (item.googlePlusId) { embed.link('home', 'http://plus.google.com/' + item.googlePlusId); embed.ignore('googlePlusId'); } }); rep.ignore('items'); // dont forget to call next! next(); }
[ "function", "(", "rep", ",", "next", ")", "{", "rep", ".", "entity", ".", "items", ".", "forEach", "(", "function", "(", "item", ")", "{", "var", "embed", "=", "rep", ".", "embed", "(", "'item'", ",", "'./'", "+", "item", ".", "id", ",", "item", ")", ";", "if", "(", "item", ".", "googlePlusId", ")", "{", "embed", ".", "link", "(", "'home'", ",", "'http://plus.google.com/'", "+", "item", ".", "googlePlusId", ")", ";", "embed", ".", "ignore", "(", "'googlePlusId'", ")", ";", "}", "}", ")", ";", "rep", ".", "ignore", "(", "'items'", ")", ";", "// dont forget to call next!", "next", "(", ")", ";", "}" ]
you can also assign this function directly to the hal property above as a shortcut
[ "you", "can", "also", "assign", "this", "function", "directly", "to", "the", "hal", "property", "above", "as", "a", "shortcut" ]
91e4f8128d6ecd2a6de318536a91aeda6b95daa5
https://github.com/bleupen/halacious/blob/91e4f8128d6ecd2a6de318536a91aeda6b95daa5/examples/programmatic-route.js#L35-L46
28,246
headcr4sh/node-maven
index.js
_spawn
function _spawn(mvn, args) { const spawn = require('child_process').spawn; // Command to be executed. let cmd = mvn.options.cmd || mvnw(mvn.options.cwd) || 'mvn'; return new Promise((resolve, reject) => { if (isWin) { args.unshift(cmd); args.unshift('/c'), args.unshift('/s'); cmd = process.env.COMSPEC || 'cmd.exe'; } const proc = spawn(cmd, args, { 'cwd': mvn.options.cwd }); proc.on('error', reject); proc.on('exit', (code, signal) => { if (code !== 0) { reject({ 'code': code, 'signal': signal }); } else { resolve(); } }); proc.stdout.on('data', process.stdout.write.bind(process.stdout)); proc.stderr.on('data', process.stderr.write.bind(process.stderr)); }); }
javascript
function _spawn(mvn, args) { const spawn = require('child_process').spawn; // Command to be executed. let cmd = mvn.options.cmd || mvnw(mvn.options.cwd) || 'mvn'; return new Promise((resolve, reject) => { if (isWin) { args.unshift(cmd); args.unshift('/c'), args.unshift('/s'); cmd = process.env.COMSPEC || 'cmd.exe'; } const proc = spawn(cmd, args, { 'cwd': mvn.options.cwd }); proc.on('error', reject); proc.on('exit', (code, signal) => { if (code !== 0) { reject({ 'code': code, 'signal': signal }); } else { resolve(); } }); proc.stdout.on('data', process.stdout.write.bind(process.stdout)); proc.stderr.on('data', process.stderr.write.bind(process.stderr)); }); }
[ "function", "_spawn", "(", "mvn", ",", "args", ")", "{", "const", "spawn", "=", "require", "(", "'child_process'", ")", ".", "spawn", ";", "// Command to be executed.", "let", "cmd", "=", "mvn", ".", "options", ".", "cmd", "||", "mvnw", "(", "mvn", ".", "options", ".", "cwd", ")", "||", "'mvn'", ";", "return", "new", "Promise", "(", "(", "resolve", ",", "reject", ")", "=>", "{", "if", "(", "isWin", ")", "{", "args", ".", "unshift", "(", "cmd", ")", ";", "args", ".", "unshift", "(", "'/c'", ")", ",", "args", ".", "unshift", "(", "'/s'", ")", ";", "cmd", "=", "process", ".", "env", ".", "COMSPEC", "||", "'cmd.exe'", ";", "}", "const", "proc", "=", "spawn", "(", "cmd", ",", "args", ",", "{", "'cwd'", ":", "mvn", ".", "options", ".", "cwd", "}", ")", ";", "proc", ".", "on", "(", "'error'", ",", "reject", ")", ";", "proc", ".", "on", "(", "'exit'", ",", "(", "code", ",", "signal", ")", "=>", "{", "if", "(", "code", "!==", "0", ")", "{", "reject", "(", "{", "'code'", ":", "code", ",", "'signal'", ":", "signal", "}", ")", ";", "}", "else", "{", "resolve", "(", ")", ";", "}", "}", ")", ";", "proc", ".", "stdout", ".", "on", "(", "'data'", ",", "process", ".", "stdout", ".", "write", ".", "bind", "(", "process", ".", "stdout", ")", ")", ";", "proc", ".", "stderr", ".", "on", "(", "'data'", ",", "process", ".", "stderr", ".", "write", ".", "bind", "(", "process", ".", "stderr", ")", ")", ";", "}", ")", ";", "}" ]
A simple wrapper around child_process.spawn that returns a promise. @private @param {!Maven} mvn @param {!Array.<string>} args Command to be executed. @return {Promise.<void>}
[ "A", "simple", "wrapper", "around", "child_process", ".", "spawn", "that", "returns", "a", "promise", "." ]
6ffaa8989c444e622c03f931bdea28072f0b3988
https://github.com/headcr4sh/node-maven/blob/6ffaa8989c444e622c03f931bdea28072f0b3988/index.js#L47-L70
28,247
robhil/grunt-protractor-cucumber-html-report
templates/assets/js/navigation.js
function () { var steps = this.querySelectorAll('.step'); var scenarioArrow = this.querySelector('.scenario-arrow'); for (var k = 0; k < steps.length; k++) { if (steps[k].style.display === 'block') { scenarioArrow.classList.remove('fa-angle-up'); scenarioArrow.classList.add('fa-angle-down'); steps[k].style.display = 'none'; } else { steps[k].style.display = 'block'; scenarioArrow.classList.remove('fa-angle-down'); scenarioArrow.classList.add('fa-angle-up'); } } }
javascript
function () { var steps = this.querySelectorAll('.step'); var scenarioArrow = this.querySelector('.scenario-arrow'); for (var k = 0; k < steps.length; k++) { if (steps[k].style.display === 'block') { scenarioArrow.classList.remove('fa-angle-up'); scenarioArrow.classList.add('fa-angle-down'); steps[k].style.display = 'none'; } else { steps[k].style.display = 'block'; scenarioArrow.classList.remove('fa-angle-down'); scenarioArrow.classList.add('fa-angle-up'); } } }
[ "function", "(", ")", "{", "var", "steps", "=", "this", ".", "querySelectorAll", "(", "'.step'", ")", ";", "var", "scenarioArrow", "=", "this", ".", "querySelector", "(", "'.scenario-arrow'", ")", ";", "for", "(", "var", "k", "=", "0", ";", "k", "<", "steps", ".", "length", ";", "k", "++", ")", "{", "if", "(", "steps", "[", "k", "]", ".", "style", ".", "display", "===", "'block'", ")", "{", "scenarioArrow", ".", "classList", ".", "remove", "(", "'fa-angle-up'", ")", ";", "scenarioArrow", ".", "classList", ".", "add", "(", "'fa-angle-down'", ")", ";", "steps", "[", "k", "]", ".", "style", ".", "display", "=", "'none'", ";", "}", "else", "{", "steps", "[", "k", "]", ".", "style", ".", "display", "=", "'block'", ";", "scenarioArrow", ".", "classList", ".", "remove", "(", "'fa-angle-down'", ")", ";", "scenarioArrow", ".", "classList", ".", "add", "(", "'fa-angle-up'", ")", ";", "}", "}", "}" ]
Hiding and displaying steps after clicking on scenario header
[ "Hiding", "and", "displaying", "steps", "after", "clicking", "on", "scenario", "header" ]
f8a73deb642c7bd97bc11da8c38656abadcd19cd
https://github.com/robhil/grunt-protractor-cucumber-html-report/blob/f8a73deb642c7bd97bc11da8c38656abadcd19cd/templates/assets/js/navigation.js#L56-L71
28,248
robhil/grunt-protractor-cucumber-html-report
templates/assets/js/navigation.js
function (buttonState) { var scenarios = document.querySelectorAll('.scenario'), hasClass, self = this; for (var i = 0; i < scenarios.length; i++) { hasClass = scenarios[i].classList.contains(buttonState); if (hasClass === true) { if (scenarios[i].parentNode.style.display === 'none') { scenarios[i].parentNode.style.display = 'block'; } } else { scenarios[i].parentNode.style.display = 'none'; } } if (buttonState === 'failed') { self.currentView = 'failed'; this.hideFeatureContainer('passed'); } else { self.currentView = 'passed'; this.hideFeatureContainer('failed'); } }
javascript
function (buttonState) { var scenarios = document.querySelectorAll('.scenario'), hasClass, self = this; for (var i = 0; i < scenarios.length; i++) { hasClass = scenarios[i].classList.contains(buttonState); if (hasClass === true) { if (scenarios[i].parentNode.style.display === 'none') { scenarios[i].parentNode.style.display = 'block'; } } else { scenarios[i].parentNode.style.display = 'none'; } } if (buttonState === 'failed') { self.currentView = 'failed'; this.hideFeatureContainer('passed'); } else { self.currentView = 'passed'; this.hideFeatureContainer('failed'); } }
[ "function", "(", "buttonState", ")", "{", "var", "scenarios", "=", "document", ".", "querySelectorAll", "(", "'.scenario'", ")", ",", "hasClass", ",", "self", "=", "this", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "scenarios", ".", "length", ";", "i", "++", ")", "{", "hasClass", "=", "scenarios", "[", "i", "]", ".", "classList", ".", "contains", "(", "buttonState", ")", ";", "if", "(", "hasClass", "===", "true", ")", "{", "if", "(", "scenarios", "[", "i", "]", ".", "parentNode", ".", "style", ".", "display", "===", "'none'", ")", "{", "scenarios", "[", "i", "]", ".", "parentNode", ".", "style", ".", "display", "=", "'block'", ";", "}", "}", "else", "{", "scenarios", "[", "i", "]", ".", "parentNode", ".", "style", ".", "display", "=", "'none'", ";", "}", "}", "if", "(", "buttonState", "===", "'failed'", ")", "{", "self", ".", "currentView", "=", "'failed'", ";", "this", ".", "hideFeatureContainer", "(", "'passed'", ")", ";", "}", "else", "{", "self", ".", "currentView", "=", "'passed'", ";", "this", ".", "hideFeatureContainer", "(", "'failed'", ")", ";", "}", "}" ]
Filtering passed and failed scenarios by clicking the passed or failed button respectively @param buttonState indicates the clicked button
[ "Filtering", "passed", "and", "failed", "scenarios", "by", "clicking", "the", "passed", "or", "failed", "button", "respectively" ]
f8a73deb642c7bd97bc11da8c38656abadcd19cd
https://github.com/robhil/grunt-protractor-cucumber-html-report/blob/f8a73deb642c7bd97bc11da8c38656abadcd19cd/templates/assets/js/navigation.js#L83-L105
28,249
robhil/grunt-protractor-cucumber-html-report
templates/assets/js/navigation.js
function (scenarios) { var self = this; self.currentView = 'all'; for (var i = 0; i < scenarios.length; i++) { if (scenarios[i].style.display != 'block') { scenarios[i].style.display = 'block'; } } }
javascript
function (scenarios) { var self = this; self.currentView = 'all'; for (var i = 0; i < scenarios.length; i++) { if (scenarios[i].style.display != 'block') { scenarios[i].style.display = 'block'; } } }
[ "function", "(", "scenarios", ")", "{", "var", "self", "=", "this", ";", "self", ".", "currentView", "=", "'all'", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "scenarios", ".", "length", ";", "i", "++", ")", "{", "if", "(", "scenarios", "[", "i", "]", ".", "style", ".", "display", "!=", "'block'", ")", "{", "scenarios", "[", "i", "]", ".", "style", ".", "display", "=", "'block'", ";", "}", "}", "}" ]
Displaying all scenarios within the report @param scenarios indicate the all scenarios in report
[ "Displaying", "all", "scenarios", "within", "the", "report" ]
f8a73deb642c7bd97bc11da8c38656abadcd19cd
https://github.com/robhil/grunt-protractor-cucumber-html-report/blob/f8a73deb642c7bd97bc11da8c38656abadcd19cd/templates/assets/js/navigation.js#L112-L120
28,250
robhil/grunt-protractor-cucumber-html-report
templates/assets/js/navigation.js
function (filteringButtons, scenarios, steps) { var self = this, btnState; for (var k = 0; k < filteringButtons.length; k++) { filteringButtons[k].addEventListener('click', function () { btnState = this.dataset.state; self.displayAllFeatures(); if (btnState !== 'steps') { self.removeActiveClass(filteringButtons); this.classList.add('active'); self.hideSteps(steps); } switch (btnState) { case 'all': self.displayAllScenarios(scenarios); break; case 'chart': app.chart.toggleChart(); self.displayAllScenarios(scenarios); break; case 'steps': if (self.currentView === 'failed') { self.toggleStepsVisibilities('.scenario.failed .step', 'passed'); } else if (self.currentView === 'passed') { self.toggleStepsVisibilities('.scenario.passed .step', 'failed'); } else { self.displayAllScenarios(scenarios); self.toggleSteps(steps); } break; default: self.filterScenarios(btnState); break; } }, false); } }
javascript
function (filteringButtons, scenarios, steps) { var self = this, btnState; for (var k = 0; k < filteringButtons.length; k++) { filteringButtons[k].addEventListener('click', function () { btnState = this.dataset.state; self.displayAllFeatures(); if (btnState !== 'steps') { self.removeActiveClass(filteringButtons); this.classList.add('active'); self.hideSteps(steps); } switch (btnState) { case 'all': self.displayAllScenarios(scenarios); break; case 'chart': app.chart.toggleChart(); self.displayAllScenarios(scenarios); break; case 'steps': if (self.currentView === 'failed') { self.toggleStepsVisibilities('.scenario.failed .step', 'passed'); } else if (self.currentView === 'passed') { self.toggleStepsVisibilities('.scenario.passed .step', 'failed'); } else { self.displayAllScenarios(scenarios); self.toggleSteps(steps); } break; default: self.filterScenarios(btnState); break; } }, false); } }
[ "function", "(", "filteringButtons", ",", "scenarios", ",", "steps", ")", "{", "var", "self", "=", "this", ",", "btnState", ";", "for", "(", "var", "k", "=", "0", ";", "k", "<", "filteringButtons", ".", "length", ";", "k", "++", ")", "{", "filteringButtons", "[", "k", "]", ".", "addEventListener", "(", "'click'", ",", "function", "(", ")", "{", "btnState", "=", "this", ".", "dataset", ".", "state", ";", "self", ".", "displayAllFeatures", "(", ")", ";", "if", "(", "btnState", "!==", "'steps'", ")", "{", "self", ".", "removeActiveClass", "(", "filteringButtons", ")", ";", "this", ".", "classList", ".", "add", "(", "'active'", ")", ";", "self", ".", "hideSteps", "(", "steps", ")", ";", "}", "switch", "(", "btnState", ")", "{", "case", "'all'", ":", "self", ".", "displayAllScenarios", "(", "scenarios", ")", ";", "break", ";", "case", "'chart'", ":", "app", ".", "chart", ".", "toggleChart", "(", ")", ";", "self", ".", "displayAllScenarios", "(", "scenarios", ")", ";", "break", ";", "case", "'steps'", ":", "if", "(", "self", ".", "currentView", "===", "'failed'", ")", "{", "self", ".", "toggleStepsVisibilities", "(", "'.scenario.failed .step'", ",", "'passed'", ")", ";", "}", "else", "if", "(", "self", ".", "currentView", "===", "'passed'", ")", "{", "self", ".", "toggleStepsVisibilities", "(", "'.scenario.passed .step'", ",", "'failed'", ")", ";", "}", "else", "{", "self", ".", "displayAllScenarios", "(", "scenarios", ")", ";", "self", ".", "toggleSteps", "(", "steps", ")", ";", "}", "break", ";", "default", ":", "self", ".", "filterScenarios", "(", "btnState", ")", ";", "break", ";", "}", "}", ",", "false", ")", ";", "}", "}" ]
Run appropriate action depending on button state @param filteringButtons indicate the navigation buttons @param scenarios indicate all scenarios in report @param steps indicate all steps in report
[ "Run", "appropriate", "action", "depending", "on", "button", "state" ]
f8a73deb642c7bd97bc11da8c38656abadcd19cd
https://github.com/robhil/grunt-protractor-cucumber-html-report/blob/f8a73deb642c7bd97bc11da8c38656abadcd19cd/templates/assets/js/navigation.js#L140-L181
28,251
robhil/grunt-protractor-cucumber-html-report
templates/assets/js/navigation.js
function (steps) { var scenarioArrowCollection = document.querySelectorAll('.scenario-arrow'), allBtn = document.querySelector('.all-btn'); for (var i = 0; i < steps.length; i++) { var display = steps[i].style.display; if (display === 'none' || display === '') { this.addArrowUp(scenarioArrowCollection); steps[i].style.display = 'block'; allBtn.classList.add('active'); } else { this.addArrowDown(scenarioArrowCollection); allBtn.classList.add('active'); steps[i].style.display = 'none'; } } }
javascript
function (steps) { var scenarioArrowCollection = document.querySelectorAll('.scenario-arrow'), allBtn = document.querySelector('.all-btn'); for (var i = 0; i < steps.length; i++) { var display = steps[i].style.display; if (display === 'none' || display === '') { this.addArrowUp(scenarioArrowCollection); steps[i].style.display = 'block'; allBtn.classList.add('active'); } else { this.addArrowDown(scenarioArrowCollection); allBtn.classList.add('active'); steps[i].style.display = 'none'; } } }
[ "function", "(", "steps", ")", "{", "var", "scenarioArrowCollection", "=", "document", ".", "querySelectorAll", "(", "'.scenario-arrow'", ")", ",", "allBtn", "=", "document", ".", "querySelector", "(", "'.all-btn'", ")", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "steps", ".", "length", ";", "i", "++", ")", "{", "var", "display", "=", "steps", "[", "i", "]", ".", "style", ".", "display", ";", "if", "(", "display", "===", "'none'", "||", "display", "===", "''", ")", "{", "this", ".", "addArrowUp", "(", "scenarioArrowCollection", ")", ";", "steps", "[", "i", "]", ".", "style", ".", "display", "=", "'block'", ";", "allBtn", ".", "classList", ".", "add", "(", "'active'", ")", ";", "}", "else", "{", "this", ".", "addArrowDown", "(", "scenarioArrowCollection", ")", ";", "allBtn", ".", "classList", ".", "add", "(", "'active'", ")", ";", "steps", "[", "i", "]", ".", "style", ".", "display", "=", "'none'", ";", "}", "}", "}" ]
Displaying and hiding steps by clicking "chart report" button @param steps indicate all steps in report
[ "Displaying", "and", "hiding", "steps", "by", "clicking", "chart", "report", "button" ]
f8a73deb642c7bd97bc11da8c38656abadcd19cd
https://github.com/robhil/grunt-protractor-cucumber-html-report/blob/f8a73deb642c7bd97bc11da8c38656abadcd19cd/templates/assets/js/navigation.js#L220-L235
28,252
robhil/grunt-protractor-cucumber-html-report
templates/assets/js/navigation.js
function (steps) { for (var i = 0; i < steps.length; i++) { steps[i].style.display = 'none'; } }
javascript
function (steps) { for (var i = 0; i < steps.length; i++) { steps[i].style.display = 'none'; } }
[ "function", "(", "steps", ")", "{", "for", "(", "var", "i", "=", "0", ";", "i", "<", "steps", ".", "length", ";", "i", "++", ")", "{", "steps", "[", "i", "]", ".", "style", ".", "display", "=", "'none'", ";", "}", "}" ]
Hiding currently displayed steps @param steps indicate all steps in report
[ "Hiding", "currently", "displayed", "steps" ]
f8a73deb642c7bd97bc11da8c38656abadcd19cd
https://github.com/robhil/grunt-protractor-cucumber-html-report/blob/f8a73deb642c7bd97bc11da8c38656abadcd19cd/templates/assets/js/navigation.js#L241-L245
28,253
robhil/grunt-protractor-cucumber-html-report
templates/assets/js/navigation.js
function (state) { var features = document.querySelectorAll('.feature-with-scenarios'), scenarios, counter = 0; for (var i = 0; i < features.length; i++) { scenarios = features[i].querySelectorAll('.scenario'); counter = 0; for (var j = 0; j < scenarios.length; j++) { if (scenarios[j].classList.contains(state)) { counter++; } } if (counter === scenarios.length) { features[i].classList.add('hidden'); } } }
javascript
function (state) { var features = document.querySelectorAll('.feature-with-scenarios'), scenarios, counter = 0; for (var i = 0; i < features.length; i++) { scenarios = features[i].querySelectorAll('.scenario'); counter = 0; for (var j = 0; j < scenarios.length; j++) { if (scenarios[j].classList.contains(state)) { counter++; } } if (counter === scenarios.length) { features[i].classList.add('hidden'); } } }
[ "function", "(", "state", ")", "{", "var", "features", "=", "document", ".", "querySelectorAll", "(", "'.feature-with-scenarios'", ")", ",", "scenarios", ",", "counter", "=", "0", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "features", ".", "length", ";", "i", "++", ")", "{", "scenarios", "=", "features", "[", "i", "]", ".", "querySelectorAll", "(", "'.scenario'", ")", ";", "counter", "=", "0", ";", "for", "(", "var", "j", "=", "0", ";", "j", "<", "scenarios", ".", "length", ";", "j", "++", ")", "{", "if", "(", "scenarios", "[", "j", "]", ".", "classList", ".", "contains", "(", "state", ")", ")", "{", "counter", "++", ";", "}", "}", "if", "(", "counter", "===", "scenarios", ".", "length", ")", "{", "features", "[", "i", "]", ".", "classList", ".", "add", "(", "'hidden'", ")", ";", "}", "}", "}" ]
Hide features and scenarios which are not corresponding to the triggered button state. eg. passed button hides all failed scenarios and features if the feature contains only failed scenarios. If there is at least one passed scenario within the feature, the feature description is displayed. @param state indicates the button state which corresponds with scenario status
[ "Hide", "features", "and", "scenarios", "which", "are", "not", "corresponding", "to", "the", "triggered", "button", "state", ".", "eg", ".", "passed", "button", "hides", "all", "failed", "scenarios", "and", "features", "if", "the", "feature", "contains", "only", "failed", "scenarios", ".", "If", "there", "is", "at", "least", "one", "passed", "scenario", "within", "the", "feature", "the", "feature", "description", "is", "displayed", "." ]
f8a73deb642c7bd97bc11da8c38656abadcd19cd
https://github.com/robhil/grunt-protractor-cucumber-html-report/blob/f8a73deb642c7bd97bc11da8c38656abadcd19cd/templates/assets/js/navigation.js#L262-L279
28,254
robhil/grunt-protractor-cucumber-html-report
templates/assets/js/chart.js
function (r, g, b) { if (r > 255 || g > 255 || b > 255) throw "Invalid color component"; return ((r << 16) | (g << 8) | b).toString(16); }
javascript
function (r, g, b) { if (r > 255 || g > 255 || b > 255) throw "Invalid color component"; return ((r << 16) | (g << 8) | b).toString(16); }
[ "function", "(", "r", ",", "g", ",", "b", ")", "{", "if", "(", "r", ">", "255", "||", "g", ">", "255", "||", "b", ">", "255", ")", "throw", "\"Invalid color component\"", ";", "return", "(", "(", "r", "<<", "16", ")", "|", "(", "g", "<<", "8", ")", "|", "b", ")", ".", "toString", "(", "16", ")", ";", "}" ]
Transforming rgb colors into Hex
[ "Transforming", "rgb", "colors", "into", "Hex" ]
f8a73deb642c7bd97bc11da8c38656abadcd19cd
https://github.com/robhil/grunt-protractor-cucumber-html-report/blob/f8a73deb642c7bd97bc11da8c38656abadcd19cd/templates/assets/js/chart.js#L88-L92
28,255
robhil/grunt-protractor-cucumber-html-report
templates/assets/js/chart.js
function (obj) { var curleft = 0, curtop = 0; if (obj.offsetParent) { do { curleft += obj.offsetLeft; curtop += obj.offsetTop; } while (obj = obj.offsetParent); return {x: curleft, y: curtop}; } }
javascript
function (obj) { var curleft = 0, curtop = 0; if (obj.offsetParent) { do { curleft += obj.offsetLeft; curtop += obj.offsetTop; } while (obj = obj.offsetParent); return {x: curleft, y: curtop}; } }
[ "function", "(", "obj", ")", "{", "var", "curleft", "=", "0", ",", "curtop", "=", "0", ";", "if", "(", "obj", ".", "offsetParent", ")", "{", "do", "{", "curleft", "+=", "obj", ".", "offsetLeft", ";", "curtop", "+=", "obj", ".", "offsetTop", ";", "}", "while", "(", "obj", "=", "obj", ".", "offsetParent", ")", ";", "return", "{", "x", ":", "curleft", ",", "y", ":", "curtop", "}", ";", "}", "}" ]
Finding mouse position on chart
[ "Finding", "mouse", "position", "on", "chart" ]
f8a73deb642c7bd97bc11da8c38656abadcd19cd
https://github.com/robhil/grunt-protractor-cucumber-html-report/blob/f8a73deb642c7bd97bc11da8c38656abadcd19cd/templates/assets/js/chart.js#L94-L103
28,256
robhil/grunt-protractor-cucumber-html-report
templates/assets/js/chart.js
function () { var documentContainer = document.querySelector('.document-container'); if (documentContainer.classList.contains('backdrop-hidden')) { documentContainer.classList.remove('backdrop-hidden'); documentContainer.style.display = 'none'; } if (this.classList.contains('chart-hidden')) { this.classList.remove('chart-hidden'); this.style.display = 'none'; } }
javascript
function () { var documentContainer = document.querySelector('.document-container'); if (documentContainer.classList.contains('backdrop-hidden')) { documentContainer.classList.remove('backdrop-hidden'); documentContainer.style.display = 'none'; } if (this.classList.contains('chart-hidden')) { this.classList.remove('chart-hidden'); this.style.display = 'none'; } }
[ "function", "(", ")", "{", "var", "documentContainer", "=", "document", ".", "querySelector", "(", "'.document-container'", ")", ";", "if", "(", "documentContainer", ".", "classList", ".", "contains", "(", "'backdrop-hidden'", ")", ")", "{", "documentContainer", ".", "classList", ".", "remove", "(", "'backdrop-hidden'", ")", ";", "documentContainer", ".", "style", ".", "display", "=", "'none'", ";", "}", "if", "(", "this", ".", "classList", ".", "contains", "(", "'chart-hidden'", ")", ")", "{", "this", ".", "classList", ".", "remove", "(", "'chart-hidden'", ")", ";", "this", ".", "style", ".", "display", "=", "'none'", ";", "}", "}" ]
Animated displaying and hiding chart
[ "Animated", "displaying", "and", "hiding", "chart" ]
f8a73deb642c7bd97bc11da8c38656abadcd19cd
https://github.com/robhil/grunt-protractor-cucumber-html-report/blob/f8a73deb642c7bd97bc11da8c38656abadcd19cd/templates/assets/js/chart.js#L105-L115
28,257
robhil/grunt-protractor-cucumber-html-report
templates/assets/js/chart.js
function () { var scenarioPassed = document.querySelectorAll('.scenario.passed').length, scenarioFailed = document.querySelectorAll('.scenario.failed').length, scenariosAmount = document.querySelectorAll('.scenario').length, passed = (scenarioPassed / scenariosAmount) * 100, failed = (scenarioFailed / scenariosAmount) * 100, statistics; statistics = { scenariosAmount: scenariosAmount, passed: Math.round(Math.floor(passed)), failed: Math.round(Math.ceil(failed)) }; return statistics; }
javascript
function () { var scenarioPassed = document.querySelectorAll('.scenario.passed').length, scenarioFailed = document.querySelectorAll('.scenario.failed').length, scenariosAmount = document.querySelectorAll('.scenario').length, passed = (scenarioPassed / scenariosAmount) * 100, failed = (scenarioFailed / scenariosAmount) * 100, statistics; statistics = { scenariosAmount: scenariosAmount, passed: Math.round(Math.floor(passed)), failed: Math.round(Math.ceil(failed)) }; return statistics; }
[ "function", "(", ")", "{", "var", "scenarioPassed", "=", "document", ".", "querySelectorAll", "(", "'.scenario.passed'", ")", ".", "length", ",", "scenarioFailed", "=", "document", ".", "querySelectorAll", "(", "'.scenario.failed'", ")", ".", "length", ",", "scenariosAmount", "=", "document", ".", "querySelectorAll", "(", "'.scenario'", ")", ".", "length", ",", "passed", "=", "(", "scenarioPassed", "/", "scenariosAmount", ")", "*", "100", ",", "failed", "=", "(", "scenarioFailed", "/", "scenariosAmount", ")", "*", "100", ",", "statistics", ";", "statistics", "=", "{", "scenariosAmount", ":", "scenariosAmount", ",", "passed", ":", "Math", ".", "round", "(", "Math", ".", "floor", "(", "passed", ")", ")", ",", "failed", ":", "Math", ".", "round", "(", "Math", ".", "ceil", "(", "failed", ")", ")", "}", ";", "return", "statistics", ";", "}" ]
Passed and failed percentage
[ "Passed", "and", "failed", "percentage" ]
f8a73deb642c7bd97bc11da8c38656abadcd19cd
https://github.com/robhil/grunt-protractor-cucumber-html-report/blob/f8a73deb642c7bd97bc11da8c38656abadcd19cd/templates/assets/js/chart.js#L149-L164
28,258
robhil/grunt-protractor-cucumber-html-report
templates/assets/js/chart.js
function () { window.scrollTo(0, 0); var chart = document.querySelector('.scenario-chart'), chartBtn = document.querySelectorAll('.btn-chart'); if (chart.style.display != 'block') { chart.style.display = 'block'; document.body.style.overflow = 'hidden'; } else { chart.classList.add('chart-hidden'); document.body.style.overflow = 'auto'; app.navigation.removeActiveClass(chartBtn); } this.toggleChartBackdrop(); }
javascript
function () { window.scrollTo(0, 0); var chart = document.querySelector('.scenario-chart'), chartBtn = document.querySelectorAll('.btn-chart'); if (chart.style.display != 'block') { chart.style.display = 'block'; document.body.style.overflow = 'hidden'; } else { chart.classList.add('chart-hidden'); document.body.style.overflow = 'auto'; app.navigation.removeActiveClass(chartBtn); } this.toggleChartBackdrop(); }
[ "function", "(", ")", "{", "window", ".", "scrollTo", "(", "0", ",", "0", ")", ";", "var", "chart", "=", "document", ".", "querySelector", "(", "'.scenario-chart'", ")", ",", "chartBtn", "=", "document", ".", "querySelectorAll", "(", "'.btn-chart'", ")", ";", "if", "(", "chart", ".", "style", ".", "display", "!=", "'block'", ")", "{", "chart", ".", "style", ".", "display", "=", "'block'", ";", "document", ".", "body", ".", "style", ".", "overflow", "=", "'hidden'", ";", "}", "else", "{", "chart", ".", "classList", ".", "add", "(", "'chart-hidden'", ")", ";", "document", ".", "body", ".", "style", ".", "overflow", "=", "'auto'", ";", "app", ".", "navigation", ".", "removeActiveClass", "(", "chartBtn", ")", ";", "}", "this", ".", "toggleChartBackdrop", "(", ")", ";", "}" ]
Displaying and hiding chart
[ "Displaying", "and", "hiding", "chart" ]
f8a73deb642c7bd97bc11da8c38656abadcd19cd
https://github.com/robhil/grunt-protractor-cucumber-html-report/blob/f8a73deb642c7bd97bc11da8c38656abadcd19cd/templates/assets/js/chart.js#L171-L184
28,259
drazisil/junit-merge
lib/index.js
parseXmlFromFile
function parseXmlFromFile(fileName) { try { var xmlFile = fs.readFileSync(fileName, "utf8"); var xmlDoc = new xmldoc.XmlDocument(xmlFile); // Single testsuite, not wrapped in a testsuites if (xmlDoc.name === "testsuite") { module.exports.testsuites = xmlDoc; module.exports.testsuiteCount = 1; } else { // Multiple testsuites, wrapped in a parent module.exports.testsuites = xmlDoc.childrenNamed("testsuite"); module.exports.testsuiteCount = module.exports.testsuites.length; } return xmlDoc; } catch (e) { if (e.code === "ENOENT") { // Bad directory return "File not found"; } // Unknown error return e; } }
javascript
function parseXmlFromFile(fileName) { try { var xmlFile = fs.readFileSync(fileName, "utf8"); var xmlDoc = new xmldoc.XmlDocument(xmlFile); // Single testsuite, not wrapped in a testsuites if (xmlDoc.name === "testsuite") { module.exports.testsuites = xmlDoc; module.exports.testsuiteCount = 1; } else { // Multiple testsuites, wrapped in a parent module.exports.testsuites = xmlDoc.childrenNamed("testsuite"); module.exports.testsuiteCount = module.exports.testsuites.length; } return xmlDoc; } catch (e) { if (e.code === "ENOENT") { // Bad directory return "File not found"; } // Unknown error return e; } }
[ "function", "parseXmlFromFile", "(", "fileName", ")", "{", "try", "{", "var", "xmlFile", "=", "fs", ".", "readFileSync", "(", "fileName", ",", "\"utf8\"", ")", ";", "var", "xmlDoc", "=", "new", "xmldoc", ".", "XmlDocument", "(", "xmlFile", ")", ";", "// Single testsuite, not wrapped in a testsuites", "if", "(", "xmlDoc", ".", "name", "===", "\"testsuite\"", ")", "{", "module", ".", "exports", ".", "testsuites", "=", "xmlDoc", ";", "module", ".", "exports", ".", "testsuiteCount", "=", "1", ";", "}", "else", "{", "// Multiple testsuites, wrapped in a parent", "module", ".", "exports", ".", "testsuites", "=", "xmlDoc", ".", "childrenNamed", "(", "\"testsuite\"", ")", ";", "module", ".", "exports", ".", "testsuiteCount", "=", "module", ".", "exports", ".", "testsuites", ".", "length", ";", "}", "return", "xmlDoc", ";", "}", "catch", "(", "e", ")", "{", "if", "(", "e", ".", "code", "===", "\"ENOENT\"", ")", "{", "// Bad directory", "return", "\"File not found\"", ";", "}", "// Unknown error", "return", "e", ";", "}", "}" ]
Read XML from file @param {string} fileName
[ "Read", "XML", "from", "file" ]
d10f6aae7057a63a36f6662852f909d4d3b7287a
https://github.com/drazisil/junit-merge/blob/d10f6aae7057a63a36f6662852f909d4d3b7287a/lib/index.js#L16-L40
28,260
drazisil/junit-merge
lib/index.js
listXmlFiles
function listXmlFiles(path, recursive) { try { var allFiles = recursive ? read(path) : fs.readdirSync(path); var xmlFiles = allFiles .map(function(file) { return fspath.join(path, file); }) // Fiter out non-files .filter(function(file) { return fs.statSync(file).isFile(); }) // Only return files ending in '.xml' .filter(function(file) { return file.slice(-4) === ".xml"; }); // No files returned if (!xmlFiles.length > 0) { return new Error("No xml files found"); } else { // Return the array of files ending in '.xml' return xmlFiles; } } catch (e) { throw e; } }
javascript
function listXmlFiles(path, recursive) { try { var allFiles = recursive ? read(path) : fs.readdirSync(path); var xmlFiles = allFiles .map(function(file) { return fspath.join(path, file); }) // Fiter out non-files .filter(function(file) { return fs.statSync(file).isFile(); }) // Only return files ending in '.xml' .filter(function(file) { return file.slice(-4) === ".xml"; }); // No files returned if (!xmlFiles.length > 0) { return new Error("No xml files found"); } else { // Return the array of files ending in '.xml' return xmlFiles; } } catch (e) { throw e; } }
[ "function", "listXmlFiles", "(", "path", ",", "recursive", ")", "{", "try", "{", "var", "allFiles", "=", "recursive", "?", "read", "(", "path", ")", ":", "fs", ".", "readdirSync", "(", "path", ")", ";", "var", "xmlFiles", "=", "allFiles", ".", "map", "(", "function", "(", "file", ")", "{", "return", "fspath", ".", "join", "(", "path", ",", "file", ")", ";", "}", ")", "// Fiter out non-files", ".", "filter", "(", "function", "(", "file", ")", "{", "return", "fs", ".", "statSync", "(", "file", ")", ".", "isFile", "(", ")", ";", "}", ")", "// Only return files ending in '.xml'", ".", "filter", "(", "function", "(", "file", ")", "{", "return", "file", ".", "slice", "(", "-", "4", ")", "===", "\".xml\"", ";", "}", ")", ";", "// No files returned", "if", "(", "!", "xmlFiles", ".", "length", ">", "0", ")", "{", "return", "new", "Error", "(", "\"No xml files found\"", ")", ";", "}", "else", "{", "// Return the array of files ending in '.xml'", "return", "xmlFiles", ";", "}", "}", "catch", "(", "e", ")", "{", "throw", "e", ";", "}", "}" ]
List all XML files in directory @param {*} path @param {*} recursive
[ "List", "all", "XML", "files", "in", "directory" ]
d10f6aae7057a63a36f6662852f909d4d3b7287a
https://github.com/drazisil/junit-merge/blob/d10f6aae7057a63a36f6662852f909d4d3b7287a/lib/index.js#L47-L73
28,261
testiumjs/testium-core
lib/init.js
extendUrlWithQuery
function extendUrlWithQuery(url, queryArgs) { if (_.isEmpty(queryArgs)) { return url; } var parts = urlLib.parse(url); var query = _.extend(qs.parse(parts.query), queryArgs); parts.search = '?' + qs.stringify(query); return urlLib.format(_.pick( parts, 'protocol', 'slashes', 'host', 'auth', 'pathname', 'search', 'hash' )); }
javascript
function extendUrlWithQuery(url, queryArgs) { if (_.isEmpty(queryArgs)) { return url; } var parts = urlLib.parse(url); var query = _.extend(qs.parse(parts.query), queryArgs); parts.search = '?' + qs.stringify(query); return urlLib.format(_.pick( parts, 'protocol', 'slashes', 'host', 'auth', 'pathname', 'search', 'hash' )); }
[ "function", "extendUrlWithQuery", "(", "url", ",", "queryArgs", ")", "{", "if", "(", "_", ".", "isEmpty", "(", "queryArgs", ")", ")", "{", "return", "url", ";", "}", "var", "parts", "=", "urlLib", ".", "parse", "(", "url", ")", ";", "var", "query", "=", "_", ".", "extend", "(", "qs", ".", "parse", "(", "parts", ".", "query", ")", ",", "queryArgs", ")", ";", "parts", ".", "search", "=", "'?'", "+", "qs", ".", "stringify", "(", "query", ")", ";", "return", "urlLib", ".", "format", "(", "_", ".", "pick", "(", "parts", ",", "'protocol'", ",", "'slashes'", ",", "'host'", ",", "'auth'", ",", "'pathname'", ",", "'search'", ",", "'hash'", ")", ")", ";", "}" ]
Retains the url fragment and query args from url, not overridden via queryArgs
[ "Retains", "the", "url", "fragment", "and", "query", "args", "from", "url", "not", "overridden", "via", "queryArgs" ]
a3c9f877ccc2ce70ce9385a858293043828fef6d
https://github.com/testiumjs/testium-core/blob/a3c9f877ccc2ce70ce9385a858293043828fef6d/lib/init.js#L48-L66
28,262
investtools/extensible-duck
src/extensible-duck.js
deriveSelectors
function deriveSelectors(selectors) { const composedSelectors = {} Object.keys(selectors).forEach(key => { const selector = selectors[key] if(selector instanceof Selector) { composedSelectors[key] = (...args) => (composedSelectors[key] = selector.extractFunction(composedSelectors))(...args) } else { composedSelectors[key] = selector } }) return composedSelectors }
javascript
function deriveSelectors(selectors) { const composedSelectors = {} Object.keys(selectors).forEach(key => { const selector = selectors[key] if(selector instanceof Selector) { composedSelectors[key] = (...args) => (composedSelectors[key] = selector.extractFunction(composedSelectors))(...args) } else { composedSelectors[key] = selector } }) return composedSelectors }
[ "function", "deriveSelectors", "(", "selectors", ")", "{", "const", "composedSelectors", "=", "{", "}", "Object", ".", "keys", "(", "selectors", ")", ".", "forEach", "(", "key", "=>", "{", "const", "selector", "=", "selectors", "[", "key", "]", "if", "(", "selector", "instanceof", "Selector", ")", "{", "composedSelectors", "[", "key", "]", "=", "(", "...", "args", ")", "=>", "(", "composedSelectors", "[", "key", "]", "=", "selector", ".", "extractFunction", "(", "composedSelectors", ")", ")", "(", "...", "args", ")", "}", "else", "{", "composedSelectors", "[", "key", "]", "=", "selector", "}", "}", ")", "return", "composedSelectors", "}" ]
Helper utility to assist in composing the selectors. Previously defined selectors can be used to derive future selectors. @param {object} selectors @returns
[ "Helper", "utility", "to", "assist", "in", "composing", "the", "selectors", ".", "Previously", "defined", "selectors", "can", "be", "used", "to", "derive", "future", "selectors", "." ]
c35ee4c2d01f333eb31124d1e818d6eb15b6c8cd
https://github.com/investtools/extensible-duck/blob/c35ee4c2d01f333eb31124d1e818d6eb15b6c8cd/src/extensible-duck.js#L135-L148
28,263
rung-tools/rung-cli
src/boilerplate.js
askQuestions
function askQuestions() { return request.get('https://app.rung.com.br/api/categories') .then(prop('body') & map(({ name, alias: value }) => ({ name, value }))) .catch(~[{ name: 'Miscellaneous', value: 'miscellaneous' }]) .then(categories => [ { name: 'name', message: 'Project name', default: getDefaultName(process.cwd()) }, { name: 'version', message: 'Version', default: '1.0.0', validate: semver.valid & Boolean }, { name: 'title', message: 'Title', default: 'Untitled' }, { name: 'description', message: 'Description' }, { name: 'category', type: 'list', message: 'Category', default: 'miscellaneous', choices: categories }, { name: 'license', message: 'license', default: 'MIT' } ]) .then(inquirer.createPromptModule()); }
javascript
function askQuestions() { return request.get('https://app.rung.com.br/api/categories') .then(prop('body') & map(({ name, alias: value }) => ({ name, value }))) .catch(~[{ name: 'Miscellaneous', value: 'miscellaneous' }]) .then(categories => [ { name: 'name', message: 'Project name', default: getDefaultName(process.cwd()) }, { name: 'version', message: 'Version', default: '1.0.0', validate: semver.valid & Boolean }, { name: 'title', message: 'Title', default: 'Untitled' }, { name: 'description', message: 'Description' }, { name: 'category', type: 'list', message: 'Category', default: 'miscellaneous', choices: categories }, { name: 'license', message: 'license', default: 'MIT' } ]) .then(inquirer.createPromptModule()); }
[ "function", "askQuestions", "(", ")", "{", "return", "request", ".", "get", "(", "'https://app.rung.com.br/api/categories'", ")", ".", "then", "(", "prop", "(", "'body'", ")", "&", "map", "(", "(", "{", "name", ",", "alias", ":", "value", "}", ")", "=>", "(", "{", "name", ",", "value", "}", ")", ")", ")", ".", "catch", "(", "~", "[", "{", "name", ":", "'Miscellaneous'", ",", "value", ":", "'miscellaneous'", "}", "]", ")", ".", "then", "(", "categories", "=>", "[", "{", "name", ":", "'name'", ",", "message", ":", "'Project name'", ",", "default", ":", "getDefaultName", "(", "process", ".", "cwd", "(", ")", ")", "}", ",", "{", "name", ":", "'version'", ",", "message", ":", "'Version'", ",", "default", ":", "'1.0.0'", ",", "validate", ":", "semver", ".", "valid", "&", "Boolean", "}", ",", "{", "name", ":", "'title'", ",", "message", ":", "'Title'", ",", "default", ":", "'Untitled'", "}", ",", "{", "name", ":", "'description'", ",", "message", ":", "'Description'", "}", ",", "{", "name", ":", "'category'", ",", "type", ":", "'list'", ",", "message", ":", "'Category'", ",", "default", ":", "'miscellaneous'", ",", "choices", ":", "categories", "}", ",", "{", "name", ":", "'license'", ",", "message", ":", "'license'", ",", "default", ":", "'MIT'", "}", "]", ")", ".", "then", "(", "inquirer", ".", "createPromptModule", "(", ")", ")", ";", "}" ]
Generate the answers from the stdin. @return {Promise}
[ "Generate", "the", "answers", "from", "the", "stdin", "." ]
c8906bb6733bdd5bcea2e9b54ed48f26ae1526d5
https://github.com/rung-tools/rung-cli/blob/c8906bb6733bdd5bcea2e9b54ed48f26ae1526d5/src/boilerplate.js#L59-L72
28,264
rung-tools/rung-cli
src/boilerplate.js
createBoilerplateFolder
function createBoilerplateFolder(answers) { return createFolder(answers.name) .tap(createFolder(`${answers.name}/info`)) .catch(~reject(new Error(`Unable to create folder ${answers.name}`))) .return(answers); }
javascript
function createBoilerplateFolder(answers) { return createFolder(answers.name) .tap(createFolder(`${answers.name}/info`)) .catch(~reject(new Error(`Unable to create folder ${answers.name}`))) .return(answers); }
[ "function", "createBoilerplateFolder", "(", "answers", ")", "{", "return", "createFolder", "(", "answers", ".", "name", ")", ".", "tap", "(", "createFolder", "(", "`", "${", "answers", ".", "name", "}", "`", ")", ")", ".", "catch", "(", "~", "reject", "(", "new", "Error", "(", "`", "${", "answers", ".", "name", "}", "`", ")", ")", ")", ".", "return", "(", "answers", ")", ";", "}" ]
Creates the folder for the boilerplate based on package name. If the folder already exists, throw an error Queria estar morta @param {Object} answers @return {Promise}
[ "Creates", "the", "folder", "for", "the", "boilerplate", "based", "on", "package", "name", ".", "If", "the", "folder", "already", "exists", "throw", "an", "error", "Queria", "estar", "morta" ]
c8906bb6733bdd5bcea2e9b54ed48f26ae1526d5
https://github.com/rung-tools/rung-cli/blob/c8906bb6733bdd5bcea2e9b54ed48f26ae1526d5/src/boilerplate.js#L82-L87
28,265
rung-tools/rung-cli
src/boilerplate.js
getInfoFiles
function getInfoFiles(answers) { const locales = ['en', 'es', 'pt_BR']; return locales | map(locale => ({ filename: path.join(answers.name, `info/${locale}.md`), content: '' })); }
javascript
function getInfoFiles(answers) { const locales = ['en', 'es', 'pt_BR']; return locales | map(locale => ({ filename: path.join(answers.name, `info/${locale}.md`), content: '' })); }
[ "function", "getInfoFiles", "(", "answers", ")", "{", "const", "locales", "=", "[", "'en'", ",", "'es'", ",", "'pt_BR'", "]", ";", "return", "locales", "|", "map", "(", "locale", "=>", "(", "{", "filename", ":", "path", ".", "join", "(", "answers", ".", "name", ",", "`", "${", "locale", "}", "`", ")", ",", "content", ":", "''", "}", ")", ")", ";", "}" ]
Content about info files @param {Object} answers @return {Object}
[ "Content", "about", "info", "files" ]
c8906bb6733bdd5bcea2e9b54ed48f26ae1526d5
https://github.com/rung-tools/rung-cli/blob/c8906bb6733bdd5bcea2e9b54ed48f26ae1526d5/src/boilerplate.js#L132-L136
28,266
rung-tools/rung-cli
src/boilerplate.js
getIndexFile
function getIndexFile(answers) { const content = format(` import { create } from 'rung-sdk'; import { String as Text } from 'rung-cli/dist/types'; function render(name) { return <b>{ _('Hello {{name}}', { name }) }</b>; } function main(context) { const { name } = context.params; return { alerts: [{ title: _('Welcome'), content: render(name), resources: [] }] }; } const params = { name: { description: _('What is your name?'), type: Text } }; export default create(main, { params, primaryKey: true, title: _(${JSON.stringify(answers.title)}), description: _(${JSON.stringify(answers.description)}), preview: render('Trixie') }); `); return { filename: path.join(answers.name, 'index.js'), content }; }
javascript
function getIndexFile(answers) { const content = format(` import { create } from 'rung-sdk'; import { String as Text } from 'rung-cli/dist/types'; function render(name) { return <b>{ _('Hello {{name}}', { name }) }</b>; } function main(context) { const { name } = context.params; return { alerts: [{ title: _('Welcome'), content: render(name), resources: [] }] }; } const params = { name: { description: _('What is your name?'), type: Text } }; export default create(main, { params, primaryKey: true, title: _(${JSON.stringify(answers.title)}), description: _(${JSON.stringify(answers.description)}), preview: render('Trixie') }); `); return { filename: path.join(answers.name, 'index.js'), content }; }
[ "function", "getIndexFile", "(", "answers", ")", "{", "const", "content", "=", "format", "(", "`", "${", "JSON", ".", "stringify", "(", "answers", ".", "title", ")", "}", "${", "JSON", ".", "stringify", "(", "answers", ".", "description", ")", "}", "`", ")", ";", "return", "{", "filename", ":", "path", ".", "join", "(", "answers", ".", "name", ",", "'index.js'", ")", ",", "content", "}", ";", "}" ]
Content about index.js file @param {Object} answers @return {Object}
[ "Content", "about", "index", ".", "js", "file" ]
c8906bb6733bdd5bcea2e9b54ed48f26ae1526d5
https://github.com/rung-tools/rung-cli/blob/c8906bb6733bdd5bcea2e9b54ed48f26ae1526d5/src/boilerplate.js#L144-L181
28,267
rung-tools/rung-cli
src/publish.js
fetchRungApi
function fetchRungApi() { const envApi = process.env.RUNG_API; if (isNil(envApi)) { return 'https://app.rung.com.br/api'; } if (!isURL(envApi)) { emitWarning(`invalid API for Rung: ${JSON.stringify(envApi)}`); } return envApi; }
javascript
function fetchRungApi() { const envApi = process.env.RUNG_API; if (isNil(envApi)) { return 'https://app.rung.com.br/api'; } if (!isURL(envApi)) { emitWarning(`invalid API for Rung: ${JSON.stringify(envApi)}`); } return envApi; }
[ "function", "fetchRungApi", "(", ")", "{", "const", "envApi", "=", "process", ".", "env", ".", "RUNG_API", ";", "if", "(", "isNil", "(", "envApi", ")", ")", "{", "return", "'https://app.rung.com.br/api'", ";", "}", "if", "(", "!", "isURL", "(", "envApi", ")", ")", "{", "emitWarning", "(", "`", "${", "JSON", ".", "stringify", "(", "envApi", ")", "}", "`", ")", ";", "}", "return", "envApi", ";", "}" ]
Returns the Rung API URL. Emits a warning when the URL is possibly invalid @return {String}
[ "Returns", "the", "Rung", "API", "URL", ".", "Emits", "a", "warning", "when", "the", "URL", "is", "possibly", "invalid" ]
c8906bb6733bdd5bcea2e9b54ed48f26ae1526d5
https://github.com/rung-tools/rung-cli/blob/c8906bb6733bdd5bcea2e9b54ed48f26ae1526d5/src/publish.js#L20-L32
28,268
rung-tools/rung-cli
src/publish.js
resolveInputFile
function resolveInputFile(args) { const { file } = args; return file ? resolve(path.resolve(file)) : build(args); }
javascript
function resolveInputFile(args) { const { file } = args; return file ? resolve(path.resolve(file)) : build(args); }
[ "function", "resolveInputFile", "(", "args", ")", "{", "const", "{", "file", "}", "=", "args", ";", "return", "file", "?", "resolve", "(", "path", ".", "resolve", "(", "file", ")", ")", ":", "build", "(", "args", ")", ";", "}" ]
Builds or uses the passed file to publication @param {Object} args @return {Promise}
[ "Builds", "or", "uses", "the", "passed", "file", "to", "publication" ]
c8906bb6733bdd5bcea2e9b54ed48f26ae1526d5
https://github.com/rung-tools/rung-cli/blob/c8906bb6733bdd5bcea2e9b54ed48f26ae1526d5/src/publish.js#L52-L55
28,269
rung-tools/rung-cli
src/compiler.js
compileProps
function compileProps(props) { const transformKey = when(equals('className'), ~'class'); const transformValue = ifElse(type & equals('Object'), compileCSS, unary(JSON.stringify)); const result = props | toPairs | map(([key, value]) => `${transformKey(key)}=${transformValue(value)}`) | join(' '); return result.length === 0 ? '' : ` ${result}`; }
javascript
function compileProps(props) { const transformKey = when(equals('className'), ~'class'); const transformValue = ifElse(type & equals('Object'), compileCSS, unary(JSON.stringify)); const result = props | toPairs | map(([key, value]) => `${transformKey(key)}=${transformValue(value)}`) | join(' '); return result.length === 0 ? '' : ` ${result}`; }
[ "function", "compileProps", "(", "props", ")", "{", "const", "transformKey", "=", "when", "(", "equals", "(", "'className'", ")", ",", "~", "'class'", ")", ";", "const", "transformValue", "=", "ifElse", "(", "type", "&", "equals", "(", "'Object'", ")", ",", "compileCSS", ",", "unary", "(", "JSON", ".", "stringify", ")", ")", ";", "const", "result", "=", "props", "|", "toPairs", "|", "map", "(", "(", "[", "key", ",", "value", "]", ")", "=>", "`", "${", "transformKey", "(", "key", ")", "}", "${", "transformValue", "(", "value", ")", "}", "`", ")", "|", "join", "(", "' '", ")", ";", "return", "result", ".", "length", "===", "0", "?", "''", ":", "`", "${", "result", "}", "`", ";", "}" ]
Generates HTML string for element properties @param {Object} props @return {String}
[ "Generates", "HTML", "string", "for", "element", "properties" ]
c8906bb6733bdd5bcea2e9b54ed48f26ae1526d5
https://github.com/rung-tools/rung-cli/blob/c8906bb6733bdd5bcea2e9b54ed48f26ae1526d5/src/compiler.js#L33-L44
28,270
rung-tools/rung-cli
src/compiler.js
compileSelfClosingTag
function compileSelfClosingTag(tag, props) { const compiledProps = compileProps(props); return contains(tag, ['br', 'hr', 'img']) ? `<${tag}${compiledProps} />` : `<${tag}${compiledProps}></${tag}>`; }
javascript
function compileSelfClosingTag(tag, props) { const compiledProps = compileProps(props); return contains(tag, ['br', 'hr', 'img']) ? `<${tag}${compiledProps} />` : `<${tag}${compiledProps}></${tag}>`; }
[ "function", "compileSelfClosingTag", "(", "tag", ",", "props", ")", "{", "const", "compiledProps", "=", "compileProps", "(", "props", ")", ";", "return", "contains", "(", "tag", ",", "[", "'br'", ",", "'hr'", ",", "'img'", "]", ")", "?", "`", "${", "tag", "}", "${", "compiledProps", "}", "`", ":", "`", "${", "tag", "}", "${", "compiledProps", "}", "${", "tag", "}", "`", ";", "}" ]
Compiles a self-closing tag, dealing with elements that may or not be self-closing @param {String} tag - JSX component name @param {Object} props - Element properties
[ "Compiles", "a", "self", "-", "closing", "tag", "dealing", "with", "elements", "that", "may", "or", "not", "be", "self", "-", "closing" ]
c8906bb6733bdd5bcea2e9b54ed48f26ae1526d5
https://github.com/rung-tools/rung-cli/blob/c8906bb6733bdd5bcea2e9b54ed48f26ae1526d5/src/compiler.js#L53-L59
28,271
iuap-design/tinper-neoui-grid
vendor/uui/js/u-ui.js
function () { if (u.hasClass(this._header, this._CssClasses.IS_ANIMATING)) { return; } if (this._content.scrollTop > 0 && !u.hasClass(this._header, this._CssClasses.IS_COMPACT)) { u.addClass(this._header, this._CssClasses.CASTING_SHADOW) .addClass(this._header, this._CssClasses.IS_COMPACT) .addClass(this._header, this._CssClasses.IS_ANIMATING); } else if (this._content.scrollTop <= 0 && u.hasClass(this._header, this._CssClasses.IS_COMPACT)) { u.removeClass(this._header, this._CssClasses.CASTING_SHADOW) .removeClass(this._header, this._CssClasses.IS_COMPACT) .addClass(this._header, this._CssClasses.IS_ANIMATING); } }
javascript
function () { if (u.hasClass(this._header, this._CssClasses.IS_ANIMATING)) { return; } if (this._content.scrollTop > 0 && !u.hasClass(this._header, this._CssClasses.IS_COMPACT)) { u.addClass(this._header, this._CssClasses.CASTING_SHADOW) .addClass(this._header, this._CssClasses.IS_COMPACT) .addClass(this._header, this._CssClasses.IS_ANIMATING); } else if (this._content.scrollTop <= 0 && u.hasClass(this._header, this._CssClasses.IS_COMPACT)) { u.removeClass(this._header, this._CssClasses.CASTING_SHADOW) .removeClass(this._header, this._CssClasses.IS_COMPACT) .addClass(this._header, this._CssClasses.IS_ANIMATING); } }
[ "function", "(", ")", "{", "if", "(", "u", ".", "hasClass", "(", "this", ".", "_header", ",", "this", ".", "_CssClasses", ".", "IS_ANIMATING", ")", ")", "{", "return", ";", "}", "if", "(", "this", ".", "_content", ".", "scrollTop", ">", "0", "&&", "!", "u", ".", "hasClass", "(", "this", ".", "_header", ",", "this", ".", "_CssClasses", ".", "IS_COMPACT", ")", ")", "{", "u", ".", "addClass", "(", "this", ".", "_header", ",", "this", ".", "_CssClasses", ".", "CASTING_SHADOW", ")", ".", "addClass", "(", "this", ".", "_header", ",", "this", ".", "_CssClasses", ".", "IS_COMPACT", ")", ".", "addClass", "(", "this", ".", "_header", ",", "this", ".", "_CssClasses", ".", "IS_ANIMATING", ")", ";", "}", "else", "if", "(", "this", ".", "_content", ".", "scrollTop", "<=", "0", "&&", "u", ".", "hasClass", "(", "this", ".", "_header", ",", "this", ".", "_CssClasses", ".", "IS_COMPACT", ")", ")", "{", "u", ".", "removeClass", "(", "this", ".", "_header", ",", "this", ".", "_CssClasses", ".", "CASTING_SHADOW", ")", ".", "removeClass", "(", "this", ".", "_header", ",", "this", ".", "_CssClasses", ".", "IS_COMPACT", ")", ".", "addClass", "(", "this", ".", "_header", ",", "this", ".", "_CssClasses", ".", "IS_ANIMATING", ")", ";", "}", "}" ]
Handles scrolling on the content. @private
[ "Handles", "scrolling", "on", "the", "content", "." ]
24d392eb460beede997187593982952a1af2cfcc
https://github.com/iuap-design/tinper-neoui-grid/blob/24d392eb460beede997187593982952a1af2cfcc/vendor/uui/js/u-ui.js#L4051-L4065
28,272
iuap-design/tinper-neoui-grid
vendor/uui/js/u-ui.js
function () { if(u.isIE8 || u.isIE9){ this._screenSizeMediaQuery = {}; var w = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth; if(w > 1024) this._screenSizeMediaQuery.matches = false; else this._screenSizeMediaQuery.matches = true; } if (this._screenSizeMediaQuery.matches) { u.addClass(this.element, this._CssClasses.IS_SMALL_SCREEN); } else { u.removeClass(this.element, this._CssClasses.IS_SMALL_SCREEN); // Collapse drawer (if any) when moving to a large screen size. if (this._drawer) { u.removeClass(this._drawer, this._CssClasses.IS_DRAWER_OPEN); u.removeClass(this._obfuscator, this._CssClasses.IS_DRAWER_OPEN); } } }
javascript
function () { if(u.isIE8 || u.isIE9){ this._screenSizeMediaQuery = {}; var w = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth; if(w > 1024) this._screenSizeMediaQuery.matches = false; else this._screenSizeMediaQuery.matches = true; } if (this._screenSizeMediaQuery.matches) { u.addClass(this.element, this._CssClasses.IS_SMALL_SCREEN); } else { u.removeClass(this.element, this._CssClasses.IS_SMALL_SCREEN); // Collapse drawer (if any) when moving to a large screen size. if (this._drawer) { u.removeClass(this._drawer, this._CssClasses.IS_DRAWER_OPEN); u.removeClass(this._obfuscator, this._CssClasses.IS_DRAWER_OPEN); } } }
[ "function", "(", ")", "{", "if", "(", "u", ".", "isIE8", "||", "u", ".", "isIE9", ")", "{", "this", ".", "_screenSizeMediaQuery", "=", "{", "}", ";", "var", "w", "=", "window", ".", "innerWidth", "||", "document", ".", "documentElement", ".", "clientWidth", "||", "document", ".", "body", ".", "clientWidth", ";", "if", "(", "w", ">", "1024", ")", "this", ".", "_screenSizeMediaQuery", ".", "matches", "=", "false", ";", "else", "this", ".", "_screenSizeMediaQuery", ".", "matches", "=", "true", ";", "}", "if", "(", "this", ".", "_screenSizeMediaQuery", ".", "matches", ")", "{", "u", ".", "addClass", "(", "this", ".", "element", ",", "this", ".", "_CssClasses", ".", "IS_SMALL_SCREEN", ")", ";", "}", "else", "{", "u", ".", "removeClass", "(", "this", ".", "element", ",", "this", ".", "_CssClasses", ".", "IS_SMALL_SCREEN", ")", ";", "// Collapse drawer (if any) when moving to a large screen size.", "if", "(", "this", ".", "_drawer", ")", "{", "u", ".", "removeClass", "(", "this", ".", "_drawer", ",", "this", ".", "_CssClasses", ".", "IS_DRAWER_OPEN", ")", ";", "u", ".", "removeClass", "(", "this", ".", "_obfuscator", ",", "this", ".", "_CssClasses", ".", "IS_DRAWER_OPEN", ")", ";", "}", "}", "}" ]
Handles changes in screen size. @private
[ "Handles", "changes", "in", "screen", "size", "." ]
24d392eb460beede997187593982952a1af2cfcc
https://github.com/iuap-design/tinper-neoui-grid/blob/24d392eb460beede997187593982952a1af2cfcc/vendor/uui/js/u-ui.js#L4073-L4092
28,273
iuap-design/tinper-neoui-grid
vendor/uui/js/u-ui.js
function () { u.toggleClass(this._drawer, this._CssClasses.IS_DRAWER_OPEN); u.toggleClass(this._obfuscator, this._CssClasses.IS_DRAWER_OPEN); }
javascript
function () { u.toggleClass(this._drawer, this._CssClasses.IS_DRAWER_OPEN); u.toggleClass(this._obfuscator, this._CssClasses.IS_DRAWER_OPEN); }
[ "function", "(", ")", "{", "u", ".", "toggleClass", "(", "this", ".", "_drawer", ",", "this", ".", "_CssClasses", ".", "IS_DRAWER_OPEN", ")", ";", "u", ".", "toggleClass", "(", "this", ".", "_obfuscator", ",", "this", ".", "_CssClasses", ".", "IS_DRAWER_OPEN", ")", ";", "}" ]
Handles toggling of the drawer. @private
[ "Handles", "toggling", "of", "the", "drawer", "." ]
24d392eb460beede997187593982952a1af2cfcc
https://github.com/iuap-design/tinper-neoui-grid/blob/24d392eb460beede997187593982952a1af2cfcc/vendor/uui/js/u-ui.js#L4098-L4101
28,274
iuap-design/tinper-neoui-grid
vendor/uui/js/u-ui.js
function () { if (u.hasClass(this._header, this._CssClasses.IS_COMPACT)) { u.removeClass(this._header, this._CssClasses.IS_COMPACT); u.addClass(this._header, this._CssClasses.IS_ANIMATING); } }
javascript
function () { if (u.hasClass(this._header, this._CssClasses.IS_COMPACT)) { u.removeClass(this._header, this._CssClasses.IS_COMPACT); u.addClass(this._header, this._CssClasses.IS_ANIMATING); } }
[ "function", "(", ")", "{", "if", "(", "u", ".", "hasClass", "(", "this", ".", "_header", ",", "this", ".", "_CssClasses", ".", "IS_COMPACT", ")", ")", "{", "u", ".", "removeClass", "(", "this", ".", "_header", ",", "this", ".", "_CssClasses", ".", "IS_COMPACT", ")", ";", "u", ".", "addClass", "(", "this", ".", "_header", ",", "this", ".", "_CssClasses", ".", "IS_ANIMATING", ")", ";", "}", "}" ]
Handles expanding the header on click @private
[ "Handles", "expanding", "the", "header", "on", "click" ]
24d392eb460beede997187593982952a1af2cfcc
https://github.com/iuap-design/tinper-neoui-grid/blob/24d392eb460beede997187593982952a1af2cfcc/vendor/uui/js/u-ui.js#L4115-L4120
28,275
iuap-design/tinper-neoui-grid
vendor/uui/js/u-ui.js
function () { if (this._input.disabled) { u.addClass(this.element, this._CssClasses.IS_DISABLED); } else { u.removeClass(this.element, this._CssClasses.IS_DISABLED); } }
javascript
function () { if (this._input.disabled) { u.addClass(this.element, this._CssClasses.IS_DISABLED); } else { u.removeClass(this.element, this._CssClasses.IS_DISABLED); } }
[ "function", "(", ")", "{", "if", "(", "this", ".", "_input", ".", "disabled", ")", "{", "u", ".", "addClass", "(", "this", ".", "element", ",", "this", ".", "_CssClasses", ".", "IS_DISABLED", ")", ";", "}", "else", "{", "u", ".", "removeClass", "(", "this", ".", "element", ",", "this", ".", "_CssClasses", ".", "IS_DISABLED", ")", ";", "}", "}" ]
Public methods. Check the disabled state and update field accordingly. @public
[ "Public", "methods", ".", "Check", "the", "disabled", "state", "and", "update", "field", "accordingly", "." ]
24d392eb460beede997187593982952a1af2cfcc
https://github.com/iuap-design/tinper-neoui-grid/blob/24d392eb460beede997187593982952a1af2cfcc/vendor/uui/js/u-ui.js#L4431-L4437
28,276
iuap-design/tinper-neoui-grid
vendor/uui/js/u-ui.js
function () { if (this._input.value && this._input.value.length > 0) { u.addClass(this.element, this._CssClasses.IS_DIRTY); } else { u.removeClass(this.element, this._CssClasses.IS_DIRTY); } }
javascript
function () { if (this._input.value && this._input.value.length > 0) { u.addClass(this.element, this._CssClasses.IS_DIRTY); } else { u.removeClass(this.element, this._CssClasses.IS_DIRTY); } }
[ "function", "(", ")", "{", "if", "(", "this", ".", "_input", ".", "value", "&&", "this", ".", "_input", ".", "value", ".", "length", ">", "0", ")", "{", "u", ".", "addClass", "(", "this", ".", "element", ",", "this", ".", "_CssClasses", ".", "IS_DIRTY", ")", ";", "}", "else", "{", "u", ".", "removeClass", "(", "this", ".", "element", ",", "this", ".", "_CssClasses", ".", "IS_DIRTY", ")", ";", "}", "}" ]
Check the dirty state and update field accordingly. @public
[ "Check", "the", "dirty", "state", "and", "update", "field", "accordingly", "." ]
24d392eb460beede997187593982952a1af2cfcc
https://github.com/iuap-design/tinper-neoui-grid/blob/24d392eb460beede997187593982952a1af2cfcc/vendor/uui/js/u-ui.js#L4457-L4463
28,277
iuap-design/tinper-neoui-grid
vendor/uui/js/u-ui.js
function (evt) { if (this.element && this._container && this.for_element) { var items = this.element.querySelectorAll('.u-menu-item:not([disabled])'); if (items && items.length > 0 && u.hasClass(this._container, 'is-visible')) { if (evt.keyCode === this._Keycodes.UP_ARROW) { u.stopEvent(evt); // evt.preventDefault(); items[items.length - 1].focus(); } else if (evt.keyCode === this._Keycodes.DOWN_ARROW) { u.stopEvent(evt); // evt.preventDefault(); items[0].focus(); } } } }
javascript
function (evt) { if (this.element && this._container && this.for_element) { var items = this.element.querySelectorAll('.u-menu-item:not([disabled])'); if (items && items.length > 0 && u.hasClass(this._container, 'is-visible')) { if (evt.keyCode === this._Keycodes.UP_ARROW) { u.stopEvent(evt); // evt.preventDefault(); items[items.length - 1].focus(); } else if (evt.keyCode === this._Keycodes.DOWN_ARROW) { u.stopEvent(evt); // evt.preventDefault(); items[0].focus(); } } } }
[ "function", "(", "evt", ")", "{", "if", "(", "this", ".", "element", "&&", "this", ".", "_container", "&&", "this", ".", "for_element", ")", "{", "var", "items", "=", "this", ".", "element", ".", "querySelectorAll", "(", "'.u-menu-item:not([disabled])'", ")", ";", "if", "(", "items", "&&", "items", ".", "length", ">", "0", "&&", "u", ".", "hasClass", "(", "this", ".", "_container", ",", "'is-visible'", ")", ")", "{", "if", "(", "evt", ".", "keyCode", "===", "this", ".", "_Keycodes", ".", "UP_ARROW", ")", "{", "u", ".", "stopEvent", "(", "evt", ")", ";", "// evt.preventDefault();", "items", "[", "items", ".", "length", "-", "1", "]", ".", "focus", "(", ")", ";", "}", "else", "if", "(", "evt", ".", "keyCode", "===", "this", ".", "_Keycodes", ".", "DOWN_ARROW", ")", "{", "u", ".", "stopEvent", "(", "evt", ")", ";", "// evt.preventDefault();", "items", "[", "0", "]", ".", "focus", "(", ")", ";", "}", "}", "}", "}" ]
Handles a keyboard event on the "for" element. @param {Event} evt The event that fired. @private
[ "Handles", "a", "keyboard", "event", "on", "the", "for", "element", "." ]
24d392eb460beede997187593982952a1af2cfcc
https://github.com/iuap-design/tinper-neoui-grid/blob/24d392eb460beede997187593982952a1af2cfcc/vendor/uui/js/u-ui.js#L4632-L4648
28,278
iuap-design/tinper-neoui-grid
vendor/uui/js/u-ui.js
function (evt) { if (this.element && this._container) { var items = this.element.querySelectorAll('.u-menu-item:not([disabled])'); if (items && items.length > 0 && u.hasClass(this._container, 'is-visible')) { var currentIndex = Array.prototype.slice.call(items).indexOf(evt.target); if (evt.keyCode === this._Keycodes.UP_ARROW) { u.stopEvent(evt); // evt.preventDefault(); if (currentIndex > 0) { items[currentIndex - 1].focus(); } else { items[items.length - 1].focus(); } } else if (evt.keyCode === this._Keycodes.DOWN_ARROW) { u.stopEvent(evt); // evt.preventDefault(); if (items.length > currentIndex + 1) { items[currentIndex + 1].focus(); } else { items[0].focus(); } } else if (evt.keyCode === this._Keycodes.SPACE || evt.keyCode === this._Keycodes.ENTER) { u.stopEvent(evt); // evt.preventDefault(); // Send mousedown and mouseup to trigger ripple. var e = new MouseEvent('mousedown'); evt.target.dispatchEvent(e); e = new MouseEvent('mouseup'); evt.target.dispatchEvent(e); // Send click. evt.target.click(); } else if (evt.keyCode === this._Keycodes.ESCAPE) { u.stopEvent(evt); // evt.preventDefault(); this.hide(); } } } }
javascript
function (evt) { if (this.element && this._container) { var items = this.element.querySelectorAll('.u-menu-item:not([disabled])'); if (items && items.length > 0 && u.hasClass(this._container, 'is-visible')) { var currentIndex = Array.prototype.slice.call(items).indexOf(evt.target); if (evt.keyCode === this._Keycodes.UP_ARROW) { u.stopEvent(evt); // evt.preventDefault(); if (currentIndex > 0) { items[currentIndex - 1].focus(); } else { items[items.length - 1].focus(); } } else if (evt.keyCode === this._Keycodes.DOWN_ARROW) { u.stopEvent(evt); // evt.preventDefault(); if (items.length > currentIndex + 1) { items[currentIndex + 1].focus(); } else { items[0].focus(); } } else if (evt.keyCode === this._Keycodes.SPACE || evt.keyCode === this._Keycodes.ENTER) { u.stopEvent(evt); // evt.preventDefault(); // Send mousedown and mouseup to trigger ripple. var e = new MouseEvent('mousedown'); evt.target.dispatchEvent(e); e = new MouseEvent('mouseup'); evt.target.dispatchEvent(e); // Send click. evt.target.click(); } else if (evt.keyCode === this._Keycodes.ESCAPE) { u.stopEvent(evt); // evt.preventDefault(); this.hide(); } } } }
[ "function", "(", "evt", ")", "{", "if", "(", "this", ".", "element", "&&", "this", ".", "_container", ")", "{", "var", "items", "=", "this", ".", "element", ".", "querySelectorAll", "(", "'.u-menu-item:not([disabled])'", ")", ";", "if", "(", "items", "&&", "items", ".", "length", ">", "0", "&&", "u", ".", "hasClass", "(", "this", ".", "_container", ",", "'is-visible'", ")", ")", "{", "var", "currentIndex", "=", "Array", ".", "prototype", ".", "slice", ".", "call", "(", "items", ")", ".", "indexOf", "(", "evt", ".", "target", ")", ";", "if", "(", "evt", ".", "keyCode", "===", "this", ".", "_Keycodes", ".", "UP_ARROW", ")", "{", "u", ".", "stopEvent", "(", "evt", ")", ";", "// evt.preventDefault();", "if", "(", "currentIndex", ">", "0", ")", "{", "items", "[", "currentIndex", "-", "1", "]", ".", "focus", "(", ")", ";", "}", "else", "{", "items", "[", "items", ".", "length", "-", "1", "]", ".", "focus", "(", ")", ";", "}", "}", "else", "if", "(", "evt", ".", "keyCode", "===", "this", ".", "_Keycodes", ".", "DOWN_ARROW", ")", "{", "u", ".", "stopEvent", "(", "evt", ")", ";", "// evt.preventDefault();", "if", "(", "items", ".", "length", ">", "currentIndex", "+", "1", ")", "{", "items", "[", "currentIndex", "+", "1", "]", ".", "focus", "(", ")", ";", "}", "else", "{", "items", "[", "0", "]", ".", "focus", "(", ")", ";", "}", "}", "else", "if", "(", "evt", ".", "keyCode", "===", "this", ".", "_Keycodes", ".", "SPACE", "||", "evt", ".", "keyCode", "===", "this", ".", "_Keycodes", ".", "ENTER", ")", "{", "u", ".", "stopEvent", "(", "evt", ")", ";", "// evt.preventDefault();", "// Send mousedown and mouseup to trigger ripple.", "var", "e", "=", "new", "MouseEvent", "(", "'mousedown'", ")", ";", "evt", ".", "target", ".", "dispatchEvent", "(", "e", ")", ";", "e", "=", "new", "MouseEvent", "(", "'mouseup'", ")", ";", "evt", ".", "target", ".", "dispatchEvent", "(", "e", ")", ";", "// Send click.", "evt", ".", "target", ".", "click", "(", ")", ";", "}", "else", "if", "(", "evt", ".", "keyCode", "===", "this", ".", "_Keycodes", ".", "ESCAPE", ")", "{", "u", ".", "stopEvent", "(", "evt", ")", ";", "// evt.preventDefault();", "this", ".", "hide", "(", ")", ";", "}", "}", "}", "}" ]
Handles a keyboard event on an item. @param {Event} evt The event that fired. @private
[ "Handles", "a", "keyboard", "event", "on", "an", "item", "." ]
24d392eb460beede997187593982952a1af2cfcc
https://github.com/iuap-design/tinper-neoui-grid/blob/24d392eb460beede997187593982952a1af2cfcc/vendor/uui/js/u-ui.js#L4655-L4696
28,279
iuap-design/tinper-neoui-grid
vendor/uui/js/u-ui.js
function (evt) { if (evt.target.hasAttribute('disabled')) { u.stopEvent(evt); // evt.stopPropagation(); } else { // Wait some time before closing menu, so the user can see the ripple. this._closing = true; window.setTimeout(function (evt) { this.hide(); this._closing = false; }.bind(this), 150); } }
javascript
function (evt) { if (evt.target.hasAttribute('disabled')) { u.stopEvent(evt); // evt.stopPropagation(); } else { // Wait some time before closing menu, so the user can see the ripple. this._closing = true; window.setTimeout(function (evt) { this.hide(); this._closing = false; }.bind(this), 150); } }
[ "function", "(", "evt", ")", "{", "if", "(", "evt", ".", "target", ".", "hasAttribute", "(", "'disabled'", ")", ")", "{", "u", ".", "stopEvent", "(", "evt", ")", ";", "// evt.stopPropagation();", "}", "else", "{", "// Wait some time before closing menu, so the user can see the ripple.", "this", ".", "_closing", "=", "true", ";", "window", ".", "setTimeout", "(", "function", "(", "evt", ")", "{", "this", ".", "hide", "(", ")", ";", "this", ".", "_closing", "=", "false", ";", "}", ".", "bind", "(", "this", ")", ",", "150", ")", ";", "}", "}" ]
Handles a click event on an item. @param {Event} evt The event that fired. @private
[ "Handles", "a", "click", "event", "on", "an", "item", "." ]
24d392eb460beede997187593982952a1af2cfcc
https://github.com/iuap-design/tinper-neoui-grid/blob/24d392eb460beede997187593982952a1af2cfcc/vendor/uui/js/u-ui.js#L4703-L4715
28,280
iuap-design/tinper-neoui-grid
vendor/uui/js/u-ui.js
function () { var cleanup = function () { u.off(this.element,'transitionend', cleanup); // this.element.removeEventListener('transitionend', cleanup); u.off(this.element,'webkitTransitionEnd', cleanup); // this.element.removeEventListener('webkitTransitionEnd', cleanup); u.removeClass(this.element, 'is-animating'); }.bind(this); // Remove animation class once the transition is done. u.on(this.element,'transitionend', cleanup); // this.element.addEventListener('transitionend', cleanup); u.on(this.element,'webkitTransitionEnd', cleanup); // this.element.addEventListener('webkitTransitionEnd', cleanup); }
javascript
function () { var cleanup = function () { u.off(this.element,'transitionend', cleanup); // this.element.removeEventListener('transitionend', cleanup); u.off(this.element,'webkitTransitionEnd', cleanup); // this.element.removeEventListener('webkitTransitionEnd', cleanup); u.removeClass(this.element, 'is-animating'); }.bind(this); // Remove animation class once the transition is done. u.on(this.element,'transitionend', cleanup); // this.element.addEventListener('transitionend', cleanup); u.on(this.element,'webkitTransitionEnd', cleanup); // this.element.addEventListener('webkitTransitionEnd', cleanup); }
[ "function", "(", ")", "{", "var", "cleanup", "=", "function", "(", ")", "{", "u", ".", "off", "(", "this", ".", "element", ",", "'transitionend'", ",", "cleanup", ")", ";", "// this.element.removeEventListener('transitionend', cleanup);", "u", ".", "off", "(", "this", ".", "element", ",", "'webkitTransitionEnd'", ",", "cleanup", ")", ";", "// this.element.removeEventListener('webkitTransitionEnd', cleanup);", "u", ".", "removeClass", "(", "this", ".", "element", ",", "'is-animating'", ")", ";", "}", ".", "bind", "(", "this", ")", ";", "// Remove animation class once the transition is done.", "u", ".", "on", "(", "this", ".", "element", ",", "'transitionend'", ",", "cleanup", ")", ";", "// this.element.addEventListener('transitionend', cleanup);", "u", ".", "on", "(", "this", ".", "element", ",", "'webkitTransitionEnd'", ",", "cleanup", ")", ";", "// this.element.addEventListener('webkitTransitionEnd', cleanup);", "}" ]
Adds an event listener to clean up after the animation ends. @private
[ "Adds", "an", "event", "listener", "to", "clean", "up", "after", "the", "animation", "ends", "." ]
24d392eb460beede997187593982952a1af2cfcc
https://github.com/iuap-design/tinper-neoui-grid/blob/24d392eb460beede997187593982952a1af2cfcc/vendor/uui/js/u-ui.js#L4752-L4766
28,281
iuap-design/tinper-neoui-grid
vendor/uui/js/u-ui.js
function () { if (this.element && this._container && this._outline) { var items = this.element.querySelectorAll('.u-menu-item'); // Remove all transition delays; menu items fade out concurrently. for (var i = 0; i < items.length; i++) { items[i].style.transitionDelay = null; } // Measure the inner element. var rect = this.element.getBoundingClientRect(); var height = rect.height; var width = rect.width; if(!width){ var left = rect.left; var right = rect.right; width = right - left; } if(!height){ var top = rect.top; var bottom = rect.bottom; height = bottom - top; } // Turn on animation, and apply the final clip. Also make invisible. // This triggers the transitions. u.addClass(this.element, 'is-animating'); this._applyClip(height, width); u.removeClass(this._container, 'is-visible'); // Clean up after the animation is complete. this._addAnimationEndListener(); } }
javascript
function () { if (this.element && this._container && this._outline) { var items = this.element.querySelectorAll('.u-menu-item'); // Remove all transition delays; menu items fade out concurrently. for (var i = 0; i < items.length; i++) { items[i].style.transitionDelay = null; } // Measure the inner element. var rect = this.element.getBoundingClientRect(); var height = rect.height; var width = rect.width; if(!width){ var left = rect.left; var right = rect.right; width = right - left; } if(!height){ var top = rect.top; var bottom = rect.bottom; height = bottom - top; } // Turn on animation, and apply the final clip. Also make invisible. // This triggers the transitions. u.addClass(this.element, 'is-animating'); this._applyClip(height, width); u.removeClass(this._container, 'is-visible'); // Clean up after the animation is complete. this._addAnimationEndListener(); } }
[ "function", "(", ")", "{", "if", "(", "this", ".", "element", "&&", "this", ".", "_container", "&&", "this", ".", "_outline", ")", "{", "var", "items", "=", "this", ".", "element", ".", "querySelectorAll", "(", "'.u-menu-item'", ")", ";", "// Remove all transition delays; menu items fade out concurrently.", "for", "(", "var", "i", "=", "0", ";", "i", "<", "items", ".", "length", ";", "i", "++", ")", "{", "items", "[", "i", "]", ".", "style", ".", "transitionDelay", "=", "null", ";", "}", "// Measure the inner element.", "var", "rect", "=", "this", ".", "element", ".", "getBoundingClientRect", "(", ")", ";", "var", "height", "=", "rect", ".", "height", ";", "var", "width", "=", "rect", ".", "width", ";", "if", "(", "!", "width", ")", "{", "var", "left", "=", "rect", ".", "left", ";", "var", "right", "=", "rect", ".", "right", ";", "width", "=", "right", "-", "left", ";", "}", "if", "(", "!", "height", ")", "{", "var", "top", "=", "rect", ".", "top", ";", "var", "bottom", "=", "rect", ".", "bottom", ";", "height", "=", "bottom", "-", "top", ";", "}", "// Turn on animation, and apply the final clip. Also make invisible.", "// This triggers the transitions.", "u", ".", "addClass", "(", "this", ".", "element", ",", "'is-animating'", ")", ";", "this", ".", "_applyClip", "(", "height", ",", "width", ")", ";", "u", ".", "removeClass", "(", "this", ".", "_container", ",", "'is-visible'", ")", ";", "// Clean up after the animation is complete.", "this", ".", "_addAnimationEndListener", "(", ")", ";", "}", "}" ]
Hides the menu. @public
[ "Hides", "the", "menu", "." ]
24d392eb460beede997187593982952a1af2cfcc
https://github.com/iuap-design/tinper-neoui-grid/blob/24d392eb460beede997187593982952a1af2cfcc/vendor/uui/js/u-ui.js#L4859-L4894
28,282
iuap-design/tinper-neoui-grid
vendor/uui/js/u-ui.js
function () { if (this._btnElement.disabled) { u.addClass(this.element, this._CssClasses.IS_DISABLED); } else { u.removeClass(this.element, this._CssClasses.IS_DISABLED); } }
javascript
function () { if (this._btnElement.disabled) { u.addClass(this.element, this._CssClasses.IS_DISABLED); } else { u.removeClass(this.element, this._CssClasses.IS_DISABLED); } }
[ "function", "(", ")", "{", "if", "(", "this", ".", "_btnElement", ".", "disabled", ")", "{", "u", ".", "addClass", "(", "this", ".", "element", ",", "this", ".", "_CssClasses", ".", "IS_DISABLED", ")", ";", "}", "else", "{", "u", ".", "removeClass", "(", "this", ".", "element", ",", "this", ".", "_CssClasses", ".", "IS_DISABLED", ")", ";", "}", "}" ]
Public methods. Check the components disabled state. @public
[ "Public", "methods", ".", "Check", "the", "components", "disabled", "state", "." ]
24d392eb460beede997187593982952a1af2cfcc
https://github.com/iuap-design/tinper-neoui-grid/blob/24d392eb460beede997187593982952a1af2cfcc/vendor/uui/js/u-ui.js#L5595-L5601
28,283
iuap-design/tinper-neoui-grid
vendor/uui/js/u-ui.js
function () { if (this._btnElement.checked) { u.addClass(this.element, this._CssClasses.IS_CHECKED); } else { u.removeClass(this.element, this._CssClasses.IS_CHECKED); } }
javascript
function () { if (this._btnElement.checked) { u.addClass(this.element, this._CssClasses.IS_CHECKED); } else { u.removeClass(this.element, this._CssClasses.IS_CHECKED); } }
[ "function", "(", ")", "{", "if", "(", "this", ".", "_btnElement", ".", "checked", ")", "{", "u", ".", "addClass", "(", "this", ".", "element", ",", "this", ".", "_CssClasses", ".", "IS_CHECKED", ")", ";", "}", "else", "{", "u", ".", "removeClass", "(", "this", ".", "element", ",", "this", ".", "_CssClasses", ".", "IS_CHECKED", ")", ";", "}", "}" ]
Check the components toggled state. @public
[ "Check", "the", "components", "toggled", "state", "." ]
24d392eb460beede997187593982952a1af2cfcc
https://github.com/iuap-design/tinper-neoui-grid/blob/24d392eb460beede997187593982952a1af2cfcc/vendor/uui/js/u-ui.js#L5609-L5615
28,284
rung-tools/rung-cli
src/build.js
localesToPairs
function localesToPairs(localeFiles) { return all(localeFiles.map(localeFile => fs.readFileAsync(localeFile, 'utf-8') .then(JSON.parse) .then(json => [localeByFile(localeFile), json]))); }
javascript
function localesToPairs(localeFiles) { return all(localeFiles.map(localeFile => fs.readFileAsync(localeFile, 'utf-8') .then(JSON.parse) .then(json => [localeByFile(localeFile), json]))); }
[ "function", "localesToPairs", "(", "localeFiles", ")", "{", "return", "all", "(", "localeFiles", ".", "map", "(", "localeFile", "=>", "fs", ".", "readFileAsync", "(", "localeFile", ",", "'utf-8'", ")", ".", "then", "(", "JSON", ".", "parse", ")", ".", "then", "(", "json", "=>", "[", "localeByFile", "(", "localeFile", ")", ",", "json", "]", ")", ")", ")", ";", "}" ]
Converts a list of locale files to pairs containing locale string and content @param {String[]} localeFiles @return {Promise}
[ "Converts", "a", "list", "of", "locale", "files", "to", "pairs", "containing", "locale", "string", "and", "content" ]
c8906bb6733bdd5bcea2e9b54ed48f26ae1526d5
https://github.com/rung-tools/rung-cli/blob/c8906bb6733bdd5bcea2e9b54ed48f26ae1526d5/src/build.js#L52-L56
28,285
rung-tools/rung-cli
src/build.js
precompile
function precompile({ code, files }) { return resolve(files) .then(filter(test(/^locales(\/|\\)[a-z]{2,3}(_[A-Z]{2})?\.json$/))) .then(localesToPairs) .then(runInAllLocales(code)) .then(createMetaFile) .return(['.meta', ...files]); }
javascript
function precompile({ code, files }) { return resolve(files) .then(filter(test(/^locales(\/|\\)[a-z]{2,3}(_[A-Z]{2})?\.json$/))) .then(localesToPairs) .then(runInAllLocales(code)) .then(createMetaFile) .return(['.meta', ...files]); }
[ "function", "precompile", "(", "{", "code", ",", "files", "}", ")", "{", "return", "resolve", "(", "files", ")", ".", "then", "(", "filter", "(", "test", "(", "/", "^locales(\\/|\\\\)[a-z]{2,3}(_[A-Z]{2})?\\.json$", "/", ")", ")", ")", ".", "then", "(", "localesToPairs", ")", ".", "then", "(", "runInAllLocales", "(", "code", ")", ")", ".", "then", "(", "createMetaFile", ")", ".", "return", "(", "[", "'.meta'", ",", "...", "files", "]", ")", ";", "}" ]
Precompiles linked files, generating a .meta file with all the meta data @param {Object<String, String[]>} { code, files } @return {Promise}
[ "Precompiles", "linked", "files", "generating", "a", ".", "meta", "file", "with", "all", "the", "meta", "data" ]
c8906bb6733bdd5bcea2e9b54ed48f26ae1526d5
https://github.com/rung-tools/rung-cli/blob/c8906bb6733bdd5bcea2e9b54ed48f26ae1526d5/src/build.js#L104-L111
28,286
rung-tools/rung-cli
src/build.js
filterFiles
async function filterFiles(files) { const clearModule = replace(/^\.\//, ''); const resources = files | filter(test(/^((icon\.png)|(README(\.\w+)?\.md))$/)); const missing = without(files, requiredFiles); if (missing.length > 0) { return reject(Error(`missing ${missing.join(', ')} from the project`)); } if (!contains('icon.png', files)) { emitWarning('compiling app without providing an icon.png file'); } const infoFiles = await listFiles('info') | filter(test(/[a-z]{2}(_[A-Z]{2,3})?\.md/)) | map(path.join('info/', _)); return fs.readFileAsync('index.js', 'utf-8') .then(inspect) .then(over(lensProp('modules'), filter(startsWith('./')))) .then(({ code, modules }) => ({ code, files: union(modules.map(clearModule), [...resources, ...requiredFiles, ...infoFiles]) })); }
javascript
async function filterFiles(files) { const clearModule = replace(/^\.\//, ''); const resources = files | filter(test(/^((icon\.png)|(README(\.\w+)?\.md))$/)); const missing = without(files, requiredFiles); if (missing.length > 0) { return reject(Error(`missing ${missing.join(', ')} from the project`)); } if (!contains('icon.png', files)) { emitWarning('compiling app without providing an icon.png file'); } const infoFiles = await listFiles('info') | filter(test(/[a-z]{2}(_[A-Z]{2,3})?\.md/)) | map(path.join('info/', _)); return fs.readFileAsync('index.js', 'utf-8') .then(inspect) .then(over(lensProp('modules'), filter(startsWith('./')))) .then(({ code, modules }) => ({ code, files: union(modules.map(clearModule), [...resources, ...requiredFiles, ...infoFiles]) })); }
[ "async", "function", "filterFiles", "(", "files", ")", "{", "const", "clearModule", "=", "replace", "(", "/", "^\\.\\/", "/", ",", "''", ")", ";", "const", "resources", "=", "files", "|", "filter", "(", "test", "(", "/", "^((icon\\.png)|(README(\\.\\w+)?\\.md))$", "/", ")", ")", ";", "const", "missing", "=", "without", "(", "files", ",", "requiredFiles", ")", ";", "if", "(", "missing", ".", "length", ">", "0", ")", "{", "return", "reject", "(", "Error", "(", "`", "${", "missing", ".", "join", "(", "', '", ")", "}", "`", ")", ")", ";", "}", "if", "(", "!", "contains", "(", "'icon.png'", ",", "files", ")", ")", "{", "emitWarning", "(", "'compiling app without providing an icon.png file'", ")", ";", "}", "const", "infoFiles", "=", "await", "listFiles", "(", "'info'", ")", "|", "filter", "(", "test", "(", "/", "[a-z]{2}(_[A-Z]{2,3})?\\.md", "/", ")", ")", "|", "map", "(", "path", ".", "join", "(", "'info/'", ",", "_", ")", ")", ";", "return", "fs", ".", "readFileAsync", "(", "'index.js'", ",", "'utf-8'", ")", ".", "then", "(", "inspect", ")", ".", "then", "(", "over", "(", "lensProp", "(", "'modules'", ")", ",", "filter", "(", "startsWith", "(", "'./'", ")", ")", ")", ")", ".", "then", "(", "(", "{", "code", ",", "modules", "}", ")", "=>", "(", "{", "code", ",", "files", ":", "union", "(", "modules", ".", "map", "(", "clearModule", ")", ",", "[", "...", "resources", ",", "...", "requiredFiles", ",", "...", "infoFiles", "]", ")", "}", ")", ")", ";", "}" ]
Ensures there are missing no files in order to a allow a basic compilation and filter the used modules. It also warns about possible improvements in the apps @param {String[]} files @return {Promise}
[ "Ensures", "there", "are", "missing", "no", "files", "in", "order", "to", "a", "allow", "a", "basic", "compilation", "and", "filter", "the", "used", "modules", ".", "It", "also", "warns", "about", "possible", "improvements", "in", "the", "apps" ]
c8906bb6733bdd5bcea2e9b54ed48f26ae1526d5
https://github.com/rung-tools/rung-cli/blob/c8906bb6733bdd5bcea2e9b54ed48f26ae1526d5/src/build.js#L121-L146
28,287
rung-tools/rung-cli
src/build.js
linkAutoComplete
function linkAutoComplete() { return listFiles('autocomplete') .then(filter(endsWith('.js')) & map(path.join('autocomplete', _))) .tap(files => all(files.map(file => fs.readFileAsync(file) .then(ensureNoImports(file))))); }
javascript
function linkAutoComplete() { return listFiles('autocomplete') .then(filter(endsWith('.js')) & map(path.join('autocomplete', _))) .tap(files => all(files.map(file => fs.readFileAsync(file) .then(ensureNoImports(file))))); }
[ "function", "linkAutoComplete", "(", ")", "{", "return", "listFiles", "(", "'autocomplete'", ")", ".", "then", "(", "filter", "(", "endsWith", "(", "'.js'", ")", ")", "&", "map", "(", "path", ".", "join", "(", "'autocomplete'", ",", "_", ")", ")", ")", ".", "tap", "(", "files", "=>", "all", "(", "files", ".", "map", "(", "file", "=>", "fs", ".", "readFileAsync", "(", "file", ")", ".", "then", "(", "ensureNoImports", "(", "file", ")", ")", ")", ")", ")", ";", "}" ]
Links autocomplete files @return {Promise}
[ "Links", "autocomplete", "files" ]
c8906bb6733bdd5bcea2e9b54ed48f26ae1526d5
https://github.com/rung-tools/rung-cli/blob/c8906bb6733bdd5bcea2e9b54ed48f26ae1526d5/src/build.js#L166-L171
28,288
rung-tools/rung-cli
src/build.js
linkLocales
function linkLocales() { return listFiles('locales') .then(filter(test(/^[a-z]{2}(_[A-Z]{2,3})?\.json$/)) & map(path.join('locales', _))) .filter(location => fs.readFileAsync(location) .then(JSON.parse & is(Object)) .catchReturn(false)) .catchReturn([]); }
javascript
function linkLocales() { return listFiles('locales') .then(filter(test(/^[a-z]{2}(_[A-Z]{2,3})?\.json$/)) & map(path.join('locales', _))) .filter(location => fs.readFileAsync(location) .then(JSON.parse & is(Object)) .catchReturn(false)) .catchReturn([]); }
[ "function", "linkLocales", "(", ")", "{", "return", "listFiles", "(", "'locales'", ")", ".", "then", "(", "filter", "(", "test", "(", "/", "^[a-z]{2}(_[A-Z]{2,3})?\\.json$", "/", ")", ")", "&", "map", "(", "path", ".", "join", "(", "'locales'", ",", "_", ")", ")", ")", ".", "filter", "(", "location", "=>", "fs", ".", "readFileAsync", "(", "location", ")", ".", "then", "(", "JSON", ".", "parse", "&", "is", "(", "Object", ")", ")", ".", "catchReturn", "(", "false", ")", ")", ".", "catchReturn", "(", "[", "]", ")", ";", "}" ]
Links locale files @return {Promise}
[ "Links", "locale", "files" ]
c8906bb6733bdd5bcea2e9b54ed48f26ae1526d5
https://github.com/rung-tools/rung-cli/blob/c8906bb6733bdd5bcea2e9b54ed48f26ae1526d5/src/build.js#L178-L185
28,289
rung-tools/rung-cli
src/build.js
linkFiles
function linkFiles({ code, files }) { return all([linkLocales(), linkAutoComplete()]) .spread(union) .then(union(files) & sort(subtract) & (files => ({ code, files }))); }
javascript
function linkFiles({ code, files }) { return all([linkLocales(), linkAutoComplete()]) .spread(union) .then(union(files) & sort(subtract) & (files => ({ code, files }))); }
[ "function", "linkFiles", "(", "{", "code", ",", "files", "}", ")", "{", "return", "all", "(", "[", "linkLocales", "(", ")", ",", "linkAutoComplete", "(", ")", "]", ")", ".", "spread", "(", "union", ")", ".", "then", "(", "union", "(", "files", ")", "&", "sort", "(", "subtract", ")", "&", "(", "files", "=>", "(", "{", "code", ",", "files", "}", ")", ")", ")", ";", "}" ]
Links the files to precompilation, including locales and autocomplete scripts. For autocomplete files, ensuring it is a valid script without requires. For locales, filtering true locale files and appending the full qualified name for current files. @param {Object<String, String[]>} { code, files } @return {Promise}
[ "Links", "the", "files", "to", "precompilation", "including", "locales", "and", "autocomplete", "scripts", ".", "For", "autocomplete", "files", "ensuring", "it", "is", "a", "valid", "script", "without", "requires", ".", "For", "locales", "filtering", "true", "locale", "files", "and", "appending", "the", "full", "qualified", "name", "for", "current", "files", "." ]
c8906bb6733bdd5bcea2e9b54ed48f26ae1526d5
https://github.com/rung-tools/rung-cli/blob/c8906bb6733bdd5bcea2e9b54ed48f26ae1526d5/src/build.js#L196-L200
28,290
rung-tools/rung-cli
src/build.js
getProjectName
function getProjectName(dir) { return fs.readFileAsync(path.join(dir, 'package.json')) .then(JSON.parse & _.name) .catchThrow(new Error('Failed to parse package.json from the project')); }
javascript
function getProjectName(dir) { return fs.readFileAsync(path.join(dir, 'package.json')) .then(JSON.parse & _.name) .catchThrow(new Error('Failed to parse package.json from the project')); }
[ "function", "getProjectName", "(", "dir", ")", "{", "return", "fs", ".", "readFileAsync", "(", "path", ".", "join", "(", "dir", ",", "'package.json'", ")", ")", ".", "then", "(", "JSON", ".", "parse", "&", "_", ".", "name", ")", ".", "catchThrow", "(", "new", "Error", "(", "'Failed to parse package.json from the project'", ")", ")", ";", "}" ]
Opens package.json and extrats its contents. Returns a promise containing the file list to be zipped and the package.json content parsed @param {String} dir @return {Promise}
[ "Opens", "package", ".", "json", "and", "extrats", "its", "contents", ".", "Returns", "a", "promise", "containing", "the", "file", "list", "to", "be", "zipped", "and", "the", "package", ".", "json", "content", "parsed" ]
c8906bb6733bdd5bcea2e9b54ed48f26ae1526d5
https://github.com/rung-tools/rung-cli/blob/c8906bb6733bdd5bcea2e9b54ed48f26ae1526d5/src/build.js#L209-L213
28,291
rung-tools/rung-cli
src/build.js
resolveOutputTarget
function resolveOutputTarget(customPath, filename) { const realPath = path.resolve('.', customPath); const getPath = tryCatch( realPath => fs.lstatSync(realPath).isDirectory() ? path.join(realPath, filename) : realPath, identity); return getPath(realPath); }
javascript
function resolveOutputTarget(customPath, filename) { const realPath = path.resolve('.', customPath); const getPath = tryCatch( realPath => fs.lstatSync(realPath).isDirectory() ? path.join(realPath, filename) : realPath, identity); return getPath(realPath); }
[ "function", "resolveOutputTarget", "(", "customPath", ",", "filename", ")", "{", "const", "realPath", "=", "path", ".", "resolve", "(", "'.'", ",", "customPath", ")", ";", "const", "getPath", "=", "tryCatch", "(", "realPath", "=>", "fs", ".", "lstatSync", "(", "realPath", ")", ".", "isDirectory", "(", ")", "?", "path", ".", "join", "(", "realPath", ",", "filename", ")", ":", "realPath", ",", "identity", ")", ";", "return", "getPath", "(", "realPath", ")", ";", "}" ]
Taking account the -o parameter can be used to specify the output directory, let's deal with it @param {String} customPath @param {String} filename @return {String}
[ "Taking", "account", "the", "-", "o", "parameter", "can", "be", "used", "to", "specify", "the", "output", "directory", "let", "s", "deal", "with", "it" ]
c8906bb6733bdd5bcea2e9b54ed48f26ae1526d5
https://github.com/rung-tools/rung-cli/blob/c8906bb6733bdd5bcea2e9b54ed48f26ae1526d5/src/build.js#L238-L248
28,292
iuap-design/tinper-neoui-grid
dist/tinper-neoui-grid.js
objCompare
function objCompare(rootObj, objAry) { var aryLen = objAry.length; // var rootStr = JSON.stringify(rootObj); var matchNum = 0; for (var i = 0; i < aryLen; i++) { // var compareStr = JSON.stringify(objAry[i]); var compareObj = objAry[i]; matchNum += rootObj == compareObj ? 1 : 0; } return matchNum > 0 ? true : false; }
javascript
function objCompare(rootObj, objAry) { var aryLen = objAry.length; // var rootStr = JSON.stringify(rootObj); var matchNum = 0; for (var i = 0; i < aryLen; i++) { // var compareStr = JSON.stringify(objAry[i]); var compareObj = objAry[i]; matchNum += rootObj == compareObj ? 1 : 0; } return matchNum > 0 ? true : false; }
[ "function", "objCompare", "(", "rootObj", ",", "objAry", ")", "{", "var", "aryLen", "=", "objAry", ".", "length", ";", "// var rootStr = JSON.stringify(rootObj);", "var", "matchNum", "=", "0", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "aryLen", ";", "i", "++", ")", "{", "// var compareStr = JSON.stringify(objAry[i]);", "var", "compareObj", "=", "objAry", "[", "i", "]", ";", "matchNum", "+=", "rootObj", "==", "compareObj", "?", "1", ":", "0", ";", "}", "return", "matchNum", ">", "0", "?", "true", ":", "false", ";", "}" ]
Object Compare with Array Object
[ "Object", "Compare", "with", "Array", "Object" ]
24d392eb460beede997187593982952a1af2cfcc
https://github.com/iuap-design/tinper-neoui-grid/blob/24d392eb460beede997187593982952a1af2cfcc/dist/tinper-neoui-grid.js#L1989-L1999
28,293
rung-tools/rung-cli
src/db.js
serialize
function serialize(input) { const value = JSON.stringify(input); return value === undefined ? reject(new Error(`Unsupported type ${type(input)}`)) : resolve(value); }
javascript
function serialize(input) { const value = JSON.stringify(input); return value === undefined ? reject(new Error(`Unsupported type ${type(input)}`)) : resolve(value); }
[ "function", "serialize", "(", "input", ")", "{", "const", "value", "=", "JSON", ".", "stringify", "(", "input", ")", ";", "return", "value", "===", "undefined", "?", "reject", "(", "new", "Error", "(", "`", "${", "type", "(", "input", ")", "}", "`", ")", ")", ":", "resolve", "(", "value", ")", ";", "}" ]
Marshalls the JS input @param {Mixed} input @return {Promise}
[ "Marshalls", "the", "JS", "input" ]
c8906bb6733bdd5bcea2e9b54ed48f26ae1526d5
https://github.com/rung-tools/rung-cli/blob/c8906bb6733bdd5bcea2e9b54ed48f26ae1526d5/src/db.js#L26-L31
28,294
rung-tools/rung-cli
src/db.js
resolveRungFolder
function resolveRungFolder() { const folder = path.join(os.homedir(), '.rung'); const createIfNotExists = tryCatch( ~(fs.lstatSync(folder).isDirectory() ? resolve() : reject(new Error('~/.rung is not a directory'))), ~createFolder(folder) ); return createIfNotExists(); }
javascript
function resolveRungFolder() { const folder = path.join(os.homedir(), '.rung'); const createIfNotExists = tryCatch( ~(fs.lstatSync(folder).isDirectory() ? resolve() : reject(new Error('~/.rung is not a directory'))), ~createFolder(folder) ); return createIfNotExists(); }
[ "function", "resolveRungFolder", "(", ")", "{", "const", "folder", "=", "path", ".", "join", "(", "os", ".", "homedir", "(", ")", ",", "'.rung'", ")", ";", "const", "createIfNotExists", "=", "tryCatch", "(", "~", "(", "fs", ".", "lstatSync", "(", "folder", ")", ".", "isDirectory", "(", ")", "?", "resolve", "(", ")", ":", "reject", "(", "new", "Error", "(", "'~/.rung is not a directory'", ")", ")", ")", ",", "~", "createFolder", "(", "folder", ")", ")", ";", "return", "createIfNotExists", "(", ")", ";", "}" ]
Creates the .rung folder when it doesn't exist @return {Promise}
[ "Creates", "the", ".", "rung", "folder", "when", "it", "doesn", "t", "exist" ]
c8906bb6733bdd5bcea2e9b54ed48f26ae1526d5
https://github.com/rung-tools/rung-cli/blob/c8906bb6733bdd5bcea2e9b54ed48f26ae1526d5/src/db.js#L87-L97
28,295
rung-tools/rung-cli
src/live.js
watchChanges
function watchChanges(io, params) { const folder = process.cwd(); return watch(folder, { recursive: true }, () => { emitInfo('changes detected. Recompiling...'); io.sockets.emit('load'); const start = new Date().getTime(); executeWithParams(params) .tap(alerts => { const ellapsed = new Date().getTime() - start; emitSuccess(`wow! recompiled and executed in ${ellapsed}ms!`); io.sockets.emit('update', compileMarkdown(alerts)); }) .catch(err => { emitError(`hot compilation error, baby: ${err.message}`); io.sockets.emit('failure', err.stack); }); }); }
javascript
function watchChanges(io, params) { const folder = process.cwd(); return watch(folder, { recursive: true }, () => { emitInfo('changes detected. Recompiling...'); io.sockets.emit('load'); const start = new Date().getTime(); executeWithParams(params) .tap(alerts => { const ellapsed = new Date().getTime() - start; emitSuccess(`wow! recompiled and executed in ${ellapsed}ms!`); io.sockets.emit('update', compileMarkdown(alerts)); }) .catch(err => { emitError(`hot compilation error, baby: ${err.message}`); io.sockets.emit('failure', err.stack); }); }); }
[ "function", "watchChanges", "(", "io", ",", "params", ")", "{", "const", "folder", "=", "process", ".", "cwd", "(", ")", ";", "return", "watch", "(", "folder", ",", "{", "recursive", ":", "true", "}", ",", "(", ")", "=>", "{", "emitInfo", "(", "'changes detected. Recompiling...'", ")", ";", "io", ".", "sockets", ".", "emit", "(", "'load'", ")", ";", "const", "start", "=", "new", "Date", "(", ")", ".", "getTime", "(", ")", ";", "executeWithParams", "(", "params", ")", ".", "tap", "(", "alerts", "=>", "{", "const", "ellapsed", "=", "new", "Date", "(", ")", ".", "getTime", "(", ")", "-", "start", ";", "emitSuccess", "(", "`", "${", "ellapsed", "}", "`", ")", ";", "io", ".", "sockets", ".", "emit", "(", "'update'", ",", "compileMarkdown", "(", "alerts", ")", ")", ";", "}", ")", ".", "catch", "(", "err", "=>", "{", "emitError", "(", "`", "${", "err", ".", "message", "}", "`", ")", ";", "io", ".", "sockets", ".", "emit", "(", "'failure'", ",", "err", ".", "stack", ")", ";", "}", ")", ";", "}", ")", ";", "}" ]
Watches folder for file changes, hot recompiling everything and notifying the clients @param {SocketIO} io @param {Object} params @return {Object}
[ "Watches", "folder", "for", "file", "changes", "hot", "recompiling", "everything", "and", "notifying", "the", "clients" ]
c8906bb6733bdd5bcea2e9b54ed48f26ae1526d5
https://github.com/rung-tools/rung-cli/blob/c8906bb6733bdd5bcea2e9b54ed48f26ae1526d5/src/live.js#L76-L93
28,296
rung-tools/rung-cli
src/live.js
startServer
function startServer(alerts, params, port, resources) { const compiledAlerts = compileMarkdown(alerts); const app = http.createServer((req, res) => res.end(resources[req.url] || resources['/index.html'])); const io = listen(app); io.on('connection', socket => { emitInfo(`new session for ${socket.handshake.address}`); socket.emit('update', compiledAlerts); socket.on('disconnect', () => { emitInfo(`disconnected session ${socket.handshake.address}`); }); }); return new Promise(resolve => app.listen(port, emitRungEmoji & resolve)) .then(~watchChanges(io, params)); }
javascript
function startServer(alerts, params, port, resources) { const compiledAlerts = compileMarkdown(alerts); const app = http.createServer((req, res) => res.end(resources[req.url] || resources['/index.html'])); const io = listen(app); io.on('connection', socket => { emitInfo(`new session for ${socket.handshake.address}`); socket.emit('update', compiledAlerts); socket.on('disconnect', () => { emitInfo(`disconnected session ${socket.handshake.address}`); }); }); return new Promise(resolve => app.listen(port, emitRungEmoji & resolve)) .then(~watchChanges(io, params)); }
[ "function", "startServer", "(", "alerts", ",", "params", ",", "port", ",", "resources", ")", "{", "const", "compiledAlerts", "=", "compileMarkdown", "(", "alerts", ")", ";", "const", "app", "=", "http", ".", "createServer", "(", "(", "req", ",", "res", ")", "=>", "res", ".", "end", "(", "resources", "[", "req", ".", "url", "]", "||", "resources", "[", "'/index.html'", "]", ")", ")", ";", "const", "io", "=", "listen", "(", "app", ")", ";", "io", ".", "on", "(", "'connection'", ",", "socket", "=>", "{", "emitInfo", "(", "`", "${", "socket", ".", "handshake", ".", "address", "}", "`", ")", ";", "socket", ".", "emit", "(", "'update'", ",", "compiledAlerts", ")", ";", "socket", ".", "on", "(", "'disconnect'", ",", "(", ")", "=>", "{", "emitInfo", "(", "`", "${", "socket", ".", "handshake", ".", "address", "}", "`", ")", ";", "}", ")", ";", "}", ")", ";", "return", "new", "Promise", "(", "resolve", "=>", "app", ".", "listen", "(", "port", ",", "emitRungEmoji", "&", "resolve", ")", ")", ".", "then", "(", "~", "watchChanges", "(", "io", ",", "params", ")", ")", ";", "}" ]
Starts the stream server using sockets @param {Object} alerts @param {Object} params @param {Number} port @param {Object} resources @return {Promise}
[ "Starts", "the", "stream", "server", "using", "sockets" ]
c8906bb6733bdd5bcea2e9b54ed48f26ae1526d5
https://github.com/rung-tools/rung-cli/blob/c8906bb6733bdd5bcea2e9b54ed48f26ae1526d5/src/live.js#L104-L119
28,297
rung-tools/rung-cli
src/cli.js
cli
function cli(args) { const { _: [command] } = args; return getModule(command).default(args) .catch(err => { getModule('input').emitError(err.message); process.exit(1); }); }
javascript
function cli(args) { const { _: [command] } = args; return getModule(command).default(args) .catch(err => { getModule('input').emitError(err.message); process.exit(1); }); }
[ "function", "cli", "(", "args", ")", "{", "const", "{", "_", ":", "[", "command", "]", "}", "=", "args", ";", "return", "getModule", "(", "command", ")", ".", "default", "(", "args", ")", ".", "catch", "(", "err", "=>", "{", "getModule", "(", "'input'", ")", ".", "emitError", "(", "err", ".", "message", ")", ";", "process", ".", "exit", "(", "1", ")", ";", "}", ")", ";", "}" ]
Entry point of Rung CLI @param {Object} args
[ "Entry", "point", "of", "Rung", "CLI" ]
c8906bb6733bdd5bcea2e9b54ed48f26ae1526d5
https://github.com/rung-tools/rung-cli/blob/c8906bb6733bdd5bcea2e9b54ed48f26ae1526d5/src/cli.js#L18-L25
28,298
drkibitz/node-pixi
src/pixi/InteractionManager.js
InteractionManager
function InteractionManager(stage) { /** * a refference to the stage * * @property stage * @type Stage */ this.stage = stage; /** * the mouse data * * @property mouse * @type InteractionData */ this.mouse = new InteractionData(); /** * an object that stores current touches (InteractionData) by id reference * * @property touchs * @type Object */ this.touchs = {}; // helpers this.tempPoint = new Point(); //this.tempMatrix = mat3.create(); this.mouseoverEnabled = true; //tiny little interactiveData pool! this.pool = []; this.interactiveItems = []; this.interactionDOMElement = null; this.last = 0; }
javascript
function InteractionManager(stage) { /** * a refference to the stage * * @property stage * @type Stage */ this.stage = stage; /** * the mouse data * * @property mouse * @type InteractionData */ this.mouse = new InteractionData(); /** * an object that stores current touches (InteractionData) by id reference * * @property touchs * @type Object */ this.touchs = {}; // helpers this.tempPoint = new Point(); //this.tempMatrix = mat3.create(); this.mouseoverEnabled = true; //tiny little interactiveData pool! this.pool = []; this.interactiveItems = []; this.interactionDOMElement = null; this.last = 0; }
[ "function", "InteractionManager", "(", "stage", ")", "{", "/**\n * a refference to the stage\n *\n * @property stage\n * @type Stage\n */", "this", ".", "stage", "=", "stage", ";", "/**\n * the mouse data\n *\n * @property mouse\n * @type InteractionData\n */", "this", ".", "mouse", "=", "new", "InteractionData", "(", ")", ";", "/**\n * an object that stores current touches (InteractionData) by id reference\n *\n * @property touchs\n * @type Object\n */", "this", ".", "touchs", "=", "{", "}", ";", "// helpers", "this", ".", "tempPoint", "=", "new", "Point", "(", ")", ";", "//this.tempMatrix = mat3.create();", "this", ".", "mouseoverEnabled", "=", "true", ";", "//tiny little interactiveData pool!", "this", ".", "pool", "=", "[", "]", ";", "this", ".", "interactiveItems", "=", "[", "]", ";", "this", ".", "interactionDOMElement", "=", "null", ";", "this", ".", "last", "=", "0", ";", "}" ]
The interaction manager deals with mouse and touch events. Any DisplayObject can be interactive This manager also supports multitouch. @class InteractionManager @constructor @param stage {Stage} The stage to handle interactions
[ "The", "interaction", "manager", "deals", "with", "mouse", "and", "touch", "events", ".", "Any", "DisplayObject", "can", "be", "interactive", "This", "manager", "also", "supports", "multitouch", "." ]
2ddb5361c50293419a46a76bf4771cecd6d9aef4
https://github.com/drkibitz/node-pixi/blob/2ddb5361c50293419a46a76bf4771cecd6d9aef4/src/pixi/InteractionManager.js#L76-L115
28,299
drkibitz/node-pixi
src/pixi/textures/RenderTexture.js
RenderTexture
function RenderTexture(width, height) { EventTarget.call( this ); this.width = width || 100; this.height = height || 100; this.identityMatrix = mat3.create(); this.frame = new Rectangle(0, 0, this.width, this.height); if(globals.gl) { this.initWebGL(); } else { this.initCanvas(); } }
javascript
function RenderTexture(width, height) { EventTarget.call( this ); this.width = width || 100; this.height = height || 100; this.identityMatrix = mat3.create(); this.frame = new Rectangle(0, 0, this.width, this.height); if(globals.gl) { this.initWebGL(); } else { this.initCanvas(); } }
[ "function", "RenderTexture", "(", "width", ",", "height", ")", "{", "EventTarget", ".", "call", "(", "this", ")", ";", "this", ".", "width", "=", "width", "||", "100", ";", "this", ".", "height", "=", "height", "||", "100", ";", "this", ".", "identityMatrix", "=", "mat3", ".", "create", "(", ")", ";", "this", ".", "frame", "=", "new", "Rectangle", "(", "0", ",", "0", ",", "this", ".", "width", ",", "this", ".", "height", ")", ";", "if", "(", "globals", ".", "gl", ")", "{", "this", ".", "initWebGL", "(", ")", ";", "}", "else", "{", "this", ".", "initCanvas", "(", ")", ";", "}", "}" ]
A RenderTexture is a special texture that allows any pixi displayObject to be rendered to it. __Hint__: All DisplayObjects (exmpl. Sprites) that renders on RenderTexture should be preloaded. Otherwise black rectangles will be drawn instead. RenderTexture takes snapshot of DisplayObject passed to render method. If DisplayObject is passed to render method, position and rotation of it will be ignored. For example: var renderTexture = new RenderTexture(800, 600); var sprite = Sprite.fromImage("spinObj_01.png"); sprite.position.x = 800/2; sprite.position.y = 600/2; sprite.anchor.x = 0.5; sprite.anchor.y = 0.5; renderTexture.render(sprite); Sprite in this case will be rendered to 0,0 position. To render this sprite at center DisplayObjectContainer should be used: var doc = new DisplayObjectContainer(); doc.addChild(sprite); renderTexture.render(doc); // Renders to center of renderTexture @class RenderTexture @extends Texture @constructor @param width {Number} The width of the render texture @param height {Number} The height of the render texture
[ "A", "RenderTexture", "is", "a", "special", "texture", "that", "allows", "any", "pixi", "displayObject", "to", "be", "rendered", "to", "it", "." ]
2ddb5361c50293419a46a76bf4771cecd6d9aef4
https://github.com/drkibitz/node-pixi/blob/2ddb5361c50293419a46a76bf4771cecd6d9aef4/src/pixi/textures/RenderTexture.js#L45-L64