get = require('lodash.get');
jsonLogic = require('json-logic-js')

module.exports = (conditions, item) ->
  return true if !conditions

  try
    return jsonLogic.apply(conditions, item)

  for attribute, test of conditions
    return false if get(item, attribute.replace(/:/g, '.')) != test
  true
