string-kit
Advanced tools
Comparing version 0.18.2 to 0.18.3
@@ -128,2 +128,18 @@ /* | ||
// Return a string that does not exceed the character limit | ||
unicode.truncateLength = unicode.truncate = ( str , limit ) => { | ||
var position = 0 , length = 0 ; | ||
for ( let char of str ) { | ||
if ( length === limit ) { return str.slice( 0 , position ) ; } | ||
length ++ ; | ||
position += char.length ; | ||
} | ||
// The string remains unchanged | ||
return str ; | ||
} ; | ||
// Return the width of a string in a terminal/monospace font | ||
@@ -159,5 +175,3 @@ unicode.width = str => { | ||
// Return a string that does not exceed the limit. | ||
// Return a string that does not exceed the width limit (taking wide-char into considerations) | ||
unicode.widthLimit = // DEPRECATED | ||
@@ -164,0 +178,0 @@ unicode.truncateWidth = ( str , limit ) => { |
{ | ||
"name": "string-kit", | ||
"version": "0.18.2", | ||
"version": "0.18.3", | ||
"engines": { | ||
@@ -5,0 +5,0 @@ "node": ">=14.15.0" |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
808461
7987