Haliont/diffcalculus

View on GitHub
src/index.js

Summary

Maintainability
A
0 mins
Test Coverage
import { readFileSync } from 'fs';
import { extname } from 'path';
import parse from './parser';
import buildAst from './builder';
import render from './renderers';

export default (firstFilePath, secondFilePath, format = 'standart') => {
  const obj1 = parse(extname(firstFilePath), readFileSync(firstFilePath, 'utf8'));
  const obj2 = parse(extname(secondFilePath), readFileSync(secondFilePath, 'utf8'));
  const diff = buildAst(obj1, obj2);
  return render(diff, format);
};