shelving 1.170.2 → 1.171.0
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/markup/util/regexp.js +3 -3
- package/package.json +1 -1
- package/schema/Schema.d.ts +2 -0
package/markup/util/regexp.js
CHANGED
|
@@ -11,11 +11,11 @@ export const WORD_CONTENT_REGEXP = "[\\p{L}\\p{N}]+"; // Word content (at least
|
|
|
11
11
|
export const WORD_START_REGEXP = "(?<![\\p{L}\\p{N}])"; // Start of word (previous character is not a letter or number).
|
|
12
12
|
export const WORD_END_REGEXP = "(?![\\p{L}\\p{N}])"; // End of word (next character is not a letter or number).
|
|
13
13
|
export function getBlockRegExp(content, start = BLOCK_START_REGEXP, end = BLOCK_END_REGEXP) {
|
|
14
|
-
return new RegExp(`${start}${getRegExpSource(content)}${end}
|
|
14
|
+
return new RegExp(`${start}${getRegExpSource(content)}${end}`, "u");
|
|
15
15
|
}
|
|
16
16
|
export function getLineRegExp(content = LINE_CONTENT_REGEXP, end = LINE_END_REGEXP, start = LINE_START_REGEXP) {
|
|
17
|
-
return new RegExp(`${start}${getRegExpSource(content)}${end}
|
|
17
|
+
return new RegExp(`${start}${getRegExpSource(content)}${end}`, "u");
|
|
18
18
|
}
|
|
19
19
|
export function getWordRegExp(content = WORD_CONTENT_REGEXP, start = WORD_START_REGEXP, end = WORD_END_REGEXP) {
|
|
20
|
-
return new RegExp(`${start}${getRegExpSource(content)}${end}
|
|
20
|
+
return new RegExp(`${start}${getRegExpSource(content)}${end}`, "u");
|
|
21
21
|
}
|
package/package.json
CHANGED
package/schema/Schema.d.ts
CHANGED
|
@@ -37,6 +37,8 @@ export declare abstract class Schema<T = unknown> implements Validator<T> {
|
|
|
37
37
|
/** Every schema must implement a `validate()` method. */
|
|
38
38
|
abstract validate(unsafeValue: unknown): T;
|
|
39
39
|
}
|
|
40
|
+
/** Extract the type from a schema. */
|
|
41
|
+
export type SchemaType<X> = X extends Schema<infer Y> ? Y : never;
|
|
40
42
|
/** A set of named schemas in `{ name: schema }` format. */
|
|
41
43
|
export type Schemas<T extends Data = Data> = {
|
|
42
44
|
readonly [K in keyof T]: Schema<T[K]>;
|