Module function reference

diff

A reference entry for diff

Module function · Utilities

diff (string left, string right[, boolean files]) ⇒ list

Compares two strings line by line, or the UTF-8 contents of two files when files is true.

Notes

This function compares two values line by line. By default, left and right are treated as text. Set files to true to instead compare the UTF-8 contents of the two file paths.

The result is a list of maps in comparison order. Each map contains operation (equal, add or remove), line, left_line and right_line. Line numbers start at 1; a missing line on either side is represented by 0.