const reduceAuthorId = (acc, author) => { const username = author.username; const times = R.length(filterUsernames(username, acc)); const authorId = times > 0 ? `${username}-${R.inc(times)}` : username; return R.prepend(R.assoc('authorId', authorId, author), acc); }
const data = R.map((step) => { const stepTitle = i === 0 ? 'Start' : i === steps.length - 1 ? 'Finished' : step.title || `Lap ${i}` const delta = step.time - last const time = step.time - first.time i = R.inc(i) last = step.time return {time, title: stepTitle, delta} }, steps)
reducer: (state, { payload }) => { const curr = payload.points > 0 ? inc(state.curr) : 0; return { curr, hi: max(state.hi, curr), lo: min(state.lo, curr), }; },
hunk.forEach((line, idx) => { const [type, data] = R.splitAt(1, line) result.push({ lineNum: count, type, data }) if (type === ' ' || type === '+') { count = R.inc(count) } })
export const getPossibleNodeForIndex = ({ gameState, shouldBuildPossibleNodes, currentPlayer, currentDepth, index }) => Node({ gameState: getNextGameState({ gameState, index }), shouldBuildPossibleNodes, action: index, currentPlayer, currentDepth: R.inc(currentDepth) });
const ProjectLargeInfoFooter = ({ previousProjectId, nextProjectId, index, total }) => { return ( <Flex width="100%" justifyContent="space-between" alignItems="center"> <Box> <BodyTextSecondary> {inc(index)}/{total} </BodyTextSecondary> </Box> <UpDownArrows previousId={previousProjectId} nextId={nextProjectId} /> </Flex> ) }
it("typechecks unary", () => { const n1: number = _.inc(1); const n2: number = _.dec(1); });
export default (state = initialState, {type, payload}) => { switch (type) { case ADD_CHANNEL: return overChannels( compose( sortByName, append(createChannel(lowestUniqueNatural(pluck( 'name', channels(state) )))) ), state ) case ADD_EFFECT_TO_CHANNEL: { const thisEffectInstance = effectInstance(payload.name, state) const lastEffect = last(effects(channel(payload.channel, state))) if (!lastEffect) connectToAudioCtx(thisEffectInstance) else { thisEffectInstance.connect(effectInstanceDestination( lastEffect, state )) } forEach( name => disconnect(instrumentInstance(name, state)) .connect(destination(thisEffectInstance)), instruments(channel(payload.channel, state)) ) return overChannelEffects(append(payload.name), payload.channel, state) } case ADD_INSTRUMENT_TO_CHANNEL: { const instrument = instance(find( propEq('name', payload.name), instrumentInstances(state) )) instrument.disconnect() const lastEffect = last(effects(channel(payload.channel, state))) if (!lastEffect) connectToAudioCtx(instrument) else instrument.connect(effectInstanceDestination(lastEffect, state)) return overChannelInstruments(append(payload.name), payload.channel, state) } case INSTANTIATE_EFFECT: { const instance = new (findConstructor( payload.plugin, state.effectPlugins ))({audioContext}) return overEffectInstances(append({ instance, name: payload.name }), state) } case INSTANTIATE_INSTRUMENT: { const instance = new (findConstructor( payload.plugin, state.instrumentPlugins ))({audioContext}) connectToAudioCtx(instance) return overInstrumentInstances( append({instance, name: payload.name}), state ) } case LOAD_PLUGIN_INSTRUMENT: return overInstrumentPlugins(append(payload), state) case LOAD_PLUGIN_EFFECT: return overEffectPlugins(append(payload), state) case REMOVE_CHANNEL: { const channel = findNameEquals( payload, channels(state) ) forEach(compose( disconnect, x => effectInstance(x, state) ), effects(channel)) forEach(compose( connectToAudioCtx, disconnect, flip(instrumentInstance)(state) ), instruments(channel)) return overChannels(without([channel]), state) } case REMOVE_EFFECT_FROM_CHANNEL: { const channelEffects = effects(channel(payload.channel, state)) const channelInstruments = instruments(channel(payload.channel, state)) disconnect(effectInstance(payload.name, state)) const effectIndex = findIndex(equals(payload.name), channelEffects) if (length(channelEffects) === 1) { forEach( name => connectToAudioCtx(instrumentInstance(name, state)), channelInstruments ) } else if (effectIndex === dec(length(channelEffects))) { forEach( name => instrumentInstance(name, state) .connect(effectInstanceDestination( nth(dec(effectIndex), channelEffects), state )), channelInstruments ) } else if (effectIndex === 0) { connectToAudioCtx(disconnect(effectInstance( nth(inc(effectIndex), channelEffects), state ))) } else { disconnect(effectInstance( nth(inc(effectIndex), channelEffects), state )).connect(effectInstanceDestination( nth(dec(effectIndex), channelEffects), state )) } return overChannelEffects(without([payload.name]), payload.channel, state) } case REMOVE_INSTRUMENT_FROM_CHANNEL: { connectToAudioCtx(disconnect(instrumentInstance(payload.name, state))) return overChannelInstruments( without([payload.name]), payload.channel, state ) } default: return state } }
const prevAuthor = author => { if (!isFirstAuthor(author)) return nth(inc(authorIndex(author)), authorsToPost); };
const mapMovesArray = (moveArrayValue, movesArrayIndex) => R.equals(players[movesArrayIndex], boardValue) ? R.inc(moveArrayValue) : moveArrayValue;
const prev = author => (authors[R.inc(R.findIndex(R.propEq('username', author), authors))] || {}).username;
var f_n_Wter_pst = (l_lst, n_ndx) => R.inc(n_ndx) / f_n_Len(l_lst);
"inc": (_, x) => R.inc(x),