Instance methods
Public
Wrapper.prototype.isTextWrapped()
The method checks if the provided text is wrapped with the wrap of the specified Wrapper object.
public isTextWrapped<Text extends string>(text: Text): text is Text {
return this.textHasClosing(text) && this.textHasOpening(text);
}Text extends string
A generic type variable constrained by the string, by default of the value captured from the provided text parameter, confirms the text type via the return type.
Parameters
text: Text
The text of a generic type variable Text to check whether it is wrapped.
Returns
The return value is a boolean indicating whether the provided text is wrapped.
Example usage
// Example usage.
import { Wrapper } from '@angular-package/text';
// Returns true of text is "[quote]"
new Wrapper(`[`, `]`).isTextWrapped(`[quote]`);Wrapper.prototype.textHasClosing()
Checks if the provided text has a closing of the specified Wrapper object.
Text extends string
A generic type variable constrained by the string, by default of the value captured from the provided text parameter, confirms the text type via the return type.
Parameters
text: Text
The text to test against the existence of the closing.
Returns
The return value is a boolean indicating whether the given text has the closing of the wrap.
Example usage
Wrapper.prototype.textHasOpening()
Checks if the provided text has an opening of the specified Wrapper object.
Text extends string
A generic type variable constrained by the string, by default of the value captured from the provided text parameter, confirms the text type via the return type.
Parameters
text: Text
The text to test against the existence of the opening.
Returns
The return value is a boolean indicating whether the given text has the opening of the wrap.
Example usage
Wrapper.prototype.unwrapText()
Returns the unwrapped text, without the opening and closing of the Wrapper.
Parameters
text: string
The text to unwrap.
Returns
The return value is the unwrapped text of a string if the opening or closing is found or the given text.
Example usage
Wrapper.prototype.wrapText()
Wraps specific text with the wrap, the opening, and closing of the Wrapper object.
Parameters
text: Text
The text of a generic type variable Text, to be wrapped.
Returns
The return value is a new instance of Wrapped type consisting of the wrapped text.
Example usage
Last updated