View intersperse.js
/** | |
* Create and return a new array with the separator interposed between elements. | |
* | |
* intersperse :: a -> [a] -> [a] | |
* | |
* Providing the separator as the first argument allows this method to be easily | |
* curried and composed with other functions; follows the "data last" approach. | |
* | |
* @param {*} separator | |
* @param {*} array |
View createActionType.js
export const APP = "r3"; | |
export const createActionType = app => duck => type => `${app}/${duck}/${type}`; | |
export const createDuckType = createActionType(APP); | |
/** | |
* Constructs a new action with a required type and optional additional action properties supplied as | |
* optional argument(s*); *see `...rest` param below. | |
* |
View cloudSettings
{"lastUpload":"2020-09-28T14:06:24.326Z","extensionVersion":"v3.4.3"} |
View EventEmitter.js
// Example on codepen https://codepen.io/jagretz/pen/aGeMoJ | |
// If you would like a production version, use complete, tested, performant, and | |
// well-supported version https://github.com/facebook/emitter | |
/** | |
* Subscribe to and control when events are emitted to subscribers. | |
*/ | |
class EventEmitter { | |
constructor() { | |
// k,v store of events to subscribers. |
View reduceReducers.js
/** | |
* Supply multiple reducer functions, as arguments, and return a new reducer function that pipes the | |
* state and action through each reducer in sequence. | |
* @param {...functions} reducers like (arg1, arg2, ...), as a serires of arguments. | |
* @return {function} a new reducer function that pipes the state and action through each reducer in sequence. | |
* Each successive reducer will receive the updated returned by the previous reducer. | |
*/ | |
export default function reduceReducers(...reducers) { | |
return (currentState = {}, action = {}) => | |
reducers.reduce((updatedState, red) => red(updatedState, action), currentState); |
View cloudSettings
{"lastUpload":"2020-09-02T18:13:37.885Z","extensionVersion":"v3.4.3"} |