Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
  • Loading branch information
kgryte authored Nov 10, 2023
1 parent 8f97891 commit b93b714
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@

// MODULES //

var isOdd = require( '@stdlib/math/base/assert/is-odd' );
var round = require( '@stdlib/math/base/special/round' );
var floor = require( '@stdlib/math/base/special/floor' );


// MAIN //
Expand Down Expand Up @@ -77,7 +77,8 @@ function truncateMiddle( str, len, seq ) {
}

seqStart = round( finalLength / 2 );
seqEnd = strLength - floor( finalLength / 2 );
seqEnd = ( isOdd( finalLength ) ) ? seqStart-1 : seqStart;
seqEnd = strLength - seqEnd;

return str.substring( 0, seqStart ) + seq + str.substring( seqEnd );
}
Expand Down

0 comments on commit b93b714

Please sign in to comment.