How to use the @nuxt/utils.isPureObject function in @nuxt/utils

To help you get started, we’ve selected a few @nuxt/utils examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github nuxt / nuxt.js / packages / webpack / src / utils / postcss.js View on Github external
loadPlugins (config) {
    const { plugins } = config
    if (isPureObject(plugins)) {
      // Map postcss plugins into instances on object mode once
      config.plugins = this.sortPlugins(config)
        .map((p) => {
          const plugin = this.buildContext.nuxt.resolver.requireModule(p)
          const opts = plugins[p]
          if (opts === false) {
            return // Disabled
          }
          return plugin(opts)
        })
        .filter(Boolean)
    }
  }
github nuxt / nuxt.js / packages / webpack / src / utils / postcss.js View on Github external
config () {
    /* istanbul ignore if */
    if (!this.postcssOptions) {
      return false
    }

    let config = this.configFromFile()
    if (config) {
      return config
    }

    config = this.normalize(cloneDeep(this.postcssOptions))

    // Apply default plugins
    if (isPureObject(config)) {
      if (config.preset) {
        this.preset = config.preset
        delete config.preset
      }
      if (Array.isArray(config.plugins)) {
        defaults(config, this.defaultConfig)
      } else {
        // Keep the order of default plugins
        config = merge({}, this.defaultConfig, config)
        this.loadPlugins(config)
      }
      return config
    }
  }
}
github nuxt / nuxt.js / packages / config / src / options.js View on Github external
}

  // If store defined, update store options to true unless explicitly disabled
  if (
    options.store !== false &&
    fs.existsSync(path.join(options.srcDir, options.dir.store)) &&
    fs.readdirSync(path.join(options.srcDir, options.dir.store))
      .find(filename => filename !== 'README.md' && filename[0] !== '.')
  ) {
    options.store = true
  }

  // SPA loadingIndicator
  if (options.loadingIndicator) {
    // Normalize loadingIndicator
    if (!isPureObject(options.loadingIndicator)) {
      options.loadingIndicator = { name: options.loadingIndicator }
    }

    // Apply defaults
    options.loadingIndicator = Object.assign(
      {
        name: 'default',
        color: (options.loading && options.loading.color) || '#D3D3D3',
        color2: '#F5F5F5',
        background: (options.manifest && options.manifest.theme_color) || 'white',
        dev: options.dev,
        loading: options.messages.loading
      },
      options.loadingIndicator
    )
  }