'use strict' ; import { um } from './utilitymanager' ; export namespace lineutilities { export function removeDuplicatedLines ( ) { um . utilityManager ( { utilType : um . TIXUtilityType . utLinesUtility , sp : um . TIXSelPolicy . All , } , ( up ) : string [ ] => { const arr = up . inlines ; for ( let i = arr . length - 1 ; i >= 0 ; i -- ) { if ( arr [ i + 1 ] === arr [ i ] ) { arr . splice ( i + 1 , 1 ) ; } } return arr ; } ) ; } export function removeEmptyLines ( ) { um . utilityManager ( { utilType : um . TIXUtilityType . utLinesUtility , sp : um . TIXSelPolicy . All , } , ( up ) : string [ ] => { const arr = up . inlines ; for ( let i = arr . length - 1 ; i >= 0 ; i -- ) { if ( ! arr [ i ] . trim ( ) ) { arr . splice ( i , 1 ) ; } } return arr ; } ) ; } export function indentOneSpace ( ) { um . utilityManager ( { utilType : um . TIXUtilityType . utLineUtility , sp : um . TIXSelPolicy . All , } , ( up ) : string => ' ' + up . intext ) ; } export function outdentOneSpace ( ) { um . utilityManager ( { utilType : um . TIXUtilityType . utLineUtility , sp : um . TIXSelPolicy . All , } , ( up ) : string => up . intext !== '' && up . intext [ 0 ] === ' ' ? up . intext . substr ( 1 ) : up . intext ) ; } }