Suite of AT Protocol TypeScript libraries built on web standards
20
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix tests

+41 -216
+25 -24
data/language.ts
··· 1 1 const BCP47_REGEXP = 2 - /^((?<grandfathered>(en-GB-oed|i-ami|i-bnn|i-default|i-enochian|i-hak|i-klingon|i-lux|i-mingo|i-navajo|i-pwn|i-tao|i-tay|i-tsu|sgn-BE-FR|sgn-BE-NL|sgn-CH-DE)|(art-lojban|cel-gaulish|no-bok|no-nyn|zh-guoyu|zh-hakka|zh-min|zh-min-nan|zh-xiang))|((?<language>([A-Za-z]{2,3}(-(?<extlang>[A-Za-z]{3}(-[A-Za-z]{3}){0,2}))?)|[A-Za-z]{4}|[A-Za-z]{5,8})(-(?<script>[A-Za-z]{4}))?(-(?<region>[A-Za-z]{2}|[0-9]{3}))?(-(?<variant>[A-Za-z0-9]{5,8}|[0-9][A-Za-z0-9]{3}))*(-(?<extension>[0-9A-WY-Za-wy-z](-[A-Za-z0-9]{2,8})+))*(-(?<privateUseA>x(-[A-Za-z0-9]{1,8})+))?)|(?<privateUseB>x(-[A-Za-z0-9]{1,8})+))$/ 2 + /^((?<grandfathered>(en-GB-oed|i-ami|i-bnn|i-default|i-enochian|i-hak|i-klingon|i-lux|i-mingo|i-navajo|i-pwn|i-tao|i-tay|i-tsu|sgn-BE-FR|sgn-BE-NL|sgn-CH-DE)|(art-lojban|cel-gaulish|no-bok|no-nyn|zh-guoyu|zh-hakka|zh-min|zh-min-nan|zh-xiang))|((?<language>([A-Za-z]{2,3}(-(?<extlang>[A-Za-z]{3}(-[A-Za-z]{3}){0,2}))?)|[A-Za-z]{4}|[A-Za-z]{5,8})(-(?<script>[A-Za-z]{4}))?(-(?<region>[A-Za-z]{2}|[0-9]{3}))?(-(?<variant>[A-Za-z0-9]{5,8}|[0-9][A-Za-z0-9]{3}))*(-(?<extension>[0-9A-WY-Za-wy-z](-[A-Za-z0-9]{2,8})+))*(-(?<privateUseA>x(-[A-Za-z0-9]{1,8})+))?)|(?<privateUseB>x(-[A-Za-z0-9]{1,8})+))$/; 3 3 4 4 export type LanguageTag = { 5 - grandfathered?: string 6 - language?: string 7 - extlang?: string 8 - script?: string 9 - region?: string 10 - variant?: string 11 - extension?: string 12 - privateUse?: string 13 - } 5 + grandfathered?: string; 6 + language?: string; 7 + extlang?: string; 8 + script?: string; 9 + region?: string; 10 + variant?: string; 11 + extension?: string; 12 + privateUse?: string; 13 + }; 14 14 15 15 export function parseLanguage(input: string): LanguageTag | null { 16 - const parsed = input.match(BCP47_REGEXP) 17 - if (!parsed?.groups) return null 16 + const parsed = input.match(BCP47_REGEXP); 17 + if (!parsed?.groups) return null; 18 18 19 - const { groups } = parsed 20 - return { 21 - grandfathered: groups.grandfathered, 22 - language: groups.language, 23 - extlang: groups.extlang, 24 - script: groups.script, 25 - region: groups.region, 26 - variant: groups.variant, 27 - extension: groups.extension, 28 - privateUse: groups.privateUseA || groups.privateUseB, 29 - } 19 + const { groups } = parsed; 20 + const result: LanguageTag = {}; 21 + if (groups.grandfathered) result.grandfathered = groups.grandfathered; 22 + if (groups.language) result.language = groups.language; 23 + if (groups.extlang) result.extlang = groups.extlang; 24 + if (groups.script) result.script = groups.script; 25 + if (groups.region) result.region = groups.region; 26 + if (groups.variant) result.variant = groups.variant; 27 + if (groups.extension) result.extension = groups.extension; 28 + const privateUse = groups.privateUseA || groups.privateUseB; 29 + if (privateUse) result.privateUse = privateUse; 30 + return result; 30 31 } 31 32 32 33 /** ··· 35 36 * @see {@link https://www.rfc-editor.org/rfc/rfc5646.html#section-2.1} 36 37 */ 37 38 export function isLanguage(input: string): boolean { 38 - return BCP47_REGEXP.test(input) 39 + return BCP47_REGEXP.test(input); 39 40 }
+8 -8
data/object.ts
··· 1 1 export function isObject(input: unknown): input is object { 2 - return input != null && typeof input === 'object' 2 + return input != null && typeof input === "object"; 3 3 } 4 4 5 - const ObjectProto = Object.prototype 6 - const ObjectToString = Object.prototype.toString 5 + const ObjectProto = Object.prototype; 6 + const ObjectToString = Object.prototype.toString; 7 7 8 8 export function isPlainObject( 9 9 input: unknown, 10 10 ): input is object & Record<string, unknown> { 11 - if (!input || typeof input !== 'object') return false 12 - const proto = Object.getPrototypeOf(input) 13 - if (proto === null) return true 11 + if (!input || typeof input !== "object") return false; 12 + const proto = Object.getPrototypeOf(input); 13 + if (proto === null) return true; 14 14 return ( 15 15 (proto === ObjectProto || 16 16 // Needed to support NodeJS's `runInNewContext` which produces objects 17 17 // with a different prototype 18 18 Object.getPrototypeOf(proto) === null) && 19 - ObjectToString.call(input) === '[object Object]' 20 - ) 19 + ObjectToString.call(input) === "[object Object]" 20 + ); 21 21 }
+1 -1
data/tests/utf8_test.ts
··· 1 - import { utf8Len } from "../index.ts"; 1 + import { utf8Len } from "@atp/data"; 2 2 import { graphemeLen } from "../utf8.ts"; 3 3 import { assertEquals } from "@std/assert"; 4 4
-1
deno.json
··· 10 10 "xrpc", 11 11 "xrpc-server", 12 12 "sync", 13 - "cli", 14 13 "data", 15 14 "lex", 16 15 "lex-gen"
+7 -182
deno.lock
··· 1 1 { 2 2 "version": "5", 3 3 "specifiers": { 4 - "jsr:@cliffy/ansi@1.0.0-rc.8": "1.0.0-rc.8", 5 - "jsr:@cliffy/ansi@^1.0.0-rc.8": "1.0.0-rc.8", 6 - "jsr:@cliffy/command@^1.0.0-rc.8": "1.0.0-rc.8", 7 - "jsr:@cliffy/flags@1.0.0-rc.8": "1.0.0-rc.8", 8 - "jsr:@cliffy/internal@1.0.0-rc.8": "1.0.0-rc.8", 9 - "jsr:@cliffy/keycode@1.0.0-rc.8": "1.0.0-rc.8", 10 - "jsr:@cliffy/prompt@^1.0.0-rc.8": "1.0.0-rc.8", 11 - "jsr:@cliffy/table@1.0.0-rc.8": "1.0.0-rc.8", 12 - "jsr:@david/code-block-writer@13": "13.0.3", 13 4 "jsr:@hono/hono@^4.9.8": "4.9.9", 14 5 "jsr:@logtape/file@^1.2.0-dev.344+834f24a9": "1.2.0-dev.344+834f24a9", 15 6 "jsr:@logtape/logtape@^1.2.0-dev.344+834f24a9": "1.2.0-dev.344+834f24a9", 16 7 "jsr:@noble/curves@^2.0.1": "2.0.1", 17 8 "jsr:@noble/hashes@2": "2.0.1", 18 9 "jsr:@noble/hashes@^2.0.1": "2.0.1", 19 - "jsr:@std/assert@^1.0.14": "1.0.15", 20 - "jsr:@std/assert@~1.0.6": "1.0.15", 10 + "jsr:@std/assert@^1.0.14": "1.0.16", 21 11 "jsr:@std/bytes@^1.0.5": "1.0.6", 22 12 "jsr:@std/cbor@~0.1.8": "0.1.8", 23 13 "jsr:@std/encoding@^1.0.10": "1.0.10", 24 - "jsr:@std/encoding@~1.0.5": "1.0.10", 25 - "jsr:@std/fmt@~1.0.2": "1.0.8", 26 - "jsr:@std/fs@1": "1.0.19", 27 - "jsr:@std/fs@^1.0.19": "1.0.19", 28 - "jsr:@std/internal@^1.0.10": "1.0.12", 14 + "jsr:@std/fs@^1.0.19": "1.0.20", 29 15 "jsr:@std/internal@^1.0.12": "1.0.12", 30 - "jsr:@std/internal@^1.0.9": "1.0.12", 31 - "jsr:@std/io@~0.224.9": "0.224.9", 32 16 "jsr:@std/json@^1.0.2": "1.0.2", 33 17 "jsr:@std/jsonc@^1.0.1": "1.0.2", 34 - "jsr:@std/path@1": "1.1.2", 35 - "jsr:@std/path@^1.1.1": "1.1.2", 36 - "jsr:@std/path@^1.1.2": "1.1.2", 37 - "jsr:@std/path@~1.0.6": "1.0.9", 38 18 "jsr:@std/streams@^1.0.9": "1.0.13", 39 - "jsr:@std/text@~1.0.7": "1.0.16", 40 - "jsr:@ts-morph/common@0.27": "0.27.0", 41 - "jsr:@ts-morph/ts-morph@26": "26.0.0", 42 19 "jsr:@zod/zod@^4.1.11": "4.1.11", 43 - "npm:@atproto/api@0.18": "0.18.0", 44 20 "npm:@atproto/crypto@*": "0.4.4", 45 21 "npm:@did-plc/lib@^0.0.4": "0.0.4", 46 22 "npm:@did-plc/server@^0.0.1": "0.0.1_express@4.21.2", ··· 55 31 "npm:zod@^4.1.11": "4.1.11" 56 32 }, 57 33 "jsr": { 58 - "@cliffy/ansi@1.0.0-rc.8": { 59 - "integrity": "ba37f10ce55bbfbdd8ddd987f91f029b17bce88385b98ba3058870f3b007b80c", 60 - "dependencies": [ 61 - "jsr:@cliffy/internal", 62 - "jsr:@std/encoding@~1.0.5", 63 - "jsr:@std/fmt", 64 - "jsr:@std/io" 65 - ] 66 - }, 67 - "@cliffy/command@1.0.0-rc.8": { 68 - "integrity": "758147790797c74a707e5294cc7285df665422a13d2a483437092ffce40b5557", 69 - "dependencies": [ 70 - "jsr:@cliffy/flags", 71 - "jsr:@cliffy/internal", 72 - "jsr:@cliffy/table", 73 - "jsr:@std/fmt", 74 - "jsr:@std/text" 75 - ] 76 - }, 77 - "@cliffy/flags@1.0.0-rc.8": { 78 - "integrity": "0f1043ce6ef037ba1cb5fe6b1bcecb25dc2f29371a1c17f278ab0f45e4b6f46c", 79 - "dependencies": [ 80 - "jsr:@std/text" 81 - ] 82 - }, 83 - "@cliffy/internal@1.0.0-rc.8": { 84 - "integrity": "34cdf2fad9b084b5aed493b138d573f52d4e988767215f7460daf0b918ff43d8" 85 - }, 86 - "@cliffy/keycode@1.0.0-rc.8": { 87 - "integrity": "76dbf85a67ec0aea2e29ca049b8507b6b3f62a2a971bd744d8d3fc447c177cd9" 88 - }, 89 - "@cliffy/prompt@1.0.0-rc.8": { 90 - "integrity": "eba403ea1d47b9971bf2210fa35f4dc7ebd2aba87beec9540ae47552806e2f25", 91 - "dependencies": [ 92 - "jsr:@cliffy/ansi@1.0.0-rc.8", 93 - "jsr:@cliffy/internal", 94 - "jsr:@cliffy/keycode", 95 - "jsr:@std/assert@~1.0.6", 96 - "jsr:@std/fmt", 97 - "jsr:@std/io", 98 - "jsr:@std/path@~1.0.6", 99 - "jsr:@std/text" 100 - ] 101 - }, 102 - "@cliffy/table@1.0.0-rc.8": { 103 - "integrity": "8bbcdc2ba5e0061b4b13810a24e6f5c6ab19c09f0cce9eb691ccd76c7c6c9db5", 104 - "dependencies": [ 105 - "jsr:@std/fmt" 106 - ] 107 - }, 108 - "@david/code-block-writer@13.0.3": { 109 - "integrity": "f98c77d320f5957899a61bfb7a9bead7c6d83ad1515daee92dbacc861e13bb7f" 110 - }, 111 34 "@hono/hono@4.9.8": { 112 35 "integrity": "908150f13e90181a051a3af3bf15203aff00190682afedfd38824d0cb9299a95" 113 36 }, ··· 132 55 "@noble/hashes@2.0.1": { 133 56 "integrity": "e0e908292a0bf91099cf8ba0720a1647cef82ab38b588815b5e9535b4ff4d7bb" 134 57 }, 135 - "@std/assert@1.0.15": { 136 - "integrity": "d64018e951dbdfab9777335ecdb000c0b4e3df036984083be219ce5941e4703b", 58 + "@std/assert@1.0.16": { 59 + "integrity": "6a7272ed1eaa77defe76e5ff63ca705d9c495077e2d5fd0126d2b53fc5bd6532", 137 60 "dependencies": [ 138 - "jsr:@std/internal@^1.0.12" 61 + "jsr:@std/internal" 139 62 ] 140 63 }, 141 64 "@std/bytes@1.0.6": { ··· 151 74 "@std/encoding@1.0.10": { 152 75 "integrity": "8783c6384a2d13abd5e9e87a7ae0520a30e9f56aeeaa3bdf910a3eaaf5c811a1" 153 76 }, 154 - "@std/fmt@1.0.8": { 155 - "integrity": "71e1fc498787e4434d213647a6e43e794af4fd393ef8f52062246e06f7e372b7" 156 - }, 157 - "@std/fs@1.0.19": { 158 - "integrity": "051968c2b1eae4d2ea9f79a08a3845740ef6af10356aff43d3e2ef11ed09fb06", 159 - "dependencies": [ 160 - "jsr:@std/internal@^1.0.9", 161 - "jsr:@std/path@^1.1.1" 162 - ] 77 + "@std/fs@1.0.20": { 78 + "integrity": "e953206aae48d46ee65e8783ded459f23bec7dd1f3879512911c35e5484ea187" 163 79 }, 164 80 "@std/internal@1.0.12": { 165 81 "integrity": "972a634fd5bc34b242024402972cd5143eac68d8dffaca5eaa4dba30ce17b027" 166 - }, 167 - "@std/io@0.224.9": { 168 - "integrity": "4414664b6926f665102e73c969cfda06d2c4c59bd5d0c603fd4f1b1c840d6ee3" 169 82 }, 170 83 "@std/json@1.0.2": { 171 84 "integrity": "d9e5497801c15fb679f55a2c01c7794ad7a5dfda4dd1bebab5e409cb5e0d34d4" ··· 176 89 "jsr:@std/json" 177 90 ] 178 91 }, 179 - "@std/path@1.0.9": { 180 - "integrity": "260a49f11edd3db93dd38350bf9cd1b4d1366afa98e81b86167b4e3dd750129e" 181 - }, 182 - "@std/path@1.1.2": { 183 - "integrity": "c0b13b97dfe06546d5e16bf3966b1cadf92e1cc83e56ba5476ad8b498d9e3038", 184 - "dependencies": [ 185 - "jsr:@std/internal@^1.0.10" 186 - ] 187 - }, 188 92 "@std/streams@1.0.10": { 189 93 "integrity": "75c0b1431873cd0d8b3d679015220204d36d3c7420d93b60acfc379eb0dc30af" 190 94 }, 191 95 "@std/streams@1.0.13": { 192 96 "integrity": "772d208cd0d3e5dac7c1d9e6cdb25842846d136eea4a41a62e44ed4ab0c8dd9e" 193 97 }, 194 - "@std/text@1.0.16": { 195 - "integrity": "ddb9853b75119a2473857d691cf1ec02ad90793a2e8b4a4ac49d7354281a0cf8" 196 - }, 197 - "@ts-morph/common@0.27.0": { 198 - "integrity": "c7b73592d78ce8479b356fd4f3d6ec3c460d77753a8680ff196effea7a939052", 199 - "dependencies": [ 200 - "jsr:@std/fs@1", 201 - "jsr:@std/path@1" 202 - ] 203 - }, 204 - "@ts-morph/ts-morph@26.0.0": { 205 - "integrity": "f2b1ca67b4d1a6332d00c00dd48496b20879c899a702c1b92bcce1c552a168df", 206 - "dependencies": [ 207 - "jsr:@david/code-block-writer", 208 - "jsr:@ts-morph/common" 209 - ] 210 - }, 211 98 "@zod/zod@4.1.5": { 212 99 "integrity": "e995ca7d588a835ce333de626c940e242c55b6763c5190e8cbb9fefb7d0fb4ef" 213 100 }, ··· 216 103 } 217 104 }, 218 105 "npm": { 219 - "@atproto/api@0.18.0": { 220 - "integrity": "sha512-2GxKPhhvMocDjRU7VpNj+cvCdmCHVAmRwyfNgRLMrJtPZvrosFoi9VATX+7eKN0FZvYvy8KdLSkCcpP2owH3IA==", 221 - "dependencies": [ 222 - "@atproto/common-web", 223 - "@atproto/lexicon", 224 - "@atproto/syntax", 225 - "@atproto/xrpc", 226 - "await-lock", 227 - "multiformats@9.9.0", 228 - "tlds", 229 - "zod@3.25.76" 230 - ] 231 - }, 232 - "@atproto/common-web@0.4.3": { 233 - "integrity": "sha512-nRDINmSe4VycJzPo6fP/hEltBcULFxt9Kw7fQk6405FyAWZiTluYHlXOnU7GkQfeUK44OENG1qFTBcmCJ7e8pg==", 234 - "dependencies": [ 235 - "graphemer", 236 - "multiformats@9.9.0", 237 - "uint8arrays", 238 - "zod@3.25.76" 239 - ] 240 - }, 241 106 "@atproto/common@0.1.0": { 242 107 "integrity": "sha512-OB5tWE2R19jwiMIs2IjQieH5KTUuMb98XGCn9h3xuu6NanwjlmbCYMv08fMYwIp3UQ6jcq//84cDT3Bu6fJD+A==", 243 108 "dependencies": [ ··· 274 139 "uint8arrays" 275 140 ] 276 141 }, 277 - "@atproto/lexicon@0.5.1": { 278 - "integrity": "sha512-y8AEtYmfgVl4fqFxqXAeGvhesiGkxiy3CWoJIfsFDDdTlZUC8DFnZrYhcqkIop3OlCkkljvpSJi1hbeC1tbi8A==", 279 - "dependencies": [ 280 - "@atproto/common-web", 281 - "@atproto/syntax", 282 - "iso-datestring-validator", 283 - "multiformats@9.9.0", 284 - "zod@3.25.76" 285 - ] 286 - }, 287 - "@atproto/syntax@0.4.1": { 288 - "integrity": "sha512-CJdImtLAiFO+0z3BWTtxwk6aY5w4t8orHTMVJgkf++QRJWTxPbIFko/0hrkADB7n2EruDxDSeAgfUGehpH6ngw==" 289 - }, 290 - "@atproto/xrpc@0.7.5": { 291 - "integrity": "sha512-MUYNn5d2hv8yVegRL0ccHvTHAVj5JSnW07bkbiaz96UH45lvYNRVwt44z+yYVnb0/mvBzyD3/ZQ55TRGt7fHkA==", 292 - "dependencies": [ 293 - "@atproto/lexicon", 294 - "zod@3.25.76" 295 - ] 296 - }, 297 142 "@did-plc/lib@0.0.4": { 298 143 "integrity": "sha512-Omeawq3b8G/c/5CtkTtzovSOnWuvIuCI4GTJNrt1AmCskwEQV7zbX5d6km1mjJNbE0gHuQPTVqZxLVqetNbfwA==", 299 144 "dependencies": [ ··· 398 243 }, 399 244 "atomic-sleep@1.0.0": { 400 245 "integrity": "sha512-kNOjDqAh7px0XWNI+4QbzoiR/nTkHAWNud2uvnJquD1/x5a7EQZMJT0AczqK0Qn67oY/TTQ1LbUKajZpp3I9tQ==" 401 - }, 402 - "await-lock@2.2.2": { 403 - "integrity": "sha512-aDczADvlvTGajTDjcjpJMqRkOF6Qdz3YbPZm/PyW6tKPkx2hlYBzxMhEywM/tU72HrVZjgl5VCdRuMlA7pZ8Gw==" 404 246 }, 405 247 "axios@1.12.2": { 406 248 "integrity": "sha512-vMJzPewAlRyOgxV2dU0Cuz2O8zzzx9VYtbJOaBgXFeLc4IV/Eg50n4LowmehOOR61S8ZMpc2K5Sa7g6A4jfkUw==", ··· 695 537 "gopd@1.2.0": { 696 538 "integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==" 697 539 }, 698 - "graphemer@1.4.0": { 699 - "integrity": "sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==" 700 - }, 701 540 "has-symbols@1.1.0": { 702 541 "integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==" 703 542 }, ··· 761 600 }, 762 601 "ipaddr.js@1.9.1": { 763 602 "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==" 764 - }, 765 - "iso-datestring-validator@2.2.2": { 766 - "integrity": "sha512-yLEMkBbLZTlVQqOnQ4FiMujR6T4DEcCb1xizmvXS+OxuhwcbtynoosRzdMA69zZCShCNAbi+gJ71FxZBBXx1SA==" 767 603 }, 768 604 "key-encoder@2.0.3": { 769 605 "integrity": "sha512-fgBtpAGIr/Fy5/+ZLQZIPPhsZEcbSlYu/Wu96tNDFNSjSACw5lEIOFeaVdQ/iwrb8oxjlWi6wmWdH76hV6GZjg==", ··· 1137 973 "real-require" 1138 974 ] 1139 975 }, 1140 - "tlds@1.261.0": { 1141 - "integrity": "sha512-QXqwfEl9ddlGBaRFXIvNKK6OhipSiLXuRuLJX5DErz0o0Q0rYxulWLdFryTkV5PkdZct5iMInwYEGe/eR++1AA==", 1142 - "bin": true 1143 - }, 1144 976 "toidentifier@1.0.1": { 1145 977 "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==" 1146 978 }, ··· 1200 1032 "bytes": { 1201 1033 "dependencies": [ 1202 1034 "npm:multiformats@^13.4.1" 1203 - ] 1204 - }, 1205 - "cli": { 1206 - "dependencies": [ 1207 - "jsr:@cliffy/command@^1.0.0-rc.8", 1208 - "jsr:@cliffy/prompt@^1.0.0-rc.8", 1209 - "npm:@atproto/api@0.18" 1210 1035 ] 1211 1036 }, 1212 1037 "common": {
lex/schema/tests/array-agg.test.ts lex/schema/tests/array-agg_test.ts
lex/schema/tests/object.test.ts lex/schema/tests/object_test.ts