построчное сравнение двух текстов
// результат diff появится здесь
curl -sX POST 'https://api.whittly.dev/v1/text/diff' \
-H 'Authorization: Bearer $WHITTLY_API_KEY' \
-H 'Content-Type: application/json' \
-d '{"a":"hello\nworld","b":"hello\nearth"}'
const res = await fetch('https://api.whittly.dev/v1/text/diff', {
method: 'POST',
headers: {
'Authorization': 'Bearer ' + apiKey,
'Content-Type': 'application/json',
},
body: JSON.stringify({ a: "hello\nworld", b: "hello\nearth" }),
});
const data = await res.json();
const { data } = await axios.post(
'https://api.whittly.dev/v1/text/diff',
{ a: "hello\nworld", b: "hello\nearth" },
{ headers: { Authorization: 'Bearer ' + apiKey } }
);
Diff сравнивает два текста и определяет, какие строки были добавлены, удалены или остались неизменными. Инструмент выполняет построчное сравнение и подсвечивает изменения в зелёно-красной цветовой схеме как в Git.