mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-03 22:37:03 +00:00
joi: add missing 'truncate' and 'normalize' to StringSchema
This commit is contained in:
Vendored
+12
@@ -503,6 +503,18 @@ export interface StringSchema extends AnySchema {
|
||||
max(limit: number, encoding?: string): this;
|
||||
max(limit: Reference, encoding?: string): this;
|
||||
|
||||
/**
|
||||
* Specifies whether the string.max() limit should be used as a truncation.
|
||||
* @param enabled - optional parameter defaulting to true which allows you to reset the behavior of truncate by providing a falsy value.
|
||||
*/
|
||||
truncate(enabled?: boolean): this;
|
||||
|
||||
/**
|
||||
* Requires the string value to be in a unicode normalized form. If the validation convert option is on (enabled by default), the string will be normalized.
|
||||
* @param form - The unicode normalization form to use. Valid values: NFC [default], NFD, NFKC, NFKD
|
||||
*/
|
||||
normalize(form?: 'NFC' | 'NFD' | 'NFKC' | 'NFKD'): this;
|
||||
|
||||
/**
|
||||
* Requires the number to be a credit card number (Using Lunh Algorithm).
|
||||
*/
|
||||
|
||||
@@ -773,6 +773,10 @@ strSchema = strSchema.isoDate();
|
||||
strSchema = strSchema.lowercase();
|
||||
strSchema = strSchema.uppercase();
|
||||
strSchema = strSchema.trim();
|
||||
strSchema = strSchema.truncate();
|
||||
strSchema = strSchema.truncate(false);
|
||||
strSchema = strSchema.normalize();
|
||||
strSchema = strSchema.normalize('NFKC');
|
||||
|
||||
namespace common {
|
||||
strSchema = strSchema.allow(x);
|
||||
|
||||
Vendored
+13
@@ -501,6 +501,19 @@ export interface StringSchema extends AnySchema {
|
||||
max(limit: number, encoding?: string): this;
|
||||
max(limit: Reference, encoding?: string): this;
|
||||
|
||||
|
||||
/**
|
||||
* Specifies whether the string.max() limit should be used as a truncation.
|
||||
* @param enabled - optional parameter defaulting to true which allows you to reset the behavior of truncate by providing a falsy value.
|
||||
*/
|
||||
truncate(enabled?: boolean): this;
|
||||
|
||||
/**
|
||||
* Requires the string value to be in a unicode normalized form. If the validation convert option is on (enabled by default), the string will be normalized.
|
||||
* @param form - The unicode normalization form to use. Valid values: NFC [default], NFD, NFKC, NFKD
|
||||
*/
|
||||
normalize(form?: 'NFC' | 'NFD' | 'NFKC' | 'NFKD'): this;
|
||||
|
||||
/**
|
||||
* Requires the number to be a credit card number (Using Lunh Algorithm).
|
||||
*/
|
||||
|
||||
@@ -773,6 +773,10 @@ strSchema = strSchema.isoDate();
|
||||
strSchema = strSchema.lowercase();
|
||||
strSchema = strSchema.uppercase();
|
||||
strSchema = strSchema.trim();
|
||||
strSchema = strSchema.truncate();
|
||||
strSchema = strSchema.truncate(false);
|
||||
strSchema = strSchema.normalize();
|
||||
strSchema = strSchema.normalize('NFKC');
|
||||
|
||||
namespace common {
|
||||
strSchema = strSchema.allow(x);
|
||||
|
||||
Reference in New Issue
Block a user