const wrongValue = (arg) => { const acceptedValues = optionsBook[arg[0]].acceptedValues; if (contains(arg[0], optionsToCheck)) { return !contains(arg[1], acceptedValues); } return false; };
.filter(([keyword, not]) => { const lowerCase = !H.includesUpperCase(keyword) const hasMatch = lowerCase ? R.contains(keyword, lowTitle) : R.contains(keyword, title) return not ? !hasMatch : hasMatch }).length > 0
export function items(suffix, lang) { if (!nconf.get('CHAMPIONGG_API')) return Promise.resolve(T('champgg_setup', lang)); const suffix_split = suffix.split(' '); const position = R.last(suffix_split).toLowerCase(); const champ = R.join(' ', R.slice(1, -1, suffix_split)); const champ_reg = _verifyName(champ); if (position === champ) return Promise.resolve(`${T('lol_specify_position', lang)} ${T('lol_positions', lang)}`); const options = { url: `http://api.champion.gg/champion/${champ_reg}/items/finished/mostWins` }; if (!R.contains(position, R.keys(positions))) return Promise.resolve(`${T('lol_unknown_position', lang)} **${position}**. ${T('lol_positions', lang)}`); let gg_position = positions[position]; return _makeRequest(options) .then(body => { const results = R.zipObj(R.pluck('role')(body), body); if (!R.contains(gg_position, R.keys(results))) throw new Warning(`${T('no_item_sets', lang)} **${champ}** **${position}**.`); return results[gg_position]; }) .then(item_data => { const champ_data = lol_champs[champ_reg]; if (!item_data.items.length) throw new Warning(`${T('no_item_sets', lang)} **${champ}** **${position}**.`); item_data.names = R.map(item_id => lol_items[item_id], item_data.items); item_data.champ_name = champ_data.name; item_data.image = champ_data.image; return phantom('lol_items', item_data, 500, 300); }) .then(buf => ({upload: buf, filename: `items_${champ}_${gg_position}.png`})); }
new Yadda.FeatureFileSearch([testFeaturesDir]).each(function eachFeatureFile(file) { //if YADDA_FEATURE_GLOB exists then check if featureFile in YADDA_FEATURE_GLOB if (tstGlob.length > 0 && !R.contains(file, tstGlob)) { return; } featureFile(file, function featureFile(feature) { var libraries = testUtils.getLibraries(testFeaturesDir, testLibrariesDir, file, feature); var loadedLibraries = testUtils.requireLibraries(libraries); //initiate yadda and execute each scenario var yadda = new Yadda.Yadda(loadedLibraries, worldContext); scenarios(feature.scenarios, function scenario(scenarioParam) { //before test setup testUtils.before(before, worldContext); //run steps /*eslint max-nested-callbacks:0 */ steps(scenarioParam.steps, function step(stepParam, done) { yadda.yadda(stepParam, done); }); //after test teardown testUtils.after(after, worldContext); }); }); //afterAll testUtils.afterAll(after, worldContext, currentBrowser); });
triggerHook: (hookName: string, args: ?Object) => { if (!R.contains(hookName, this.newHooks)) { logger.debug(`trying to trigger the hook ${hookName} which not registered by this extension`); return; } HooksManagerInstance.triggerHook(hookName, args); },
constructor ({ id: optsId, aliases: optsAliases = [], parameters: optsParameters = [], categories: optsCategories = [], description: optsDescription = '' }) { this._id = optsId this._aliases = optsAliases this._parameters = optsParameters this._categories = optsCategories this._description = optsDescription this._parent = null this._parentList = [] this._finalized = false this._id = R.toLower(this._id) if (R.is(String, this._aliases)) { this._aliases = [this._aliases] } this._aliases = R.map(R.toLower, this._aliases) if (!R.contains(this._id, this._aliases)) { this._aliases.push(this._id) } if (R.is(String, this._parameters)) { this._parameters = [this._parameters] } }
R.forEach(line => { const var_name = line.expression.left.property.name; if (R.contains(var_name, ['championData', 'champion'])) { const data = escodegen.generate(line.expression.right, {format: {json: true}}); parsed_data[var_name] = JSON.parse(data); } }, esprima.parse(script_tag).body);
export function best(suffix, lang) { if (!nconf.get('CHAMPIONGG_API')) return Promise.resolve(T('champgg_setup', lang)); const position = R.last(suffix.split(' ')).toLowerCase(); if (!position || position === 'best') return Promise.resolve(`${T('lol_specify_position', lang)} ${T('lol_positions', lang)}`); if (!R.contains(position, R.keys(positions))) return Promise.resolve(`${T('lol_unknown_position', lang)} **${position}**. ${T('lol_positions', lang)}`); const gg_position = positions[position]; const options = { url: `http://api.champion.gg/stats/role/${gg_position}/bestPerformance`, qs: { limit: 10, page: 1 } }; return _makeRequest(options) .then(R.prop('data')) .then(data => { return R.addIndex(R.map)((champ, idx) => `*${getOrdinal(idx + 1)}*. **${champ.name}** with a ${champ.general.winPercent}% winrate.`, data); }) .then(R.prepend(`Sick! Here's the top 10 **statistically** best for **${gg_position}**:\n`)) .then(R.join('\n')); }
const selector = ( standardId, risks, usersByIds, riskTypesByIds, departmentsByIds, standardsByIds, ) => compose( map(compose( over(lenses.type, id => riskTypesByIds[id]), over(lenses.originator, id => getUserWithFullName(usersByIds[id])), over(lenses.owner, id => getUserWithFullName(usersByIds[id])), over(lenses.departments, map(compose( renameKeys({ name: 'title' }), id => departmentsByIds[id], ))), over(lenses.standards, map(id => standardsByIds[id])), over(lenses.analysis, compose( over(lenses.executor, id => getUserWithFullName(usersByIds[id])), over(lenses.completedBy, id => getUserWithFullName(usersByIds[id])), )), renameKeys({ ownerId: 'owner', originatorId: 'originator', typeId: 'type', departmentsIds: 'departments', standardsIds: 'standards', }), )), filter(where({ standardsIds: contains(standardId) })), )(risks);
export const isModuleDisabled = (name) => { if(!name) { throw new Error('Please submit a valid name'); } const disabledModules = getKey('disabledModules') || []; return R.contains(name, disabledModules); };
render: function () { const node = this.props.node return ( <div style={{paddingLeft: '20px'}}> {map( a => <TreeNodeAttribute attribute={a} owner={node} />, filter( pipe( prop('name'), toLower, contains(__, [ 'def', 'diffusecolor', 'orientation', 'position', 'render', 'rotation', 'scale', 'translation', 'url' ]) ), node.attributes ) )} </div> ) }
wordlist.forEach(function (word) { if (word.startsWith('#') && !R.contains(word, hashlist)) { word = word.trim(); word = word.replace(/,\s*$/, ''); hashlist.push(word); } });
export function onAdd(thread, id, tagId, communityId, selectedIds) { if (!R.contains(tagId, selectedIds)) { const args = { id, tagId, communityId } args.thread = R.toUpper(thread) sr71$.mutate(S.setTag, args) } }
export function best(bot, msg, suffix) { if (!nconf.get('CHAMPIONGG_API')) { return bot.sendMessage(msg.channel, T('champgg_setup', msg.author.lang)); } const position = R.last(suffix.split(' ')).toLowerCase(); if (!position || position === 'best') return bot.sendMessage(msg.channel, `${T('lol_specify_position', msg.author.lang)} ${T('lol_positions', msg.author.lang)}`); if (!R.contains(position, R.keys(positions))) return bot.sendMessage(msg.channel, `${T('lol_unknown_position', msg.author.lang)} **${position}**. ${T('lol_positions', msg.author.lang)}`); const gg_position = positions[position]; const options = { url: `http://api.champion.gg/stats/role/${gg_position}/bestPerformance`, qs: { limit: 10, page: 1 } }; return _makeRequest(options) .then(R.prop('data')) .then(data => { return R.addIndex(R.map)((champ, idx) => `*${getOrdinal(idx + 1)}*. **${champ.name}** with a ${champ.general.winPercent}% winrate.`, data); }) .then(R.prepend(`Sick! Here's the top 10 **statistically** best for **${gg_position}**:\n`)) .then(R.join('\n')) .then(text => bot.sendMessage(msg.channel, text)) .catch(err => { sentry(err, 'leagueoflegends', 'best'); bot.sendMessage(msg.channel, `Error: ${err.message}`); }); }
const SuggestIcon = ({ round, suggestion: { raw, logo, cmd } }) => { /* const lowerRaw = R.toLower(raw) */ if (cmd === 'theme') { return ( <ThemeIconWrapper> <ThemeDot bg={themeCoverMap[raw]} /> </ThemeIconWrapper> ) } // doraemon cat icon, it's smaller then normal icons if (raw === 'doraemon_help') { return ( <Wrapper> <DoraemonIcon src={logo} /> </Wrapper> ) } // normal icons return ( <React.Fragment> {logo ? ( <Wrapper> <Icon round={round} src={logo || DEFAULT_ICON} nonFill={R.contains(raw, NON_FILL_COMMUNITY)} /> </Wrapper> ) : null} </React.Fragment> ) }
var stopTracking = function stopTracking() { var ms = (performanceNow() - start).toFixed(0); if (!R.contains(action.type, MIDDLEWARE_ACTION_IGNORE)) { client.sendCommand('redux.action.done', { type: type, ms: ms, action: action }); } };
function validate (opts) { if (opts.category && !R.contains(opts.category, R.values(c.category))) { throw Error('Invalid category ' + opts.category); } opts.collection = opts.collection || c.collection.TOP_FREE_IOS; if (!R.contains(opts.collection, R.values(c.collection))) { throw Error(`Invalid collection ${opts.collection}`); } opts.num = opts.num || 50; if (opts.num > 200) { throw Error('Cannot retrieve more than 200 apps'); } opts.country = opts.country || 'us'; }
var exitIfNotDevMode = function () { var isDevMode = R.anyPass([ R.has('mod'), R.pipe(R.prop('_'), R.contains('tdd')) ]); if (!isDevMode(argv)) process.exit(); };
var props = r.reduce(function(acc, prop) { var key = prop.key.name; var val = recast.print(prop.value).code; if (!r.contains(key, ignore)) { acc += "this." + key + " = " + val + ";\n"; } return acc; }, "", findReactClassProps(ast)[0]);
literal: function(node) { var str = '' + node.options.value; if (!R.contains('.', str)) { str += '.0'; } return { c: function() { return str; }, subs: [] }; },
/** * Use BFS to find a path between two nodes in the circuit graph. * * @param startNode - Node to begin searching from. * @param destNode - Node to find path to. * @param circuit * @param circuit.nodes - Nodes in the graph. * @param circuit.models - Edges of the graph. * @param opts - Extra options. * @param opts.exclude - Don't look for paths through models with these IDs. * @param opts.types - If defined, only look for paths through these types. */ function isPathBetween( startNode, destNode, {nodes, models}, {exclude, types} = { exclude: [], types: null }) { const visited = [], q = []; visited[startNode] = true; q.push(startNode); if (startNode === destNode) { return true; } while (q.length !== 0) { const n = q.shift(); const tConnectors = nodes[n]; for (let i = 0; i < tConnectors.length; i++) { const con = tConnectors[i]; const id = con.viewID; if (R.contains(id, exclude)) { continue; // ignore paths through excluded models } else if (types && !R.contains(models[id].typeID, types)) { continue; // ignore paths that aren't through the given types } const connectedNodes = models[id].nodes; for (let j = 0; j < connectedNodes.length; j++) { const connectedNode = connectedNodes[j]; if (connectedNode === destNode) { return true; } if (!visited[connectedNode]) { visited[connectedNode] = true; q.push(connectedNode); } } } } return false; }
{categories.map(c => ( <CategoryTag key={uid.gen()} active={R.contains(c.id, selectedids)} onClick={logic.onAdd.bind(this, communityId, c.id, selectedids)} > {c.title} </CategoryTag> ))}
function uninstallVersion(version) { if (R.contains(version, getInstalledVersions())) { return util.deleteDir(path.join(paths.PSVM_VERSIONS, version)); } else { return new Promise(function (resolve, reject) { reject('Version to uninstall not found'); }) } }
updateValidationVisibility = (keySet: Array<string>) => { const { dispatch, profiles } = this.props const username = SETTINGS.user.username if (!profiles[username].edit) { dispatch(updateValidationVisibility(username, keySet)) } else if (!R.contains(keySet, profiles[username].edit.visibility)) { dispatch(updateValidationVisibility(username, keySet)) } }
appendOrRemovePredicate = predicate => { const removePredicate = n => R.eqProps('name', n, predicate) R.contains(predicate.name, R.pluck('name', this.state.predicates)) ? this.setState({ ...this.state, predicates: R.reject(removePredicate, this.state.predicates) }) : this.setState({ ...this.state, predicates: R.append(predicate, this.state.predicates) }) }
render: (cursor) => { let profileCursor = cursor.cursor('userProfile') let user = profileCursor.get('user').toJS() let currentHash = cursor.cursor('router').get('currentHash') let soundCloud = user.soundCloud || {} let profileTabs = [ new UserTab('Projects'), new UserTab('Plans'), new UserTab('About'), new UserTab('Media', null, !R.isEmpty(soundCloud.uploads || [])), new UserTab('Workshops', null, !S.isBlank(user.workshopsInfo)), ] let activeTab = R.contains(currentHash, R.map((tab) => { return tab.name }, profileTabs)) ? currentHash : 'projects' logger.debug(`Rendering profile of user '${user.username}', active tab '${activeTab}':`, user) logger.debug(`State:`, profileCursor.toJS()) let tabContents if (activeTab === 'about') { tabContents = About(user) } else if (activeTab === 'projects') { tabContents = Projects(user) } else if (activeTab === 'plans') { tabContents = ProjectPlans({user, cursor,}) } else if (activeTab === 'media') { tabContents = Media(user) } else if (activeTab === 'workshops') { tabContents = Workshops(user) } return h('#user-pad', [ h('.pure-g', [ h('.pure-u-1-4', [ VCard(user), ]), h('.pure-u-3-4', [ h('ul.tabs', {role: 'tablist',}, R.map((profileTab) => { return h(`li.${S.join('.', profileTab.getClasses(activeTab))}`, [ profileTab.enabled ? h('a', { role: 'tab', href: profileTab.url, }, [ profileTab.icon != null ? h(`span.icon-${profileTab.icon}`, nbsp) : null, h('span', profileTab.title), ]) : h('div', [ profileTab.icon != null ? h(`span.icon-${profileTab.icon}`, nbsp) : null, h('span', profileTab.title), ]), ]) }, profileTabs)), h('#tab-contents', [tabContents,]), ]), ]), ]) },
.then((deployments) => { const getInstances = R.compose(R.flatten, R.map((d) => { return getTagsFromInstances(d.Instances); })); const insts = getInstances(deployments); deployments = R.map(R.prop(constants.DEPLOYMENT_TAG), insts); return R.contains(name, deployments); });
.then((prs) => { const getInstances = R.compose(R.flatten, R.map((d) => { return getTagsFromInstances(d.Instances); })); const insts = getInstances(prs); prs = R.map(R.prop(constants.PR_TAG), insts); return R.contains(pr, prs); });
export const responseToProblem = (response) => { if (response instanceof Error) { // first check if the error message is Network Error (set by axios at 0.12) on platforms other than NodeJS. if (response.message === 'Network Error') return NETWORK_ERROR // then check the specific error code return R.cond([ [R.contains(R.__, TIMEOUT_ERROR_CODES), R.always(TIMEOUT_ERROR)], [R.contains(R.__, NODEJS_CONNECTION_ERROR_CODES), R.always(CONNECTION_ERROR)], [R.T, R.always(UNKNOWN_ERROR)] ])(response.code) } if (R.isNil(response) || !R.has('status')) return UNKNOWN_ERROR return R.cond([ [in200s, R.always(NONE)], [in400s, R.always(CLIENT_ERROR)], [in500s, R.always(SERVER_ERROR)], [R.T, R.always(UNKNOWN_ERROR)] ])(response.status || 0) }
client.reduxMiddleware = (store) => (next) => (action) => { const {type} = action const start = performanceNow() const result = next(action) const ms = (performanceNow() - start).toFixed(0) if (!R.contains(action.type, MIDDLEWARE_ACTION_IGNORE)) { client.sendCommand('redux.action.done', {type, ms, action}) } return result }