Skip to content

Instantly share code, notes, and snippets.

@jazmon
Last active December 1, 2017 14:11
Show Gist options
  • Save jazmon/6e0153103eb248113414d37934f53bbc to your computer and use it in GitHub Desktop.
Save jazmon/6e0153103eb248113414d37934f53bbc to your computer and use it in GitHub Desktop.
Useful Regexes

Useful regexes

Redux

Add flowtypes to Redux Action Types

export const ([\w_]+) =(?:\n  | )'([\w_\/]+)';
export type $1_TYPE = '$2';\nexport const $1: $1_TYPE = '$2';

Reduce duplicated words from Redux Action types

([\w_]+)/([\w]+)/(FETCH|UPDATE|DELETE)_(?:\1S?)_(START|SUCCESS|FAILURE)
$1/$2/$3_$4

less

Less font-size variable to styled-components helper function

@(font-size-[\w-]+)
${themeSize('$1')}

Less color variable to styled-components helper function

@([\w\-]+)
${themeColor('$1')}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment