/
githubmirror
/
components
Обзор
Документация
Войти
/
githubmirror
/
components
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
src/material/schematics/migration-utilities/update.ts
23 строки
757 B
Naji
docs: replace angular.io links with angular.dev (#29734)
19 сен 2024, 13:57
Не верифицирован
19 сен 2024, 13:57
5782834
Код
Авторство
О чём код?
/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.dev/license */ /** Stores the data needed to make a single update to a file. */ export interface Update { /** The start index of the location of the update. */ offset: number; /** A function to be used to update the file content. */ updateFn: (text: string) => string; } /** Applies the updates to the given file content in reverse offset order. */ export function writeUpdates(content: string, updates: Update[]): string { updates.sort((a, b) => b.offset - a.offset); updates.forEach(update => (content = update.updateFn(content))); return content; }