"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.hasPrevNodeIgnore = hasPrevNodeIgnore;
exports.isAtRule = isAtRule;
exports.isComment = isComment;
exports.isCommentContentSame = isCommentContentSame;
exports.isInsideMediaQuery = isInsideMediaQuery;
exports.isThisComment = isThisComment;

function isComment(node) {
  return node && node.type && node.type === 'comment';
}

function isCommentContentSame(node, content) {
  return node.text.toLowerCase() === content;
}

function isThisComment(node, ignoreComment) {
  return isComment(node) && isCommentContentSame(node, ignoreComment);
}

function hasPrevNodeIgnore(index, prevNode, ignoreComment) {
  return index !== 0 && isThisComment(prevNode, ignoreComment);
}

function isAtRule(rule) {
  return rule.parent && rule.parent.type === 'atrule';
}

function isInsideMediaQuery(rule) {
  return isAtRule(rule) && rule.parent && rule.parent.name === 'media' ? true : false;
}