How to use just-map-values - 5 common examples

To help you get started, we’ve selected a few just-map-values examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github u-wave / web / src / reducers / playlists.js View on Github external
// set `active` property on all playlists
        playlists: mapValues(state.playlists, (playlist) => ({
          ...playlist,
          loading: playlist._id === payload.playlistID ? false : playlist.loading,
          active: playlist._id === payload.playlistID,
        })),
        activePlaylistID: payload.playlistID,
      };
    case SELECT_PLAYLIST: {
      const { currentFilter } = state;
      const shouldClearFilter = currentFilter && currentFilter.playlistID !== payload.playlistID;
      return {
        ...state,
        currentFilter: shouldClearFilter ? {} : currentFilter,
        // set `selected` property on playlists
        playlists: mapValues(state.playlists, (playlist) => ({
          ...playlist,
          selected: playlist._id === payload.playlistID,
        })),
        selectedPlaylistID: payload.playlistID,
      };
    }
    case SEARCH_START:
    // We deselect playlists when doing a search, so the UI can switch to the
    // search results view instead.
      return {
        ...state,
        playlists: deselectAll(state.playlists),
        selectedPlaylistID: null,
      };
    case SEARCH_DELETE:
    // Select the active playlist when search results are closed while they
github u-wave / web / src / reducers / playlists.js View on Github external
function deselectAll(playlists) {
  return mapValues(playlists, (playlist) => (
    playlist.selected
      ? { ...playlist, selected: false }
      : playlist
  ));
}
github fanfoujs / space-fanfou / src / features / notifications / service@background.js View on Github external
createEmptyCounts() {
      return mapValues(itemsToCheck, () => 0)
    }
  }
github fanfoujs / space-fanfou / src / background / environment / settings.js View on Github external
const getOptionDefs = simpleMemoize(() => {
  const unsolderedFeatures = omitBy(features, feature => feature.metadata.isSoldered)
  const optionDefs = mapValues(unsolderedFeatures, feature => feature.metadata.optionDefs)

  return optionDefs
})
github u-wave / web / src / selectors / chatSelectors.js View on Github external
  (mutes) => mapValues(mutes, (mute) => mute.expirationTimer),
);

just-map-values

map an object, predicate updates values, receives (value, key, object)

MIT
Latest version published 2 years ago

Package Health Score

61 / 100
Full package analysis

Popular just-map-values functions