function curryParams( baseName: string, sourceOverloadId: number, sourceOverload: Overload, interfaceIndex: number, ): Interface { const params = getInterfaceParams(sourceOverload, interfaceIndex); const interfaceTypeParams = getInterfaceTypeParams(sourceOverload, interfaceIndex); const prevParams = _.without(sourceOverload.params, ...params); const prevTypeParams = getUsedTypeParams(prevParams, sourceOverload.typeParams); const typeParams = _.without(sourceOverload.typeParams, ...prevTypeParams); // 1st overload takes no parameters and just returns the same interface (effectively a no-op) // HACK: omit the parameterless overload because it's not very useful, and it causes the build to run out of memory // This assumes params.length > 0, which is true because curryParams is only called when params.length >= 2. /*const overloads: Overload[] = [{ typeParams: [], params: [], returnType: getInterfaceName(baseName, sourceOverloadId, interfaceIndex, interfaceTypeParams), jsdoc: sourceOverload.jsdoc, }];*/ const overloads: Overload[] = []; const lastOverload = (1 << params.length) - 1; for (let i = 1; i <= lastOverload; ++i) { // xxxx i = number of parameters used by this overload // const totalCombinations = nCk(params.length, i); // i = binary representation of which parameters are used for this overload (reversed), e.g. // 1 = 0001 -> 1000 = 1st parameter // 6 = 1010 -> 0101 = 2nd and 4th parameters const currentParams = params.map((p, j) => (i & (1 << j)) ? p : `${getParamName(p)}: __`); while (currentParams.length > 0 && _.last(currentParams)!.endsWith("__")) currentParams.pop(); // There's no point in passing a placeholder as the last parameter, so don't allow it. const usedTypeParams = i < lastOverload ? getUsedTypeParams(currentParams, typeParams) : typeParams; const combinedIndex = combineIndexes(interfaceIndex, i); const passTypeParams = getInterfaceTypeParams(sourceOverload, combinedIndex); const currentReturnType = i < lastOverload ? getInterfaceName(baseName, sourceOverloadId, combinedIndex, passTypeParams) : sourceOverload.returnType; overloads.push({ typeParams: _.cloneDeep(usedTypeParams), params: currentParams, returnType: currentReturnType, jsdoc: interfaceIndex === 0 ? sourceOverload.jsdoc : "", }); } const interfaceDef: Interface = { name: getInterfaceName(baseName, sourceOverloadId, interfaceIndex, []), typeParams: _.cloneDeep(interfaceTypeParams), overloads, constants: [], }; // Remove the `extends` constraint from interface type parameters, because sometimes they extend things that aren't passed to the interface. for (const typeParam of interfaceDef.typeParams) { // 1. retain `extends keyof X` constraints so that TObject[TKey] still works. // 2. retain `any[]` constraints so that variadic generics work. if (!_.startsWith(typeParam.extends, "keyof ") && typeParam.extends !== "any[]") delete typeParam.extends; } return interfaceDef; }
kickMember(member: GuildMember, propagate = true) { // check if they're online, remove guildName (basically, call memberLeave) const onlinePlayer = GameState.getInstance().getPlayer(member.name); if(onlinePlayer && onlinePlayer.guildName !== this.name) return; if(onlinePlayer) { this.memberLeave(onlinePlayer); // check if member is even in guild (ie, could just be an invite) const memberInList = _.find(this.members, { name: member.name }); this.members = _.without(this.members, memberInList); this.save(true); } else if(propagate) { GuildKickRedis(this.name, member.name); } else if(!propagate) { // if not online, dig into db and unset guildName const memberInList = _.find(this.members, { name: member.name }); this.members = _.without(this.members, memberInList); this.$guildDb.removePlayerFromGuild(member.name, this.name); this.save(true); } }
removeValue(commandClass: number, index) { if (this.commandClassExists(commandClass)) { const filteredCommandClass = without(this.values[commandClass], index); this.values.set(commandClass, filteredCommandClass); } }
.add<{ index: number }>("REMOVE_STEP", function (state, action) { let seq = state.all[state.current]; let index = action.payload.index; seq.body = _.without(seq.body, seq.body[index]); markDirty(state); return state; })
return async (dispatch: (action: any) => void, getState: () => GertyState, bundle: Bundle) => { const state = getState(); const isWorkspace = relativePath === state.configuration.workspacePath; const repositoryDataPath = isWorkspace ? "workspace.hosts" : `repositories.${relativePath}.hosts`; const hosts = _.get(state.data, repositoryDataPath, []) as Host[]; const newHosts = _.without(hosts, hosts[index]); dispatch({ type: "set-data-value", path: repositoryDataPath, value: newHosts, } as SetDataValueAction); if (isWorkspace) { await dispatch(saveWorkspace()); } else { await dispatch(saveRepository(relativePath)); } };
removeTag(tag, evt) { this.query.tag = _.without(this.query.tag, tag); this.search(); this.giveSearchFocus = this.giveSearchFocus + 1; evt.stopPropagation(); evt.preventDefault(); }
static getMetricFieldKey(segment) { const keys = _.keys(segment); return _.filter(_.without(keys, 'start', 'end'), key => { return _.isObject(segment[key]); })[0]; }
removeQuery() { if (this.panelCtrl.__collapsedQueryCache) { delete this.panelCtrl.__collapsedQueryCache[this.target.refId]; } this.panel.targets = _.without(this.panel.targets, this.target); this.panelCtrl.refresh(); }
public stopInstance(dotEnsime: DotEnsime): void { for (const instance of this.instances) { if (instance.rootDir === dotEnsime.rootDir) { instance.destroy() this.instances = _.without(this.instances, instance) } } }
stopInstance(dotEnsime: DotEnsime) { for (let instance of this.instances) { if(instance.rootDir == dotEnsime.rootDir) { instance.destroy() this.instances = _.without(this.instances, instance) } } }