[WOK][PATCH] Added method to validate ASCII value

From: Pooja Kulkarni <pkulkark@linux.vnet.ibm.com> Added a method to utils to check if a given field value is ASCII Signed-off-by: Pooja Kulkarni <pkulkark@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

I was not able to apply this patch. Could you rebase it on top of master branch and resend? Thanks, Aline Manera On 04/13/2016 08:04 AM, pkulkark@linux.vnet.ibm.com wrote:
From: Pooja Kulkarni <pkulkark@linux.vnet.ibm.com>
Added a method to utils to check if a given field value is ASCII
Signed-off-by: Pooja Kulkarni <pkulkark@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); +}
participants (2)
-
Aline Manera
-
pkulkark@linux.vnet.ibm.com