refactor
This commit is contained in:
		@@ -91,20 +91,19 @@ export function getQueryObject(url) {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 *get getByteLen
 | 
					 * @param {Sting} input value
 | 
				
			||||||
 * @param {Sting} val input value
 | 
					 | 
				
			||||||
 * @returns {number} output value
 | 
					 * @returns {number} output value
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
export function getByteLen(val) {
 | 
					export function byteLength(str) {
 | 
				
			||||||
  let len = 0
 | 
					  // returns the byte length of an utf8 string
 | 
				
			||||||
  for (let i = 0; i < val.length; i++) {
 | 
					  let s = str.length
 | 
				
			||||||
    if (val[i].match(/[^\x00-\xff]/gi) != null || (val[i] >= 'A' && val[i] <= 'Z')) {
 | 
					  for (var i = str.length - 1; i >= 0; i--) {
 | 
				
			||||||
      len += 1
 | 
					    const code = str.charCodeAt(i)
 | 
				
			||||||
    } else {
 | 
					    if (code > 0x7f && code <= 0x7ff) s++
 | 
				
			||||||
      len += 0.5
 | 
					    else if (code > 0x7ff && code <= 0xffff) s += 2
 | 
				
			||||||
    }
 | 
					    if (code >= 0xDC00 && code <= 0xDFFF) i--
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  return Math.floor(len)
 | 
					  return s
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export function cleanArray(actual) {
 | 
					export function cleanArray(actual) {
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user