How to use just-omit - 10 common examples

To help you get started, we’ve selected a few just-omit 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
return state;
    }
    case DELETE_PLAYLIST_START:
      return setPlaylistLoading(state, payload.playlistID);
    case DELETE_PLAYLIST_COMPLETE:
      if (error) {
        return setPlaylistLoading(state, meta.playlistID, false);
      }

      return {
        ...state,
        // When deleting the selected playlist, select the active playlist instead.
        selectedPlaylistID: state.selectedPlaylistID === payload.playlistID
          ? state.activePlaylistID
          : state.selectedPlaylistID,
        playlists: omit(state.playlists, payload.playlistID),
      };

    case ADD_MEDIA_START:
      return setPlaylistLoading(state, payload.playlistID);
    case ADD_MEDIA_COMPLETE:
      if (error) {
        return setPlaylistLoading(state, meta.playlistID, false);
      }

      return updatePlaylistAndItems(
        state,
        payload.playlistID,
        (playlist) => ({
          ...playlist,
          loading: false,
          size: payload.newSize,
github u-wave / web / src / reducers / users.js View on Github external
// this is merged in instead of replacing the state, because sometimes the
    // JOIN event from the current user comes in before the LOAD event, and then
    // the current user is sometimes excluded from the state. it looks like this
    // approach could cause problems, too, though.
    // TODO maybe replace state instead anyway and merge in the current user?
      return {
        ...state,
        ...indexBy(payload.users, '_id'),
      };
    case USER_JOIN:
      return {
        ...state,
        [payload.user._id]: payload.user,
      };
    case USER_LEAVE:
      return omit(state, payload.userID);
    case CHANGE_USERNAME:
      return updateUser(state, payload.userID, (user) => ({
        ...user,
        username: payload.username,
      }));
    case USER_ADD_ROLES:
      return updateUser(state, payload.userID, (user) => ({
        ...user,
        roles: [...user.roles, ...payload.roles],
      }));
    case USER_REMOVE_ROLES:
      return updateUser(state, payload.userID, (user) => ({
        ...user,
        roles: user.roles.filter((role) => !payload.roles.includes(role)),
      }));
    default:
github zero-plus-x / neoform / packages / neoform-validation / src / fieldValidation.js View on Github external
render() {
      const validation = this.context.neoform.getValidation(this.props.name);

      return createElement(Target, {
        ...omit(this.props, 'validator'),
        validate: this.validate,
        validationStatus: validation.status,
        validationMessage: validation.message
      });
    }
  }
github zero-plus-x / neoform / packages / neoform-validation / src / formValidation.js View on Github external
this.setState((prevState) => ({
        fields: omit(prevState.fields, name)
      }));
    }
github imyelo / pokequest-wiki / src / data / index.js View on Github external
return
      }
      kvMoves[name].pokemons.push({
        ...omit(pokemon, 'moves'),
        move: {
          learnable: move.learnable,
          method: move.method,
        },
      })
      return
    }
    kvMoves[name] = {
      ...omit(move, ['learnable', 'method']),
      pokemons: [
        {
          ...omit(pokemon, 'moves'),
          move: {
            learnable: move.learnable,
            method: move.method,
          },
        },
      ],
    }
  })
})
github u-wave / web / src / reducers / playlists.js View on Github external
),
        selectedPlaylistID: meta.tempId,
      };
    }
    case CREATE_PLAYLIST_COMPLETE:
      if (error) {
        return {
          ...state,
          playlists: omit(state.playlists, `${meta.tempId}`),
        };
      }

      return {
        ...state,
        playlists: Object.assign(
          deselectAll(omit(state.playlists, `${meta.tempId}`)),
          {
            [payload.playlist._id]: {
              ...payload.playlist,
              selected: true,
            },
          },
        ),
        selectedPlaylistID: payload.playlist._id,
      };

    case RENAME_PLAYLIST_START:
      return setPlaylistLoading(state, payload.playlistID);
    case RENAME_PLAYLIST_COMPLETE: {
      if (error) {
        return setPlaylistLoading(state, meta.playlistID, false);
      }
github deepsweet / hocs / packages / omit-props / src / index.js View on Github external
  const OmitProps = (props) => createElement(Target, (omit(props, propsToOmit)))
github uber / baseweb / documentation-site / components / yard / config / textarea.ts View on Github external
import {theme, inputProps} from './input';

const textareaProps = require('!!extract-react-types-loader!../../../../src/textarea/textarea.js');

const TextareaConfig: TConfig = {
  imports: {
    'baseui/textarea': {named: ['Textarea']},
  },
  scope: {
    Textarea,
    SIZE,
    ADJOINED,
  },
  theme,
  props: {
    ...omit(inputProps, ['type', 'startEnhancer', 'endEnhancer']),
    overrides: {
      value: undefined,
      type: PropTypes.Custom,
      description: 'Lets you customize all aspects of the component.',
      custom: {
        names: ['Input', 'InputContainer'],
        sharedProps: {
          $isFocused: {
            type: PropTypes.Boolean,
            description: 'True when the component is focused.',
          },
          $disabled: 'disabled',
          $error: 'error',
          $positive: 'positive',
          $adjoined: 'adjoined',
          $size: 'size',
github u-wave / web / src / reducers / chat.js View on Github external
case MUTE_USER:
      return {
        ...state,
        mutedUsers: {
          ...state.mutedUsers,
          [payload.userID]: {
            mutedBy: payload.moderatorID,
            expiresAt: payload.expiresAt,
            expirationTimer: payload.expirationTimer,
          },
        },
      };
    case UNMUTE_USER:
      return {
        ...state,
        mutedUsers: omit(state.mutedUsers, payload.userID),
      };

    default: {
      const nextMessages = reduceNotifications(messages, action);
      if (nextMessages !== messages) {
        return { ...state, messages: nextMessages };
      }
      return state;
    }
  }
}
github imyelo / pokequest-wiki / src / data / index.js View on Github external
let name = move.name.toLowerCase()
    if (name in kvMoves) {
      if (kvMoves[name].pokemons.find((mon) => pokemon.id === mon.id)) {
        return
      }
      kvMoves[name].pokemons.push({
        ...omit(pokemon, 'moves'),
        move: {
          learnable: move.learnable,
          method: move.method,
        },
      })
      return
    }
    kvMoves[name] = {
      ...omit(move, ['learnable', 'method']),
      pokemons: [
        {
          ...omit(pokemon, 'moves'),
          move: {
            learnable: move.learnable,
            method: move.method,
          },
        },
      ],
    }
  })
})

just-omit

copy an object but omit the specified keys

MIT
Latest version published 1 year ago

Package Health Score

65 / 100
Full package analysis

Popular just-omit functions