import { memoizeJ } from "@thi.ng/memoize/memoizej" ; import type { Stringer } from "./api.js" ; import { repeat } from "./repeat.js" ; param n param ch export const padRight = memoizeJ < number , string | number | undefined , Stringer < any > > ( ( n , ch = " " ) => { const buf = repeat ( String ( ch ) , n ) ; return ( x , len ? ) => { if ( x == null ) return buf ; x = x . toString ( ) ; len = len !== undefined ? len : x . length ; return len ! < n ? x + buf . substr ( len ! ) : x ; } ; } ) ;