"use strict";
/**
 * Matcher for cookies
 * Ported from https://github.com/optimizely/client-js/blob/5025fb16720e35213b822c0e673a265d24ae4bff/src/plugins/feature_cookies/matchers/cookies.js
 * @module
 */
var match = require('../match');
/**
 * @type ConditionMatcher
 */
module.exports = {
    // specify the fields needed
    fieldsNeeded: ['cookies'],
    /**
     * @param {Object} value
     * @param {Object} value.cookies
     * @param {Condition} cond
     * @return {Boolean}
     */
    match: function (value, cond) {
        var cookieName = cond.name;
        var valueToMatch = cond.value;
        var matchType = cond.match;
        var cookieValue = value.cookies[cookieName];
        return match.hasMatch(valueToMatch, matchType, cookieValue);
    },
};
