This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { createSelector, createSelectorCreator, weakMapMemoize } from 'reselect' | |
const firstArgsMemoize = (func) => { | |
const internal = weakMapMemoize(func) | |
return (state) => { | |
return internal(state) | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type recordsFunction<Input, Value> = (a: Input) => Value; | |
const cases = <Key extends string | number, Value>( | |
input: Key, | |
cases: Record<Key, Value | recordsFunction<Key, Value>> & { default: Value | recordsFunction<Key, Value> } | |
) => { | |
if (input in cases) { | |
return typeof cases[input] === 'function' ? (cases[input] as recordsFunction<Key, Value>)(input) : cases[input]; | |
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"partial": { | |
"enabled": true | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const setPath = ([key, ...next], value, obj) => { | |
if (next.length === 0) { | |
return {...obj, [key]: value }; | |
} | |
return {...obj, [key]: setPath(next, value, obj[key]) }; | |
}; | |
export const getPath = ([key, ...next], obj) => { | |
if (next.length === 0) { | |
return obj[key]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
04094e7973e1f2a7a4a27e89eaca885cf05163ae129f6e5d8246e98e405110fcb47a47a4584ff05f25434344e126c2a4c95755f50206545366e9ccb4bdbef2dab5;yddmat |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const setPath = ([key, ...next], value, obj) => { | |
if (next.length === 0) { | |
return {...obj, [key]: value }; | |
} | |
return {...obj, [key]: setPath(next, value, obj[key]) }; | |
}; | |
const set = (path, value, obj) => setPath(path.split('.'), value, obj); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const store = createStore((state = {repoIds, reposById}, action) => { | |
switch (action.type) { | |
case UPDATE_TAG: | |
return set('reposById.1.tags[0]', {id: 213, text: 'Node.js'}, state); | |
default: | |
return state; | |
} | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
switch (action.type) { | |
case ADD_NEW_AVAILABLE_COLOR_TO_CAR:{ | |
const { color, model, manufacturer } = action.payload | |
return {...state, manufacturer: { | |
...state.manufacturer, [manufacturer]: | |
{...state.manufacturers[manufacturers], models: | |
{...state.manufacturers[manufacturers].models, [model]: | |
{...state.manufacturers[manufacturers].models[model], options: | |
{...state.manufacturers[manufacturers].models[model].options, colors: | |
{...state.manufacturers[manufacturers].models[model].options.colors, [color]: true} |
NewerOlder