Skip to content

Instantly share code, notes, and snippets.

View dews's full-sized avatar

Calvin Zheng dews

  • Taichung, Taiwan
View GitHub Profile
@dews
dews / slim-redux.js
Last active March 7, 2021 14:03 — forked from gaearon/slim-redux.js
Add applyMiddleware and add example
function mapValues(obj, fn) {
return Object.keys(obj).reduce((result, key) => {
result[key] = fn(obj[key], key);
return result;
}, {});
}
function pick(obj, fn) {
return Object.keys(obj).reduce((result, key) => {
if (fn(obj[key])) {