| author | Stephen Paul Weber
<singpolyma@singpolyma.net> 2025-03-04 16:59:25 UTC |
| committer | Stephen Paul Weber
<singpolyma@singpolyma.net> 2025-03-04 16:59:25 UTC |
| parent | 3290c27df70c6a425536cfaad02fa61a565b2c46 |
| snikket/Autolink.hx | +7 | -7 |
| snikket/EmojiUtil.hx | +1 | -1 |
| snikket/persistence/MediaStoreCache.js | +4 | -4 |
| test/TestStanza.hx | +20 | -20 |
diff --git a/snikket/Autolink.hx b/snikket/Autolink.hx index 1a31de9..56f4563 100644 --- a/snikket/Autolink.hx +++ b/snikket/Autolink.hx @@ -333,13 +333,13 @@ class Autolink { public static function one(s:String, start:Int) { final matches = [ - match(s, start, XMPP_URI, false), - match(s, start, TEL_URI, false), - match(s, start, SMS_URI, false), - match(s, start, AUTOLINK_WEB_URL, true) - ]; - matches.sort((x, y) -> x.start - y.start); // Should use minimum... - return matches.find((match) -> match.span != null) ?? matches[0]; + match(s, start, XMPP_URI, false), + match(s, start, TEL_URI, false), + match(s, start, SMS_URI, false), + match(s, start, AUTOLINK_WEB_URL, true) + ]; + matches.sort((x, y) -> x.start - y.start); // Should use minimum... + return matches.find((match) -> match.span != null) ?? matches[0]; } private static function match(s:String, start:Int, pattern:String, addHttps:Bool) { diff --git a/snikket/EmojiUtil.hx b/snikket/EmojiUtil.hx index 2c86b63..c7a3a86 100644 --- a/snikket/EmojiUtil.hx +++ b/snikket/EmojiUtil.hx @@ -247,7 +247,7 @@ class UnicodeRange implements UnicodeSet { private final lower: Int; private final upper: Int; - public function new(lower: Int, upper: Int) { + public function new(lower: Int, upper: Int) { this.lower = lower; this.upper = upper; } diff --git a/snikket/persistence/MediaStoreCache.js b/snikket/persistence/MediaStoreCache.js index 757fe67..7afdba9 100644 --- a/snikket/persistence/MediaStoreCache.js +++ b/snikket/persistence/MediaStoreCache.js @@ -25,13 +25,13 @@ export default (cacheName) => { })().then(callback); }, - removeMedia(hashAlgorithm, hash) { + removeMedia(hashAlgorithm, hash) { (async () => { let niUrl; if (hashAlgorithm === "sha-256") { niUrl = mkNiUrl(hashAlgorithm, hash); } else { - niUrl = this.kv && await new Promise((resolve) => this.kv.get(mkNiUrl(hashAlgorithm, hash), resolve)); + niUrl = this.kv && await new Promise((resolve) => this.kv.get(mkNiUrl(hashAlgorithm, hash), resolve)); if (!niUrl) return; } @@ -39,7 +39,7 @@ export default (cacheName) => { })(); }, - routeHashPathSW() { + routeHashPathSW() { const waitForMedia = async (uri) => { const r = await this.getMediaResponse(uri); if (r) return r; @@ -61,7 +61,7 @@ export default (cacheName) => { if (uri.split("/")[3] === "sha-256") { niUrl = uri; } else { - niUrl = this.kv && await new Promise((resolve) => this.kv.get(uri, resolve)); + niUrl = this.kv && await new Promise((resolve) => this.kv.get(uri, resolve)); if (!niUrl) { return null; } diff --git a/test/TestStanza.hx b/test/TestStanza.hx index a80d8fa..a9970dd 100644 --- a/test/TestStanza.hx +++ b/test/TestStanza.hx @@ -6,27 +6,27 @@ import utest.Async; import snikket.Stanza; class TestStanza extends utest.Test { - public function testRemoveChildren() { - final s = new Stanza("test", { xmlns: "urn:example:foo" }) - .textTag("odd", "") - .textTag("even", "") - .textTag("odd", "") - .textTag("even", ""); + public function testRemoveChildren() { + final s = new Stanza("test", { xmlns: "urn:example:foo" }) + .textTag("odd", "") + .textTag("even", "") + .textTag("odd", "") + .textTag("even", ""); - s.removeChildren("odd"); + s.removeChildren("odd"); - var count = 0; - for(tag in s.allTags()) { - count++; - Assert.equals("even", tag.name); - } - Assert.equals(2, count); - } + var count = 0; + for(tag in s.allTags()) { + count++; + Assert.equals("even", tag.name); + } + Assert.equals(2, count); + } - public function testParseXmlBool() { - Assert.equals(true, Stanza.parseXmlBool("true")); - Assert.equals(true, Stanza.parseXmlBool("1")); - Assert.equals(false, Stanza.parseXmlBool("false")); - Assert.equals(false, Stanza.parseXmlBool("0")); - } + public function testParseXmlBool() { + Assert.equals(true, Stanza.parseXmlBool("true")); + Assert.equals(true, Stanza.parseXmlBool("1")); + Assert.equals(false, Stanza.parseXmlBool("false")); + Assert.equals(false, Stanza.parseXmlBool("0")); + } }