mirror of
https://github.com/vercel/commerce.git
synced 2025-07-23 04:36:49 +00:00
Use kebab case instead of camel case
This commit is contained in:
16
framework/spree/utils/require-config.ts
Normal file
16
framework/spree/utils/require-config.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import MissingConfigurationValueError from '../errors/MissingConfigurationValueError'
|
||||
import type { NonUndefined, ValueOf } from '../types'
|
||||
|
||||
const requireConfig = <T>(isomorphicConfig: T, key: keyof T) => {
|
||||
const valueUnderKey = isomorphicConfig[key]
|
||||
|
||||
if (typeof valueUnderKey === 'undefined') {
|
||||
throw new MissingConfigurationValueError(
|
||||
`Value for configuration key ${key} was undefined.`
|
||||
)
|
||||
}
|
||||
|
||||
return valueUnderKey as NonUndefined<ValueOf<T>>
|
||||
}
|
||||
|
||||
export default requireConfig
|
Reference in New Issue
Block a user