Hi Justin, What will happen if "restrict" will be undefined ?
Piotr 2017-06-01 7:58 GMT+02:00 <jmcl...@apache.org>: > use === and !== rather than == and != > > > Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo > Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/ce22dc67 > Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/ce22dc67 > Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/ce22dc67 > > Branch: refs/heads/develop > Commit: ce22dc67a26579611d0454eddbeef53a7db5d5d6 > Parents: ee3a98e > Author: Justin Mclean <jmcl...@apache.org> > Authored: Thu Jun 1 13:21:47 2017 +1000 > Committer: Justin Mclean <jmcl...@apache.org> > Committed: Thu Jun 1 13:21:47 2017 +1000 > > ---------------------------------------------------------------------- > .../flex/org/apache/flex/utils/StringUtil.as | 20 ++++++++++---------- > 1 file changed, 10 insertions(+), 10 deletions(-) > ---------------------------------------------------------------------- > > > http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/ > ce22dc67/frameworks/projects/Core/src/main/flex/org/apache/ > flex/utils/StringUtil.as > ---------------------------------------------------------------------- > diff --git > a/frameworks/projects/Core/src/main/flex/org/apache/flex/utils/StringUtil.as > b/frameworks/projects/Core/src/main/flex/org/apache/flex/ > utils/StringUtil.as > index 8674180..f53ba62 100644 > --- a/frameworks/projects/Core/src/main/flex/org/apache/flex/ > utils/StringUtil.as > +++ b/frameworks/projects/Core/src/main/flex/org/apache/flex/ > utils/StringUtil.as > @@ -84,12 +84,12 @@ package org.apache.flex.utils > */ > public static function substitute(str:String, ... > rest):String > { > - if (str == null) return ''; > + if (str === null) return ''; > > // Replace all of the parameters in the msg string. > var len:uint = rest.length; > var args:Array; > - if (len == 1 && rest[0] is Array) > + if (len === 1 && rest[0] is Array) > { > args = rest[0] as Array; > len = args.length; > @@ -125,7 +125,7 @@ package org.apache.flex.utils > */ > public static function repeat(str:String, n:int):String > { > - if (n == 0) > + if (n === 0) > return ""; > var a:Array = []; > for (var i:int = 0; i < n; i++) > @@ -158,11 +158,11 @@ package org.apache.flex.utils > public static function restrict(str:String, > restrict:String):String > { > // A null 'restrict' string means all characters > are allowed. > - if (restrict == null) > + if (restrict === null) > return str; > > // An empty 'restrict' string means no characters > are allowed. > - if (restrict == "") > + if (restrict === "") > return ""; > > // Otherwise, we need to test each character in > 'str' > @@ -285,7 +285,7 @@ package org.apache.flex.utils > if (n > 0) > { > code = restrict.charCodeAt(0); > - if (code == 94) // caret > + if (code === 94) // caret > allowIt = true; > } > > @@ -296,11 +296,11 @@ package org.apache.flex.utils > var acceptCode:Boolean = false; > if (!inBackSlash) > { > - if (code == 45) // hyphen > + if (code === 45) // hyphen > inRange = true; > - else if (code == 94) // caret > + else if (code === 94) // caret > setFlag = !setFlag; > - else if (code == 92) // backslash > + else if (code === 92) // backslash > inBackSlash = true; > else > acceptCode = true; > @@ -322,7 +322,7 @@ package org.apache.flex.utils > } > else > { > - if (charCode == code) > + if (charCode === code) > allowIt = setFlag; > lastCode = code; > } > >