@@ -73,7 +73,8 @@ class StarkString extends NativeString {
7373
7474 /**
7575 * Used for decode Persian Characters in URL
76- * https://fa.wikipedia.org/wiki/مدیاویکی:Gadget-Extra-Editbuttons-Functions.js
76+ * https://fa.wikipedia.org/wiki/مدیاویکی:Gadget-Extra-Editbuttons-Functions.
77+ * s
7778 */
7879 fixURL ( ) : StarkString {
7980 this . _value = decodeURL ( this . _value ) ;
@@ -82,7 +83,8 @@ class StarkString extends NativeString {
8283
8384 /**
8485 * Used for decode Persian Characters in URL
85- * https://fa.wikipedia.org/wiki/مدیاویکی:Gadget-Extra-Editbuttons-Functions.js
86+ * https://fa.wikipedia.org/wiki/مدیاویکی:Gadget-Extra-Editbuttons-Functions.
87+ * s
8688 */
8789 decodeURL ( ) : StarkString {
8890 this . _value = decodeURL ( this . _value ) ;
@@ -124,8 +126,13 @@ class StarkString extends NativeString {
124126 }
125127
126128 /** Remove anything expect numbers */
127- parseNumber ( ) : StarkString {
129+ parseNumber ( { max } : { max ?: number } = { } ) : StarkString {
128130 this . _value = parseNumber ( this . _value ) ;
131+ if ( typeof max === "number" ) {
132+ if ( Number ( this . _value ) > max ) {
133+ this . _value = String ( max ) ;
134+ }
135+ }
129136 return this ;
130137 }
131138
@@ -145,4 +152,4 @@ class StarkString extends NativeString {
145152//CommonJS module is defined
146153export default starkString ;
147154
148- export type { StarkString }
155+ export type { StarkString } ;
0 commit comments