Skip to content

Instantly share code, notes, and snippets.

@rymndhng
Last active October 15, 2017 20:11
Show Gist options
  • Save rymndhng/f7517f2d8ec1da97adb6f0f2553869d3 to your computer and use it in GitHub Desktop.
Save rymndhng/f7517f2d8ec1da97adb6f0f2553869d3 to your computer and use it in GitHub Desktop.
See that `${1:$(string-inflection-upcase-function yas-text)}` is used 4 times.
# -*- mode: snippet -*-
# name: action
# key: act
# expand-env: ((yas-indent-line 'fixed))
# Depends on string-inflection package
# --
export const ${1:$(string-inflection-upcase-function yas-text)} = '${1:$(string-inflection-upcase-function yas-text)}'
type ${1:$$(string-inflection-camelcase-function yas-text)}Payload = {
$0
}
export type $1 = $Action<typeof ${1:$(string-inflection-upcase-function yas-text)}, $1Payload>
export const ${1:$(string-inflection-lower-camelcase-function yas-text)} = (payload: $1Payload) => {
return {
payload,
type: ${1:$(string-inflection-upcase-function yas-text)}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment