define()
Wrapper.define()
Wrapper.define()
Defines a new Wrapper
instance with the provided opening
, closing
chars, and optional text
.
public static define<
Opening extends string,
Closing extends string,
Text extends string = ''
>(
opening: Opening,
closing: Closing,
text?: Text
): Wrapper<Opening, Text, Closing> {
return new this(opening, closing, text);
}
Generic type variables
Opening
extends
string
Opening
extends
string
A generic type variable constrained by the string
, by default of the value captured from the provided opening
indicates the type of the opening in the Wrapper
via return type.
Closing
extends
string
Closing
extends
string
A generic type variable constrained by the string
, by default of the value captured from the provided closing
indicates the type of the closing in the Wrapper
via return type.
Text
extends
string
=
''
Text
extends
string
=
''
A generic type variable constrained by the string
, by default of the value captured from the provided text
indicates the type of the text in the Wrapper
via return type.
Parameters
opening: Opening
opening: Opening
The opening chars of generic type variable Opening
for new Wrapper
instance.
closing: Closing
closing: Closing
The closing chars of generic type variable Closing
for new Wrapper
instance.
text?: Text
text?: Text
An optional text of generic type variable Text
for new Wrapper
instance.
Return type
Wrapper<Opening, Text, Closing>
Wrapper<Opening, Text, Closing>
The return type is the Wrapper
object that takes generic type variables Opening
, Text
, and Closing
.
Returns
The return value is the Wrapper
instance of given opening
, closing
chars, and optional text
.
Example usage
// Example usage.
import { Wrapper } from '@angular-package/wrapper';
// Returns Wrapper {'()'}
// of type Wrapper<"(", "", ")">
Wrapper.define('(', ')');
// Returns Wrapper {'!!'}
// of type Wrapper<"!", "", "!">
Wrapper.define('!', '!');
// Returns Wrapper {'"This is quoted text"'}
// of type Wrapper<"\"", "This is quoted text", "\"">
Wrapper.define('"', '"', 'This is quoted text');
Last updated
Was this helpful?