@chr33s/pdf-unicode-properties 5.0.6 → 5.0.7
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/index.d.ts +27 -2
- package/dist/index.js +6 -2
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
- package/src/index.ts +27 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,20 +1,41 @@
|
|
|
1
|
+
/** Function that returns a string property value for a given Unicode code point. */
|
|
1
2
|
export type PropertyAccessor = (codePoint: number) => string;
|
|
3
|
+
/** Function that returns a numeric value for a given Unicode code point, or null if none. */
|
|
2
4
|
export type NumericAccessor = (codePoint: number) => number | null;
|
|
5
|
+
/** Function that tests whether a Unicode code point has a specific property. */
|
|
3
6
|
export type PropertyPredicate = (codePoint: number) => boolean;
|
|
7
|
+
/**
|
|
8
|
+
* Unicode property lookup API.
|
|
9
|
+
* Provides efficient access to Unicode categories, scripts, combining classes, and property predicates.
|
|
10
|
+
*/
|
|
4
11
|
export type UnicodePropertiesAPI = {
|
|
12
|
+
/** Returns the General Category (e.g., "Lu", "Ll", "Nd") for a code point. */
|
|
5
13
|
getCategory: PropertyAccessor;
|
|
14
|
+
/** Returns the Canonical Combining Class for a code point. */
|
|
6
15
|
getCombiningClass: PropertyAccessor;
|
|
16
|
+
/** Returns the Script property (e.g., "Latin", "Cyrillic") for a code point. */
|
|
7
17
|
getScript: PropertyAccessor;
|
|
18
|
+
/** Returns the East Asian Width property (e.g., "W", "N", "A") for a code point. */
|
|
8
19
|
getEastAsianWidth: PropertyAccessor;
|
|
20
|
+
/** Returns the numeric value of a code point, or null if not a numeric character. */
|
|
9
21
|
getNumericValue: NumericAccessor;
|
|
22
|
+
/** Tests if the code point is alphabetic (Lu, Ll, Lt, Lm, Lo, or Nl). */
|
|
10
23
|
isAlphabetic: PropertyPredicate;
|
|
24
|
+
/** Tests if the code point is a decimal digit (Nd). */
|
|
11
25
|
isDigit: PropertyPredicate;
|
|
26
|
+
/** Tests if the code point is punctuation (Pc, Pd, Pe, Pf, Pi, Po, or Ps). */
|
|
12
27
|
isPunctuation: PropertyPredicate;
|
|
28
|
+
/** Tests if the code point is lowercase (Ll). */
|
|
13
29
|
isLowerCase: PropertyPredicate;
|
|
30
|
+
/** Tests if the code point is uppercase (Lu). */
|
|
14
31
|
isUpperCase: PropertyPredicate;
|
|
32
|
+
/** Tests if the code point is titlecase (Lt). */
|
|
15
33
|
isTitleCase: PropertyPredicate;
|
|
34
|
+
/** Tests if the code point is whitespace (Zs, Zl, or Zp). */
|
|
16
35
|
isWhiteSpace: PropertyPredicate;
|
|
36
|
+
/** Tests if the code point is a base form (letters, numbers, or spacing marks). */
|
|
17
37
|
isBaseForm: PropertyPredicate;
|
|
38
|
+
/** Tests if the code point is a combining mark (Mn, Me, or Mc). */
|
|
18
39
|
isMark: PropertyPredicate;
|
|
19
40
|
};
|
|
20
41
|
/**
|
|
@@ -32,8 +53,12 @@ export declare function isInitialized(): boolean;
|
|
|
32
53
|
*/
|
|
33
54
|
export declare function getUnicodeProperties(): UnicodePropertiesAPI;
|
|
34
55
|
/**
|
|
35
|
-
* Proxy object
|
|
36
|
-
*
|
|
56
|
+
* Proxy object providing synchronous access to Unicode property lookup functions.
|
|
57
|
+
* Throws if accessed before {@link createUnicodeProperties} has resolved.
|
|
58
|
+
* @example
|
|
59
|
+
* await createUnicodeProperties();
|
|
60
|
+
* unicode.getCategory(0x41); // "Lu"
|
|
61
|
+
* unicode.isAlphabetic(0x41); // true
|
|
37
62
|
*/
|
|
38
63
|
export declare const unicode: UnicodePropertiesAPI;
|
|
39
64
|
export default createUnicodeProperties;
|
package/dist/index.js
CHANGED
|
@@ -172,8 +172,12 @@ export function getUnicodeProperties() {
|
|
|
172
172
|
return instance;
|
|
173
173
|
}
|
|
174
174
|
/**
|
|
175
|
-
* Proxy object
|
|
176
|
-
*
|
|
175
|
+
* Proxy object providing synchronous access to Unicode property lookup functions.
|
|
176
|
+
* Throws if accessed before {@link createUnicodeProperties} has resolved.
|
|
177
|
+
* @example
|
|
178
|
+
* await createUnicodeProperties();
|
|
179
|
+
* unicode.getCategory(0x41); // "Lu"
|
|
180
|
+
* unicode.isAlphabetic(0x41); // true
|
|
177
181
|
*/
|
|
178
182
|
export const unicode = new Proxy({}, {
|
|
179
183
|
get(_target, prop) {
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,WAAW,MAAM,0BAA0B,CAAC;AAEnD,OAAO,kBAAkB,MAAM,WAAW,CAAC;AAC3C,OAAO,kBAAkB,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,WAAW,MAAM,0BAA0B,CAAC;AAEnD,OAAO,kBAAkB,MAAM,WAAW,CAAC;AAC3C,OAAO,kBAAkB,MAAM,WAAW,CAAC;AAgB3C,MAAM,YAAY,GAAG,CAAC,OAAe,EAAc,EAAE,CAAC,IAAI,UAAU,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC;AAE7F,MAAM,WAAW,GAAG,IAAI,WAAW,EAAE,CAAC;AACtC,MAAM,WAAW,GAAG,KAAK,EAAK,OAAe,EAAc,EAAE,CAC3D,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,MAAM,CAAC,MAAM,OAAO,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;AAEvE,MAAM,aAAa,GAAG,CAAC,OAAe,EAAuB,EAAE,CAAC,OAAO,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC;AAE/F,MAAM,IAAI,GAAG,CAAC,K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AACrB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,aAAa;IAC3B,OAAO,QAAQ,KAAK,IAAI,CAAC;AAC3B,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,oBAAoB;IAClC,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,MAAM,IAAI,KAAK,CACb,gGAAgG,CACjG,CAAC;IACJ,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,OAAO,GAAyB,IAAI,KAAK,CAAC,EAA0B,EAAE;IACjF,GAAG,CAAC,OAAO,EAAE,IAAgC;QAC3C,IAAI,CAAC,QAAQ,EAAE,CAAC;YACd,MAAM,IAAI,KAAK,CACb,8FAA8F,MAAM,CAAC,IAAI,CAAC,IAAI,CAC/G,CAAC;QACJ,CAAC;QACD,OAAO,QAAQ,CAAC,IAAI,CAAC,CAAC;IACxB,CAAC;CACF,CAAC,CAAC;AAEH,eAAe,uBAAuB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chr33s/pdf-unicode-properties",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.7",
|
|
4
4
|
"description": "Provides fast access to unicode character properties",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -22,11 +22,11 @@
|
|
|
22
22
|
"typecheck": "tsc --project tsconfig.typecheck.json"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@chr33s/pdf-common": "5.0.
|
|
26
|
-
"@chr33s/pdf-unicode-trie": "5.0.
|
|
25
|
+
"@chr33s/pdf-common": "5.0.7",
|
|
26
|
+
"@chr33s/pdf-unicode-trie": "5.0.7"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"@chr33s/pdf-codepoints": "5.0.
|
|
29
|
+
"@chr33s/pdf-codepoints": "5.0.7",
|
|
30
30
|
"@types/node": "24.10.1",
|
|
31
31
|
"@vitest/coverage-v8": "4.0.15",
|
|
32
32
|
"typescript": "5.9.3",
|
package/src/index.ts
CHANGED
|
@@ -11,8 +11,11 @@ type UnicodeDataset = {
|
|
|
11
11
|
eaw: string[];
|
|
12
12
|
};
|
|
13
13
|
|
|
14
|
+
/** Function that returns a string property value for a given Unicode code point. */
|
|
14
15
|
export type PropertyAccessor = (codePoint: number) => string;
|
|
16
|
+
/** Function that returns a numeric value for a given Unicode code point, or null if none. */
|
|
15
17
|
export type NumericAccessor = (codePoint: number) => number | null;
|
|
18
|
+
/** Function that tests whether a Unicode code point has a specific property. */
|
|
16
19
|
export type PropertyPredicate = (codePoint: number) => boolean;
|
|
17
20
|
|
|
18
21
|
const decodeBase64 = (encoded: string): Uint8Array => new Uint8Array(base64.decode(encoded));
|
|
@@ -26,20 +29,38 @@ const inflateBinary = (encoded: string): Promise<Uint8Array> => inflate(decodeBa
|
|
|
26
29
|
const log2 = (value: number): number => Math.log2?.(value) ?? Math.log(value) / Math.LN2;
|
|
27
30
|
const bits = (value: number): number => (value > 0 ? (log2(value) + 1) | 0 : 0);
|
|
28
31
|
|
|
32
|
+
/**
|
|
33
|
+
* Unicode property lookup API.
|
|
34
|
+
* Provides efficient access to Unicode categories, scripts, combining classes, and property predicates.
|
|
35
|
+
*/
|
|
29
36
|
export type UnicodePropertiesAPI = {
|
|
37
|
+
/** Returns the General Category (e.g., "Lu", "Ll", "Nd") for a code point. */
|
|
30
38
|
getCategory: PropertyAccessor;
|
|
39
|
+
/** Returns the Canonical Combining Class for a code point. */
|
|
31
40
|
getCombiningClass: PropertyAccessor;
|
|
41
|
+
/** Returns the Script property (e.g., "Latin", "Cyrillic") for a code point. */
|
|
32
42
|
getScript: PropertyAccessor;
|
|
43
|
+
/** Returns the East Asian Width property (e.g., "W", "N", "A") for a code point. */
|
|
33
44
|
getEastAsianWidth: PropertyAccessor;
|
|
45
|
+
/** Returns the numeric value of a code point, or null if not a numeric character. */
|
|
34
46
|
getNumericValue: NumericAccessor;
|
|
47
|
+
/** Tests if the code point is alphabetic (Lu, Ll, Lt, Lm, Lo, or Nl). */
|
|
35
48
|
isAlphabetic: PropertyPredicate;
|
|
49
|
+
/** Tests if the code point is a decimal digit (Nd). */
|
|
36
50
|
isDigit: PropertyPredicate;
|
|
51
|
+
/** Tests if the code point is punctuation (Pc, Pd, Pe, Pf, Pi, Po, or Ps). */
|
|
37
52
|
isPunctuation: PropertyPredicate;
|
|
53
|
+
/** Tests if the code point is lowercase (Ll). */
|
|
38
54
|
isLowerCase: PropertyPredicate;
|
|
55
|
+
/** Tests if the code point is uppercase (Lu). */
|
|
39
56
|
isUpperCase: PropertyPredicate;
|
|
57
|
+
/** Tests if the code point is titlecase (Lt). */
|
|
40
58
|
isTitleCase: PropertyPredicate;
|
|
59
|
+
/** Tests if the code point is whitespace (Zs, Zl, or Zp). */
|
|
41
60
|
isWhiteSpace: PropertyPredicate;
|
|
61
|
+
/** Tests if the code point is a base form (letters, numbers, or spacing marks). */
|
|
42
62
|
isBaseForm: PropertyPredicate;
|
|
63
|
+
/** Tests if the code point is a combining mark (Mn, Me, or Mc). */
|
|
43
64
|
isMark: PropertyPredicate;
|
|
44
65
|
};
|
|
45
66
|
|
|
@@ -245,8 +266,12 @@ export function getUnicodeProperties(): UnicodePropertiesAPI {
|
|
|
245
266
|
}
|
|
246
267
|
|
|
247
268
|
/**
|
|
248
|
-
* Proxy object
|
|
249
|
-
*
|
|
269
|
+
* Proxy object providing synchronous access to Unicode property lookup functions.
|
|
270
|
+
* Throws if accessed before {@link createUnicodeProperties} has resolved.
|
|
271
|
+
* @example
|
|
272
|
+
* await createUnicodeProperties();
|
|
273
|
+
* unicode.getCategory(0x41); // "Lu"
|
|
274
|
+
* unicode.isAlphabetic(0x41); // true
|
|
250
275
|
*/
|
|
251
276
|
export const unicode: UnicodePropertiesAPI = new Proxy({} as UnicodePropertiesAPI, {
|
|
252
277
|
get(_target, prop: keyof UnicodePropertiesAPI) {
|