/
githubmirror
/
yarn
Обзор
Документация
Войти
/
githubmirror
/
yarn
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
src/util/colorize-diff.js
16 строк
484 B
Jeff Held
Fix: Diffing identical versions should not include extra period at end (#4428)
13 сен 2017, 13:08
13 сен 2017, 13:08
274a26a
Код
Авторство
О чём код?
/* @flow */ import type {Reporter} from '../reporters/index.js'; export default function(from: string, to: string, reporter: Reporter): string { const parts = to.split('.'); const fromParts = from.split('.'); const splitIndex = parts.findIndex((part, i) => part !== fromParts[i]); if (splitIndex === -1) { return from; } const colorized = reporter.format.green(parts.slice(splitIndex).join('.')); return parts.slice(0, splitIndex).concat(colorized).join('.'); }