Skip to content

Commit 82db0a3

Browse files
authored
🤖 Merge PR DefinitelyTyped#74487 Feature/add hyphen exceptions param by @jono-pov
1 parent c6ed865 commit 82db0a3

File tree

3 files changed

+23
-1
lines changed

3 files changed

+23
-1
lines changed

types/hyphen/hyphen-tests.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,11 @@ if (hyphenateEnUsSyncWithMinWordLength("sabotaging") !== "sabotaging") {
3939
// sabotaging has 10 chars => don't hyphenate
4040
throw new Error("Test failed");
4141
}
42+
43+
// Test with exceptions
44+
const hyphenateWithExceptions = createHyphenator(hyphenationPatternsEnGb, {
45+
exceptions: ["Bland-thorn"],
46+
}) as HyphenationFunctionSync;
47+
if (hyphenateWithExceptions("Blandthorn") !== "Bland-thorn") {
48+
throw new Error("Test failed");
49+
}

types/hyphen/index.d.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,13 @@ declare namespace hyphen {
4343
* @default 5
4444
*/
4545
minWordLength?: number | undefined;
46+
47+
/**
48+
* An array of values with exceptions of hyphenation in words.
49+
* Hard hyphen symbol `-` should be used to mark the position of further configured hyphenation symbol.
50+
* @default []
51+
*/
52+
exceptions?: string[] | undefined;
4653
}
4754

4855
/**
@@ -66,6 +73,13 @@ declare namespace hyphen {
6673
* @default 5
6774
*/
6875
minWordLength?: number | undefined;
76+
77+
/**
78+
* An array of values with exceptions of hyphenation in words.
79+
* Hard hyphen symbol `-` should be used to mark the position of further configured hyphenation symbol.
80+
* @default []
81+
*/
82+
exceptions?: string[] | undefined;
6983
}
7084

7185
/**

types/hyphen/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"private": true,
33
"name": "@types/hyphen",
4-
"version": "1.6.9999",
4+
"version": "1.14.9999",
55
"projects": [
66
"https://github.com/ytiurin/hyphen"
77
],

0 commit comments

Comments
 (0)