diff options
author | Jo-Philipp Wich <jo@mein.io> | 2019-07-07 20:11:35 +0200 |
---|---|---|
committer | Jo-Philipp Wich <jo@mein.io> | 2019-07-07 20:11:35 +0200 |
commit | f970c485cfb2571dd6d4ee6a1ad36958f1410b6a (patch) | |
tree | bac0cd8c4d8fa60c11ac4db804074b2548c020cc /applications/luci-app-firewall/htdocs/luci-static/resources/tools | |
parent | 37ca6fe6d63f748904a18ee5213f52e642980ab5 (diff) |
treewide: switch to shared isObject(), toArray() and sortedKeys() helpers
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'applications/luci-app-firewall/htdocs/luci-static/resources/tools')
-rw-r--r-- | applications/luci-app-firewall/htdocs/luci-static/resources/tools/firewall.js | 26 |
1 files changed, 5 insertions, 21 deletions
diff --git a/applications/luci-app-firewall/htdocs/luci-static/resources/tools/firewall.js b/applications/luci-app-firewall/htdocs/luci-static/resources/tools/firewall.js index 909540eaf9..6785d1ca63 100644 --- a/applications/luci-app-firewall/htdocs/luci-static/resources/tools/firewall.js +++ b/applications/luci-app-firewall/htdocs/luci-static/resources/tools/firewall.js @@ -64,22 +64,6 @@ var protocols = [ 'rohc', 142, 'ROHC', ]; -function toArray(x) { - if (x == null) - return []; - else if (Array.isArray(x)) - return x.map(String); - else if (typeof(x) == 'object') - return [ x ]; - - var s = String(x).trim(); - - if (s == '') - return []; - - return s.split(/\s+/); -} - function lookupProto(x) { if (x == null || x == '') return null; @@ -104,7 +88,7 @@ return L.Class.extend({ }, fmt_mac: function(x) { - var rv = E([]), l = toArray(x); + var rv = E([]), l = L.toArray(x); if (l.length == 0) return null; @@ -123,7 +107,7 @@ return L.Class.extend({ }, fmt_port: function(x, d) { - var rv = E([]), l = toArray(x); + var rv = E([]), l = L.toArray(x); if (l.length == 0) { if (d) { @@ -159,7 +143,7 @@ return L.Class.extend({ }, fmt_ip: function(x, d) { - var rv = E([]), l = toArray(x); + var rv = E([]), l = L.toArray(x); if (l.length == 0) { if (d) { @@ -205,7 +189,7 @@ return L.Class.extend({ }, fmt_icmp_type: function(x) { - var rv = E([]), l = toArray(x); + var rv = E([]), l = L.toArray(x); if (l.length == 0) return null; @@ -228,7 +212,7 @@ return L.Class.extend({ }, fmt_proto: function(x, icmp_types) { - var rv = E([]), l = toArray(x); + var rv = E([]), l = L.toArray(x); if (l.length == 0) return null; |