       before_pass: (ctx) =>
         # once content is loaded, pass contentful data into locals
         promise.then (locals) =>
-          return if @roots.config.locals.contentful
+          if @roots.config.locals.contentful then return
           @roots.config.locals.contentful = locals

pluralize  = require 'pluralize'

errors =
  no_token:     'Missing required options for roots-contentful. Please ensure `access_token` and `space_id` are present.'
  no_type_id:   'One or more of your content types is missing an `id` value'
  sys_conflict: 'One of your content types has `sys` as a field. This is reserved for storing Contentful system metadata, please rename this field to a different value.'

module.exports = (opts) ->
  # throw error if missing required config

  ###

  format_entry = (e) ->
    if _.has(e.fields, 'sys') then W.reject(errors.sys_conflict)
    _.assign(_.omit(e, 'fields'), e.fields)

  # load content
