mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-07 00:07:07 +00:00
add tr method
This commit is contained in:
Vendored
+6
@@ -80,6 +80,8 @@ declare namespace v {
|
||||
reverseGrapheme(subject?: string): string;
|
||||
slugify(subject?: string): string;
|
||||
splice(subject?: string, start?: number, deleteCount?: number, toAdd?: string): string;
|
||||
tr(subject?: string, from?: string, to?: string): string;
|
||||
tr(subject?: string, from?: { [key: string]: string }): string;
|
||||
trim(subject?: string, whitespace?: string): string;
|
||||
trimLeft(subject?: string, whitespace?: string): string;
|
||||
trimRight(subject?: string, whitespace?: string): string;
|
||||
@@ -177,6 +179,8 @@ declare namespace v {
|
||||
reverseGrapheme(): Chain;
|
||||
slugify(): Chain;
|
||||
splice(start?: number, deleteCount?: number, toAdd?: string): Chain;
|
||||
tr(from?: string, to?: string): Chain;
|
||||
tr(from?: { [key: string]: string }): Chain;
|
||||
trim(whitespace?: string): Chain;
|
||||
trimLeft(whitespace?: string): Chain;
|
||||
trimRight(whitespace?: string): Chain;
|
||||
@@ -270,6 +274,8 @@ declare namespace v {
|
||||
reverseGrapheme(): ExplicitChain<string>;
|
||||
slugify(): ExplicitChain<string>;
|
||||
splice(start?: number, deleteCount?: number, toAdd?: string): ExplicitChain<string>;
|
||||
tr(from?: string, to?: string): ExplicitChain<string>;
|
||||
tr(from?: { [key: string]: string }): ExplicitChain<string>;
|
||||
trim(whitespace?: string): ExplicitChain<string>;
|
||||
trimLeft(whitespace?: string): ExplicitChain<string>;
|
||||
trimRight(whitespace?: string): ExplicitChain<string>;
|
||||
|
||||
@@ -214,6 +214,23 @@ str = v.splice('new year', 0);
|
||||
str = v.splice('new year', 0, 4);
|
||||
str = v.splice('new year', 0, 3, 'happy');
|
||||
|
||||
str = v.tr();
|
||||
str = v.tr('hello', 'el', 'ip');
|
||||
str = v.tr('Yes. The fire rises.', {
|
||||
'Yes': 'Awesome',
|
||||
'fire': 'flame'
|
||||
})
|
||||
str = v('hello').tr('el', 'ip').value();
|
||||
str = v('Yes. The fire rises.').tr({
|
||||
'Yes': 'Awesome',
|
||||
'fire': 'flame'
|
||||
}).value();
|
||||
str = v.chain('hello').tr('el', 'ip').value();
|
||||
str = v.chain('Yes. The fire rises.').tr({
|
||||
'Yes': 'Awesome',
|
||||
'fire': 'flame'
|
||||
}).value();
|
||||
|
||||
str = v.trim();
|
||||
str = v.trim(' Mother nature ');
|
||||
str = v.trim('--Earth--', '-');
|
||||
|
||||
Reference in New Issue
Block a user