[Kimchi-devel] [WOK][PATCH] Added method to validate ASCII value

pkulkark at linux.vnet.ibm.com pkulkark at linux.vnet.ibm.com
Wed Apr 13 11:04:52 UTC 2016


From: Pooja Kulkarni <pkulkark at linux.vnet.ibm.com>

Added a method to utils to check
if a given field value is ASCII

Signed-off-by: Pooja Kulkarni <pkulkark at linux.vnet.ibm.com>
---
 ui/js/src/wok.utils.js | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/ui/js/src/wok.utils.js b/ui/js/src/wok.utils.js
index e5701e6..d7dd8a3 100644
--- a/ui/js/src/wok.utils.js
+++ b/ui/js/src/wok.utils.js
@@ -193,3 +193,7 @@ wok.urlSafeB64Decode = function(str) {
 wok.urlSafeB64Encode = function(str) {
     return $.base64.btoa(str, true).replace(/\+/g, '-').replace(/\//g, '_');
 }
+
+wok.isASCII = function(field) {
+    return /^[\x00-\x7F]*$/.test(field);
+}
-- 
2.1.0




More information about the Kimchi-devel mailing list