import { decorate as markdownDecorator } from './markdown'
import testRule from 'skypager-util/lib/path-matcher'

export const rules = [
  /.*\.(test|spec).*\.(md|js)$/i
]

export const testDocument = (doc) => (
  typeof rules.find(rule => testRule(rule, doc.fileBaseName)) !== 'undefined'
)

export const decorate = (doc) => {
  if (doc.isJavascript) {
    doc = javascript(doc)
  }

  if (doc.isMarkdown) {
    doc = markdown(doc)
  }

  return doc
}
  

export const javascript = (doc) => {
  return doc 
}

export const markdown = (doc) => {
  return doc
} 