-
-
Notifications
You must be signed in to change notification settings - Fork 142
/
options.js
26 lines (22 loc) · 910 Bytes
/
options.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
function getOption({ opts }, name, defaultValue = true) {
return opts[name] === undefined || opts[name] === null
? defaultValue
: opts[name]
}
export const useDisplayName = state => getOption(state, 'displayName')
export const useTopLevelImportPaths = state =>
getOption(state, 'topLevelImportPaths', [])
export const useSSR = state => getOption(state, 'ssr', true)
export const useFileName = state => getOption(state, 'fileName')
export const useMinify = state => getOption(state, 'minify')
export const useTranspileTemplateLiterals = state =>
getOption(state, 'transpileTemplateLiterals')
export const useNamespace = state => {
const namespace = getOption(state, 'namespace', '')
if (namespace) {
return `${namespace}__`
}
return ''
}
export const usePureAnnotation = state => getOption(state, 'pure', false)
export const useCssProp = state => getOption(state, 'cssProp', true)