podns 1.0.2 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/parser.js +1 -1
- package/package.json +1 -1
- package/src/http.test.ts +1 -1
- package/src/parser.test.ts +4 -0
- package/src/parser.ts +1 -1
package/dist/parser.js
CHANGED
|
@@ -85,7 +85,7 @@ function parseRecord(record, silenceErrors = false) {
|
|
|
85
85
|
}
|
|
86
86
|
for (const i in parts) {
|
|
87
87
|
parts[i] = parts[i].trim();
|
|
88
|
-
if (
|
|
88
|
+
if (!parts[i] || [";", "!", "*", "/", "#"].some(c => parts[i].includes(c))) {
|
|
89
89
|
if (!silenceErrors) {
|
|
90
90
|
throw Error("fetched pronoun \"" + record + "\" contains invalid characters in its pronoun set");
|
|
91
91
|
}
|
package/package.json
CHANGED
package/src/http.test.ts
CHANGED
|
@@ -5,5 +5,5 @@ test("fetch pronouns from domain name & tld", async (t) => {
|
|
|
5
5
|
const pronouns = await getPronounsRecords("mauve.beer")
|
|
6
6
|
assert.equal(pronouns.includes("she/her;preferred"), true)
|
|
7
7
|
assert.equal(pronouns.includes("they/them"), true)
|
|
8
|
-
assert.equal(pronouns.length,
|
|
8
|
+
assert.equal(pronouns.length, 3)
|
|
9
9
|
})
|
package/src/parser.test.ts
CHANGED
|
@@ -41,10 +41,14 @@ test("parse wildcard and none", () => {
|
|
|
41
41
|
|
|
42
42
|
test("parse invalid tag", () => {
|
|
43
43
|
expect(() => parseRecord("she;meow")).toThrowError("fetched pronoun \"she;meow\" contains invalid tag(s)")
|
|
44
|
+
expect(() => parseRecord("she;/her;meow")).toThrowError("fetched pronoun \"she;/her;meow\" contains invalid tag(s)")
|
|
44
45
|
})
|
|
45
46
|
|
|
46
47
|
test("parse invalid pronoun set", () => {
|
|
47
48
|
expect(() => parseRecord("she/")).toThrowError("fetched pronoun \"she/\" contains invalid characters in its pronoun set")
|
|
49
|
+
expect(() => parseRecord("she/!her")).toThrowError("fetched pronoun \"she/!her\" contains invalid characters in its pronoun set")
|
|
50
|
+
expect(() => parseRecord("she/*her")).toThrowError("fetched pronoun \"she/*her\" contains invalid characters in its pronoun set")
|
|
51
|
+
expect(() => parseRecord("she/#her#meow")).toThrowError("fetched pronoun \"she/#her#meow\" contains invalid characters in its pronoun set")
|
|
48
52
|
})
|
|
49
53
|
|
|
50
54
|
test("parse return null if errors are silenced", () => {
|
package/src/parser.ts
CHANGED
|
@@ -85,7 +85,7 @@ export function parseRecord(record: string, silenceErrors = false): PronounRecor
|
|
|
85
85
|
|
|
86
86
|
for (const i in parts) {
|
|
87
87
|
parts[i]=parts[i].trim()
|
|
88
|
-
if (
|
|
88
|
+
if (!parts[i] || [";","!","*","/","#"].some(c=>parts[i].includes(c))) {
|
|
89
89
|
if (!silenceErrors) {
|
|
90
90
|
throw Error("fetched pronoun \"" + record +"\" contains invalid characters in its pronoun set")
|
|
91
91
|
} else {
|