UNPKG

@newrelic/gatsby-theme-newrelic

Version:

[![Community Project header](https://github.com/newrelic/opensource-website/raw/master/src/images/categories/Community_Project.png)](https://opensource.newrelic.com/oss-category/#community-project)

21 lines (16 loc) 494 B
const { merge, omit } = require('lodash'); const getResolvedEnv = require('./config/resolvedEnv'); const buildConfigGetter = (configKey, { defaults = {}, envOptions = false } = {}) => (themeOptions) => { const config = themeOptions[configKey]; if (!config) { return null; } return merge( defaults, omit(config, ['env']), envOptions && config.env ? config.env[getResolvedEnv(themeOptions)] : {} ); }; module.exports = { buildConfigGetter };